Merge "Changed practice robot pot offset."
diff --git a/WORKSPACE b/WORKSPACE
index 0ae306c..4a57e1b 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -159,14 +159,6 @@
url = "http://frc971.org/Build-Dependencies/allwpilib_ni-libraries_57e9fb3.tar.gz",
)
-new_http_archive(
- name = "allwpilib_ni_libraries_repo_2017",
- build_file = "debian/ni-libraries-2017.BUILD",
- sha256 = "67c1ad365fb712cc0acb0bf43465b831030523dc6f88daa02626994f644d91eb",
- strip_prefix = "ni-libraries",
- url = "http://frc971.org/Build-Dependencies/allwpilib_ni-libraries_e375b4a.tar.gz",
-)
-
# Downloaded from:
# https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz
new_http_archive(
diff --git a/debian/ni-libraries-2017.BUILD b/debian/ni-libraries-2017.BUILD
deleted file mode 100644
index fcd8988..0000000
--- a/debian/ni-libraries-2017.BUILD
+++ /dev/null
@@ -1,21 +0,0 @@
-cc_library(
- name = 'ni-libraries',
- visibility = ['//visibility:public'],
- srcs = [
- 'lib/libFRC_NetworkCommunication.so.17.0.0',
- 'lib/libRoboRIO_FRC_ChipObject.so.17.0.0',
- 'lib/libNiFpgaLv.so.16.0.0',
- 'lib/libNiFpga.so.16.0.0',
- 'lib/libNiRioSrv.so.16.0.0',
- 'lib/libspi.so.1.0.0',
- 'lib/libi2c.so.2.0.0',
- 'lib/libniriosession.so.16.0.0',
- 'lib/libniriodevenum.so.16.0.0',
- ],
- includes = [
- 'include',
- ],
- hdrs = glob(['include/**']),
- linkstatic = True,
- restricted_to = ['@//tools:roborio'],
-)
diff --git a/third_party/allwpilib_2017/.clang-format b/third_party/allwpilib_2017/.clang-format
deleted file mode 100644
index ed38227..0000000
--- a/third_party/allwpilib_2017/.clang-format
+++ /dev/null
@@ -1,89 +0,0 @@
----
-Language: Cpp
-BasedOnStyle: Google
-AccessModifierOffset: -1
-AlignAfterOpenBracket: Align
-AlignConsecutiveAssignments: false
-AlignConsecutiveDeclarations: false
-AlignEscapedNewlinesLeft: true
-AlignOperands: true
-AlignTrailingComments: true
-AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
-AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: All
-AllowShortIfStatementsOnASingleLine: true
-AllowShortLoopsOnASingleLine: true
-AlwaysBreakAfterDefinitionReturnType: None
-AlwaysBreakAfterReturnType: None
-AlwaysBreakBeforeMultilineStrings: true
-AlwaysBreakTemplateDeclarations: true
-BinPackArguments: true
-BinPackParameters: true
-BraceWrapping:
- AfterClass: false
- AfterControlStatement: false
- AfterEnum: false
- AfterFunction: false
- AfterNamespace: false
- AfterObjCDeclaration: false
- AfterStruct: false
- AfterUnion: false
- BeforeCatch: false
- BeforeElse: false
- IndentBraces: false
-BreakBeforeBinaryOperators: None
-BreakBeforeBraces: Attach
-BreakBeforeTernaryOperators: true
-BreakConstructorInitializersBeforeComma: false
-ColumnLimit: 80
-CommentPragmas: '^ IWYU pragma:'
-ConstructorInitializerAllOnOneLineOrOnePerLine: true
-ConstructorInitializerIndentWidth: 4
-ContinuationIndentWidth: 4
-Cpp11BracedListStyle: true
-DerivePointerAlignment: false
-DisableFormat: false
-ExperimentalAutoDetectBinPacking: false
-ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
-IncludeCategories:
- - Regex: '^<.*\.h>'
- Priority: 1
- - Regex: '^<.*'
- Priority: 2
- - Regex: '.*'
- Priority: 3
-IndentCaseLabels: true
-IndentWidth: 2
-IndentWrappedFunctionNames: false
-KeepEmptyLinesAtTheStartOfBlocks: false
-MacroBlockBegin: ''
-MacroBlockEnd: ''
-MaxEmptyLinesToKeep: 1
-NamespaceIndentation: None
-ObjCBlockIndentWidth: 2
-ObjCSpaceAfterProperty: false
-ObjCSpaceBeforeProtocolList: false
-PenaltyBreakBeforeFirstCallParameter: 1
-PenaltyBreakComment: 300
-PenaltyBreakFirstLessLess: 120
-PenaltyBreakString: 1000
-PenaltyExcessCharacter: 1000000
-PenaltyReturnTypeOnItsOwnLine: 200
-PointerAlignment: Left
-ReflowComments: true
-SortIncludes: true
-SpaceAfterCStyleCast: false
-SpaceBeforeAssignmentOperators: true
-SpaceBeforeParens: ControlStatements
-SpaceInEmptyParentheses: false
-SpacesBeforeTrailingComments: 2
-SpacesInAngles: false
-SpacesInContainerLiterals: true
-SpacesInCStyleCastParentheses: false
-SpacesInParentheses: false
-SpacesInSquareBrackets: false
-Standard: Auto
-TabWidth: 8
-UseTab: Never
-...
diff --git a/third_party/allwpilib_2017/.gitignore b/third_party/allwpilib_2017/.gitignore
deleted file mode 100644
index 3f409ac..0000000
--- a/third_party/allwpilib_2017/.gitignore
+++ /dev/null
@@ -1,192 +0,0 @@
-# WPIlib Specific
-
-dependency-reduced-pom.xml
-/wpilibj/src/athena/cpp/nivision/*.c
-/wpilibj/src/athena/cpp/nivision/*.cpp
-/wpilibj/src/athena/cpp/nivision/*.s
-/wpilibj/src/athena/cpp/nivision/*_arm.ini
-/wpilibj/src/athena/cpp/nivision/*.java
-/wpilibj/src/athena/cpp/nivision/nivision_funcs.txt
-/wpilibj/src/athena/cpp/nivision/imaqdx_funcs.txt
-/wpilibj/src/shared/java/edu/wpi/first/wpilibj/util/WPILibVersion.java
-/wpilibc/shared/src/WPILibVersion.cpp
-doxygen.log
-
-# Created by the jenkins test script
-test-reports
-
-# IntelliJ
-*.iml
-.idea/
-
-# Created by http://www.gitignore.io
-
-### Linux ###
-*~
-
-# KDE directory preferences
-.directory
-
-
-### Windows ###
-# Windows image file caches
-Thumbs.db
-ehthumbs.db
-
-# Folder config file
-Desktop.ini
-
-# Recycle Bin used on file shares
-$RECYCLE.BIN/
-
-# Windows Installer files
-*.cab
-*.msi
-*.msm
-*.msp
-
-
-### OSX ###
-.DS_Store
-.AppleDouble
-.LSOverride
-
-# Icon must end with two \r
-Icon
-
-
-# Thumbnails
-._*
-
-# Files that might appear on external disk
-.Spotlight-V100
-.Trashes
-
-# Directories potentially created on remote AFP share
-.AppleDB
-.AppleDesktop
-Network Trash Folder
-Temporary Items
-.apdisk
-
-
-### Java ###
-*.class
-
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
-
-# Package Files #
-*.jar
-*.war
-*.ear
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
-
-
-### C++ ###
-# Compiled Object files
-*.slo
-*.lo
-*.o
-*.obj
-
-# Compiled Dynamic libraries
-*.dylib
-*.dll
-
-# Fortran module files
-*.mod
-
-# Compiled Static libraries
-*.lai
-*.la
-*.a
-*.lib
-
-# Executables
-*.exe
-*.out
-*.app
-
-
-### Maven ###
-target/
-pom.xml.tag
-pom.xml.releaseBackup
-pom.xml.versionsBackup
-pom.xml.next
-release.properties
-
-
-### CMake ###
-CMakeCache.txt
-CMakeFiles
-cmake_install.cmake
-install_manifest.txt
-
-
-### Gradle ###
-.gradle
-build/
-
-# Ignore Gradle GUI config
-gradle-app.setting
-
-
-### Vagrant ###
-.vagrant/
-
-
-### Eclipse ###
-*.pydevproject
-.metadata
-.gradle
-bin/
-tmp/
-*.tmp
-*.bak
-*.swp
-*~.nib
-local.properties
-.settings/
-.loadpath
-
-### Python ###
-*.pyc
-__pycache__
-
-# External tool builders
-.externalToolBuilders/
-
-# Locally stored "Eclipse launch configurations"
-*.launch
-
-# CDT-specific
-.cproject
-
-# PDT-specific
-.buildpath
-
-# sbteclipse plugin
-.target
-
-# TeXlipse plugin
-.texlipse
-
-#catkin stuff
-package.xml
-
-# Doxygen stuff
-NO
-
-# Simulation folder stuff
-!simulation/install_resources/*
-
-# VSCode
-.vscode/
-
-#classpaths and projects
-.project
-.classpath
diff --git a/third_party/allwpilib_2017/.styleguide b/third_party/allwpilib_2017/.styleguide
deleted file mode 100644
index 5b9874e..0000000
--- a/third_party/allwpilib_2017/.styleguide
+++ /dev/null
@@ -1,65 +0,0 @@
-cExtensions {
-}
-
-cppHeaderExtensions {
- h
- inc
-}
-
-cppSrcExtensions {
- cpp
-}
-
-otherExtensions {
- java
-}
-
-genFolderExclude {
- FRC_FPGA_ChipObject
- NetworkCommunication
- ctre
- frccansae
- gtest
- i2clib
- msgs
- ni-libraries
- ni/vision
- spilib
- wpilibj/src/athena/cpp/nivision
- visa
-}
-
-genFileExclude {
- NIIMAQdx\.h$
- can_proto\.h$
- nivision\.h$
-}
-
-modifiableFolderExclude {
- \.git
- wpilibj/src/athena/cpp/include
- wpilibj/src/athena/cpp/lib
-}
-
-modifiableFileExclude {
- \.patch$
- \.png$
- \.py$
- \.so$
-}
-
-includeRelated {
-}
-
-includeCSys {
-}
-
-includeCppSys {
-}
-
-includeOtherLibs {
-}
-
-includeProject {
- ^ctre/
-}
diff --git a/third_party/allwpilib_2017/.styleguide-license b/third_party/allwpilib_2017/.styleguide-license
deleted file mode 100644
index 0bb7710..0000000
--- a/third_party/allwpilib_2017/.styleguide-license
+++ /dev/null
@@ -1,6 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST {year}. All Rights Reserved.{padding}*/
-/* 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. */
-/*----------------------------------------------------------------------------*/
diff --git a/third_party/allwpilib_2017/.travis.yml b/third_party/allwpilib_2017/.travis.yml
deleted file mode 100644
index 2c6eeed..0000000
--- a/third_party/allwpilib_2017/.travis.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-sudo: required
-dist: trusty
-language: java
-
-before_install:
- - sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
- - wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
- - sudo add-apt-repository ppa:wpilib/toolchain -y
- - sudo apt-get update -q || true
- - sudo apt-get install frc-toolchain libgazebo7-dev protobuf-compiler libprotobuf-dev python3 clang-format-3.8 -y
-install:
- - pip3 install wpiformat
-
-before_cache:
- - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
-cache:
- directories:
- - $HOME/.gradle/caches/
- - $HOME/.gradle/wrapper/
-
-script:
- - wpiformat
- - git --no-pager diff --exit-code HEAD # Ensure formatter made no changes
- - ./gradlew build -PmakeSim
diff --git a/third_party/allwpilib_2017/BUILD b/third_party/allwpilib_2017/BUILD
deleted file mode 100644
index 31ac4a8..0000000
--- a/third_party/allwpilib_2017/BUILD
+++ /dev/null
@@ -1,134 +0,0 @@
-licenses(['notice'])
-
-genrule(
- name = 'wpilib_version',
- outs = ['shared/src/WPILibVersion.cpp'],
- cmd = '\n'.join([
- "cat > \"$@\" << EOF",
- "// Autogenerated file! Do not manually edit this file.",
- "#include \"WPILibVersion.h\"",
- "const char *WPILibVersion = \"2017-frc971\";",
- "EOF",
- ]),
-)
-
-_header_dirs = [
- 'wpilibc/shared/include',
- 'wpilibc/athena/include',
- 'hal/include',
- 'hal/lib/athena',
-]
-
-# Names of WPILib "devices" I don't want to deal with making trivial updates to
-# chop out various ugliness or have to vet for sanity.
-_excluded_devices = [
- 'ADXL345_I2C',
- 'GearTooth',
- 'Ultrasonic',
- 'Victor',
- 'TalonSRX',
- 'CANTalon',
- 'CANJaguar',
- 'PIDController',
- 'Spark',
- 'SD540',
- 'RobotDrive',
- 'Jaguar',
- 'ADXL345_SPI',
- 'DoubleSolenoid',
- 'AnalogPotentiometer',
- 'ADXL362',
- 'AnalogGyro',
- 'AnalogAccelerometer',
- 'CameraServer',
- 'ADXRS450_Gyro',
- 'GyroBase',
- 'IterativeRobot',
- 'MotorSafety',
- 'MotorSafetyHelper',
- 'SafePWM',
- 'SpeedController',
- 'PWMSpeedController',
- 'SerialPort',
- 'OSSerialPort',
- 'SerialHelper',
- 'XboxController',
- 'GenericHID',
- 'GamepadBase',
- 'PIDSource',
- 'Potentiometer',
- 'JoystickBase',
- 'Joystick',
- 'Log',
- 'CANSpeedController',
- 'visa',
-]
-
-# Whole subdirectories of WPILib we don't want around.
-_excluded_directories = [
- 'SmartDashboard',
- 'LiveWindow',
- 'Commands',
- 'Buttons',
- 'Filters',
- 'LabView',
- 'vision',
-]
-
-# Header files we don't want to have.
-_bad_hdrs = ([
- 'wpilibc/athena/include/WPILib.h',
- 'hal/include/HAL/LabVIEW/HAL.h',
- 'wpilibc/**/Accelerometer.*',
-] + ['**/%s/**' % d for d in _excluded_directories] +
- ['**/%s.*' % d for d in _excluded_devices])
-_h_hdrs = glob([d + '/**/*.h' for d in _header_dirs], exclude=_bad_hdrs)
-_hpp_hdrs = glob([d + '/**/*.hpp' for d in _header_dirs], exclude=_bad_hdrs)
-
-cc_library(
- name = 'wpilib',
- visibility = ['//third_party:__pkg__'],
- srcs = glob([
- 'wpilibc/athena/src/*.cpp',
- 'wpilibc/athena/src/Internal/*.cpp',
- 'wpilibc/shared/src/**/*.cpp',
-
- 'hal/lib/athena/*.cpp',
- 'hal/lib/athena/cpp/*.cpp',
- 'hal/lib/athena/ctre/*.cpp',
- 'hal/lib/shared/handles/*.cpp',
- ], exclude = (
- ['**/%s/**' % d for d in _excluded_directories] +
- ['**/%s.*' % d for d in _excluded_devices] + [
- 'wpilibc/**/Accelerometer.*',
- ])) + [
- ':wpilib_version',
- ],
- copts = [
- '-Wno-unused-parameter',
- '-Wno-switch-enum',
- '-Wno-attributes',
- '-Wno-cast-align',
- '-Wno-cast-qual',
- '-Wno-deprecated-declarations',
- '-Wno-error',
- '-Wno-unused-const-variable',
- ],
- deps = [
- '//third_party/ntcore_2017:ntcore',
- '@allwpilib_ni_libraries_repo_2017//:ni-libraries',
- '//aos/logging',
- ],
- hdrs = _h_hdrs + _hpp_hdrs + [
- 'wpilibc/shared/include/CircularBuffer.inc',
- 'wpilibc/athena/include/Task.inc',
- ],
- includes = _header_dirs,
- linkopts = [
- '-lpthread',
- ],
- defines = [
- 'WPILIB2017=1',
- ],
- restricted_to = ['//tools:roborio'],
-)
diff --git a/third_party/allwpilib_2017/CMakeLists.txt b/third_party/allwpilib_2017/CMakeLists.txt
deleted file mode 100644
index 7025762..0000000
--- a/third_party/allwpilib_2017/CMakeLists.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-project(AllC++Sim)
-
-include(CheckCXXCompilerFlag)
-include (FindPkgConfig)
-include(GNUInstallDirs)
-
-#check for depenedencies
-find_package(gazebo REQUIRED)
-find_package(Boost COMPONENTS system filesystem REQUIRED)
-
-#on windows we produce .dlls with no prefix
-if(WIN32)
- #allows us to define constexpr and noexcept in macros
- #since msvc 2013 doesn't support them
- add_definitions(-D_ALLOW_KEYWORD_MACROS)
-
- # defines things like M_PI
- add_definitions(-D_USE_MATH_DEFINES)
-
- # get rid of min max macros on windows
- add_definitions(-DNOMINMAX)
-
- add_definitions(-DWIN32_LEAN_AND_MEAN)
-
- SET(CMAKE_FIND_LIBRARY_PREFIXES "")
- SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
-endif()
-
-if (MSVC)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFRC_SIMULATOR /MDd /Zi")
-else ()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++1y -DFRC_SIMULATOR -Wno-unused-parameter -pthread -fPIC -fpermissive")
-endif()
-
-include_directories("build")
-add_subdirectory(simulation/gz_msgs)
-add_subdirectory(wpilibc/sim)
-add_subdirectory(simulation/frc_gazebo_plugins)
diff --git a/third_party/allwpilib_2017/CONTRIBUTING.md b/third_party/allwpilib_2017/CONTRIBUTING.md
deleted file mode 100644
index 6e186a1..0000000
--- a/third_party/allwpilib_2017/CONTRIBUTING.md
+++ /dev/null
@@ -1,56 +0,0 @@
-# Contributing to WPILib
-
-So you want to contribute your changes back to WPILib. Great! We have a few contributing rules that will help you make sure your changes will be accepted into the project. Please remember to follow the rules written here, and behave with Gracious Professionalism.
-
-- [General Contribution Rules](#general-contribution-rules)
-- [What to Contribute](#what-to-contribute)
-- [Coding Guidelines](#coding-guidelines)
-- [Submitting Changes](#submitting-changes)
- - [Pull Request Format](#pull-request-format)
- - [Merge Process](#merge-process)
-- [Licensing](#licensing)
-
-## General Contribution Rules
-
-- Everything in the library must work for the 3000+ teams that will be using it.
-- We need to be able to maintain submitted changes, even if you are no longer working on the project.
-- Tool suite changes must be generally useful to a broad range of teams
-- Excluding bug fixes, changes in one language generally need to have corresponding changes in other languages.
- - Some features, such the addition of C++11 for WPILibC or Functional Interfaces for WPILibJ, are specific to that version of WPILib only.
- - Substantial changes often need to have corresponding LabVIEW changes. To do this, we will work with NI on these large changes.
-- Changes should have tests.
-- Code should be well documented.
- - This often involves ScreenSteps. To add content to ScreenSteps, we will work with you to get the appropriate articles written.
-
-## What to Contribute
-
-- Bug reports and fixes
- - We will generally accept bug fixes without too much question. If they are only implemented for one language, we will implement them for any other necessary languages. Bug reports are also welcome, please submit them to our GitHub issue tracker.
-- While we do welcome improvements to the API, there are a few important rules to consider:
- - Features must be added to both WPILibC and WPILibJ, with rare exceptions.
- - During competition season, we will not merge any new feature additions. We want to ensure that the API is stable during the season to help minimize issues for teams.
- - Ask about large changes before spending a bunch of time on them! You can create a new issue on our GitHub tracker for feature request/discussion and talk about it with us there.
- - Features that make it easier for teams with less experience to be more successful are more likely to be accepted.
- - Features in WPILib should be broadly applicable to all teams. Anything that is team specific should not be submitted.
- - As a rule, we are happy with the general structure of WPILib. We are not interested in major rewrites of all of WPILib. We are open to talking about ideas, but backwards compatibility is very important for WPILib, so be sure to keep this in mind when proposing major changes.
- - Generally speaking, we do not accept code for specific sensors. We have to be able to test the sensor in hardware on the WPILib test bed. Additionally, hardware availability for teams is important. Therefore, as a general rule, the library only directly supports hardware that is in the Kit of Parts. If you are a company interested in getting a sensor into the Kit of Parts, please contact FIRST directly at frcparts@firstinspires.org.
-
-## Coding Guidelines
-
-WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Running wpiformat is required for all contributions and is enforced by our continuous integration system.
-
-While the library should be fully formatted according to the styles, additional elements of the style guide were not followed when the library was initially created. All new code should follow the guidelines. If you are looking for some easy ramp-up tasks, finding areas that don't follow the style guide and fixing them is very welcome.
-
-## Submitting Changes
-
-### Pull Request Format
-
-Changes should be submitted as a Pull Request against the master branch of WPILib. For most changes, we ask that you squash your changes down to a single commit. For particularly large changes, multiple commits are ok, but assume one commit unless asked otherwise. No change will be merged unless it is up to date with the current master. We will also not merge any changes with merge commits in them; please rebase off of master before submitting a pull request. We do this to make sure that the git history isn't too cluttered.
-
-### Merge Process
-
-When you first submit changes, Travis-CI will attempt to run `./gradlew check` on your change. If this fails, you will need to fix any issues that it sees. Once Travis passes, we will begin the review process in more earnest. One or more WPILib team members will review your change. This will be a back-and-forth process with the WPILib team and the greater community. Once we are satisfied that your change is ready, we will allow our Jenkins instance to test it. This will run the full gamut of checks, including integration tests on actual hardware. Once all tests have passed and the team is satisfied, we will merge your change into the WPILib repository.
-
-## Licensing
-
-By contributing to WPILib, you agree that your code will be distributed with WPILib, and licensed under the license for the WPILib project. You should not contribute code that you do not have permission to relicense in this manner. This includes code that is licensed under the GPL that you do not have permission to relicense, as WPILib is not released under a copyleft license. Our license is the 3-clause BSD license, which you can find [here](license.txt).
diff --git a/third_party/allwpilib_2017/README.md b/third_party/allwpilib_2017/README.md
deleted file mode 100644
index dd1890f..0000000
--- a/third_party/allwpilib_2017/README.md
+++ /dev/null
@@ -1,110 +0,0 @@
-# WPILib Project
-
-[](https://travis-ci.org/wpilibsuite/allwpilib)
-
-Welcome to the WPILib project. This repository contains the HAL, WPILibJ, and WPILibC projects. These are the core libraries for creating robot programs for the roboRIO.
-
-- [WPILib Mission](#wpilib-mission)
-- [Building WPILib](#building-wpilib)
- - [Requirements](#requirements)
- - [Setup](#setup)
- - [Building](#building)
- - [Publishing](#publishing)
- - [Structure and Organization](#structure-and-organization)
-- [Contributing to WPILib](#contributing-to-wpilib)
-
-## WPILib Mission
-
-The WPILib Mission is to enable FIRST Robotics teams to focus on writing game-specific software rather than focussing on hardware details - "raise the floor, don't lower the ceiling". We work to enable teams with limited programming knowledge and/or mentor experience to be as successful as possible, while not hampering the abilities of teams with more advanced programming capabilities. We support Kit of Parts control system components directly in the library. We also strive to keep parity between major features of each language (Java, C++, and NI's LabVIEW), so that teams aren't at a disadvantage for choosing a specific programming language. WPILib is an open source project, licensed under the BSD 3-clause license. You can find a copy of the license [here](license.txt).
-
-# Building WPILib
-
-Using Gradle makes building WPILib very straightforward. It only has a few dependencies on outside tools, such as the ARM cross compiler for creating roboRIO binaries.
-
-## Requirements
-
-- [ARM Compiler Toolchain](http://first.wpi.edu/FRC/roborio/toolchains/)
-- Doxygen (Only required if you want to build the C++ documentation)
-- [wpiformat](https://github.com/wpilibsuite/styleguide)
-
-## Setup
-
-Clone the WPILib repository. If the toolchains are not installed, install them, and make sure they are available on the system PATH.
-
-See the [styleguide README](https://github.com/wpilibsuite/styleguide/blob/master/README.md) for wpiformat setup instructions.
-
-## Building
-
-All build steps are executed using the Gradle wrapper, `gradlew`. Each target that Gradle can build is referred to as a task. The most common Gradle task to use is `build`. This will build all the outputs created by WPILib. To run, open a console and cd into the cloned WPILib directory. Then:
-
-```bash
-./gradlew build
-```
-
-To build a specific subproject, such as WPILibC, you must access the subproject and run the build task only on that project. Accessing a subproject in Gradle is quite easy. Simply use `:subproject_name:task_name` with the Gradle wrapper. For example, building just WPILibC:
-
-```bash
-./gradlew :wpilibc:build
-```
-
-If you have installed the FRC Toolchain to a directory other than the default, or if the Toolchain location is not on your System PATH, you can pass the `toolChainPath` property to specify where it is located. Example:
-
-```bash
-./gradlew build -PtoolChainPath=some/path/to/frc/toolchain/bin
-```
-
-If you also want simulation to be built, add -PmakeSim. This requires gazebo_transport. We have tested on 14.04 and 15.05, but any correct install of Gazebo should work, even on Windows if you build Gazebo from source. Correct means CMake needs to be able to find gazebo-config.cmake. See [The Gazebo website](https://gazebosim.org/) for installation instructions.
-
-```bash
-./gradlew build -PmakeSim
-```
-
-If you prefer to use CMake directly, the you can still do so.
-The common CMake tasks are wpilibcSim, frc_gazebo_plugins, and gz_msgs
-
-```bash
-mkdir build #run this in the root of allwpilib
-cd build
-cmake ..
-make
-```
-
-The gradlew wrapper only exists in the root of the main project, so be sure to run all commands from there. All of the subprojects have build tasks that can be run. Gradle automatically determines and rebuilds dependencies, so if you make a change in the HAL and then run `./gradlew :wpilibc:build`, the HAL will be rebuilt, then WPILibC.
-
-There are a few tasks other than `build` available. To see them, run the meta-task `tasks`. This will print a list of all available tasks, with a description of each task.
-
-wpiformat can be executed anywhere in the repository via `py -3 -m wpiformat` on Windows or `python3 -m wpiformat` on other platforms.
-
-## Publishing
-
-If you are building to test with the Eclipse plugins or just want to export the build as a Maven-style dependency, simply run the `publish` task. This task will publish all available packages to ~/releases/maven/development. If you need to publish the project to a different repo, you can specify it with `-Prepo=repo_name`. Valid options are:
-
-- development - The default repo.
-- beta - Publishes to ~/releases/maven/beta.
-- stable - Publishes to ~/releases/maven/stable.
-- release - Publishes to ~/releases/maven/release.
-
-The following maven targets a published by this task:
-
-- edu.wpi.first.wpilib.cmake:cpp-root:1.0.0 - roboRIO C++
-- edu.wpi.first.wpilibc.simulation:WPILibCSim:0.1.0 - Simulation C++
-- edu.wpi.first.wpilibj:wpilibJavaFinal:0.1.0-SNAPSHOT - roboRIO Java
-- edu.wpi.first.wpilibj:wpilibJavaSim:0.1.0-SNAPSHOT - Simulation Java
-- edu.wpi.first.wpilibj.simulation:SimDS:0.1.0-SNAPSHOT - The driverstation for controlling simulation.
-- org.gazebosim:JavaGazebo:0.1.0-SNAPSHOT - Gazebo protocol for Java.
-
-## Structure and Organization
-
-The main WPILib code you're probably looking for is in WPILibJ and WPILibC. Those directories are split into shared, sim, and athena. Athena contains the WPILib code meant to run on your roboRIO. Sim is WPILib code meant to run on your computer with Gazebo, and shared is code shared between the two. Shared code must be platform-independent, since it will be compiled with both the ARM cross-compiler and whatever desktop compiler you are using (g++, msvc, etc...).
-
-The Simulation directory contains extra simulation tools and libraries, such as gz_msgs and JavaGazebo. See sub-directories for more information.
-
-The integration test directories for C++ and Java contain test code that runs on our test-system. When you submit code for review, it is tested by those programs. If you add new functionality you should make sure to write tests for it so we don't break it in the future.
-
-The hal directory contains more C++ code meant to run on the roboRIO. HAL is an acronym for "Hardware Abstraction Layer", and it interfaces with the NI Libraries. The NI Libraries contain the low-level code for controlling devices on your robot. The NI Libraries are found in the ni-libraries folder.
-
-The [styleguide repository](https://github.com/wpilibsuite/styleguide) contains our style guides for C++ and Java code. Anything submitted to the WPILib project needs to follow the code style guides outlined in there. For details about the style, please see the contributors document [here](CONTRIBUTING.md#coding-guidelines).
-
-# Contributing to WPILib
-
-See [CONTRIBUTING.md](CONTRIBUTING.md).
diff --git a/third_party/allwpilib_2017/arm-toolchain.cmake b/third_party/allwpilib_2017/arm-toolchain.cmake
deleted file mode 100644
index 771c629..0000000
--- a/third_party/allwpilib_2017/arm-toolchain.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-INCLUDE(CMakeForceCompiler)
-set(ARM_PREFIX arm-frc-linux-gnueabi)
-set(CMAKE_SYSTEM_NAME Linux)
-CMAKE_FORCE_CXX_COMPILER(${ARM_PREFIX}-g++ GNU)
-CMAKE_FORCE_C_COMPILER(${ARM_PREFIX}-gcc GNU)
-set(CMAKE_CXX_FLAGS "-std=c++1y -Wformat=2 -Wall -Wextra -Werror -pedantic -Wno-psabi" CACHE STRING "" FORCE)
-set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3" CACHE STRING "" FORCE)
-set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g" CACHE STRING "" FORCE) # still want debugging for release?
diff --git a/third_party/allwpilib_2017/build.gradle b/third_party/allwpilib_2017/build.gradle
deleted file mode 100644
index 0c66254..0000000
--- a/third_party/allwpilib_2017/build.gradle
+++ /dev/null
@@ -1,69 +0,0 @@
-plugins {
- id 'net.ltgt.errorprone' version '0.0.8'
- id 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' version '1.6'
-}
-
-// Ensure that the WPILibVersioningPlugin is setup by setting the release type, if releaseType wasn't
-// already specified on the command line
-if (!hasProperty('releaseType')) {
- WPILibVersion {
- releaseType = 'dev'
- }
-}
-
-def enableSimulation = hasProperty('makeSim')
-
-ext.simulationInstallDir = "$rootDir/build/install/simulation"
-
-allprojects {
- ext.enableSimulation = enableSimulation
-
- repositories {
- mavenCentral()
- }
-
- ext.ntcoreDep = { lang, classifier, extension = null ->
- return "edu.wpi.first.wpilib.networktables.$lang:NetworkTables:+:$classifier${extension == null ? '' : '@' + extension}"
- }
-
- ext.cscoreDep = { lang, classifier, extension = null ->
- return "edu.wpi.cscore.$lang:cscore:+:$classifier${extension == null ? '' : '@' + extension}"
- }
-
- ext.wpiUtilDep = { classifier ->
- return "edu.wpi.first.wpilib:wpiutil:+:$classifier@zip"
- }
-}
-
-subprojects {
- apply plugin: 'eclipse'
- apply plugin: 'idea'
- apply plugin: 'checkstyle'
-
- checkstyle {
- toolVersion = "6.18"
- configFile = new File(rootDir, "styleguide/checkstyle.xml")
- }
-
- ext.armBuild = true
-
- // Disables doclint in java 8.
- if (JavaVersion.current().isJava8Compatible()) {
- tasks.withType(Javadoc) {
- options.addStringOption('Xdoclint:none', '-quiet')
- }
- }
- ext.setupWpilibRepo = { publishing ->
- publishing.repositories.maven {
- url = WPILibVersion.mavenLocalUrl
- }
- }
-}
-
-apply from: 'cppSettings.gradle'
-
-apply from: 'ni-libraries/ni-libraries.gradle'
-
-task wrapper(type: Wrapper) {
- gradleVersion = '3.3'
-}
diff --git a/third_party/allwpilib_2017/configure.bat b/third_party/allwpilib_2017/configure.bat
deleted file mode 100644
index f308fa3..0000000
--- a/third_party/allwpilib_2017/configure.bat
+++ /dev/null
@@ -1,46 +0,0 @@
-:: This file is a helper for allC++Sim
-::
-:: Usage: cd /build && ../configure
-::
-:: WARNING -- this is only temporary, and only meant for debug, and only works on my computer
-@set WS=C:\Users\peter\gz-ws
-@set BOOST_PATH=%WS%\boost_1_56_0
-@set BOOST_LIBRARY_DIR=%BOOST_PATH%\lib64-msvc-12.0
-
-@set PROTOBUF_PATH=%WS%\protobuf-2.6.0-win64-vc12
-
-@set OGRE_PATH=%WS%\ogre_src_v1-8-1-vc12-x64-release-debug\build\install\Debug
-@set OGRE_INCLUDE_DIR=%OGRE_PATH%\include;%OGRE_PATH%\include\OGRE;%OGRE_PATH%\include\OGRE\RTShaderSystem;%OGRE_PATH%\include\OGRE\Terrain;%OGRE_PATH%\include\OGRE\Paging
-@set OGRE_LIBRARY_DIR=%OGRE_PATH%\lib\Debug
-set OGRE_LIB_SUFFIX=_d.lib
-@set OGRE_LIBS=%OGRE_LIBRARY_DIR%\OgreMain%OGRE_LIB_SUFFIX%;%OGRE_LIBRARY_DIR%\OgreOverlay%OGRE_LIB_SUFFIX%;%OGRE_LIBRARY_DIR%\OgreRTShaderSystem%OGRE_LIB_SUFFIX%;%OGRE_LIBRARY_DIR%\OgreTerrain%OGRE_LIB_SUFFIX%;%OGRE_LIBRARY_DIR%\OgrePaging%OGRE_LIB_SUFFIX%
-@set OGRE_LIBS=%OGRE_LIBRARY_DIR%\OgreMain%OGRE_LIB_SUFFIX%;%OGRE_LIBRARY_DIR%\OgreRTShaderSystem%OGRE_LIB_SUFFIX%;%OGRE_LIBRARY_DIR%\OgreTerrain%OGRE_LIB_SUFFIX%;%OGRE_LIBRARY_DIR%\OgrePaging%OGRE_LIB_SUFFIX%
-
-@set FREEIMAGE_PATH=%WS%\FreeImage-vc12-x64-release-debug
-@set FREEIMAGE_INCLUDE_DIR=%FREEIMAGE_PATH%\Source
-
-@set TBB_PATH=%WS%\tbb43_20141023oss
-@set TBB_INCLUDEDIR=%TBB_PATH%\include
-
-@set DLFCN_WIN32_PATH=%WS%\dlfcn-win32-vc12-x64-release-debug\build\install\Debug
-@set DLFCN_WIN32_INCLUDE_DIR=%DLFCN_WIN32_PATH%\include
-
-@set TINY_XML_INCLUDE_DIR=%WS%\sdformat\src\win\tinyxml
-
-@set GAZEBO_PATH=%WS%\gazebo\build\install\Debug\lib\cmake\gazebo
-@set SDFORMAT_PATH=%WS%\sdformat\build\install\Debug\lib\cmake\sdformat
-@set IGNITION-MATH_PATH=%WS%\ign-math\build\install\Debug\lib\cmake\ignition-math2
-
-@set INCLUDE=%TINY_XML_INCLUDE_DIR%;%FREEIMAGE_INCLUDE_DIR%;%TBB_INCLUDEDIR%;%DLFCN_WIN32_INCLUDE_DIR%;%INCLUDE%
-@set LIB=%LIB%
-
-cmake -G "NMake Makefiles"^
- -DCMAKE_INSTALL_PREFIX=build^
- -DCMAKE_PREFIX_PATH="%GAZEBO_PATH%;%SDFORMAT_PATH%;%IGNITION-MATH_PATH%"^
- -DOGRE_FOUND=1^
- -DOGRE_INCLUDE_DIRS="%OGRE_INCLUDE_DIR%"^
- -DOGRE_LIBRARIES="%OGRE_LIBS%"^
- -DPROTOBUF_SRC_ROOT_FOLDER="%PROTOBUF_PATH%"^
- -DBOOST_ROOT="%BOOST_PATH%"^
- -DBOOST_LIBRARYDIR="%BOOST_LIBRARY_DIR%"^
- ..
diff --git a/third_party/allwpilib_2017/cppSettings.gradle b/third_party/allwpilib_2017/cppSettings.gradle
deleted file mode 100644
index a0197b2..0000000
--- a/third_party/allwpilib_2017/cppSettings.gradle
+++ /dev/null
@@ -1,243 +0,0 @@
-// These add the nilibraries shared library to the linker args
-def niLibraryPath = file('ni-libraries/lib').path
-def niLibrary = niLibraryPath + "/libnilibraries.so"
-
-configurations.create('armDeps')
-
-dependencies {
- armDeps ntcoreDep('cpp', 'arm', 'zip')
- armDeps wpiUtilDep('arm')
- armDeps cscoreDep('cpp', 'athena-uberzip', 'zip')
-}
-
-def depLocation = "$buildDir/dependencies"
-
-configurations.armDeps.files.each { file ->
- def depName = file.name.substring(0, file.name.indexOf('-'))
- def t = tasks.create("downloadArm${depName.capitalize()}", Copy) {
- description = "Downloads and unzips the $depName dependency."
- group = 'Dependencies'
- from zipTree(file)
- into "$depLocation/${depName.toLowerCase()}"
- }
-}
-
-task downloadNetworkTables {
- description = 'Downloads all needed versions of networktables.'
- group = 'Dependencies'
- dependsOn downloadArmNetworkTables
-}
-
-task downloadWpiutil {
- description = 'Downloads all needed versions of WPIUtil.'
- group = 'Dependencies'
- dependsOn downloadArmWpiutil
-}
-
-task downloadCscore {
- description = 'Downloads all needed versions of cscore.'
- group = 'Dependencies'
- dependsOn downloadArmCscore
-}
-
-if (enableSimulation) {
- configurations.create('nativeDeps')
-
- dependencies {
- nativeDeps ntcoreDep('cpp', 'desktop', 'zip')
- nativeDeps wpiUtilDep('desktop')
- }
-
- configurations.nativeDeps.files.each { file ->
- def depName = file.name.substring(0, file.name.indexOf('-'))
- def t = tasks.create("downloadNative${depName.capitalize()}", Copy) {
- description = "Downloads and unzips the $depName dependency."
- group = 'Dependencies'
- from zipTree(file)
- into "$depLocation/${depName.toLowerCase()}"
- }
- }
-
- downloadNetworkTables.dependsOn downloadNativeNetworkTables
- downloadWpiutil.dependsOn downloadNativeWpiutil
-}
-
-def netTablesUnzipLocation = "$depLocation/networktables"
-def wpiUtilUnzipLocation = "$depLocation/wpiutil"
-def csCoreUnzipLocation = "$depLocation/cscore"
-
-task clean(type: Delete) {
- description = "Deletes the build directory"
- group = "Build"
- delete buildDir
-}
-
-if (!hasProperty("toolChainPath")) {
- ext.toolChainPath = null
-}
-
-subprojects {
- ext.defineWpiUtilProperties = {
- ext.wpiUtil = wpiUtilUnzipLocation
- ext.wpiUtilInclude = "$wpiUtilUnzipLocation/include"
- ext.wpiUtilLibArmLocation = "$wpiUtilUnzipLocation/Linux/arm"
- if (enableSimulation) {
- ext.wpiUtilLibDesktopLocation = "$wpiUtilUnzipLocation/Linux/amd64"
- }
- ext.wpiUtilSharedLib = "$wpiUtilLibArmLocation/libwpiutil.so"
- ext.wpiUtilSharedLibDebug = "$wpiUtilLibArmLocation/libwpiutil.so.debug"
- ext.wpiUtilStaticLib = "$wpiUtilLibArmLocation/libwpiutil.a"
-
- ext.addWpiUtilLibraryLinks = { compileTask, linker, targetPlatform ->
- compileTask.dependsOn project(':').downloadWpiutil
- String architecture = targetPlatform.architecture
- if (architecture.contains('arm')) {
- linker.args wpiUtilSharedLib
- }
- }
-
- ext.addStaticWpiUtilLibraryLinks = { compileTask, linker, targetPlatform ->
- compileTask.dependsOn project(':').downloadWpiutil
- String architecture = targetPlatform.architecture
- if (architecture.contains('arm')) {
- linker.args wpiUtilStaticLib
- }
- }
- }
-
- // This defines a project property that projects depending on network tables can use to setup that dependency.
- ext.defineNetworkTablesProperties = {
- ext.netTables = netTablesUnzipLocation
- ext.netTablesInclude = "$netTablesUnzipLocation/include"
- ext.netLibArmLocation = "$netTablesUnzipLocation/Linux/arm"
- if (enableSimulation) {
- ext.netLibDesktopLocation = "$netTablesUnzipLocation/Linux/amd64"
- }
- ext.netSharedLib = "$netLibArmLocation/libntcore.so"
- ext.netSharedLibDebug = "$netLibArmLocation/libntcore.so.debug"
- ext.netStaticLib = "$netLibArmLocation/libntcore.a"
-
- ext.addNetworkTablesLibraryLinks = { compileTask, linker, targetPlatform ->
- compileTask.dependsOn project(':').downloadNetworkTables
- String architecture = targetPlatform.architecture
- if (architecture.contains('arm')) {
- linker.args netSharedLib
- }
- addWpiUtilLibraryLinks(compileTask, linker, targetPlatform)
- }
-
- ext.addStaticNetworkTablesLibraryLinks = { compileTask, linker, targetPlatform ->
- compileTask.dependsOn project(':').downloadNetworkTables
- String architecture = targetPlatform.architecture
- if (architecture.contains('arm')) {
- linker.args netStaticLib
- }
- addStaticWpiUtilLibraryLinks(compileTask, linker, targetPlatform)
- }
- }
-
- // This defines a project property that projects depending on cscore can use to setup that dependency.
- ext.defineCsCoreProperties = {
- ext.csCore = csCoreUnzipLocation
- ext.csCoreInclude = "$csCoreUnzipLocation/include"
- ext.csLibArmLocation = "$csCoreUnzipLocation/lib"
- ext.csSharedLib = "$csLibArmLocation/libcscore.so"
- ext.cvSharedLib = "$csLibArmLocation/libopencv.so"
-
- ext.addCsCoreLibraryLinks = { compileTask, linker, targetPlatform ->
- compileTask.dependsOn project(':').downloadCscore
- String architecture = targetPlatform.architecture
- if (architecture.contains('arm')) {
- linker.args << '-L' + csLibArmLocation
- linker.args csSharedLib
- linker.args cvSharedLib
- }
- }
- }
-
- ext.defineCrossCompilerProperties = {
- // We use a custom-built cross compiler with the prefix arm-frc-linux-gnueabi-<util name>
- // If this ever changes, the prefix will need to be changed here
- ext.compilerPrefix = 'arm-frc-linux-gnueabi-'
- }
-
- plugins.withType(CppPlugin).whenPluginAdded {
- defineCrossCompilerProperties()
- model {
- buildTypes {
- debug
- }
- // Adds a custom toolchain for our compiler prefix and options
- toolChains {
- roborioGcc(Gcc) {
- if (toolChainPath != null)
- path toolChainPath
- target('roborio-arm') {
- cCompiler.executable = compilerPrefix + cCompiler.executable
- cppCompiler.executable = compilerPrefix + cppCompiler.executable
- linker.executable = compilerPrefix + linker.executable
- assembler.executable = compilerPrefix + assembler.executable
- // Gradle auto-adds the -m32 argument to the linker and compiler. Our compiler only supports
- // arm, and doesn't understand this flag, so it is removed from both
- cppCompiler.withArguments { args ->
- args << '-std=c++1y' << '-Wformat=2' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic'
- args << '-Wno-psabi' << '-Wno-unused-parameter' << '-fPIC' << '-Og' << '-g3' << '-rdynamic'
- //TODO: When the compiler allows us to actually call deprecated functions from within
- // deprecated function, remove this line (this will cause calling deprecated functions
- // to be treated as a warning rather than an error).
- args << '-Wno-error=deprecated-declarations'
- args.remove('-m32')
- }
- linker.withArguments { args ->
- args << '-rdynamic'
- args.remove('-m32')
- }
- staticLibArchiver.executable = compilerPrefix + staticLibArchiver.executable
- }
- }
- }
-
- platforms {
- 'roborio-arm' {
- architecture 'arm'
- operatingSystem 'linux'
- }
- }
- }
-
- ext.niLibraryHeadersRoot = "${rootDir}/ni-libraries/include"
- ext.niLibraryHeadersChipObject = "${rootDir}/ni-libraries/include/FRC_FPGA_ChipObject"
-
- ext.binTool = { tool ->
- if (toolChainPath != null) return "${toolChainPath}/${compilerPrefix}${tool}"
- return "${compilerPrefix}${tool}"
- }
-
- // This task adds the appropriate linker flags for the NI libraries
- ext.addNiLibraryLinks = { linker, targetPlatform ->
- String architecture = targetPlatform.architecture
- if (architecture.contains('arm')){
- linker.args << '-L' + niLibraryPath
- linker.args niLibrary
- }
- }
-
- // This task sets up the shared libraries to be stripped
- ext.debugStripSetup = { project->
- if (!project.hasProperty('debug')) {
- project.tasks.whenObjectAdded { task ->
- def name = task.name.toLowerCase()
- if (name.contains('link') && name.contains('sharedlibrary')) {
- def library = task.outputFile.absolutePath
- def debugLibrary = task.outputFile.absolutePath + ".debug"
- task.doLast {
- exec { commandLine binTool('objcopy'), '--only-keep-debug', library, debugLibrary }
- exec { commandLine binTool('strip'), '-g', library }
- exec { commandLine binTool('objcopy'), "--add-gnu-debuglink=$debugLibrary", library }
- }
- }
- }
- }
- }
- }
-}
diff --git a/third_party/allwpilib_2017/gradlew b/third_party/allwpilib_2017/gradlew
deleted file mode 100755
index 4453cce..0000000
--- a/third_party/allwpilib_2017/gradlew
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env sh
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Escape application args
-save ( ) {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=$(save "$@")
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
-fi
-
-exec "$JAVACMD" "$@"
diff --git a/third_party/allwpilib_2017/gradlew.bat b/third_party/allwpilib_2017/gradlew.bat
deleted file mode 100644
index e95643d..0000000
--- a/third_party/allwpilib_2017/gradlew.bat
+++ /dev/null
@@ -1,84 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/third_party/allwpilib_2017/hal/build.gradle b/third_party/allwpilib_2017/hal/build.gradle
deleted file mode 100644
index 07d2d39..0000000
--- a/third_party/allwpilib_2017/hal/build.gradle
+++ /dev/null
@@ -1,160 +0,0 @@
-// There are two hal libraries that are built
-// - desktop which is used by simulation (gcc/msvc)
-// - athena which is used by the roborio (arm)
-
-plugins {
- id 'cpp'
- id 'maven-publish'
-}
-
-defineWpiUtilProperties()
-
-debugStripSetup(project)
-
-model {
- components {
- HALAthena(NativeLibrarySpec) {
- targetPlatform 'roborio-arm'
- binaries.all {
- tasks.withType(CppCompile) {
- addNiLibraryLinks(linker, targetPlatform)
- addWpiUtilLibraryLinks(it, linker, targetPlatform)
- }
- }
- sources {
- cpp {
- source {
- srcDirs = ["lib/athena", niLibraryHeadersRoot, "lib/shared"]
- includes = ["**/*.cpp"]
- }
- exportedHeaders {
- srcDirs = ["include", niLibraryHeadersRoot, wpiUtilInclude]
- }
- }
- }
- }
- }
- tasks { tasks ->
- tasks.halZip.dependsOn tasks.HALAthenaSharedLibrary
- tasks.athenaRuntimeZip.dependsOn tasks.HALAthenaSharedLibrary
- }
-}
-
-task halZip(type: Zip) {
- description = 'Zips the HAL'
- group = 'WPILib'
- baseName = 'hal'
- destinationDir = project.buildDir
- duplicatesStrategy = 'exclude'
-
- // Include the shared library file and header files from this project
- model {
- binaries {
- withType(SharedLibraryBinarySpec) { spec ->
- spec.headerDirs.each {
- def normalizedIt = it.toString().replace('/', '\\')
- def normalizedWPIUtil = wpiUtilInclude.toString().replace('/', '\\')
- // exclude the wpiUtil library, and any NI libraries (NI libraries grabbed later)
- if (normalizedIt != normalizedWPIUtil) {
- from(it) {
- into 'include'
- // We don't want to include any of the .cpp files that are in some of the header directories
- exclude '**/*.cpp'
- }
- }
- }
- from(spec.sharedLibraryFile) {
- into 'lib'
- }
- from(new File(spec.sharedLibraryFile.absolutePath + ".debug")) {
- into 'lib'
- }
- }
- }
- }
-
- // Finally, include all of the shared library objects from the ni directory
- from(project.file('../ni-libraries/lib')) {
- into 'lib'
- exclude 'genlinks'
- exclude 'genlinks.bat'
- exclude 'libwpi.so'
- }
-}
-
-task athenaRuntimeZip(type: Zip) {
- description = 'Zips the Athena Runtime libraries'
- group = 'WPILib'
- baseName = 'athena-runtime'
- destinationDir = project.buildDir
- duplicatesStrategy = 'exclude'
-
- // Include the static library file and header files from this project
- model {
- binaries {
- withType(SharedLibraryBinarySpec) { spec ->
- spec.headerDirs.each {
- from(it) {
- into 'include'
- // We don't want to include any of the .cpp files that are in some of the header directories
- exclude '**/*.cpp'
- }
- }
- from(spec.sharedLibraryFile) {
- into 'lib'
- }
- from(new File(spec.sharedLibraryFile.absolutePath + ".debug")) {
- into 'lib'
- }
- }
- }
- }
-
- defineNetworkTablesProperties()
- dependsOn project(':').downloadNetworkTables
-
- from(project.file(netTablesInclude)) {
- into 'include'
- }
-
- from (file(netSharedLib)) {
- into 'lib'
- }
-
- from (file(netSharedLibDebug)) {
- into 'lib'
- }
-
- from (file(wpiUtilSharedLib)) {
- into 'lib'
- }
-
- from (file(wpiUtilSharedLibDebug)) {
- into 'lib'
- }
-}
-
-
-publishing {
- publications {
- hal(MavenPublication) {
- artifact halZip
-
- groupId 'edu.wpi.first.wpilib'
- artifactId 'hal'
- version WPILibVersion.version
- }
- athenaruntime(MavenPublication) {
- artifact athenaRuntimeZip
-
- groupId 'edu.wpi.first.wpilib'
- artifactId 'athena-runtime'
- version WPILibVersion.version
- }
- }
-
- setupWpilibRepo(it)
-}
-
-build.dependsOn halZip
-build.dependsOn athenaRuntimeZip
diff --git a/third_party/allwpilib_2017/hal/include/HAL/Accelerometer.h b/third_party/allwpilib_2017/hal/include/HAL/Accelerometer.h
deleted file mode 100644
index 69bd85e..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/Accelerometer.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 "HAL/Types.h"
-
-enum HAL_AccelerometerRange : int32_t {
- HAL_AccelerometerRange_k2G = 0,
- HAL_AccelerometerRange_k4G = 1,
- HAL_AccelerometerRange_k8G = 2,
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-void HAL_SetAccelerometerActive(HAL_Bool active);
-void HAL_SetAccelerometerRange(HAL_AccelerometerRange range);
-double HAL_GetAccelerometerX(void);
-double HAL_GetAccelerometerY(void);
-double HAL_GetAccelerometerZ(void);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/AnalogAccumulator.h b/third_party/allwpilib_2017/hal/include/HAL/AnalogAccumulator.h
deleted file mode 100644
index 35235f8..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/AnalogAccumulator.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-HAL_Bool HAL_IsAccumulatorChannel(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status);
-void HAL_InitAccumulator(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status);
-void HAL_ResetAccumulator(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status);
-void HAL_SetAccumulatorCenter(HAL_AnalogInputHandle analogPortHandle,
- int32_t center, int32_t* status);
-void HAL_SetAccumulatorDeadband(HAL_AnalogInputHandle analogPortHandle,
- int32_t deadband, int32_t* status);
-int64_t HAL_GetAccumulatorValue(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status);
-int64_t HAL_GetAccumulatorCount(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status);
-void HAL_GetAccumulatorOutput(HAL_AnalogInputHandle analogPortHandle,
- int64_t* value, int64_t* count, int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/AnalogGyro.h b/third_party/allwpilib_2017/hal/include/HAL/AnalogGyro.h
deleted file mode 100644
index d1c6aaf..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/AnalogGyro.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-HAL_GyroHandle HAL_InitializeAnalogGyro(HAL_AnalogInputHandle handle,
- int32_t* status);
-void HAL_SetupAnalogGyro(HAL_GyroHandle handle, int32_t* status);
-void HAL_FreeAnalogGyro(HAL_GyroHandle handle);
-void HAL_SetAnalogGyroParameters(HAL_GyroHandle handle,
- double voltsPerDegreePerSecond, double offset,
- int32_t center, int32_t* status);
-void HAL_SetAnalogGyroVoltsPerDegreePerSecond(HAL_GyroHandle handle,
- double voltsPerDegreePerSecond,
- int32_t* status);
-void HAL_ResetAnalogGyro(HAL_GyroHandle handle, int32_t* status);
-void HAL_CalibrateAnalogGyro(HAL_GyroHandle handle, int32_t* status);
-void HAL_SetAnalogGyroDeadband(HAL_GyroHandle handle, double volts,
- int32_t* status);
-double HAL_GetAnalogGyroAngle(HAL_GyroHandle handle, int32_t* status);
-double HAL_GetAnalogGyroRate(HAL_GyroHandle handle, int32_t* status);
-double HAL_GetAnalogGyroOffset(HAL_GyroHandle handle, int32_t* status);
-int32_t HAL_GetAnalogGyroCenter(HAL_GyroHandle handle, int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/AnalogInput.h b/third_party/allwpilib_2017/hal/include/HAL/AnalogInput.h
deleted file mode 100644
index 7cc07db..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/AnalogInput.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-HAL_AnalogInputHandle HAL_InitializeAnalogInputPort(HAL_PortHandle portHandle,
- int32_t* status);
-void HAL_FreeAnalogInputPort(HAL_AnalogInputHandle analogPortHandle);
-HAL_Bool HAL_CheckAnalogModule(int32_t module);
-HAL_Bool HAL_CheckAnalogInputChannel(int32_t channel);
-
-void HAL_SetAnalogSampleRate(double samplesPerSecond, int32_t* status);
-double HAL_GetAnalogSampleRate(int32_t* status);
-void HAL_SetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
- int32_t bits, int32_t* status);
-int32_t HAL_GetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status);
-void HAL_SetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
- int32_t bits, int32_t* status);
-int32_t HAL_GetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status);
-int32_t HAL_GetAnalogValue(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status);
-int32_t HAL_GetAnalogAverageValue(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status);
-int32_t HAL_GetAnalogVoltsToValue(HAL_AnalogInputHandle analogPortHandle,
- double voltage, int32_t* status);
-double HAL_GetAnalogVoltage(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status);
-double HAL_GetAnalogAverageVoltage(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status);
-int32_t HAL_GetAnalogLSBWeight(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status);
-int32_t HAL_GetAnalogOffset(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/AnalogOutput.h b/third_party/allwpilib_2017/hal/include/HAL/AnalogOutput.h
deleted file mode 100644
index 5607d5d..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/AnalogOutput.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-HAL_AnalogOutputHandle HAL_InitializeAnalogOutputPort(HAL_PortHandle portHandle,
- int32_t* status);
-void HAL_FreeAnalogOutputPort(HAL_AnalogOutputHandle analogOutputHandle);
-void HAL_SetAnalogOutput(HAL_AnalogOutputHandle analogOutputHandle,
- double voltage, int32_t* status);
-double HAL_GetAnalogOutput(HAL_AnalogOutputHandle analogOutputHandle,
- int32_t* status);
-HAL_Bool HAL_CheckAnalogOutputChannel(int32_t channel);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/AnalogTrigger.h b/third_party/allwpilib_2017/hal/include/HAL/AnalogTrigger.h
deleted file mode 100644
index 17ef929..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/AnalogTrigger.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-enum HAL_AnalogTriggerType : int32_t {
- HAL_Trigger_kInWindow = 0,
- HAL_Trigger_kState = 1,
- HAL_Trigger_kRisingPulse = 2,
- HAL_Trigger_kFallingPulse = 3
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-HAL_AnalogTriggerHandle HAL_InitializeAnalogTrigger(
- HAL_AnalogInputHandle portHandle, int32_t* index, int32_t* status);
-void HAL_CleanAnalogTrigger(HAL_AnalogTriggerHandle analogTriggerHandle,
- int32_t* status);
-void HAL_SetAnalogTriggerLimitsRaw(HAL_AnalogTriggerHandle analogTriggerHandle,
- int32_t lower, int32_t upper,
- int32_t* status);
-void HAL_SetAnalogTriggerLimitsVoltage(
- HAL_AnalogTriggerHandle analogTriggerHandle, double lower, double upper,
- int32_t* status);
-void HAL_SetAnalogTriggerAveraged(HAL_AnalogTriggerHandle analogTriggerHandle,
- HAL_Bool useAveragedValue, int32_t* status);
-void HAL_SetAnalogTriggerFiltered(HAL_AnalogTriggerHandle analogTriggerHandle,
- HAL_Bool useFilteredValue, int32_t* status);
-HAL_Bool HAL_GetAnalogTriggerInWindow(
- HAL_AnalogTriggerHandle analogTriggerHandle, int32_t* status);
-HAL_Bool HAL_GetAnalogTriggerTriggerState(
- HAL_AnalogTriggerHandle analogTriggerHandle, int32_t* status);
-HAL_Bool HAL_GetAnalogTriggerOutput(HAL_AnalogTriggerHandle analogTriggerHandle,
- HAL_AnalogTriggerType type,
- int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/CAN.h b/third_party/allwpilib_2017/hal/include/HAL/CAN.h
deleted file mode 100644
index 67b34bb..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/CAN.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "FRC_NetworkCommunication/CANSessionMux.h"
-
-void canTxSend(uint32_t arbID, uint8_t length,
- int32_t period = CAN_SEND_PERIOD_NO_REPEAT);
-
-void canTxPackInt8(uint32_t arbID, uint8_t offset, uint8_t value);
-void canTxPackInt16(uint32_t arbID, uint8_t offset, uint16_t value);
-void canTxPackInt32(uint32_t arbID, uint8_t offset, uint32_t value);
-void canTxPackFXP16(uint32_t arbID, uint8_t offset, double value);
-void canTxPackFXP32(uint32_t arbID, uint8_t offset, double value);
-
-uint8_t canTxUnpackInt8(uint32_t arbID, uint8_t offset);
-uint32_t canTxUnpackInt32(uint32_t arbID, uint8_t offset);
-uint16_t canTxUnpackInt16(uint32_t arbID, uint8_t offset);
-double canTxUnpackFXP16(uint32_t arbID, uint8_t offset);
-double canTxUnpackFXP32(uint32_t arbID, uint8_t offset);
-
-bool canRxReceive(uint32_t arbID);
-
-uint8_t canRxUnpackInt8(uint32_t arbID, uint8_t offset);
-uint16_t canRxUnpackInt16(uint32_t arbID, uint8_t offset);
-uint32_t canRxUnpackInt32(uint32_t arbID, uint8_t offset);
-double canRxUnpackFXP16(uint32_t arbID, uint8_t offset);
-double canRxUnpackFXP32(uint32_t arbID, uint8_t offset);
diff --git a/third_party/allwpilib_2017/hal/include/HAL/ChipObject.h b/third_party/allwpilib_2017/hal/include/HAL/ChipObject.h
deleted file mode 100644
index c45c01d..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/ChipObject.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wpedantic"
-#pragma GCC diagnostic ignored "-Wignored-qualifiers"
-
-#include <stdint.h>
-
-#include "FRC_FPGA_ChipObject/RoboRIO_FRC_ChipObject_Aliases.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/nInterfaceGlobals.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAI.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAO.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAccel.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAccumulator.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAlarm.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAnalogTrigger.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tBIST.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tCounter.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tDIO.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tDMA.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tEncoder.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tGlobal.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tInterrupt.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tPWM.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tPower.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tRelay.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSPI.h"
-#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSysWatchdog.h"
-#include "FRC_FPGA_ChipObject/tDMAChannelDescriptor.h"
-#include "FRC_FPGA_ChipObject/tDMAManager.h"
-#include "FRC_FPGA_ChipObject/tInterruptManager.h"
-#include "FRC_FPGA_ChipObject/tSystem.h"
-#include "FRC_FPGA_ChipObject/tSystemInterface.h"
-
-namespace hal {
-using namespace nFPGA;
-using namespace nRoboRIO_FPGANamespace;
-} // namespace hal
-
-#pragma GCC diagnostic pop
diff --git a/third_party/allwpilib_2017/hal/include/HAL/Compressor.h b/third_party/allwpilib_2017/hal/include/HAL/Compressor.h
deleted file mode 100644
index aea7211..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/Compressor.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-HAL_CompressorHandle HAL_InitializeCompressor(int32_t module, int32_t* status);
-HAL_Bool HAL_CheckCompressorModule(int32_t module);
-
-HAL_Bool HAL_GetCompressor(HAL_CompressorHandle compressorHandle,
- int32_t* status);
-
-void HAL_SetCompressorClosedLoopControl(HAL_CompressorHandle compressorHandle,
- HAL_Bool value, int32_t* status);
-HAL_Bool HAL_GetCompressorClosedLoopControl(
- HAL_CompressorHandle compressorHandle, int32_t* status);
-
-HAL_Bool HAL_GetCompressorPressureSwitch(HAL_CompressorHandle compressorHandle,
- int32_t* status);
-double HAL_GetCompressorCurrent(HAL_CompressorHandle compressorHandle,
- int32_t* status);
-
-HAL_Bool HAL_GetCompressorCurrentTooHighFault(
- HAL_CompressorHandle compressorHandle, int32_t* status);
-HAL_Bool HAL_GetCompressorCurrentTooHighStickyFault(
- HAL_CompressorHandle compressorHandle, int32_t* status);
-HAL_Bool HAL_GetCompressorShortedStickyFault(
- HAL_CompressorHandle compressorHandle, int32_t* status);
-HAL_Bool HAL_GetCompressorShortedFault(HAL_CompressorHandle compressorHandle,
- int32_t* status);
-HAL_Bool HAL_GetCompressorNotConnectedStickyFault(
- HAL_CompressorHandle compressorHandle, int32_t* status);
-HAL_Bool HAL_GetCompressorNotConnectedFault(
- HAL_CompressorHandle compressorHandle, int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/Constants.h b/third_party/allwpilib_2017/hal/include/HAL/Constants.h
deleted file mode 100644
index b764ccc..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/Constants.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int32_t HAL_GetSystemClockTicksPerMicrosecond(void);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/Counter.h b/third_party/allwpilib_2017/hal/include/HAL/Counter.h
deleted file mode 100644
index 90b9cdc..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/Counter.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/AnalogTrigger.h"
-#include "HAL/Types.h"
-
-enum HAL_Counter_Mode : int32_t {
- HAL_Counter_kTwoPulse = 0,
- HAL_Counter_kSemiperiod = 1,
- HAL_Counter_kPulseLength = 2,
- HAL_Counter_kExternalDirection = 3
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-HAL_CounterHandle HAL_InitializeCounter(HAL_Counter_Mode mode, int32_t* index,
- int32_t* status);
-void HAL_FreeCounter(HAL_CounterHandle counterHandle, int32_t* status);
-void HAL_SetCounterAverageSize(HAL_CounterHandle counterHandle, int32_t size,
- int32_t* status);
-void HAL_SetCounterUpSource(HAL_CounterHandle counterHandle,
- HAL_Handle digitalSourceHandle,
- HAL_AnalogTriggerType analogTriggerType,
- int32_t* status);
-void HAL_SetCounterUpSourceEdge(HAL_CounterHandle counterHandle,
- HAL_Bool risingEdge, HAL_Bool fallingEdge,
- int32_t* status);
-void HAL_ClearCounterUpSource(HAL_CounterHandle counterHandle, int32_t* status);
-void HAL_SetCounterDownSource(HAL_CounterHandle counterHandle,
- HAL_Handle digitalSourceHandle,
- HAL_AnalogTriggerType analogTriggerType,
- int32_t* status);
-void HAL_SetCounterDownSourceEdge(HAL_CounterHandle counterHandle,
- HAL_Bool risingEdge, HAL_Bool fallingEdge,
- int32_t* status);
-void HAL_ClearCounterDownSource(HAL_CounterHandle counterHandle,
- int32_t* status);
-void HAL_SetCounterUpDownMode(HAL_CounterHandle counterHandle, int32_t* status);
-void HAL_SetCounterExternalDirectionMode(HAL_CounterHandle counterHandle,
- int32_t* status);
-void HAL_SetCounterSemiPeriodMode(HAL_CounterHandle counterHandle,
- HAL_Bool highSemiPeriod, int32_t* status);
-void HAL_SetCounterPulseLengthMode(HAL_CounterHandle counterHandle,
- double threshold, int32_t* status);
-int32_t HAL_GetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
- int32_t* status);
-void HAL_SetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
- int32_t samplesToAverage, int32_t* status);
-void HAL_ResetCounter(HAL_CounterHandle counterHandle, int32_t* status);
-int32_t HAL_GetCounter(HAL_CounterHandle counterHandle, int32_t* status);
-double HAL_GetCounterPeriod(HAL_CounterHandle counterHandle, int32_t* status);
-void HAL_SetCounterMaxPeriod(HAL_CounterHandle counterHandle, double maxPeriod,
- int32_t* status);
-void HAL_SetCounterUpdateWhenEmpty(HAL_CounterHandle counterHandle,
- HAL_Bool enabled, int32_t* status);
-HAL_Bool HAL_GetCounterStopped(HAL_CounterHandle counterHandle,
- int32_t* status);
-HAL_Bool HAL_GetCounterDirection(HAL_CounterHandle counterHandle,
- int32_t* status);
-void HAL_SetCounterReverseDirection(HAL_CounterHandle counterHandle,
- HAL_Bool reverseDirection, int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/DIO.h b/third_party/allwpilib_2017/hal/include/HAL/DIO.h
deleted file mode 100644
index 0348d76..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/DIO.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-HAL_DigitalHandle HAL_InitializeDIOPort(HAL_PortHandle portHandle,
- HAL_Bool input, int32_t* status);
-HAL_Bool HAL_CheckDIOChannel(int32_t channel);
-void HAL_FreeDIOPort(HAL_DigitalHandle dioPortHandle);
-HAL_DigitalPWMHandle HAL_AllocateDigitalPWM(int32_t* status);
-void HAL_FreeDigitalPWM(HAL_DigitalPWMHandle pwmGenerator, int32_t* status);
-void HAL_SetDigitalPWMRate(double rate, int32_t* status);
-void HAL_SetDigitalPWMDutyCycle(HAL_DigitalPWMHandle pwmGenerator,
- double dutyCycle, int32_t* status);
-void HAL_SetDigitalPWMOutputChannel(HAL_DigitalPWMHandle pwmGenerator,
- int32_t channel, int32_t* status);
-void HAL_SetDIO(HAL_DigitalHandle dioPortHandle, HAL_Bool value,
- int32_t* status);
-HAL_Bool HAL_GetDIO(HAL_DigitalHandle dioPortHandle, int32_t* status);
-HAL_Bool HAL_GetDIODirection(HAL_DigitalHandle dioPortHandle, int32_t* status);
-void HAL_Pulse(HAL_DigitalHandle dioPortHandle, double pulseLength,
- int32_t* status);
-HAL_Bool HAL_IsPulsing(HAL_DigitalHandle dioPortHandle, int32_t* status);
-HAL_Bool HAL_IsAnyPulsing(int32_t* status);
-
-void HAL_SetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t filterIndex,
- int32_t* status);
-int32_t HAL_GetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t* status);
-void HAL_SetFilterPeriod(int32_t filterIndex, int64_t value, int32_t* status);
-int64_t HAL_GetFilterPeriod(int32_t filterIndex, int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/DriverStation.h b/third_party/allwpilib_2017/hal/include/HAL/DriverStation.h
deleted file mode 100644
index e2097f2..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/DriverStation.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2013-2017. 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 <stdint.h>
-
-#include <cstddef>
-
-#include "HAL/Types.h"
-
-#define HAL_IO_CONFIG_DATA_SIZE 32
-#define HAL_SYS_STATUS_DATA_SIZE 44
-#define HAL_USER_STATUS_DATA_SIZE \
- (984 - HAL_IO_CONFIG_DATA_SIZE - HAL_SYS_STATUS_DATA_SIZE)
-
-#define HALFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input 17
-#define HALFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output 18
-#define HALFRC_NetworkCommunication_DynamicType_Kinect_Header 19
-#define HALFRC_NetworkCommunication_DynamicType_Kinect_Extra1 20
-#define HALFRC_NetworkCommunication_DynamicType_Kinect_Vertices1 21
-#define HALFRC_NetworkCommunication_DynamicType_Kinect_Extra2 22
-#define HALFRC_NetworkCommunication_DynamicType_Kinect_Vertices2 23
-#define HALFRC_NetworkCommunication_DynamicType_Kinect_Joystick 24
-#define HALFRC_NetworkCommunication_DynamicType_Kinect_Custom 25
-
-struct HAL_ControlWord {
- uint32_t enabled : 1;
- uint32_t autonomous : 1;
- uint32_t test : 1;
- uint32_t eStop : 1;
- uint32_t fmsAttached : 1;
- uint32_t dsAttached : 1;
- uint32_t control_reserved : 26;
-};
-
-enum HAL_AllianceStationID : int32_t {
- HAL_AllianceStationID_kRed1,
- HAL_AllianceStationID_kRed2,
- HAL_AllianceStationID_kRed3,
- HAL_AllianceStationID_kBlue1,
- HAL_AllianceStationID_kBlue2,
- HAL_AllianceStationID_kBlue3,
-};
-
-/* The maximum number of axes that will be stored in a single HALJoystickAxes
- * struct. This is used for allocating buffers, not bounds checking, since
- * there are usually less axes in practice.
- */
-#define HAL_kMaxJoystickAxes 12
-#define HAL_kMaxJoystickPOVs 12
-
-struct HAL_JoystickAxes {
- int16_t count;
- float axes[HAL_kMaxJoystickAxes];
-};
-
-struct HAL_JoystickPOVs {
- int16_t count;
- int16_t povs[HAL_kMaxJoystickPOVs];
-};
-
-struct HAL_JoystickButtons {
- uint32_t buttons;
- uint8_t count;
-};
-
-struct HAL_JoystickDescriptor {
- uint8_t isXbox;
- uint8_t type;
- char name[256];
- uint8_t axisCount;
- uint8_t axisTypes[HAL_kMaxJoystickAxes];
- uint8_t buttonCount;
- uint8_t povCount;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-int32_t HAL_SetErrorData(const char* errors, int32_t errorsLength,
- int32_t waitMs);
-int32_t HAL_SendError(HAL_Bool isError, int32_t errorCode, HAL_Bool isLVCode,
- const char* details, const char* location,
- const char* callStack, HAL_Bool printMsg);
-
-int32_t HAL_GetControlWord(HAL_ControlWord* controlWord);
-HAL_AllianceStationID HAL_GetAllianceStation(int32_t* status);
-int32_t HAL_GetJoystickAxes(int32_t joystickNum, HAL_JoystickAxes* axes);
-int32_t HAL_GetJoystickPOVs(int32_t joystickNum, HAL_JoystickPOVs* povs);
-int32_t HAL_GetJoystickButtons(int32_t joystickNum,
- HAL_JoystickButtons* buttons);
-int32_t HAL_GetJoystickDescriptor(int32_t joystickNum,
- HAL_JoystickDescriptor* desc);
-HAL_Bool HAL_GetJoystickIsXbox(int32_t joystickNum);
-int32_t HAL_GetJoystickType(int32_t joystickNum);
-char* HAL_GetJoystickName(int32_t joystickNum);
-int32_t HAL_GetJoystickAxisType(int32_t joystickNum, int32_t axis);
-int32_t HAL_SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
- int32_t leftRumble, int32_t rightRumble);
-double HAL_GetMatchTime(int32_t* status);
-
-#ifndef HAL_USE_LABVIEW
-
-void HAL_WaitForDSData(void);
-void HAL_InitializeDriverStation(void);
-
-void HAL_ObserveUserProgramStarting(void);
-void HAL_ObserveUserProgramDisabled(void);
-void HAL_ObserveUserProgramAutonomous(void);
-void HAL_ObserveUserProgramTeleop(void);
-void HAL_ObserveUserProgramTest(void);
-
-#endif // HAL_USE_LABVIEW
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/Encoder.h b/third_party/allwpilib_2017/hal/include/HAL/Encoder.h
deleted file mode 100644
index c86ca8e..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/Encoder.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/AnalogTrigger.h"
-#include "HAL/Types.h"
-
-enum HAL_EncoderIndexingType : int32_t {
- HAL_kResetWhileHigh,
- HAL_kResetWhileLow,
- HAL_kResetOnFallingEdge,
- HAL_kResetOnRisingEdge
-};
-enum HAL_EncoderEncodingType : int32_t {
- HAL_Encoder_k1X,
- HAL_Encoder_k2X,
- HAL_Encoder_k4X
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-HAL_EncoderHandle HAL_InitializeEncoder(
- HAL_Handle digitalSourceHandleA, HAL_AnalogTriggerType analogTriggerTypeA,
- HAL_Handle digitalSourceHandleB, HAL_AnalogTriggerType analogTriggerTypeB,
- HAL_Bool reverseDirection, HAL_EncoderEncodingType encodingType,
- int32_t* status);
-void HAL_FreeEncoder(HAL_EncoderHandle encoderHandle, int32_t* status);
-int32_t HAL_GetEncoder(HAL_EncoderHandle encoderHandle, int32_t* status);
-int32_t HAL_GetEncoderRaw(HAL_EncoderHandle encoderHandle, int32_t* status);
-int32_t HAL_GetEncoderEncodingScale(HAL_EncoderHandle encoderHandle,
- int32_t* status);
-void HAL_ResetEncoder(HAL_EncoderHandle encoderHandle, int32_t* status);
-double HAL_GetEncoderPeriod(HAL_EncoderHandle encoderHandle, int32_t* status);
-void HAL_SetEncoderMaxPeriod(HAL_EncoderHandle encoderHandle, double maxPeriod,
- int32_t* status);
-HAL_Bool HAL_GetEncoderStopped(HAL_EncoderHandle encoderHandle,
- int32_t* status);
-HAL_Bool HAL_GetEncoderDirection(HAL_EncoderHandle encoderHandle,
- int32_t* status);
-double HAL_GetEncoderDistance(HAL_EncoderHandle encoderHandle, int32_t* status);
-double HAL_GetEncoderRate(HAL_EncoderHandle encoderHandle, int32_t* status);
-void HAL_SetEncoderMinRate(HAL_EncoderHandle encoderHandle, double minRate,
- int32_t* status);
-void HAL_SetEncoderDistancePerPulse(HAL_EncoderHandle encoderHandle,
- double distancePerPulse, int32_t* status);
-void HAL_SetEncoderReverseDirection(HAL_EncoderHandle encoderHandle,
- HAL_Bool reverseDirection, int32_t* status);
-void HAL_SetEncoderSamplesToAverage(HAL_EncoderHandle encoderHandle,
- int32_t samplesToAverage, int32_t* status);
-int32_t HAL_GetEncoderSamplesToAverage(HAL_EncoderHandle encoderHandle,
- int32_t* status);
-
-void HAL_SetEncoderIndexSource(HAL_EncoderHandle encoderHandle,
- HAL_Handle digitalSourceHandle,
- HAL_AnalogTriggerType analogTriggerType,
- HAL_EncoderIndexingType type, int32_t* status);
-
-int32_t HAL_GetEncoderFPGAIndex(HAL_EncoderHandle encoderHandle,
- int32_t* status);
-
-double HAL_GetEncoderDecodingScaleFactor(HAL_EncoderHandle encoderHandle,
- int32_t* status);
-
-double HAL_GetEncoderDistancePerPulse(HAL_EncoderHandle encoderHandle,
- int32_t* status);
-
-HAL_EncoderEncodingType HAL_GetEncoderEncodingType(
- HAL_EncoderHandle encoderHandle, int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/Errors.h b/third_party/allwpilib_2017/hal/include/HAL/Errors.h
deleted file mode 100644
index a31fa9f..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/Errors.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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
-
-#define CTR_RxTimeout_MESSAGE "CTRE CAN Receive Timeout"
-#define CTR_TxTimeout_MESSAGE "CTRE CAN Transmit Timeout"
-#define CTR_InvalidParamValue_MESSAGE "CTRE CAN Invalid Parameter"
-#define CTR_UnexpectedArbId_MESSAGE \
- "CTRE Unexpected Arbitration ID (CAN Node ID)"
-#define CTR_TxFailed_MESSAGE "CTRE CAN Transmit Error"
-#define CTR_SigNotUpdated_MESSAGE "CTRE CAN Signal Not Updated"
-
-#define NiFpga_Status_FifoTimeout_MESSAGE "NIFPGA: FIFO timeout error"
-#define NiFpga_Status_TransferAborted_MESSAGE "NIFPGA: Transfer aborted error"
-#define NiFpga_Status_MemoryFull_MESSAGE \
- "NIFPGA: Memory Allocation failed, memory full"
-#define NiFpga_Status_SoftwareFault_MESSAGE "NIFPGA: Unexpected software error"
-#define NiFpga_Status_InvalidParameter_MESSAGE "NIFPGA: Invalid Parameter"
-#define NiFpga_Status_ResourceNotFound_MESSAGE "NIFPGA: Resource not found"
-#define NiFpga_Status_ResourceNotInitialized_MESSAGE \
- "NIFPGA: Resource not initialized"
-#define NiFpga_Status_HardwareFault_MESSAGE "NIFPGA: Hardware Fault"
-#define NiFpga_Status_IrqTimeout_MESSAGE "NIFPGA: Interrupt timeout"
-
-#define ERR_CANSessionMux_InvalidBuffer_MESSAGE "CAN: Invalid Buffer"
-#define ERR_CANSessionMux_MessageNotFound_MESSAGE "CAN: Message not found"
-#define WARN_CANSessionMux_NoToken_MESSAGE "CAN: No token"
-#define ERR_CANSessionMux_NotAllowed_MESSAGE "CAN: Not allowed"
-#define ERR_CANSessionMux_NotInitialized_MESSAGE "CAN: Not initialized"
-
-#define SAMPLE_RATE_TOO_HIGH 1001
-#define SAMPLE_RATE_TOO_HIGH_MESSAGE \
- "HAL: Analog module sample rate is too high"
-#define VOLTAGE_OUT_OF_RANGE 1002
-#define VOLTAGE_OUT_OF_RANGE_MESSAGE \
- "HAL: Voltage to convert to raw value is out of range [0; 5]"
-#define LOOP_TIMING_ERROR 1004
-#define LOOP_TIMING_ERROR_MESSAGE \
- "HAL: Digital module loop timing is not the expected value"
-#define SPI_WRITE_NO_MOSI 1012
-#define SPI_WRITE_NO_MOSI_MESSAGE \
- "HAL: Cannot write to SPI port with no MOSI output"
-#define SPI_READ_NO_MISO 1013
-#define SPI_READ_NO_MISO_MESSAGE \
- "HAL: Cannot read from SPI port with no MISO input"
-#define SPI_READ_NO_DATA 1014
-#define SPI_READ_NO_DATA_MESSAGE "HAL: No data available to read from SPI"
-#define INCOMPATIBLE_STATE 1015
-#define INCOMPATIBLE_STATE_MESSAGE \
- "HAL: Incompatible State: The operation cannot be completed"
-#define NO_AVAILABLE_RESOURCES -1004
-#define NO_AVAILABLE_RESOURCES_MESSAGE "HAL: No available resources to allocate"
-#define NULL_PARAMETER -1005
-#define NULL_PARAMETER_MESSAGE "HAL: A pointer parameter to a method is NULL"
-#define ANALOG_TRIGGER_LIMIT_ORDER_ERROR -1010
-#define ANALOG_TRIGGER_LIMIT_ORDER_ERROR_MESSAGE \
- "HAL: AnalogTrigger limits error. Lower limit > Upper Limit"
-#define ANALOG_TRIGGER_PULSE_OUTPUT_ERROR -1011
-#define ANALOG_TRIGGER_PULSE_OUTPUT_ERROR_MESSAGE \
- "HAL: Attempted to read AnalogTrigger pulse output."
-#define PARAMETER_OUT_OF_RANGE -1028
-#define PARAMETER_OUT_OF_RANGE_MESSAGE "HAL: A parameter is out of range."
-#define RESOURCE_IS_ALLOCATED -1029
-#define RESOURCE_IS_ALLOCATED_MESSAGE "HAL: Resource already allocated"
-#define RESOURCE_OUT_OF_RANGE -1030
-#define RESOURCE_OUT_OF_RANGE_MESSAGE \
- "HAL: The requested resource is out of range."
-#define HAL_INVALID_ACCUMULATOR_CHANNEL -1035
-#define HAL_INVALID_ACCUMULATOR_CHANNEL_MESSAGE \
- "HAL: The requested input is not an accumulator channel"
-#define HAL_COUNTER_NOT_SUPPORTED -1058
-#define HAL_COUNTER_NOT_SUPPORTED_MESSAGE \
- "HAL: Counter mode not supported for encoder method"
-#define HAL_PWM_SCALE_ERROR -1072
-#define HAL_PWM_SCALE_ERROR_MESSAGE \
- "HAL: The PWM Scale Factors are out of range"
-#define HAL_HANDLE_ERROR -1098
-#define HAL_HANDLE_ERROR_MESSAGE \
- "HAL: A handle parameter was passed incorrectly"
-
-#define HAL_SERIAL_PORT_NOT_FOUND -1123
-#define HAL_SERIAL_PORT_NOT_FOUND_MESSAGE \
- "HAL: The specified serial port device was not found"
-
-#define HAL_SERIAL_PORT_OPEN_ERROR -1124
-#define HAL_SERIAL_PORT_OPEN_ERROR_MESSAGE \
- "HAL: The serial port could not be opened"
-
-#define HAL_SERIAL_PORT_ERROR -1125
-#define HAL_SERIAL_PORT_ERROR_MESSAGE \
- "HAL: There was an error on the serial port"
-
-#define HAL_THREAD_PRIORITY_ERROR -1152
-#define HAL_THREAD_PRIORITY_ERROR_MESSAGE \
- "HAL: Getting or setting the priority of a thread has failed";
-
-#define HAL_THREAD_PRIORITY_RANGE_ERROR -1153
-#define HAL_THREAD_PRIORITY_RANGE_ERROR_MESSAGE \
- "HAL: The priority requested to be set is invalid"
-
-#define VI_ERROR_SYSTEM_ERROR_MESSAGE "HAL - VISA: System Error";
-#define VI_ERROR_INV_OBJECT_MESSAGE "HAL - VISA: Invalid Object"
-#define VI_ERROR_RSRC_LOCKED_MESSAGE "HAL - VISA: Resource Locked"
-#define VI_ERROR_RSRC_NFOUND_MESSAGE "HAL - VISA: Resource Not Found"
-#define VI_ERROR_INV_RSRC_NAME_MESSAGE "HAL - VISA: Invalid Resource Name"
-#define VI_ERROR_QUEUE_OVERFLOW_MESSAGE "HAL - VISA: Queue Overflow"
-#define VI_ERROR_IO_MESSAGE "HAL - VISA: General IO Error"
-#define VI_ERROR_ASRL_PARITY_MESSAGE "HAL - VISA: Parity Error"
-#define VI_ERROR_ASRL_FRAMING_MESSAGE "HAL - VISA: Framing Error"
-#define VI_ERROR_ASRL_OVERRUN_MESSAGE "HAL - VISA: Buffer Overrun Error"
-#define VI_ERROR_RSRC_BUSY_MESSAGE "HAL - VISA: Resource Busy"
-#define VI_ERROR_INV_PARAMETER_MESSAGE "HAL - VISA: Invalid Parameter"
diff --git a/third_party/allwpilib_2017/hal/include/HAL/HAL.h b/third_party/allwpilib_2017/hal/include/HAL/HAL.h
deleted file mode 100644
index bd8c6ca..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/HAL.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2013-2017. 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 <stdint.h>
-
-#ifndef HAL_USE_LABVIEW
-
-#include "HAL/AnalogAccumulator.h"
-#include "HAL/AnalogInput.h"
-#include "HAL/AnalogOutput.h"
-#include "HAL/AnalogTrigger.h"
-#include "HAL/Compressor.h"
-#include "HAL/Constants.h"
-#include "HAL/Counter.h"
-#include "HAL/DIO.h"
-#include "HAL/DriverStation.h"
-#include "HAL/Errors.h"
-#include "HAL/I2C.h"
-#include "HAL/Interrupts.h"
-#include "HAL/Notifier.h"
-#include "HAL/PDP.h"
-#include "HAL/PWM.h"
-#include "HAL/Ports.h"
-#include "HAL/Power.h"
-#include "HAL/Relay.h"
-#include "HAL/SPI.h"
-#include "HAL/Solenoid.h"
-
-#endif // HAL_USE_LABVIEW
-
-#include "FRC_NetworkCommunication/UsageReporting.h"
-#include "HAL/Types.h"
-
-namespace HALUsageReporting = nUsageReporting;
-
-enum HAL_RuntimeType : int32_t { HAL_Athena, HAL_Mock };
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-const char* HAL_GetErrorMessage(int32_t code);
-
-int32_t HAL_GetFPGAVersion(int32_t* status);
-int64_t HAL_GetFPGARevision(int32_t* status);
-
-HAL_RuntimeType HAL_GetRuntimeType();
-HAL_Bool HAL_GetFPGAButton(int32_t* status);
-
-HAL_Bool HAL_GetSystemActive(int32_t* status);
-HAL_Bool HAL_GetBrownedOut(int32_t* status);
-
-void HAL_BaseInitialize(int32_t* status);
-
-#ifndef HAL_USE_LABVIEW
-
-HAL_PortHandle HAL_GetPort(int32_t channel);
-HAL_PortHandle HAL_GetPortWithModule(int32_t module, int32_t channel);
-
-uint64_t HAL_GetFPGATime(int32_t* status);
-
-int32_t HAL_Initialize(int32_t mode);
-
-// ifdef's definition is to allow for default parameters in C++.
-#ifdef __cplusplus
-int64_t HAL_Report(int32_t resource, int32_t instanceNumber,
- int32_t context = 0, const char* feature = nullptr);
-#else
-int64_t HAL_Report(int32_t resource, int32_t instanceNumber, int32_t context,
- const char* feature);
-#endif
-
-#endif // HAL_USE_LABVIEW
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/I2C.h b/third_party/allwpilib_2017/hal/include/HAL/I2C.h
deleted file mode 100644
index 3543f37..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/I2C.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void HAL_InitializeI2C(int32_t port, int32_t* status);
-int32_t HAL_TransactionI2C(int32_t port, int32_t deviceAddress,
- uint8_t* dataToSend, int32_t sendSize,
- uint8_t* dataReceived, int32_t receiveSize);
-int32_t HAL_WriteI2C(int32_t port, int32_t deviceAddress, uint8_t* dataToSend,
- int32_t sendSize);
-int32_t HAL_ReadI2C(int32_t port, int32_t deviceAddress, uint8_t* buffer,
- int32_t count);
-void HAL_CloseI2C(int32_t port);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/Interrupts.h b/third_party/allwpilib_2017/hal/include/HAL/Interrupts.h
deleted file mode 100644
index af2fd7b..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/Interrupts.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/AnalogTrigger.h"
-#include "HAL/Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*HAL_InterruptHandlerFunction)(uint32_t interruptAssertedMask,
- void* param);
-
-HAL_InterruptHandle HAL_InitializeInterrupts(HAL_Bool watcher, int32_t* status);
-void HAL_CleanInterrupts(HAL_InterruptHandle interruptHandle, int32_t* status);
-
-int64_t HAL_WaitForInterrupt(HAL_InterruptHandle interruptHandle,
- double timeout, HAL_Bool ignorePrevious,
- int32_t* status);
-void HAL_EnableInterrupts(HAL_InterruptHandle interruptHandle, int32_t* status);
-void HAL_DisableInterrupts(HAL_InterruptHandle interruptHandle,
- int32_t* status);
-double HAL_ReadInterruptRisingTimestamp(HAL_InterruptHandle interruptHandle,
- int32_t* status);
-double HAL_ReadInterruptFallingTimestamp(HAL_InterruptHandle interruptHandle,
- int32_t* status);
-void HAL_RequestInterrupts(HAL_InterruptHandle interruptHandle,
- HAL_Handle digitalSourceHandle,
- HAL_AnalogTriggerType analogTriggerType,
- int32_t* status);
-void HAL_AttachInterruptHandler(HAL_InterruptHandle interruptHandle,
- HAL_InterruptHandlerFunction handler,
- void* param, int32_t* status);
-void HAL_AttachInterruptHandlerThreaded(HAL_InterruptHandle interruptHandle,
- HAL_InterruptHandlerFunction handler,
- void* param, int32_t* status);
-void HAL_SetInterruptUpSourceEdge(HAL_InterruptHandle interruptHandle,
- HAL_Bool risingEdge, HAL_Bool fallingEdge,
- int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/LabVIEW/HAL.h b/third_party/allwpilib_2017/hal/include/HAL/LabVIEW/HAL.h
deleted file mode 100644
index 722c251..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/LabVIEW/HAL.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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
-
-#define HAL_USE_LABVIEW
-
-#include "HAL/DriverStation.h"
-#include "HAL/HAL.h"
-#include "HAL/Types.h"
diff --git a/third_party/allwpilib_2017/hal/include/HAL/Notifier.h b/third_party/allwpilib_2017/hal/include/HAL/Notifier.h
deleted file mode 100644
index 4df1819..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/Notifier.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*HAL_NotifierProcessFunction)(uint64_t currentTime,
- HAL_NotifierHandle handle);
-
-HAL_NotifierHandle HAL_InitializeNotifier(HAL_NotifierProcessFunction process,
- void* param, int32_t* status);
-HAL_NotifierHandle HAL_InitializeNotifierThreaded(
- HAL_NotifierProcessFunction process, void* param, int32_t* status);
-void HAL_CleanNotifier(HAL_NotifierHandle notifierHandle, int32_t* status);
-void* HAL_GetNotifierParam(HAL_NotifierHandle notifierHandle, int32_t* status);
-void HAL_UpdateNotifierAlarm(HAL_NotifierHandle notifierHandle,
- uint64_t triggerTime, int32_t* status);
-void HAL_StopNotifierAlarm(HAL_NotifierHandle notifierHandle, int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/OSSerialPort.h b/third_party/allwpilib_2017/hal/include/HAL/OSSerialPort.h
deleted file mode 100644
index 21696cc..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/OSSerialPort.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "SerialPort.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void HAL_InitializeOSSerialPort(HAL_SerialPort port, int32_t* status);
-void HAL_SetOSSerialBaudRate(HAL_SerialPort port, int32_t baud,
- int32_t* status);
-void HAL_SetOSSerialDataBits(HAL_SerialPort port, int32_t bits,
- int32_t* status);
-void HAL_SetOSSerialParity(HAL_SerialPort port, int32_t parity,
- int32_t* status);
-void HAL_SetOSSerialStopBits(HAL_SerialPort port, int32_t stopBits,
- int32_t* status);
-void HAL_SetOSSerialWriteMode(HAL_SerialPort port, int32_t mode,
- int32_t* status);
-void HAL_SetOSSerialFlowControl(HAL_SerialPort port, int32_t flow,
- int32_t* status);
-void HAL_SetOSSerialTimeout(HAL_SerialPort port, double timeout,
- int32_t* status);
-void HAL_EnableOSSerialTermination(HAL_SerialPort port, char terminator,
- int32_t* status);
-void HAL_DisableOSSerialTermination(HAL_SerialPort port, int32_t* status);
-void HAL_SetOSSerialReadBufferSize(HAL_SerialPort port, int32_t size,
- int32_t* status);
-void HAL_SetOSSerialWriteBufferSize(HAL_SerialPort port, int32_t size,
- int32_t* status);
-int32_t HAL_GetOSSerialBytesReceived(HAL_SerialPort port, int32_t* status);
-int32_t HAL_ReadOSSerial(HAL_SerialPort port, char* buffer, int32_t count,
- int32_t* status);
-int32_t HAL_WriteOSSerial(HAL_SerialPort port, const char* buffer,
- int32_t count, int32_t* status);
-void HAL_FlushOSSerial(HAL_SerialPort port, int32_t* status);
-void HAL_ClearOSSerial(HAL_SerialPort port, int32_t* status);
-void HAL_CloseOSSerial(HAL_SerialPort port, int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/PDP.h b/third_party/allwpilib_2017/hal/include/HAL/PDP.h
deleted file mode 100644
index e63bb7b..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/PDP.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void HAL_InitializePDP(int32_t module, int32_t* status);
-HAL_Bool HAL_CheckPDPChannel(int32_t channel);
-HAL_Bool HAL_CheckPDPModule(int32_t module);
-double HAL_GetPDPTemperature(int32_t module, int32_t* status);
-double HAL_GetPDPVoltage(int32_t module, int32_t* status);
-double HAL_GetPDPChannelCurrent(int32_t module, int32_t channel,
- int32_t* status);
-double HAL_GetPDPTotalCurrent(int32_t module, int32_t* status);
-double HAL_GetPDPTotalPower(int32_t module, int32_t* status);
-double HAL_GetPDPTotalEnergy(int32_t module, int32_t* status);
-void HAL_ResetPDPTotalEnergy(int32_t module, int32_t* status);
-void HAL_ClearPDPStickyFaults(int32_t module, int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/PWM.h b/third_party/allwpilib_2017/hal/include/HAL/PWM.h
deleted file mode 100644
index 6db7bdc..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/PWM.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-HAL_DigitalHandle HAL_InitializePWMPort(HAL_PortHandle portHandle,
- int32_t* status);
-void HAL_FreePWMPort(HAL_DigitalHandle pwmPortHandle, int32_t* status);
-
-HAL_Bool HAL_CheckPWMChannel(int32_t channel);
-
-void HAL_SetPWMConfig(HAL_DigitalHandle pwmPortHandle, double maxPwm,
- double deadbandMaxPwm, double centerPwm,
- double deadbandMinPwm, double minPwm, int32_t* status);
-void HAL_SetPWMConfigRaw(HAL_DigitalHandle pwmPortHandle, int32_t maxPwm,
- int32_t deadbandMaxPwm, int32_t centerPwm,
- int32_t deadbandMinPwm, int32_t minPwm,
- int32_t* status);
-void HAL_GetPWMConfigRaw(HAL_DigitalHandle pwmPortHandle, int32_t* maxPwm,
- int32_t* deadbandMaxPwm, int32_t* centerPwm,
- int32_t* deadbandMinPwm, int32_t* minPwm,
- int32_t* status);
-void HAL_SetPWMEliminateDeadband(HAL_DigitalHandle pwmPortHandle,
- HAL_Bool eliminateDeadband, int32_t* status);
-HAL_Bool HAL_GetPWMEliminateDeadband(HAL_DigitalHandle pwmPortHandle,
- int32_t* status);
-void HAL_SetPWMRaw(HAL_DigitalHandle pwmPortHandle, int32_t value,
- int32_t* status);
-void HAL_SetPWMSpeed(HAL_DigitalHandle pwmPortHandle, double speed,
- int32_t* status);
-void HAL_SetPWMPosition(HAL_DigitalHandle pwmPortHandle, double position,
- int32_t* status);
-void HAL_SetPWMDisabled(HAL_DigitalHandle pwmPortHandle, int32_t* status);
-int32_t HAL_GetPWMRaw(HAL_DigitalHandle pwmPortHandle, int32_t* status);
-double HAL_GetPWMSpeed(HAL_DigitalHandle pwmPortHandle, int32_t* status);
-double HAL_GetPWMPosition(HAL_DigitalHandle pwmPortHandle, int32_t* status);
-void HAL_LatchPWMZero(HAL_DigitalHandle pwmPortHandle, int32_t* status);
-void HAL_SetPWMPeriodScale(HAL_DigitalHandle pwmPortHandle, int32_t squelchMask,
- int32_t* status);
-int32_t HAL_GetLoopTiming(int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/Ports.h b/third_party/allwpilib_2017/hal/include/HAL/Ports.h
deleted file mode 100644
index afa691a..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/Ports.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int32_t HAL_GetNumAccumulators(void);
-int32_t HAL_GetNumAnalogTriggers(void);
-int32_t HAL_GetNumAnalogInputs(void);
-int32_t HAL_GetNumAnalogOutputs(void);
-int32_t HAL_GetNumCounters(void);
-int32_t HAL_GetNumDigitalHeaders(void);
-int32_t HAL_GetNumPWMHeaders(void);
-int32_t HAL_GetNumDigitalChannels(void);
-int32_t HAL_GetNumPWMChannels(void);
-int32_t HAL_GetNumDigitalPWMOutputs(void);
-int32_t HAL_GetNumEncoders(void);
-int32_t HAL_GetNumInterrupts(void);
-int32_t HAL_GetNumRelayChannels(void);
-int32_t HAL_GetNumRelayHeaders(void);
-int32_t HAL_GetNumPCMModules(void);
-int32_t HAL_GetNumSolenoidChannels(void);
-int32_t HAL_GetNumPDPModules(void);
-int32_t HAL_GetNumPDPChannels(void);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/Power.h b/third_party/allwpilib_2017/hal/include/HAL/Power.h
deleted file mode 100644
index da53f72..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/Power.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-double HAL_GetVinVoltage(int32_t* status);
-double HAL_GetVinCurrent(int32_t* status);
-double HAL_GetUserVoltage6V(int32_t* status);
-double HAL_GetUserCurrent6V(int32_t* status);
-HAL_Bool HAL_GetUserActive6V(int32_t* status);
-int32_t HAL_GetUserCurrentFaults6V(int32_t* status);
-double HAL_GetUserVoltage5V(int32_t* status);
-double HAL_GetUserCurrent5V(int32_t* status);
-HAL_Bool HAL_GetUserActive5V(int32_t* status);
-int32_t HAL_GetUserCurrentFaults5V(int32_t* status);
-double HAL_GetUserVoltage3V3(int32_t* status);
-double HAL_GetUserCurrent3V3(int32_t* status);
-HAL_Bool HAL_GetUserActive3V3(int32_t* status);
-int32_t HAL_GetUserCurrentFaults3V3(int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/Relay.h b/third_party/allwpilib_2017/hal/include/HAL/Relay.h
deleted file mode 100644
index cc83799..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/Relay.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-HAL_RelayHandle HAL_InitializeRelayPort(HAL_PortHandle portHandle, HAL_Bool fwd,
- int32_t* status);
-void HAL_FreeRelayPort(HAL_RelayHandle relayPortHandle);
-
-HAL_Bool HAL_CheckRelayChannel(int32_t channel);
-
-void HAL_SetRelay(HAL_RelayHandle relayPortHandle, HAL_Bool on,
- int32_t* status);
-HAL_Bool HAL_GetRelay(HAL_RelayHandle relayPortHandle, int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/SPI.h b/third_party/allwpilib_2017/hal/include/HAL/SPI.h
deleted file mode 100644
index d29d9f3..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/SPI.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void HAL_InitializeSPI(int32_t port, int32_t* status);
-int32_t HAL_TransactionSPI(int32_t port, uint8_t* dataToSend,
- uint8_t* dataReceived, int32_t size);
-int32_t HAL_WriteSPI(int32_t port, uint8_t* dataToSend, int32_t sendSize);
-int32_t HAL_ReadSPI(int32_t port, uint8_t* buffer, int32_t count);
-void HAL_CloseSPI(int32_t port);
-void HAL_SetSPISpeed(int32_t port, int32_t speed);
-void HAL_SetSPIOpts(int32_t port, HAL_Bool msbFirst, HAL_Bool sampleOnTrailing,
- HAL_Bool clkIdleHigh);
-void HAL_SetSPIChipSelectActiveHigh(int32_t port, int32_t* status);
-void HAL_SetSPIChipSelectActiveLow(int32_t port, int32_t* status);
-int32_t HAL_GetSPIHandle(int32_t port);
-void HAL_SetSPIHandle(int32_t port, int32_t handle);
-
-void HAL_InitSPIAccumulator(int32_t port, int32_t period, int32_t cmd,
- int32_t xferSize, int32_t validMask,
- int32_t validValue, int32_t dataShift,
- int32_t dataSize, HAL_Bool isSigned,
- HAL_Bool bigEndian, int32_t* status);
-void HAL_FreeSPIAccumulator(int32_t port, int32_t* status);
-void HAL_ResetSPIAccumulator(int32_t port, int32_t* status);
-void HAL_SetSPIAccumulatorCenter(int32_t port, int32_t center, int32_t* status);
-void HAL_SetSPIAccumulatorDeadband(int32_t port, int32_t deadband,
- int32_t* status);
-int32_t HAL_GetSPIAccumulatorLastValue(int32_t port, int32_t* status);
-int64_t HAL_GetSPIAccumulatorValue(int32_t port, int32_t* status);
-int64_t HAL_GetSPIAccumulatorCount(int32_t port, int32_t* status);
-double HAL_GetSPIAccumulatorAverage(int32_t port, int32_t* status);
-void HAL_GetSPIAccumulatorOutput(int32_t port, int64_t* value, int64_t* count,
- int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/SerialPort.h b/third_party/allwpilib_2017/hal/include/HAL/SerialPort.h
deleted file mode 100644
index 3b5aa92..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/SerialPort.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-enum HAL_SerialPort : int32_t {
- HAL_SerialPort_Onboard = 0,
- HAL_SerialPort_MXP = 1,
- HAL_SerialPort_USB1 = 2,
- HAL_SerialPort_USB2 = 3
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void HAL_InitializeSerialPort(HAL_SerialPort port, int32_t* status);
-void HAL_SetSerialBaudRate(HAL_SerialPort port, int32_t baud, int32_t* status);
-void HAL_SetSerialDataBits(HAL_SerialPort port, int32_t bits, int32_t* status);
-void HAL_SetSerialParity(HAL_SerialPort port, int32_t parity, int32_t* status);
-void HAL_SetSerialStopBits(HAL_SerialPort port, int32_t stopBits,
- int32_t* status);
-void HAL_SetSerialWriteMode(HAL_SerialPort port, int32_t mode, int32_t* status);
-void HAL_SetSerialFlowControl(HAL_SerialPort port, int32_t flow,
- int32_t* status);
-void HAL_SetSerialTimeout(HAL_SerialPort port, double timeout, int32_t* status);
-void HAL_EnableSerialTermination(HAL_SerialPort port, char terminator,
- int32_t* status);
-void HAL_DisableSerialTermination(HAL_SerialPort port, int32_t* status);
-void HAL_SetSerialReadBufferSize(HAL_SerialPort port, int32_t size,
- int32_t* status);
-void HAL_SetSerialWriteBufferSize(HAL_SerialPort port, int32_t size,
- int32_t* status);
-int32_t HAL_GetSerialBytesReceived(HAL_SerialPort port, int32_t* status);
-int32_t HAL_ReadSerial(HAL_SerialPort port, char* buffer, int32_t count,
- int32_t* status);
-int32_t HAL_WriteSerial(HAL_SerialPort port, const char* buffer, int32_t count,
- int32_t* status);
-void HAL_FlushSerial(HAL_SerialPort port, int32_t* status);
-void HAL_ClearSerial(HAL_SerialPort port, int32_t* status);
-void HAL_CloseSerial(HAL_SerialPort port, int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/Solenoid.h b/third_party/allwpilib_2017/hal/include/HAL/Solenoid.h
deleted file mode 100644
index f434592..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/Solenoid.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-HAL_SolenoidHandle HAL_InitializeSolenoidPort(HAL_PortHandle portHandle,
- int32_t* status);
-void HAL_FreeSolenoidPort(HAL_SolenoidHandle solenoidPortHandle);
-HAL_Bool HAL_CheckSolenoidModule(int32_t module);
-HAL_Bool HAL_CheckSolenoidChannel(int32_t channel);
-HAL_Bool HAL_GetSolenoid(HAL_SolenoidHandle solenoidPortHandle,
- int32_t* status);
-int32_t HAL_GetAllSolenoids(int32_t module, int32_t* status);
-void HAL_SetSolenoid(HAL_SolenoidHandle solenoidPortHandle, HAL_Bool value,
- int32_t* status);
-void HAL_SetAllSolenoids(int32_t module, int32_t state, int32_t* status);
-int32_t HAL_GetPCMSolenoidBlackList(int32_t module, int32_t* status);
-HAL_Bool HAL_GetPCMSolenoidVoltageStickyFault(int32_t module, int32_t* status);
-HAL_Bool HAL_GetPCMSolenoidVoltageFault(int32_t module, int32_t* status);
-void HAL_ClearAllPCMStickyFaults(int32_t module, int32_t* status);
-#ifdef __cplusplus
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/Threads.h b/third_party/allwpilib_2017/hal/include/HAL/Threads.h
deleted file mode 100644
index 8fe5578..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/Threads.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 "HAL/Types.h"
-
-#ifdef _WIN32
-#include <windows.h>
-#define NativeThreadHandle const HANDLE*
-#else
-#include <pthread.h>
-#define NativeThreadHandle const pthread_t*
-#endif
-
-extern "C" {
-int32_t HAL_GetThreadPriority(NativeThreadHandle handle, HAL_Bool* isRealTime,
- int32_t* status);
-int32_t HAL_GetCurrentThreadPriority(HAL_Bool* isRealTime, int32_t* status);
-HAL_Bool HAL_SetThreadPriority(NativeThreadHandle handle, HAL_Bool realTime,
- int32_t priority, int32_t* status);
-HAL_Bool HAL_SetCurrentThreadPriority(HAL_Bool realTime, int32_t priority,
- int32_t* status);
-}
diff --git a/third_party/allwpilib_2017/hal/include/HAL/Types.h b/third_party/allwpilib_2017/hal/include/HAL/Types.h
deleted file mode 100644
index 3b91159..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/Types.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#define HAL_kInvalidHandle 0
-
-typedef int32_t HAL_Handle;
-
-typedef HAL_Handle HAL_PortHandle;
-
-typedef HAL_Handle HAL_AnalogInputHandle;
-
-typedef HAL_Handle HAL_AnalogOutputHandle;
-
-typedef HAL_Handle HAL_AnalogTriggerHandle;
-
-typedef HAL_Handle HAL_CompressorHandle;
-
-typedef HAL_Handle HAL_CounterHandle;
-
-typedef HAL_Handle HAL_DigitalHandle;
-
-typedef HAL_Handle HAL_DigitalPWMHandle;
-
-typedef HAL_Handle HAL_EncoderHandle;
-
-typedef HAL_Handle HAL_FPGAEncoderHandle;
-
-typedef HAL_Handle HAL_GyroHandle;
-
-typedef HAL_Handle HAL_InterruptHandle;
-
-typedef HAL_Handle HAL_NotifierHandle;
-
-typedef HAL_Handle HAL_RelayHandle;
-
-typedef HAL_Handle HAL_SolenoidHandle;
-
-typedef int32_t HAL_Bool;
diff --git a/third_party/allwpilib_2017/hal/include/HAL/cpp/Log.h b/third_party/allwpilib_2017/hal/include/HAL/cpp/Log.h
deleted file mode 100644
index 4ddbd4f..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/cpp/Log.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <chrono>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <string>
-
-inline std::string NowTime();
-
-enum TLogLevel {
- logNONE,
- logERROR,
- logWARNING,
- logINFO,
- logDEBUG,
- logDEBUG1,
- logDEBUG2,
- logDEBUG3,
- logDEBUG4
-};
-
-class Log {
- public:
- Log();
- virtual ~Log();
- std::ostringstream& Get(TLogLevel level = logINFO);
-
- public:
- static TLogLevel& ReportingLevel();
- static std::string ToString(TLogLevel level);
- static TLogLevel FromString(const std::string& level);
-
- protected:
- std::ostringstream os;
-
- private:
- Log(const Log&);
- Log& operator=(const Log&);
-};
-
-inline Log::Log() {}
-
-inline std::ostringstream& Log::Get(TLogLevel level) {
- os << "- " << NowTime();
- os << " " << ToString(level) << ": ";
- os << std::string(level > logDEBUG ? level - logDEBUG : 0, '\t');
- return os;
-}
-
-inline Log::~Log() {
- os << std::endl;
- std::cerr << os.str();
-}
-
-inline TLogLevel& Log::ReportingLevel() {
- static TLogLevel reportingLevel = logDEBUG4;
- return reportingLevel;
-}
-
-inline std::string Log::ToString(TLogLevel level) {
- static const char* const buffer[] = {"NONE", "ERROR", "WARNING",
- "INFO", "DEBUG", "DEBUG1",
- "DEBUG2", "DEBUG3", "DEBUG4"};
- return buffer[level];
-}
-
-inline TLogLevel Log::FromString(const std::string& level) {
- if (level == "DEBUG4") return logDEBUG4;
- if (level == "DEBUG3") return logDEBUG3;
- if (level == "DEBUG2") return logDEBUG2;
- if (level == "DEBUG1") return logDEBUG1;
- if (level == "DEBUG") return logDEBUG;
- if (level == "INFO") return logINFO;
- if (level == "WARNING") return logWARNING;
- if (level == "ERROR") return logERROR;
- if (level == "NONE") return logNONE;
- Log().Get(logWARNING) << "Unknown logging level '" << level
- << "'. Using INFO level as default.";
- return logINFO;
-}
-
-typedef Log FILELog;
-
-#define FILE_LOG(level) \
- if (level > FILELog::ReportingLevel()) \
- ; \
- else \
- Log().Get(level)
-
-inline std::string NowTime() {
- std::stringstream ss;
- ss << std::setfill('0') << std::setw(2);
-
- using namespace std::chrono;
- auto now = system_clock::now().time_since_epoch();
-
- ss << duration_cast<hours>(now).count() % 24 << ":"
- << duration_cast<minutes>(now).count() % 60 << ":"
- << duration_cast<seconds>(now).count() % 60 << "."
- << duration_cast<milliseconds>(now).count() % 1000;
-
- return ss.str();
-}
diff --git a/third_party/allwpilib_2017/hal/include/HAL/cpp/Semaphore.h b/third_party/allwpilib_2017/hal/include/HAL/cpp/Semaphore.h
deleted file mode 100644
index 53e17d7..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/cpp/Semaphore.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include <condition_variable>
-
-#include "HAL/cpp/priority_mutex.h"
-#include "support/deprecated.h"
-
-class WPI_DEPRECATED(
- "Semaphore scheduled for removal in 2018. Recommended to replace with a "
- "std::mutex and std::condition_variable") Semaphore {
- public:
- explicit Semaphore(int32_t count = 0);
- Semaphore(Semaphore&&);
- Semaphore& operator=(Semaphore&&);
-
- void give();
- void take();
-
- // @return true if semaphore was locked successfully. false if not.
- bool tryTake();
-
- static const int32_t kNoWait = 0;
- static const int32_t kWaitForever = -1;
-
- static const int32_t kEmpty = 0;
- static const int32_t kFull = 1;
-
- private:
- priority_mutex m_mutex;
- std::condition_variable_any m_condition;
- int32_t m_count = 0;
-};
diff --git a/third_party/allwpilib_2017/hal/include/HAL/cpp/SerialHelper.h b/third_party/allwpilib_2017/hal/include/HAL/cpp/SerialHelper.h
deleted file mode 100644
index f416818..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/cpp/SerialHelper.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include <string>
-#include <vector>
-
-#include "HAL/SerialPort.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "llvm/SmallString.h"
-#include "llvm/SmallVector.h"
-
-namespace hal {
-class SerialHelper {
- public:
- SerialHelper();
-
- std::string GetVISASerialPortName(HAL_SerialPort port, int32_t* status);
- std::string GetOSSerialPortName(HAL_SerialPort port, int32_t* status);
-
- std::vector<std::string> GetVISASerialPortList(int32_t* status);
- std::vector<std::string> GetOSSerialPortList(int32_t* status);
-
- private:
- void SortHubPathVector();
- void CoiteratedSort(llvm::SmallVectorImpl<llvm::SmallString<16>>& vec);
- void QueryHubPaths(int32_t* status);
-
- int32_t GetIndexForPort(HAL_SerialPort port, int32_t* status);
-
- // Vectors to hold data before sorting.
- // Note we will most likely have at max 2 instances, and the longest string
- // is around 12, so these should never touch the heap;
- llvm::SmallVector<llvm::SmallString<16>, 4> m_visaResource;
- llvm::SmallVector<llvm::SmallString<16>, 4> m_osResource;
- llvm::SmallVector<llvm::SmallString<16>, 4> m_unsortedHubPath;
- llvm::SmallVector<llvm::SmallString<16>, 4> m_sortedHubPath;
-
- int32_t m_resourceHandle;
-
- static priority_mutex m_nameMutex;
- static std::string m_usbNames[2];
-};
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/include/HAL/cpp/make_unique.h b/third_party/allwpilib_2017/hal/include/HAL/cpp/make_unique.h
deleted file mode 100644
index d70f873..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/cpp/make_unique.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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
-
-// Define make_unique for C++11-only compilers
-#if __cplusplus == 201103L
-#include <cstddef>
-#include <memory>
-#include <type_traits>
-#include <utility>
-
-namespace std {
-template <class T>
-struct _Unique_if {
- typedef unique_ptr<T> _Single_object;
-};
-
-template <class T>
-struct _Unique_if<T[]> {
- typedef unique_ptr<T[]> _Unknown_bound;
-};
-
-template <class T, size_t N>
-struct _Unique_if<T[N]> {
- typedef void _Known_bound;
-};
-
-template <class T, class... Args>
-typename _Unique_if<T>::_Single_object make_unique(Args&&... args) {
- return unique_ptr<T>(new T(std::forward<Args>(args)...));
-}
-
-template <class T>
-typename _Unique_if<T>::_Unknown_bound make_unique(size_t n) {
- typedef typename remove_extent<T>::type U;
- return unique_ptr<T>(new U[n]());
-}
-
-template <class T, class... Args>
-typename _Unique_if<T>::_Known_bound make_unique(Args&&...) = delete;
-} // namespace std
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/HAL/cpp/priority_condition_variable.h b/third_party/allwpilib_2017/hal/include/HAL/cpp/priority_condition_variable.h
deleted file mode 100644
index 12aeba9..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/cpp/priority_condition_variable.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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
-
-/* std::condition_variable provides the native_handle() method to return its
- * underlying pthread_cond_t*. WPILib uses this to interface with the FRC
- * network communication library. Since WPILib uses a custom mutex class and
- * not std::mutex, std::condition_variable_any must be used instead.
- * std::condition_variable_any doesn't expose its internal handle, so this
- * class provides the same interface and implementation in addition to a
- * native_handle() method.
- */
-
-#include <condition_variable>
-#include <memory>
-#include <utility>
-
-#include "priority_mutex.h"
-
-class priority_condition_variable {
- typedef std::chrono::system_clock clock;
-
- public:
- typedef std::condition_variable::native_handle_type native_handle_type;
-
- priority_condition_variable() : m_mutex(std::make_shared<std::mutex>()) {}
- ~priority_condition_variable() = default;
-
- priority_condition_variable(const priority_condition_variable&) = delete;
- priority_condition_variable& operator=(const priority_condition_variable&) =
- delete;
-
- void notify_one() noexcept {
- std::lock_guard<std::mutex> lock(*m_mutex);
- m_cond.notify_one();
- }
-
- void notify_all() noexcept {
- std::lock_guard<std::mutex> lock(*m_mutex);
- m_cond.notify_all();
- }
-
- template <typename Lock>
- void wait(Lock& _lock) {
- std::shared_ptr<std::mutex> _mutex = m_mutex;
- std::unique_lock<std::mutex> my_lock(*_mutex);
- Unlock<Lock> unlock(_lock);
-
- // *mutex must be unlocked before re-locking _lock so move
- // ownership of *_mutex lock to an object with shorter lifetime.
- std::unique_lock<std::mutex> my_lock2(std::move(my_lock));
- m_cond.wait(my_lock2);
- }
-
- template <typename Lock, typename Predicate>
- void wait(Lock& lock, Predicate p) {
- while (!p()) {
- wait(lock);
- }
- }
-
- template <typename Lock, typename Clock, typename Duration>
- std::cv_status wait_until(
- Lock& _lock, const std::chrono::time_point<Clock, Duration>& atime) {
- std::shared_ptr<std::mutex> _mutex = m_mutex;
- std::unique_lock<std::mutex> my_lock(*_mutex);
- Unlock<Lock> unlock(_lock);
-
- // *_mutex must be unlocked before re-locking _lock so move
- // ownership of *_mutex lock to an object with shorter lifetime.
- std::unique_lock<std::mutex> my_lock2(std::move(my_lock));
- return m_cond.wait_until(my_lock2, atime);
- }
-
- template <typename Lock, typename Clock, typename Duration,
- typename Predicate>
- bool wait_until(Lock& lock,
- const std::chrono::time_point<Clock, Duration>& atime,
- Predicate p) {
- while (!p()) {
- if (wait_until(lock, atime) == std::cv_status::timeout) {
- return p();
- }
- }
- return true;
- }
-
- template <typename Lock, typename Rep, typename Period>
- std::cv_status wait_for(Lock& lock,
- const std::chrono::duration<Rep, Period>& rtime) {
- return wait_until(lock, clock::now() + rtime);
- }
-
- template <typename Lock, typename Rep, typename Period, typename Predicate>
- bool wait_for(Lock& lock, const std::chrono::duration<Rep, Period>& rtime,
- Predicate p) {
- return wait_until(lock, clock::now() + rtime, std::move(p));
- }
-
- native_handle_type native_handle() { return m_cond.native_handle(); }
-
- private:
- std::condition_variable m_cond;
- std::shared_ptr<std::mutex> m_mutex;
-
- // scoped unlock - unlocks in ctor, re-locks in dtor
- template <typename Lock>
- struct Unlock {
- explicit Unlock(Lock& lk) : m_lock(lk) { lk.unlock(); }
-
- ~Unlock() /*noexcept(false)*/ {
- if (std::uncaught_exception()) {
- try {
- m_lock.lock();
- } catch (...) {
- }
- } else {
- m_lock.lock();
- }
- }
-
- Unlock(const Unlock&) = delete;
- Unlock& operator=(const Unlock&) = delete;
-
- Lock& m_lock;
- };
-};
diff --git a/third_party/allwpilib_2017/hal/include/HAL/cpp/priority_mutex.h b/third_party/allwpilib_2017/hal/include/HAL/cpp/priority_mutex.h
deleted file mode 100644
index c156bed..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/cpp/priority_mutex.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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
-
-// Allows usage with std::lock_guard without including <mutex> separately
-#include <mutex>
-
-#if defined(FRC_SIMULATOR) || defined(_WIN32)
-// We do not want to use pthreads if in the simulator; however, in the
-// simulator, we do not care about priority inversion.
-typedef std::mutex priority_mutex;
-typedef std::recursive_mutex priority_recursive_mutex;
-#else // Covers rest of file.
-
-#include <pthread.h>
-
-class priority_recursive_mutex {
- public:
- typedef pthread_mutex_t* native_handle_type;
-
- constexpr priority_recursive_mutex() noexcept = default;
- priority_recursive_mutex(const priority_recursive_mutex&) = delete;
- priority_recursive_mutex& operator=(const priority_recursive_mutex&) = delete;
-
- // Lock the mutex, blocking until it's available.
- void lock();
-
- // Unlock the mutex.
- void unlock();
-
- // Tries to lock the mutex.
- bool try_lock() noexcept;
-
- pthread_mutex_t* native_handle();
-
- private:
-// Do the equivalent of setting PTHREAD_PRIO_INHERIT and
-// PTHREAD_MUTEX_RECURSIVE_NP.
-#if __WORDSIZE == 64
- pthread_mutex_t m_mutex = {
- {0, 0, 0, 0, 0x20 | PTHREAD_MUTEX_RECURSIVE_NP, 0, 0, {0, 0}}};
-#else
- pthread_mutex_t m_mutex = {
- {0, 0, 0, 0x20 | PTHREAD_MUTEX_RECURSIVE_NP, 0, {0}}};
-#endif
-};
-
-class priority_mutex {
- public:
- typedef pthread_mutex_t* native_handle_type;
-
- constexpr priority_mutex() noexcept = default;
- priority_mutex(const priority_mutex&) = delete;
- priority_mutex& operator=(const priority_mutex&) = delete;
-
- // Lock the mutex, blocking until it's available.
- void lock();
-
- // Unlock the mutex.
- void unlock();
-
- // Tries to lock the mutex.
- bool try_lock() noexcept;
-
- pthread_mutex_t* native_handle();
-
- private:
-// Do the equivalent of setting PTHREAD_PRIO_INHERIT.
-#if __WORDSIZE == 64
- pthread_mutex_t m_mutex = {{0, 0, 0, 0, 0x20, 0, 0, {0, 0}}};
-#else
- pthread_mutex_t m_mutex = {{0, 0, 0, 0x20, 0, {0}}};
-#endif
-};
-
-#endif // FRC_SIMULATOR
diff --git a/third_party/allwpilib_2017/hal/include/HAL/handles/DigitalHandleResource.h b/third_party/allwpilib_2017/hal/include/HAL/handles/DigitalHandleResource.h
deleted file mode 100644
index 653011e..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/handles/DigitalHandleResource.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include <array>
-#include <memory>
-
-#include "HAL/Errors.h"
-#include "HAL/Types.h"
-#include "HAL/cpp/make_unique.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "HAL/handles/HandlesInternal.h"
-
-namespace hal {
-
-/**
- * The DigitalHandleResource class is a way to track handles. This version
- * allows a limited number of handles that are allocated by index.
- * The enum value is seperate, as 2 enum values are allowed per handle
- * Because they are allocated by index, each individual index holds its own
- * mutex, which reduces contention heavily.]
- *
- * @tparam THandle The Handle Type (Must be typedefed from HAL_Handle)
- * @tparam TStruct The struct type held by this resource
- * @tparam size The number of resources allowed to be allocated
- *
- */
-template <typename THandle, typename TStruct, int16_t size>
-class DigitalHandleResource {
- friend class DigitalHandleResourceTest;
-
- public:
- DigitalHandleResource() = default;
- DigitalHandleResource(const DigitalHandleResource&) = delete;
- DigitalHandleResource& operator=(const DigitalHandleResource&) = delete;
-
- THandle Allocate(int16_t index, HAL_HandleEnum enumValue, int32_t* status);
- std::shared_ptr<TStruct> Get(THandle handle, HAL_HandleEnum enumValue);
- void Free(THandle handle, HAL_HandleEnum enumValue);
-
- private:
- std::array<std::shared_ptr<TStruct>, size> m_structures;
- std::array<priority_mutex, size> m_handleMutexes;
-};
-
-template <typename THandle, typename TStruct, int16_t size>
-THandle DigitalHandleResource<THandle, TStruct, size>::Allocate(
- int16_t index, HAL_HandleEnum enumValue, int32_t* status) {
- // don't aquire the lock if we can fail early.
- if (index < 0 || index >= size) {
- *status = RESOURCE_OUT_OF_RANGE;
- return HAL_kInvalidHandle;
- }
- std::lock_guard<priority_mutex> sync(m_handleMutexes[index]);
- // check for allocation, otherwise allocate and return a valid handle
- if (m_structures[index] != nullptr) {
- *status = RESOURCE_IS_ALLOCATED;
- return HAL_kInvalidHandle;
- }
- m_structures[index] = std::make_shared<TStruct>();
- return static_cast<THandle>(hal::createHandle(index, enumValue));
-}
-
-template <typename THandle, typename TStruct, int16_t size>
-std::shared_ptr<TStruct> DigitalHandleResource<THandle, TStruct, size>::Get(
- THandle handle, HAL_HandleEnum enumValue) {
- // get handle index, and fail early if index out of range or wrong handle
- int16_t index = getHandleTypedIndex(handle, enumValue);
- if (index < 0 || index >= size) {
- return nullptr;
- }
- std::lock_guard<priority_mutex> sync(m_handleMutexes[index]);
- // return structure. Null will propogate correctly, so no need to manually
- // check.
- return m_structures[index];
-}
-
-template <typename THandle, typename TStruct, int16_t size>
-void DigitalHandleResource<THandle, TStruct, size>::Free(
- THandle handle, HAL_HandleEnum enumValue) {
- // get handle index, and fail early if index out of range or wrong handle
- int16_t index = getHandleTypedIndex(handle, enumValue);
- if (index < 0 || index >= size) return;
- // lock and deallocated handle
- std::lock_guard<priority_mutex> sync(m_handleMutexes[index]);
- m_structures[index].reset();
-}
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/include/HAL/handles/HandlesInternal.h b/third_party/allwpilib_2017/hal/include/HAL/handles/HandlesInternal.h
deleted file mode 100644
index 27596dc..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/handles/HandlesInternal.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Types.h"
-
-/* General Handle Data Layout
- * Bits 0-15: Handle Index
- * Bits 16-23: Unused
- * Bits 24-30: Handle Type
- * Bit 31: 1 if handle error, 0 if no error
- *
- * Other specialized handles will use different formats, however Bits 24-31 are
- * always reserved for type and error handling.
- */
-
-namespace hal {
-
-constexpr int16_t InvalidHandleIndex = -1;
-
-enum class HAL_HandleEnum {
- Undefined = 0,
- DIO = 1,
- Port = 2,
- Notifier = 3,
- Interrupt = 4,
- AnalogOutput = 5,
- AnalogInput = 6,
- AnalogTrigger = 7,
- Relay = 8,
- PWM = 9,
- DigitalPWM = 10,
- Counter = 11,
- FPGAEncoder = 12,
- Encoder = 13,
- Compressor = 14,
- Solenoid = 15,
- AnalogGyro = 16,
- Vendor = 17
-};
-
-static inline int16_t getHandleIndex(HAL_Handle handle) {
- // mask and return last 16 bits
- return static_cast<int16_t>(handle & 0xffff);
-}
-static inline HAL_HandleEnum getHandleType(HAL_Handle handle) {
- // mask first 8 bits and cast to enum
- return static_cast<HAL_HandleEnum>((handle >> 24) & 0xff);
-}
-static inline bool isHandleType(HAL_Handle handle, HAL_HandleEnum handleType) {
- return handleType == getHandleType(handle);
-}
-static inline int16_t getHandleTypedIndex(HAL_Handle handle,
- HAL_HandleEnum enumType) {
- if (!isHandleType(handle, enumType)) return InvalidHandleIndex;
- return getHandleIndex(handle);
-}
-
-/* specialized functions for Port handle
- * Port Handle Data Layout
- * Bits 0-7: Channel Number
- * Bits 8-15: Module Number
- * Bits 16-23: Unused
- * Bits 24-30: Handle Type
- * Bit 31: 1 if handle error, 0 if no error
- */
-
-// using a 16 bit value so we can store 0-255 and still report error
-static inline int16_t getPortHandleChannel(HAL_PortHandle handle) {
- if (!isHandleType(handle, HAL_HandleEnum::Port)) return InvalidHandleIndex;
- return static_cast<uint8_t>(handle & 0xff);
-}
-
-// using a 16 bit value so we can store 0-255 and still report error
-static inline int16_t getPortHandleModule(HAL_PortHandle handle) {
- if (!isHandleType(handle, HAL_HandleEnum::Port)) return InvalidHandleIndex;
- return static_cast<uint8_t>((handle >> 8) & 0xff);
-}
-
-// using a 16 bit value so we can store 0-255 and still report error
-static inline int16_t getPortHandleSPIEnable(HAL_PortHandle handle) {
- if (!isHandleType(handle, HAL_HandleEnum::Port)) return InvalidHandleIndex;
- return static_cast<uint8_t>((handle >> 16) & 0xff);
-}
-
-HAL_PortHandle createPortHandle(uint8_t channel, uint8_t module);
-
-HAL_PortHandle createPortHandleForSPI(uint8_t channel);
-
-HAL_Handle createHandle(int16_t index, HAL_HandleEnum handleType);
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/include/HAL/handles/IndexedClassedHandleResource.h b/third_party/allwpilib_2017/hal/include/HAL/handles/IndexedClassedHandleResource.h
deleted file mode 100644
index 0f69b1d..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/handles/IndexedClassedHandleResource.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include <memory>
-#include <vector>
-
-#include "HAL/Errors.h"
-#include "HAL/Types.h"
-#include "HAL/cpp/make_unique.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "HAL/handles/HandlesInternal.h"
-
-namespace hal {
-
-/**
- * The IndexedClassedHandleResource class is a way to track handles. This
- * version
- * allows a limited number of handles that are allocated by index.
- * Because they are allocated by index, each individual index holds its own
- * mutex, which reduces contention heavily.]
- *
- * @tparam THandle The Handle Type (Must be typedefed from HAL_Handle)
- * @tparam TStruct The struct type held by this resource
- * @tparam size The number of resources allowed to be allocated
- * @tparam enumValue The type value stored in the handle
- *
- */
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-class IndexedClassedHandleResource {
- friend class IndexedClassedHandleResourceTest;
-
- public:
- IndexedClassedHandleResource();
- IndexedClassedHandleResource(const IndexedClassedHandleResource&) = delete;
- IndexedClassedHandleResource& operator=(const IndexedClassedHandleResource&) =
- delete;
-
- THandle Allocate(int16_t index, std::shared_ptr<TStruct> toSet,
- int32_t* status);
- std::shared_ptr<TStruct> Get(THandle handle);
- void Free(THandle handle);
-
- private:
- // Dynamic array to shrink HAL file size.
- std::unique_ptr<std::shared_ptr<TStruct>[]> m_structures;
- std::unique_ptr<priority_mutex[]> m_handleMutexes;
-};
-
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-IndexedClassedHandleResource<THandle, TStruct, size,
- enumValue>::IndexedClassedHandleResource() {
- m_structures = std::make_unique<std::shared_ptr<TStruct>[]>(size);
- m_handleMutexes = std::make_unique<priority_mutex[]>(size);
-}
-
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-THandle
-IndexedClassedHandleResource<THandle, TStruct, size, enumValue>::Allocate(
- int16_t index, std::shared_ptr<TStruct> toSet, int32_t* status) {
- // don't aquire the lock if we can fail early.
- if (index < 0 || index >= size) {
- *status = RESOURCE_OUT_OF_RANGE;
- return HAL_kInvalidHandle;
- }
- std::lock_guard<priority_mutex> sync(m_handleMutexes[index]);
- // check for allocation, otherwise allocate and return a valid handle
- if (m_structures[index] != nullptr) {
- *status = RESOURCE_IS_ALLOCATED;
- return HAL_kInvalidHandle;
- }
- m_structures[index] = toSet;
- return static_cast<THandle>(hal::createHandle(index, enumValue));
-}
-
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-std::shared_ptr<TStruct> IndexedClassedHandleResource<
- THandle, TStruct, size, enumValue>::Get(THandle handle) {
- // get handle index, and fail early if index out of range or wrong handle
- int16_t index = getHandleTypedIndex(handle, enumValue);
- if (index < 0 || index >= size) {
- return nullptr;
- }
- std::lock_guard<priority_mutex> sync(m_handleMutexes[index]);
- // return structure. Null will propogate correctly, so no need to manually
- // check.
- return m_structures[index];
-}
-
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-void IndexedClassedHandleResource<THandle, TStruct, size, enumValue>::Free(
- THandle handle) {
- // get handle index, and fail early if index out of range or wrong handle
- int16_t index = getHandleTypedIndex(handle, enumValue);
- if (index < 0 || index >= size) return;
- // lock and deallocated handle
- std::lock_guard<priority_mutex> sync(m_handleMutexes[index]);
- m_structures[index].reset();
-}
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/include/HAL/handles/IndexedHandleResource.h b/third_party/allwpilib_2017/hal/include/HAL/handles/IndexedHandleResource.h
deleted file mode 100644
index cfe0668..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/handles/IndexedHandleResource.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include <array>
-#include <memory>
-
-#include "HAL/Errors.h"
-#include "HAL/Types.h"
-#include "HAL/cpp/make_unique.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "HAL/handles/HandlesInternal.h"
-
-namespace hal {
-
-/**
- * The IndexedHandleResource class is a way to track handles. This version
- * allows a limited number of handles that are allocated by index.
- * Because they are allocated by index, each individual index holds its own
- * mutex, which reduces contention heavily.]
- *
- * @tparam THandle The Handle Type (Must be typedefed from HAL_Handle)
- * @tparam TStruct The struct type held by this resource
- * @tparam size The number of resources allowed to be allocated
- * @tparam enumValue The type value stored in the handle
- *
- */
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-class IndexedHandleResource {
- friend class IndexedHandleResourceTest;
-
- public:
- IndexedHandleResource() = default;
- IndexedHandleResource(const IndexedHandleResource&) = delete;
- IndexedHandleResource& operator=(const IndexedHandleResource&) = delete;
-
- THandle Allocate(int16_t index, int32_t* status);
- std::shared_ptr<TStruct> Get(THandle handle);
- void Free(THandle handle);
-
- private:
- std::array<std::shared_ptr<TStruct>, size> m_structures;
- std::array<priority_mutex, size> m_handleMutexes;
-};
-
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-THandle IndexedHandleResource<THandle, TStruct, size, enumValue>::Allocate(
- int16_t index, int32_t* status) {
- // don't aquire the lock if we can fail early.
- if (index < 0 || index >= size) {
- *status = RESOURCE_OUT_OF_RANGE;
- return HAL_kInvalidHandle;
- }
- std::lock_guard<priority_mutex> sync(m_handleMutexes[index]);
- // check for allocation, otherwise allocate and return a valid handle
- if (m_structures[index] != nullptr) {
- *status = RESOURCE_IS_ALLOCATED;
- return HAL_kInvalidHandle;
- }
- m_structures[index] = std::make_shared<TStruct>();
- return static_cast<THandle>(hal::createHandle(index, enumValue));
-}
-
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-std::shared_ptr<TStruct>
-IndexedHandleResource<THandle, TStruct, size, enumValue>::Get(THandle handle) {
- // get handle index, and fail early if index out of range or wrong handle
- int16_t index = getHandleTypedIndex(handle, enumValue);
- if (index < 0 || index >= size) {
- return nullptr;
- }
- std::lock_guard<priority_mutex> sync(m_handleMutexes[index]);
- // return structure. Null will propogate correctly, so no need to manually
- // check.
- return m_structures[index];
-}
-
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-void IndexedHandleResource<THandle, TStruct, size, enumValue>::Free(
- THandle handle) {
- // get handle index, and fail early if index out of range or wrong handle
- int16_t index = getHandleTypedIndex(handle, enumValue);
- if (index < 0 || index >= size) return;
- // lock and deallocated handle
- std::lock_guard<priority_mutex> sync(m_handleMutexes[index]);
- m_structures[index].reset();
-}
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/include/HAL/handles/LimitedClassedHandleResource.h b/third_party/allwpilib_2017/hal/include/HAL/handles/LimitedClassedHandleResource.h
deleted file mode 100644
index 178bf1d..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/handles/LimitedClassedHandleResource.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include <array>
-#include <memory>
-
-#include "HAL/Types.h"
-#include "HAL/cpp/make_unique.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "HAL/handles/HandlesInternal.h"
-
-namespace hal {
-
-/**
- * The LimitedClassedHandleResource class is a way to track handles. This
- * version
- * allows a limited number of handles that are allocated sequentially.
- *
- * @tparam THandle The Handle Type (Must be typedefed from HAL_Handle)
- * @tparam TStruct The struct type held by this resource
- * @tparam size The number of resources allowed to be allocated
- * @tparam enumValue The type value stored in the handle
- *
- */
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-class LimitedClassedHandleResource {
- friend class LimitedClassedHandleResourceTest;
-
- public:
- LimitedClassedHandleResource() = default;
- LimitedClassedHandleResource(const LimitedClassedHandleResource&) = delete;
- LimitedClassedHandleResource& operator=(const LimitedClassedHandleResource&) =
- delete;
-
- THandle Allocate(std::shared_ptr<TStruct> toSet);
- std::shared_ptr<TStruct> Get(THandle handle);
- void Free(THandle handle);
-
- private:
- std::array<std::shared_ptr<TStruct>, size> m_structures;
- std::array<priority_mutex, size> m_handleMutexes;
- priority_mutex m_allocateMutex;
-};
-
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-THandle
-LimitedClassedHandleResource<THandle, TStruct, size, enumValue>::Allocate(
- std::shared_ptr<TStruct> toSet) {
- // globally lock to loop through indices
- std::lock_guard<priority_mutex> sync(m_allocateMutex);
- int16_t i;
- for (i = 0; i < size; i++) {
- if (m_structures[i] == nullptr) {
- // if a false index is found, grab its specific mutex
- // and allocate it.
- std::lock_guard<priority_mutex> sync(m_handleMutexes[i]);
- m_structures[i] = toSet;
- return static_cast<THandle>(createHandle(i, enumValue));
- }
- }
- return HAL_kInvalidHandle;
-}
-
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-std::shared_ptr<TStruct> LimitedClassedHandleResource<
- THandle, TStruct, size, enumValue>::Get(THandle handle) {
- // get handle index, and fail early if index out of range or wrong handle
- int16_t index = getHandleTypedIndex(handle, enumValue);
- if (index < 0 || index >= size) {
- return nullptr;
- }
- std::lock_guard<priority_mutex> sync(m_handleMutexes[index]);
- // return structure. Null will propogate correctly, so no need to manually
- // check.
- return m_structures[index];
-}
-
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-void LimitedClassedHandleResource<THandle, TStruct, size, enumValue>::Free(
- THandle handle) {
- // get handle index, and fail early if index out of range or wrong handle
- int16_t index = getHandleTypedIndex(handle, enumValue);
- if (index < 0 || index >= size) return;
- // lock and deallocated handle
- std::lock_guard<priority_mutex> sync(m_allocateMutex);
- std::lock_guard<priority_mutex> lock(m_handleMutexes[index]);
- m_structures[index].reset();
-}
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/include/HAL/handles/LimitedHandleResource.h b/third_party/allwpilib_2017/hal/include/HAL/handles/LimitedHandleResource.h
deleted file mode 100644
index 522328e..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/handles/LimitedHandleResource.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include <array>
-#include <memory>
-
-#include "HAL/Types.h"
-#include "HAL/cpp/make_unique.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "HandlesInternal.h"
-
-namespace hal {
-
-/**
- * The LimitedHandleResource class is a way to track handles. This version
- * allows a limited number of handles that are allocated sequentially.
- *
- * @tparam THandle The Handle Type (Must be typedefed from HAL_Handle)
- * @tparam TStruct The struct type held by this resource
- * @tparam size The number of resources allowed to be allocated
- * @tparam enumValue The type value stored in the handle
- *
- */
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-class LimitedHandleResource {
- friend class LimitedHandleResourceTest;
-
- public:
- LimitedHandleResource() = default;
- LimitedHandleResource(const LimitedHandleResource&) = delete;
- LimitedHandleResource& operator=(const LimitedHandleResource&) = delete;
-
- THandle Allocate();
- std::shared_ptr<TStruct> Get(THandle handle);
- void Free(THandle handle);
-
- private:
- std::array<std::shared_ptr<TStruct>, size> m_structures;
- std::array<priority_mutex, size> m_handleMutexes;
- priority_mutex m_allocateMutex;
-};
-
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-THandle LimitedHandleResource<THandle, TStruct, size, enumValue>::Allocate() {
- // globally lock to loop through indices
- std::lock_guard<priority_mutex> sync(m_allocateMutex);
- int16_t i;
- for (i = 0; i < size; i++) {
- if (m_structures[i] == nullptr) {
- // if a false index is found, grab its specific mutex
- // and allocate it.
- std::lock_guard<priority_mutex> sync(m_handleMutexes[i]);
- m_structures[i] = std::make_shared<TStruct>();
- return static_cast<THandle>(createHandle(i, enumValue));
- }
- }
- return HAL_kInvalidHandle;
-}
-
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-std::shared_ptr<TStruct>
-LimitedHandleResource<THandle, TStruct, size, enumValue>::Get(THandle handle) {
- // get handle index, and fail early if index out of range or wrong handle
- int16_t index = getHandleTypedIndex(handle, enumValue);
- if (index < 0 || index >= size) {
- return nullptr;
- }
- std::lock_guard<priority_mutex> sync(m_handleMutexes[index]);
- // return structure. Null will propogate correctly, so no need to manually
- // check.
- return m_structures[index];
-}
-
-template <typename THandle, typename TStruct, int16_t size,
- HAL_HandleEnum enumValue>
-void LimitedHandleResource<THandle, TStruct, size, enumValue>::Free(
- THandle handle) {
- // get handle index, and fail early if index out of range or wrong handle
- int16_t index = getHandleTypedIndex(handle, enumValue);
- if (index < 0 || index >= size) return;
- // lock and deallocated handle
- std::lock_guard<priority_mutex> sync(m_allocateMutex);
- std::lock_guard<priority_mutex> lock(m_handleMutexes[index]);
- m_structures[index].reset();
-}
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/include/HAL/handles/UnlimitedHandleResource.h b/third_party/allwpilib_2017/hal/include/HAL/handles/UnlimitedHandleResource.h
deleted file mode 100644
index ab77914..0000000
--- a/third_party/allwpilib_2017/hal/include/HAL/handles/UnlimitedHandleResource.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <stdint.h>
-
-#include <memory>
-#include <vector>
-
-#include "HAL/Types.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "HAL/handles/HandlesInternal.h"
-
-namespace hal {
-
-/**
- * The UnlimitedHandleResource class is a way to track handles. This version
- * allows an unlimted number of handles that are allocated sequentially. When
- * possible, indices are reused to save memory usage and keep the array length
- * down.
- * However, automatic array management has not been implemented, but might be in
- * the future.
- * Because we have to loop through the allocator, we must use a global mutex.
-
- * @tparam THandle The Handle Type (Must be typedefed from HAL_Handle)
- * @tparam TStruct The struct type held by this resource
- * @tparam enumValue The type value stored in the handle
- *
- */
-template <typename THandle, typename TStruct, HAL_HandleEnum enumValue>
-class UnlimitedHandleResource {
- friend class UnlimitedHandleResourceTest;
-
- public:
- UnlimitedHandleResource() = default;
- UnlimitedHandleResource(const UnlimitedHandleResource&) = delete;
- UnlimitedHandleResource& operator=(const UnlimitedHandleResource&) = delete;
-
- THandle Allocate(std::shared_ptr<TStruct> structure);
- std::shared_ptr<TStruct> Get(THandle handle);
- void Free(THandle handle);
-
- private:
- std::vector<std::shared_ptr<TStruct>> m_structures;
- priority_mutex m_handleMutex;
-};
-
-template <typename THandle, typename TStruct, HAL_HandleEnum enumValue>
-THandle UnlimitedHandleResource<THandle, TStruct, enumValue>::Allocate(
- std::shared_ptr<TStruct> structure) {
- std::lock_guard<priority_mutex> sync(m_handleMutex);
- size_t i;
- for (i = 0; i < m_structures.size(); i++) {
- if (m_structures[i] == nullptr) {
- m_structures[i] = structure;
- return static_cast<THandle>(createHandle(i, enumValue));
- }
- }
- if (i >= INT16_MAX) return HAL_kInvalidHandle;
-
- m_structures.push_back(structure);
- return static_cast<THandle>(createHandle(static_cast<int16_t>(i), enumValue));
-}
-
-template <typename THandle, typename TStruct, HAL_HandleEnum enumValue>
-std::shared_ptr<TStruct>
-UnlimitedHandleResource<THandle, TStruct, enumValue>::Get(THandle handle) {
- int16_t index = getHandleTypedIndex(handle, enumValue);
- std::lock_guard<priority_mutex> sync(m_handleMutex);
- if (index < 0 || index >= static_cast<int16_t>(m_structures.size()))
- return nullptr;
- return m_structures[index];
-}
-
-template <typename THandle, typename TStruct, HAL_HandleEnum enumValue>
-void UnlimitedHandleResource<THandle, TStruct, enumValue>::Free(
- THandle handle) {
- int16_t index = getHandleTypedIndex(handle, enumValue);
- std::lock_guard<priority_mutex> sync(m_handleMutex);
- if (index < 0 || index >= static_cast<int16_t>(m_structures.size())) return;
- m_structures[index].reset();
-}
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/include/ctre/CtreCanNode.h b/third_party/allwpilib_2017/hal/include/ctre/CtreCanNode.h
deleted file mode 100644
index 2707598..0000000
--- a/third_party/allwpilib_2017/hal/include/ctre/CtreCanNode.h
+++ /dev/null
@@ -1,131 +0,0 @@
-#ifndef CtreCanNode_H_
-#define CtreCanNode_H_
-#include "ctre.h" //BIT Defines + Typedefs
-#include <map>
-#include <string.h> // memcpy
-#include <sys/time.h>
-class CtreCanNode
-{
-public:
- CtreCanNode(UINT8 deviceNumber);
- ~CtreCanNode();
-
- UINT8 GetDeviceNumber()
- {
- return _deviceNumber;
- }
-protected:
-
-
- template <typename T> class txTask{
- public:
- uint32_t arbId;
- T * toSend;
- T * operator -> ()
- {
- return toSend;
- }
- T & operator*()
- {
- return *toSend;
- }
- bool IsEmpty()
- {
- if(toSend == 0)
- return true;
- return false;
- }
- };
- template <typename T> class recMsg{
- public:
- uint32_t arbId;
- uint8_t bytes[8];
- CTR_Code err;
- T * operator -> ()
- {
- return (T *)bytes;
- }
- T & operator*()
- {
- return *(T *)bytes;
- }
- };
- UINT8 _deviceNumber;
- void RegisterRx(uint32_t arbId);
- /**
- * Schedule a CAN Frame for periodic transmit. Assume eight byte DLC and zero value for initial transmission.
- * @param arbId CAN Frame Arbitration ID. Set BIT31 for 11bit ids, otherwise we use 29bit ids.
- * @param periodMs Period to transmit CAN frame. Pass 0 for one-shot, which also disables that ArbID's preceding periodic transmit.
- */
- void RegisterTx(uint32_t arbId, uint32_t periodMs);
- /**
- * Schedule a CAN Frame for periodic transmit.
- * @param arbId CAN Frame Arbitration ID. Set BIT31 for 11bit ids, otherwise we use 29bit ids.
- * @param periodMs Period to transmit CAN frame. Pass 0 for one-shot, which also disables that ArbID's preceding periodic transmit.
- * @param dlc Number of bytes to transmit (0 to 8).
- * @param initialFrame Ptr to the frame data to schedule for transmitting. Passing null will result
- * in defaulting to zero data value.
- */
- void RegisterTx(uint32_t arbId, uint32_t periodMs, uint32_t dlc, const uint8_t * initialFrame);
- void UnregisterTx(uint32_t arbId);
-
- CTR_Code GetRx(uint32_t arbId,uint8_t * dataBytes,uint32_t timeoutMs);
- void FlushTx(uint32_t arbId);
- bool ChangeTxPeriod(uint32_t arbId, uint32_t periodMs);
-
- template<typename T> txTask<T> GetTx(uint32_t arbId)
- {
- txTask<T> retval = {0, nullptr};
- txJobs_t::iterator i = _txJobs.find(arbId);
- if(i != _txJobs.end()){
- retval.arbId = i->second.arbId;
- retval.toSend = (T*)i->second.toSend;
- }
- return retval;
- }
- template<class T> void FlushTx(T & par)
- {
- FlushTx(par.arbId);
- }
-
- template<class T> recMsg<T> GetRx(uint32_t arbId, uint32_t timeoutMs)
- {
- recMsg<T> retval;
- retval.err = GetRx(arbId,retval.bytes, timeoutMs);
- return retval;
- }
-
-private:
-
- class txJob_t {
- public:
- uint32_t arbId;
- uint8_t toSend[8];
- uint32_t periodMs;
- uint8_t dlc;
- };
-
- class rxEvent_t{
- public:
- uint8_t bytes[8];
- struct timespec time;
- rxEvent_t()
- {
- bytes[0] = 0;
- bytes[1] = 0;
- bytes[2] = 0;
- bytes[3] = 0;
- bytes[4] = 0;
- bytes[5] = 0;
- bytes[6] = 0;
- bytes[7] = 0;
- }
- };
-
- typedef std::map<uint32_t,txJob_t> txJobs_t;
- txJobs_t _txJobs;
-
- typedef std::map<uint32_t,rxEvent_t> rxRxEvents_t;
- rxRxEvents_t _rxRxEvents;
-};
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/ctre/PCM.h b/third_party/allwpilib_2017/hal/include/ctre/PCM.h
deleted file mode 100644
index 03d9b2d..0000000
--- a/third_party/allwpilib_2017/hal/include/ctre/PCM.h
+++ /dev/null
@@ -1,226 +0,0 @@
-#ifndef PCM_H_
-#define PCM_H_
-#include "ctre.h" //BIT Defines + Typedefs
-#include "CtreCanNode.h"
-class PCM : public CtreCanNode
-{
-public:
- PCM(UINT8 deviceNumber=0);
- ~PCM();
-
- /* Set PCM solenoid state
- *
- * @Return - CTR_Code - Error code (if any) for setting solenoid
- * @Param - idx - ID of solenoid (0-7)
- * @Param - en - Enable / Disable identified solenoid
- */
- CTR_Code SetSolenoid(unsigned char idx, bool en);
-
- /* Set all PCM solenoid states
- *
- * @Return - CTR_Code - Error code (if any) for setting solenoids
- * @Param - state Bitfield to set all solenoids to
- */
- CTR_Code SetAllSolenoids(UINT8 state);
-
- /* Enables PCM Closed Loop Control of Compressor via pressure switch
- * @Return - CTR_Code - Error code (if any) for setting solenoid
- * @Param - en - Enable / Disable Closed Loop Control
- */
- CTR_Code SetClosedLoopControl(bool en);
-
- /* Clears PCM sticky faults (indicators of past faults
- * @Return - CTR_Code - Error code (if any) for setting solenoid
- */
- CTR_Code ClearStickyFaults();
-
- /* Get solenoid state
- *
- * @Return - CTR_Code - Error code (if any)
- * @Param - idx - ID of solenoid (0-7) to return if solenoid is on.
- * @Param - status - true if solenoid enabled, false otherwise
- */
- CTR_Code GetSolenoid(UINT8 idx, bool &status);
-
- /* Get state of all solenoids
- *
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - bitfield of solenoid states
- */
- CTR_Code GetAllSolenoids(UINT8 &status);
-
- /* Get pressure switch state
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - True if pressure adequate, false if low
- */
- CTR_Code GetPressure(bool &status);
-
- /* Get compressor state
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - True if compress ouput is on, false if otherwise
- */
- CTR_Code GetCompressor(bool &status);
-
- /* Get closed loop control state
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - True if closed loop enabled, false if otherwise
- */
- CTR_Code GetClosedLoopControl(bool &status);
-
- /* Get compressor current draw
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - Compressor current returned in Amperes (A)
- */
- CTR_Code GetCompressorCurrent(float &status);
-
- /* Get voltage across solenoid rail
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - Voltage across solenoid rail in Volts (V)
- */
- CTR_Code GetSolenoidVoltage(float &status);
-
- /* Get hardware fault value
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - True if hardware failure detected, false if otherwise
- */
- CTR_Code GetHardwareFault(bool &status);
-
- /* Get compressor fault value
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - True if abnormally high compressor current detected, false if otherwise
- */
- CTR_Code GetCompressorCurrentTooHighFault(bool &status);
-
- /* Get solenoid fault value
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - True if shorted solenoid detected, false if otherwise
- */
- CTR_Code GetSolenoidFault(bool &status);
-
- /* Get compressor sticky fault value
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - True if solenoid had previously been shorted
- * (and sticky fault was not cleared), false if otherwise
- */
- CTR_Code GetCompressorCurrentTooHighStickyFault(bool &status);
- /* Get compressor shorted sticky fault value
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - True if compressor output is shorted, false if otherwise
- */
- CTR_Code GetCompressorShortedStickyFault(bool &status);
- /* Get compressor shorted fault value
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - True if compressor output is shorted, false if otherwise
- */
- CTR_Code GetCompressorShortedFault(bool &status);
- /* Get compressor is not connected sticky fault value
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - True if compressor current is too low,
- * indicating compressor is not connected, false if otherwise
- */
- CTR_Code GetCompressorNotConnectedStickyFault(bool &status);
- /* Get compressor is not connected fault value
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - True if compressor current is too low,
- * indicating compressor is not connected, false if otherwise
- */
- CTR_Code GetCompressorNotConnectedFault(bool &status);
-
- /* Get solenoid sticky fault value
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - True if compressor had previously been shorted
- * (and sticky fault was not cleared), false if otherwise
- */
- CTR_Code GetSolenoidStickyFault(bool &status);
-
- /* Get battery voltage
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - Voltage across PCM power ports in Volts (V)
- */
- CTR_Code GetBatteryVoltage(float &status);
-
- /* Set PCM Device Number and according CAN frame IDs
- * @Return - void
- * @Param - deviceNumber - Device number of PCM to control
- */
- void SetDeviceNumber(UINT8 deviceNumber);
- /* Get number of total failed PCM Control Frame
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - Number of failed control frames (tokenization fails)
- * @WARNING - Return only valid if [SeekDebugFrames] is enabled
- * See function SeekDebugFrames
- * See function EnableSeekDebugFrames
- */
- CTR_Code GetNumberOfFailedControlFrames(UINT16 &status);
-
- /* Get raw Solenoid Blacklist
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - Raw binary breakdown of Solenoid Blacklist
- * BIT7 = Solenoid 1, BIT6 = Solenoid 2, etc.
- * @WARNING - Return only valid if [SeekStatusFaultFrames] is enabled
- * See function SeekStatusFaultFrames
- * See function EnableSeekStatusFaultFrames
- */
- CTR_Code GetSolenoidBlackList(UINT8 &status);
-
- /* Get solenoid Blacklist status
- * - Blacklisted solenoids cannot be enabled until PCM is power cycled
- * @Return - CTR_Code - Error code (if any)
- * @Param - idx - ID of solenoid [0,7]
- * @Param - status - True if Solenoid is blacklisted, false if otherwise
- * @WARNING - Return only valid if [SeekStatusFaultFrames] is enabled
- * See function SeekStatusFaultFrames
- * See function EnableSeekStatusFaultFrames
- */
- CTR_Code IsSolenoidBlacklisted(UINT8 idx, bool &status);
-
- /* Return status of module enable/disable
- * @Return - CTR_Code - Error code (if any)
- * @Param - status - Returns TRUE if PCM is enabled, FALSE if disabled
- */
- CTR_Code isModuleEnabled(bool &status);
-
- /* Get solenoid Blacklist status
- * @Return - CTR_Code - Error code (if any)
- * @Param - idx - ID of solenoid [0,7] to fire one shot pulse.
- */
- CTR_Code FireOneShotSolenoid(UINT8 idx);
-
- /* Configure the pulse width of a solenoid channel for one-shot pulse.
- * Preprogrammed pulsewidth is 10ms resolute and can be between 20ms and 5.1s.
- * @Return - CTR_Code - Error code (if any)
- * @Param - idx - ID of solenoid [0,7] to configure.
- * @Param - durMs - pulse width in ms.
- */
- CTR_Code SetOneShotDurationMs(UINT8 idx,uint32_t durMs);
-
-};
-//------------------ C interface --------------------------------------------//
-extern "C" {
- void * c_PCM_Init(void);
- CTR_Code c_SetSolenoid(void * handle,unsigned char idx,INT8 param);
- CTR_Code c_SetAllSolenoids(void * handle,UINT8 state);
- CTR_Code c_SetClosedLoopControl(void * handle,INT8 param);
- CTR_Code c_ClearStickyFaults(void * handle,INT8 param);
- CTR_Code c_GetSolenoid(void * handle,UINT8 idx,INT8 * status);
- CTR_Code c_GetAllSolenoids(void * handle,UINT8 * status);
- CTR_Code c_GetPressure(void * handle,INT8 * status);
- CTR_Code c_GetCompressor(void * handle,INT8 * status);
- CTR_Code c_GetClosedLoopControl(void * handle,INT8 * status);
- CTR_Code c_GetCompressorCurrent(void * handle,float * status);
- CTR_Code c_GetSolenoidVoltage(void * handle,float*status);
- CTR_Code c_GetHardwareFault(void * handle,INT8*status);
- CTR_Code c_GetCompressorFault(void * handle,INT8*status);
- CTR_Code c_GetSolenoidFault(void * handle,INT8*status);
- CTR_Code c_GetCompressorStickyFault(void * handle,INT8*status);
- CTR_Code c_GetSolenoidStickyFault(void * handle,INT8*status);
- CTR_Code c_GetBatteryVoltage(void * handle,float*status);
- void c_SetDeviceNumber_PCM(void * handle,UINT8 deviceNumber);
- void c_EnableSeekStatusFrames(void * handle,INT8 enable);
- void c_EnableSeekStatusFaultFrames(void * handle,INT8 enable);
- void c_EnableSeekDebugFrames(void * handle,INT8 enable);
- CTR_Code c_GetNumberOfFailedControlFrames(void * handle,UINT16*status);
- CTR_Code c_GetSolenoidBlackList(void * handle,UINT8 *status);
- CTR_Code c_IsSolenoidBlacklisted(void * handle,UINT8 idx,INT8*status);
-}
-#endif
diff --git a/third_party/allwpilib_2017/hal/include/ctre/PDP.h b/third_party/allwpilib_2017/hal/include/ctre/PDP.h
deleted file mode 100644
index b968a44..0000000
--- a/third_party/allwpilib_2017/hal/include/ctre/PDP.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef PDP_H_
-#define PDP_H_
-#include "ctre.h" //BIT Defines + Typedefs
-#include "CtreCanNode.h"
-class PDP : public CtreCanNode
-{
-public:
- /* Get PDP Channel Current
- *
- * @Param - deviceNumber - Device ID for PDP. Factory default is 60. Function defaults to 60.
- */
- PDP(UINT8 deviceNumber=0);
- ~PDP();
- /* Get PDP Channel Current
- *
- * @Return - CTR_Code - Error code (if any)
- *
- * @Param - idx - ID of channel to return current for (channels 1-16)
- *
- * @Param - status - Current of channel 'idx' in Amps (A)
- */
- CTR_Code GetChannelCurrent(UINT8 idx, double &status);
-
- /* Get Bus Voltage of PDP
- *
- * @Return - CTR_Code - Error code (if any)
- *
- * @Param - status - Voltage (V) across PDP
- */
- CTR_Code GetVoltage(double &status);
-
- /* Get Temperature of PDP
- *
- * @Return - CTR_Code - Error code (if any)
- *
- * @Param - status - Temperature of PDP in Centigrade / Celcius (C)
- */
- CTR_Code GetTemperature(double &status);
-
- CTR_Code GetTotalCurrent(double ¤tAmps);
- CTR_Code GetTotalPower(double &powerWatts);
- CTR_Code GetTotalEnergy(double &energyJoules);
- /* Clear sticky faults.
- * @Return - CTR_Code - Error code (if any)
- */
- CTR_Code ClearStickyFaults();
-
- /* Reset Energy Signals
- * @Return - CTR_Code - Error code (if any)
- */
- CTR_Code ResetEnergy();
-private:
- uint64_t ReadCurrents(uint8_t api);
-};
-extern "C" {
- void * c_PDP_Init();
- CTR_Code c_GetChannelCurrent(void * handle,UINT8 idx, double *status);
- CTR_Code c_GetVoltage(void * handle,double *status);
- CTR_Code c_GetTemperature(void * handle,double *status);
- void c_SetDeviceNumber_PDP(void * handle,UINT8 deviceNumber);
-}
-#endif /* PDP_H_ */
diff --git a/third_party/allwpilib_2017/hal/include/ctre/ctre.h b/third_party/allwpilib_2017/hal/include/ctre/ctre.h
deleted file mode 100644
index a0f99b3..0000000
--- a/third_party/allwpilib_2017/hal/include/ctre/ctre.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * @file ctre.h
- * Common header for all CTRE HAL modules.
- */
-#ifndef CTRE_H
-#define CTRE_H
-
-//Bit Defines
-#define BIT0 0x01
-#define BIT1 0x02
-#define BIT2 0x04
-#define BIT3 0x08
-#define BIT4 0x10
-#define BIT5 0x20
-#define BIT6 0x40
-#define BIT7 0x80
-#define BIT8 0x0100
-#define BIT9 0x0200
-#define BIT10 0x0400
-#define BIT11 0x0800
-#define BIT12 0x1000
-#define BIT13 0x2000
-#define BIT14 0x4000
-#define BIT15 0x8000
-
-//Signed
-typedef signed char INT8;
-typedef signed short INT16;
-typedef signed int INT32;
-typedef signed long long INT64;
-
-//Unsigned
-typedef unsigned char UINT8;
-typedef unsigned short UINT16;
-typedef unsigned int UINT32;
-typedef unsigned long long UINT64;
-
-//Other
-typedef unsigned char UCHAR;
-typedef unsigned short USHORT;
-typedef unsigned int UINT;
-typedef unsigned long ULONG;
-
-typedef enum {
- CTR_OKAY, //!< No Error - Function executed as expected
- CTR_RxTimeout, //!< CAN frame has not been received within specified period of time.
- CTR_TxTimeout, //!< Not used.
- CTR_InvalidParamValue, //!< Caller passed an invalid param
- CTR_UnexpectedArbId, //!< Specified CAN Id is invalid.
- CTR_TxFailed, //!< Could not transmit the CAN frame.
- CTR_SigNotUpdated, //!< Have not received an value response for signal.
- CTR_BufferFull, //!< Caller attempted to insert data into a buffer that is full.
-}CTR_Code;
-
-#include "ctre_frames.h"
-
-#endif /* CTRE_H */
diff --git a/third_party/allwpilib_2017/hal/include/ctre/ctre_frames.h b/third_party/allwpilib_2017/hal/include/ctre/ctre_frames.h
deleted file mode 100644
index f131538..0000000
--- a/third_party/allwpilib_2017/hal/include/ctre/ctre_frames.h
+++ /dev/null
@@ -1,243 +0,0 @@
-/**
- * @file ctre_frames.h
- * CAN Encoder/Decoder Structures for CTRE devices.
- */
-#ifndef CTRE_FRAMES_H
-#define CTRE_FRAMES_H
-
-/** control */
-typedef struct _TALON_Control_1_General_10ms_t {
- unsigned TokenH:8;
- unsigned TokenL:8;
- unsigned DemandH:8;
- unsigned DemandM:8;
- unsigned DemandL:8;
- unsigned ProfileSlotSelect:1;
- unsigned FeedbackDeviceSelect:4;
- unsigned OverrideLimitSwitchEn:3;
- unsigned RevFeedbackSensor:1;
- unsigned RevMotDuringCloseLoopEn:1;
- unsigned OverrideBrakeType:2;
- unsigned ModeSelect:4;
- unsigned RampThrottle:8;
-} TALON_Control_1_General_10ms_t ;
-
-/* TALON_Control_2_Rates_OneShot_t removed since it has been deprecated */
-
-typedef struct _TALON_Control_3_ClearFlags_OneShot_t {
- unsigned ZeroFeedbackSensor:1;
- unsigned ClearStickyFaults:1;
-} TALON_Control_3_ClearFlags_OneShot_t ;
-
-typedef struct _TALON_Control_5_General_10ms_t {
- unsigned ThrottleBump_h3:3;
- unsigned ReservedZero:5;
- unsigned ThrottleBump_l8:8;
- unsigned DemandH:8;
- unsigned DemandM:8;
- unsigned DemandL:8;
- unsigned ProfileSlotSelect:1;
- unsigned FeedbackDeviceSelect:4;
- unsigned OverrideLimitSwitchEn:3;
- unsigned RevFeedbackSensor:1;
- unsigned RevMotDuringCloseLoopEn:1;
- unsigned OverrideBrakeType:2;
- unsigned ModeSelect:4;
- unsigned RampThrottle:8;
-} TALON_Control_5_General_10ms_t ;
-
-typedef struct _TALON_Control_6_MotProfAddTrajPoint_t {
- unsigned huffCode:2; //!< Compression coding
- unsigned NextPt_VelOnly:1;
- unsigned NextPt_IsLast:1;
- unsigned reserved0:2;
- unsigned NextPt_ZeroPosition:1;
- unsigned NextPt_ProfileSlotSelect:1;
- unsigned Idx:4;
- unsigned reserved1:4;
- unsigned restOfFrame0:8;
- unsigned restOfFrame1:8;
- unsigned restOfFrame2:8;
- unsigned restOfFrame3:8;
- unsigned restOfFrame4:8;
- unsigned restOfFrame5:8;
-} TALON_Control_6_MotProfAddTrajPoint_t;
-
-typedef struct _TALON_Control_6_MotProfAddTrajPoint_huff0_t {
- unsigned huffCode_expect_0:2; //!< Compression coding
- unsigned NextPt_VelOnly:1;
- unsigned NextPt_IsLast:1;
- unsigned reserved0:2;
- unsigned NextPt_ZeroPosition:1;
- unsigned NextPt_ProfileSlotSelect:1;
- unsigned Idx:4;
- unsigned reserved1:4;
- unsigned NextPt_DurationMs:8;
- unsigned NextPt_VelocityH:8;
- unsigned NextPt_VelocityL:8;
- unsigned NextPt_PositionH:8;
- unsigned NextPt_PositionM:8;
- unsigned NextPt_PositionL:8;
-} TALON_Control_6_MotProfAddTrajPoint_huff0_t;
-
-typedef struct _TALON_Control_6_MotProfAddTrajPoint_huff1_t {
- unsigned huffCode_expect_1:2; //!< Compression coding
- unsigned NextPt_VelOnly:1;
- unsigned NextPt_IsLast:1;
- unsigned reserved0:2;
- unsigned NextPt_ZeroPosition:1;
- unsigned NextPt_ProfileSlotSelect:1;
- unsigned Idx:4;
- unsigned reserved1:4;
- unsigned NextPt_DurationMs:8;
- unsigned NextPt_SameVelocityH:8;
- unsigned NextPt_SameVelocityL:8;
- unsigned NextPt_DeltaPositionH:8;
- unsigned NextPt_DeltaPositionL:8;
- unsigned NextPt_Count:8;
-} TALON_Control_6_MotProfAddTrajPoint_huff1_t;
-
-/** status */
-typedef struct _TALON_Status_1_General_10ms_t {
- unsigned CloseLoopErrH:8;
- unsigned CloseLoopErrM:8;
- unsigned CloseLoopErrL:8;
- unsigned AppliedThrottle_h3:3;
- unsigned Fault_RevSoftLim:1;
- unsigned Fault_ForSoftLim:1;
- unsigned TokLocked:1;
- unsigned LimitSwitchClosedRev:1;
- unsigned LimitSwitchClosedFor:1;
- unsigned AppliedThrottle_l8:8;
- unsigned ModeSelect_h1:1;
- unsigned FeedbackDeviceSelect:4;
- unsigned LimitSwitchEn:3;
- unsigned Fault_HardwareFailure:1;
- unsigned Fault_RevLim:1;
- unsigned Fault_ForLim:1;
- unsigned Fault_UnderVoltage:1;
- unsigned Fault_OverTemp:1;
- unsigned ModeSelect_b3:3;
- unsigned TokenSeed:8;
-} TALON_Status_1_General_10ms_t ;
-typedef struct _TALON_Status_2_Feedback_20ms_t {
- unsigned SensorPositionH:8;
- unsigned SensorPositionM:8;
- unsigned SensorPositionL:8;
- unsigned SensorVelocityH:8;
- unsigned SensorVelocityL:8;
- unsigned Current_h8:8;
- unsigned StckyFault_RevSoftLim:1;
- unsigned StckyFault_ForSoftLim:1;
- unsigned StckyFault_RevLim:1;
- unsigned StckyFault_ForLim:1;
- unsigned StckyFault_UnderVoltage:1;
- unsigned StckyFault_OverTemp:1;
- unsigned Current_l2:2;
- unsigned reserved:3;
- unsigned Cmd5Allowed:1;
- unsigned VelDiv4:1;
- unsigned PosDiv8:1;
- unsigned ProfileSlotSelect:1;
- unsigned BrakeIsEnabled:1;
-} TALON_Status_2_Feedback_20ms_t ;
-typedef struct _TALON_Status_3_Enc_100ms_t {
- unsigned EncPositionH:8;
- unsigned EncPositionM:8;
- unsigned EncPositionL:8;
- unsigned EncVelH:8;
- unsigned EncVelL:8;
- unsigned EncIndexRiseEventsH:8;
- unsigned EncIndexRiseEventsL:8;
- unsigned reserved:3;
- unsigned VelDiv4:1;
- unsigned PosDiv8:1;
- unsigned QuadIdxpin:1;
- unsigned QuadBpin:1;
- unsigned QuadApin:1;
-} TALON_Status_3_Enc_100ms_t ;
-typedef struct _TALON_Status_4_AinTempVbat_100ms_t {
- unsigned AnalogInWithOvH:8;
- unsigned AnalogInWithOvM:8;
- unsigned AnalogInWithOvL:8;
- unsigned AnalogInVelH:8;
- unsigned AnalogInVelL:8;
- unsigned Temp:8;
- unsigned BatteryV:8;
- unsigned reserved:6;
- unsigned VelDiv4:1;
- unsigned PosDiv8:1;
-} TALON_Status_4_AinTempVbat_100ms_t ;
-typedef struct _TALON_Status_5_Startup_OneShot_t {
- unsigned ResetCountH:8;
- unsigned ResetCountL:8;
- unsigned ResetFlagsH:8;
- unsigned ResetFlagsL:8;
- unsigned FirmVersH:8;
- unsigned FirmVersL:8;
-} TALON_Status_5_Startup_OneShot_t ;
-typedef struct _TALON_Status_6_Eol_t {
- unsigned currentAdcUncal_h2:2;
- unsigned reserved1:5;
- unsigned SpiCsPin_GadgeteerPin6:1;
- unsigned currentAdcUncal_l8:8;
- unsigned tempAdcUncal_h2:2;
- unsigned reserved2:6;
- unsigned tempAdcUncal_l8:8;
- unsigned vbatAdcUncal_h2:2;
- unsigned reserved3:6;
- unsigned vbatAdcUncal_l8:8;
- unsigned analogAdcUncal_h2:2;
- unsigned reserved4:6;
- unsigned analogAdcUncal_l8:8;
-} TALON_Status_6_Eol_t ;
-typedef struct _TALON_Status_7_Debug_200ms_t {
- unsigned TokenizationFails_h8:8;
- unsigned TokenizationFails_l8:8;
- unsigned LastFailedToken_h8:8;
- unsigned LastFailedToken_l8:8;
- unsigned TokenizationSucceses_h8:8;
- unsigned TokenizationSucceses_l8:8;
-} TALON_Status_7_Debug_200ms_t ;
-typedef struct _TALON_Status_8_PulseWid_100ms_t {
- unsigned PulseWidPositionH:8;
- unsigned PulseWidPositionM:8;
- unsigned PulseWidPositionL:8;
- unsigned reserved:6;
- unsigned VelDiv4:1;
- unsigned PosDiv8:1;
- unsigned PeriodUsM8:8;
- unsigned PeriodUsL8:8;
- unsigned PulseWidVelH:8;
- unsigned PulseWidVelL:8;
-} TALON_Status_8_PulseWid_100ms_t ;
-typedef struct _TALON_Status_9_MotProfBuffer_100ms_t {
- unsigned ActTraj_IsValid:1; //!< '1' if other ActTraj_* signals are valid. '0' if there is no active trajectory pt.
- unsigned ActTraj_ProfileSlotSelect:1;
- unsigned ActTraj_VelOnly:1;
- unsigned ActTraj_IsLast:1;
- unsigned OutputType:2;
- unsigned HasUnderrun:1;
- unsigned IsUnderrun:1;
- unsigned NextID:4;
- unsigned reserved1:3;
- unsigned BufferIsFull:1;
- unsigned Count:8;
- unsigned ActTraj_VelocityH:8;
- unsigned ActTraj_VelocityL:8;
- unsigned ActTraj_PositionH:8;
- unsigned ActTraj_PositionM:8;
- unsigned ActTraj_PositionL:8;
-} TALON_Status_9_MotProfBuffer_100ms_t ;
-typedef struct _TALON_Param_Request_t {
- unsigned ParamEnum:8;
-} TALON_Param_Request_t ;
-typedef struct _TALON_Param_Response_t {
- unsigned ParamEnum:8;
- unsigned ParamValueL:8;
- unsigned ParamValueML:8;
- unsigned ParamValueMH:8;
- unsigned ParamValueH:8;
-} TALON_Param_Response_t ;
-
-#endif /* CTRE_FRAMES_H */
diff --git a/third_party/allwpilib_2017/hal/lib/athena/Accelerometer.cpp b/third_party/allwpilib_2017/hal/lib/athena/Accelerometer.cpp
deleted file mode 100644
index 6c912f3..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/Accelerometer.cpp
+++ /dev/null
@@ -1,252 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Accelerometer.h"
-
-#include <stdint.h>
-
-#include <cassert>
-#include <cstdio>
-#include <memory>
-
-#include "HAL/ChipObject.h"
-#include "HAL/HAL.h"
-
-using namespace hal;
-
-// The 7-bit I2C address with a 0 "send" bit
-static const uint8_t kSendAddress = (0x1c << 1) | 0;
-
-// The 7-bit I2C address with a 1 "receive" bit
-static const uint8_t kReceiveAddress = (0x1c << 1) | 1;
-
-static const uint8_t kControlTxRx = 1;
-static const uint8_t kControlStart = 2;
-static const uint8_t kControlStop = 4;
-
-static std::unique_ptr<tAccel> accel;
-static HAL_AccelerometerRange accelerometerRange;
-
-// Register addresses
-enum Register {
- kReg_Status = 0x00,
- kReg_OutXMSB = 0x01,
- kReg_OutXLSB = 0x02,
- kReg_OutYMSB = 0x03,
- kReg_OutYLSB = 0x04,
- kReg_OutZMSB = 0x05,
- kReg_OutZLSB = 0x06,
- kReg_Sysmod = 0x0B,
- kReg_IntSource = 0x0C,
- kReg_WhoAmI = 0x0D,
- kReg_XYZDataCfg = 0x0E,
- kReg_HPFilterCutoff = 0x0F,
- kReg_PLStatus = 0x10,
- kReg_PLCfg = 0x11,
- kReg_PLCount = 0x12,
- kReg_PLBfZcomp = 0x13,
- kReg_PLThsReg = 0x14,
- kReg_FFMtCfg = 0x15,
- kReg_FFMtSrc = 0x16,
- kReg_FFMtThs = 0x17,
- kReg_FFMtCount = 0x18,
- kReg_TransientCfg = 0x1D,
- kReg_TransientSrc = 0x1E,
- kReg_TransientThs = 0x1F,
- kReg_TransientCount = 0x20,
- kReg_PulseCfg = 0x21,
- kReg_PulseSrc = 0x22,
- kReg_PulseThsx = 0x23,
- kReg_PulseThsy = 0x24,
- kReg_PulseThsz = 0x25,
- kReg_PulseTmlt = 0x26,
- kReg_PulseLtcy = 0x27,
- kReg_PulseWind = 0x28,
- kReg_ASlpCount = 0x29,
- kReg_CtrlReg1 = 0x2A,
- kReg_CtrlReg2 = 0x2B,
- kReg_CtrlReg3 = 0x2C,
- kReg_CtrlReg4 = 0x2D,
- kReg_CtrlReg5 = 0x2E,
- kReg_OffX = 0x2F,
- kReg_OffY = 0x30,
- kReg_OffZ = 0x31
-};
-
-static void writeRegister(Register reg, uint8_t data);
-static uint8_t readRegister(Register reg);
-
-/**
- * Initialize the accelerometer.
- */
-static void initializeAccelerometer() {
- int32_t status;
-
- if (!accel) {
- accel.reset(tAccel::create(&status));
-
- // Enable I2C
- accel->writeCNFG(1, &status);
-
- // Set the counter to 100 kbps
- accel->writeCNTR(213, &status);
-
- // The device identification number should be 0x2a
- assert(readRegister(kReg_WhoAmI) == 0x2a);
- }
-}
-
-static void writeRegister(Register reg, uint8_t data) {
- int32_t status = 0;
- uint64_t initialTime;
-
- accel->writeADDR(kSendAddress, &status);
-
- // Send a start transmit/receive message with the register address
- accel->writeCNTL(kControlStart | kControlTxRx, &status);
- accel->writeDATO(reg, &status);
- accel->strobeGO(&status);
-
- // Execute and wait until it's done (up to a millisecond)
- initialTime = HAL_GetFPGATime(&status);
- while (accel->readSTAT(&status) & 1) {
- if (HAL_GetFPGATime(&status) > initialTime + 1000) break;
- }
-
- // Send a stop transmit/receive message with the data
- accel->writeCNTL(kControlStop | kControlTxRx, &status);
- accel->writeDATO(data, &status);
- accel->strobeGO(&status);
-
- // Execute and wait until it's done (up to a millisecond)
- initialTime = HAL_GetFPGATime(&status);
- while (accel->readSTAT(&status) & 1) {
- if (HAL_GetFPGATime(&status) > initialTime + 1000) break;
- }
-}
-
-static uint8_t readRegister(Register reg) {
- int32_t status = 0;
- uint64_t initialTime;
-
- // Send a start transmit/receive message with the register address
- accel->writeADDR(kSendAddress, &status);
- accel->writeCNTL(kControlStart | kControlTxRx, &status);
- accel->writeDATO(reg, &status);
- accel->strobeGO(&status);
-
- // Execute and wait until it's done (up to a millisecond)
- initialTime = HAL_GetFPGATime(&status);
- while (accel->readSTAT(&status) & 1) {
- if (HAL_GetFPGATime(&status) > initialTime + 1000) break;
- }
-
- // Receive a message with the data and stop
- accel->writeADDR(kReceiveAddress, &status);
- accel->writeCNTL(kControlStart | kControlStop | kControlTxRx, &status);
- accel->strobeGO(&status);
-
- // Execute and wait until it's done (up to a millisecond)
- initialTime = HAL_GetFPGATime(&status);
- while (accel->readSTAT(&status) & 1) {
- if (HAL_GetFPGATime(&status) > initialTime + 1000) break;
- }
-
- return accel->readDATI(&status);
-}
-
-/**
- * Convert a 12-bit raw acceleration value into a scaled double in units of
- * 1 g-force, taking into account the accelerometer range.
- */
-static double unpackAxis(int16_t raw) {
- // The raw value is actually 12 bits, not 16, so we need to propogate the
- // 2's complement sign bit to the unused 4 bits for this to work with
- // negative numbers.
- raw <<= 4;
- raw >>= 4;
-
- switch (accelerometerRange) {
- case HAL_AccelerometerRange_k2G:
- return raw / 1024.0;
- case HAL_AccelerometerRange_k4G:
- return raw / 512.0;
- case HAL_AccelerometerRange_k8G:
- return raw / 256.0;
- default:
- return 0.0;
- }
-}
-
-extern "C" {
-
-/**
- * Set the accelerometer to active or standby mode. It must be in standby
- * mode to change any configuration.
- */
-void HAL_SetAccelerometerActive(HAL_Bool active) {
- initializeAccelerometer();
-
- uint8_t ctrlReg1 = readRegister(kReg_CtrlReg1);
- ctrlReg1 &= ~1; // Clear the existing active bit
- writeRegister(kReg_CtrlReg1, ctrlReg1 | (active ? 1 : 0));
-}
-
-/**
- * Set the range of values that can be measured (either 2, 4, or 8 g-forces).
- * The accelerometer should be in standby mode when this is called.
- */
-void HAL_SetAccelerometerRange(HAL_AccelerometerRange range) {
- initializeAccelerometer();
-
- accelerometerRange = range;
-
- uint8_t xyzDataCfg = readRegister(kReg_XYZDataCfg);
- xyzDataCfg &= ~3; // Clear the existing two range bits
- writeRegister(kReg_XYZDataCfg, xyzDataCfg | range);
-}
-
-/**
- * Get the x-axis acceleration
- *
- * This is a floating point value in units of 1 g-force
- */
-double HAL_GetAccelerometerX() {
- initializeAccelerometer();
-
- int32_t raw =
- (readRegister(kReg_OutXMSB) << 4) | (readRegister(kReg_OutXLSB) >> 4);
- return unpackAxis(raw);
-}
-
-/**
- * Get the y-axis acceleration
- *
- * This is a floating point value in units of 1 g-force
- */
-double HAL_GetAccelerometerY() {
- initializeAccelerometer();
-
- int32_t raw =
- (readRegister(kReg_OutYMSB) << 4) | (readRegister(kReg_OutYLSB) >> 4);
- return unpackAxis(raw);
-}
-
-/**
- * Get the z-axis acceleration
- *
- * This is a floating point value in units of 1 g-force
- */
-double HAL_GetAccelerometerZ() {
- initializeAccelerometer();
-
- int32_t raw =
- (readRegister(kReg_OutZMSB) << 4) | (readRegister(kReg_OutZLSB) >> 4);
- return unpackAxis(raw);
-}
-
-} // extern "C"
diff --git a/third_party/allwpilib_2017/hal/lib/athena/AnalogAccumulator.cpp b/third_party/allwpilib_2017/hal/lib/athena/AnalogAccumulator.cpp
deleted file mode 100644
index b3af537..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/AnalogAccumulator.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/AnalogAccumulator.h"
-
-#include "AnalogInternal.h"
-#include "HAL/HAL.h"
-
-using namespace hal;
-
-extern "C" {
-/**
- * Is the channel attached to an accumulator.
- *
- * @param analogPortHandle Handle to the analog port.
- * @return The analog channel is attached to an accumulator.
- */
-HAL_Bool HAL_IsAccumulatorChannel(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- for (int32_t i = 0; i < kNumAccumulators; i++) {
- if (port->channel == kAccumulatorChannels[i]) return true;
- }
- return false;
-}
-
-/**
- * Initialize the accumulator.
- *
- * @param analogPortHandle Handle to the analog port.
- */
-void HAL_InitAccumulator(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status) {
- if (!HAL_IsAccumulatorChannel(analogPortHandle, status)) {
- *status = HAL_INVALID_ACCUMULATOR_CHANNEL;
- return;
- }
- HAL_SetAccumulatorCenter(analogPortHandle, 0, status);
- HAL_ResetAccumulator(analogPortHandle, status);
-}
-
-/**
- * Resets the accumulator to the initial value.
- *
- * @param analogPortHandle Handle to the analog port.
- */
-void HAL_ResetAccumulator(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- if (port->accumulator == nullptr) {
- *status = NULL_PARAMETER;
- return;
- }
- port->accumulator->strobeReset(status);
-}
-
-/**
- * Set the center value of the accumulator.
- *
- * The center value is subtracted from each A/D value before it is added to the
- * accumulator. This is used for the center value of devices like gyros and
- * accelerometers to make integration work and to take the device offset into
- * account when integrating.
- *
- * This center value is based on the output of the oversampled and averaged
- * source from channel 1. Because of this, any non-zero oversample bits will
- * affect the size of the value for this field.
- *
- * @param analogPortHandle Handle to the analog port.
- * @param center The center value of the accumulator.
- */
-void HAL_SetAccumulatorCenter(HAL_AnalogInputHandle analogPortHandle,
- int32_t center, int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- if (port->accumulator == nullptr) {
- *status = NULL_PARAMETER;
- return;
- }
- port->accumulator->writeCenter(center, status);
-}
-
-/**
- * Set the accumulator's deadband.
- *
- * @param analogPortHandle Handle to the analog port.
- * @param deadband The deadband of the accumulator.
- */
-void HAL_SetAccumulatorDeadband(HAL_AnalogInputHandle analogPortHandle,
- int32_t deadband, int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- if (port->accumulator == nullptr) {
- *status = NULL_PARAMETER;
- return;
- }
- port->accumulator->writeDeadband(deadband, status);
-}
-
-/**
- * Read the accumulated value.
- *
- * Read the value that has been accumulating on channel 1.
- * The accumulator is attached after the oversample and average engine.
- *
- * @param analogPortHandle Handle to the analog port.
- * @return The 64-bit value accumulated since the last Reset().
- */
-int64_t HAL_GetAccumulatorValue(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- if (port->accumulator == nullptr) {
- *status = NULL_PARAMETER;
- return 0;
- }
- int64_t value = port->accumulator->readOutput_Value(status);
- return value;
-}
-
-/**
- * Read the number of accumulated values.
- *
- * Read the count of the accumulated values since the accumulator was last
- * Reset().
- *
- * @param analogPortHandle Handle to the analog port.
- * @return The number of times samples from the channel were accumulated.
- */
-int64_t HAL_GetAccumulatorCount(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- if (port->accumulator == nullptr) {
- *status = NULL_PARAMETER;
- return 0;
- }
- return port->accumulator->readOutput_Count(status);
-}
-
-/**
- * Read the accumulated value and the number of accumulated values atomically.
- *
- * This function reads the value and count from the FPGA atomically.
- * This can be used for averaging.
- *
- * @param analogPortHandle Handle to the analog port.
- * @param value Pointer to the 64-bit accumulated output.
- * @param count Pointer to the number of accumulation cycles.
- */
-void HAL_GetAccumulatorOutput(HAL_AnalogInputHandle analogPortHandle,
- int64_t* value, int64_t* count, int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- if (port->accumulator == nullptr) {
- *status = NULL_PARAMETER;
- return;
- }
- if (value == nullptr || count == nullptr) {
- *status = NULL_PARAMETER;
- return;
- }
-
- tAccumulator::tOutput output = port->accumulator->readOutput(status);
-
- *value = output.Value;
- *count = output.Count;
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/AnalogGyro.cpp b/third_party/allwpilib_2017/hal/lib/athena/AnalogGyro.cpp
deleted file mode 100644
index 8d3d82d..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/AnalogGyro.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/AnalogGyro.h"
-
-#include <chrono>
-#include <thread>
-
-#include "AnalogInternal.h"
-#include "HAL/AnalogAccumulator.h"
-#include "HAL/AnalogInput.h"
-#include "HAL/handles/IndexedHandleResource.h"
-
-namespace {
-struct AnalogGyro {
- HAL_AnalogInputHandle handle;
- double voltsPerDegreePerSecond;
- double offset;
- int32_t center;
-};
-}
-
-static constexpr uint32_t kOversampleBits = 10;
-static constexpr uint32_t kAverageBits = 0;
-static constexpr double kSamplesPerSecond = 50.0;
-static constexpr double kCalibrationSampleTime = 5.0;
-static constexpr double kDefaultVoltsPerDegreePerSecond = 0.007;
-
-using namespace hal;
-
-static IndexedHandleResource<HAL_GyroHandle, AnalogGyro, kNumAccumulators,
- HAL_HandleEnum::AnalogGyro>
- analogGyroHandles;
-
-static void Wait(double seconds) {
- if (seconds < 0.0) return;
- std::this_thread::sleep_for(std::chrono::duration<double>(seconds));
-}
-
-extern "C" {
-HAL_GyroHandle HAL_InitializeAnalogGyro(HAL_AnalogInputHandle analogHandle,
- int32_t* status) {
- if (!HAL_IsAccumulatorChannel(analogHandle, status)) {
- if (*status == 0) {
- *status = HAL_INVALID_ACCUMULATOR_CHANNEL;
- }
- return HAL_kInvalidHandle;
- }
-
- // handle known to be correct, so no need to type check
- int16_t channel = getHandleIndex(analogHandle);
-
- auto handle = analogGyroHandles.Allocate(channel, status);
-
- if (*status != 0)
- return HAL_kInvalidHandle; // failed to allocate. Pass error back.
-
- // Initialize port structure
- auto gyro = analogGyroHandles.Get(handle);
- if (gyro == nullptr) { // would only error on thread issue
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
-
- gyro->handle = analogHandle;
- gyro->voltsPerDegreePerSecond = 0;
- gyro->offset = 0;
- gyro->center = 0;
-
- return handle;
-}
-
-void HAL_SetupAnalogGyro(HAL_GyroHandle handle, int32_t* status) {
- auto gyro = analogGyroHandles.Get(handle);
- if (gyro == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- gyro->voltsPerDegreePerSecond = kDefaultVoltsPerDegreePerSecond;
-
- HAL_SetAnalogAverageBits(gyro->handle, kAverageBits, status);
- if (*status != 0) return;
- HAL_SetAnalogOversampleBits(gyro->handle, kOversampleBits, status);
- if (*status != 0) return;
- double sampleRate =
- kSamplesPerSecond * (1 << (kAverageBits + kOversampleBits));
- HAL_SetAnalogSampleRate(sampleRate, status);
- if (*status != 0) return;
- Wait(0.1);
-
- HAL_SetAnalogGyroDeadband(handle, 0.0, status);
- if (*status != 0) return;
-}
-
-void HAL_FreeAnalogGyro(HAL_GyroHandle handle) {
- analogGyroHandles.Free(handle);
-}
-
-void HAL_SetAnalogGyroParameters(HAL_GyroHandle handle,
- double voltsPerDegreePerSecond, double offset,
- int32_t center, int32_t* status) {
- auto gyro = analogGyroHandles.Get(handle);
- if (gyro == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- gyro->voltsPerDegreePerSecond = voltsPerDegreePerSecond;
- gyro->offset = offset;
- gyro->center = center;
- HAL_SetAccumulatorCenter(gyro->handle, center, status);
-}
-
-void HAL_SetAnalogGyroVoltsPerDegreePerSecond(HAL_GyroHandle handle,
- double voltsPerDegreePerSecond,
- int32_t* status) {
- auto gyro = analogGyroHandles.Get(handle);
- if (gyro == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- gyro->voltsPerDegreePerSecond = voltsPerDegreePerSecond;
-}
-
-void HAL_ResetAnalogGyro(HAL_GyroHandle handle, int32_t* status) {
- auto gyro = analogGyroHandles.Get(handle);
- if (gyro == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- HAL_ResetAccumulator(gyro->handle, status);
- if (*status != 0) return;
-
- const double sampleTime = 1.0 / HAL_GetAnalogSampleRate(status);
- const double overSamples =
- 1 << HAL_GetAnalogOversampleBits(gyro->handle, status);
- const double averageSamples =
- 1 << HAL_GetAnalogAverageBits(gyro->handle, status);
- if (*status != 0) return;
- Wait(sampleTime * overSamples * averageSamples);
-}
-
-void HAL_CalibrateAnalogGyro(HAL_GyroHandle handle, int32_t* status) {
- auto gyro = analogGyroHandles.Get(handle);
- if (gyro == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- HAL_InitAccumulator(gyro->handle, status);
- if (*status != 0) return;
- Wait(kCalibrationSampleTime);
-
- int64_t value;
- int64_t count;
- HAL_GetAccumulatorOutput(gyro->handle, &value, &count, status);
- if (*status != 0) return;
-
- gyro->center = static_cast<int32_t>(
- static_cast<double>(value) / static_cast<double>(count) + .5);
-
- gyro->offset = static_cast<double>(value) / static_cast<double>(count) -
- static_cast<double>(gyro->center);
- HAL_SetAccumulatorCenter(gyro->handle, gyro->center, status);
- if (*status != 0) return;
- HAL_ResetAnalogGyro(handle, status);
-}
-
-void HAL_SetAnalogGyroDeadband(HAL_GyroHandle handle, double volts,
- int32_t* status) {
- auto gyro = analogGyroHandles.Get(handle);
- if (gyro == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- int32_t deadband = static_cast<int32_t>(
- volts * 1e9 / HAL_GetAnalogLSBWeight(gyro->handle, status) *
- (1 << HAL_GetAnalogOversampleBits(gyro->handle, status)));
- if (*status != 0) return;
- HAL_SetAccumulatorDeadband(gyro->handle, deadband, status);
-}
-
-double HAL_GetAnalogGyroAngle(HAL_GyroHandle handle, int32_t* status) {
- auto gyro = analogGyroHandles.Get(handle);
- if (gyro == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- int64_t rawValue = 0;
- int64_t count = 0;
- HAL_GetAccumulatorOutput(gyro->handle, &rawValue, &count, status);
-
- int64_t value = rawValue - static_cast<int64_t>(static_cast<double>(count) *
- gyro->offset);
-
- double scaledValue =
- value * 1e-9 *
- static_cast<double>(HAL_GetAnalogLSBWeight(gyro->handle, status)) *
- static_cast<double>(1 << HAL_GetAnalogAverageBits(gyro->handle, status)) /
- (HAL_GetAnalogSampleRate(status) * gyro->voltsPerDegreePerSecond);
-
- return scaledValue;
-}
-
-double HAL_GetAnalogGyroRate(HAL_GyroHandle handle, int32_t* status) {
- auto gyro = analogGyroHandles.Get(handle);
- if (gyro == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
-
- return (HAL_GetAnalogAverageValue(gyro->handle, status) -
- (static_cast<double>(gyro->center) + gyro->offset)) *
- 1e-9 * HAL_GetAnalogLSBWeight(gyro->handle, status) /
- ((1 << HAL_GetAnalogOversampleBits(gyro->handle, status)) *
- gyro->voltsPerDegreePerSecond);
-}
-
-double HAL_GetAnalogGyroOffset(HAL_GyroHandle handle, int32_t* status) {
- auto gyro = analogGyroHandles.Get(handle);
- if (gyro == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return gyro->offset;
-}
-
-int32_t HAL_GetAnalogGyroCenter(HAL_GyroHandle handle, int32_t* status) {
- auto gyro = analogGyroHandles.Get(handle);
- if (gyro == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return gyro->center;
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/AnalogInput.cpp b/third_party/allwpilib_2017/hal/lib/athena/AnalogInput.cpp
deleted file mode 100644
index 7c966ef..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/AnalogInput.cpp
+++ /dev/null
@@ -1,385 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/AnalogInput.h"
-
-#include <mutex>
-
-#include "AnalogInternal.h"
-#include "FRC_NetworkCommunication/AICalibration.h"
-#include "HAL/AnalogAccumulator.h"
-#include "HAL/HAL.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "HAL/handles/HandlesInternal.h"
-#include "PortsInternal.h"
-
-using namespace hal;
-
-extern "C" {
-/**
- * Initialize the analog input port using the given port object.
- *
- * @param portHandle Handle to the port to initialize.
- */
-HAL_AnalogInputHandle HAL_InitializeAnalogInputPort(HAL_PortHandle portHandle,
- int32_t* status) {
- initializeAnalog(status);
-
- if (*status != 0) return HAL_kInvalidHandle;
-
- int16_t channel = getPortHandleChannel(portHandle);
- if (channel == InvalidHandleIndex) {
- *status = PARAMETER_OUT_OF_RANGE;
- return HAL_kInvalidHandle;
- }
-
- HAL_AnalogInputHandle handle = analogInputHandles.Allocate(channel, status);
-
- if (*status != 0)
- return HAL_kInvalidHandle; // failed to allocate. Pass error back.
-
- // Initialize port structure
- auto analog_port = analogInputHandles.Get(handle);
- if (analog_port == nullptr) { // would only error on thread issue
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
- analog_port->channel = static_cast<uint8_t>(channel);
- if (HAL_IsAccumulatorChannel(handle, status)) {
- analog_port->accumulator.reset(tAccumulator::create(channel, status));
- } else {
- analog_port->accumulator = nullptr;
- }
-
- // Set default configuration
- analogInputSystem->writeScanList(channel, channel, status);
- HAL_SetAnalogAverageBits(handle, kDefaultAverageBits, status);
- HAL_SetAnalogOversampleBits(handle, kDefaultOversampleBits, status);
- return handle;
-}
-
-/**
- * @param analogPortHandle Handle to the analog port.
- */
-void HAL_FreeAnalogInputPort(HAL_AnalogInputHandle analogPortHandle) {
- // no status, so no need to check for a proper free.
- analogInputHandles.Free(analogPortHandle);
-}
-
-/**
- * Check that the analog module number is valid.
- *
- * @param module The analog module number.
- * @return Analog module is valid and present
- */
-HAL_Bool HAL_CheckAnalogModule(int32_t module) { return module == 1; }
-
-/**
- * Check that the analog output channel number is value.
- * Verify that the analog channel number is one of the legal channel numbers.
- * Channel numbers are 0-based.
- *
- * @param channel The analog output channel number.
- * @return Analog channel is valid
- */
-HAL_Bool HAL_CheckAnalogInputChannel(int32_t channel) {
- return channel < kNumAnalogInputs && channel >= 0;
-}
-
-/**
- * Set the sample rate.
- *
- * This is a global setting for the Athena and effects all channels.
- *
- * @param samplesPerSecond The number of samples per channel per second.
- */
-void HAL_SetAnalogSampleRate(double samplesPerSecond, int32_t* status) {
- // TODO: This will change when variable size scan lists are implemented.
- // TODO: Need double comparison with epsilon.
- // wpi_assert(!sampleRateSet || GetSampleRate() == samplesPerSecond);
- initializeAnalog(status);
- if (*status != 0) return;
- setAnalogSampleRate(samplesPerSecond, status);
-}
-
-/**
- * Get the current sample rate.
- *
- * This assumes one entry in the scan list.
- * This is a global setting for the Athena and effects all channels.
- *
- * @return Sample rate.
- */
-double HAL_GetAnalogSampleRate(int32_t* status) {
- initializeAnalog(status);
- if (*status != 0) return 0;
- uint32_t ticksPerConversion = analogInputSystem->readLoopTiming(status);
- uint32_t ticksPerSample =
- ticksPerConversion * getAnalogNumActiveChannels(status);
- return static_cast<double>(kTimebase) / static_cast<double>(ticksPerSample);
-}
-
-/**
- * Set the number of averaging bits.
- *
- * This sets the number of averaging bits. The actual number of averaged samples
- * is 2**bits. Use averaging to improve the stability of your measurement at the
- * expense of sampling rate. The averaging is done automatically in the FPGA.
- *
- * @param analogPortHandle Handle to the analog port to configure.
- * @param bits Number of bits to average.
- */
-void HAL_SetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
- int32_t bits, int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- analogInputSystem->writeAverageBits(port->channel, static_cast<uint8_t>(bits),
- status);
-}
-
-/**
- * Get the number of averaging bits.
- *
- * This gets the number of averaging bits from the FPGA. The actual number of
- * averaged samples is 2**bits. The averaging is done automatically in the FPGA.
- *
- * @param analogPortHandle Handle to the analog port to use.
- * @return Bits to average.
- */
-int32_t HAL_GetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return kDefaultAverageBits;
- }
- uint8_t result = analogInputSystem->readAverageBits(port->channel, status);
- return result;
-}
-
-/**
- * Set the number of oversample bits.
- *
- * This sets the number of oversample bits. The actual number of oversampled
- * values is 2**bits. Use oversampling to improve the resolution of your
- * measurements at the expense of sampling rate. The oversampling is done
- * automatically in the FPGA.
- *
- * @param analogPortHandle Handle to the analog port to use.
- * @param bits Number of bits to oversample.
- */
-void HAL_SetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
- int32_t bits, int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- analogInputSystem->writeOversampleBits(port->channel,
- static_cast<uint8_t>(bits), status);
-}
-
-/**
- * Get the number of oversample bits.
- *
- * This gets the number of oversample bits from the FPGA. The actual number of
- * oversampled values is 2**bits. The oversampling is done automatically in the
- * FPGA.
- *
- * @param analogPortHandle Handle to the analog port to use.
- * @return Bits to oversample.
- */
-int32_t HAL_GetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return kDefaultOversampleBits;
- }
- uint8_t result = analogInputSystem->readOversampleBits(port->channel, status);
- return result;
-}
-
-/**
- * Get a sample straight from the channel on this module.
- *
- * The sample is a 12-bit value representing the 0V to 5V range of the A/D
- * converter in the module. The units are in A/D converter codes. Use
- * GetVoltage() to get the analog value in calibrated units.
- *
- * @param analogPortHandle Handle to the analog port to use.
- * @return A sample straight from the channel on this module.
- */
-int32_t HAL_GetAnalogValue(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
-
- tAI::tReadSelect readSelect;
- readSelect.Channel = port->channel;
- readSelect.Averaged = false;
-
- std::lock_guard<priority_recursive_mutex> sync(analogRegisterWindowMutex);
- analogInputSystem->writeReadSelect(readSelect, status);
- analogInputSystem->strobeLatchOutput(status);
- return static_cast<int16_t>(analogInputSystem->readOutput(status));
-}
-
-/**
- * Get a sample from the output of the oversample and average engine for the
- * channel.
- *
- * The sample is 12-bit + the value configured in SetOversampleBits().
- * The value configured in SetAverageBits() will cause this value to be averaged
- * 2**bits number of samples. This is not a sliding window. The sample will not
- * change until 2**(OversamplBits + AverageBits) samples have been acquired from
- * the module on this channel. Use GetAverageVoltage() to get the analog value
- * in calibrated units.
- *
- * @param analogPortHandle Handle to the analog port to use.
- * @return A sample from the oversample and average engine for the channel.
- */
-int32_t HAL_GetAnalogAverageValue(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- tAI::tReadSelect readSelect;
- readSelect.Channel = port->channel;
- readSelect.Averaged = true;
-
- std::lock_guard<priority_recursive_mutex> sync(analogRegisterWindowMutex);
- analogInputSystem->writeReadSelect(readSelect, status);
- analogInputSystem->strobeLatchOutput(status);
- return static_cast<int32_t>(analogInputSystem->readOutput(status));
-}
-
-/**
- * Get a scaled sample straight from the channel on this module.
- *
- * The value is scaled to units of Volts using the calibrated scaling data from
- * GetLSBWeight() and GetOffset().
- *
- * @param analogPortHandle Handle to the analog port to use.
- * @return A scaled sample straight from the channel on this module.
- */
-double HAL_GetAnalogVoltage(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status) {
- int32_t value = HAL_GetAnalogValue(analogPortHandle, status);
- int32_t LSBWeight = HAL_GetAnalogLSBWeight(analogPortHandle, status);
- int32_t offset = HAL_GetAnalogOffset(analogPortHandle, status);
- double voltage = LSBWeight * 1.0e-9 * value - offset * 1.0e-9;
- return voltage;
-}
-
-/**
- * Get a scaled sample from the output of the oversample and average engine for
- * the channel.
- *
- * The value is scaled to units of Volts using the calibrated scaling data from
- * GetLSBWeight() and GetOffset(). Using oversampling will cause this value to
- * be higher resolution, but it will update more slowly. Using averaging will
- * cause this value to be more stable, but it will update more slowly.
- *
- * @param analogPortHandle Handle to the analog port to use.
- * @return A scaled sample from the output of the oversample and average engine
- * for the channel.
- */
-double HAL_GetAnalogAverageVoltage(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status) {
- int32_t value = HAL_GetAnalogAverageValue(analogPortHandle, status);
- int32_t LSBWeight = HAL_GetAnalogLSBWeight(analogPortHandle, status);
- int32_t offset = HAL_GetAnalogOffset(analogPortHandle, status);
- int32_t oversampleBits =
- HAL_GetAnalogOversampleBits(analogPortHandle, status);
- double voltage =
- LSBWeight * 1.0e-9 * value / static_cast<double>(1 << oversampleBits) -
- offset * 1.0e-9;
- return voltage;
-}
-
-/**
- * Convert a voltage to a raw value for a specified channel.
- *
- * This process depends on the calibration of each channel, so the channel must
- * be specified.
- *
- * @todo This assumes raw values. Oversampling not supported as is.
- *
- * @param analogPortHandle Handle to the analog port to use.
- * @param voltage The voltage to convert.
- * @return The raw value for the channel.
- */
-int32_t HAL_GetAnalogVoltsToValue(HAL_AnalogInputHandle analogPortHandle,
- double voltage, int32_t* status) {
- if (voltage > 5.0) {
- voltage = 5.0;
- *status = VOLTAGE_OUT_OF_RANGE;
- }
- if (voltage < 0.0) {
- voltage = 0.0;
- *status = VOLTAGE_OUT_OF_RANGE;
- }
- int32_t LSBWeight = HAL_GetAnalogLSBWeight(analogPortHandle, status);
- int32_t offset = HAL_GetAnalogOffset(analogPortHandle, status);
- int32_t value =
- static_cast<int32_t>((voltage + offset * 1.0e-9) / (LSBWeight * 1.0e-9));
- return value;
-}
-
-/**
- * Get the factory scaling least significant bit weight constant.
- * The least significant bit weight constant for the channel that was calibrated
- * in manufacturing and stored in an eeprom in the module.
- *
- * Volts = ((LSB_Weight * 1e-9) * raw) - (Offset * 1e-9)
- *
- * @param analogPortHandle Handle to the analog port to use.
- * @return Least significant bit weight.
- */
-int32_t HAL_GetAnalogLSBWeight(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- int32_t lsbWeight = FRC_NetworkCommunication_nAICalibration_getLSBWeight(
- 0, port->channel, status); // XXX: aiSystemIndex == 0?
- return lsbWeight;
-}
-
-/**
- * Get the factory scaling offset constant.
- * The offset constant for the channel that was calibrated in manufacturing and
- * stored in an eeprom in the module.
- *
- * Volts = ((LSB_Weight * 1e-9) * raw) - (Offset * 1e-9)
- *
- * @param analogPortHandle Handle to the analog port to use.
- * @return Offset constant.
- */
-int32_t HAL_GetAnalogOffset(HAL_AnalogInputHandle analogPortHandle,
- int32_t* status) {
- auto port = analogInputHandles.Get(analogPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- int32_t offset = FRC_NetworkCommunication_nAICalibration_getOffset(
- 0, port->channel, status); // XXX: aiSystemIndex == 0?
- return offset;
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/AnalogInternal.cpp b/third_party/allwpilib_2017/hal/lib/athena/AnalogInternal.cpp
deleted file mode 100644
index 98e5524..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/AnalogInternal.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "AnalogInternal.h"
-
-#include <atomic>
-
-#include "HAL/AnalogInput.h"
-#include "HAL/ChipObject.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "PortsInternal.h"
-
-namespace hal {
-priority_recursive_mutex analogRegisterWindowMutex;
-std::unique_ptr<tAI> analogInputSystem;
-std::unique_ptr<tAO> analogOutputSystem;
-
-IndexedHandleResource<HAL_AnalogInputHandle, hal::AnalogPort, kNumAnalogInputs,
- HAL_HandleEnum::AnalogInput>
- analogInputHandles;
-
-static int32_t analogNumChannelsToActivate = 0;
-
-static std::atomic<bool> analogSystemInitialized{false};
-
-bool analogSampleRateSet = false;
-
-/**
- * Initialize the analog System.
- */
-void initializeAnalog(int32_t* status) {
- if (analogSystemInitialized) return;
- std::lock_guard<priority_recursive_mutex> sync(analogRegisterWindowMutex);
- if (analogSystemInitialized) return;
- analogInputSystem.reset(tAI::create(status));
- analogOutputSystem.reset(tAO::create(status));
- setAnalogNumChannelsToActivate(kNumAnalogInputs);
- setAnalogSampleRate(kDefaultSampleRate, status);
- analogSystemInitialized = true;
-}
-
-/**
- * Return the number of channels on the module in use.
- *
- * @return Active channels.
- */
-int32_t getAnalogNumActiveChannels(int32_t* status) {
- int32_t scanSize = analogInputSystem->readConfig_ScanSize(status);
- if (scanSize == 0) return 8;
- return scanSize;
-}
-
-/**
- * Get the number of active channels.
- *
- * This is an internal function to allow the atomic update of both the
- * number of active channels and the sample rate.
- *
- * When the number of channels changes, use the new value. Otherwise,
- * return the curent value.
- *
- * @return Value to write to the active channels field.
- */
-int32_t getAnalogNumChannelsToActivate(int32_t* status) {
- if (analogNumChannelsToActivate == 0)
- return getAnalogNumActiveChannels(status);
- return analogNumChannelsToActivate;
-}
-
-/**
- * Set the sample rate.
- *
- * This is a global setting for the Athena and effects all channels.
- *
- * @param samplesPerSecond The number of samples per channel per second.
- */
-void setAnalogSampleRate(double samplesPerSecond, int32_t* status) {
- // TODO: This will change when variable size scan lists are implemented.
- // TODO: Need double comparison with epsilon.
- // wpi_assert(!sampleRateSet || GetSampleRate() == samplesPerSecond);
- analogSampleRateSet = true;
-
- // Compute the convert rate
- uint32_t ticksPerSample =
- static_cast<uint32_t>(static_cast<double>(kTimebase) / samplesPerSecond);
- uint32_t ticksPerConversion =
- ticksPerSample / getAnalogNumChannelsToActivate(status);
- // ticksPerConversion must be at least 80
- if (ticksPerConversion < 80) {
- if ((*status) >= 0) *status = SAMPLE_RATE_TOO_HIGH;
- ticksPerConversion = 80;
- }
-
- // Atomically set the scan size and the convert rate so that the sample rate
- // is constant
- tAI::tConfig config;
- config.ScanSize = getAnalogNumChannelsToActivate(status);
- config.ConvertRate = ticksPerConversion;
- analogInputSystem->writeConfig(config, status);
-
- // Indicate that the scan size has been commited to hardware.
- setAnalogNumChannelsToActivate(0);
-}
-
-/**
- * Set the number of active channels.
- *
- * Store the number of active channels to set. Don't actually commit to
- * hardware
- * until SetSampleRate().
- *
- * @param channels Number of active channels.
- */
-void setAnalogNumChannelsToActivate(int32_t channels) {
- analogNumChannelsToActivate = channels;
-}
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/lib/athena/AnalogInternal.h b/third_party/allwpilib_2017/hal/lib/athena/AnalogInternal.h
deleted file mode 100644
index f91c8e5..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/AnalogInternal.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include <memory>
-
-#include "HAL/ChipObject.h"
-#include "HAL/Ports.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "HAL/handles/IndexedHandleResource.h"
-#include "PortsInternal.h"
-
-namespace hal {
-constexpr int32_t kTimebase = 40000000; ///< 40 MHz clock
-constexpr int32_t kDefaultOversampleBits = 0;
-constexpr int32_t kDefaultAverageBits = 7;
-constexpr double kDefaultSampleRate = 50000.0;
-static const uint32_t kAccumulatorChannels[] = {0, 1};
-
-extern std::unique_ptr<tAI> analogInputSystem;
-extern std::unique_ptr<tAO> analogOutputSystem;
-extern priority_recursive_mutex analogRegisterWindowMutex;
-extern bool analogSampleRateSet;
-
-struct AnalogPort {
- uint8_t channel;
- std::unique_ptr<tAccumulator> accumulator;
-};
-
-extern IndexedHandleResource<HAL_AnalogInputHandle, hal::AnalogPort,
- kNumAnalogInputs, HAL_HandleEnum::AnalogInput>
- analogInputHandles;
-
-int32_t getAnalogNumActiveChannels(int32_t* status);
-int32_t getAnalogNumChannelsToActivate(int32_t* status);
-void setAnalogNumChannelsToActivate(int32_t channels);
-void setAnalogSampleRate(double samplesPerSecond, int32_t* status);
-void initializeAnalog(int32_t* status);
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/lib/athena/AnalogOutput.cpp b/third_party/allwpilib_2017/hal/lib/athena/AnalogOutput.cpp
deleted file mode 100644
index 33642a9..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/AnalogOutput.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/AnalogOutput.h"
-
-#include "AnalogInternal.h"
-#include "HAL/Errors.h"
-#include "HAL/handles/HandlesInternal.h"
-#include "HAL/handles/IndexedHandleResource.h"
-#include "PortsInternal.h"
-
-using namespace hal;
-
-namespace {
-struct AnalogOutput {
- uint8_t channel;
-};
-}
-
-static IndexedHandleResource<HAL_AnalogOutputHandle, AnalogOutput,
- kNumAnalogOutputs, HAL_HandleEnum::AnalogOutput>
- analogOutputHandles;
-
-extern "C" {
-
-/**
- * Initialize the analog output port using the given port object.
- */
-HAL_AnalogOutputHandle HAL_InitializeAnalogOutputPort(HAL_PortHandle portHandle,
- int32_t* status) {
- initializeAnalog(status);
-
- if (*status != 0) return HAL_kInvalidHandle;
-
- int16_t channel = getPortHandleChannel(portHandle);
- if (channel == InvalidHandleIndex) {
- *status = PARAMETER_OUT_OF_RANGE;
- return HAL_kInvalidHandle;
- }
-
- HAL_AnalogOutputHandle handle = analogOutputHandles.Allocate(channel, status);
-
- if (*status != 0)
- return HAL_kInvalidHandle; // failed to allocate. Pass error back.
-
- auto port = analogOutputHandles.Get(handle);
- if (port == nullptr) { // would only error on thread issue
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
-
- port->channel = static_cast<uint8_t>(channel);
- return handle;
-}
-
-void HAL_FreeAnalogOutputPort(HAL_AnalogOutputHandle analogOutputHandle) {
- // no status, so no need to check for a proper free.
- analogOutputHandles.Free(analogOutputHandle);
-}
-
-/**
- * Check that the analog output channel number is value.
- * Verify that the analog channel number is one of the legal channel numbers.
- * Channel numbers are 0-based.
- *
- * @return Analog channel is valid
- */
-HAL_Bool HAL_CheckAnalogOutputChannel(int32_t channel) {
- return channel < kNumAnalogOutputs && channel >= 0;
-}
-
-void HAL_SetAnalogOutput(HAL_AnalogOutputHandle analogOutputHandle,
- double voltage, int32_t* status) {
- auto port = analogOutputHandles.Get(analogOutputHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- uint16_t rawValue = static_cast<uint16_t>(voltage / 5.0 * 0x1000);
-
- if (voltage < 0.0)
- rawValue = 0;
- else if (voltage > 5.0)
- rawValue = 0x1000;
-
- analogOutputSystem->writeMXP(port->channel, rawValue, status);
-}
-
-double HAL_GetAnalogOutput(HAL_AnalogOutputHandle analogOutputHandle,
- int32_t* status) {
- auto port = analogOutputHandles.Get(analogOutputHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0.0;
- }
-
- uint16_t rawValue = analogOutputSystem->readMXP(port->channel, status);
-
- return rawValue * 5.0 / 0x1000;
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/AnalogTrigger.cpp b/third_party/allwpilib_2017/hal/lib/athena/AnalogTrigger.cpp
deleted file mode 100644
index a1d85bc..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/AnalogTrigger.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/AnalogTrigger.h"
-
-#include "AnalogInternal.h"
-#include "HAL/AnalogInput.h"
-#include "HAL/Errors.h"
-#include "HAL/handles/HandlesInternal.h"
-#include "HAL/handles/LimitedHandleResource.h"
-#include "PortsInternal.h"
-
-using namespace hal;
-
-namespace {
-struct AnalogTrigger {
- std::unique_ptr<tAnalogTrigger> trigger;
- HAL_AnalogInputHandle analogHandle;
- uint8_t index;
-};
-}
-
-static LimitedHandleResource<HAL_AnalogTriggerHandle, AnalogTrigger,
- kNumAnalogTriggers, HAL_HandleEnum::AnalogTrigger>
- analogTriggerHandles;
-
-extern "C" {
-
-HAL_AnalogTriggerHandle HAL_InitializeAnalogTrigger(
- HAL_AnalogInputHandle portHandle, int32_t* index, int32_t* status) {
- // ensure we are given a valid and active AnalogInput handle
- auto analog_port = analogInputHandles.Get(portHandle);
- if (analog_port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
- HAL_AnalogTriggerHandle handle = analogTriggerHandles.Allocate();
- if (handle == HAL_kInvalidHandle) {
- *status = NO_AVAILABLE_RESOURCES;
- return HAL_kInvalidHandle;
- }
- auto trigger = analogTriggerHandles.Get(handle);
- if (trigger == nullptr) { // would only occur on thread issue
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
- trigger->analogHandle = portHandle;
- trigger->index = static_cast<uint8_t>(getHandleIndex(handle));
- *index = trigger->index;
-
- trigger->trigger.reset(tAnalogTrigger::create(trigger->index, status));
- trigger->trigger->writeSourceSelect_Channel(analog_port->channel, status);
- return handle;
-}
-
-void HAL_CleanAnalogTrigger(HAL_AnalogTriggerHandle analogTriggerHandle,
- int32_t* status) {
- analogTriggerHandles.Free(analogTriggerHandle);
- // caller owns the analog input handle.
-}
-
-void HAL_SetAnalogTriggerLimitsRaw(HAL_AnalogTriggerHandle analogTriggerHandle,
- int32_t lower, int32_t upper,
- int32_t* status) {
- auto trigger = analogTriggerHandles.Get(analogTriggerHandle);
- if (trigger == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- if (lower > upper) {
- *status = ANALOG_TRIGGER_LIMIT_ORDER_ERROR;
- }
- trigger->trigger->writeLowerLimit(lower, status);
- trigger->trigger->writeUpperLimit(upper, status);
-}
-
-/**
- * Set the upper and lower limits of the analog trigger.
- * The limits are given as floating point voltage values.
- */
-void HAL_SetAnalogTriggerLimitsVoltage(
- HAL_AnalogTriggerHandle analogTriggerHandle, double lower, double upper,
- int32_t* status) {
- auto trigger = analogTriggerHandles.Get(analogTriggerHandle);
- if (trigger == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- if (lower > upper) {
- *status = ANALOG_TRIGGER_LIMIT_ORDER_ERROR;
- }
-
- // TODO: This depends on the averaged setting. Only raw values will work as
- // is.
- trigger->trigger->writeLowerLimit(
- HAL_GetAnalogVoltsToValue(trigger->analogHandle, lower, status), status);
- trigger->trigger->writeUpperLimit(
- HAL_GetAnalogVoltsToValue(trigger->analogHandle, upper, status), status);
-}
-
-/**
- * Configure the analog trigger to use the averaged vs. raw values.
- * If the value is true, then the averaged value is selected for the analog
- * trigger, otherwise the immediate value is used.
- */
-void HAL_SetAnalogTriggerAveraged(HAL_AnalogTriggerHandle analogTriggerHandle,
- HAL_Bool useAveragedValue, int32_t* status) {
- auto trigger = analogTriggerHandles.Get(analogTriggerHandle);
- if (trigger == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- if (trigger->trigger->readSourceSelect_Filter(status) != 0) {
- *status = INCOMPATIBLE_STATE;
- // TODO: wpi_setWPIErrorWithContext(IncompatibleMode, "Hardware does not
- // support average and filtering at the same time.");
- }
- trigger->trigger->writeSourceSelect_Averaged(useAveragedValue, status);
-}
-
-/**
- * Configure the analog trigger to use a filtered value.
- * The analog trigger will operate with a 3 point average rejection filter. This
- * is designed to help with 360 degree pot applications for the period where the
- * pot crosses through zero.
- */
-void HAL_SetAnalogTriggerFiltered(HAL_AnalogTriggerHandle analogTriggerHandle,
- HAL_Bool useFilteredValue, int32_t* status) {
- auto trigger = analogTriggerHandles.Get(analogTriggerHandle);
- if (trigger == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- if (trigger->trigger->readSourceSelect_Averaged(status) != 0) {
- *status = INCOMPATIBLE_STATE;
- // TODO: wpi_setWPIErrorWithContext(IncompatibleMode, "Hardware does not "
- // "support average and filtering at the same time.");
- }
- trigger->trigger->writeSourceSelect_Filter(useFilteredValue, status);
-}
-
-/**
- * Return the InWindow output of the analog trigger.
- * True if the analog input is between the upper and lower limits.
- * @return The InWindow output of the analog trigger.
- */
-HAL_Bool HAL_GetAnalogTriggerInWindow(
- HAL_AnalogTriggerHandle analogTriggerHandle, int32_t* status) {
- auto trigger = analogTriggerHandles.Get(analogTriggerHandle);
- if (trigger == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- return trigger->trigger->readOutput_InHysteresis(trigger->index, status) != 0;
-}
-
-/**
- * Return the TriggerState output of the analog trigger.
- * True if above upper limit.
- * False if below lower limit.
- * If in Hysteresis, maintain previous state.
- * @return The TriggerState output of the analog trigger.
- */
-HAL_Bool HAL_GetAnalogTriggerTriggerState(
- HAL_AnalogTriggerHandle analogTriggerHandle, int32_t* status) {
- auto trigger = analogTriggerHandles.Get(analogTriggerHandle);
- if (trigger == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- return trigger->trigger->readOutput_OverLimit(trigger->index, status) != 0;
-}
-
-/**
- * Get the state of the analog trigger output.
- * @return The state of the analog trigger output.
- */
-HAL_Bool HAL_GetAnalogTriggerOutput(HAL_AnalogTriggerHandle analogTriggerHandle,
- HAL_AnalogTriggerType type,
- int32_t* status) {
- auto trigger = analogTriggerHandles.Get(analogTriggerHandle);
- if (trigger == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- bool result = false;
- switch (type) {
- case HAL_Trigger_kInWindow:
- result =
- trigger->trigger->readOutput_InHysteresis(trigger->index, status);
- break; // XXX: Backport
- case HAL_Trigger_kState:
- result = trigger->trigger->readOutput_OverLimit(trigger->index, status);
- break; // XXX: Backport
- case HAL_Trigger_kRisingPulse:
- case HAL_Trigger_kFallingPulse:
- *status = ANALOG_TRIGGER_PULSE_OUTPUT_ERROR;
- return false;
- }
- return result;
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/Compressor.cpp b/third_party/allwpilib_2017/hal/lib/athena/Compressor.cpp
deleted file mode 100644
index 210beca..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/Compressor.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Compressor.h"
-
-#include "HAL/Errors.h"
-#include "HAL/handles/HandlesInternal.h"
-#include "PCMInternal.h"
-#include "PortsInternal.h"
-#include "ctre/PCM.h"
-
-using namespace hal;
-
-extern "C" {
-
-HAL_CompressorHandle HAL_InitializeCompressor(int32_t module, int32_t* status) {
- // Use status to check for invalid index
- initializePCM(module, status);
- if (*status != 0) {
- return HAL_kInvalidHandle;
- }
-
- // As compressors can have unlimited objects, just create a
- // handle with the module number as the index.
-
- return (HAL_CompressorHandle)createHandle(static_cast<int16_t>(module),
- HAL_HandleEnum::Compressor);
-}
-
-HAL_Bool HAL_CheckCompressorModule(int32_t module) {
- return module < kNumPCMModules && module >= 0;
-}
-
-HAL_Bool HAL_GetCompressor(HAL_CompressorHandle compressorHandle,
- int32_t* status) {
- int16_t index =
- getHandleTypedIndex(compressorHandle, HAL_HandleEnum::Compressor);
- if (index == InvalidHandleIndex) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- bool value;
-
- *status = PCM_modules[index]->GetCompressor(value);
-
- return value;
-}
-
-void HAL_SetCompressorClosedLoopControl(HAL_CompressorHandle compressorHandle,
- HAL_Bool value, int32_t* status) {
- int16_t index =
- getHandleTypedIndex(compressorHandle, HAL_HandleEnum::Compressor);
- if (index == InvalidHandleIndex) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- *status = PCM_modules[index]->SetClosedLoopControl(value);
-}
-
-HAL_Bool HAL_GetCompressorClosedLoopControl(
- HAL_CompressorHandle compressorHandle, int32_t* status) {
- int16_t index =
- getHandleTypedIndex(compressorHandle, HAL_HandleEnum::Compressor);
- if (index == InvalidHandleIndex) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- bool value;
-
- *status = PCM_modules[index]->GetClosedLoopControl(value);
-
- return value;
-}
-
-HAL_Bool HAL_GetCompressorPressureSwitch(HAL_CompressorHandle compressorHandle,
- int32_t* status) {
- int16_t index =
- getHandleTypedIndex(compressorHandle, HAL_HandleEnum::Compressor);
- if (index == InvalidHandleIndex) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- bool value;
-
- *status = PCM_modules[index]->GetPressure(value);
-
- return value;
-}
-
-double HAL_GetCompressorCurrent(HAL_CompressorHandle compressorHandle,
- int32_t* status) {
- int16_t index =
- getHandleTypedIndex(compressorHandle, HAL_HandleEnum::Compressor);
- if (index == InvalidHandleIndex) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- float value;
-
- *status = PCM_modules[index]->GetCompressorCurrent(value);
-
- return value;
-}
-HAL_Bool HAL_GetCompressorCurrentTooHighFault(
- HAL_CompressorHandle compressorHandle, int32_t* status) {
- int16_t index =
- getHandleTypedIndex(compressorHandle, HAL_HandleEnum::Compressor);
- if (index == InvalidHandleIndex) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- bool value;
-
- *status = PCM_modules[index]->GetCompressorCurrentTooHighFault(value);
-
- return value;
-}
-HAL_Bool HAL_GetCompressorCurrentTooHighStickyFault(
- HAL_CompressorHandle compressorHandle, int32_t* status) {
- int16_t index =
- getHandleTypedIndex(compressorHandle, HAL_HandleEnum::Compressor);
- if (index == InvalidHandleIndex) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- bool value;
-
- *status = PCM_modules[index]->GetCompressorCurrentTooHighStickyFault(value);
-
- return value;
-}
-HAL_Bool HAL_GetCompressorShortedStickyFault(
- HAL_CompressorHandle compressorHandle, int32_t* status) {
- int16_t index =
- getHandleTypedIndex(compressorHandle, HAL_HandleEnum::Compressor);
- if (index == InvalidHandleIndex) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- bool value;
-
- *status = PCM_modules[index]->GetCompressorShortedStickyFault(value);
-
- return value;
-}
-HAL_Bool HAL_GetCompressorShortedFault(HAL_CompressorHandle compressorHandle,
- int32_t* status) {
- int16_t index =
- getHandleTypedIndex(compressorHandle, HAL_HandleEnum::Compressor);
- if (index == InvalidHandleIndex) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- bool value;
-
- *status = PCM_modules[index]->GetCompressorShortedFault(value);
-
- return value;
-}
-HAL_Bool HAL_GetCompressorNotConnectedStickyFault(
- HAL_CompressorHandle compressorHandle, int32_t* status) {
- int16_t index =
- getHandleTypedIndex(compressorHandle, HAL_HandleEnum::Compressor);
- if (index == InvalidHandleIndex) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- bool value;
-
- *status = PCM_modules[index]->GetCompressorNotConnectedStickyFault(value);
-
- return value;
-}
-HAL_Bool HAL_GetCompressorNotConnectedFault(
- HAL_CompressorHandle compressorHandle, int32_t* status) {
- int16_t index =
- getHandleTypedIndex(compressorHandle, HAL_HandleEnum::Compressor);
- if (index == InvalidHandleIndex) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- bool value;
-
- *status = PCM_modules[index]->GetCompressorNotConnectedFault(value);
-
- return value;
-}
-} // extern "C"
diff --git a/third_party/allwpilib_2017/hal/lib/athena/Constants.cpp b/third_party/allwpilib_2017/hal/lib/athena/Constants.cpp
deleted file mode 100644
index 1f4517b..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/Constants.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Constants.h"
-
-#include "ConstantsInternal.h"
-
-using namespace hal;
-
-extern "C" {
-int32_t HAL_GetSystemClockTicksPerMicrosecond(void) {
- return kSystemClockTicksPerMicrosecond;
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/ConstantsInternal.h b/third_party/allwpilib_2017/hal/lib/athena/ConstantsInternal.h
deleted file mode 100644
index a1466fb..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/ConstantsInternal.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-namespace hal {
-constexpr int32_t kSystemClockTicksPerMicrosecond = 40;
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/Counter.cpp b/third_party/allwpilib_2017/hal/lib/athena/Counter.cpp
deleted file mode 100644
index 9273ea9..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/Counter.cpp
+++ /dev/null
@@ -1,466 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Counter.h"
-
-#include "ConstantsInternal.h"
-#include "DigitalInternal.h"
-#include "HAL/HAL.h"
-#include "HAL/handles/LimitedHandleResource.h"
-#include "PortsInternal.h"
-
-using namespace hal;
-
-namespace {
-struct Counter {
- std::unique_ptr<tCounter> counter;
- uint8_t index;
-};
-}
-
-static LimitedHandleResource<HAL_CounterHandle, Counter, kNumCounters,
- HAL_HandleEnum::Counter>
- counterHandles;
-
-extern "C" {
-HAL_CounterHandle HAL_InitializeCounter(HAL_Counter_Mode mode, int32_t* index,
- int32_t* status) {
- auto handle = counterHandles.Allocate();
- if (handle == HAL_kInvalidHandle) { // out of resources
- *status = NO_AVAILABLE_RESOURCES;
- return HAL_kInvalidHandle;
- }
- auto counter = counterHandles.Get(handle);
- if (counter == nullptr) { // would only occur on thread issues
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
- counter->index = static_cast<uint8_t>(getHandleIndex(handle));
- *index = counter->index;
-
- counter->counter.reset(tCounter::create(counter->index, status));
- counter->counter->writeConfig_Mode(mode, status);
- counter->counter->writeTimerConfig_AverageSize(1, status);
- return handle;
-}
-
-void HAL_FreeCounter(HAL_CounterHandle counterHandle, int32_t* status) {
- counterHandles.Free(counterHandle);
-}
-
-void HAL_SetCounterAverageSize(HAL_CounterHandle counterHandle, int32_t size,
- int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- counter->counter->writeTimerConfig_AverageSize(size, status);
-}
-
-/**
- * Set the source object that causes the counter to count up.
- * Set the up counting DigitalSource.
- */
-void HAL_SetCounterUpSource(HAL_CounterHandle counterHandle,
- HAL_Handle digitalSourceHandle,
- HAL_AnalogTriggerType analogTriggerType,
- int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- bool routingAnalogTrigger = false;
- uint8_t routingChannel = 0;
- uint8_t routingModule = 0;
- bool success =
- remapDigitalSource(digitalSourceHandle, analogTriggerType, routingChannel,
- routingModule, routingAnalogTrigger);
- if (!success) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- counter->counter->writeConfig_UpSource_Module(routingModule, status);
- counter->counter->writeConfig_UpSource_Channel(routingChannel, status);
- counter->counter->writeConfig_UpSource_AnalogTrigger(routingAnalogTrigger,
- status);
-
- if (counter->counter->readConfig_Mode(status) == HAL_Counter_kTwoPulse ||
- counter->counter->readConfig_Mode(status) ==
- HAL_Counter_kExternalDirection) {
- HAL_SetCounterUpSourceEdge(counterHandle, true, false, status);
- }
- counter->counter->strobeReset(status);
-}
-
-/**
- * Set the edge sensitivity on an up counting source.
- * Set the up source to either detect rising edges or falling edges.
- */
-void HAL_SetCounterUpSourceEdge(HAL_CounterHandle counterHandle,
- HAL_Bool risingEdge, HAL_Bool fallingEdge,
- int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- counter->counter->writeConfig_UpRisingEdge(risingEdge, status);
- counter->counter->writeConfig_UpFallingEdge(fallingEdge, status);
-}
-
-/**
- * Disable the up counting source to the counter.
- */
-void HAL_ClearCounterUpSource(HAL_CounterHandle counterHandle,
- int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- counter->counter->writeConfig_UpFallingEdge(false, status);
- counter->counter->writeConfig_UpRisingEdge(false, status);
- // Index 0 of digital is always 0.
- counter->counter->writeConfig_UpSource_Channel(0, status);
- counter->counter->writeConfig_UpSource_AnalogTrigger(false, status);
-}
-
-/**
- * Set the source object that causes the counter to count down.
- * Set the down counting DigitalSource.
- */
-void HAL_SetCounterDownSource(HAL_CounterHandle counterHandle,
- HAL_Handle digitalSourceHandle,
- HAL_AnalogTriggerType analogTriggerType,
- int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- uint8_t mode = counter->counter->readConfig_Mode(status);
- if (mode != HAL_Counter_kTwoPulse && mode != HAL_Counter_kExternalDirection) {
- // TODO: wpi_setWPIErrorWithContext(ParameterOutOfRange, "Counter only
- // supports DownSource in TwoPulse and ExternalDirection modes.");
- *status = PARAMETER_OUT_OF_RANGE;
- return;
- }
-
- bool routingAnalogTrigger = false;
- uint8_t routingChannel = 0;
- uint8_t routingModule = 0;
- bool success =
- remapDigitalSource(digitalSourceHandle, analogTriggerType, routingChannel,
- routingModule, routingAnalogTrigger);
- if (!success) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- counter->counter->writeConfig_DownSource_Module(routingModule, status);
- counter->counter->writeConfig_DownSource_Channel(routingChannel, status);
- counter->counter->writeConfig_DownSource_AnalogTrigger(routingAnalogTrigger,
- status);
-
- HAL_SetCounterDownSourceEdge(counterHandle, true, false, status);
- counter->counter->strobeReset(status);
-}
-
-/**
- * Set the edge sensitivity on a down counting source.
- * Set the down source to either detect rising edges or falling edges.
- */
-void HAL_SetCounterDownSourceEdge(HAL_CounterHandle counterHandle,
- HAL_Bool risingEdge, HAL_Bool fallingEdge,
- int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- counter->counter->writeConfig_DownRisingEdge(risingEdge, status);
- counter->counter->writeConfig_DownFallingEdge(fallingEdge, status);
-}
-
-/**
- * Disable the down counting source to the counter.
- */
-void HAL_ClearCounterDownSource(HAL_CounterHandle counterHandle,
- int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- counter->counter->writeConfig_DownFallingEdge(false, status);
- counter->counter->writeConfig_DownRisingEdge(false, status);
- // Index 0 of digital is always 0.
- counter->counter->writeConfig_DownSource_Channel(0, status);
- counter->counter->writeConfig_DownSource_AnalogTrigger(false, status);
-}
-
-/**
- * Set standard up / down counting mode on this counter.
- * Up and down counts are sourced independently from two inputs.
- */
-void HAL_SetCounterUpDownMode(HAL_CounterHandle counterHandle,
- int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- counter->counter->writeConfig_Mode(HAL_Counter_kTwoPulse, status);
-}
-
-/**
- * Set external direction mode on this counter.
- * Counts are sourced on the Up counter input.
- * The Down counter input represents the direction to count.
- */
-void HAL_SetCounterExternalDirectionMode(HAL_CounterHandle counterHandle,
- int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- counter->counter->writeConfig_Mode(HAL_Counter_kExternalDirection, status);
-}
-
-/**
- * Set Semi-period mode on this counter.
- * Counts up on both rising and falling edges.
- */
-void HAL_SetCounterSemiPeriodMode(HAL_CounterHandle counterHandle,
- HAL_Bool highSemiPeriod, int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- counter->counter->writeConfig_Mode(HAL_Counter_kSemiperiod, status);
- counter->counter->writeConfig_UpRisingEdge(highSemiPeriod, status);
- HAL_SetCounterUpdateWhenEmpty(counterHandle, false, status);
-}
-
-/**
- * Configure the counter to count in up or down based on the length of the input
- * pulse.
- * This mode is most useful for direction sensitive gear tooth sensors.
- * @param threshold The pulse length beyond which the counter counts the
- * opposite direction. Units are seconds.
- */
-void HAL_SetCounterPulseLengthMode(HAL_CounterHandle counterHandle,
- double threshold, int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- counter->counter->writeConfig_Mode(HAL_Counter_kPulseLength, status);
- counter->counter->writeConfig_PulseLengthThreshold(
- static_cast<uint32_t>(threshold * 1.0e6) *
- kSystemClockTicksPerMicrosecond,
- status);
-}
-
-/**
- * Get the Samples to Average which specifies the number of samples of the timer
- * to
- * average when calculating the period. Perform averaging to account for
- * mechanical imperfections or as oversampling to increase resolution.
- * @return SamplesToAverage The number of samples being averaged (from 1 to 127)
- */
-int32_t HAL_GetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
- int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return counter->counter->readTimerConfig_AverageSize(status);
-}
-
-/**
- * Set the Samples to Average which specifies the number of samples of the timer
- * to average when calculating the period. Perform averaging to account for
- * mechanical imperfections or as oversampling to increase resolution.
- * @param samplesToAverage The number of samples to average from 1 to 127.
- */
-void HAL_SetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
- int32_t samplesToAverage, int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- if (samplesToAverage < 1 || samplesToAverage > 127) {
- *status = PARAMETER_OUT_OF_RANGE;
- }
- counter->counter->writeTimerConfig_AverageSize(samplesToAverage, status);
-}
-
-/**
- * Reset the Counter to zero.
- * Set the counter value to zero. This doesn't effect the running state of the
- * counter, just sets the current value to zero.
- */
-void HAL_ResetCounter(HAL_CounterHandle counterHandle, int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- counter->counter->strobeReset(status);
-}
-
-/**
- * Read the current counter value.
- * Read the value at this instant. It may still be running, so it reflects the
- * current value. Next time it is read, it might have a different value.
- */
-int32_t HAL_GetCounter(HAL_CounterHandle counterHandle, int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- int32_t value = counter->counter->readOutput_Value(status);
- return value;
-}
-
-/*
- * Get the Period of the most recent count.
- * Returns the time interval of the most recent count. This can be used for
- * velocity calculations to determine shaft speed.
- * @returns The period of the last two pulses in units of seconds.
- */
-double HAL_GetCounterPeriod(HAL_CounterHandle counterHandle, int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0.0;
- }
- tCounter::tTimerOutput output = counter->counter->readTimerOutput(status);
- double period;
- if (output.Stalled) {
- // Return infinity
- double zero = 0.0;
- period = 1.0 / zero;
- } else {
- // output.Period is a fixed point number that counts by 2 (24 bits, 25
- // integer bits)
- period = static_cast<double>(output.Period << 1) /
- static_cast<double>(output.Count);
- }
- return static_cast<double>(period *
- 2.5e-8); // result * timebase (currently 25ns)
-}
-
-/**
- * Set the maximum period where the device is still considered "moving".
- * Sets the maximum period where the device is considered moving. This value is
- * used to determine the "stopped" state of the counter using the GetStopped
- * method.
- * @param maxPeriod The maximum period where the counted device is considered
- * moving in seconds.
- */
-void HAL_SetCounterMaxPeriod(HAL_CounterHandle counterHandle, double maxPeriod,
- int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- counter->counter->writeTimerConfig_StallPeriod(
- static_cast<uint32_t>(maxPeriod * 4.0e8), status);
-}
-
-/**
- * Select whether you want to continue updating the event timer output when
- * there are no samples captured. The output of the event timer has a buffer of
- * periods that are averaged and posted to a register on the FPGA. When the
- * timer detects that the event source has stopped (based on the MaxPeriod) the
- * buffer of samples to be averaged is emptied. If you enable the update when
- * empty, you will be notified of the stopped source and the event time will
- * report 0 samples. If you disable update when empty, the most recent average
- * will remain on the output until a new sample is acquired. You will never see
- * 0 samples output (except when there have been no events since an FPGA reset)
- * and you will likely not see the stopped bit become true (since it is updated
- * at the end of an average and there are no samples to average).
- */
-void HAL_SetCounterUpdateWhenEmpty(HAL_CounterHandle counterHandle,
- HAL_Bool enabled, int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- counter->counter->writeTimerConfig_UpdateWhenEmpty(enabled, status);
-}
-
-/**
- * Determine if the clock is stopped.
- * Determine if the clocked input is stopped based on the MaxPeriod value set
- * using the SetMaxPeriod method. If the clock exceeds the MaxPeriod, then the
- * device (and counter) are assumed to be stopped and it returns true.
- * @return Returns true if the most recent counter period exceeds the MaxPeriod
- * value set by SetMaxPeriod.
- */
-HAL_Bool HAL_GetCounterStopped(HAL_CounterHandle counterHandle,
- int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- return counter->counter->readTimerOutput_Stalled(status);
-}
-
-/**
- * The last direction the counter value changed.
- * @return The last direction the counter value changed.
- */
-HAL_Bool HAL_GetCounterDirection(HAL_CounterHandle counterHandle,
- int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- bool value = counter->counter->readOutput_Direction(status);
- return value;
-}
-
-/**
- * Set the Counter to return reversed sensing on the direction.
- * This allows counters to change the direction they are counting in the case of
- * 1X and 2X quadrature encoding only. Any other counter mode isn't supported.
- * @param reverseDirection true if the value counted should be negated.
- */
-void HAL_SetCounterReverseDirection(HAL_CounterHandle counterHandle,
- HAL_Bool reverseDirection,
- int32_t* status) {
- auto counter = counterHandles.Get(counterHandle);
- if (counter == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- if (counter->counter->readConfig_Mode(status) ==
- HAL_Counter_kExternalDirection) {
- if (reverseDirection)
- HAL_SetCounterDownSourceEdge(counterHandle, true, true, status);
- else
- HAL_SetCounterDownSourceEdge(counterHandle, false, true, status);
- }
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/DIO.cpp b/third_party/allwpilib_2017/hal/lib/athena/DIO.cpp
deleted file mode 100644
index cf01397..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/DIO.cpp
+++ /dev/null
@@ -1,532 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/DIO.h"
-
-#include <cmath>
-
-#include "DigitalInternal.h"
-#include "HAL/handles/HandlesInternal.h"
-#include "HAL/handles/LimitedHandleResource.h"
-#include "PortsInternal.h"
-
-using namespace hal;
-
-// Create a mutex to protect changes to the digital output values
-static priority_recursive_mutex digitalDIOMutex;
-
-static LimitedHandleResource<HAL_DigitalPWMHandle, uint8_t,
- kNumDigitalPWMOutputs, HAL_HandleEnum::DigitalPWM>
- digitalPWMHandles;
-
-extern "C" {
-
-/**
- * Create a new instance of a digital port.
- */
-HAL_DigitalHandle HAL_InitializeDIOPort(HAL_PortHandle portHandle,
- HAL_Bool input, int32_t* status) {
- initializeDigital(status);
-
- if (*status != 0) return HAL_kInvalidHandle;
-
- int16_t channel = getPortHandleChannel(portHandle);
- if (channel == InvalidHandleIndex || channel >= kNumDigitalChannels) {
- *status = PARAMETER_OUT_OF_RANGE;
- return HAL_kInvalidHandle;
- }
-
- auto handle =
- digitalChannelHandles.Allocate(channel, HAL_HandleEnum::DIO, status);
-
- if (*status != 0)
- return HAL_kInvalidHandle; // failed to allocate. Pass error back.
-
- auto port = digitalChannelHandles.Get(handle, HAL_HandleEnum::DIO);
- if (port == nullptr) { // would only occur on thread issue.
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
-
- port->channel = static_cast<uint8_t>(channel);
-
- std::lock_guard<priority_recursive_mutex> sync(digitalDIOMutex);
-
- tDIO::tOutputEnable outputEnable = digitalSystem->readOutputEnable(status);
-
- if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
- if (!getPortHandleSPIEnable(portHandle)) {
- // if this flag is not set, we actually want DIO.
- uint32_t bitToSet = 1u << remapSPIChannel(port->channel);
-
- uint16_t specialFunctions = spiSystem->readEnableDIO(status);
- // Set the field to enable SPI DIO
- spiSystem->writeEnableDIO(specialFunctions | bitToSet, status);
-
- if (input) {
- outputEnable.SPIPort =
- outputEnable.SPIPort & (~bitToSet); // clear the field for read
- } else {
- outputEnable.SPIPort =
- outputEnable.SPIPort | bitToSet; // set the bits for write
- }
- }
- } else if (port->channel < kNumDigitalHeaders) {
- uint32_t bitToSet = 1u << port->channel;
- if (input) {
- outputEnable.Headers =
- outputEnable.Headers & (~bitToSet); // clear the bit for read
- } else {
- outputEnable.Headers =
- outputEnable.Headers | bitToSet; // set the bit for write
- }
- } else {
- uint32_t bitToSet = 1u << remapMXPChannel(port->channel);
-
- uint16_t specialFunctions =
- digitalSystem->readEnableMXPSpecialFunction(status);
- digitalSystem->writeEnableMXPSpecialFunction(specialFunctions & ~bitToSet,
- status);
-
- if (input) {
- outputEnable.MXP =
- outputEnable.MXP & (~bitToSet); // clear the bit for read
- } else {
- outputEnable.MXP = outputEnable.MXP | bitToSet; // set the bit for write
- }
- }
-
- digitalSystem->writeOutputEnable(outputEnable, status);
-
- return handle;
-}
-
-HAL_Bool HAL_CheckDIOChannel(int32_t channel) {
- return channel < kNumDigitalChannels && channel >= 0;
-}
-
-void HAL_FreeDIOPort(HAL_DigitalHandle dioPortHandle) {
- auto port = digitalChannelHandles.Get(dioPortHandle, HAL_HandleEnum::DIO);
- // no status, so no need to check for a proper free.
- digitalChannelHandles.Free(dioPortHandle, HAL_HandleEnum::DIO);
- if (port == nullptr) return;
- int32_t status = 0;
- std::lock_guard<priority_recursive_mutex> sync(digitalDIOMutex);
- if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
- // Unset the SPI flag
- int32_t bitToUnset = 1 << remapSPIChannel(port->channel);
- uint16_t specialFunctions = spiSystem->readEnableDIO(&status);
- spiSystem->writeEnableDIO(specialFunctions & ~bitToUnset, &status);
- } else if (port->channel >= kNumDigitalHeaders) {
- // Unset the MXP flag
- uint32_t bitToUnset = 1u << remapMXPChannel(port->channel);
-
- uint16_t specialFunctions =
- digitalSystem->readEnableMXPSpecialFunction(&status);
- digitalSystem->writeEnableMXPSpecialFunction(specialFunctions | bitToUnset,
- &status);
- }
-}
-
-/**
- * Allocate a DO PWM Generator.
- * Allocate PWM generators so that they are not accidentally reused.
- *
- * @return PWM Generator handle
- */
-HAL_DigitalPWMHandle HAL_AllocateDigitalPWM(int32_t* status) {
- auto handle = digitalPWMHandles.Allocate();
- if (handle == HAL_kInvalidHandle) {
- *status = NO_AVAILABLE_RESOURCES;
- return HAL_kInvalidHandle;
- }
-
- auto id = digitalPWMHandles.Get(handle);
- if (id == nullptr) { // would only occur on thread issue.
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
- *id = static_cast<uint8_t>(getHandleIndex(handle));
-
- return handle;
-}
-
-/**
- * Free the resource associated with a DO PWM generator.
- *
- * @param pwmGenerator The pwmGen to free that was allocated with
- * allocateDigitalPWM()
- */
-void HAL_FreeDigitalPWM(HAL_DigitalPWMHandle pwmGenerator, int32_t* status) {
- digitalPWMHandles.Free(pwmGenerator);
-}
-
-/**
- * Change the frequency of the DO PWM generator.
- *
- * The valid range is from 0.6 Hz to 19 kHz. The frequency resolution is
- * logarithmic.
- *
- * @param rate The frequency to output all digital output PWM signals.
- */
-void HAL_SetDigitalPWMRate(double rate, int32_t* status) {
- // Currently rounding in the log rate domain... heavy weight toward picking a
- // higher freq.
- // TODO: Round in the linear rate domain.
- initializeDigital(status);
- if (*status != 0) return;
- uint8_t pwmPeriodPower = static_cast<uint8_t>(
- std::log(1.0 / (pwmSystem->readLoopTiming(status) * 0.25E-6 * rate)) /
- std::log(2.0) +
- 0.5);
- digitalSystem->writePWMPeriodPower(pwmPeriodPower, status);
-}
-
-/**
- * Configure the duty-cycle of the PWM generator
- *
- * @param pwmGenerator The generator index reserved by allocateDigitalPWM()
- * @param dutyCycle The percent duty cycle to output [0..1].
- */
-void HAL_SetDigitalPWMDutyCycle(HAL_DigitalPWMHandle pwmGenerator,
- double dutyCycle, int32_t* status) {
- auto port = digitalPWMHandles.Get(pwmGenerator);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- int32_t id = *port;
- if (dutyCycle > 1.0) dutyCycle = 1.0;
- if (dutyCycle < 0.0) dutyCycle = 0.0;
- double rawDutyCycle = 256.0 * dutyCycle;
- if (rawDutyCycle > 255.5) rawDutyCycle = 255.5;
- {
- std::lock_guard<priority_recursive_mutex> sync(digitalPwmMutex);
- uint16_t pwmPeriodPower = digitalSystem->readPWMPeriodPower(status);
- if (pwmPeriodPower < 4) {
- // The resolution of the duty cycle drops close to the highest
- // frequencies.
- rawDutyCycle = rawDutyCycle / std::pow(2.0, 4 - pwmPeriodPower);
- }
- if (id < 4)
- digitalSystem->writePWMDutyCycleA(id, static_cast<uint8_t>(rawDutyCycle),
- status);
- else
- digitalSystem->writePWMDutyCycleB(
- id - 4, static_cast<uint8_t>(rawDutyCycle), status);
- }
-}
-
-/**
- * Configure which DO channel the PWM signal is output on
- *
- * @param pwmGenerator The generator index reserved by allocateDigitalPWM()
- * @param channel The Digital Output channel to output on
- */
-void HAL_SetDigitalPWMOutputChannel(HAL_DigitalPWMHandle pwmGenerator,
- int32_t channel, int32_t* status) {
- auto port = digitalPWMHandles.Get(pwmGenerator);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- int32_t id = *port;
- if (channel >= kNumDigitalHeaders &&
- channel <
- kNumDigitalHeaders + kNumDigitalMXPChannels) { // If it is on the MXP
- /* Then to write as a digital PWM channel an offset is needed to write on
- * the correct channel
- */
- channel += kMXPDigitalPWMOffset;
- }
- digitalSystem->writePWMOutputSelect(id, channel, status);
-}
-
-/**
- * Write a digital I/O bit to the FPGA.
- * Set a single value on a digital I/O channel.
- *
- * @param channel The Digital I/O channel
- * @param value The state to set the digital channel (if it is configured as an
- * output)
- */
-void HAL_SetDIO(HAL_DigitalHandle dioPortHandle, HAL_Bool value,
- int32_t* status) {
- auto port = digitalChannelHandles.Get(dioPortHandle, HAL_HandleEnum::DIO);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- if (value != 0 && value != 1) {
- if (value != 0) value = 1;
- }
- {
- std::lock_guard<priority_recursive_mutex> sync(digitalDIOMutex);
- tDIO::tDO currentDIO = digitalSystem->readDO(status);
-
- if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
- if (value == 0) {
- currentDIO.SPIPort =
- currentDIO.SPIPort & ~(1u << remapSPIChannel(port->channel));
- } else if (value == 1) {
- currentDIO.SPIPort =
- currentDIO.SPIPort | (1u << remapSPIChannel(port->channel));
- }
- } else if (port->channel < kNumDigitalHeaders) {
- if (value == 0) {
- currentDIO.Headers = currentDIO.Headers & ~(1u << port->channel);
- } else if (value == 1) {
- currentDIO.Headers = currentDIO.Headers | (1u << port->channel);
- }
- } else {
- if (value == 0) {
- currentDIO.MXP =
- currentDIO.MXP & ~(1u << remapMXPChannel(port->channel));
- } else if (value == 1) {
- currentDIO.MXP =
- currentDIO.MXP | (1u << remapMXPChannel(port->channel));
- }
- }
- digitalSystem->writeDO(currentDIO, status);
- }
-}
-
-/**
- * Read a digital I/O bit from the FPGA.
- * Get a single value from a digital I/O channel.
- *
- * @param channel The digital I/O channel
- * @return The state of the specified channel
- */
-HAL_Bool HAL_GetDIO(HAL_DigitalHandle dioPortHandle, int32_t* status) {
- auto port = digitalChannelHandles.Get(dioPortHandle, HAL_HandleEnum::DIO);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- tDIO::tDI currentDIO = digitalSystem->readDI(status);
- // Shift 00000001 over channel-1 places.
- // AND it against the currentDIO
- // if it == 0, then return false
- // else return true
-
- if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
- return ((currentDIO.SPIPort >> remapSPIChannel(port->channel)) & 1) != 0;
- } else if (port->channel < kNumDigitalHeaders) {
- return ((currentDIO.Headers >> port->channel) & 1) != 0;
- } else {
- return ((currentDIO.MXP >> remapMXPChannel(port->channel)) & 1) != 0;
- }
-}
-
-/**
- * Read the direction of a the Digital I/O lines
- * A 1 bit means output and a 0 bit means input.
- *
- * @param channel The digital I/O channel
- * @return The direction of the specified channel
- */
-HAL_Bool HAL_GetDIODirection(HAL_DigitalHandle dioPortHandle, int32_t* status) {
- auto port = digitalChannelHandles.Get(dioPortHandle, HAL_HandleEnum::DIO);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- tDIO::tOutputEnable currentOutputEnable =
- digitalSystem->readOutputEnable(status);
- // Shift 00000001 over port->channel-1 places.
- // AND it against the currentOutputEnable
- // if it == 0, then return false
- // else return true
-
- if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
- return ((currentOutputEnable.SPIPort >> remapSPIChannel(port->channel)) &
- 1) != 0;
- } else if (port->channel < kNumDigitalHeaders) {
- return ((currentOutputEnable.Headers >> port->channel) & 1) != 0;
- } else {
- return ((currentOutputEnable.MXP >> remapMXPChannel(port->channel)) & 1) !=
- 0;
- }
-}
-
-/**
- * Generate a single pulse.
- * Write a pulse to the specified digital output channel. There can only be a
- * single pulse going at any time.
- *
- * @param channel The Digital Output channel that the pulse should be output on
- * @param pulseLength The active length of the pulse (in seconds)
- */
-void HAL_Pulse(HAL_DigitalHandle dioPortHandle, double pulseLength,
- int32_t* status) {
- auto port = digitalChannelHandles.Get(dioPortHandle, HAL_HandleEnum::DIO);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- tDIO::tPulse pulse;
-
- if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
- pulse.SPIPort = 1u << remapSPIChannel(port->channel);
- } else if (port->channel < kNumDigitalHeaders) {
- pulse.Headers = 1u << port->channel;
- } else {
- pulse.MXP = 1u << remapMXPChannel(port->channel);
- }
-
- digitalSystem->writePulseLength(
- static_cast<uint8_t>(1.0e9 * pulseLength /
- (pwmSystem->readLoopTiming(status) * 25)),
- status);
- digitalSystem->writePulse(pulse, status);
-}
-
-/**
- * Check a DIO line to see if it is currently generating a pulse.
- *
- * @return A pulse is in progress
- */
-HAL_Bool HAL_IsPulsing(HAL_DigitalHandle dioPortHandle, int32_t* status) {
- auto port = digitalChannelHandles.Get(dioPortHandle, HAL_HandleEnum::DIO);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- tDIO::tPulse pulseRegister = digitalSystem->readPulse(status);
-
- if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
- return (pulseRegister.SPIPort & (1 << remapSPIChannel(port->channel))) != 0;
- } else if (port->channel < kNumDigitalHeaders) {
- return (pulseRegister.Headers & (1 << port->channel)) != 0;
- } else {
- return (pulseRegister.MXP & (1 << remapMXPChannel(port->channel))) != 0;
- }
-}
-
-/**
- * Check if any DIO line is currently generating a pulse.
- *
- * @return A pulse on some line is in progress
- */
-HAL_Bool HAL_IsAnyPulsing(int32_t* status) {
- initializeDigital(status);
- if (*status != 0) return false;
- tDIO::tPulse pulseRegister = digitalSystem->readPulse(status);
- return pulseRegister.Headers != 0 && pulseRegister.MXP != 0 &&
- pulseRegister.SPIPort != 0;
-}
-
-/**
- * Write the filter index from the FPGA.
- * Set the filter index used to filter out short pulses.
- *
- * @param dioPortHandle Handle to the digital I/O channel
- * @param filterIndex The filter index. Must be in the range 0 - 3, where 0
- * means "none" and 1 - 3 means filter # filterIndex - 1.
- */
-void HAL_SetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t filterIndex,
- int32_t* status) {
- auto port = digitalChannelHandles.Get(dioPortHandle, HAL_HandleEnum::DIO);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- std::lock_guard<priority_recursive_mutex> sync(digitalDIOMutex);
- if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
- // Channels 10-15 are SPI channels, so subtract our MXP channels
- digitalSystem->writeFilterSelectHdr(port->channel - kNumDigitalMXPChannels,
- filterIndex, status);
- } else if (port->channel < kNumDigitalHeaders) {
- digitalSystem->writeFilterSelectHdr(port->channel, filterIndex, status);
- } else {
- digitalSystem->writeFilterSelectMXP(remapMXPChannel(port->channel),
- filterIndex, status);
- }
-}
-
-/**
- * Read the filter index from the FPGA.
- * Get the filter index used to filter out short pulses.
- *
- * @param dioPortHandle Handle to the digital I/O channel
- * @return filterIndex The filter index. Must be in the range 0 - 3,
- * where 0 means "none" and 1 - 3 means filter # filterIndex - 1.
- */
-int32_t HAL_GetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t* status) {
- auto port = digitalChannelHandles.Get(dioPortHandle, HAL_HandleEnum::DIO);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
-
- std::lock_guard<priority_recursive_mutex> sync(digitalDIOMutex);
- if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
- // Channels 10-15 are SPI channels, so subtract our MXP channels
- return digitalSystem->readFilterSelectHdr(
- port->channel - kNumDigitalMXPChannels, status);
- } else if (port->channel < kNumDigitalHeaders) {
- return digitalSystem->readFilterSelectHdr(port->channel, status);
- } else {
- return digitalSystem->readFilterSelectMXP(remapMXPChannel(port->channel),
- status);
- }
-}
-
-/**
- * Set the filter period for the specified filter index.
- *
- * Set the filter period in FPGA cycles. Even though there are 2 different
- * filter index domains (MXP vs HDR), ignore that distinction for now since it
- * compilicates the interface. That can be changed later.
- *
- * @param filterIndex The filter index, 0 - 2.
- * @param value The number of cycles that the signal must not transition to be
- * counted as a transition.
- */
-void HAL_SetFilterPeriod(int32_t filterIndex, int64_t value, int32_t* status) {
- initializeDigital(status);
- if (*status != 0) return;
- std::lock_guard<priority_recursive_mutex> sync(digitalDIOMutex);
- digitalSystem->writeFilterPeriodHdr(filterIndex, value, status);
- if (*status == 0) {
- digitalSystem->writeFilterPeriodMXP(filterIndex, value, status);
- }
-}
-
-/**
- * Get the filter period for the specified filter index.
- *
- * Get the filter period in FPGA cycles. Even though there are 2 different
- * filter index domains (MXP vs HDR), ignore that distinction for now since it
- * compilicates the interface. Set status to NiFpga_Status_SoftwareFault if the
- * filter values miss-match.
- *
- * @param filterIndex The filter index, 0 - 2.
- * @param value The number of cycles that the signal must not transition to be
- * counted as a transition.
- */
-int64_t HAL_GetFilterPeriod(int32_t filterIndex, int32_t* status) {
- initializeDigital(status);
- if (*status != 0) return 0;
- uint32_t hdrPeriod = 0;
- uint32_t mxpPeriod = 0;
- {
- std::lock_guard<priority_recursive_mutex> sync(digitalDIOMutex);
- hdrPeriod = digitalSystem->readFilterPeriodHdr(filterIndex, status);
- if (*status == 0) {
- mxpPeriod = digitalSystem->readFilterPeriodMXP(filterIndex, status);
- }
- }
- if (hdrPeriod != mxpPeriod) {
- *status = NiFpga_Status_SoftwareFault;
- return -1;
- }
- return hdrPeriod;
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/DigitalInternal.cpp b/third_party/allwpilib_2017/hal/lib/athena/DigitalInternal.cpp
deleted file mode 100644
index 01e6c16..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/DigitalInternal.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "DigitalInternal.h"
-
-#include <atomic>
-#include <mutex>
-#include <thread>
-
-#include "ConstantsInternal.h"
-#include "FRC_NetworkCommunication/LoadOut.h"
-#include "HAL/AnalogTrigger.h"
-#include "HAL/ChipObject.h"
-#include "HAL/HAL.h"
-#include "HAL/Ports.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "PortsInternal.h"
-
-namespace hal {
-// Create a mutex to protect changes to the DO PWM config
-priority_recursive_mutex digitalPwmMutex;
-
-std::unique_ptr<tDIO> digitalSystem;
-std::unique_ptr<tRelay> relaySystem;
-std::unique_ptr<tPWM> pwmSystem;
-std::unique_ptr<tSPI> spiSystem;
-
-static std::atomic<bool> digitalSystemsInitialized{false};
-static priority_mutex initializeMutex;
-
-DigitalHandleResource<HAL_DigitalHandle, DigitalPort,
- kNumDigitalChannels + kNumPWMHeaders>
- digitalChannelHandles;
-
-/**
- * Initialize the digital system.
- */
-void initializeDigital(int32_t* status) {
- // Initial check, as if it's true initialization has finished
- if (digitalSystemsInitialized) return;
-
- std::lock_guard<priority_mutex> lock(initializeMutex);
- // Second check in case another thread was waiting
- if (digitalSystemsInitialized) return;
-
- digitalSystem.reset(tDIO::create(status));
-
- // Relay Setup
- relaySystem.reset(tRelay::create(status));
-
- // Turn off all relay outputs.
- relaySystem->writeValue_Forward(0, status);
- relaySystem->writeValue_Reverse(0, status);
-
- // PWM Setup
- pwmSystem.reset(tPWM::create(status));
-
- // Make sure that the 9403 IONode has had a chance to initialize before
- // continuing.
- while (pwmSystem->readLoopTiming(status) == 0) std::this_thread::yield();
-
- if (pwmSystem->readLoopTiming(status) != kExpectedLoopTiming) {
- *status = LOOP_TIMING_ERROR; // NOTE: Doesn't display the error
- }
-
- // Calculate the length, in ms, of one DIO loop
- double loopTime = pwmSystem->readLoopTiming(status) /
- (kSystemClockTicksPerMicrosecond * 1e3);
-
- pwmSystem->writeConfig_Period(
- static_cast<uint16_t>(kDefaultPwmPeriod / loopTime + .5), status);
- uint16_t minHigh = static_cast<uint16_t>(
- (kDefaultPwmCenter - kDefaultPwmStepsDown * loopTime) / loopTime + .5);
- pwmSystem->writeConfig_MinHigh(minHigh, status);
- // Ensure that PWM output values are set to OFF
- for (uint8_t pwmIndex = 0; pwmIndex < kNumPWMChannels; pwmIndex++) {
- // Copy of SetPWM
- if (pwmIndex < tPWM::kNumHdrRegisters) {
- pwmSystem->writeHdr(pwmIndex, kPwmDisabled, status);
- } else {
- pwmSystem->writeMXP(pwmIndex - tPWM::kNumHdrRegisters, kPwmDisabled,
- status);
- }
-
- // Copy of SetPWMPeriodScale, set to 4x by default.
- if (pwmIndex < tPWM::kNumPeriodScaleHdrElements) {
- pwmSystem->writePeriodScaleHdr(pwmIndex, 3, status);
- } else {
- pwmSystem->writePeriodScaleMXP(
- pwmIndex - tPWM::kNumPeriodScaleHdrElements, 3, status);
- }
- }
-
- // SPI setup
- spiSystem.reset(tSPI::create(status));
-
- digitalSystemsInitialized = true;
-}
-
-/**
- * Map SPI channel numbers from their physical number (27 to 31) to their
- * position in the bit field.
- */
-int32_t remapSPIChannel(int32_t channel) { return channel - 26; }
-
-/**
- * Map DIO channel numbers from their physical number (10 to 26) to their
- * position in the bit field.
- */
-int32_t remapMXPChannel(int32_t channel) { return channel - 10; }
-
-int32_t remapMXPPWMChannel(int32_t channel) {
- if (channel < 14) {
- return channel - 10; // first block of 4 pwms (MXP 0-3)
- } else {
- return channel - 6; // block of PWMs after SPI
- }
-}
-
-/**
- * remap the digital source channel and set the module.
- * If it's an analog trigger, determine the module from the high order routing
- * channel else do normal digital input remapping based on channel number
- * (MXP)
- */
-bool remapDigitalSource(HAL_Handle digitalSourceHandle,
- HAL_AnalogTriggerType analogTriggerType,
- uint8_t& channel, uint8_t& module,
- bool& analogTrigger) {
- if (isHandleType(digitalSourceHandle, HAL_HandleEnum::AnalogTrigger)) {
- // If handle passed, index is not negative
- int32_t index = getHandleIndex(digitalSourceHandle);
- channel = (index << 2) + analogTriggerType;
- module = channel >> 4;
- analogTrigger = true;
- return true;
- } else if (isHandleType(digitalSourceHandle, HAL_HandleEnum::DIO)) {
- int32_t index = getHandleIndex(digitalSourceHandle);
- if (index > kNumDigitalHeaders + kNumDigitalMXPChannels) {
- // channels 10-15, so need to add headers to remap index
- channel = remapSPIChannel(index) + kNumDigitalHeaders;
- module = 0;
- } else if (index >= kNumDigitalHeaders) {
- channel = remapMXPChannel(index);
- module = 1;
- } else {
- channel = index;
- module = 0;
- }
- analogTrigger = false;
- return true;
- } else {
- return false;
- }
-}
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/lib/athena/DigitalInternal.h b/third_party/allwpilib_2017/hal/lib/athena/DigitalInternal.h
deleted file mode 100644
index 65dcc85..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/DigitalInternal.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include <memory>
-
-#include "HAL/AnalogTrigger.h"
-#include "HAL/ChipObject.h"
-#include "HAL/Ports.h"
-#include "HAL/Types.h"
-#include "HAL/handles/DigitalHandleResource.h"
-#include "HAL/handles/HandlesInternal.h"
-#include "PortsInternal.h"
-
-namespace hal {
-/**
- * MXP channels when used as digital output PWM are offset from actual value
- */
-constexpr int32_t kMXPDigitalPWMOffset = 6;
-
-constexpr int32_t kExpectedLoopTiming = 40;
-
-/**
- * kDefaultPwmPeriod is in ms
- *
- * - 20ms periods (50 Hz) are the "safest" setting in that this works for all
- * devices
- * - 20ms periods seem to be desirable for Vex Motors
- * - 20ms periods are the specified period for HS-322HD servos, but work
- * reliably down to 10.0 ms; starting at about 8.5ms, the servo sometimes hums
- * and get hot; by 5.0ms the hum is nearly continuous
- * - 10ms periods work well for Victor 884
- * - 5ms periods allows higher update rates for Luminary Micro Jaguar speed
- * controllers. Due to the shipping firmware on the Jaguar, we can't run the
- * update period less than 5.05 ms.
- *
- * kDefaultPwmPeriod is the 1x period (5.05 ms). In hardware, the period
- * scaling is implemented as an output squelch to get longer periods for old
- * devices.
- */
-constexpr double kDefaultPwmPeriod = 5.05;
-/**
- * kDefaultPwmCenter is the PWM range center in ms
- */
-constexpr double kDefaultPwmCenter = 1.5;
-/**
- * kDefaultPWMStepsDown is the number of PWM steps below the centerpoint
- */
-constexpr int32_t kDefaultPwmStepsDown = 1000;
-constexpr int32_t kPwmDisabled = 0;
-
-// Create a mutex to protect changes to the DO PWM config
-extern priority_recursive_mutex digitalPwmMutex;
-
-extern std::unique_ptr<tDIO> digitalSystem;
-extern std::unique_ptr<tRelay> relaySystem;
-extern std::unique_ptr<tPWM> pwmSystem;
-extern std::unique_ptr<tSPI> spiSystem;
-
-struct DigitalPort {
- uint8_t channel;
- bool configSet = false;
- bool eliminateDeadband = false;
- int32_t maxPwm = 0;
- int32_t deadbandMaxPwm = 0;
- int32_t centerPwm = 0;
- int32_t deadbandMinPwm = 0;
- int32_t minPwm = 0;
-};
-
-extern DigitalHandleResource<HAL_DigitalHandle, DigitalPort,
- kNumDigitalChannels + kNumPWMHeaders>
- digitalChannelHandles;
-
-void initializeDigital(int32_t* status);
-bool remapDigitalSource(HAL_Handle digitalSourceHandle,
- HAL_AnalogTriggerType analogTriggerType,
- uint8_t& channel, uint8_t& module, bool& analogTrigger);
-int32_t remapSPIChannel(int32_t channel);
-int32_t remapMXPPWMChannel(int32_t channel);
-int32_t remapMXPChannel(int32_t channel);
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/lib/athena/Encoder.cpp b/third_party/allwpilib_2017/hal/lib/athena/Encoder.cpp
deleted file mode 100644
index d7998d1..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/Encoder.cpp
+++ /dev/null
@@ -1,448 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Encoder.h"
-
-#include "EncoderInternal.h"
-#include "FPGAEncoder.h"
-#include "HAL/ChipObject.h"
-#include "HAL/Counter.h"
-#include "HAL/Errors.h"
-#include "HAL/handles/LimitedClassedHandleResource.h"
-#include "PortsInternal.h"
-
-using namespace hal;
-
-Encoder::Encoder(HAL_Handle digitalSourceHandleA,
- HAL_AnalogTriggerType analogTriggerTypeA,
- HAL_Handle digitalSourceHandleB,
- HAL_AnalogTriggerType analogTriggerTypeB,
- bool reverseDirection, HAL_EncoderEncodingType encodingType,
- int32_t* status) {
- m_encodingType = encodingType;
- switch (encodingType) {
- case HAL_Encoder_k4X: {
- m_encodingScale = 4;
- m_encoder = HAL_InitializeFPGAEncoder(
- digitalSourceHandleA, analogTriggerTypeA, digitalSourceHandleB,
- analogTriggerTypeB, reverseDirection, &m_index, status);
- if (*status != 0) {
- return;
- }
- m_counter = HAL_kInvalidHandle;
- SetMaxPeriod(.5, status);
- break;
- }
- case HAL_Encoder_k1X:
- case HAL_Encoder_k2X: {
- SetupCounter(digitalSourceHandleA, analogTriggerTypeA,
- digitalSourceHandleB, analogTriggerTypeB, reverseDirection,
- encodingType, status);
-
- m_encodingScale = encodingType == HAL_Encoder_k1X ? 1 : 2;
- break;
- }
- default:
- *status = PARAMETER_OUT_OF_RANGE;
- return;
- }
-}
-
-void Encoder::SetupCounter(HAL_Handle digitalSourceHandleA,
- HAL_AnalogTriggerType analogTriggerTypeA,
- HAL_Handle digitalSourceHandleB,
- HAL_AnalogTriggerType analogTriggerTypeB,
- bool reverseDirection,
- HAL_EncoderEncodingType encodingType,
- int32_t* status) {
- m_encodingScale = encodingType == HAL_Encoder_k1X ? 1 : 2;
- m_counter =
- HAL_InitializeCounter(HAL_Counter_kExternalDirection, &m_index, status);
- if (*status != 0) return;
- HAL_SetCounterMaxPeriod(m_counter, 0.5, status);
- if (*status != 0) return;
- HAL_SetCounterUpSource(m_counter, digitalSourceHandleA, analogTriggerTypeA,
- status);
- if (*status != 0) return;
- HAL_SetCounterDownSource(m_counter, digitalSourceHandleB, analogTriggerTypeB,
- status);
- if (*status != 0) return;
- if (encodingType == HAL_Encoder_k1X) {
- HAL_SetCounterUpSourceEdge(m_counter, true, false, status);
- HAL_SetCounterAverageSize(m_counter, 1, status);
- } else {
- HAL_SetCounterUpSourceEdge(m_counter, true, true, status);
- HAL_SetCounterAverageSize(m_counter, 2, status);
- }
- HAL_SetCounterDownSourceEdge(m_counter, reverseDirection, true, status);
-}
-
-Encoder::~Encoder() {
- if (m_counter != HAL_kInvalidHandle) {
- int32_t status = 0;
- HAL_FreeCounter(m_counter, &status);
- } else {
- int32_t status = 0;
- HAL_FreeFPGAEncoder(m_encoder, &status);
- }
-}
-
-// CounterBase interface
-int32_t Encoder::Get(int32_t* status) const {
- return static_cast<int32_t>(GetRaw(status) * DecodingScaleFactor());
-}
-
-int32_t Encoder::GetRaw(int32_t* status) const {
- if (m_counter) {
- return HAL_GetCounter(m_counter, status);
- } else {
- return HAL_GetFPGAEncoder(m_encoder, status);
- }
-}
-
-int32_t Encoder::GetEncodingScale(int32_t* status) const {
- return m_encodingScale;
-}
-
-void Encoder::Reset(int32_t* status) {
- if (m_counter) {
- HAL_ResetCounter(m_counter, status);
- } else {
- HAL_ResetFPGAEncoder(m_encoder, status);
- }
-}
-
-double Encoder::GetPeriod(int32_t* status) const {
- if (m_counter) {
- return HAL_GetCounterPeriod(m_counter, status) / DecodingScaleFactor();
- } else {
- return HAL_GetFPGAEncoderPeriod(m_encoder, status);
- }
-}
-
-void Encoder::SetMaxPeriod(double maxPeriod, int32_t* status) {
- if (m_counter) {
- HAL_SetCounterMaxPeriod(m_counter, maxPeriod, status);
- } else {
- HAL_SetFPGAEncoderMaxPeriod(m_encoder, maxPeriod, status);
- }
-}
-
-bool Encoder::GetStopped(int32_t* status) const {
- if (m_counter) {
- return HAL_GetCounterStopped(m_counter, status);
- } else {
- return HAL_GetFPGAEncoderStopped(m_encoder, status);
- }
-}
-
-bool Encoder::GetDirection(int32_t* status) const {
- if (m_counter) {
- return HAL_GetCounterDirection(m_counter, status);
- } else {
- return HAL_GetFPGAEncoderDirection(m_encoder, status);
- }
-}
-
-double Encoder::GetDistance(int32_t* status) const {
- return GetRaw(status) * DecodingScaleFactor() * m_distancePerPulse;
-}
-
-double Encoder::GetRate(int32_t* status) const {
- return m_distancePerPulse / GetPeriod(status);
-}
-
-void Encoder::SetMinRate(double minRate, int32_t* status) {
- SetMaxPeriod(m_distancePerPulse / minRate, status);
-}
-
-void Encoder::SetDistancePerPulse(double distancePerPulse, int32_t* status) {
- m_distancePerPulse = distancePerPulse;
-}
-
-void Encoder::SetReverseDirection(bool reverseDirection, int32_t* status) {
- if (m_counter) {
- HAL_SetCounterReverseDirection(m_counter, reverseDirection, status);
- } else {
- HAL_SetFPGAEncoderReverseDirection(m_encoder, reverseDirection, status);
- }
-}
-
-void Encoder::SetSamplesToAverage(int32_t samplesToAverage, int32_t* status) {
- if (samplesToAverage < 1 || samplesToAverage > 127) {
- *status = PARAMETER_OUT_OF_RANGE;
- return;
- }
- if (m_counter) {
- HAL_SetCounterSamplesToAverage(m_counter, samplesToAverage, status);
- } else {
- HAL_SetFPGAEncoderSamplesToAverage(m_encoder, samplesToAverage, status);
- }
-}
-
-int32_t Encoder::GetSamplesToAverage(int32_t* status) const {
- if (m_counter) {
- return HAL_GetCounterSamplesToAverage(m_counter, status);
- } else {
- return HAL_GetFPGAEncoderSamplesToAverage(m_encoder, status);
- }
-}
-
-void Encoder::SetIndexSource(HAL_Handle digitalSourceHandle,
- HAL_AnalogTriggerType analogTriggerType,
- HAL_EncoderIndexingType type, int32_t* status) {
- if (m_counter) {
- *status = HAL_COUNTER_NOT_SUPPORTED;
- return;
- }
- bool activeHigh =
- (type == HAL_kResetWhileHigh) || (type == HAL_kResetOnRisingEdge);
- bool edgeSensitive =
- (type == HAL_kResetOnFallingEdge) || (type == HAL_kResetOnRisingEdge);
- HAL_SetFPGAEncoderIndexSource(m_encoder, digitalSourceHandle,
- analogTriggerType, activeHigh, edgeSensitive,
- status);
-}
-
-double Encoder::DecodingScaleFactor() const {
- switch (m_encodingType) {
- case HAL_Encoder_k1X:
- return 1.0;
- case HAL_Encoder_k2X:
- return 0.5;
- case HAL_Encoder_k4X:
- return 0.25;
- default:
- return 0.0;
- }
-}
-
-static LimitedClassedHandleResource<HAL_EncoderHandle, Encoder,
- kNumEncoders + kNumCounters,
- HAL_HandleEnum::Encoder>
- encoderHandles;
-
-extern "C" {
-HAL_EncoderHandle HAL_InitializeEncoder(
- HAL_Handle digitalSourceHandleA, HAL_AnalogTriggerType analogTriggerTypeA,
- HAL_Handle digitalSourceHandleB, HAL_AnalogTriggerType analogTriggerTypeB,
- HAL_Bool reverseDirection, HAL_EncoderEncodingType encodingType,
- int32_t* status) {
- auto encoder = std::make_shared<Encoder>(
- digitalSourceHandleA, analogTriggerTypeA, digitalSourceHandleB,
- analogTriggerTypeB, reverseDirection, encodingType, status);
- if (*status != 0) return HAL_kInvalidHandle; // return in creation error
- auto handle = encoderHandles.Allocate(encoder);
- if (handle == HAL_kInvalidHandle) {
- *status = NO_AVAILABLE_RESOURCES;
- return HAL_kInvalidHandle;
- }
- return handle;
-}
-
-void HAL_FreeEncoder(HAL_EncoderHandle encoderHandle, int32_t* status) {
- encoderHandles.Free(encoderHandle);
-}
-
-int32_t HAL_GetEncoder(HAL_EncoderHandle encoderHandle, int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return encoder->Get(status);
-}
-
-int32_t HAL_GetEncoderRaw(HAL_EncoderHandle encoderHandle, int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return encoder->GetRaw(status);
-}
-
-int32_t HAL_GetEncoderEncodingScale(HAL_EncoderHandle encoderHandle,
- int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return encoder->GetEncodingScale(status);
-}
-
-void HAL_ResetEncoder(HAL_EncoderHandle encoderHandle, int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- encoder->Reset(status);
-}
-
-double HAL_GetEncoderPeriod(HAL_EncoderHandle encoderHandle, int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return encoder->GetPeriod(status);
-}
-
-void HAL_SetEncoderMaxPeriod(HAL_EncoderHandle encoderHandle, double maxPeriod,
- int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- encoder->SetMaxPeriod(maxPeriod, status);
-}
-
-HAL_Bool HAL_GetEncoderStopped(HAL_EncoderHandle encoderHandle,
- int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return encoder->GetStopped(status);
-}
-
-HAL_Bool HAL_GetEncoderDirection(HAL_EncoderHandle encoderHandle,
- int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return encoder->GetDirection(status);
-}
-
-double HAL_GetEncoderDistance(HAL_EncoderHandle encoderHandle,
- int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return encoder->GetDistance(status);
-}
-
-double HAL_GetEncoderRate(HAL_EncoderHandle encoderHandle, int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return encoder->GetRate(status);
-}
-
-void HAL_SetEncoderMinRate(HAL_EncoderHandle encoderHandle, double minRate,
- int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- encoder->SetMinRate(minRate, status);
-}
-
-void HAL_SetEncoderDistancePerPulse(HAL_EncoderHandle encoderHandle,
- double distancePerPulse, int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- encoder->SetDistancePerPulse(distancePerPulse, status);
-}
-
-void HAL_SetEncoderReverseDirection(HAL_EncoderHandle encoderHandle,
- HAL_Bool reverseDirection,
- int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- encoder->SetReverseDirection(reverseDirection, status);
-}
-
-void HAL_SetEncoderSamplesToAverage(HAL_EncoderHandle encoderHandle,
- int32_t samplesToAverage, int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- encoder->SetSamplesToAverage(samplesToAverage, status);
-}
-
-int32_t HAL_GetEncoderSamplesToAverage(HAL_EncoderHandle encoderHandle,
- int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return encoder->GetSamplesToAverage(status);
-}
-
-double HAL_GetEncoderDecodingScaleFactor(HAL_EncoderHandle encoderHandle,
- int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return encoder->DecodingScaleFactor();
-}
-
-double HAL_GetEncoderDistancePerPulse(HAL_EncoderHandle encoderHandle,
- int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return encoder->GetDistancePerPulse();
-}
-
-HAL_EncoderEncodingType HAL_GetEncoderEncodingType(
- HAL_EncoderHandle encoderHandle, int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return HAL_Encoder_k4X; // default to k4X
- }
- return encoder->GetEncodingType();
-}
-
-void HAL_SetEncoderIndexSource(HAL_EncoderHandle encoderHandle,
- HAL_Handle digitalSourceHandle,
- HAL_AnalogTriggerType analogTriggerType,
- HAL_EncoderIndexingType type, int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- encoder->SetIndexSource(digitalSourceHandle, analogTriggerType, type, status);
-}
-
-int32_t HAL_GetEncoderFPGAIndex(HAL_EncoderHandle encoderHandle,
- int32_t* status) {
- auto encoder = encoderHandles.Get(encoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return encoder->GetFPGAIndex();
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/EncoderInternal.h b/third_party/allwpilib_2017/hal/lib/athena/EncoderInternal.h
deleted file mode 100644
index 76ec840..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/EncoderInternal.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/Encoder.h"
-
-namespace hal {
-class Encoder {
- public:
- Encoder(HAL_Handle digitalSourceHandleA,
- HAL_AnalogTriggerType analogTriggerTypeA,
- HAL_Handle digitalSourceHandleB,
- HAL_AnalogTriggerType analogTriggerTypeB, bool reverseDirection,
- HAL_EncoderEncodingType encodingType, int32_t* status);
- ~Encoder();
-
- // CounterBase interface
- int32_t Get(int32_t* status) const;
- int32_t GetRaw(int32_t* status) const;
- int32_t GetEncodingScale(int32_t* status) const;
- void Reset(int32_t* status);
- double GetPeriod(int32_t* status) const;
- void SetMaxPeriod(double maxPeriod, int32_t* status);
- bool GetStopped(int32_t* status) const;
- bool GetDirection(int32_t* status) const;
-
- double GetDistance(int32_t* status) const;
- double GetRate(int32_t* status) const;
- void SetMinRate(double minRate, int32_t* status);
- void SetDistancePerPulse(double distancePerPulse, int32_t* status);
- void SetReverseDirection(bool reverseDirection, int32_t* status);
- void SetSamplesToAverage(int32_t samplesToAverage, int32_t* status);
- int32_t GetSamplesToAverage(int32_t* status) const;
-
- void SetIndexSource(HAL_Handle digitalSourceHandle,
- HAL_AnalogTriggerType analogTriggerType,
- HAL_EncoderIndexingType type, int32_t* status);
-
- int32_t GetFPGAIndex() const { return m_index; }
-
- int32_t GetEncodingScale() const { return m_encodingScale; }
-
- double DecodingScaleFactor() const;
-
- double GetDistancePerPulse() const { return m_distancePerPulse; }
-
- HAL_EncoderEncodingType GetEncodingType() const { return m_encodingType; }
-
- private:
- void SetupCounter(HAL_Handle digitalSourceHandleA,
- HAL_AnalogTriggerType analogTriggerTypeA,
- HAL_Handle digitalSourceHandleB,
- HAL_AnalogTriggerType analogTriggerTypeB,
- bool reverseDirection, HAL_EncoderEncodingType encodingType,
- int32_t* status);
-
- HAL_FPGAEncoderHandle m_encoder = HAL_kInvalidHandle;
-
- HAL_CounterHandle m_counter = HAL_kInvalidHandle;
-
- int32_t m_index = 0;
-
- double m_distancePerPulse = 1.0;
-
- HAL_EncoderEncodingType m_encodingType;
-
- int32_t m_encodingScale;
-};
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/lib/athena/FPGAEncoder.cpp b/third_party/allwpilib_2017/hal/lib/athena/FPGAEncoder.cpp
deleted file mode 100644
index 9b0e5ad..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/FPGAEncoder.cpp
+++ /dev/null
@@ -1,296 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "FPGAEncoder.h"
-
-#include <memory>
-
-#include "DigitalInternal.h"
-#include "HAL/handles/LimitedHandleResource.h"
-#include "PortsInternal.h"
-
-using namespace hal;
-
-namespace {
-struct Encoder {
- std::unique_ptr<tEncoder> encoder;
- uint8_t index;
-};
-}
-
-static const double DECODING_SCALING_FACTOR = 0.25;
-
-static LimitedHandleResource<HAL_FPGAEncoderHandle, Encoder, kNumEncoders,
- HAL_HandleEnum::FPGAEncoder>
- fpgaEncoderHandles;
-
-extern "C" {
-HAL_FPGAEncoderHandle HAL_InitializeFPGAEncoder(
- HAL_Handle digitalSourceHandleA, HAL_AnalogTriggerType analogTriggerTypeA,
- HAL_Handle digitalSourceHandleB, HAL_AnalogTriggerType analogTriggerTypeB,
- HAL_Bool reverseDirection, int32_t* index, int32_t* status) {
- bool routingAnalogTriggerA = false;
- uint8_t routingChannelA = 0;
- uint8_t routingModuleA = 0;
- bool successA = remapDigitalSource(digitalSourceHandleA, analogTriggerTypeA,
- routingChannelA, routingModuleA,
- routingAnalogTriggerA);
- bool routingAnalogTriggerB = false;
- uint8_t routingChannelB = 0;
- uint8_t routingModuleB = 0;
- bool successB = remapDigitalSource(digitalSourceHandleB, analogTriggerTypeB,
- routingChannelB, routingModuleB,
- routingAnalogTriggerB);
-
- if (!successA || !successB) {
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
-
- auto handle = fpgaEncoderHandles.Allocate();
- if (handle == HAL_kInvalidHandle) { // out of resources
- *status = NO_AVAILABLE_RESOURCES;
- return HAL_kInvalidHandle;
- }
-
- auto encoder = fpgaEncoderHandles.Get(handle);
- if (encoder == nullptr) { // will only error on thread issue
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
-
- encoder->index = static_cast<uint8_t>(getHandleIndex(handle));
- *index = encoder->index;
- // TODO: if (index == ~0ul) { CloneError(quadEncoders); return; }
- encoder->encoder.reset(tEncoder::create(encoder->index, status));
- encoder->encoder->writeConfig_ASource_Module(routingModuleA, status);
- encoder->encoder->writeConfig_ASource_Channel(routingChannelA, status);
- encoder->encoder->writeConfig_ASource_AnalogTrigger(routingAnalogTriggerA,
- status);
- encoder->encoder->writeConfig_BSource_Module(routingModuleB, status);
- encoder->encoder->writeConfig_BSource_Channel(routingChannelB, status);
- encoder->encoder->writeConfig_BSource_AnalogTrigger(routingAnalogTriggerB,
- status);
- encoder->encoder->strobeReset(status);
- encoder->encoder->writeConfig_Reverse(reverseDirection, status);
- encoder->encoder->writeTimerConfig_AverageSize(4, status);
-
- return handle;
-}
-
-void HAL_FreeFPGAEncoder(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- int32_t* status) {
- fpgaEncoderHandles.Free(fpgaEncoderHandle);
-}
-
-/**
- * Reset the Encoder distance to zero.
- * Resets the current count to zero on the encoder.
- */
-void HAL_ResetFPGAEncoder(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- int32_t* status) {
- auto encoder = fpgaEncoderHandles.Get(fpgaEncoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- encoder->encoder->strobeReset(status);
-}
-
-/**
- * Gets the fpga value from the encoder.
- * The fpga value is the actual count unscaled by the 1x, 2x, or 4x scale
- * factor.
- * @return Current fpga count from the encoder
- */
-int32_t HAL_GetFPGAEncoder(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- int32_t* status) {
- auto encoder = fpgaEncoderHandles.Get(fpgaEncoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return encoder->encoder->readOutput_Value(status);
-}
-
-/**
- * Returns the period of the most recent pulse.
- * Returns the period of the most recent Encoder pulse in seconds.
- * This method compenstates for the decoding type.
- *
- * @deprecated Use GetRate() in favor of this method. This returns unscaled
- * periods and GetRate() scales using value from SetDistancePerPulse().
- *
- * @return Period in seconds of the most recent pulse.
- */
-double HAL_GetFPGAEncoderPeriod(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- int32_t* status) {
- auto encoder = fpgaEncoderHandles.Get(fpgaEncoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0.0;
- }
- tEncoder::tTimerOutput output = encoder->encoder->readTimerOutput(status);
- double value;
- if (output.Stalled) {
- // Return infinity
- double zero = 0.0;
- value = 1.0 / zero;
- } else {
- // output.Period is a fixed point number that counts by 2 (24 bits, 25
- // integer bits)
- value = static_cast<double>(output.Period << 1) /
- static_cast<double>(output.Count);
- }
- double measuredPeriod = value * 2.5e-8;
- return measuredPeriod / DECODING_SCALING_FACTOR;
-}
-
-/**
- * Sets the maximum period for stopped detection.
- * Sets the value that represents the maximum period of the Encoder before it
- * will assume that the attached device is stopped. This timeout allows users
- * to determine if the wheels or other shaft has stopped rotating.
- * This method compensates for the decoding type.
- *
- * @deprecated Use SetMinRate() in favor of this method. This takes unscaled
- * periods and SetMinRate() scales using value from SetDistancePerPulse().
- *
- * @param maxPeriod The maximum time between rising and falling edges before the
- * FPGA will
- * report the device stopped. This is expressed in seconds.
- */
-void HAL_SetFPGAEncoderMaxPeriod(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- double maxPeriod, int32_t* status) {
- auto encoder = fpgaEncoderHandles.Get(fpgaEncoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- encoder->encoder->writeTimerConfig_StallPeriod(
- static_cast<uint32_t>(maxPeriod * 4.0e8 * DECODING_SCALING_FACTOR),
- status);
-}
-
-/**
- * Determine if the encoder is stopped.
- * Using the MaxPeriod value, a boolean is returned that is true if the encoder
- * is considered stopped and false if it is still moving. A stopped encoder is
- * one where the most recent pulse width exceeds the MaxPeriod.
- * @return True if the encoder is considered stopped.
- */
-HAL_Bool HAL_GetFPGAEncoderStopped(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- int32_t* status) {
- auto encoder = fpgaEncoderHandles.Get(fpgaEncoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- return encoder->encoder->readTimerOutput_Stalled(status) != 0;
-}
-
-/**
- * The last direction the encoder value changed.
- * @return The last direction the encoder value changed.
- */
-HAL_Bool HAL_GetFPGAEncoderDirection(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- int32_t* status) {
- auto encoder = fpgaEncoderHandles.Get(fpgaEncoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- return encoder->encoder->readOutput_Direction(status);
-}
-
-/**
- * Set the direction sensing for this encoder.
- * This sets the direction sensing on the encoder so that it could count in the
- * correct software direction regardless of the mounting.
- * @param reverseDirection true if the encoder direction should be reversed
- */
-void HAL_SetFPGAEncoderReverseDirection(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- HAL_Bool reverseDirection,
- int32_t* status) {
- auto encoder = fpgaEncoderHandles.Get(fpgaEncoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- encoder->encoder->writeConfig_Reverse(reverseDirection, status);
-}
-
-/**
- * Set the Samples to Average which specifies the number of samples of the timer
- * to average when calculating the period. Perform averaging to account for
- * mechanical imperfections or as oversampling to increase resolution.
- * @param samplesToAverage The number of samples to average from 1 to 127.
- */
-void HAL_SetFPGAEncoderSamplesToAverage(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- int32_t samplesToAverage,
- int32_t* status) {
- auto encoder = fpgaEncoderHandles.Get(fpgaEncoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- if (samplesToAverage < 1 || samplesToAverage > 127) {
- *status = PARAMETER_OUT_OF_RANGE;
- }
- encoder->encoder->writeTimerConfig_AverageSize(samplesToAverage, status);
-}
-
-/**
- * Get the Samples to Average which specifies the number of samples of the timer
- * to average when calculating the period. Perform averaging to account for
- * mechanical imperfections or as oversampling to increase resolution.
- * @return SamplesToAverage The number of samples being averaged (from 1 to 127)
- */
-int32_t HAL_GetFPGAEncoderSamplesToAverage(
- HAL_FPGAEncoderHandle fpgaEncoderHandle, int32_t* status) {
- auto encoder = fpgaEncoderHandles.Get(fpgaEncoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- return encoder->encoder->readTimerConfig_AverageSize(status);
-}
-
-/**
- * Set an index source for an encoder, which is an input that resets the
- * encoder's count.
- */
-void HAL_SetFPGAEncoderIndexSource(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- HAL_Handle digitalSourceHandle,
- HAL_AnalogTriggerType analogTriggerType,
- HAL_Bool activeHigh, HAL_Bool edgeSensitive,
- int32_t* status) {
- auto encoder = fpgaEncoderHandles.Get(fpgaEncoderHandle);
- if (encoder == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- bool routingAnalogTrigger = false;
- uint8_t routingChannel = 0;
- uint8_t routingModule = 0;
- bool success =
- remapDigitalSource(digitalSourceHandle, analogTriggerType, routingChannel,
- routingModule, routingAnalogTrigger);
- if (!success) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- encoder->encoder->writeConfig_IndexSource_Channel(routingChannel, status);
- encoder->encoder->writeConfig_IndexSource_Module(routingModule, status);
- encoder->encoder->writeConfig_IndexSource_AnalogTrigger(routingAnalogTrigger,
- status);
- encoder->encoder->writeConfig_IndexActiveHigh(activeHigh, status);
- encoder->encoder->writeConfig_IndexEdgeSensitive(edgeSensitive, status);
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/FPGAEncoder.h b/third_party/allwpilib_2017/hal/lib/athena/FPGAEncoder.h
deleted file mode 100644
index 279fa81..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/FPGAEncoder.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/AnalogTrigger.h"
-#include "HAL/Types.h"
-
-extern "C" {
-HAL_FPGAEncoderHandle HAL_InitializeFPGAEncoder(
- HAL_Handle digitalSourceHandleA, HAL_AnalogTriggerType analogTriggerTypeA,
- HAL_Handle digitalSourceHandleB, HAL_AnalogTriggerType analogTriggerTypeB,
- HAL_Bool reverseDirection, int32_t* index, int32_t* status);
-void HAL_FreeFPGAEncoder(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- int32_t* status);
-void HAL_ResetFPGAEncoder(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- int32_t* status);
-int32_t HAL_GetFPGAEncoder(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- int32_t* status); // Raw value
-double HAL_GetFPGAEncoderPeriod(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- int32_t* status);
-void HAL_SetFPGAEncoderMaxPeriod(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- double maxPeriod, int32_t* status);
-HAL_Bool HAL_GetFPGAEncoderStopped(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- int32_t* status);
-HAL_Bool HAL_GetFPGAEncoderDirection(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- int32_t* status);
-void HAL_SetFPGAEncoderReverseDirection(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- HAL_Bool reverseDirection,
- int32_t* status);
-void HAL_SetFPGAEncoderSamplesToAverage(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- int32_t samplesToAverage,
- int32_t* status);
-int32_t HAL_GetFPGAEncoderSamplesToAverage(
- HAL_FPGAEncoderHandle fpgaEncoderHandle, int32_t* status);
-void HAL_SetFPGAEncoderIndexSource(HAL_FPGAEncoderHandle fpgaEncoderHandle,
- HAL_Handle digitalSourceHandle,
- HAL_AnalogTriggerType analogTriggerType,
- HAL_Bool activeHigh, HAL_Bool edgeSensitive,
- int32_t* status);
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/FRCDriverStation.cpp b/third_party/allwpilib_2017/hal/lib/athena/FRCDriverStation.cpp
deleted file mode 100644
index 28855db..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/FRCDriverStation.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include <chrono>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <limits>
-
-#include "FRC_NetworkCommunication/FRCComm.h"
-#include "HAL/DriverStation.h"
-#include "HAL/cpp/priority_condition_variable.h"
-#include "HAL/cpp/priority_mutex.h"
-
-static_assert(sizeof(int32_t) >= sizeof(int),
- "FRC_NetworkComm status variable is larger than 32 bits");
-
-struct HAL_JoystickAxesInt {
- int16_t count;
- int16_t axes[HAL_kMaxJoystickAxes];
-};
-
-static priority_mutex msgMutex;
-static priority_condition_variable newDSDataAvailableCond;
-static priority_mutex newDSDataAvailableMutex;
-
-extern "C" {
-int32_t HAL_SetErrorData(const char* errors, int32_t errorsLength,
- int32_t waitMs) {
- return setErrorData(errors, errorsLength, waitMs);
-}
-
-int32_t HAL_SendError(HAL_Bool isError, int32_t errorCode, HAL_Bool isLVCode,
- const char* details, const char* location,
- const char* callStack, HAL_Bool printMsg) {
- // Avoid flooding console by keeping track of previous 5 error
- // messages and only printing again if they're longer than 1 second old.
- static constexpr int KEEP_MSGS = 5;
- std::lock_guard<priority_mutex> lock(msgMutex);
- static std::string prevMsg[KEEP_MSGS];
- static std::chrono::time_point<std::chrono::steady_clock>
- prevMsgTime[KEEP_MSGS];
- static bool initialized = false;
- if (!initialized) {
- for (int i = 0; i < KEEP_MSGS; i++) {
- prevMsgTime[i] =
- std::chrono::steady_clock::now() - std::chrono::seconds(2);
- }
- initialized = true;
- }
-
- auto curTime = std::chrono::steady_clock::now();
- int i;
- for (i = 0; i < KEEP_MSGS; ++i) {
- if (prevMsg[i] == details) break;
- }
- int retval = 0;
- if (i == KEEP_MSGS || (curTime - prevMsgTime[i]) >= std::chrono::seconds(1)) {
- retval = FRC_NetworkCommunication_sendError(isError, errorCode, isLVCode,
- details, location, callStack);
- if (printMsg) {
- if (location && location[0] != '\0') {
- std::fprintf(stderr, "%s at %s: ", isError ? "Error" : "Warning",
- location);
- }
- std::fprintf(stderr, "%s\n", details);
- if (callStack && callStack[0] != '\0') {
- std::fprintf(stderr, "%s\n", callStack);
- }
- }
- if (i == KEEP_MSGS) {
- // replace the oldest one
- i = 0;
- auto first = prevMsgTime[0];
- for (int j = 1; j < KEEP_MSGS; ++j) {
- if (prevMsgTime[j] < first) {
- first = prevMsgTime[j];
- i = j;
- }
- }
- prevMsg[i] = details;
- }
- prevMsgTime[i] = curTime;
- }
- return retval;
-}
-
-int32_t HAL_GetControlWord(HAL_ControlWord* controlWord) {
- std::memset(controlWord, 0, sizeof(HAL_ControlWord));
- return FRC_NetworkCommunication_getControlWord(
- reinterpret_cast<ControlWord_t*>(controlWord));
-}
-
-HAL_AllianceStationID HAL_GetAllianceStation(int32_t* status) {
- HAL_AllianceStationID allianceStation;
- *status = FRC_NetworkCommunication_getAllianceStation(
- reinterpret_cast<AllianceStationID_t*>(&allianceStation));
- return allianceStation;
-}
-
-int32_t HAL_GetJoystickAxes(int32_t joystickNum, HAL_JoystickAxes* axes) {
- HAL_JoystickAxesInt axesInt;
-
- int retVal = FRC_NetworkCommunication_getJoystickAxes(
- joystickNum, reinterpret_cast<JoystickAxes_t*>(&axesInt),
- HAL_kMaxJoystickAxes);
-
- // copy integer values to double values
- axes->count = axesInt.count;
- // current scaling is -128 to 127, can easily be patched in the future by
- // changing this function.
- for (int32_t i = 0; i < axesInt.count; i++) {
- int8_t value = axesInt.axes[i];
- if (value < 0) {
- axes->axes[i] = value / 128.0;
- } else {
- axes->axes[i] = value / 127.0;
- }
- }
-
- return retVal;
-}
-
-int32_t HAL_GetJoystickPOVs(int32_t joystickNum, HAL_JoystickPOVs* povs) {
- return FRC_NetworkCommunication_getJoystickPOVs(
- joystickNum, reinterpret_cast<JoystickPOV_t*>(povs),
- HAL_kMaxJoystickPOVs);
-}
-
-int32_t HAL_GetJoystickButtons(int32_t joystickNum,
- HAL_JoystickButtons* buttons) {
- return FRC_NetworkCommunication_getJoystickButtons(
- joystickNum, &buttons->buttons, &buttons->count);
-}
-/**
- * Retrieve the Joystick Descriptor for particular slot
- * @param desc [out] descriptor (data transfer object) to fill in. desc is
- * filled in regardless of success. In other words, if descriptor is not
- * available, desc is filled in with default values matching the init-values in
- * Java and C++ Driverstation for when caller requests a too-large joystick
- * index.
- *
- * @return error code reported from Network Comm back-end. Zero is good,
- * nonzero is bad.
- */
-int32_t HAL_GetJoystickDescriptor(int32_t joystickNum,
- HAL_JoystickDescriptor* desc) {
- desc->isXbox = 0;
- desc->type = std::numeric_limits<uint8_t>::max();
- desc->name[0] = '\0';
- desc->axisCount =
- HAL_kMaxJoystickAxes; /* set to the desc->axisTypes's capacity */
- desc->buttonCount = 0;
- desc->povCount = 0;
- int retval = FRC_NetworkCommunication_getJoystickDesc(
- joystickNum, &desc->isXbox, &desc->type,
- reinterpret_cast<char*>(&desc->name), &desc->axisCount,
- reinterpret_cast<uint8_t*>(&desc->axisTypes), &desc->buttonCount,
- &desc->povCount);
- /* check the return, if there is an error and the RIOimage predates FRC2017,
- * then axisCount needs to be cleared */
- if (retval != 0) {
- /* set count to zero so downstream code doesn't decode invalid axisTypes. */
- desc->axisCount = 0;
- }
- return retval;
-}
-
-HAL_Bool HAL_GetJoystickIsXbox(int32_t joystickNum) {
- HAL_JoystickDescriptor joystickDesc;
- if (HAL_GetJoystickDescriptor(joystickNum, &joystickDesc) < 0) {
- return 0;
- } else {
- return joystickDesc.isXbox;
- }
-}
-
-int32_t HAL_GetJoystickType(int32_t joystickNum) {
- HAL_JoystickDescriptor joystickDesc;
- if (HAL_GetJoystickDescriptor(joystickNum, &joystickDesc) < 0) {
- return -1;
- } else {
- return joystickDesc.type;
- }
-}
-
-char* HAL_GetJoystickName(int32_t joystickNum) {
- HAL_JoystickDescriptor joystickDesc;
- if (HAL_GetJoystickDescriptor(joystickNum, &joystickDesc) < 0) {
- char* name = static_cast<char*>(std::malloc(1));
- name[0] = '\0';
- return name;
- } else {
- size_t len = std::strlen(joystickDesc.name);
- char* name = static_cast<char*>(std::malloc(len + 1));
- std::strncpy(name, joystickDesc.name, len);
- name[len] = '\0';
- return name;
- }
-}
-
-int32_t HAL_GetJoystickAxisType(int32_t joystickNum, int32_t axis) {
- HAL_JoystickDescriptor joystickDesc;
- if (HAL_GetJoystickDescriptor(joystickNum, &joystickDesc) < 0) {
- return -1;
- } else {
- return joystickDesc.axisTypes[axis];
- }
-}
-
-int32_t HAL_SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
- int32_t leftRumble, int32_t rightRumble) {
- return FRC_NetworkCommunication_setJoystickOutputs(joystickNum, outputs,
- leftRumble, rightRumble);
-}
-
-double HAL_GetMatchTime(int32_t* status) {
- float matchTime;
- *status = FRC_NetworkCommunication_getMatchTime(&matchTime);
- return matchTime;
-}
-
-void HAL_ObserveUserProgramStarting(void) {
- FRC_NetworkCommunication_observeUserProgramStarting();
-}
-
-void HAL_ObserveUserProgramDisabled(void) {
- FRC_NetworkCommunication_observeUserProgramDisabled();
-}
-
-void HAL_ObserveUserProgramAutonomous(void) {
- FRC_NetworkCommunication_observeUserProgramAutonomous();
-}
-
-void HAL_ObserveUserProgramTeleop(void) {
- FRC_NetworkCommunication_observeUserProgramTeleop();
-}
-
-void HAL_ObserveUserProgramTest(void) {
- FRC_NetworkCommunication_observeUserProgramTest();
-}
-
-/**
- * Waits for the newest DS packet to arrive. Note that this is a blocking call.
- */
-void HAL_WaitForDSData(void) {
- std::unique_lock<priority_mutex> lock(newDSDataAvailableMutex);
- newDSDataAvailableCond.wait(lock);
-}
-
-void HAL_InitializeDriverStation(void) {
- // Set our DS new data condition variable.
- setNewDataSem(newDSDataAvailableCond.native_handle());
-}
-
-} // extern "C"
diff --git a/third_party/allwpilib_2017/hal/lib/athena/HAL.cpp b/third_party/allwpilib_2017/hal/lib/athena/HAL.cpp
deleted file mode 100644
index 08e1ade..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/HAL.cpp
+++ /dev/null
@@ -1,343 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/HAL.h"
-
-#include <signal.h> // linux for kill
-#include <sys/prctl.h>
-#include <unistd.h>
-
-#include <atomic>
-#include <cstdlib>
-#include <fstream>
-#include <iostream>
-#include <mutex>
-#include <thread>
-
-#include "FRC_NetworkCommunication/CANSessionMux.h"
-#include "FRC_NetworkCommunication/FRCComm.h"
-#include "FRC_NetworkCommunication/LoadOut.h"
-#include "HAL/ChipObject.h"
-#include "HAL/DriverStation.h"
-#include "HAL/Errors.h"
-#include "HAL/Notifier.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "HAL/handles/HandlesInternal.h"
-#include "ctre/ctre.h"
-
-using namespace hal;
-
-static std::unique_ptr<tGlobal> global;
-static std::unique_ptr<tSysWatchdog> watchdog;
-
-static priority_mutex timeMutex;
-static HAL_NotifierHandle rolloverNotifier = 0;
-
-using namespace hal;
-
-extern "C" {
-
-HAL_PortHandle HAL_GetPort(int32_t channel) {
- // Dont allow a number that wouldn't fit in a uint8_t
- if (channel < 0 || channel >= 255) return HAL_kInvalidHandle;
- return createPortHandle(channel, 1);
-}
-
-/**
- * @deprecated Uses module numbers
- */
-HAL_PortHandle HAL_GetPortWithModule(int32_t module, int32_t channel) {
- // Dont allow a number that wouldn't fit in a uint8_t
- if (channel < 0 || channel >= 255) return HAL_kInvalidHandle;
- if (module < 0 || module >= 255) return HAL_kInvalidHandle;
- return createPortHandle(channel, module);
-}
-
-const char* HAL_GetErrorMessage(int32_t code) {
- switch (code) {
- case 0:
- return "";
- case CTR_RxTimeout:
- return CTR_RxTimeout_MESSAGE;
- case CTR_TxTimeout:
- return CTR_TxTimeout_MESSAGE;
- case CTR_InvalidParamValue:
- return CTR_InvalidParamValue_MESSAGE;
- case CTR_UnexpectedArbId:
- return CTR_UnexpectedArbId_MESSAGE;
- case CTR_TxFailed:
- return CTR_TxFailed_MESSAGE;
- case CTR_SigNotUpdated:
- return CTR_SigNotUpdated_MESSAGE;
- case NiFpga_Status_FifoTimeout:
- return NiFpga_Status_FifoTimeout_MESSAGE;
- case NiFpga_Status_TransferAborted:
- return NiFpga_Status_TransferAborted_MESSAGE;
- case NiFpga_Status_MemoryFull:
- return NiFpga_Status_MemoryFull_MESSAGE;
- case NiFpga_Status_SoftwareFault:
- return NiFpga_Status_SoftwareFault_MESSAGE;
- case NiFpga_Status_InvalidParameter:
- return NiFpga_Status_InvalidParameter_MESSAGE;
- case NiFpga_Status_ResourceNotFound:
- return NiFpga_Status_ResourceNotFound_MESSAGE;
- case NiFpga_Status_ResourceNotInitialized:
- return NiFpga_Status_ResourceNotInitialized_MESSAGE;
- case NiFpga_Status_HardwareFault:
- return NiFpga_Status_HardwareFault_MESSAGE;
- case NiFpga_Status_IrqTimeout:
- return NiFpga_Status_IrqTimeout_MESSAGE;
- case SAMPLE_RATE_TOO_HIGH:
- return SAMPLE_RATE_TOO_HIGH_MESSAGE;
- case VOLTAGE_OUT_OF_RANGE:
- return VOLTAGE_OUT_OF_RANGE_MESSAGE;
- case LOOP_TIMING_ERROR:
- return LOOP_TIMING_ERROR_MESSAGE;
- case SPI_WRITE_NO_MOSI:
- return SPI_WRITE_NO_MOSI_MESSAGE;
- case SPI_READ_NO_MISO:
- return SPI_READ_NO_MISO_MESSAGE;
- case SPI_READ_NO_DATA:
- return SPI_READ_NO_DATA_MESSAGE;
- case INCOMPATIBLE_STATE:
- return INCOMPATIBLE_STATE_MESSAGE;
- case NO_AVAILABLE_RESOURCES:
- return NO_AVAILABLE_RESOURCES_MESSAGE;
- case RESOURCE_IS_ALLOCATED:
- return RESOURCE_IS_ALLOCATED_MESSAGE;
- case RESOURCE_OUT_OF_RANGE:
- return RESOURCE_OUT_OF_RANGE_MESSAGE;
- case HAL_INVALID_ACCUMULATOR_CHANNEL:
- return HAL_INVALID_ACCUMULATOR_CHANNEL_MESSAGE;
- case HAL_HANDLE_ERROR:
- return HAL_HANDLE_ERROR_MESSAGE;
- case NULL_PARAMETER:
- return NULL_PARAMETER_MESSAGE;
- case ANALOG_TRIGGER_LIMIT_ORDER_ERROR:
- return ANALOG_TRIGGER_LIMIT_ORDER_ERROR_MESSAGE;
- case ANALOG_TRIGGER_PULSE_OUTPUT_ERROR:
- return ANALOG_TRIGGER_PULSE_OUTPUT_ERROR_MESSAGE;
- case PARAMETER_OUT_OF_RANGE:
- return PARAMETER_OUT_OF_RANGE_MESSAGE;
- case HAL_COUNTER_NOT_SUPPORTED:
- return HAL_COUNTER_NOT_SUPPORTED_MESSAGE;
- case ERR_CANSessionMux_InvalidBuffer:
- return ERR_CANSessionMux_InvalidBuffer_MESSAGE;
- case ERR_CANSessionMux_MessageNotFound:
- return ERR_CANSessionMux_MessageNotFound_MESSAGE;
- case WARN_CANSessionMux_NoToken:
- return WARN_CANSessionMux_NoToken_MESSAGE;
- case ERR_CANSessionMux_NotAllowed:
- return ERR_CANSessionMux_NotAllowed_MESSAGE;
- case ERR_CANSessionMux_NotInitialized:
- return ERR_CANSessionMux_NotInitialized_MESSAGE;
- case HAL_PWM_SCALE_ERROR:
- return HAL_PWM_SCALE_ERROR_MESSAGE;
- case HAL_SERIAL_PORT_NOT_FOUND:
- return HAL_SERIAL_PORT_NOT_FOUND_MESSAGE;
- case HAL_THREAD_PRIORITY_ERROR:
- return HAL_THREAD_PRIORITY_ERROR_MESSAGE;
- case HAL_THREAD_PRIORITY_RANGE_ERROR:
- return HAL_THREAD_PRIORITY_RANGE_ERROR_MESSAGE;
- case HAL_SERIAL_PORT_OPEN_ERROR:
- return HAL_SERIAL_PORT_OPEN_ERROR_MESSAGE;
- case HAL_SERIAL_PORT_ERROR:
- return HAL_SERIAL_PORT_ERROR_MESSAGE;
- default:
- return "Unknown error status";
- }
-}
-
-/**
- * Returns the runtime type of this HAL
- */
-HAL_RuntimeType HAL_GetRuntimeType() { return HAL_Athena; }
-
-/**
- * Return the FPGA Version number.
- * For now, expect this to be competition year.
- * @return FPGA Version number.
- */
-int32_t HAL_GetFPGAVersion(int32_t* status) {
- if (!global) {
- *status = NiFpga_Status_ResourceNotInitialized;
- return 0;
- }
- return global->readVersion(status);
-}
-
-/**
- * Return the FPGA Revision number.
- * The format of the revision is 3 numbers.
- * The 12 most significant bits are the Major Revision.
- * the next 8 bits are the Minor Revision.
- * The 12 least significant bits are the Build Number.
- * @return FPGA Revision number.
- */
-int64_t HAL_GetFPGARevision(int32_t* status) {
- if (!global) {
- *status = NiFpga_Status_ResourceNotInitialized;
- return 0;
- }
- return global->readRevision(status);
-}
-
-/**
- * Read the microsecond-resolution timer on the FPGA.
- *
- * @return The current time in microseconds according to the FPGA (since FPGA
- * reset).
- */
-uint64_t HAL_GetFPGATime(int32_t* status) {
- if (!global) {
- *status = NiFpga_Status_ResourceNotInitialized;
- return 0;
- }
- return global->readLocalTime(status);
-}
-
-/**
- * Get the state of the "USER" button on the roboRIO
- * @return true if the button is currently pressed down
- */
-HAL_Bool HAL_GetFPGAButton(int32_t* status) {
- if (!global) {
- *status = NiFpga_Status_ResourceNotInitialized;
- return false;
- }
- return global->readUserButton(status);
-}
-
-HAL_Bool HAL_GetSystemActive(int32_t* status) {
- if (!watchdog) {
- *status = NiFpga_Status_ResourceNotInitialized;
- return false;
- }
- return watchdog->readStatus_SystemActive(status);
-}
-
-HAL_Bool HAL_GetBrownedOut(int32_t* status) {
- if (!watchdog) {
- *status = NiFpga_Status_ResourceNotInitialized;
- return false;
- }
- return !(watchdog->readStatus_PowerAlive(status));
-}
-
-static void timerRollover(uint64_t currentTime, HAL_NotifierHandle handle) {
- // reschedule timer for next rollover
- int32_t status = 0;
- HAL_UpdateNotifierAlarm(handle, currentTime + 0x80000000ULL, &status);
-}
-
-void HAL_BaseInitialize(int32_t* status) {
- static std::atomic_bool initialized{false};
- static priority_mutex initializeMutex;
- // Initial check, as if it's true initialization has finished
- if (initialized) return;
-
- std::lock_guard<priority_mutex> lock(initializeMutex);
- // Second check in case another thread was waiting
- if (initialized) return;
- // image 4; Fixes errors caused by multiple processes. Talk to NI about this
- nFPGA::nRoboRIO_FPGANamespace::g_currentTargetClass =
- nLoadOut::kTargetClass_RoboRIO;
-
- global.reset(tGlobal::create(status));
- watchdog.reset(tSysWatchdog::create(status));
- initialized = true;
-}
-
-/**
- * Call this to start up HAL. This is required for robot programs.
- */
-int32_t HAL_Initialize(int32_t mode) {
- setlinebuf(stdin);
- setlinebuf(stdout);
-
- prctl(PR_SET_PDEATHSIG, SIGTERM);
-
- FRC_NetworkCommunication_Reserve(nullptr);
-
- std::atexit([]() {
- // Unregister our new data condition variable.
- setNewDataSem(nullptr);
- });
-
- int32_t status = 0;
- HAL_BaseInitialize(&status);
-
- if (!rolloverNotifier)
- rolloverNotifier = HAL_InitializeNotifier(timerRollover, nullptr, &status);
- if (status == 0) {
- uint64_t curTime = HAL_GetFPGATime(&status);
- if (status == 0)
- HAL_UpdateNotifierAlarm(rolloverNotifier, curTime + 0x80000000ULL,
- &status);
- }
-
- // Kill any previous robot programs
- std::fstream fs;
- // By making this both in/out, it won't give us an error if it doesnt exist
- fs.open("/var/lock/frc.pid", std::fstream::in | std::fstream::out);
- if (fs.bad()) return 0;
-
- pid_t pid = 0;
- if (!fs.eof() && !fs.fail()) {
- fs >> pid;
- // see if the pid is around, but we don't want to mess with init id=1, or
- // ourselves
- if (pid >= 2 && kill(pid, 0) == 0 && pid != getpid()) {
- std::cout << "Killing previously running FRC program..." << std::endl;
- kill(pid, SIGTERM); // try to kill it
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- if (kill(pid, 0) == 0) {
- // still not successfull
- if (mode == 0) {
- std::cout << "FRC pid " << pid
- << " did not die within 110ms. Aborting" << std::endl;
- return 0; // just fail
- } else if (mode == 1) { // kill -9 it
- kill(pid, SIGKILL);
- } else {
- std::cout << "WARNING: FRC pid " << pid
- << " did not die within 110ms." << std::endl;
- }
- }
- }
- }
- fs.close();
- // we will re-open it write only to truncate the file
- fs.open("/var/lock/frc.pid", std::fstream::out | std::fstream::trunc);
- fs.seekp(0);
- pid = getpid();
- fs << pid << std::endl;
- fs.close();
-
- HAL_InitializeDriverStation();
-
- return 1;
-}
-
-int64_t HAL_Report(int32_t resource, int32_t instanceNumber, int32_t context,
- const char* feature) {
- if (feature == nullptr) {
- feature = "";
- }
-
- return FRC_NetworkCommunication_nUsageReporting_report(
- resource, instanceNumber, context, feature);
-}
-
-// TODO: HACKS
-// No need for header definitions, as we should not run from user code.
-void NumericArrayResize() {}
-void RTSetCleanupProc() {}
-void EDVR_CreateReference() {}
-void Occur() {}
-
-} // extern "C"
diff --git a/third_party/allwpilib_2017/hal/lib/athena/I2C.cpp b/third_party/allwpilib_2017/hal/lib/athena/I2C.cpp
deleted file mode 100644
index 7d22cd4..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/I2C.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/I2C.h"
-
-#include "DigitalInternal.h"
-#include "HAL/DIO.h"
-#include "HAL/HAL.h"
-#include "i2clib/i2c-lib.h"
-
-using namespace hal;
-
-static priority_recursive_mutex digitalI2COnBoardMutex;
-static priority_recursive_mutex digitalI2CMXPMutex;
-
-static uint8_t i2COnboardObjCount = 0;
-static uint8_t i2CMXPObjCount = 0;
-static uint8_t i2COnBoardHandle = 0;
-static uint8_t i2CMXPHandle = 0;
-
-static HAL_DigitalHandle i2CMXPDigitalHandle1 = HAL_kInvalidHandle;
-static HAL_DigitalHandle i2CMXPDigitalHandle2 = HAL_kInvalidHandle;
-
-extern "C" {
-/*
- * Initialize the I2C port. Opens the port if necessary and saves the handle.
- * If opening the MXP port, also sets up the channel functions appropriately
- * @param port The port to open, 0 for the on-board, 1 for the MXP.
- */
-void HAL_InitializeI2C(int32_t port, int32_t* status) {
- initializeDigital(status);
- if (*status != 0) return;
-
- if (port > 1) {
- // Set port out of range error here
- return;
- }
-
- priority_recursive_mutex& lock =
- port == 0 ? digitalI2COnBoardMutex : digitalI2CMXPMutex;
- {
- std::lock_guard<priority_recursive_mutex> sync(lock);
- if (port == 0) {
- i2COnboardObjCount++;
- if (i2COnBoardHandle > 0) return;
- i2COnBoardHandle = i2clib_open("/dev/i2c-2");
- } else if (port == 1) {
- i2CMXPObjCount++;
- if (i2CMXPHandle > 0) return;
- if ((i2CMXPDigitalHandle1 = HAL_InitializeDIOPort(
- HAL_GetPort(24), false, status)) == HAL_kInvalidHandle) {
- return;
- }
- if ((i2CMXPDigitalHandle2 = HAL_InitializeDIOPort(
- HAL_GetPort(25), false, status)) == HAL_kInvalidHandle) {
- HAL_FreeDIOPort(i2CMXPDigitalHandle1); // free the first port allocated
- return;
- }
- digitalSystem->writeEnableMXPSpecialFunction(
- digitalSystem->readEnableMXPSpecialFunction(status) | 0xC000, status);
- i2CMXPHandle = i2clib_open("/dev/i2c-1");
- }
- return;
- }
-}
-
-/**
- * Generic transaction.
- *
- * This is a lower-level interface to the I2C hardware giving you more control
- * over each transaction.
- *
- * @param dataToSend Buffer of data to send as part of the transaction.
- * @param sendSize Number of bytes to send as part of the transaction.
- * @param dataReceived Buffer to read data into.
- * @param receiveSize Number of bytes to read from the device.
- * @return >= 0 on success or -1 on transfer abort.
- */
-int32_t HAL_TransactionI2C(int32_t port, int32_t deviceAddress,
- uint8_t* dataToSend, int32_t sendSize,
- uint8_t* dataReceived, int32_t receiveSize) {
- if (port > 1) {
- // Set port out of range error here
- return -1;
- }
-
- int32_t handle = port == 0 ? i2COnBoardHandle : i2CMXPHandle;
- priority_recursive_mutex& lock =
- port == 0 ? digitalI2COnBoardMutex : digitalI2CMXPMutex;
-
- {
- std::lock_guard<priority_recursive_mutex> sync(lock);
- return i2clib_writeread(
- handle, deviceAddress, reinterpret_cast<const char*>(dataToSend),
- static_cast<int32_t>(sendSize), reinterpret_cast<char*>(dataReceived),
- static_cast<int32_t>(receiveSize));
- }
-}
-
-/**
- * Execute a write transaction with the device.
- *
- * Write a single byte to a register on a device and wait until the
- * transaction is complete.
- *
- * @param registerAddress The address of the register on the device to be
- * written.
- * @param data The byte to write to the register on the device.
- * @return >= 0 on success or -1 on transfer abort.
- */
-int32_t HAL_WriteI2C(int32_t port, int32_t deviceAddress, uint8_t* dataToSend,
- int32_t sendSize) {
- if (port > 1) {
- // Set port out of range error here
- return -1;
- }
-
- int32_t handle = port == 0 ? i2COnBoardHandle : i2CMXPHandle;
- priority_recursive_mutex& lock =
- port == 0 ? digitalI2COnBoardMutex : digitalI2CMXPMutex;
- {
- std::lock_guard<priority_recursive_mutex> sync(lock);
- return i2clib_write(handle, deviceAddress,
- reinterpret_cast<const char*>(dataToSend), sendSize);
- }
-}
-
-/**
- * Execute a read transaction with the device.
- *
- * Read bytes from a device.
- * Most I2C devices will auto-increment the register pointer internally allowing
- * you to read consecutive registers on a device in a single transaction.
- *
- * @param registerAddress The register to read first in the transaction.
- * @param count The number of bytes to read in the transaction.
- * @param buffer A pointer to the array of bytes to store the data read from the
- * device.
- * @return >= 0 on success or -1 on transfer abort.
- */
-int32_t HAL_ReadI2C(int32_t port, int32_t deviceAddress, uint8_t* buffer,
- int32_t count) {
- if (port > 1) {
- // Set port out of range error here
- return -1;
- }
-
- int32_t handle = port == 0 ? i2COnBoardHandle : i2CMXPHandle;
- priority_recursive_mutex& lock =
- port == 0 ? digitalI2COnBoardMutex : digitalI2CMXPMutex;
- {
- std::lock_guard<priority_recursive_mutex> sync(lock);
- return i2clib_read(handle, deviceAddress, reinterpret_cast<char*>(buffer),
- static_cast<int32_t>(count));
- }
-}
-
-void HAL_CloseI2C(int32_t port) {
- if (port > 1) {
- // Set port out of range error here
- return;
- }
- priority_recursive_mutex& lock =
- port == 0 ? digitalI2COnBoardMutex : digitalI2CMXPMutex;
- {
- std::lock_guard<priority_recursive_mutex> sync(lock);
- if ((port == 0 ? i2COnboardObjCount-- : i2CMXPObjCount--) == 0) {
- int32_t handle = port == 0 ? i2COnBoardHandle : i2CMXPHandle;
- i2clib_close(handle);
- }
- }
-
- if (port == 1) {
- HAL_FreeDIOPort(i2CMXPDigitalHandle1);
- HAL_FreeDIOPort(i2CMXPDigitalHandle2);
- }
- return;
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/Interrupts.cpp b/third_party/allwpilib_2017/hal/lib/athena/Interrupts.cpp
deleted file mode 100644
index 571253e..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/Interrupts.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Interrupts.h"
-
-#include <memory>
-
-#include "DigitalInternal.h"
-#include "HAL/ChipObject.h"
-#include "HAL/Errors.h"
-#include "HAL/cpp/make_unique.h"
-#include "HAL/handles/HandlesInternal.h"
-#include "HAL/handles/LimitedHandleResource.h"
-#include "PortsInternal.h"
-#include "support/SafeThread.h"
-
-using namespace hal;
-
-namespace {
-struct Interrupt {
- std::unique_ptr<tInterrupt> anInterrupt;
- std::unique_ptr<tInterruptManager> manager;
-};
-
-// Safe thread to allow callbacks to run on their own thread
-class InterruptThread : public wpi::SafeThread {
- public:
- void Main() {
- std::unique_lock<std::mutex> lock(m_mutex);
- while (m_active) {
- m_cond.wait(lock, [&] { return !m_active || m_notify; });
- if (!m_active) break;
- m_notify = false;
- HAL_InterruptHandlerFunction handler = m_handler;
- uint32_t mask = m_mask;
- void* param = m_param;
- lock.unlock(); // don't hold mutex during callback execution
- handler(mask, param);
- lock.lock();
- }
- }
-
- bool m_notify = false;
- HAL_InterruptHandlerFunction m_handler;
- void* m_param;
- uint32_t m_mask;
-};
-
-class InterruptThreadOwner : public wpi::SafeThreadOwner<InterruptThread> {
- public:
- void SetFunc(HAL_InterruptHandlerFunction handler, void* param) {
- auto thr = GetThread();
- if (!thr) return;
- thr->m_handler = handler;
- thr->m_param = param;
- }
-
- void Notify(uint32_t mask) {
- auto thr = GetThread();
- if (!thr) return;
- thr->m_mask = mask;
- thr->m_notify = true;
- thr->m_cond.notify_one();
- }
-};
-
-} // namespace
-
-static void threadedInterruptHandler(uint32_t mask, void* param) {
- static_cast<InterruptThreadOwner*>(param)->Notify(mask);
-}
-
-static LimitedHandleResource<HAL_InterruptHandle, Interrupt, kNumInterrupts,
- HAL_HandleEnum::Interrupt>
- interruptHandles;
-
-extern "C" {
-
-HAL_InterruptHandle HAL_InitializeInterrupts(HAL_Bool watcher,
- int32_t* status) {
- HAL_InterruptHandle handle = interruptHandles.Allocate();
- if (handle == HAL_kInvalidHandle) {
- *status = NO_AVAILABLE_RESOURCES;
- return HAL_kInvalidHandle;
- }
- auto anInterrupt = interruptHandles.Get(handle);
- uint32_t interruptIndex = static_cast<uint32_t>(getHandleIndex(handle));
- // Expects the calling leaf class to allocate an interrupt index.
- anInterrupt->anInterrupt.reset(tInterrupt::create(interruptIndex, status));
- anInterrupt->anInterrupt->writeConfig_WaitForAck(false, status);
- anInterrupt->manager = std::make_unique<tInterruptManager>(
- (1u << interruptIndex) | (1u << (interruptIndex + 8u)), watcher, status);
- return handle;
-}
-
-void HAL_CleanInterrupts(HAL_InterruptHandle interruptHandle, int32_t* status) {
- interruptHandles.Free(interruptHandle);
-}
-
-/**
- * In synchronous mode, wait for the defined interrupt to occur.
- * @param timeout Timeout in seconds
- * @param ignorePrevious If true, ignore interrupts that happened before
- * waitForInterrupt was called.
- * @return The mask of interrupts that fired.
- */
-int64_t HAL_WaitForInterrupt(HAL_InterruptHandle interruptHandle,
- double timeout, HAL_Bool ignorePrevious,
- int32_t* status) {
- uint32_t result;
- auto anInterrupt = interruptHandles.Get(interruptHandle);
- if (anInterrupt == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
-
- result = anInterrupt->manager->watch(static_cast<int32_t>(timeout * 1e3),
- ignorePrevious, status);
-
- // Don't report a timeout as an error - the return code is enough to tell
- // that a timeout happened.
- if (*status == -NiFpga_Status_IrqTimeout) {
- *status = NiFpga_Status_Success;
- }
-
- return result;
-}
-
-/**
- * Enable interrupts to occur on this input.
- * Interrupts are disabled when the RequestInterrupt call is made. This gives
- * time to do the setup of the other options before starting to field
- * interrupts.
- */
-void HAL_EnableInterrupts(HAL_InterruptHandle interruptHandle,
- int32_t* status) {
- auto anInterrupt = interruptHandles.Get(interruptHandle);
- if (anInterrupt == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- anInterrupt->manager->enable(status);
-}
-
-/**
- * Disable Interrupts without without deallocating structures.
- */
-void HAL_DisableInterrupts(HAL_InterruptHandle interruptHandle,
- int32_t* status) {
- auto anInterrupt = interruptHandles.Get(interruptHandle);
- if (anInterrupt == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- anInterrupt->manager->disable(status);
-}
-
-/**
- * Return the timestamp for the rising interrupt that occurred most recently.
- * This is in the same time domain as GetClock().
- * @return Timestamp in seconds since boot.
- */
-double HAL_ReadInterruptRisingTimestamp(HAL_InterruptHandle interruptHandle,
- int32_t* status) {
- auto anInterrupt = interruptHandles.Get(interruptHandle);
- if (anInterrupt == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- uint32_t timestamp = anInterrupt->anInterrupt->readRisingTimeStamp(status);
- return timestamp * 1e-6;
-}
-
-/**
-* Return the timestamp for the falling interrupt that occurred most recently.
-* This is in the same time domain as GetClock().
-* @return Timestamp in seconds since boot.
-*/
-double HAL_ReadInterruptFallingTimestamp(HAL_InterruptHandle interruptHandle,
- int32_t* status) {
- auto anInterrupt = interruptHandles.Get(interruptHandle);
- if (anInterrupt == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- uint32_t timestamp = anInterrupt->anInterrupt->readFallingTimeStamp(status);
- return timestamp * 1e-6;
-}
-
-void HAL_RequestInterrupts(HAL_InterruptHandle interruptHandle,
- HAL_Handle digitalSourceHandle,
- HAL_AnalogTriggerType analogTriggerType,
- int32_t* status) {
- auto anInterrupt = interruptHandles.Get(interruptHandle);
- if (anInterrupt == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- anInterrupt->anInterrupt->writeConfig_WaitForAck(false, status);
- bool routingAnalogTrigger = false;
- uint8_t routingChannel = 0;
- uint8_t routingModule = 0;
- bool success =
- remapDigitalSource(digitalSourceHandle, analogTriggerType, routingChannel,
- routingModule, routingAnalogTrigger);
- if (!success) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- anInterrupt->anInterrupt->writeConfig_Source_AnalogTrigger(
- routingAnalogTrigger, status);
- anInterrupt->anInterrupt->writeConfig_Source_Channel(routingChannel, status);
- anInterrupt->anInterrupt->writeConfig_Source_Module(routingModule, status);
-}
-
-void HAL_AttachInterruptHandler(HAL_InterruptHandle interruptHandle,
- HAL_InterruptHandlerFunction handler,
- void* param, int32_t* status) {
- auto anInterrupt = interruptHandles.Get(interruptHandle);
- if (anInterrupt == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- anInterrupt->manager->registerHandler(handler, param, status);
-}
-
-void HAL_AttachInterruptHandlerThreaded(HAL_InterruptHandle interrupt_handle,
- HAL_InterruptHandlerFunction handler,
- void* param, int32_t* status) {
- InterruptThreadOwner* intr = new InterruptThreadOwner;
- intr->Start();
- intr->SetFunc(handler, param);
-
- HAL_AttachInterruptHandler(interrupt_handle, threadedInterruptHandler, intr,
- status);
-
- if (*status != 0) {
- delete intr;
- }
-}
-
-void HAL_SetInterruptUpSourceEdge(HAL_InterruptHandle interruptHandle,
- HAL_Bool risingEdge, HAL_Bool fallingEdge,
- int32_t* status) {
- auto anInterrupt = interruptHandles.Get(interruptHandle);
- if (anInterrupt == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- anInterrupt->anInterrupt->writeConfig_RisingEdge(risingEdge, status);
- anInterrupt->anInterrupt->writeConfig_FallingEdge(fallingEdge, status);
-}
-
-} // extern "C"
diff --git a/third_party/allwpilib_2017/hal/lib/athena/Notifier.cpp b/third_party/allwpilib_2017/hal/lib/athena/Notifier.cpp
deleted file mode 100644
index 3bedb68..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/Notifier.cpp
+++ /dev/null
@@ -1,299 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Notifier.h"
-
-// For std::atexit()
-#include <cstdlib>
-
-#include <atomic>
-#include <memory>
-#include <mutex>
-
-#include "HAL/ChipObject.h"
-#include "HAL/Errors.h"
-#include "HAL/HAL.h"
-#include "HAL/cpp/make_unique.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "HAL/handles/UnlimitedHandleResource.h"
-#include "support/SafeThread.h"
-
-using namespace hal;
-
-static const int32_t kTimerInterruptNumber = 28;
-
-static priority_mutex notifierInterruptMutex;
-static priority_recursive_mutex notifierMutex;
-static std::unique_ptr<tAlarm> notifierAlarm;
-static std::unique_ptr<tInterruptManager> notifierManager;
-static uint64_t closestTrigger = UINT64_MAX;
-
-namespace {
-struct Notifier {
- std::shared_ptr<Notifier> prev, next;
- void* param;
- HAL_NotifierProcessFunction process;
- uint64_t triggerTime = UINT64_MAX;
- HAL_NotifierHandle handle;
- bool threaded;
-};
-
-// Safe thread to allow callbacks to run on their own thread
-class NotifierThread : public wpi::SafeThread {
- public:
- void Main() {
- std::unique_lock<std::mutex> lock(m_mutex);
- while (m_active) {
- m_cond.wait(lock, [&] { return !m_active || m_notify; });
- if (!m_active) break;
- m_notify = false;
- uint64_t currentTime = m_currentTime;
- HAL_NotifierHandle handle = m_handle;
- HAL_NotifierProcessFunction process = m_process;
- lock.unlock(); // don't hold mutex during callback execution
- process(currentTime, handle);
- lock.lock();
- }
- }
-
- bool m_notify = false;
- HAL_NotifierHandle m_handle = HAL_kInvalidHandle;
- HAL_NotifierProcessFunction m_process;
- uint64_t m_currentTime;
-};
-
-class NotifierThreadOwner : public wpi::SafeThreadOwner<NotifierThread> {
- public:
- void SetFunc(HAL_NotifierProcessFunction process, void* param) {
- auto thr = GetThread();
- if (!thr) return;
- thr->m_process = process;
- m_param = param;
- }
-
- void Notify(uint64_t currentTime, HAL_NotifierHandle handle) {
- auto thr = GetThread();
- if (!thr) return;
- thr->m_currentTime = currentTime;
- thr->m_handle = handle;
- thr->m_notify = true;
- thr->m_cond.notify_one();
- }
-
- void* m_param;
-};
-} // namespace
-
-static std::shared_ptr<Notifier> notifiers;
-static std::atomic_flag notifierAtexitRegistered = ATOMIC_FLAG_INIT;
-static std::atomic_int notifierRefCount{0};
-
-using namespace hal;
-
-static UnlimitedHandleResource<HAL_NotifierHandle, Notifier,
- HAL_HandleEnum::Notifier>
- notifierHandles;
-
-// internal version of updateAlarm used during the alarmCallback when we know
-// that the pointer is a valid pointer.
-void updateNotifierAlarmInternal(std::shared_ptr<Notifier> notifierPointer,
- uint64_t triggerTime, int32_t* status) {
- std::lock_guard<priority_recursive_mutex> sync(notifierMutex);
-
- auto notifier = notifierPointer;
- // no need for a null check, as this must always be a valid pointer.
- notifier->triggerTime = triggerTime;
- bool wasActive = (closestTrigger != UINT64_MAX);
-
- if (!notifierInterruptMutex.try_lock() || notifierRefCount == 0 ||
- !notifierAlarm)
- return;
-
- // Update alarm time if closer than current.
- if (triggerTime < closestTrigger) {
- closestTrigger = triggerTime;
- // Simply truncate the hardware trigger time to 32-bit.
- notifierAlarm->writeTriggerTime(static_cast<uint32_t>(triggerTime), status);
- }
- // Enable the alarm. The hardware disables itself after each alarm.
- if (!wasActive) notifierAlarm->writeEnable(true, status);
-
- notifierInterruptMutex.unlock();
-}
-
-static void alarmCallback(uint32_t, void*) {
- std::unique_lock<priority_recursive_mutex> sync(notifierMutex);
-
- int32_t status = 0;
- uint64_t currentTime = 0;
-
- // the hardware disables itself after each alarm
- closestTrigger = UINT64_MAX;
-
- // process all notifiers
- std::shared_ptr<Notifier> notifier = notifiers;
- while (notifier) {
- if (notifier->triggerTime != UINT64_MAX) {
- if (currentTime == 0) currentTime = HAL_GetFPGATime(&status);
- if (notifier->triggerTime < currentTime) {
- notifier->triggerTime = UINT64_MAX;
- auto process = notifier->process;
- auto handle = notifier->handle;
- sync.unlock();
- process(currentTime, handle);
- sync.lock();
- } else if (notifier->triggerTime < closestTrigger) {
- updateNotifierAlarmInternal(notifier, notifier->triggerTime, &status);
- }
- }
- notifier = notifier->next;
- }
-}
-
-static void cleanupNotifierAtExit() {
- notifierAlarm = nullptr;
- notifierManager = nullptr;
-}
-
-static void threadedNotifierHandler(uint64_t currentTimeInt,
- HAL_NotifierHandle handle) {
- // Grab notifier and get handler param
- auto notifier = notifierHandles.Get(handle);
- if (!notifier) return;
- auto notifierPointer = notifier->param;
- if (notifierPointer == nullptr) return;
- NotifierThreadOwner* owner =
- static_cast<NotifierThreadOwner*>(notifierPointer);
- owner->Notify(currentTimeInt, handle);
-}
-
-extern "C" {
-
-HAL_NotifierHandle HAL_InitializeNotifier(HAL_NotifierProcessFunction process,
- void* param, int32_t* status) {
- if (!process) {
- *status = NULL_PARAMETER;
- return 0;
- }
- if (!notifierAtexitRegistered.test_and_set())
- std::atexit(cleanupNotifierAtExit);
- if (notifierRefCount.fetch_add(1) == 0) {
- std::lock_guard<priority_mutex> sync(notifierInterruptMutex);
- // create manager and alarm if not already created
- if (!notifierManager) {
- notifierManager = std::make_unique<tInterruptManager>(
- 1 << kTimerInterruptNumber, false, status);
- notifierManager->registerHandler(alarmCallback, nullptr, status);
- notifierManager->enable(status);
- }
- if (!notifierAlarm) notifierAlarm.reset(tAlarm::create(status));
- }
-
- std::lock_guard<priority_recursive_mutex> sync(notifierMutex);
- std::shared_ptr<Notifier> notifier = std::make_shared<Notifier>();
- HAL_NotifierHandle handle = notifierHandles.Allocate(notifier);
- if (handle == HAL_kInvalidHandle) {
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
- // create notifier structure and add to list
- notifier->next = notifiers;
- if (notifier->next) notifier->next->prev = notifier;
- notifier->param = param;
- notifier->process = process;
- notifier->handle = handle;
- notifier->threaded = false;
- notifiers = notifier;
- return handle;
-}
-
-HAL_NotifierHandle HAL_InitializeNotifierThreaded(
- HAL_NotifierProcessFunction process, void* param, int32_t* status) {
- NotifierThreadOwner* notify = new NotifierThreadOwner;
- notify->Start();
- notify->SetFunc(process, param);
-
- auto notifierHandle =
- HAL_InitializeNotifier(threadedNotifierHandler, notify, status);
-
- if (notifierHandle == HAL_kInvalidHandle || *status != 0) {
- delete notify;
- return HAL_kInvalidHandle;
- }
-
- auto notifier = notifierHandles.Get(notifierHandle);
- if (!notifier) {
- return HAL_kInvalidHandle;
- }
- notifier->threaded = true;
-
- return notifierHandle;
-}
-
-void HAL_CleanNotifier(HAL_NotifierHandle notifierHandle, int32_t* status) {
- {
- std::lock_guard<priority_recursive_mutex> sync(notifierMutex);
- auto notifier = notifierHandles.Get(notifierHandle);
- if (!notifier) return;
-
- // remove from list
- if (notifier->prev) notifier->prev->next = notifier->next;
- if (notifier->next) notifier->next->prev = notifier->prev;
- if (notifiers == notifier) notifiers = notifier->next;
- notifierHandles.Free(notifierHandle);
-
- if (notifier->threaded) {
- NotifierThreadOwner* owner =
- static_cast<NotifierThreadOwner*>(notifier->param);
- delete owner;
- }
- }
-
- if (notifierRefCount.fetch_sub(1) == 1) {
- std::lock_guard<priority_mutex> sync(notifierInterruptMutex);
- // if this was the last notifier, clean up alarm and manager
- if (notifierAlarm) {
- notifierAlarm->writeEnable(false, status);
- notifierAlarm = nullptr;
- }
- if (notifierManager) {
- notifierManager->disable(status);
- notifierManager = nullptr;
- }
- closestTrigger = UINT64_MAX;
- }
-}
-
-void* HAL_GetNotifierParam(HAL_NotifierHandle notifierHandle, int32_t* status) {
- auto notifier = notifierHandles.Get(notifierHandle);
- if (!notifier) return nullptr;
- if (notifier->threaded) {
- // If threaded, return thread param rather then notifier param
- NotifierThreadOwner* owner =
- static_cast<NotifierThreadOwner*>(notifier->param);
- return owner->m_param;
- }
- return notifier->param;
-}
-
-void HAL_UpdateNotifierAlarm(HAL_NotifierHandle notifierHandle,
- uint64_t triggerTime, int32_t* status) {
- std::lock_guard<priority_recursive_mutex> sync(notifierMutex);
-
- auto notifier = notifierHandles.Get(notifierHandle);
- if (!notifier) return;
- updateNotifierAlarmInternal(notifier, triggerTime, status);
-}
-
-void HAL_StopNotifierAlarm(HAL_NotifierHandle notifierHandle, int32_t* status) {
- std::lock_guard<priority_recursive_mutex> sync(notifierMutex);
- auto notifier = notifierHandles.Get(notifierHandle);
- if (!notifier) return;
- notifier->triggerTime = UINT64_MAX;
-}
-
-} // extern "C"
diff --git a/third_party/allwpilib_2017/hal/lib/athena/OSSerialPort.cpp b/third_party/allwpilib_2017/hal/lib/athena/OSSerialPort.cpp
deleted file mode 100644
index 95c467d..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/OSSerialPort.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/OSSerialPort.h"
-
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <termios.h>
-#include <unistd.h>
-
-#include <chrono>
-#include <cstring>
-#include <string>
-
-#include "HAL/Errors.h"
-#include "HAL/cpp/SerialHelper.h"
-
-static int portHandles[4]{-1, -1, -1, -1};
-static std::chrono::milliseconds portTimeouts[4]{
- std::chrono::milliseconds(0), std::chrono::milliseconds(0),
- std::chrono::milliseconds(0), std::chrono::milliseconds(0)};
-
-extern "C" {
-
-void HAL_InitializeOSSerialPort(HAL_SerialPort port, int32_t* status) {
- std::string portName;
-
- hal::SerialHelper serialHelper;
-
- portName = serialHelper.GetOSSerialPortName(port, status);
-
- if (*status < 0) {
- return;
- }
-
- int fs = open(portName.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
- if (fs == -1) {
- *status = HAL_SERIAL_PORT_OPEN_ERROR;
- return;
- }
- portHandles[port] = fs;
-
- struct termios options;
- tcgetattr(fs, &options);
- options.c_cflag = B9600 | CS8 | CLOCAL | CREAD;
- options.c_iflag = 0;
- options.c_oflag = 0;
- options.c_lflag = 0;
- tcflush(fs, TCIFLUSH);
- tcsetattr(fs, TCSANOW, &options);
-}
-
-void HAL_SetOSSerialBaudRate(HAL_SerialPort port, int32_t baud,
- int32_t* status) {
- int baudRate = -1;
- switch (baud) {
- case 9600:
- baudRate = B9600;
- break;
- case 19200:
- baudRate = B19200;
- break;
- case 38400:
- baudRate = B38400;
- break;
- case 57600:
- baudRate = B57600;
- break;
- case 115200:
- baudRate = B115200;
- break;
- default:
- *status = PARAMETER_OUT_OF_RANGE;
- return;
- }
-
- struct termios options;
- tcgetattr(portHandles[port], &options);
- auto set = cfsetospeed(&options, baudRate);
- if (set != 0) {
- *status = HAL_SERIAL_PORT_ERROR;
- return;
- }
- set = tcsetattr(portHandles[port], TCSANOW, &options);
- if (set != 0) {
- *status = HAL_SERIAL_PORT_ERROR;
- return;
- }
-}
-
-void HAL_SetOSSerialDataBits(HAL_SerialPort port, int32_t bits,
- int32_t* status) {
- int numBits = -1;
- switch (bits) {
- case 5:
- numBits = CS5;
- break;
- case 6:
- numBits = CS6;
- break;
- case 7:
- numBits = CS7;
- break;
- case 8:
- numBits = CS8;
- break;
- default:
- *status = PARAMETER_OUT_OF_RANGE;
- return;
- }
-
- struct termios options;
- tcgetattr(portHandles[port], &options);
- options.c_cflag &= ~CSIZE;
- options.c_cflag |= numBits;
- auto set = tcsetattr(portHandles[port], TCSANOW, &options);
- if (set != 0) {
- *status = HAL_SERIAL_PORT_ERROR;
- return;
- }
-}
-
-void HAL_SetOSSerialParity(HAL_SerialPort port, int32_t parity,
- int32_t* status) {
- // Just set none parity
- struct termios options;
- tcgetattr(portHandles[port], &options);
- options.c_cflag &= ~PARENB;
- auto set = tcsetattr(portHandles[port], TCSANOW, &options);
- if (set != 0) {
- *status = HAL_SERIAL_PORT_ERROR;
- return;
- }
-}
-
-void HAL_SetOSSerialStopBits(HAL_SerialPort port, int32_t stopBits,
- int32_t* status) {
- // Force 1 stop bit
- struct termios options;
- tcgetattr(portHandles[port], &options);
- options.c_cflag &= ~CSTOPB;
- auto set = tcsetattr(portHandles[port], TCSANOW, &options);
- if (set != 0) {
- *status = HAL_SERIAL_PORT_ERROR;
- return;
- }
-}
-
-void HAL_SetOSSerialWriteMode(HAL_SerialPort port, int32_t mode,
- int32_t* status) {
- // No op
-}
-
-void HAL_SetOSSerialFlowControl(HAL_SerialPort port, int32_t flow,
- int32_t* status) {
- // No op
-}
-
-void HAL_SetOSSerialTimeout(HAL_SerialPort port, double timeout,
- int32_t* status) {
- // Convert to millis
- int t = timeout / 1000;
- portTimeouts[port] = std::chrono::milliseconds(t);
-}
-
-void HAL_EnableOSSerialTermination(HAL_SerialPort port, char terminator,
- int32_t* status) {
- // \n is hardcoded for now. Will fix later
- // Seems like a VISA only setting, need to check
-}
-
-void HAL_DisableOSSerialTermination(HAL_SerialPort port, int32_t* status) {
- // Seems like a VISA only setting, need to check
-}
-
-void HAL_SetOSSerialReadBufferSize(HAL_SerialPort port, int32_t size,
- int32_t* status) {
- // No op
-}
-
-void HAL_SetOSSerialWriteBufferSize(HAL_SerialPort port, int32_t size,
- int32_t* status) {
- // No op
-}
-
-int32_t HAL_GetOSSerialBytesReceived(HAL_SerialPort port, int32_t* status) {
- int bytes = 0;
- ioctl(portHandles[port], FIONREAD, &bytes);
- return bytes;
-}
-
-int32_t HAL_ReadOSSerial(HAL_SerialPort port, char* buffer, int32_t count,
- int32_t* status) {
- auto endTime = std::chrono::steady_clock::now() + portTimeouts[port];
-
- int bytesRead = 0;
-
- unsigned char buf[256];
-
- do {
- int rx = read(portHandles[port], buf, count - bytesRead);
- std::memcpy(&buffer[bytesRead], buf, rx);
- bytesRead += rx;
- if (bytesRead >= count) break;
- llvm::StringRef tmp(buffer, bytesRead);
- auto loc = tmp.find('\n');
- if (loc != llvm::StringRef::npos) {
- bytesRead = loc;
- break;
- }
- } while (std::chrono::steady_clock::now() < endTime);
- return bytesRead;
-}
-
-int32_t HAL_WriteOSSerial(HAL_SerialPort port, const char* buffer,
- int32_t count, int32_t* status) {
- return write(portHandles[port], buffer, count);
-}
-void HAL_FlushOSSerial(HAL_SerialPort port, int32_t* status) {
- tcdrain(portHandles[port]);
-}
-void HAL_ClearOSSerial(HAL_SerialPort port, int32_t* status) {
- tcflush(portHandles[port], TCIOFLUSH);
-}
-void HAL_CloseOSSerial(HAL_SerialPort port, int32_t* status) {
- close(portHandles[port]);
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/PCMInternal.cpp b/third_party/allwpilib_2017/hal/lib/athena/PCMInternal.cpp
deleted file mode 100644
index c767a8f..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/PCMInternal.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "PCMInternal.h"
-
-#include "HAL/Errors.h"
-#include "HAL/Solenoid.h"
-#include "HAL/cpp/make_unique.h"
-#include "PortsInternal.h"
-
-namespace hal {
-std::unique_ptr<PCM> PCM_modules[kNumPCMModules];
-
-void initializePCM(int32_t module, int32_t* status) {
- if (!HAL_CheckSolenoidModule(module)) {
- *status = RESOURCE_OUT_OF_RANGE;
- return;
- }
- if (!PCM_modules[module]) {
- PCM_modules[module] = std::make_unique<PCM>(module);
- }
-}
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/lib/athena/PCMInternal.h b/third_party/allwpilib_2017/hal/lib/athena/PCMInternal.h
deleted file mode 100644
index 4d47792..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/PCMInternal.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include <memory>
-
-#include "HAL/Errors.h"
-#include "HAL/Ports.h"
-#include "HAL/Solenoid.h"
-#include "PortsInternal.h"
-#include "ctre/PCM.h"
-
-namespace hal {
-extern std::unique_ptr<PCM> PCM_modules[kNumPCMModules];
-
-static inline bool checkPCMInit(int32_t module, int32_t* status) {
- if (!HAL_CheckSolenoidModule(module)) {
- *status = RESOURCE_OUT_OF_RANGE;
- return false;
- }
- if (!PCM_modules[module]) {
- *status = INCOMPATIBLE_STATE;
- return false;
- }
- return true;
-}
-
-void initializePCM(int32_t module, int32_t* status);
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/lib/athena/PDP.cpp b/third_party/allwpilib_2017/hal/lib/athena/PDP.cpp
deleted file mode 100644
index 61b8c5b..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/PDP.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/PDP.h"
-
-#include <memory>
-
-#include "HAL/Errors.h"
-#include "HAL/Ports.h"
-#include "HAL/cpp/make_unique.h"
-#include "PortsInternal.h"
-#include "ctre/PDP.h"
-
-using namespace hal;
-
-static std::unique_ptr<PDP> pdp[kNumPDPModules];
-
-static inline bool checkPDPInit(int32_t module, int32_t* status) {
- if (!HAL_CheckPDPModule(module)) {
- *status = RESOURCE_OUT_OF_RANGE;
- return false;
- }
- if (!pdp[module]) {
- *status = INCOMPATIBLE_STATE;
- return false;
- }
- return true;
-}
-
-extern "C" {
-
-void HAL_InitializePDP(int32_t module, int32_t* status) {
- if (!HAL_CheckPDPModule(module)) {
- *status = RESOURCE_OUT_OF_RANGE;
- return;
- }
- if (!pdp[module]) {
- pdp[module] = std::make_unique<PDP>(module);
- }
-}
-
-HAL_Bool HAL_CheckPDPModule(int32_t module) {
- return module < kNumPDPModules && module >= 0;
-}
-
-HAL_Bool HAL_CheckPDPChannel(int32_t channel) {
- return channel < kNumPDPChannels && channel >= 0;
-}
-
-double HAL_GetPDPTemperature(int32_t module, int32_t* status) {
- if (!checkPDPInit(module, status)) return 0;
-
- double temperature;
-
- *status = pdp[module]->GetTemperature(temperature);
-
- return temperature;
-}
-
-double HAL_GetPDPVoltage(int32_t module, int32_t* status) {
- if (!checkPDPInit(module, status)) return 0;
-
- double voltage;
-
- *status = pdp[module]->GetVoltage(voltage);
-
- return voltage;
-}
-
-double HAL_GetPDPChannelCurrent(int32_t module, int32_t channel,
- int32_t* status) {
- if (!checkPDPInit(module, status)) return 0;
-
- double current;
-
- *status = pdp[module]->GetChannelCurrent(channel, current);
-
- return current;
-}
-
-double HAL_GetPDPTotalCurrent(int32_t module, int32_t* status) {
- if (!checkPDPInit(module, status)) return 0;
-
- double current;
-
- *status = pdp[module]->GetTotalCurrent(current);
-
- return current;
-}
-
-double HAL_GetPDPTotalPower(int32_t module, int32_t* status) {
- if (!checkPDPInit(module, status)) return 0;
-
- double power;
-
- *status = pdp[module]->GetTotalPower(power);
-
- return power;
-}
-
-double HAL_GetPDPTotalEnergy(int32_t module, int32_t* status) {
- if (!checkPDPInit(module, status)) return 0;
-
- double energy;
-
- *status = pdp[module]->GetTotalEnergy(energy);
-
- return energy;
-}
-
-void HAL_ResetPDPTotalEnergy(int32_t module, int32_t* status) {
- if (!checkPDPInit(module, status)) return;
-
- *status = pdp[module]->ResetEnergy();
-}
-
-void HAL_ClearPDPStickyFaults(int32_t module, int32_t* status) {
- if (!checkPDPInit(module, status)) return;
-
- *status = pdp[module]->ClearStickyFaults();
-}
-
-} // extern "C"
diff --git a/third_party/allwpilib_2017/hal/lib/athena/PWM.cpp b/third_party/allwpilib_2017/hal/lib/athena/PWM.cpp
deleted file mode 100644
index a193842..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/PWM.cpp
+++ /dev/null
@@ -1,452 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/PWM.h"
-
-#include <cmath>
-
-#include "ConstantsInternal.h"
-#include "DigitalInternal.h"
-#include "HAL/handles/HandlesInternal.h"
-#include "PortsInternal.h"
-
-using namespace hal;
-
-static inline int32_t GetMaxPositivePwm(DigitalPort* port) {
- return port->maxPwm;
-}
-static inline int32_t GetMinPositivePwm(DigitalPort* port) {
- return port->eliminateDeadband ? port->deadbandMaxPwm : port->centerPwm + 1;
-}
-static inline int32_t GetCenterPwm(DigitalPort* port) {
- return port->centerPwm;
-}
-static inline int32_t GetMaxNegativePwm(DigitalPort* port) {
- return port->eliminateDeadband ? port->deadbandMinPwm : port->centerPwm - 1;
-}
-static inline int32_t GetMinNegativePwm(DigitalPort* port) {
- return port->minPwm;
-}
-static inline int32_t GetPositiveScaleFactor(DigitalPort* port) {
- return GetMaxPositivePwm(port) - GetMinPositivePwm(port);
-} ///< The scale for positive speeds.
-static inline int32_t GetNegativeScaleFactor(DigitalPort* port) {
- return GetMaxNegativePwm(port) - GetMinNegativePwm(port);
-} ///< The scale for negative speeds.
-static inline int32_t GetFullRangeScaleFactor(DigitalPort* port) {
- return GetMaxPositivePwm(port) - GetMinNegativePwm(port);
-} ///< The scale for positions.
-
-extern "C" {
-
-HAL_DigitalHandle HAL_InitializePWMPort(HAL_PortHandle portHandle,
- int32_t* status) {
- initializeDigital(status);
-
- if (*status != 0) return HAL_kInvalidHandle;
-
- int16_t channel = getPortHandleChannel(portHandle);
- if (channel == InvalidHandleIndex || channel >= kNumPWMChannels) {
- *status = PARAMETER_OUT_OF_RANGE;
- return HAL_kInvalidHandle;
- }
-
- uint8_t origChannel = static_cast<uint8_t>(channel);
-
- if (origChannel < kNumPWMHeaders) {
- channel += kNumDigitalChannels; // remap Headers to end of allocations
- } else {
- channel = remapMXPPWMChannel(channel) + 10; // remap MXP to proper channel
- }
-
- auto handle =
- digitalChannelHandles.Allocate(channel, HAL_HandleEnum::PWM, status);
-
- if (*status != 0)
- return HAL_kInvalidHandle; // failed to allocate. Pass error back.
-
- auto port = digitalChannelHandles.Get(handle, HAL_HandleEnum::PWM);
- if (port == nullptr) { // would only occur on thread issue.
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
-
- port->channel = origChannel;
-
- int32_t bitToSet = 1 << remapMXPPWMChannel(port->channel);
- uint16_t specialFunctions =
- digitalSystem->readEnableMXPSpecialFunction(status);
- digitalSystem->writeEnableMXPSpecialFunction(specialFunctions | bitToSet,
- status);
-
- return handle;
-}
-void HAL_FreePWMPort(HAL_DigitalHandle pwmPortHandle, int32_t* status) {
- auto port = digitalChannelHandles.Get(pwmPortHandle, HAL_HandleEnum::PWM);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- if (port->channel > tPWM::kNumHdrRegisters - 1) {
- int32_t bitToUnset = 1 << remapMXPPWMChannel(port->channel);
- uint16_t specialFunctions =
- digitalSystem->readEnableMXPSpecialFunction(status);
- digitalSystem->writeEnableMXPSpecialFunction(specialFunctions & ~bitToUnset,
- status);
- }
-
- digitalChannelHandles.Free(pwmPortHandle, HAL_HandleEnum::PWM);
-}
-
-HAL_Bool HAL_CheckPWMChannel(int32_t channel) {
- return channel < kNumPWMChannels && channel >= 0;
-}
-
-void HAL_SetPWMConfig(HAL_DigitalHandle pwmPortHandle, double max,
- double deadbandMax, double center, double deadbandMin,
- double min, int32_t* status) {
- auto port = digitalChannelHandles.Get(pwmPortHandle, HAL_HandleEnum::PWM);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- // calculate the loop time in milliseconds
- double loopTime =
- HAL_GetLoopTiming(status) / (kSystemClockTicksPerMicrosecond * 1e3);
- if (*status != 0) return;
-
- int32_t maxPwm = static_cast<int32_t>((max - kDefaultPwmCenter) / loopTime +
- kDefaultPwmStepsDown - 1);
- int32_t deadbandMaxPwm = static_cast<int32_t>(
- (deadbandMax - kDefaultPwmCenter) / loopTime + kDefaultPwmStepsDown - 1);
- int32_t centerPwm = static_cast<int32_t>(
- (center - kDefaultPwmCenter) / loopTime + kDefaultPwmStepsDown - 1);
- int32_t deadbandMinPwm = static_cast<int32_t>(
- (deadbandMin - kDefaultPwmCenter) / loopTime + kDefaultPwmStepsDown - 1);
- int32_t minPwm = static_cast<int32_t>((min - kDefaultPwmCenter) / loopTime +
- kDefaultPwmStepsDown - 1);
-
- port->maxPwm = maxPwm;
- port->deadbandMaxPwm = deadbandMaxPwm;
- port->deadbandMinPwm = deadbandMinPwm;
- port->centerPwm = centerPwm;
- port->minPwm = minPwm;
- port->configSet = true;
-}
-
-void HAL_SetPWMConfigRaw(HAL_DigitalHandle pwmPortHandle, int32_t maxPwm,
- int32_t deadbandMaxPwm, int32_t centerPwm,
- int32_t deadbandMinPwm, int32_t minPwm,
- int32_t* status) {
- auto port = digitalChannelHandles.Get(pwmPortHandle, HAL_HandleEnum::PWM);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- port->maxPwm = maxPwm;
- port->deadbandMaxPwm = deadbandMaxPwm;
- port->deadbandMinPwm = deadbandMinPwm;
- port->centerPwm = centerPwm;
- port->minPwm = minPwm;
-}
-
-void HAL_GetPWMConfigRaw(HAL_DigitalHandle pwmPortHandle, int32_t* maxPwm,
- int32_t* deadbandMaxPwm, int32_t* centerPwm,
- int32_t* deadbandMinPwm, int32_t* minPwm,
- int32_t* status) {
- auto port = digitalChannelHandles.Get(pwmPortHandle, HAL_HandleEnum::PWM);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- *maxPwm = port->maxPwm;
- *deadbandMaxPwm = port->deadbandMaxPwm;
- *deadbandMinPwm = port->deadbandMinPwm;
- *centerPwm = port->centerPwm;
- *minPwm = port->minPwm;
-}
-
-void HAL_SetPWMEliminateDeadband(HAL_DigitalHandle pwmPortHandle,
- HAL_Bool eliminateDeadband, int32_t* status) {
- auto port = digitalChannelHandles.Get(pwmPortHandle, HAL_HandleEnum::PWM);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- port->eliminateDeadband = eliminateDeadband;
-}
-
-HAL_Bool HAL_GetPWMEliminateDeadband(HAL_DigitalHandle pwmPortHandle,
- int32_t* status) {
- auto port = digitalChannelHandles.Get(pwmPortHandle, HAL_HandleEnum::PWM);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- return port->eliminateDeadband;
-}
-
-/**
- * Set a PWM channel to the desired value. The values range from 0 to 255 and
- * the period is controlled
- * by the PWM Period and MinHigh registers.
- *
- * @param channel The PWM channel to set.
- * @param value The PWM value to set.
- */
-void HAL_SetPWMRaw(HAL_DigitalHandle pwmPortHandle, int32_t value,
- int32_t* status) {
- auto port = digitalChannelHandles.Get(pwmPortHandle, HAL_HandleEnum::PWM);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- if (port->channel < tPWM::kNumHdrRegisters) {
- pwmSystem->writeHdr(port->channel, value, status);
- } else {
- pwmSystem->writeMXP(port->channel - tPWM::kNumHdrRegisters, value, status);
- }
-}
-
-/**
- * Set a PWM channel to the desired scaled value. The values range from -1 to 1
- * and
- * the period is controlled
- * by the PWM Period and MinHigh registers.
- *
- * @param channel The PWM channel to set.
- * @param value The scaled PWM value to set.
- */
-void HAL_SetPWMSpeed(HAL_DigitalHandle pwmPortHandle, double speed,
- int32_t* status) {
- auto port = digitalChannelHandles.Get(pwmPortHandle, HAL_HandleEnum::PWM);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- if (!port->configSet) {
- *status = INCOMPATIBLE_STATE;
- return;
- }
-
- DigitalPort* dPort = port.get();
-
- if (speed < -1.0) {
- speed = -1.0;
- } else if (speed > 1.0) {
- speed = 1.0;
- } else if (!std::isfinite(speed)) {
- speed = 0.0;
- }
-
- // calculate the desired output pwm value by scaling the speed appropriately
- int32_t rawValue;
- if (speed == 0.0) {
- rawValue = GetCenterPwm(dPort);
- } else if (speed > 0.0) {
- rawValue = static_cast<int32_t>(
- speed * static_cast<double>(GetPositiveScaleFactor(dPort)) +
- static_cast<double>(GetMinPositivePwm(dPort)) + 0.5);
- } else {
- rawValue = static_cast<int32_t>(
- speed * static_cast<double>(GetNegativeScaleFactor(dPort)) +
- static_cast<double>(GetMaxNegativePwm(dPort)) + 0.5);
- }
-
- if (!((rawValue >= GetMinNegativePwm(dPort)) &&
- (rawValue <= GetMaxPositivePwm(dPort))) ||
- rawValue == kPwmDisabled) {
- *status = HAL_PWM_SCALE_ERROR;
- return;
- }
-
- HAL_SetPWMRaw(pwmPortHandle, rawValue, status);
-}
-
-/**
- * Set a PWM channel to the desired position value. The values range from 0 to 1
- * and
- * the period is controlled
- * by the PWM Period and MinHigh registers.
- *
- * @param channel The PWM channel to set.
- * @param value The scaled PWM value to set.
- */
-void HAL_SetPWMPosition(HAL_DigitalHandle pwmPortHandle, double pos,
- int32_t* status) {
- auto port = digitalChannelHandles.Get(pwmPortHandle, HAL_HandleEnum::PWM);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- if (!port->configSet) {
- *status = INCOMPATIBLE_STATE;
- return;
- }
- DigitalPort* dPort = port.get();
-
- if (pos < 0.0) {
- pos = 0.0;
- } else if (pos > 1.0) {
- pos = 1.0;
- }
-
- // note, need to perform the multiplication below as floating point before
- // converting to int
- int32_t rawValue = static_cast<int32_t>(
- (pos * static_cast<double>(GetFullRangeScaleFactor(dPort))) +
- GetMinNegativePwm(dPort));
-
- if (rawValue == kPwmDisabled) {
- *status = HAL_PWM_SCALE_ERROR;
- return;
- }
-
- HAL_SetPWMRaw(pwmPortHandle, rawValue, status);
-}
-
-void HAL_SetPWMDisabled(HAL_DigitalHandle pwmPortHandle, int32_t* status) {
- HAL_SetPWMRaw(pwmPortHandle, kPwmDisabled, status);
-}
-
-/**
- * Get a value from a PWM channel. The values range from 0 to 255.
- *
- * @param channel The PWM channel to read from.
- * @return The raw PWM value.
- */
-int32_t HAL_GetPWMRaw(HAL_DigitalHandle pwmPortHandle, int32_t* status) {
- auto port = digitalChannelHandles.Get(pwmPortHandle, HAL_HandleEnum::PWM);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
-
- if (port->channel < tPWM::kNumHdrRegisters) {
- return pwmSystem->readHdr(port->channel, status);
- } else {
- return pwmSystem->readMXP(port->channel - tPWM::kNumHdrRegisters, status);
- }
-}
-
-/**
- * Get a scaled value from a PWM channel. The values range from -1 to 1.
- *
- * @param channel The PWM channel to read from.
- * @return The scaled PWM value.
- */
-double HAL_GetPWMSpeed(HAL_DigitalHandle pwmPortHandle, int32_t* status) {
- auto port = digitalChannelHandles.Get(pwmPortHandle, HAL_HandleEnum::PWM);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- if (!port->configSet) {
- *status = INCOMPATIBLE_STATE;
- return 0;
- }
-
- int32_t value = HAL_GetPWMRaw(pwmPortHandle, status);
- if (*status != 0) return 0;
- DigitalPort* dPort = port.get();
-
- if (value == kPwmDisabled) {
- return 0.0;
- } else if (value > GetMaxPositivePwm(dPort)) {
- return 1.0;
- } else if (value < GetMinNegativePwm(dPort)) {
- return -1.0;
- } else if (value > GetMinPositivePwm(dPort)) {
- return static_cast<double>(value - GetMinPositivePwm(dPort)) /
- static_cast<double>(GetPositiveScaleFactor(dPort));
- } else if (value < GetMaxNegativePwm(dPort)) {
- return static_cast<double>(value - GetMaxNegativePwm(dPort)) /
- static_cast<double>(GetNegativeScaleFactor(dPort));
- } else {
- return 0.0;
- }
-}
-
-/**
- * Get a position value from a PWM channel. The values range from 0 to 1.
- *
- * @param channel The PWM channel to read from.
- * @return The scaled PWM value.
- */
-double HAL_GetPWMPosition(HAL_DigitalHandle pwmPortHandle, int32_t* status) {
- auto port = digitalChannelHandles.Get(pwmPortHandle, HAL_HandleEnum::PWM);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return 0;
- }
- if (!port->configSet) {
- *status = INCOMPATIBLE_STATE;
- return 0;
- }
-
- int32_t value = HAL_GetPWMRaw(pwmPortHandle, status);
- if (*status != 0) return 0;
- DigitalPort* dPort = port.get();
-
- if (value < GetMinNegativePwm(dPort)) {
- return 0.0;
- } else if (value > GetMaxPositivePwm(dPort)) {
- return 1.0;
- } else {
- return static_cast<double>(value - GetMinNegativePwm(dPort)) /
- static_cast<double>(GetFullRangeScaleFactor(dPort));
- }
-}
-
-void HAL_LatchPWMZero(HAL_DigitalHandle pwmPortHandle, int32_t* status) {
- auto port = digitalChannelHandles.Get(pwmPortHandle, HAL_HandleEnum::PWM);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- pwmSystem->writeZeroLatch(port->channel, true, status);
- pwmSystem->writeZeroLatch(port->channel, false, status);
-}
-
-/**
- * Set how how often the PWM signal is squelched, thus scaling the period.
- *
- * @param channel The PWM channel to configure.
- * @param squelchMask The 2-bit mask of outputs to squelch.
- */
-void HAL_SetPWMPeriodScale(HAL_DigitalHandle pwmPortHandle, int32_t squelchMask,
- int32_t* status) {
- auto port = digitalChannelHandles.Get(pwmPortHandle, HAL_HandleEnum::PWM);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- if (port->channel < tPWM::kNumPeriodScaleHdrElements) {
- pwmSystem->writePeriodScaleHdr(port->channel, squelchMask, status);
- } else {
- pwmSystem->writePeriodScaleMXP(
- port->channel - tPWM::kNumPeriodScaleHdrElements, squelchMask, status);
- }
-}
-
-/**
- * Get the loop timing of the PWM system
- *
- * @return The loop time
- */
-int32_t HAL_GetLoopTiming(int32_t* status) {
- initializeDigital(status);
- if (*status != 0) return 0;
- return pwmSystem->readLoopTiming(status);
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/Ports.cpp b/third_party/allwpilib_2017/hal/lib/athena/Ports.cpp
deleted file mode 100644
index 98246bd..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/Ports.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Ports.h"
-
-#include "PortsInternal.h"
-
-using namespace hal;
-
-extern "C" {
-int32_t HAL_GetNumAccumulators(void) { return kNumAccumulators; }
-int32_t HAL_GetNumAnalogTriggers(void) { return kNumAnalogTriggers; }
-int32_t HAL_GetNumAnalogInputs(void) { return kNumAnalogInputs; }
-int32_t HAL_GetNumAnalogOutputs(void) { return kNumAnalogOutputs; }
-int32_t HAL_GetNumCounters(void) { return kNumCounters; }
-int32_t HAL_GetNumDigitalHeaders(void) { return kNumDigitalHeaders; }
-int32_t HAL_GetNumPWMHeaders(void) { return kNumPWMHeaders; }
-int32_t HAL_GetNumDigitalChannels(void) { return kNumDigitalChannels; }
-int32_t HAL_GetNumPWMChannels(void) { return kNumPWMChannels; }
-int32_t HAL_GetNumDigitalPWMOutputs(void) { return kNumDigitalPWMOutputs; }
-int32_t HAL_GetNumEncoders(void) { return kNumEncoders; }
-int32_t HAL_GetNumInterrupts(void) { return kNumInterrupts; }
-int32_t HAL_GetNumRelayChannels(void) { return kNumRelayChannels; }
-int32_t HAL_GetNumRelayHeaders(void) { return kNumRelayHeaders; }
-int32_t HAL_GetNumPCMModules(void) { return kNumPCMModules; }
-int32_t HAL_GetNumSolenoidChannels(void) { return kNumSolenoidChannels; }
-int32_t HAL_GetNumPDPModules(void) { return kNumPDPModules; }
-int32_t HAL_GetNumPDPChannels(void) { return kNumPDPChannels; }
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/PortsInternal.h b/third_party/allwpilib_2017/hal/lib/athena/PortsInternal.h
deleted file mode 100644
index 391c38b..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/PortsInternal.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include "HAL/ChipObject.h"
-
-namespace hal {
-constexpr int32_t kNumAccumulators = tAccumulator::kNumSystems;
-constexpr int32_t kNumAnalogTriggers = tAnalogTrigger::kNumSystems;
-constexpr int32_t kNumAnalogInputs = 8;
-constexpr int32_t kNumAnalogOutputs = tAO::kNumMXPRegisters;
-constexpr int32_t kNumCounters = tCounter::kNumSystems;
-constexpr int32_t kNumDigitalHeaders = 10;
-constexpr int32_t kNumDigitalMXPChannels = 16;
-constexpr int32_t kNumDigitalSPIPortChannels = 5;
-constexpr int32_t kNumPWMHeaders = tPWM::kNumHdrRegisters;
-constexpr int32_t kNumDigitalChannels =
- kNumDigitalHeaders + kNumDigitalMXPChannels + kNumDigitalSPIPortChannels;
-constexpr int32_t kNumPWMChannels = tPWM::kNumMXPRegisters + kNumPWMHeaders;
-constexpr int32_t kNumDigitalPWMOutputs =
- tDIO::kNumPWMDutyCycleAElements + tDIO::kNumPWMDutyCycleBElements;
-constexpr int32_t kNumEncoders = tEncoder::kNumSystems;
-constexpr int32_t kNumInterrupts = tInterrupt::kNumSystems;
-constexpr int32_t kNumRelayChannels = 8;
-constexpr int32_t kNumRelayHeaders = kNumRelayChannels / 2;
-constexpr int32_t kNumPCMModules = 63;
-constexpr int32_t kNumSolenoidChannels = 8;
-constexpr int32_t kNumPDPModules = 63;
-constexpr int32_t kNumPDPChannels = 16;
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/lib/athena/Power.cpp b/third_party/allwpilib_2017/hal/lib/athena/Power.cpp
deleted file mode 100644
index 4d66fe2..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/Power.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Power.h"
-
-#include <memory>
-
-#include "HAL/ChipObject.h"
-
-using namespace hal;
-
-static std::unique_ptr<tPower> power;
-
-static void initializePower(int32_t* status) {
- if (power == nullptr) {
- power.reset(tPower::create(status));
- }
-}
-
-extern "C" {
-
-/**
- * Get the roboRIO input voltage
- */
-double HAL_GetVinVoltage(int32_t* status) {
- initializePower(status);
- return power->readVinVoltage(status) / 4.096 * 0.025733 - 0.029;
-}
-
-/**
- * Get the roboRIO input current
- */
-double HAL_GetVinCurrent(int32_t* status) {
- initializePower(status);
- return power->readVinCurrent(status) / 4.096 * 0.017042 - 0.071;
-}
-
-/**
- * Get the 6V rail voltage
- */
-double HAL_GetUserVoltage6V(int32_t* status) {
- initializePower(status);
- return power->readUserVoltage6V(status) / 4.096 * 0.007019 - 0.014;
-}
-
-/**
- * Get the 6V rail current
- */
-double HAL_GetUserCurrent6V(int32_t* status) {
- initializePower(status);
- return power->readUserCurrent6V(status) / 4.096 * 0.005566 - 0.009;
-}
-
-/**
- * Get the active state of the 6V rail
- */
-HAL_Bool HAL_GetUserActive6V(int32_t* status) {
- initializePower(status);
- return power->readStatus_User6V(status) == 4;
-}
-
-/**
- * Get the fault count for the 6V rail
- */
-int32_t HAL_GetUserCurrentFaults6V(int32_t* status) {
- initializePower(status);
- return static_cast<int32_t>(
- power->readFaultCounts_OverCurrentFaultCount6V(status));
-}
-
-/**
- * Get the 5V rail voltage
- */
-double HAL_GetUserVoltage5V(int32_t* status) {
- initializePower(status);
- return power->readUserVoltage5V(status) / 4.096 * 0.005962 - 0.013;
-}
-
-/**
- * Get the 5V rail current
- */
-double HAL_GetUserCurrent5V(int32_t* status) {
- initializePower(status);
- return power->readUserCurrent5V(status) / 4.096 * 0.001996 - 0.002;
-}
-
-/**
- * Get the active state of the 5V rail
- */
-HAL_Bool HAL_GetUserActive5V(int32_t* status) {
- initializePower(status);
- return power->readStatus_User5V(status) == 4;
-}
-
-/**
- * Get the fault count for the 5V rail
- */
-int32_t HAL_GetUserCurrentFaults5V(int32_t* status) {
- initializePower(status);
- return static_cast<int32_t>(
- power->readFaultCounts_OverCurrentFaultCount5V(status));
-}
-
-/**
- * Get the 3.3V rail voltage
- */
-double HAL_GetUserVoltage3V3(int32_t* status) {
- initializePower(status);
- return power->readUserVoltage3V3(status) / 4.096 * 0.004902 - 0.01;
-}
-
-/**
- * Get the 3.3V rail current
- */
-double HAL_GetUserCurrent3V3(int32_t* status) {
- initializePower(status);
- return power->readUserCurrent3V3(status) / 4.096 * 0.002486 - 0.003;
-}
-
-/**
- * Get the active state of the 3.3V rail
- */
-HAL_Bool HAL_GetUserActive3V3(int32_t* status) {
- initializePower(status);
- return power->readStatus_User3V3(status) == 4;
-}
-
-/**
- * Get the fault count for the 3.3V rail
- */
-int32_t HAL_GetUserCurrentFaults3V3(int32_t* status) {
- initializePower(status);
- return static_cast<int32_t>(
- power->readFaultCounts_OverCurrentFaultCount3V3(status));
-}
-
-} // extern "C"
diff --git a/third_party/allwpilib_2017/hal/lib/athena/Relay.cpp b/third_party/allwpilib_2017/hal/lib/athena/Relay.cpp
deleted file mode 100644
index 3c39869..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/Relay.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Relay.h"
-
-#include "DigitalInternal.h"
-#include "HAL/handles/IndexedHandleResource.h"
-#include "PortsInternal.h"
-
-using namespace hal;
-
-namespace {
-struct Relay {
- uint8_t channel;
- bool fwd;
-};
-}
-
-static IndexedHandleResource<HAL_RelayHandle, Relay, kNumRelayChannels,
- HAL_HandleEnum::Relay>
- relayHandles;
-
-// Create a mutex to protect changes to the relay values
-static priority_recursive_mutex digitalRelayMutex;
-
-extern "C" {
-HAL_RelayHandle HAL_InitializeRelayPort(HAL_PortHandle portHandle, HAL_Bool fwd,
- int32_t* status) {
- initializeDigital(status);
-
- if (*status != 0) return HAL_kInvalidHandle;
-
- int16_t channel = getPortHandleChannel(portHandle);
- if (channel == InvalidHandleIndex) {
- *status = PARAMETER_OUT_OF_RANGE;
- return HAL_kInvalidHandle;
- }
-
- if (!fwd) channel += kNumRelayHeaders; // add 4 to reverse channels
-
- auto handle = relayHandles.Allocate(channel, status);
-
- if (*status != 0)
- return HAL_kInvalidHandle; // failed to allocate. Pass error back.
-
- auto port = relayHandles.Get(handle);
- if (port == nullptr) { // would only occur on thread issue.
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
-
- if (!fwd) {
- // Subtract number of headers to put channel in range
- channel -= kNumRelayHeaders;
-
- port->fwd = false; // set to reverse
- } else {
- port->fwd = true; // set to forward
- }
-
- port->channel = static_cast<uint8_t>(channel);
- return handle;
-}
-
-void HAL_FreeRelayPort(HAL_RelayHandle relayPortHandle) {
- // no status, so no need to check for a proper free.
- relayHandles.Free(relayPortHandle);
-}
-
-HAL_Bool HAL_CheckRelayChannel(int32_t channel) {
- // roboRIO only has 4 headers, and the FPGA has
- // seperate functions for forward and reverse,
- // instead of seperate channel IDs
- return channel < kNumRelayHeaders && channel >= 0;
-}
-
-/**
- * Set the state of a relay.
- * Set the state of a relay output.
- */
-void HAL_SetRelay(HAL_RelayHandle relayPortHandle, HAL_Bool on,
- int32_t* status) {
- auto port = relayHandles.Get(relayPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
- std::lock_guard<priority_recursive_mutex> sync(digitalRelayMutex);
- uint8_t relays = 0;
- if (port->fwd) {
- relays = relaySystem->readValue_Forward(status);
- } else {
- relays = relaySystem->readValue_Reverse(status);
- }
-
- if (*status != 0) return; // bad status read
-
- if (on) {
- relays |= 1 << port->channel;
- } else {
- relays &= ~(1 << port->channel);
- }
-
- if (port->fwd) {
- relaySystem->writeValue_Forward(relays, status);
- } else {
- relaySystem->writeValue_Reverse(relays, status);
- }
-}
-
-/**
- * Get the current state of the relay channel
- */
-HAL_Bool HAL_GetRelay(HAL_RelayHandle relayPortHandle, int32_t* status) {
- auto port = relayHandles.Get(relayPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
-
- uint8_t relays = 0;
- if (port->fwd) {
- relays = relaySystem->readValue_Forward(status);
- } else {
- relays = relaySystem->readValue_Reverse(status);
- }
-
- return (relays & (1 << port->channel)) != 0;
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/SPI.cpp b/third_party/allwpilib_2017/hal/lib/athena/SPI.cpp
deleted file mode 100644
index 7df2dcb..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/SPI.cpp
+++ /dev/null
@@ -1,669 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/SPI.h"
-
-#include <atomic>
-#include <cstdio>
-
-#include "DigitalInternal.h"
-#include "HAL/DIO.h"
-#include "HAL/HAL.h"
-#include "HAL/Notifier.h"
-#include "HAL/cpp/make_unique.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "HAL/handles/HandlesInternal.h"
-#include "spilib/spi-lib.h"
-
-using namespace hal;
-
-static int32_t m_spiCS0Handle = 0;
-static int32_t m_spiCS1Handle = 0;
-static int32_t m_spiCS2Handle = 0;
-static int32_t m_spiCS3Handle = 0;
-static int32_t m_spiMXPHandle = 0;
-static priority_recursive_mutex spiOnboardMutex;
-static priority_recursive_mutex spiMXPMutex;
-
-// MXP SPI does not count towards this
-std::atomic<int32_t> spiPortCount{0};
-
-static HAL_DigitalHandle digitalHandles[9]{HAL_kInvalidHandle};
-
-/**
- * Get the semaphore for a SPI port
- *
- * @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
- * @return The semaphore for the SPI port.
- */
-static priority_recursive_mutex& spiGetMutex(int32_t port) {
- if (port < 4)
- return spiOnboardMutex;
- else
- return spiMXPMutex;
-}
-
-extern "C" {
-
-struct SPIAccumulator {
- std::atomic<HAL_NotifierHandle> notifier{0};
- uint64_t triggerTime;
- int32_t period;
-
- int64_t value = 0;
- uint32_t count = 0;
- int32_t lastValue = 0;
-
- int32_t center = 0;
- int32_t deadband = 0;
-
- uint8_t cmd[4]; // command to send (up to 4 bytes)
- int32_t validMask;
- int32_t validValue;
- int32_t dataMax; // one more than max data value
- int32_t dataMsbMask; // data field MSB mask (for signed)
- uint8_t dataShift; // data field shift right amount, in bits
- uint8_t xferSize; // SPI transfer size, in bytes (up to 4)
- uint8_t port;
- bool isSigned; // is data field signed?
- bool bigEndian; // is response big endian?
-};
-std::unique_ptr<SPIAccumulator> spiAccumulators[5];
-
-static void CommonSPIPortInit(int32_t* status) {
- // All false cases will set
- if (spiPortCount.fetch_add(1) == 0) {
- // Have not been initialized yet
- initializeDigital(status);
- if (*status != 0) return;
- // MISO
- if ((digitalHandles[3] = HAL_InitializeDIOPort(createPortHandleForSPI(29),
- false, status)) ==
- HAL_kInvalidHandle) {
- std::printf("Failed to allocate DIO 29 (MISO)\n");
- return;
- }
- // MOSI
- if ((digitalHandles[4] = HAL_InitializeDIOPort(createPortHandleForSPI(30),
- false, status)) ==
- HAL_kInvalidHandle) {
- std::printf("Failed to allocate DIO 30 (MOSI)\n");
- HAL_FreeDIOPort(digitalHandles[3]); // free the first port allocated
- return;
- }
- }
-}
-
-static void CommonSPIPortFree() {
- if (spiPortCount.fetch_sub(1) == 1) {
- // Clean up SPI Handles
- HAL_FreeDIOPort(digitalHandles[3]);
- HAL_FreeDIOPort(digitalHandles[4]);
- }
-}
-
-/*
- * Initialize the spi port. Opens the port if necessary and saves the handle.
- * If opening the MXP port, also sets up the channel functions appropriately
- * @param port The number of the port to use. 0-3 for Onboard CS0-CS3, 4 for MXP
- */
-void HAL_InitializeSPI(int32_t port, int32_t* status) {
- if (HAL_GetSPIHandle(port) != 0) return;
- switch (port) {
- case 0:
- CommonSPIPortInit(status);
- if (*status != 0) return;
- // CS0 is not a DIO port, so nothing to allocate
- HAL_SetSPIHandle(0, spilib_open("/dev/spidev0.0"));
- break;
- case 1:
- CommonSPIPortInit(status);
- if (*status != 0) return;
- #if 0
- // CS1, Allocate
- if ((digitalHandles[0] = HAL_InitializeDIOPort(
- HAL_GetPort(26), false, status)) == HAL_kInvalidHandle) {
- std::printf("Failed to allocate DIO 26 (CS1)\n");
- CommonSPIPortFree();
- return;
- }
- #endif
- HAL_SetSPIHandle(1, spilib_open("/dev/spidev0.1"));
- break;
- case 2:
- CommonSPIPortInit(status);
- if (*status != 0) return;
- #if 0
- // CS2, Allocate
- if ((digitalHandles[1] = HAL_InitializeDIOPort(
- HAL_GetPort(27), false, status)) == HAL_kInvalidHandle) {
- std::printf("Failed to allocate DIO 27 (CS2)\n");
- CommonSPIPortFree();
- return;
- }
- #endif
- HAL_SetSPIHandle(2, spilib_open("/dev/spidev0.2"));
- break;
- case 3:
- CommonSPIPortInit(status);
- if (*status != 0) return;
- // CS3, Allocate
- if ((digitalHandles[2] = HAL_InitializeDIOPort(
- HAL_GetPort(28), false, status)) == HAL_kInvalidHandle) {
- std::printf("Failed to allocate DIO 28 (CS3)\n");
- CommonSPIPortFree();
- return;
- }
- HAL_SetSPIHandle(3, spilib_open("/dev/spidev0.3"));
- break;
- case 4:
- initializeDigital(status);
- if (*status != 0) return;
- if ((digitalHandles[5] = HAL_InitializeDIOPort(
- HAL_GetPort(14), false, status)) == HAL_kInvalidHandle) {
- std::printf("Failed to allocate DIO 14\n");
- return;
- }
- if ((digitalHandles[6] = HAL_InitializeDIOPort(
- HAL_GetPort(15), false, status)) == HAL_kInvalidHandle) {
- std::printf("Failed to allocate DIO 15\n");
- HAL_FreeDIOPort(digitalHandles[5]); // free the first port allocated
- return;
- }
- if ((digitalHandles[7] = HAL_InitializeDIOPort(
- HAL_GetPort(16), false, status)) == HAL_kInvalidHandle) {
- std::printf("Failed to allocate DIO 16\n");
- HAL_FreeDIOPort(digitalHandles[5]); // free the first port allocated
- HAL_FreeDIOPort(digitalHandles[6]); // free the second port allocated
- return;
- }
- if ((digitalHandles[8] = HAL_InitializeDIOPort(
- HAL_GetPort(17), false, status)) == HAL_kInvalidHandle) {
- std::printf("Failed to allocate DIO 17\n");
- HAL_FreeDIOPort(digitalHandles[5]); // free the first port allocated
- HAL_FreeDIOPort(digitalHandles[6]); // free the second port allocated
- HAL_FreeDIOPort(digitalHandles[7]); // free the third port allocated
- return;
- }
- digitalSystem->writeEnableMXPSpecialFunction(
- digitalSystem->readEnableMXPSpecialFunction(status) | 0x00F0, status);
- HAL_SetSPIHandle(4, spilib_open("/dev/spidev1.0"));
- break;
- default:
- *status = PARAMETER_OUT_OF_RANGE;
- break;
- }
- return;
-}
-
-/**
- * Generic transaction.
- *
- * This is a lower-level interface to the spi hardware giving you more control
- * over each transaction.
- *
- * @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
- * @param dataToSend Buffer of data to send as part of the transaction.
- * @param dataReceived Buffer to read data into.
- * @param size Number of bytes to transfer. [0..7]
- * @return Number of bytes transferred, -1 for error
- */
-int32_t HAL_TransactionSPI(int32_t port, uint8_t* dataToSend,
- uint8_t* dataReceived, int32_t size) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- return spilib_writeread(
- HAL_GetSPIHandle(port), reinterpret_cast<const char*>(dataToSend),
- reinterpret_cast<char*>(dataReceived), static_cast<int32_t>(size));
-}
-
-/**
- * Execute a write transaction with the device.
- *
- * Write to a device and wait until the transaction is complete.
- *
- * @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
- * @param datToSend The data to write to the register on the device.
- * @param sendSize The number of bytes to be written
- * @return The number of bytes written. -1 for an error
- */
-int32_t HAL_WriteSPI(int32_t port, uint8_t* dataToSend, int32_t sendSize) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- return spilib_write(HAL_GetSPIHandle(port),
- reinterpret_cast<const char*>(dataToSend),
- static_cast<int32_t>(sendSize));
-}
-
-/**
- * Execute a read from the device.
- *
- * This method does not write any data out to the device
- * Most spi devices will require a register address to be written before
- * they begin returning data
- *
- * @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
- * @param buffer A pointer to the array of bytes to store the data read from the
- * device.
- * @param count The number of bytes to read in the transaction. [1..7]
- * @return Number of bytes read. -1 for error.
- */
-int32_t HAL_ReadSPI(int32_t port, uint8_t* buffer, int32_t count) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- return spilib_read(HAL_GetSPIHandle(port), reinterpret_cast<char*>(buffer),
- static_cast<int32_t>(count));
-}
-
-/**
- * Close the SPI port
- *
- * @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
- */
-void HAL_CloseSPI(int32_t port) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- if (spiAccumulators[port]) {
- int32_t status = 0;
- HAL_FreeSPIAccumulator(port, &status);
- }
- spilib_close(HAL_GetSPIHandle(port));
- HAL_SetSPIHandle(port, 0);
- if (port < 4) {
- CommonSPIPortFree();
- }
- switch (port) {
- // Case 0 does not need to do anything
- case 1:
- HAL_FreeDIOPort(digitalHandles[0]);
- break;
- case 2:
- HAL_FreeDIOPort(digitalHandles[1]);
- break;
- case 3:
- HAL_FreeDIOPort(digitalHandles[2]);
- break;
- case 4:
- HAL_FreeDIOPort(digitalHandles[5]);
- HAL_FreeDIOPort(digitalHandles[6]);
- HAL_FreeDIOPort(digitalHandles[7]);
- HAL_FreeDIOPort(digitalHandles[8]);
- break;
- default:
- break;
- }
- return;
-}
-
-/**
- * Set the clock speed for the SPI bus.
- *
- * @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
- * @param speed The speed in Hz (0-1MHz)
- */
-void HAL_SetSPISpeed(int32_t port, int32_t speed) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- spilib_setspeed(HAL_GetSPIHandle(port), speed);
-}
-
-/**
- * Set the SPI options
- *
- * @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
- * @param msbFirst True to write the MSB first, False for LSB first
- * @param sampleOnTrailing True to sample on the trailing edge, False to sample
- * on the leading edge
- * @param clkIdleHigh True to set the clock to active low, False to set the
- * clock active high
- */
-void HAL_SetSPIOpts(int32_t port, HAL_Bool msbFirst, HAL_Bool sampleOnTrailing,
- HAL_Bool clkIdleHigh) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- spilib_setopts(HAL_GetSPIHandle(port), msbFirst, sampleOnTrailing,
- clkIdleHigh);
-}
-
-/**
- * Set the CS Active high for a SPI port
- *
- * @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
- */
-void HAL_SetSPIChipSelectActiveHigh(int32_t port, int32_t* status) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- if (port < 4) {
- spiSystem->writeChipSelectActiveHigh_Hdr(
- spiSystem->readChipSelectActiveHigh_Hdr(status) | (1 << port), status);
- } else {
- spiSystem->writeChipSelectActiveHigh_MXP(1, status);
- }
-}
-
-/**
- * Set the CS Active low for a SPI port
- *
- * @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
- */
-void HAL_SetSPIChipSelectActiveLow(int32_t port, int32_t* status) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- if (port < 4) {
- spiSystem->writeChipSelectActiveHigh_Hdr(
- spiSystem->readChipSelectActiveHigh_Hdr(status) & ~(1 << port), status);
- } else {
- spiSystem->writeChipSelectActiveHigh_MXP(0, status);
- }
-}
-
-/**
- * Get the stored handle for a SPI port
- *
- * @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
- * @return The stored handle for the SPI port. 0 represents no stored handle.
- */
-int32_t HAL_GetSPIHandle(int32_t port) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- switch (port) {
- case 0:
- return m_spiCS0Handle;
- case 1:
- return m_spiCS1Handle;
- case 2:
- return m_spiCS2Handle;
- case 3:
- return m_spiCS3Handle;
- case 4:
- return m_spiMXPHandle;
- default:
- return 0;
- }
-}
-
-/**
- * Set the stored handle for a SPI port
- *
- * @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
- * MXP.
- * @param handle The value of the handle for the port.
- */
-void HAL_SetSPIHandle(int32_t port, int32_t handle) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- switch (port) {
- case 0:
- m_spiCS0Handle = handle;
- break;
- case 1:
- m_spiCS1Handle = handle;
- break;
- case 2:
- m_spiCS2Handle = handle;
- break;
- case 3:
- m_spiCS3Handle = handle;
- break;
- case 4:
- m_spiMXPHandle = handle;
- break;
- default:
- break;
- }
-}
-
-static void spiAccumulatorProcess(uint64_t currentTime,
- HAL_NotifierHandle handle) {
- int32_t status = 0;
- auto param = HAL_GetNotifierParam(handle, &status);
- if (param == nullptr) return;
- SPIAccumulator* accum = static_cast<SPIAccumulator*>(param);
-
- // perform SPI transaction
- uint8_t resp_b[4];
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(accum->port));
- spilib_writeread(
- HAL_GetSPIHandle(accum->port), reinterpret_cast<const char*>(accum->cmd),
- reinterpret_cast<char*>(resp_b), static_cast<int32_t>(accum->xferSize));
-
- // convert from bytes
- uint32_t resp = 0;
- if (accum->bigEndian) {
- for (int32_t i = 0; i < accum->xferSize; ++i) {
- resp <<= 8;
- resp |= resp_b[i] & 0xff;
- }
- } else {
- for (int32_t i = accum->xferSize - 1; i >= 0; --i) {
- resp <<= 8;
- resp |= resp_b[i] & 0xff;
- }
- }
-
- // process response
- if ((resp & accum->validMask) == static_cast<uint32_t>(accum->validValue)) {
- // valid sensor data; extract data field
- int32_t data = static_cast<int32_t>(resp >> accum->dataShift);
- data &= accum->dataMax - 1;
- // 2s complement conversion if signed MSB is set
- if (accum->isSigned && (data & accum->dataMsbMask) != 0)
- data -= accum->dataMax;
- // center offset
- data -= accum->center;
- // only accumulate if outside deadband
- if (data < -accum->deadband || data > accum->deadband) accum->value += data;
- ++accum->count;
- accum->lastValue = data;
- } else {
- // no data from the sensor; just clear the last value
- accum->lastValue = 0;
- }
-
- // reschedule timer
- accum->triggerTime += accum->period;
- // handle timer slip
- if (accum->triggerTime < currentTime)
- accum->triggerTime = currentTime + accum->period;
- status = 0;
- HAL_UpdateNotifierAlarm(accum->notifier, accum->triggerTime, &status);
-}
-
-/**
- * Initialize a SPI accumulator.
- *
- * @param port SPI port
- * @param period Time between reads, in us
- * @param cmd SPI command to send to request data
- * @param xferSize SPI transfer size, in bytes
- * @param validMask Mask to apply to received data for validity checking
- * @param valid_data After validMask is applied, required matching value for
- * validity checking
- * @param dataShift Bit shift to apply to received data to get actual data
- * value
- * @param dataSize Size (in bits) of data field
- * @param isSigned Is data field signed?
- * @param bigEndian Is device big endian?
- */
-void HAL_InitSPIAccumulator(int32_t port, int32_t period, int32_t cmd,
- int32_t xferSize, int32_t validMask,
- int32_t validValue, int32_t dataShift,
- int32_t dataSize, HAL_Bool isSigned,
- HAL_Bool bigEndian, int32_t* status) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- if (port > 4) return;
- if (!spiAccumulators[port])
- spiAccumulators[port] = std::make_unique<SPIAccumulator>();
- SPIAccumulator* accum = spiAccumulators[port].get();
- if (bigEndian) {
- for (int32_t i = xferSize - 1; i >= 0; --i) {
- accum->cmd[i] = cmd & 0xff;
- cmd >>= 8;
- }
- } else {
- accum->cmd[0] = cmd & 0xff;
- cmd >>= 8;
- accum->cmd[1] = cmd & 0xff;
- cmd >>= 8;
- accum->cmd[2] = cmd & 0xff;
- cmd >>= 8;
- accum->cmd[3] = cmd & 0xff;
- }
- accum->period = period;
- accum->xferSize = xferSize;
- accum->validMask = validMask;
- accum->validValue = validValue;
- accum->dataShift = dataShift;
- accum->dataMax = (1 << dataSize);
- accum->dataMsbMask = (1 << (dataSize - 1));
- accum->isSigned = isSigned;
- accum->bigEndian = bigEndian;
- if (!accum->notifier) {
- accum->notifier =
- HAL_InitializeNotifier(spiAccumulatorProcess, accum, status);
- accum->triggerTime = HAL_GetFPGATime(status) + period;
- if (*status != 0) return;
- HAL_UpdateNotifierAlarm(accum->notifier, accum->triggerTime, status);
- }
-}
-
-/**
- * Frees a SPI accumulator.
- */
-void HAL_FreeSPIAccumulator(int32_t port, int32_t* status) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- SPIAccumulator* accum = spiAccumulators[port].get();
- if (!accum) {
- *status = NULL_PARAMETER;
- return;
- }
- HAL_NotifierHandle handle = accum->notifier.exchange(0);
- HAL_CleanNotifier(handle, status);
- spiAccumulators[port] = nullptr;
-}
-
-/**
- * Resets the accumulator to zero.
- */
-void HAL_ResetSPIAccumulator(int32_t port, int32_t* status) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- SPIAccumulator* accum = spiAccumulators[port].get();
- if (!accum) {
- *status = NULL_PARAMETER;
- return;
- }
- accum->value = 0;
- accum->count = 0;
- accum->lastValue = 0;
-}
-
-/**
- * Set the center value of the accumulator.
- *
- * The center value is subtracted from each value before it is added to the
- * accumulator. This
- * is used for the center value of devices like gyros and accelerometers to make
- * integration work
- * and to take the device offset into account when integrating.
- */
-void HAL_SetSPIAccumulatorCenter(int32_t port, int32_t center,
- int32_t* status) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- SPIAccumulator* accum = spiAccumulators[port].get();
- if (!accum) {
- *status = NULL_PARAMETER;
- return;
- }
- accum->center = center;
-}
-
-/**
- * Set the accumulator's deadband.
- */
-void HAL_SetSPIAccumulatorDeadband(int32_t port, int32_t deadband,
- int32_t* status) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- SPIAccumulator* accum = spiAccumulators[port].get();
- if (!accum) {
- *status = NULL_PARAMETER;
- return;
- }
- accum->deadband = deadband;
-}
-
-/**
- * Read the last value read by the accumulator engine.
- */
-int32_t HAL_GetSPIAccumulatorLastValue(int32_t port, int32_t* status) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- SPIAccumulator* accum = spiAccumulators[port].get();
- if (!accum) {
- *status = NULL_PARAMETER;
- return 0;
- }
- return accum->lastValue;
-}
-
-/**
- * Read the accumulated value.
- *
- * @return The 64-bit value accumulated since the last Reset().
- */
-int64_t HAL_GetSPIAccumulatorValue(int32_t port, int32_t* status) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- SPIAccumulator* accum = spiAccumulators[port].get();
- if (!accum) {
- *status = NULL_PARAMETER;
- return 0;
- }
- return accum->value;
-}
-
-/**
- * Read the number of accumulated values.
- *
- * Read the count of the accumulated values since the accumulator was last
- * Reset().
- *
- * @return The number of times samples from the channel were accumulated.
- */
-int64_t HAL_GetSPIAccumulatorCount(int32_t port, int32_t* status) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- SPIAccumulator* accum = spiAccumulators[port].get();
- if (!accum) {
- *status = NULL_PARAMETER;
- return 0;
- }
- return accum->count;
-}
-
-/**
- * Read the average of the accumulated value.
- *
- * @return The accumulated average value (value / count).
- */
-double HAL_GetSPIAccumulatorAverage(int32_t port, int32_t* status) {
- int64_t value;
- int64_t count;
- HAL_GetSPIAccumulatorOutput(port, &value, &count, status);
- if (count == 0) return 0.0;
- return static_cast<double>(value) / count;
-}
-
-/**
- * Read the accumulated value and the number of accumulated values atomically.
- *
- * This function reads the value and count atomically.
- * This can be used for averaging.
- *
- * @param value Pointer to the 64-bit accumulated output.
- * @param count Pointer to the number of accumulation cycles.
- */
-void HAL_GetSPIAccumulatorOutput(int32_t port, int64_t* value, int64_t* count,
- int32_t* status) {
- std::lock_guard<priority_recursive_mutex> sync(spiGetMutex(port));
- SPIAccumulator* accum = spiAccumulators[port].get();
- if (!accum) {
- *status = NULL_PARAMETER;
- *value = 0;
- *count = 0;
- return;
- }
- *value = accum->value;
- *count = accum->count;
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/SerialPort.cpp b/third_party/allwpilib_2017/hal/lib/athena/SerialPort.cpp
deleted file mode 100644
index 183e3cb..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/SerialPort.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/SerialPort.h"
-
-#include <string>
-
-#include "HAL/cpp/SerialHelper.h"
-#include "visa/visa.h"
-
-static int32_t resourceManagerHandle;
-static HAL_SerialPort portHandles[4];
-
-extern "C" {
-
-void HAL_InitializeSerialPort(HAL_SerialPort port, int32_t* status) {
- std::string portName;
-
- if (resourceManagerHandle == 0)
- viOpenDefaultRM(reinterpret_cast<ViSession*>(&resourceManagerHandle));
-
- hal::SerialHelper serialHelper;
-
- portName = serialHelper.GetVISASerialPortName(port, status);
-
- if (*status < 0) {
- return;
- }
-
- *status = viOpen(resourceManagerHandle, const_cast<char*>(portName.c_str()),
- VI_NULL, VI_NULL,
- reinterpret_cast<ViSession*>(&portHandles[port]));
- if (*status > 0) *status = 0;
-}
-
-void HAL_SetSerialBaudRate(HAL_SerialPort port, int32_t baud, int32_t* status) {
- *status = viSetAttribute(portHandles[port], VI_ATTR_ASRL_BAUD, baud);
- if (*status > 0) *status = 0;
-}
-
-void HAL_SetSerialDataBits(HAL_SerialPort port, int32_t bits, int32_t* status) {
- *status = viSetAttribute(portHandles[port], VI_ATTR_ASRL_DATA_BITS, bits);
- if (*status > 0) *status = 0;
-}
-
-void HAL_SetSerialParity(HAL_SerialPort port, int32_t parity, int32_t* status) {
- *status = viSetAttribute(portHandles[port], VI_ATTR_ASRL_PARITY, parity);
- if (*status > 0) *status = 0;
-}
-
-void HAL_SetSerialStopBits(HAL_SerialPort port, int32_t stopBits,
- int32_t* status) {
- *status = viSetAttribute(portHandles[port], VI_ATTR_ASRL_STOP_BITS, stopBits);
- if (*status > 0) *status = 0;
-}
-
-void HAL_SetSerialWriteMode(HAL_SerialPort port, int32_t mode,
- int32_t* status) {
- *status = viSetAttribute(portHandles[port], VI_ATTR_WR_BUF_OPER_MODE, mode);
- if (*status > 0) *status = 0;
-}
-
-void HAL_SetSerialFlowControl(HAL_SerialPort port, int32_t flow,
- int32_t* status) {
- *status = viSetAttribute(portHandles[port], VI_ATTR_ASRL_FLOW_CNTRL, flow);
- if (*status > 0) *status = 0;
-}
-
-void HAL_SetSerialTimeout(HAL_SerialPort port, double timeout,
- int32_t* status) {
- *status = viSetAttribute(portHandles[port], VI_ATTR_TMO_VALUE,
- static_cast<uint32_t>(timeout * 1e3));
- if (*status > 0) *status = 0;
-}
-
-void HAL_EnableSerialTermination(HAL_SerialPort port, char terminator,
- int32_t* status) {
- viSetAttribute(portHandles[port], VI_ATTR_TERMCHAR_EN, VI_TRUE);
- viSetAttribute(portHandles[port], VI_ATTR_TERMCHAR, terminator);
- *status = viSetAttribute(portHandles[port], VI_ATTR_ASRL_END_IN,
- VI_ASRL_END_TERMCHAR);
- if (*status > 0) *status = 0;
-}
-
-void HAL_DisableSerialTermination(HAL_SerialPort port, int32_t* status) {
- viSetAttribute(portHandles[port], VI_ATTR_TERMCHAR_EN, VI_FALSE);
- *status =
- viSetAttribute(portHandles[port], VI_ATTR_ASRL_END_IN, VI_ASRL_END_NONE);
- if (*status > 0) *status = 0;
-}
-
-void HAL_SetSerialReadBufferSize(HAL_SerialPort port, int32_t size,
- int32_t* status) {
- *status = viSetBuf(portHandles[port], VI_READ_BUF, size);
- if (*status > 0) *status = 0;
-}
-
-void HAL_SetSerialWriteBufferSize(HAL_SerialPort port, int32_t size,
- int32_t* status) {
- *status = viSetBuf(portHandles[port], VI_WRITE_BUF, size);
- if (*status > 0) *status = 0;
-}
-
-int32_t HAL_GetSerialBytesReceived(HAL_SerialPort port, int32_t* status) {
- int32_t bytes = 0;
-
- *status = viGetAttribute(portHandles[port], VI_ATTR_ASRL_AVAIL_NUM, &bytes);
- if (*status > 0) *status = 0;
- return bytes;
-}
-
-int32_t HAL_ReadSerial(HAL_SerialPort port, char* buffer, int32_t count,
- int32_t* status) {
- uint32_t retCount = 0;
-
- *status =
- viRead(portHandles[port], (ViPBuf)buffer, count, (ViPUInt32)&retCount);
-
- if (*status == VI_ERROR_IO || *status == VI_ERROR_ASRL_OVERRUN ||
- *status == VI_ERROR_ASRL_FRAMING || *status == VI_ERROR_ASRL_PARITY) {
- int32_t localStatus = 0;
- HAL_ClearSerial(port, &localStatus);
- }
-
- if (*status == VI_ERROR_TMO || *status > 0) *status = 0;
- return static_cast<int32_t>(retCount);
-}
-
-int32_t HAL_WriteSerial(HAL_SerialPort port, const char* buffer, int32_t count,
- int32_t* status) {
- uint32_t retCount = 0;
-
- *status =
- viWrite(portHandles[port], (ViPBuf)buffer, count, (ViPUInt32)&retCount);
-
- if (*status > 0) *status = 0;
- return static_cast<int32_t>(retCount);
-}
-
-void HAL_FlushSerial(HAL_SerialPort port, int32_t* status) {
- *status = viFlush(portHandles[port], VI_WRITE_BUF);
- if (*status > 0) *status = 0;
-}
-
-void HAL_ClearSerial(HAL_SerialPort port, int32_t* status) {
- *status = viClear(portHandles[port]);
- if (*status > 0) *status = 0;
-}
-
-void HAL_CloseSerial(HAL_SerialPort port, int32_t* status) {
- *status = viClose(portHandles[port]);
- if (*status > 0) *status = 0;
-}
-
-} // extern "C"
diff --git a/third_party/allwpilib_2017/hal/lib/athena/Solenoid.cpp b/third_party/allwpilib_2017/hal/lib/athena/Solenoid.cpp
deleted file mode 100644
index 8df8664..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/Solenoid.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Solenoid.h"
-
-#include "FRC_NetworkCommunication/LoadOut.h"
-#include "HAL/ChipObject.h"
-#include "HAL/Errors.h"
-#include "HAL/Ports.h"
-#include "HAL/handles/HandlesInternal.h"
-#include "HAL/handles/IndexedHandleResource.h"
-#include "PCMInternal.h"
-#include "PortsInternal.h"
-#include "ctre/PCM.h"
-
-namespace {
-struct Solenoid {
- uint8_t module;
- uint8_t channel;
-};
-}
-
-using namespace hal;
-
-static IndexedHandleResource<HAL_SolenoidHandle, Solenoid,
- kNumPCMModules * kNumSolenoidChannels,
- HAL_HandleEnum::Solenoid>
- solenoidHandles;
-
-extern "C" {
-
-HAL_SolenoidHandle HAL_InitializeSolenoidPort(HAL_PortHandle portHandle,
- int32_t* status) {
- int16_t channel = getPortHandleChannel(portHandle);
- int16_t module = getPortHandleModule(portHandle);
- if (channel == InvalidHandleIndex) {
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
-
- // initializePCM will check the module
- if (!HAL_CheckSolenoidChannel(channel)) {
- *status = RESOURCE_OUT_OF_RANGE;
- return HAL_kInvalidHandle;
- }
-
- initializePCM(module, status);
- if (*status != 0) {
- return HAL_kInvalidHandle;
- }
-
- auto handle =
- solenoidHandles.Allocate(module * kNumSolenoidChannels + channel, status);
- if (*status != 0) {
- return HAL_kInvalidHandle;
- }
- auto solenoidPort = solenoidHandles.Get(handle);
- if (solenoidPort == nullptr) { // would only occur on thread issues
- *status = HAL_HANDLE_ERROR;
- return HAL_kInvalidHandle;
- }
- solenoidPort->module = static_cast<uint8_t>(module);
- solenoidPort->channel = static_cast<uint8_t>(channel);
-
- return handle;
-}
-
-void HAL_FreeSolenoidPort(HAL_SolenoidHandle solenoidPortHandle) {
- solenoidHandles.Free(solenoidPortHandle);
-}
-
-HAL_Bool HAL_CheckSolenoidModule(int32_t module) {
- return module < kNumPCMModules && module >= 0;
-}
-
-HAL_Bool HAL_CheckSolenoidChannel(int32_t channel) {
- return channel < kNumSolenoidChannels && channel >= 0;
-}
-
-HAL_Bool HAL_GetSolenoid(HAL_SolenoidHandle solenoidPortHandle,
- int32_t* status) {
- auto port = solenoidHandles.Get(solenoidPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return false;
- }
- bool value;
-
- *status = PCM_modules[port->module]->GetSolenoid(port->channel, value);
-
- return value;
-}
-
-int32_t HAL_GetAllSolenoids(int32_t module, int32_t* status) {
- if (!checkPCMInit(module, status)) return 0;
- uint8_t value;
-
- *status = PCM_modules[module]->GetAllSolenoids(value);
-
- return value;
-}
-
-void HAL_SetSolenoid(HAL_SolenoidHandle solenoidPortHandle, HAL_Bool value,
- int32_t* status) {
- auto port = solenoidHandles.Get(solenoidPortHandle);
- if (port == nullptr) {
- *status = HAL_HANDLE_ERROR;
- return;
- }
-
- *status = PCM_modules[port->module]->SetSolenoid(port->channel, value);
-}
-
-void HAL_SetAllSolenoids(int32_t module, int32_t state, int32_t* status) {
- if (!checkPCMInit(module, status)) return;
-
- *status = PCM_modules[module]->SetAllSolenoids(state);
-}
-
-int32_t HAL_GetPCMSolenoidBlackList(int32_t module, int32_t* status) {
- if (!checkPCMInit(module, status)) return 0;
- uint8_t value;
-
- *status = PCM_modules[module]->GetSolenoidBlackList(value);
-
- return value;
-}
-HAL_Bool HAL_GetPCMSolenoidVoltageStickyFault(int32_t module, int32_t* status) {
- if (!checkPCMInit(module, status)) return 0;
- bool value;
-
- *status = PCM_modules[module]->GetSolenoidStickyFault(value);
-
- return value;
-}
-HAL_Bool HAL_GetPCMSolenoidVoltageFault(int32_t module, int32_t* status) {
- if (!checkPCMInit(module, status)) return false;
- bool value;
-
- *status = PCM_modules[module]->GetSolenoidFault(value);
-
- return value;
-}
-void HAL_ClearAllPCMStickyFaults(int32_t module, int32_t* status) {
- if (!checkPCMInit(module, status)) return;
-
- *status = PCM_modules[module]->ClearStickyFaults();
-}
-
-} // extern "C"
diff --git a/third_party/allwpilib_2017/hal/lib/athena/Threads.cpp b/third_party/allwpilib_2017/hal/lib/athena/Threads.cpp
deleted file mode 100644
index 8e8bc89..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/Threads.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Threads.h"
-
-#include <pthread.h>
-#include <sched.h>
-
-#include "HAL/Errors.h"
-
-extern "C" {
-/**
- * Get the thread priority for the specified thread.
- *
- * @param handle Native handle pointer to the thread to get the priority for
- * @param isRealTime Set to true if thread is realtime, otherwise false
- * @param status Error status variable. 0 on success
- * @return The current thread priority. Scaled 1-99, with 1 being highest.
- */
-int32_t HAL_GetThreadPriority(NativeThreadHandle handle, HAL_Bool* isRealTime,
- int32_t* status) {
- sched_param sch;
- int policy;
- int success = pthread_getschedparam(*handle, &policy, &sch);
- if (success == 0) {
- *status = 0;
- } else {
- *status = HAL_THREAD_PRIORITY_ERROR;
- return -1;
- }
- if (policy == SCHED_FIFO || policy == SCHED_RR) {
- *isRealTime = true;
- return sch.sched_priority;
- } else {
- *isRealTime = false;
- // 0 is the only suppored priority for non-realtime, so scale to 1
- return 1;
- }
-}
-
-/**
- * Get the thread priority for the current thread.
- *
- * @param handle Native handle pointer to the thread to get the priority for
- * @param isRealTime Set to true if thread is realtime, otherwise false
- * @param status Error status variable. 0 on success
- * @return The current thread priority. Scaled 1-99, with 1 being highest.
- */
-int32_t HAL_GetCurrentThreadPriority(HAL_Bool* isRealTime, int32_t* status) {
- auto thread = pthread_self();
- return HAL_GetThreadPriority(&thread, isRealTime, status);
-}
-
-/**
- * Sets the thread priority for the specified thread
- *
- * @param thread Reference to the thread to set the priority of
- * @param realTime Set to true to set a realtime priority, false for standard
- * priority
- * @param priority Priority to set the thread to. Scaled 1-99, with 1 being
- * highest
- * @param status Error status variable. 0 on success
- *
- * @return The success state of setting the priority
- */
-HAL_Bool HAL_SetThreadPriority(NativeThreadHandle handle, HAL_Bool realTime,
- int32_t priority, int32_t* status) {
- if (handle == nullptr) {
- *status = NULL_PARAMETER;
- return false;
- }
-
- int scheduler = realTime ? SCHED_FIFO : SCHED_OTHER;
- if (realTime) {
- // We don't support setting priorities for non RT threads
- // so we don't need to check for proper range
- if (priority < sched_get_priority_min(scheduler) ||
- priority > sched_get_priority_max(scheduler)) {
- *status = HAL_THREAD_PRIORITY_RANGE_ERROR;
- return false;
- }
- }
-
- sched_param sch;
- int policy;
- pthread_getschedparam(*handle, &policy, &sch);
- if (scheduler == SCHED_FIFO || scheduler == SCHED_RR)
- sch.sched_priority = priority;
- else
- // Only need to set 0 priority for non RT thread
- sch.sched_priority = 0;
- if (pthread_setschedparam(*handle, scheduler, &sch)) {
- *status = HAL_THREAD_PRIORITY_ERROR;
- return false;
- } else {
- *status = 0;
- return true;
- }
-}
-
-/**
- * Sets the thread priority for the current thread
- *
- * @param thread Reference to the thread to set the priority of
- * @param realTime Set to true to set a realtime priority, false for standard
- * priority
- * @param priority Priority to set the thread to. Scaled 1-99, with 1 being
- * highest
- * @param status Error status variable. 0 on success
- *
- * @return The success state of setting the priority
- */
-HAL_Bool HAL_SetCurrentThreadPriority(HAL_Bool realTime, int32_t priority,
- int32_t* status) {
- auto thread = pthread_self();
- return HAL_SetThreadPriority(&thread, realTime, priority, status);
-}
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/cpp/Semaphore.cpp b/third_party/allwpilib_2017/hal/lib/athena/cpp/Semaphore.cpp
deleted file mode 100644
index 521c816..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/cpp/Semaphore.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/cpp/Semaphore.h"
-
-Semaphore::Semaphore(int32_t count) { m_count = count; }
-
-void Semaphore::give() {
- std::lock_guard<priority_mutex> lock(m_mutex);
- ++m_count;
- m_condition.notify_one();
-}
-
-void Semaphore::take() {
- std::unique_lock<priority_mutex> lock(m_mutex);
- m_condition.wait(lock, [this] { return m_count; });
- --m_count;
-}
-
-bool Semaphore::tryTake() {
- std::lock_guard<priority_mutex> lock(m_mutex);
- if (m_count) {
- --m_count;
- return true;
- } else {
- return false;
- }
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/cpp/SerialHelper.cpp b/third_party/allwpilib_2017/hal/lib/athena/cpp/SerialHelper.cpp
deleted file mode 100644
index 5b7e8be..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/cpp/SerialHelper.cpp
+++ /dev/null
@@ -1,343 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/cpp/SerialHelper.h"
-
-#include <algorithm>
-#include <cstdio>
-#include <cstring>
-
-#include "../visa/visa.h"
-#include "HAL/Errors.h"
-#include "llvm/StringRef.h"
-
-constexpr const char* OnboardResourceVISA = "ASRL1::INSTR";
-constexpr const char* MxpResourceVISA = "ASRL2::INSTR";
-
-constexpr const char* OnboardResourceOS = "/dev/ttyS0";
-constexpr const char* MxpResourceOS = "/dev/ttyS1";
-
-namespace hal {
-std::string SerialHelper::m_usbNames[2]{"", ""};
-
-priority_mutex SerialHelper::m_nameMutex;
-
-SerialHelper::SerialHelper() {
- viOpenDefaultRM(reinterpret_cast<ViSession*>(&m_resourceHandle));
-}
-
-std::string SerialHelper::GetVISASerialPortName(HAL_SerialPort port,
- int32_t* status) {
- if (port == HAL_SerialPort::HAL_SerialPort_Onboard) {
- return OnboardResourceVISA;
- } else if (port == HAL_SerialPort::HAL_SerialPort_MXP) {
- return MxpResourceVISA;
- }
-
- QueryHubPaths(status);
-
- // If paths are empty or status error, return error
- if (*status != 0 || m_visaResource.empty() || m_osResource.empty() ||
- m_sortedHubPath.empty()) {
- *status = HAL_SERIAL_PORT_NOT_FOUND;
- return "";
- }
-
- int32_t visaIndex = GetIndexForPort(port, status);
- if (visaIndex == -1) {
- *status = HAL_SERIAL_PORT_NOT_FOUND;
- return "";
- // Error
- } else {
- return m_visaResource[visaIndex].str();
- }
-}
-
-std::string SerialHelper::GetOSSerialPortName(HAL_SerialPort port,
- int32_t* status) {
- if (port == HAL_SerialPort::HAL_SerialPort_Onboard) {
- return OnboardResourceOS;
- } else if (port == HAL_SerialPort::HAL_SerialPort_MXP) {
- return MxpResourceOS;
- }
-
- QueryHubPaths(status);
-
- // If paths are empty or status error, return error
- if (*status != 0 || m_visaResource.empty() || m_osResource.empty() ||
- m_sortedHubPath.empty()) {
- *status = HAL_SERIAL_PORT_NOT_FOUND;
- return "";
- }
-
- int32_t osIndex = GetIndexForPort(port, status);
- if (osIndex == -1) {
- *status = HAL_SERIAL_PORT_NOT_FOUND;
- return "";
- // Error
- } else {
- return m_osResource[osIndex].str();
- }
-}
-
-std::vector<std::string> SerialHelper::GetVISASerialPortList(int32_t* status) {
- std::vector<std::string> retVec;
-
- // Always add 2 onboard ports
- retVec.emplace_back(OnboardResourceVISA);
- retVec.emplace_back(MxpResourceVISA);
-
- QueryHubPaths(status);
-
- // If paths are empty or status error, return only onboard list
- if (*status != 0 || m_visaResource.empty() || m_osResource.empty() ||
- m_sortedHubPath.empty()) {
- *status = 0;
- return retVec;
- }
-
- for (auto& i : m_visaResource) {
- retVec.emplace_back(i.str());
- }
-
- return retVec;
-}
-
-std::vector<std::string> SerialHelper::GetOSSerialPortList(int32_t* status) {
- std::vector<std::string> retVec;
-
- // Always add 2 onboard ports
- retVec.emplace_back(OnboardResourceOS);
- retVec.emplace_back(MxpResourceOS);
-
- QueryHubPaths(status);
-
- // If paths are empty or status error, return only onboard list
- if (*status != 0 || m_visaResource.empty() || m_osResource.empty() ||
- m_sortedHubPath.empty()) {
- *status = 0;
- return retVec;
- }
-
- for (auto& i : m_osResource) {
- retVec.emplace_back(i.str());
- }
-
- return retVec;
-}
-
-void SerialHelper::SortHubPathVector() {
- m_sortedHubPath.clear();
- m_sortedHubPath = m_unsortedHubPath;
- std::sort(m_sortedHubPath.begin(), m_sortedHubPath.end(),
- [](const llvm::SmallVectorImpl<char>& lhs,
- const llvm::SmallVectorImpl<char>& rhs) -> int {
- llvm::StringRef lhsRef(lhs.begin(), lhs.size());
- llvm::StringRef rhsRef(rhs.begin(), rhs.size());
- return lhsRef.compare(rhsRef);
- });
-}
-
-void SerialHelper::CoiteratedSort(
- llvm::SmallVectorImpl<llvm::SmallString<16>>& vec) {
- llvm::SmallVector<llvm::SmallString<16>, 4> sortedVec;
- for (auto& str : m_sortedHubPath) {
- for (size_t i = 0; i < m_unsortedHubPath.size(); i++) {
- if (llvm::StringRef{m_unsortedHubPath[i].begin(),
- m_unsortedHubPath[i].size()}
- .equals(llvm::StringRef{str.begin(), str.size()})) {
- sortedVec.push_back(vec[i]);
- break;
- }
- }
- }
- vec = sortedVec;
-}
-
-void SerialHelper::QueryHubPaths(int32_t* status) {
- // VISA resource matching string
- const char* str = "?*";
- // Items needed for VISA
- ViUInt32 retCnt = 0;
- ViFindList viList = 0;
- ViChar desc[VI_FIND_BUFLEN];
- *status = viFindRsrc(m_resourceHandle, const_cast<char*>(str), &viList,
- &retCnt, desc);
-
- if (*status < 0) {
- // Handle the bad status elsewhere
- // Note let positive statii (warnings) continue
- goto done;
- }
- // Status might be positive, so reset it to 0
- *status = 0;
-
- // Storage buffers for Visa calls and system exec calls
- char osName[256];
- char execBuffer[128];
-
- // Loop through all returned VISA objects.
- // Increment the internal VISA ptr every loop
- for (size_t i = 0; i < retCnt; i++, viFindNext(viList, desc)) {
- // Ignore any matches to the 2 onboard ports
- if (std::strcmp(OnboardResourceVISA, desc) == 0 ||
- std::strcmp(MxpResourceVISA, desc) == 0) {
- continue;
- }
-
- // Open the resource, grab its interface name, and close it.
- ViSession vSession;
- *status = viOpen(m_resourceHandle, desc, VI_NULL, VI_NULL, &vSession);
- if (*status < 0) goto done;
- *status = 0;
-
- *status = viGetAttribute(vSession, VI_ATTR_INTF_INST_NAME, &osName);
- // Ignore an error here, as we want to close the session on an error
- // Use a seperate close variable so we can check
- ViStatus closeStatus = viClose(vSession);
- if (*status < 0) goto done;
- if (closeStatus < 0) goto done;
- *status = 0;
-
- // split until (/dev/
- llvm::StringRef devNameRef = llvm::StringRef{osName}.split("(/dev/").second;
- // String not found, continue
- if (devNameRef.equals("")) continue;
-
- // Split at )
- llvm::StringRef matchString = devNameRef.split(')').first;
- if (matchString.equals(devNameRef)) continue;
-
- // Run find using pipe to get a list of system accessors
- llvm::SmallString<128> val(
- "sh -c \"find /sys/devices/soc0 | grep amba | grep usb | grep ");
- val += matchString;
- val += "\"";
-
- // Pipe code found on StackOverflow
- // http://stackoverflow.com/questions/478898/how-to-execute-a-command-and-get-output-of-command-within-c-using-posix
-
- // Using std::string because this is guarenteed to be large
- std::string output = "";
-
- std::shared_ptr<FILE> pipe(popen(val.c_str(), "r"), pclose);
- // Just check the next item on a pipe failure
- if (!pipe) continue;
- while (!feof(pipe.get())) {
- if (std::fgets(execBuffer, 128, pipe.get()) != 0) output += execBuffer;
- }
-
- if (!output.empty()) {
- llvm::SmallVector<llvm::StringRef, 16> pathSplitVec;
- // Split output by line, grab first line, and split it into
- // individual directories
- llvm::StringRef{output}.split('\n').first.split(pathSplitVec, '/', -1,
- false);
-
- // Find each individual item index
-
- const char* usb1 = "usb1";
- const char* tty = "tty";
-
- int findusb = -1;
- int findtty = -1;
- int findregex = -1;
- for (size_t i = 0; i < pathSplitVec.size(); i++) {
- if (findusb == -1 && pathSplitVec[i].equals(usb1)) {
- findusb = i;
- }
- if (findtty == -1 && pathSplitVec[i].equals(tty)) {
- findtty = i;
- }
- if (findregex == -1 && pathSplitVec[i].equals(matchString)) {
- findregex = i;
- }
- }
-
- // Get the index for our device
- int hubIndex = findtty;
- if (findtty == -1) hubIndex = findregex;
-
- int devStart = findusb + 1;
-
- if (hubIndex < devStart) continue;
-
- // Add our devices to our list
- m_unsortedHubPath.emplace_back(
- llvm::StringRef{pathSplitVec[hubIndex - 2]});
- m_visaResource.emplace_back(desc);
- m_osResource.emplace_back(
- llvm::StringRef{osName}.split("(").second.split(")").first);
- }
- }
-
- SortHubPathVector();
-
- CoiteratedSort(m_visaResource);
- CoiteratedSort(m_osResource);
-done:
- viClose(viList);
-}
-
-int32_t SerialHelper::GetIndexForPort(HAL_SerialPort port, int32_t* status) {
- // Hold lock whenever we're using the names array
- std::lock_guard<priority_mutex> lock(m_nameMutex);
-
- std::string portString = m_usbNames[port - 2];
-
- llvm::SmallVector<int32_t, 4> indices;
-
- // If port has not been assigned, find the one to assign
- if (portString.empty()) {
- for (size_t i = 0; i < 2; i++) {
- // Remove all used ports
- auto idx = std::find(m_sortedHubPath.begin(), m_sortedHubPath.end(),
- m_usbNames[i]);
- if (idx != m_sortedHubPath.end()) {
- // found
- m_sortedHubPath.erase(idx);
- }
- if (m_usbNames[i] == "") {
- indices.push_back(i);
- }
- }
-
- int32_t idx = -1;
- for (size_t i = 0; i < indices.size(); i++) {
- if (indices[i] == port - 2) {
- idx = i;
- break;
- }
- }
-
- if (idx == -1) {
- *status = HAL_SERIAL_PORT_NOT_FOUND;
- return -1;
- }
-
- if (idx >= static_cast<int32_t>(m_sortedHubPath.size())) {
- *status = HAL_SERIAL_PORT_NOT_FOUND;
- return -1;
- }
-
- portString = m_sortedHubPath[idx].str();
- m_usbNames[port - 2] = portString;
- }
-
- int retIndex = -1;
-
- for (size_t i = 0; i < m_sortedHubPath.size(); i++) {
- if (m_sortedHubPath[i].equals(portString)) {
- retIndex = i;
- break;
- }
- }
-
- return retIndex;
-}
-
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/lib/athena/cpp/priority_mutex.cpp b/third_party/allwpilib_2017/hal/lib/athena/cpp/priority_mutex.cpp
deleted file mode 100644
index 1213898..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/cpp/priority_mutex.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/cpp/priority_mutex.h"
-
-void priority_recursive_mutex::lock() { pthread_mutex_lock(&m_mutex); }
-
-void priority_recursive_mutex::unlock() { pthread_mutex_unlock(&m_mutex); }
-
-bool priority_recursive_mutex::try_lock() noexcept {
- return !pthread_mutex_trylock(&m_mutex);
-}
-
-pthread_mutex_t* priority_recursive_mutex::native_handle() { return &m_mutex; }
-
-void priority_mutex::lock() { pthread_mutex_lock(&m_mutex); }
-
-void priority_mutex::unlock() { pthread_mutex_unlock(&m_mutex); }
-
-bool priority_mutex::try_lock() noexcept {
- return !pthread_mutex_trylock(&m_mutex);
-}
-
-pthread_mutex_t* priority_mutex::native_handle() { return &m_mutex; }
diff --git a/third_party/allwpilib_2017/hal/lib/athena/ctre/CtreCanNode.cpp b/third_party/allwpilib_2017/hal/lib/athena/ctre/CtreCanNode.cpp
deleted file mode 100644
index 2eb42ab..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/ctre/CtreCanNode.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
-
-#include "ctre/CtreCanNode.h"
-#include "FRC_NetworkCommunication/CANSessionMux.h"
-#include <string.h> // memset
-
-static const UINT32 kFullMessageIDMask = 0x1fffffff;
-
-CtreCanNode::CtreCanNode(UINT8 deviceNumber)
-{
- _deviceNumber = deviceNumber;
-}
-CtreCanNode::~CtreCanNode()
-{
-}
-void CtreCanNode::RegisterRx(uint32_t arbId)
-{
- /* no need to do anything, we just use new API to poll last received message */
-}
-/**
- * Schedule a CAN Frame for periodic transmit.
- * @param arbId CAN Frame Arbitration ID. Set BIT31 for 11bit ids, otherwise we use 29bit ids.
- * @param periodMs Period to transmit CAN frame. Pass 0 for one-shot, which also disables that ArbID's preceding periodic transmit.
- * @param dlc Number of bytes to transmit (0 to 8).
- * @param initialFrame Ptr to the frame data to schedule for transmitting. Passing null will result
- * in defaulting to zero data value.
- */
-void CtreCanNode::RegisterTx(uint32_t arbId, uint32_t periodMs, uint32_t dlc, const uint8_t * initialFrame)
-{
- int32_t status = 0;
- if(dlc > 8)
- dlc = 8;
- txJob_t job = {0};
- job.arbId = arbId;
- job.periodMs = periodMs;
- job.dlc = dlc;
- if(initialFrame){
- /* caller wants to specify original data */
- memcpy(job.toSend, initialFrame, dlc);
- }
- _txJobs[arbId] = job;
- FRC_NetworkCommunication_CANSessionMux_sendMessage( job.arbId,
- job.toSend,
- job.dlc,
- job.periodMs,
- &status);
-}
-/**
- * Schedule a CAN Frame for periodic transmit. Assume eight byte DLC and zero value for initial transmission.
- * @param arbId CAN Frame Arbitration ID. Set BIT31 for 11bit ids, otherwise we use 29bit ids.
- * @param periodMs Period to transmit CAN frame. Pass 0 for one-shot, which also disables that ArbID's preceding periodic transmit.
- */
-void CtreCanNode::RegisterTx(uint32_t arbId, uint32_t periodMs)
-{
- RegisterTx(arbId,periodMs, 8, 0);
-}
-/**
- * Remove a CAN frame Arbid to stop transmission.
- * @param arbId CAN Frame Arbitration ID. Set BIT31 for 11bit ids, otherwise we use 29bit ids.
- */
-void CtreCanNode::UnregisterTx(uint32_t arbId)
-{
- /* set period to zero */
- ChangeTxPeriod(arbId, 0);
- /* look and remove */
- txJobs_t::iterator iter = _txJobs.find(arbId);
- if(iter != _txJobs.end()) {
- _txJobs.erase(iter);
- }
-}
-timespec diff(const timespec & start, const timespec & end)
-{
- timespec temp;
- if ((end.tv_nsec-start.tv_nsec)<0) {
- temp.tv_sec = end.tv_sec-start.tv_sec-1;
- temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
- } else {
- temp.tv_sec = end.tv_sec-start.tv_sec;
- temp.tv_nsec = end.tv_nsec-start.tv_nsec;
- }
- return temp;
-}
-CTR_Code CtreCanNode::GetRx(uint32_t arbId,uint8_t * dataBytes, uint32_t timeoutMs)
-{
- CTR_Code retval = CTR_OKAY;
- int32_t status = 0;
- uint8_t len = 0;
- uint32_t timeStamp;
- /* cap timeout at 999ms */
- if(timeoutMs > 999)
- timeoutMs = 999;
- FRC_NetworkCommunication_CANSessionMux_receiveMessage(&arbId,kFullMessageIDMask,dataBytes,&len,&timeStamp,&status);
- if(status == 0){
- /* fresh update */
- rxEvent_t & r = _rxRxEvents[arbId]; /* lookup entry or make a default new one with all zeroes */
- clock_gettime(2,&r.time); /* fill in time */
- memcpy(r.bytes, dataBytes, 8); /* fill in databytes */
- }else{
- /* did not get the message */
- rxRxEvents_t::iterator i = _rxRxEvents.find(arbId);
- if(i == _rxRxEvents.end()){
- /* we've never gotten this mesage */
- retval = CTR_RxTimeout;
- /* fill caller's buffer with zeros */
- memset(dataBytes,0,8);
- }else{
- /* we've gotten this message before but not recently */
- memcpy(dataBytes,i->second.bytes,8);
- /* get the time now */
- struct timespec temp;
- clock_gettime(2,&temp); /* get now */
- /* how long has it been? */
- temp = diff(i->second.time,temp); /* temp = now - last */
- if(temp.tv_sec > 0){
- retval = CTR_RxTimeout;
- }else if(temp.tv_nsec > ((int32_t)timeoutMs*1000*1000)){
- retval = CTR_RxTimeout;
- }else {
- /* our last update was recent enough */
- }
- }
- }
-
- return retval;
-}
-void CtreCanNode::FlushTx(uint32_t arbId)
-{
- int32_t status = 0;
- txJobs_t::iterator iter = _txJobs.find(arbId);
- if(iter != _txJobs.end())
- FRC_NetworkCommunication_CANSessionMux_sendMessage( iter->second.arbId,
- iter->second.toSend,
- iter->second.dlc,
- iter->second.periodMs,
- &status);
-}
-/**
- * Change the transmit period of an already scheduled CAN frame.
- * This keeps the frame payload contents the same without caller having to perform
- * a read-modify-write.
- * @param arbId CAN Frame Arbitration ID. Set BIT31 for 11bit ids, otherwise we use 29bit ids.
- * @param periodMs Period to transmit CAN frame. Pass 0 for one-shot, which also disables that ArbID's preceding periodic transmit.
- * @return true if scheduled job was found and updated, false if there was no preceding job for the specified arbID.
- */
-bool CtreCanNode::ChangeTxPeriod(uint32_t arbId, uint32_t periodMs)
-{
- int32_t status = 0;
- /* lookup the data bytes and period for this message */
- txJobs_t::iterator iter = _txJobs.find(arbId);
- if(iter != _txJobs.end()) {
- /* modify th periodMs */
- iter->second.periodMs = periodMs;
- /* reinsert into scheduler with the same data bytes, only the period changed. */
- FRC_NetworkCommunication_CANSessionMux_sendMessage( iter->second.arbId,
- iter->second.toSend,
- iter->second.dlc,
- iter->second.periodMs,
- &status);
- return true;
- }
- return false;
-}
-
diff --git a/third_party/allwpilib_2017/hal/lib/athena/ctre/PCM.cpp b/third_party/allwpilib_2017/hal/lib/athena/ctre/PCM.cpp
deleted file mode 100644
index 2676743..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/ctre/PCM.cpp
+++ /dev/null
@@ -1,572 +0,0 @@
-#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
-
-#include "ctre/PCM.h"
-#include "FRC_NetworkCommunication/CANSessionMux.h"
-#include <string.h> // memset
-/* This can be a constant, as long as nobody needs to update solenoids within
- 1/50 of a second. */
-static const INT32 kCANPeriod = 20;
-
-#define STATUS_1 0x9041400
-#define STATUS_SOL_FAULTS 0x9041440
-#define STATUS_DEBUG 0x9041480
-
-#define EXPECTED_RESPONSE_TIMEOUT_MS (50)
-#define GET_PCM_STATUS() CtreCanNode::recMsg<PcmStatus_t> rx = GetRx<PcmStatus_t> (STATUS_1|GetDeviceNumber(),EXPECTED_RESPONSE_TIMEOUT_MS)
-#define GET_PCM_SOL_FAULTS() CtreCanNode::recMsg<PcmStatusFault_t> rx = GetRx<PcmStatusFault_t> (STATUS_SOL_FAULTS|GetDeviceNumber(),EXPECTED_RESPONSE_TIMEOUT_MS)
-#define GET_PCM_DEBUG() CtreCanNode::recMsg<PcmDebug_t> rx = GetRx<PcmDebug_t> (STATUS_DEBUG|GetDeviceNumber(),EXPECTED_RESPONSE_TIMEOUT_MS)
-
-#define CONTROL_1 0x09041C00 /* PCM_Control */
-#define CONTROL_2 0x09041C40 /* PCM_SupplemControl */
-#define CONTROL_3 0x09041C80 /* PcmControlSetOneShotDur_t */
-
-/* encoder/decoders */
-typedef struct _PcmStatus_t{
- /* Byte 0 */
- unsigned SolenoidBits:8;
- /* Byte 1 */
- unsigned compressorOn:1;
- unsigned stickyFaultFuseTripped:1;
- unsigned stickyFaultCompCurrentTooHigh:1;
- unsigned faultFuseTripped:1;
- unsigned faultCompCurrentTooHigh:1;
- unsigned faultHardwareFailure:1;
- unsigned isCloseloopEnabled:1;
- unsigned pressureSwitchEn:1;
- /* Byte 2*/
- unsigned battVoltage:8;
- /* Byte 3 */
- unsigned solenoidVoltageTop8:8;
- /* Byte 4 */
- unsigned compressorCurrentTop6:6;
- unsigned solenoidVoltageBtm2:2;
- /* Byte 5 */
- unsigned StickyFault_dItooHigh :1;
- unsigned Fault_dItooHigh :1;
- unsigned moduleEnabled:1;
- unsigned closedLoopOutput:1;
- unsigned compressorCurrentBtm4:4;
- /* Byte 6 */
- unsigned tokenSeedTop8:8;
- /* Byte 7 */
- unsigned tokenSeedBtm8:8;
-}PcmStatus_t;
-
-typedef struct _PcmControl_t{
- /* Byte 0 */
- unsigned tokenTop8:8;
- /* Byte 1 */
- unsigned tokenBtm8:8;
- /* Byte 2 */
- unsigned solenoidBits:8;
- /* Byte 3*/
- unsigned reserved:4;
- unsigned closeLoopOutput:1;
- unsigned compressorOn:1;
- unsigned closedLoopEnable:1;
- unsigned clearStickyFaults:1;
- /* Byte 4 */
- unsigned OneShotField_h8:8;
- /* Byte 5 */
- unsigned OneShotField_l8:8;
-}PcmControl_t;
-
-typedef struct _PcmControlSetOneShotDur_t{
- uint8_t sol10MsPerUnit[8];
-}PcmControlSetOneShotDur_t;
-
-typedef struct _PcmStatusFault_t{
- /* Byte 0 */
- unsigned SolenoidBlacklist:8;
- /* Byte 1 */
- unsigned reserved_bit0 :1;
- unsigned reserved_bit1 :1;
- unsigned reserved_bit2 :1;
- unsigned reserved_bit3 :1;
- unsigned StickyFault_CompNoCurrent :1;
- unsigned Fault_CompNoCurrent :1;
- unsigned StickyFault_SolenoidJumper :1;
- unsigned Fault_SolenoidJumper :1;
-}PcmStatusFault_t;
-
-typedef struct _PcmDebug_t{
- unsigned tokFailsTop8:8;
- unsigned tokFailsBtm8:8;
- unsigned lastFailedTokTop8:8;
- unsigned lastFailedTokBtm8:8;
- unsigned tokSuccessTop8:8;
- unsigned tokSuccessBtm8:8;
-}PcmDebug_t;
-
-
-/* PCM Constructor - Clears all vars, establishes default settings, starts PCM background process
- *
- * @Return - void
- *
- * @Param - deviceNumber - Device ID of PCM to be controlled
- */
-PCM::PCM(UINT8 deviceNumber): CtreCanNode(deviceNumber)
-{
- RegisterRx(STATUS_1 | deviceNumber );
- RegisterRx(STATUS_SOL_FAULTS | deviceNumber );
- RegisterRx(STATUS_DEBUG | deviceNumber );
- RegisterTx(CONTROL_1 | deviceNumber, kCANPeriod);
- /* enable close loop */
- SetClosedLoopControl(1);
-}
-/* PCM D'tor
- */
-PCM::~PCM()
-{
-
-}
-
-/* Set PCM solenoid state
- *
- * @Return - CTR_Code - Error code (if any) for setting solenoid
- *
- * @Param - idx - ID of solenoid (0-7)
- * @Param - en - Enable / Disable identified solenoid
- */
-CTR_Code PCM::SetSolenoid(unsigned char idx, bool en)
-{
- CtreCanNode::txTask<PcmControl_t> toFill = GetTx<PcmControl_t>(CONTROL_1 | GetDeviceNumber());
- if(toFill.IsEmpty())return CTR_UnexpectedArbId;
- if (en)
- toFill->solenoidBits |= (1ul << (idx));
- else
- toFill->solenoidBits &= ~(1ul << (idx));
- FlushTx(toFill);
- return CTR_OKAY;
-}
-
-/* Set all PCM solenoid states
- *
- * @Return - CTR_Code - Error code (if any) for setting solenoids
- * @Param - state Bitfield to set all solenoids to
- */
-CTR_Code PCM::SetAllSolenoids(UINT8 state) {
- CtreCanNode::txTask<PcmControl_t> toFill = GetTx<PcmControl_t>(CONTROL_1 | GetDeviceNumber());
- if(toFill.IsEmpty())return CTR_UnexpectedArbId;
- toFill->solenoidBits = state;
- FlushTx(toFill);
- return CTR_OKAY;
-}
-
-/* Clears PCM sticky faults (indicators of past faults
- *
- * @Return - CTR_Code - Error code (if any) for setting solenoid
- *
- * @Param - clr - Clear / do not clear faults
- */
-CTR_Code PCM::ClearStickyFaults()
-{
- int32_t status = 0;
- uint8_t pcmSupplemControl[] = { 0, 0, 0, 0x80 }; /* only bit set is ClearStickyFaults */
- FRC_NetworkCommunication_CANSessionMux_sendMessage(CONTROL_2 | GetDeviceNumber(), pcmSupplemControl, sizeof(pcmSupplemControl), 0, &status);
- if(status)
- return CTR_TxFailed;
- return CTR_OKAY;
-}
-
-/* Enables PCM Closed Loop Control of Compressor via pressure switch
- *
- * @Return - CTR_Code - Error code (if any) for setting solenoid
- *
- * @Param - en - Enable / Disable Closed Loop Control
- */
-CTR_Code PCM::SetClosedLoopControl(bool en)
-{
- CtreCanNode::txTask<PcmControl_t> toFill = GetTx<PcmControl_t>(CONTROL_1 | GetDeviceNumber());
- if(toFill.IsEmpty())return CTR_UnexpectedArbId;
- toFill->closedLoopEnable = en;
- FlushTx(toFill);
- return CTR_OKAY;
-}
-/* Get solenoid Blacklist status
- * @Return - CTR_Code - Error code (if any)
- * @Param - idx - ID of solenoid [0,7] to fire one shot pulse.
- */
-CTR_Code PCM::FireOneShotSolenoid(UINT8 idx)
-{
- CtreCanNode::txTask<PcmControl_t> toFill = GetTx<PcmControl_t>(CONTROL_1 | GetDeviceNumber());
- if(toFill.IsEmpty())return CTR_UnexpectedArbId;
- /* grab field as it is now */
- uint16_t oneShotField;
- oneShotField = toFill->OneShotField_h8;
- oneShotField <<= 8;
- oneShotField |= toFill->OneShotField_l8;
- /* get the caller's channel */
- uint16_t shift = 2*idx;
- uint16_t mask = 3; /* two bits wide */
- uint8_t chBits = (oneShotField >> shift) & mask;
- /* flip it */
- chBits = (chBits)%3 + 1;
- /* clear out 2bits for this channel*/
- oneShotField &= ~(mask << shift);
- /* put new field in */
- oneShotField |= chBits << shift;
- /* apply field as it is now */
- toFill->OneShotField_h8 = oneShotField >> 8;
- toFill->OneShotField_l8 = oneShotField;
- FlushTx(toFill);
- return CTR_OKAY;
-}
-/* Configure the pulse width of a solenoid channel for one-shot pulse.
- * Preprogrammed pulsewidth is 10ms resolute and can be between 20ms and 5.1s.
- * @Return - CTR_Code - Error code (if any)
- * @Param - idx - ID of solenoid [0,7] to configure.
- * @Param - durMs - pulse width in ms.
- */
-CTR_Code PCM::SetOneShotDurationMs(UINT8 idx,uint32_t durMs)
-{
- /* sanity check caller's param */
- if(idx > 7)
- return CTR_InvalidParamValue;
- /* get latest tx frame */
- CtreCanNode::txTask<PcmControlSetOneShotDur_t> toFill = GetTx<PcmControlSetOneShotDur_t>(CONTROL_3 | GetDeviceNumber());
- if(toFill.IsEmpty()){
- /* only send this out if caller wants to do one-shots */
- RegisterTx(CONTROL_3 | _deviceNumber, kCANPeriod);
- /* grab it */
- toFill = GetTx<PcmControlSetOneShotDur_t>(CONTROL_3 | GetDeviceNumber());
- }
- toFill->sol10MsPerUnit[idx] = std::min(durMs/10,(uint32_t)0xFF);
- /* apply the new data bytes */
- FlushTx(toFill);
- return CTR_OKAY;
-}
-
-/* Get solenoid state
- *
- * @Return - True/False - True if solenoid enabled, false otherwise
- *
- * @Param - idx - ID of solenoid (0-7) to return status of
- */
-CTR_Code PCM::GetSolenoid(UINT8 idx, bool &status)
-{
- GET_PCM_STATUS();
- status = (rx->SolenoidBits & (1ul<<(idx)) ) ? 1 : 0;
- return rx.err;
-}
-
-/* Get solenoid state for all solenoids on the PCM
- *
- * @Return - Bitfield of solenoid states
- */
-CTR_Code PCM::GetAllSolenoids(UINT8 &status)
-{
- GET_PCM_STATUS();
- status = rx->SolenoidBits;
- return rx.err;
-}
-
-/* Get pressure switch state
- *
- * @Return - True/False - True if pressure adequate, false if low
- */
-CTR_Code PCM::GetPressure(bool &status)
-{
- GET_PCM_STATUS();
- status = (rx->pressureSwitchEn ) ? 1 : 0;
- return rx.err;
-}
-
-/* Get compressor state
- *
- * @Return - True/False - True if enabled, false if otherwise
- */
-CTR_Code PCM::GetCompressor(bool &status)
-{
- GET_PCM_STATUS();
- status = (rx->compressorOn);
- return rx.err;
-}
-
-/* Get closed loop control state
- *
- * @Return - True/False - True if closed loop enabled, false if otherwise
- */
-CTR_Code PCM::GetClosedLoopControl(bool &status)
-{
- GET_PCM_STATUS();
- status = (rx->isCloseloopEnabled);
- return rx.err;
-}
-
-/* Get compressor current draw
- *
- * @Return - Amperes - Compressor current
- */
-CTR_Code PCM::GetCompressorCurrent(float &status)
-{
- GET_PCM_STATUS();
- uint32_t temp =(rx->compressorCurrentTop6);
- temp <<= 4;
- temp |= rx->compressorCurrentBtm4;
- status = temp * 0.03125; /* 5.5 fixed pt value in Amps */
- return rx.err;
-}
-
-/* Get voltage across solenoid rail
- *
- * @Return - Volts - Voltage across solenoid rail
- */
-CTR_Code PCM::GetSolenoidVoltage(float &status)
-{
- GET_PCM_STATUS();
- uint32_t raw =(rx->solenoidVoltageTop8);
- raw <<= 2;
- raw |= rx->solenoidVoltageBtm2;
- status = (double) raw * 0.03125; /* 5.5 fixed pt value in Volts */
- return rx.err;
-}
-
-/* Get hardware fault value
- *
- * @Return - True/False - True if hardware failure detected, false if otherwise
- */
-CTR_Code PCM::GetHardwareFault(bool &status)
-{
- GET_PCM_STATUS();
- status = rx->faultHardwareFailure;
- return rx.err;
-}
-
-/* Get compressor fault value
- *
- * @Return - True/False - True if shorted compressor detected, false if otherwise
- */
-CTR_Code PCM::GetCompressorCurrentTooHighFault(bool &status)
-{
- GET_PCM_STATUS();
- status = rx->faultCompCurrentTooHigh;
- return rx.err;
-}
-CTR_Code PCM::GetCompressorShortedStickyFault(bool &status)
-{
- GET_PCM_STATUS();
- status = rx->StickyFault_dItooHigh;
- return rx.err;
-}
-CTR_Code PCM::GetCompressorShortedFault(bool &status)
-{
- GET_PCM_STATUS();
- status = rx->Fault_dItooHigh;
- return rx.err;
-}
-CTR_Code PCM::GetCompressorNotConnectedStickyFault(bool &status)
-{
- GET_PCM_SOL_FAULTS();
- status = rx->StickyFault_CompNoCurrent;
- return rx.err;
-}
-CTR_Code PCM::GetCompressorNotConnectedFault(bool &status)
-{
- GET_PCM_SOL_FAULTS();
- status = rx->Fault_CompNoCurrent;
- return rx.err;
-}
-
-/* Get solenoid fault value
- *
- * @Return - True/False - True if shorted solenoid detected, false if otherwise
- */
-CTR_Code PCM::GetSolenoidFault(bool &status)
-{
- GET_PCM_STATUS();
- status = rx->faultFuseTripped;
- return rx.err;
-}
-
-/* Get compressor sticky fault value
- *
- * @Return - True/False - True if solenoid had previously been shorted
- * (and sticky fault was not cleared), false if otherwise
- */
-CTR_Code PCM::GetCompressorCurrentTooHighStickyFault(bool &status)
-{
- GET_PCM_STATUS();
- status = rx->stickyFaultCompCurrentTooHigh;
- return rx.err;
-}
-
-/* Get solenoid sticky fault value
- *
- * @Return - True/False - True if compressor had previously been shorted
- * (and sticky fault was not cleared), false if otherwise
- */
-CTR_Code PCM::GetSolenoidStickyFault(bool &status)
-{
- GET_PCM_STATUS();
- status = rx->stickyFaultFuseTripped;
- return rx.err;
-}
-/* Get battery voltage
- *
- * @Return - Volts - Voltage across PCM power ports
- */
-CTR_Code PCM::GetBatteryVoltage(float &status)
-{
- GET_PCM_STATUS();
- status = (float)rx->battVoltage * 0.05 + 4.0; /* 50mV per unit plus 4V. */
- return rx.err;
-}
-/* Return status of module enable/disable
- *
- * @Return - bool - Returns TRUE if PCM is enabled, FALSE if disabled
- */
-CTR_Code PCM::isModuleEnabled(bool &status)
-{
- GET_PCM_STATUS();
- status = rx->moduleEnabled;
- return rx.err;
-}
-/* Get number of total failed PCM Control Frame
- *
- * @Return - Failed Control Frames - Number of failed control frames (tokenization fails)
- *
- * @WARNING - Return only valid if [SeekDebugFrames] is enabled
- * See function SeekDebugFrames
- * See function EnableSeekDebugFrames
- */
-CTR_Code PCM::GetNumberOfFailedControlFrames(UINT16 &status)
-{
- GET_PCM_DEBUG();
- status = rx->tokFailsTop8;
- status <<= 8;
- status |= rx->tokFailsBtm8;
- return rx.err;
-}
-/* Get raw Solenoid Blacklist
- *
- * @Return - BINARY - Raw binary breakdown of Solenoid Blacklist
- * BIT7 = Solenoid 1, BIT6 = Solenoid 2, etc.
- *
- * @WARNING - Return only valid if [SeekStatusFaultFrames] is enabled
- * See function SeekStatusFaultFrames
- * See function EnableSeekStatusFaultFrames
- */
-CTR_Code PCM::GetSolenoidBlackList(UINT8 &status)
-{
- GET_PCM_SOL_FAULTS();
- status = rx->SolenoidBlacklist;
- return rx.err;
-}
-/* Get solenoid Blacklist status
- * - Blacklisted solenoids cannot be enabled until PCM is power cycled
- *
- * @Return - True/False - True if Solenoid is blacklisted, false if otherwise
- *
- * @Param - idx - ID of solenoid [0,7]
- *
- * @WARNING - Return only valid if [SeekStatusFaultFrames] is enabled
- * See function SeekStatusFaultFrames
- * See function EnableSeekStatusFaultFrames
- */
-CTR_Code PCM::IsSolenoidBlacklisted(UINT8 idx, bool &status)
-{
- GET_PCM_SOL_FAULTS();
- status = (rx->SolenoidBlacklist & (1ul<<(idx)) )? 1 : 0;
- return rx.err;
-}
-//------------------ C interface --------------------------------------------//
-extern "C" {
- void * c_PCM_Init(void) {
- return new PCM();
- }
- CTR_Code c_SetSolenoid(void * handle, unsigned char idx, INT8 param) {
- return ((PCM*) handle)->SetSolenoid(idx, param);
- }
- CTR_Code c_SetAllSolenoids(void * handle, UINT8 state) {
- return ((PCM*) handle)->SetAllSolenoids(state);
- }
- CTR_Code c_SetClosedLoopControl(void * handle, INT8 param) {
- return ((PCM*) handle)->SetClosedLoopControl(param);
- }
- CTR_Code c_ClearStickyFaults(void * handle, INT8 param) {
- return ((PCM*) handle)->ClearStickyFaults();
- }
- CTR_Code c_GetSolenoid(void * handle, UINT8 idx, INT8 * status) {
- bool bstatus;
- CTR_Code retval = ((PCM*) handle)->GetSolenoid(idx, bstatus);
- *status = bstatus;
- return retval;
- }
- CTR_Code c_GetAllSolenoids(void * handle, UINT8 * status) {
- return ((PCM*) handle)->GetAllSolenoids(*status);
- }
- CTR_Code c_GetPressure(void * handle, INT8 * status) {
- bool bstatus;
- CTR_Code retval = ((PCM*) handle)->GetPressure(bstatus);
- *status = bstatus;
- return retval;
- }
- CTR_Code c_GetCompressor(void * handle, INT8 * status) {
- bool bstatus;
- CTR_Code retval = ((PCM*) handle)->GetCompressor(bstatus);
- *status = bstatus;
- return retval;
- }
- CTR_Code c_GetClosedLoopControl(void * handle, INT8 * status) {
- bool bstatus;
- CTR_Code retval = ((PCM*) handle)->GetClosedLoopControl(bstatus);
- *status = bstatus;
- return retval;
- }
- CTR_Code c_GetCompressorCurrent(void * handle, float * status) {
- CTR_Code retval = ((PCM*) handle)->GetCompressorCurrent(*status);
- return retval;
- }
- CTR_Code c_GetSolenoidVoltage(void * handle, float*status) {
- return ((PCM*) handle)->GetSolenoidVoltage(*status);
- }
- CTR_Code c_GetHardwareFault(void * handle, INT8*status) {
- bool bstatus;
- CTR_Code retval = ((PCM*) handle)->GetHardwareFault(bstatus);
- *status = bstatus;
- return retval;
- }
- CTR_Code c_GetCompressorFault(void * handle, INT8*status) {
- bool bstatus;
- CTR_Code retval = ((PCM*) handle)->GetCompressorCurrentTooHighFault(bstatus);
- *status = bstatus;
- return retval;
- }
- CTR_Code c_GetSolenoidFault(void * handle, INT8*status) {
- bool bstatus;
- CTR_Code retval = ((PCM*) handle)->GetSolenoidFault(bstatus);
- *status = bstatus;
- return retval;
- }
- CTR_Code c_GetCompressorStickyFault(void * handle, INT8*status) {
- bool bstatus;
- CTR_Code retval = ((PCM*) handle)->GetCompressorCurrentTooHighStickyFault(bstatus);
- *status = bstatus;
- return retval;
- }
- CTR_Code c_GetSolenoidStickyFault(void * handle, INT8*status) {
- bool bstatus;
- CTR_Code retval = ((PCM*) handle)->GetSolenoidStickyFault(bstatus);
- *status = bstatus;
- return retval;
- }
- CTR_Code c_GetBatteryVoltage(void * handle, float*status) {
- CTR_Code retval = ((PCM*) handle)->GetBatteryVoltage(*status);
- return retval;
- }
- void c_SetDeviceNumber_PCM(void * handle, UINT8 deviceNumber) {
- }
- CTR_Code c_GetNumberOfFailedControlFrames(void * handle, UINT16*status) {
- return ((PCM*) handle)->GetNumberOfFailedControlFrames(*status);
- }
- CTR_Code c_GetSolenoidBlackList(void * handle, UINT8 *status) {
- return ((PCM*) handle)->GetSolenoidBlackList(*status);
- }
- CTR_Code c_IsSolenoidBlacklisted(void * handle, UINT8 idx, INT8*status) {
- bool bstatus;
- CTR_Code retval = ((PCM*) handle)->IsSolenoidBlacklisted(idx, bstatus);
- *status = bstatus;
- return retval;
- }
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/ctre/PDP.cpp b/third_party/allwpilib_2017/hal/lib/athena/ctre/PDP.cpp
deleted file mode 100644
index 127b1dc..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/ctre/PDP.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-#include "ctre/PDP.h"
-#include "FRC_NetworkCommunication/CANSessionMux.h" //CAN Comm
-#include <string.h> // memset
-
-#define STATUS_1 0x8041400
-#define STATUS_2 0x8041440
-#define STATUS_3 0x8041480
-#define STATUS_ENERGY 0x8041740
-
-#define CONTROL_1 0x08041C00 /* PDP_Control_ClearStats */
-
-#define EXPECTED_RESPONSE_TIMEOUT_MS (50)
-#define GET_STATUS1() CtreCanNode::recMsg<PdpStatus1_t> rx = GetRx<PdpStatus1_t>(STATUS_1|GetDeviceNumber(),EXPECTED_RESPONSE_TIMEOUT_MS)
-#define GET_STATUS2() CtreCanNode::recMsg<PdpStatus2_t> rx = GetRx<PdpStatus2_t>(STATUS_2|GetDeviceNumber(),EXPECTED_RESPONSE_TIMEOUT_MS)
-#define GET_STATUS3() CtreCanNode::recMsg<PdpStatus3_t> rx = GetRx<PdpStatus3_t>(STATUS_3|GetDeviceNumber(),EXPECTED_RESPONSE_TIMEOUT_MS)
-#define GET_STATUS_ENERGY() CtreCanNode::recMsg<PDP_Status_Energy_t> rx = GetRx<PDP_Status_Energy_t>(STATUS_ENERGY|GetDeviceNumber(),EXPECTED_RESPONSE_TIMEOUT_MS)
-
-/* encoder/decoders */
-typedef struct _PdpStatus1_t{
- unsigned chan1_h8:8;
- unsigned chan2_h6:6;
- unsigned chan1_l2:2;
- unsigned chan3_h4:4;
- unsigned chan2_l4:4;
- unsigned chan4_h2:2;
- unsigned chan3_l6:6;
- unsigned chan4_l8:8;
- unsigned chan5_h8:8;
- unsigned chan6_h6:6;
- unsigned chan5_l2:2;
- unsigned reserved4:4;
- unsigned chan6_l4:4;
-}PdpStatus1_t;
-typedef struct _PdpStatus2_t{
- unsigned chan7_h8:8;
- unsigned chan8_h6:6;
- unsigned chan7_l2:2;
- unsigned chan9_h4:4;
- unsigned chan8_l4:4;
- unsigned chan10_h2:2;
- unsigned chan9_l6:6;
- unsigned chan10_l8:8;
- unsigned chan11_h8:8;
- unsigned chan12_h6:6;
- unsigned chan11_l2:2;
- unsigned reserved4:4;
- unsigned chan12_l4:4;
-}PdpStatus2_t;
-typedef struct _PdpStatus3_t{
- unsigned chan13_h8:8;
- unsigned chan14_h6:6;
- unsigned chan13_l2:2;
- unsigned chan15_h4:4;
- unsigned chan14_l4:4;
- unsigned chan16_h2:2;
- unsigned chan15_l6:6;
- unsigned chan16_l8:8;
- unsigned internalResBattery_mOhms:8;
- unsigned busVoltage:8;
- unsigned temp:8;
-}PdpStatus3_t;
-typedef struct _PDP_Status_Energy_t {
- unsigned TmeasMs_likelywillbe20ms_:8;
- unsigned TotalCurrent_125mAperunit_h8:8;
- unsigned Power_125mWperunit_h4:4;
- unsigned TotalCurrent_125mAperunit_l4:4;
- unsigned Power_125mWperunit_m8:8;
- unsigned Energy_125mWPerUnitXTmeas_h4:4;
- unsigned Power_125mWperunit_l4:4;
- unsigned Energy_125mWPerUnitXTmeas_mh8:8;
- unsigned Energy_125mWPerUnitXTmeas_ml8:8;
- unsigned Energy_125mWPerUnitXTmeas_l8:8;
-} PDP_Status_Energy_t ;
-
-PDP::PDP(UINT8 deviceNumber): CtreCanNode(deviceNumber)
-{
- RegisterRx(STATUS_1 | deviceNumber );
- RegisterRx(STATUS_2 | deviceNumber );
- RegisterRx(STATUS_3 | deviceNumber );
-}
-/* PDP D'tor
- */
-PDP::~PDP()
-{
-}
-
-CTR_Code PDP::GetChannelCurrent(UINT8 idx, double ¤t)
-{
- CTR_Code retval = CTR_InvalidParamValue;
- uint32_t raw = 0;
-
- if(idx <= 5){
- GET_STATUS1();
- retval = rx.err;
- switch(idx){
- case 0: raw = ((uint32_t)rx->chan1_h8 << 2) | rx->chan1_l2; break;
- case 1: raw = ((uint32_t)rx->chan2_h6 << 4) | rx->chan2_l4; break;
- case 2: raw = ((uint32_t)rx->chan3_h4 << 6) | rx->chan3_l6; break;
- case 3: raw = ((uint32_t)rx->chan4_h2 << 8) | rx->chan4_l8; break;
- case 4: raw = ((uint32_t)rx->chan5_h8 << 2) | rx->chan5_l2; break;
- case 5: raw = ((uint32_t)rx->chan6_h6 << 4) | rx->chan6_l4; break;
- default: retval = CTR_InvalidParamValue; break;
- }
- }else if(idx <= 11){
- GET_STATUS2();
- retval = rx.err;
- switch(idx){
- case 6: raw = ((uint32_t)rx->chan7_h8 << 2) | rx->chan7_l2; break;
- case 7: raw = ((uint32_t)rx->chan8_h6 << 4) | rx->chan8_l4; break;
- case 8: raw = ((uint32_t)rx->chan9_h4 << 6) | rx->chan9_l6; break;
- case 9: raw = ((uint32_t)rx->chan10_h2 << 8) | rx->chan10_l8; break;
- case 10: raw = ((uint32_t)rx->chan11_h8 << 2) | rx->chan11_l2; break;
- case 11: raw = ((uint32_t)rx->chan12_h6 << 4) | rx->chan12_l4; break;
- default: retval = CTR_InvalidParamValue; break;
- }
- }else if(idx <= 15){
- GET_STATUS3();
- retval = rx.err;
- switch(idx){
- case 12: raw = ((uint32_t)rx->chan13_h8 << 2) | rx->chan13_l2; break;
- case 13: raw = ((uint32_t)rx->chan14_h6 << 4) | rx->chan14_l4; break;
- case 14: raw = ((uint32_t)rx->chan15_h4 << 6) | rx->chan15_l6; break;
- case 15: raw = ((uint32_t)rx->chan16_h2 << 8) | rx->chan16_l8; break;
- default: retval = CTR_InvalidParamValue; break;
- }
- }
- /* convert to amps */
- current = (double)raw * 0.125; /* 7.3 fixed pt value in Amps */
- /* signal caller with success */
- return retval;
-}
-CTR_Code PDP::GetVoltage(double &voltage)
-{
- GET_STATUS3();
- uint32_t raw = rx->busVoltage;
- voltage = (double)raw * 0.05 + 4.0; /* 50mV per unit plus 4V. */;
- return rx.err;
-}
-CTR_Code PDP::GetTemperature(double &tempC)
-{
- GET_STATUS3();
- uint32_t raw = rx->temp;
- tempC = (double)raw * 1.03250836957542 - 67.8564500484966;
- return rx.err;
-}
-CTR_Code PDP::GetTotalCurrent(double ¤tAmps)
-{
- GET_STATUS_ENERGY();
- uint32_t raw;
- raw = rx->TotalCurrent_125mAperunit_h8;
- raw <<= 4;
- raw |= rx->TotalCurrent_125mAperunit_l4;
- currentAmps = 0.125 * raw;
- return rx.err;
-}
-CTR_Code PDP::GetTotalPower(double &powerWatts)
-{
- GET_STATUS_ENERGY();
- uint32_t raw;
- raw = rx->Power_125mWperunit_h4;
- raw <<= 8;
- raw |= rx->Power_125mWperunit_m8;
- raw <<= 4;
- raw |= rx->Power_125mWperunit_l4;
- powerWatts = 0.125 * raw;
- return rx.err;
-}
-CTR_Code PDP::GetTotalEnergy(double &energyJoules)
-{
- GET_STATUS_ENERGY();
- uint32_t raw;
- raw = rx->Energy_125mWPerUnitXTmeas_h4;
- raw <<= 8;
- raw |= rx->Energy_125mWPerUnitXTmeas_mh8;
- raw <<= 8;
- raw |= rx->Energy_125mWPerUnitXTmeas_ml8;
- raw <<= 8;
- raw |= rx->Energy_125mWPerUnitXTmeas_l8;
- energyJoules = 0.125 * raw; /* mW integrated every TmeasMs */
- energyJoules *= 0.001; /* convert from mW to W */
- energyJoules *= rx->TmeasMs_likelywillbe20ms_; /* multiplied by TmeasMs = joules */
- return rx.err;
-}
-/* Clear sticky faults.
- * @Return - CTR_Code - Error code (if any)
- */
-CTR_Code PDP::ClearStickyFaults()
-{
- int32_t status = 0;
- uint8_t pdpControl[] = { 0x80 }; /* only bit set is ClearStickyFaults */
- FRC_NetworkCommunication_CANSessionMux_sendMessage(CONTROL_1 | GetDeviceNumber(), pdpControl, sizeof(pdpControl), 0, &status);
- if(status)
- return CTR_TxFailed;
- return CTR_OKAY;
-}
-
-/* Reset Energy Signals
- * @Return - CTR_Code - Error code (if any)
- */
-CTR_Code PDP::ResetEnergy()
-{
- int32_t status = 0;
- uint8_t pdpControl[] = { 0x40 }; /* only bit set is ResetEnergy */
- FRC_NetworkCommunication_CANSessionMux_sendMessage(CONTROL_1 | GetDeviceNumber(), pdpControl, sizeof(pdpControl), 0, &status);
- if(status)
- return CTR_TxFailed;
- return CTR_OKAY;
-}
-//------------------ C interface --------------------------------------------//
-extern "C" {
- void * c_PDP_Init(void)
- {
- return new PDP();
- }
- CTR_Code c_GetChannelCurrent(void * handle,UINT8 idx, double *status)
- {
- return ((PDP*)handle)-> GetChannelCurrent(idx,*status);
- }
- CTR_Code c_GetVoltage(void * handle,double *status)
- {
- return ((PDP*)handle)-> GetVoltage(*status);
- }
- CTR_Code c_GetTemperature(void * handle,double *status)
- {
- return ((PDP*)handle)-> GetTemperature(*status);
- }
- void c_SetDeviceNumber_PDP(void * handle,UINT8 deviceNumber)
- {
- }
-}
diff --git a/third_party/allwpilib_2017/hal/lib/athena/frccansae/CANDeviceInterface.h b/third_party/allwpilib_2017/hal/lib/athena/frccansae/CANDeviceInterface.h
deleted file mode 100644
index 62a38cb..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/frccansae/CANDeviceInterface.h
+++ /dev/null
@@ -1,156 +0,0 @@
-#ifndef __CAN_DEVICE_INTERFACE_H__
-#define __CAN_DEVICE_INTERFACE_H__
-
-#define MAX_STRING_LEN 64
-
-#define SUPPORT_UNIQUE_ID (1) /* depends entirely on old vs new build */
-#define USE_NTH_ORDER (0) /* zero to user deviceId */
-#define SUPPORT_MOTOR_CONTROLLER_PROFILE (1)
-namespace CANDeviceInterface1
-{
-
-struct PIDSlot
-{
- // Proportional gain
- float pGain;
- // Integral gain
- float iGain;
- // Differential gain
- float dGain;
- // Feed-forward gain
- float fGain;
- // Integral zone
- float iZone;
- // Closed-loop ramp rate
- float clRampRate;
-};
-
-struct DeviceDescriptor
-{
- // The full device ID, including the device number, manufacturer, and device type.
- // The mask of a message the device supports is 0x1FFF003F.
- unsigned int deviceID;
-#if SUPPORT_UNIQUE_ID != 0
- // This is the ID that uniquely identifies the device node in the UI.
- // The purpose of this is to be able to track the device across renames or deviceID changes.
- unsigned int uniqueID;
-#endif
- // An dynamically assigned ID that will make setting deviceIDs robust,
- // Never again will you need to isolate a CAN node just to fix it's ID.
- unsigned int dynamicID;
- // User visible name. This can be customized by the user, but should have a
- // reasonable default.
- char name[MAX_STRING_LEN];
- // This is a user visible model name that should match the can_devices.ini section.
- char model[MAX_STRING_LEN];
- // This is a version number that represents the version of firmware currently
- // installed on the device.
- char currentVersion[MAX_STRING_LEN];
- // Hardware revision.
- char hardwareRev[MAX_STRING_LEN];
- // Bootloader version. Will not change for the life of the product, but additional
- // field upgrade features could be added in newer hardware.
- char bootloaderRev[MAX_STRING_LEN];
- // Manufacture Date. Could be a calender date or just the FRC season year.
- // Also helps troubleshooting "old ones" vs "new ones".
- char manufactureDate[MAX_STRING_LEN];
- // General status of the hardware. For example if the device is in bootloader
- // due to a bad flash UI could emphasize that.
- char softwareStatus[MAX_STRING_LEN];
- // Is the LED currently on?
- bool led;
- // Reserved fields for future use by CTRE. Not touched by frccansae
- unsigned int dynFlags;
- unsigned int flags; /* bitfield */
- unsigned int ptrToString;
- //unsigned int reserved0;
- //unsigned int reserved1;
- //unsigned int reserved2;
-#if SUPPORT_MOTOR_CONTROLLER_PROFILE != 0
- // Motor controller properties (ignored if SupportsMotorControllerProperties is false or unset for this model)
- unsigned int brakeMode; // 0=Coast, 1=Brake
- unsigned int limitSwitchFwdMode; // 0=disabled, 1=Normally Closed, 2=Normally Open
- unsigned int limitSwitchRevMode; // 0=disabled, 1=Normally Closed, 2=Normally Open
- // Limit-switch soft limits
- bool bFwdSoftLimitEnable;
- bool bRevSoftLimitEnable;
- float softLimitFwd;
- float softLimitRev;
- // PID constants for slot 0
- struct PIDSlot slot0;
- // PID constants for slot 1
- struct PIDSlot slot1;
-#endif
-};
-
-#define kLimitSwitchMode_Disabled (0)
-#define kLimitSwitchMode_NormallyClosed (1)
-#define kLimitSwitchMode_NormallyOpen (2)
-
-// Interface functions that must be implemented by the CAN Firmware Update Library
-
-// Returns the number of devices that will be returned in a call to
-// getListOfDevices(). The calling library will use this info to allocate enough
-// memory to accept all device info.
-int getNumberOfDevices();
-
-// Return info about discovered devices. The array of structs should be
-// populated before returning. The numDescriptors input describes how many
-// elements were allocated to prevent memory corruption. The number of devices
-// populated should be returned from this function as well.
-int getListOfDevices(DeviceDescriptor *devices, int numDescriptors);
-
-// When the user requests to update the firmware of a device a thread will be
-// spawned and this function is called from that thread. This function should
-// complete the firmware update process before returning. The image
-// contents and size are directly from the file selected by the user. The
-// error message string can be filled with a NULL-terminated message to show the
-// user if there was a problem updating firmware. The error message is only
-// displayed if a non-zero value is returned from this function.
-int updateFirmware(const DeviceDescriptor *device, const unsigned char *imageContents, unsigned int imageSize, char *errorMessage, int errorMessageMaxSize);
-
-// This function is called periodically from the UI thread while the firmware
-// update is in progress. The percentComplete parameter should the filled in
-// with the current progress of the firmware update process to update a progress
-// bar in the UI.
-void checkUpdateProgress(const DeviceDescriptor *device, int *percentComplete);
-
-// This is called when the user selects a new ID to assign on the bus and
-// chooses to save. The newDeviceID is really just the device number. The
-// manufacturer and device type will remain unchanged. If a problem is detected
-// when assigning a new ID, this function should return a non-zero value.
-int assignBroadcastDeviceID(unsigned int newDeviceID);
-// The device descriptor should be updated with the new device ID. The name may
-// also change in the descriptor and will be updated in the UI immediately.
-// Be sure to modify the descriptor first since the refresh from the UI is
-// asynchronous.
-int assignDeviceID(DeviceDescriptor *device, unsigned int newDeviceID);
-
-// This entry-point will get called when the user chooses to change the value
-// of the device's LED. This will allow the user to identify devices which
-// support dynamic addresses or are otherwise unknown. If this function returns
-// a non-zero value, the UI will report an error.
-int saveLightLed(const DeviceDescriptor *device, bool newLEDStatus);
-
-// This entry-point will get called when the user chooses to change the alias
-// of the device with the device specified. If this function returns a non-
-// zero value, the UI will report an error. The device descriptor must be
-// updated with the new name that was selected. If a different name is saved
-// to the descriptor than the user specified, this will require a manual
-// refresh by the user. This is reported as CAR #505139
-int saveDeviceName(DeviceDescriptor *device, const char *newName);
-
-// This entry-point will get called when the user changes any of the motor
-// controller specific properties. If this function returns a non-zero value,
-// the UI will report an error. The device descriptor may be updated with
-// coerced values.
-int saveMotorParameters(DeviceDescriptor *device);
-
-// Run some sort of self-test functionality on the device. This can be anything
-// and the results will be displayed to the user. A non-zero return value
-// indicates an error.
-int selfTest(const DeviceDescriptor *device, char *detailedResults, int detailedResultsMaxSize);
-
-} /* CANDeviceInterface */
-
-#endif /* __CAN_DEVICE_INTERFACE_H__ */
diff --git a/third_party/allwpilib_2017/hal/lib/athena/visa/visa.h b/third_party/allwpilib_2017/hal/lib/athena/visa/visa.h
deleted file mode 100644
index 3c6ad30..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/visa/visa.h
+++ /dev/null
@@ -1,1064 +0,0 @@
-/*---------------------------------------------------------------------------*/
-/* Distributed by IVI Foundation Inc. */
-/* Contains National Instruments extensions. */
-/* Do not modify the contents of this file. */
-/*---------------------------------------------------------------------------*/
-/* */
-/* Title : VISA.H */
-/* Date : 10-09-2006 */
-/* Purpose : Include file for the VISA Library 4.0 specification */
-/* */
-/*---------------------------------------------------------------------------*/
-/* When using NI-VISA extensions, you must link with the VISA library that */
-/* comes with NI-VISA. Currently, the extensions provided by NI-VISA are: */
-/* */
-/* PXI (Compact PCI eXtensions for Instrumentation) and PCI support. To use */
-/* this, you must define the macro NIVISA_PXI before including this header. */
-/* You must also create an INF file with the VISA Driver Development Wizard. */
-/* */
-/* A fast set of macros for viPeekXX/viPokeXX that guarantees binary */
-/* compatibility with other implementations of VISA. To use this, you must */
-/* define the macro NIVISA_PEEKPOKE before including this header. */
-/* */
-/* Support for USB devices that do not conform to a specific class. To use */
-/* this, you must define the macro NIVISA_USB before including this header. */
-/* You must also create an INF file with the VISA Driver Development Wizard. */
-/*---------------------------------------------------------------------------*/
-
-#ifndef __VISA_HEADER__
-#define __VISA_HEADER__
-
-#include <stdarg.h>
-
-#if !defined(__VISATYPE_HEADER__)
-#include "visatype.h"
-#endif
-
-#define VI_SPEC_VERSION (0x00400000UL)
-
-#if defined(__cplusplus) || defined(__cplusplus__)
- extern "C" {
-#endif
-
-#if defined(_CVI_)
-#pragma EnableLibraryRuntimeChecking
-#endif
-
-/*- VISA Types --------------------------------------------------------------*/
-
-typedef ViObject ViEvent;
-typedef ViEvent _VI_PTR ViPEvent;
-typedef ViObject ViFindList;
-typedef ViFindList _VI_PTR ViPFindList;
-
-#if defined(_VI_INT64_UINT64_DEFINED) && defined(_VISA_ENV_IS_64_BIT)
-typedef ViUInt64 ViBusAddress;
-typedef ViUInt64 ViBusSize;
-typedef ViUInt64 ViAttrState;
-#else
-typedef ViUInt32 ViBusAddress;
-typedef ViUInt32 ViBusSize;
-typedef ViUInt32 ViAttrState;
-#endif
-
-#if defined(_VI_INT64_UINT64_DEFINED)
-typedef ViUInt64 ViBusAddress64;
-typedef ViBusAddress64 _VI_PTR ViPBusAddress64;
-#endif
-
-typedef ViUInt32 ViEventType;
-typedef ViEventType _VI_PTR ViPEventType;
-typedef ViEventType _VI_PTR ViAEventType;
-typedef void _VI_PTR ViPAttrState;
-typedef ViAttr _VI_PTR ViPAttr;
-typedef ViAttr _VI_PTR ViAAttr;
-
-typedef ViString ViKeyId;
-typedef ViPString ViPKeyId;
-typedef ViUInt32 ViJobId;
-typedef ViJobId _VI_PTR ViPJobId;
-typedef ViUInt32 ViAccessMode;
-typedef ViAccessMode _VI_PTR ViPAccessMode;
-typedef ViBusAddress _VI_PTR ViPBusAddress;
-typedef ViUInt32 ViEventFilter;
-
-typedef va_list ViVAList;
-
-typedef ViStatus (_VI_FUNCH _VI_PTR ViHndlr)
- (ViSession vi, ViEventType eventType, ViEvent event, ViAddr userHandle);
-
-/*- Resource Manager Functions and Operations -------------------------------*/
-
-ViStatus _VI_FUNC viOpenDefaultRM (ViPSession vi);
-ViStatus _VI_FUNC viFindRsrc (ViSession sesn, ViString expr, ViPFindList vi,
- ViPUInt32 retCnt, ViChar _VI_FAR desc[]);
-ViStatus _VI_FUNC viFindNext (ViFindList vi, ViChar _VI_FAR desc[]);
-ViStatus _VI_FUNC viParseRsrc (ViSession rmSesn, ViRsrc rsrcName,
- ViPUInt16 intfType, ViPUInt16 intfNum);
-ViStatus _VI_FUNC viParseRsrcEx (ViSession rmSesn, ViRsrc rsrcName, ViPUInt16 intfType,
- ViPUInt16 intfNum, ViChar _VI_FAR rsrcClass[],
- ViChar _VI_FAR expandedUnaliasedName[],
- ViChar _VI_FAR aliasIfExists[]);
-ViStatus _VI_FUNC viOpen (ViSession sesn, ViRsrc name, ViAccessMode mode,
- ViUInt32 timeout, ViPSession vi);
-
-/*- Resource Template Operations --------------------------------------------*/
-
-ViStatus _VI_FUNC viClose (ViObject vi);
-ViStatus _VI_FUNC viSetAttribute (ViObject vi, ViAttr attrName, ViAttrState attrValue);
-ViStatus _VI_FUNC viGetAttribute (ViObject vi, ViAttr attrName, void _VI_PTR attrValue);
-ViStatus _VI_FUNC viStatusDesc (ViObject vi, ViStatus status, ViChar _VI_FAR desc[]);
-ViStatus _VI_FUNC viTerminate (ViObject vi, ViUInt16 degree, ViJobId jobId);
-
-ViStatus _VI_FUNC viLock (ViSession vi, ViAccessMode lockType, ViUInt32 timeout,
- ViKeyId requestedKey, ViChar _VI_FAR accessKey[]);
-ViStatus _VI_FUNC viUnlock (ViSession vi);
-ViStatus _VI_FUNC viEnableEvent (ViSession vi, ViEventType eventType, ViUInt16 mechanism,
- ViEventFilter context);
-ViStatus _VI_FUNC viDisableEvent (ViSession vi, ViEventType eventType, ViUInt16 mechanism);
-ViStatus _VI_FUNC viDiscardEvents (ViSession vi, ViEventType eventType, ViUInt16 mechanism);
-ViStatus _VI_FUNC viWaitOnEvent (ViSession vi, ViEventType inEventType, ViUInt32 timeout,
- ViPEventType outEventType, ViPEvent outContext);
-ViStatus _VI_FUNC viInstallHandler(ViSession vi, ViEventType eventType, ViHndlr handler,
- ViAddr userHandle);
-ViStatus _VI_FUNC viUninstallHandler(ViSession vi, ViEventType eventType, ViHndlr handler,
- ViAddr userHandle);
-
-/*- Basic I/O Operations ----------------------------------------------------*/
-
-ViStatus _VI_FUNC viRead (ViSession vi, ViPBuf buf, ViUInt32 cnt, ViPUInt32 retCnt);
-ViStatus _VI_FUNC viReadAsync (ViSession vi, ViPBuf buf, ViUInt32 cnt, ViPJobId jobId);
-ViStatus _VI_FUNC viReadToFile (ViSession vi, ViConstString filename, ViUInt32 cnt,
- ViPUInt32 retCnt);
-ViStatus _VI_FUNC viWrite (ViSession vi, ViBuf buf, ViUInt32 cnt, ViPUInt32 retCnt);
-ViStatus _VI_FUNC viWriteAsync (ViSession vi, ViBuf buf, ViUInt32 cnt, ViPJobId jobId);
-ViStatus _VI_FUNC viWriteFromFile (ViSession vi, ViConstString filename, ViUInt32 cnt,
- ViPUInt32 retCnt);
-ViStatus _VI_FUNC viAssertTrigger (ViSession vi, ViUInt16 protocol);
-ViStatus _VI_FUNC viReadSTB (ViSession vi, ViPUInt16 status);
-ViStatus _VI_FUNC viClear (ViSession vi);
-
-/*- Formatted and Buffered I/O Operations -----------------------------------*/
-
-ViStatus _VI_FUNC viSetBuf (ViSession vi, ViUInt16 mask, ViUInt32 size);
-ViStatus _VI_FUNC viFlush (ViSession vi, ViUInt16 mask);
-
-ViStatus _VI_FUNC viBufWrite (ViSession vi, ViBuf buf, ViUInt32 cnt, ViPUInt32 retCnt);
-ViStatus _VI_FUNC viBufRead (ViSession vi, ViPBuf buf, ViUInt32 cnt, ViPUInt32 retCnt);
-
-ViStatus _VI_FUNCC viPrintf (ViSession vi, ViString writeFmt, ...);
-ViStatus _VI_FUNC viVPrintf (ViSession vi, ViString writeFmt, ViVAList params);
-ViStatus _VI_FUNCC viSPrintf (ViSession vi, ViPBuf buf, ViString writeFmt, ...);
-ViStatus _VI_FUNC viVSPrintf (ViSession vi, ViPBuf buf, ViString writeFmt,
- ViVAList parms);
-
-ViStatus _VI_FUNCC viScanf (ViSession vi, ViString readFmt, ...);
-ViStatus _VI_FUNC viVScanf (ViSession vi, ViString readFmt, ViVAList params);
-ViStatus _VI_FUNCC viSScanf (ViSession vi, ViBuf buf, ViString readFmt, ...);
-ViStatus _VI_FUNC viVSScanf (ViSession vi, ViBuf buf, ViString readFmt,
- ViVAList parms);
-
-ViStatus _VI_FUNCC viQueryf (ViSession vi, ViString writeFmt, ViString readFmt, ...);
-ViStatus _VI_FUNC viVQueryf (ViSession vi, ViString writeFmt, ViString readFmt,
- ViVAList params);
-
-/*- Memory I/O Operations ---------------------------------------------------*/
-
-ViStatus _VI_FUNC viIn8 (ViSession vi, ViUInt16 space,
- ViBusAddress offset, ViPUInt8 val8);
-ViStatus _VI_FUNC viOut8 (ViSession vi, ViUInt16 space,
- ViBusAddress offset, ViUInt8 val8);
-ViStatus _VI_FUNC viIn16 (ViSession vi, ViUInt16 space,
- ViBusAddress offset, ViPUInt16 val16);
-ViStatus _VI_FUNC viOut16 (ViSession vi, ViUInt16 space,
- ViBusAddress offset, ViUInt16 val16);
-ViStatus _VI_FUNC viIn32 (ViSession vi, ViUInt16 space,
- ViBusAddress offset, ViPUInt32 val32);
-ViStatus _VI_FUNC viOut32 (ViSession vi, ViUInt16 space,
- ViBusAddress offset, ViUInt32 val32);
-
-#if defined(_VI_INT64_UINT64_DEFINED)
-ViStatus _VI_FUNC viIn64 (ViSession vi, ViUInt16 space,
- ViBusAddress offset, ViPUInt64 val64);
-ViStatus _VI_FUNC viOut64 (ViSession vi, ViUInt16 space,
- ViBusAddress offset, ViUInt64 val64);
-
-ViStatus _VI_FUNC viIn8Ex (ViSession vi, ViUInt16 space,
- ViBusAddress64 offset, ViPUInt8 val8);
-ViStatus _VI_FUNC viOut8Ex (ViSession vi, ViUInt16 space,
- ViBusAddress64 offset, ViUInt8 val8);
-ViStatus _VI_FUNC viIn16Ex (ViSession vi, ViUInt16 space,
- ViBusAddress64 offset, ViPUInt16 val16);
-ViStatus _VI_FUNC viOut16Ex (ViSession vi, ViUInt16 space,
- ViBusAddress64 offset, ViUInt16 val16);
-ViStatus _VI_FUNC viIn32Ex (ViSession vi, ViUInt16 space,
- ViBusAddress64 offset, ViPUInt32 val32);
-ViStatus _VI_FUNC viOut32Ex (ViSession vi, ViUInt16 space,
- ViBusAddress64 offset, ViUInt32 val32);
-ViStatus _VI_FUNC viIn64Ex (ViSession vi, ViUInt16 space,
- ViBusAddress64 offset, ViPUInt64 val64);
-ViStatus _VI_FUNC viOut64Ex (ViSession vi, ViUInt16 space,
- ViBusAddress64 offset, ViUInt64 val64);
-#endif
-
-ViStatus _VI_FUNC viMoveIn8 (ViSession vi, ViUInt16 space, ViBusAddress offset,
- ViBusSize length, ViAUInt8 buf8);
-ViStatus _VI_FUNC viMoveOut8 (ViSession vi, ViUInt16 space, ViBusAddress offset,
- ViBusSize length, ViAUInt8 buf8);
-ViStatus _VI_FUNC viMoveIn16 (ViSession vi, ViUInt16 space, ViBusAddress offset,
- ViBusSize length, ViAUInt16 buf16);
-ViStatus _VI_FUNC viMoveOut16 (ViSession vi, ViUInt16 space, ViBusAddress offset,
- ViBusSize length, ViAUInt16 buf16);
-ViStatus _VI_FUNC viMoveIn32 (ViSession vi, ViUInt16 space, ViBusAddress offset,
- ViBusSize length, ViAUInt32 buf32);
-ViStatus _VI_FUNC viMoveOut32 (ViSession vi, ViUInt16 space, ViBusAddress offset,
- ViBusSize length, ViAUInt32 buf32);
-
-#if defined(_VI_INT64_UINT64_DEFINED)
-ViStatus _VI_FUNC viMoveIn64 (ViSession vi, ViUInt16 space, ViBusAddress offset,
- ViBusSize length, ViAUInt64 buf64);
-ViStatus _VI_FUNC viMoveOut64 (ViSession vi, ViUInt16 space, ViBusAddress offset,
- ViBusSize length, ViAUInt64 buf64);
-
-ViStatus _VI_FUNC viMoveIn8Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset,
- ViBusSize length, ViAUInt8 buf8);
-ViStatus _VI_FUNC viMoveOut8Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset,
- ViBusSize length, ViAUInt8 buf8);
-ViStatus _VI_FUNC viMoveIn16Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset,
- ViBusSize length, ViAUInt16 buf16);
-ViStatus _VI_FUNC viMoveOut16Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset,
- ViBusSize length, ViAUInt16 buf16);
-ViStatus _VI_FUNC viMoveIn32Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset,
- ViBusSize length, ViAUInt32 buf32);
-ViStatus _VI_FUNC viMoveOut32Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset,
- ViBusSize length, ViAUInt32 buf32);
-ViStatus _VI_FUNC viMoveIn64Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset,
- ViBusSize length, ViAUInt64 buf64);
-ViStatus _VI_FUNC viMoveOut64Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset,
- ViBusSize length, ViAUInt64 buf64);
-#endif
-
-ViStatus _VI_FUNC viMove (ViSession vi, ViUInt16 srcSpace, ViBusAddress srcOffset,
- ViUInt16 srcWidth, ViUInt16 destSpace,
- ViBusAddress destOffset, ViUInt16 destWidth,
- ViBusSize srcLength);
-ViStatus _VI_FUNC viMoveAsync (ViSession vi, ViUInt16 srcSpace, ViBusAddress srcOffset,
- ViUInt16 srcWidth, ViUInt16 destSpace,
- ViBusAddress destOffset, ViUInt16 destWidth,
- ViBusSize srcLength, ViPJobId jobId);
-
-#if defined(_VI_INT64_UINT64_DEFINED)
-ViStatus _VI_FUNC viMoveEx (ViSession vi, ViUInt16 srcSpace, ViBusAddress64 srcOffset,
- ViUInt16 srcWidth, ViUInt16 destSpace,
- ViBusAddress64 destOffset, ViUInt16 destWidth,
- ViBusSize srcLength);
-ViStatus _VI_FUNC viMoveAsyncEx (ViSession vi, ViUInt16 srcSpace, ViBusAddress64 srcOffset,
- ViUInt16 srcWidth, ViUInt16 destSpace,
- ViBusAddress64 destOffset, ViUInt16 destWidth,
- ViBusSize srcLength, ViPJobId jobId);
-#endif
-
-ViStatus _VI_FUNC viMapAddress (ViSession vi, ViUInt16 mapSpace, ViBusAddress mapOffset,
- ViBusSize mapSize, ViBoolean access,
- ViAddr suggested, ViPAddr address);
-ViStatus _VI_FUNC viUnmapAddress (ViSession vi);
-
-#if defined(_VI_INT64_UINT64_DEFINED)
-ViStatus _VI_FUNC viMapAddressEx (ViSession vi, ViUInt16 mapSpace, ViBusAddress64 mapOffset,
- ViBusSize mapSize, ViBoolean access,
- ViAddr suggested, ViPAddr address);
-#endif
-
-void _VI_FUNC viPeek8 (ViSession vi, ViAddr address, ViPUInt8 val8);
-void _VI_FUNC viPoke8 (ViSession vi, ViAddr address, ViUInt8 val8);
-void _VI_FUNC viPeek16 (ViSession vi, ViAddr address, ViPUInt16 val16);
-void _VI_FUNC viPoke16 (ViSession vi, ViAddr address, ViUInt16 val16);
-void _VI_FUNC viPeek32 (ViSession vi, ViAddr address, ViPUInt32 val32);
-void _VI_FUNC viPoke32 (ViSession vi, ViAddr address, ViUInt32 val32);
-
-#if defined(_VI_INT64_UINT64_DEFINED)
-void _VI_FUNC viPeek64 (ViSession vi, ViAddr address, ViPUInt64 val64);
-void _VI_FUNC viPoke64 (ViSession vi, ViAddr address, ViUInt64 val64);
-#endif
-
-/*- Shared Memory Operations ------------------------------------------------*/
-
-ViStatus _VI_FUNC viMemAlloc (ViSession vi, ViBusSize size, ViPBusAddress offset);
-ViStatus _VI_FUNC viMemFree (ViSession vi, ViBusAddress offset);
-
-#if defined(_VI_INT64_UINT64_DEFINED)
-ViStatus _VI_FUNC viMemAllocEx (ViSession vi, ViBusSize size, ViPBusAddress64 offset);
-ViStatus _VI_FUNC viMemFreeEx (ViSession vi, ViBusAddress64 offset);
-#endif
-
-/*- Interface Specific Operations -------------------------------------------*/
-
-ViStatus _VI_FUNC viGpibControlREN(ViSession vi, ViUInt16 mode);
-ViStatus _VI_FUNC viGpibControlATN(ViSession vi, ViUInt16 mode);
-ViStatus _VI_FUNC viGpibSendIFC (ViSession vi);
-ViStatus _VI_FUNC viGpibCommand (ViSession vi, ViBuf cmd, ViUInt32 cnt, ViPUInt32 retCnt);
-ViStatus _VI_FUNC viGpibPassControl(ViSession vi, ViUInt16 primAddr, ViUInt16 secAddr);
-
-ViStatus _VI_FUNC viVxiCommandQuery(ViSession vi, ViUInt16 mode, ViUInt32 cmd,
- ViPUInt32 response);
-ViStatus _VI_FUNC viAssertUtilSignal(ViSession vi, ViUInt16 line);
-ViStatus _VI_FUNC viAssertIntrSignal(ViSession vi, ViInt16 mode, ViUInt32 statusID);
-ViStatus _VI_FUNC viMapTrigger (ViSession vi, ViInt16 trigSrc, ViInt16 trigDest,
- ViUInt16 mode);
-ViStatus _VI_FUNC viUnmapTrigger (ViSession vi, ViInt16 trigSrc, ViInt16 trigDest);
-ViStatus _VI_FUNC viUsbControlOut (ViSession vi, ViInt16 bmRequestType, ViInt16 bRequest,
- ViUInt16 wValue, ViUInt16 wIndex, ViUInt16 wLength,
- ViBuf buf);
-ViStatus _VI_FUNC viUsbControlIn (ViSession vi, ViInt16 bmRequestType, ViInt16 bRequest,
- ViUInt16 wValue, ViUInt16 wIndex, ViUInt16 wLength,
- ViPBuf buf, ViPUInt16 retCnt);
-
-/*- Attributes (platform independent size) ----------------------------------*/
-
-#define VI_ATTR_RSRC_CLASS (0xBFFF0001UL)
-#define VI_ATTR_RSRC_NAME (0xBFFF0002UL)
-#define VI_ATTR_RSRC_IMPL_VERSION (0x3FFF0003UL)
-#define VI_ATTR_RSRC_LOCK_STATE (0x3FFF0004UL)
-#define VI_ATTR_MAX_QUEUE_LENGTH (0x3FFF0005UL)
-#define VI_ATTR_USER_DATA_32 (0x3FFF0007UL)
-#define VI_ATTR_FDC_CHNL (0x3FFF000DUL)
-#define VI_ATTR_FDC_MODE (0x3FFF000FUL)
-#define VI_ATTR_FDC_GEN_SIGNAL_EN (0x3FFF0011UL)
-#define VI_ATTR_FDC_USE_PAIR (0x3FFF0013UL)
-#define VI_ATTR_SEND_END_EN (0x3FFF0016UL)
-#define VI_ATTR_TERMCHAR (0x3FFF0018UL)
-#define VI_ATTR_TMO_VALUE (0x3FFF001AUL)
-#define VI_ATTR_GPIB_READDR_EN (0x3FFF001BUL)
-#define VI_ATTR_IO_PROT (0x3FFF001CUL)
-#define VI_ATTR_DMA_ALLOW_EN (0x3FFF001EUL)
-#define VI_ATTR_ASRL_BAUD (0x3FFF0021UL)
-#define VI_ATTR_ASRL_DATA_BITS (0x3FFF0022UL)
-#define VI_ATTR_ASRL_PARITY (0x3FFF0023UL)
-#define VI_ATTR_ASRL_STOP_BITS (0x3FFF0024UL)
-#define VI_ATTR_ASRL_FLOW_CNTRL (0x3FFF0025UL)
-#define VI_ATTR_RD_BUF_OPER_MODE (0x3FFF002AUL)
-#define VI_ATTR_RD_BUF_SIZE (0x3FFF002BUL)
-#define VI_ATTR_WR_BUF_OPER_MODE (0x3FFF002DUL)
-#define VI_ATTR_WR_BUF_SIZE (0x3FFF002EUL)
-#define VI_ATTR_SUPPRESS_END_EN (0x3FFF0036UL)
-#define VI_ATTR_TERMCHAR_EN (0x3FFF0038UL)
-#define VI_ATTR_DEST_ACCESS_PRIV (0x3FFF0039UL)
-#define VI_ATTR_DEST_BYTE_ORDER (0x3FFF003AUL)
-#define VI_ATTR_SRC_ACCESS_PRIV (0x3FFF003CUL)
-#define VI_ATTR_SRC_BYTE_ORDER (0x3FFF003DUL)
-#define VI_ATTR_SRC_INCREMENT (0x3FFF0040UL)
-#define VI_ATTR_DEST_INCREMENT (0x3FFF0041UL)
-#define VI_ATTR_WIN_ACCESS_PRIV (0x3FFF0045UL)
-#define VI_ATTR_WIN_BYTE_ORDER (0x3FFF0047UL)
-#define VI_ATTR_GPIB_ATN_STATE (0x3FFF0057UL)
-#define VI_ATTR_GPIB_ADDR_STATE (0x3FFF005CUL)
-#define VI_ATTR_GPIB_CIC_STATE (0x3FFF005EUL)
-#define VI_ATTR_GPIB_NDAC_STATE (0x3FFF0062UL)
-#define VI_ATTR_GPIB_SRQ_STATE (0x3FFF0067UL)
-#define VI_ATTR_GPIB_SYS_CNTRL_STATE (0x3FFF0068UL)
-#define VI_ATTR_GPIB_HS488_CBL_LEN (0x3FFF0069UL)
-#define VI_ATTR_CMDR_LA (0x3FFF006BUL)
-#define VI_ATTR_VXI_DEV_CLASS (0x3FFF006CUL)
-#define VI_ATTR_MAINFRAME_LA (0x3FFF0070UL)
-#define VI_ATTR_MANF_NAME (0xBFFF0072UL)
-#define VI_ATTR_MODEL_NAME (0xBFFF0077UL)
-#define VI_ATTR_VXI_VME_INTR_STATUS (0x3FFF008BUL)
-#define VI_ATTR_VXI_TRIG_STATUS (0x3FFF008DUL)
-#define VI_ATTR_VXI_VME_SYSFAIL_STATE (0x3FFF0094UL)
-#define VI_ATTR_WIN_BASE_ADDR_32 (0x3FFF0098UL)
-#define VI_ATTR_WIN_SIZE_32 (0x3FFF009AUL)
-#define VI_ATTR_ASRL_AVAIL_NUM (0x3FFF00ACUL)
-#define VI_ATTR_MEM_BASE_32 (0x3FFF00ADUL)
-#define VI_ATTR_ASRL_CTS_STATE (0x3FFF00AEUL)
-#define VI_ATTR_ASRL_DCD_STATE (0x3FFF00AFUL)
-#define VI_ATTR_ASRL_DSR_STATE (0x3FFF00B1UL)
-#define VI_ATTR_ASRL_DTR_STATE (0x3FFF00B2UL)
-#define VI_ATTR_ASRL_END_IN (0x3FFF00B3UL)
-#define VI_ATTR_ASRL_END_OUT (0x3FFF00B4UL)
-#define VI_ATTR_ASRL_REPLACE_CHAR (0x3FFF00BEUL)
-#define VI_ATTR_ASRL_RI_STATE (0x3FFF00BFUL)
-#define VI_ATTR_ASRL_RTS_STATE (0x3FFF00C0UL)
-#define VI_ATTR_ASRL_XON_CHAR (0x3FFF00C1UL)
-#define VI_ATTR_ASRL_XOFF_CHAR (0x3FFF00C2UL)
-#define VI_ATTR_WIN_ACCESS (0x3FFF00C3UL)
-#define VI_ATTR_RM_SESSION (0x3FFF00C4UL)
-#define VI_ATTR_VXI_LA (0x3FFF00D5UL)
-#define VI_ATTR_MANF_ID (0x3FFF00D9UL)
-#define VI_ATTR_MEM_SIZE_32 (0x3FFF00DDUL)
-#define VI_ATTR_MEM_SPACE (0x3FFF00DEUL)
-#define VI_ATTR_MODEL_CODE (0x3FFF00DFUL)
-#define VI_ATTR_SLOT (0x3FFF00E8UL)
-#define VI_ATTR_INTF_INST_NAME (0xBFFF00E9UL)
-#define VI_ATTR_IMMEDIATE_SERV (0x3FFF0100UL)
-#define VI_ATTR_INTF_PARENT_NUM (0x3FFF0101UL)
-#define VI_ATTR_RSRC_SPEC_VERSION (0x3FFF0170UL)
-#define VI_ATTR_INTF_TYPE (0x3FFF0171UL)
-#define VI_ATTR_GPIB_PRIMARY_ADDR (0x3FFF0172UL)
-#define VI_ATTR_GPIB_SECONDARY_ADDR (0x3FFF0173UL)
-#define VI_ATTR_RSRC_MANF_NAME (0xBFFF0174UL)
-#define VI_ATTR_RSRC_MANF_ID (0x3FFF0175UL)
-#define VI_ATTR_INTF_NUM (0x3FFF0176UL)
-#define VI_ATTR_TRIG_ID (0x3FFF0177UL)
-#define VI_ATTR_GPIB_REN_STATE (0x3FFF0181UL)
-#define VI_ATTR_GPIB_UNADDR_EN (0x3FFF0184UL)
-#define VI_ATTR_DEV_STATUS_BYTE (0x3FFF0189UL)
-#define VI_ATTR_FILE_APPEND_EN (0x3FFF0192UL)
-#define VI_ATTR_VXI_TRIG_SUPPORT (0x3FFF0194UL)
-#define VI_ATTR_TCPIP_ADDR (0xBFFF0195UL)
-#define VI_ATTR_TCPIP_HOSTNAME (0xBFFF0196UL)
-#define VI_ATTR_TCPIP_PORT (0x3FFF0197UL)
-#define VI_ATTR_TCPIP_DEVICE_NAME (0xBFFF0199UL)
-#define VI_ATTR_TCPIP_NODELAY (0x3FFF019AUL)
-#define VI_ATTR_TCPIP_KEEPALIVE (0x3FFF019BUL)
-#define VI_ATTR_4882_COMPLIANT (0x3FFF019FUL)
-#define VI_ATTR_USB_SERIAL_NUM (0xBFFF01A0UL)
-#define VI_ATTR_USB_INTFC_NUM (0x3FFF01A1UL)
-#define VI_ATTR_USB_PROTOCOL (0x3FFF01A7UL)
-#define VI_ATTR_USB_MAX_INTR_SIZE (0x3FFF01AFUL)
-#define VI_ATTR_PXI_DEV_NUM (0x3FFF0201UL)
-#define VI_ATTR_PXI_FUNC_NUM (0x3FFF0202UL)
-#define VI_ATTR_PXI_BUS_NUM (0x3FFF0205UL)
-#define VI_ATTR_PXI_CHASSIS (0x3FFF0206UL)
-#define VI_ATTR_PXI_SLOTPATH (0xBFFF0207UL)
-#define VI_ATTR_PXI_SLOT_LBUS_LEFT (0x3FFF0208UL)
-#define VI_ATTR_PXI_SLOT_LBUS_RIGHT (0x3FFF0209UL)
-#define VI_ATTR_PXI_TRIG_BUS (0x3FFF020AUL)
-#define VI_ATTR_PXI_STAR_TRIG_BUS (0x3FFF020BUL)
-#define VI_ATTR_PXI_STAR_TRIG_LINE (0x3FFF020CUL)
-#define VI_ATTR_PXI_MEM_TYPE_BAR0 (0x3FFF0211UL)
-#define VI_ATTR_PXI_MEM_TYPE_BAR1 (0x3FFF0212UL)
-#define VI_ATTR_PXI_MEM_TYPE_BAR2 (0x3FFF0213UL)
-#define VI_ATTR_PXI_MEM_TYPE_BAR3 (0x3FFF0214UL)
-#define VI_ATTR_PXI_MEM_TYPE_BAR4 (0x3FFF0215UL)
-#define VI_ATTR_PXI_MEM_TYPE_BAR5 (0x3FFF0216UL)
-#define VI_ATTR_PXI_MEM_BASE_BAR0 (0x3FFF0221UL)
-#define VI_ATTR_PXI_MEM_BASE_BAR1 (0x3FFF0222UL)
-#define VI_ATTR_PXI_MEM_BASE_BAR2 (0x3FFF0223UL)
-#define VI_ATTR_PXI_MEM_BASE_BAR3 (0x3FFF0224UL)
-#define VI_ATTR_PXI_MEM_BASE_BAR4 (0x3FFF0225UL)
-#define VI_ATTR_PXI_MEM_BASE_BAR5 (0x3FFF0226UL)
-#define VI_ATTR_PXI_MEM_SIZE_BAR0 (0x3FFF0231UL)
-#define VI_ATTR_PXI_MEM_SIZE_BAR1 (0x3FFF0232UL)
-#define VI_ATTR_PXI_MEM_SIZE_BAR2 (0x3FFF0233UL)
-#define VI_ATTR_PXI_MEM_SIZE_BAR3 (0x3FFF0234UL)
-#define VI_ATTR_PXI_MEM_SIZE_BAR4 (0x3FFF0235UL)
-#define VI_ATTR_PXI_MEM_SIZE_BAR5 (0x3FFF0236UL)
-#define VI_ATTR_PXI_IS_EXPRESS (0x3FFF0240UL)
-#define VI_ATTR_PXI_SLOT_LWIDTH (0x3FFF0241UL)
-#define VI_ATTR_PXI_MAX_LWIDTH (0x3FFF0242UL)
-#define VI_ATTR_PXI_ACTUAL_LWIDTH (0x3FFF0243UL)
-#define VI_ATTR_PXI_DSTAR_BUS (0x3FFF0244UL)
-#define VI_ATTR_PXI_DSTAR_SET (0x3FFF0245UL)
-
-#define VI_ATTR_JOB_ID (0x3FFF4006UL)
-#define VI_ATTR_EVENT_TYPE (0x3FFF4010UL)
-#define VI_ATTR_SIGP_STATUS_ID (0x3FFF4011UL)
-#define VI_ATTR_RECV_TRIG_ID (0x3FFF4012UL)
-#define VI_ATTR_INTR_STATUS_ID (0x3FFF4023UL)
-#define VI_ATTR_STATUS (0x3FFF4025UL)
-#define VI_ATTR_RET_COUNT_32 (0x3FFF4026UL)
-#define VI_ATTR_BUFFER (0x3FFF4027UL)
-#define VI_ATTR_RECV_INTR_LEVEL (0x3FFF4041UL)
-#define VI_ATTR_OPER_NAME (0xBFFF4042UL)
-#define VI_ATTR_GPIB_RECV_CIC_STATE (0x3FFF4193UL)
-#define VI_ATTR_RECV_TCPIP_ADDR (0xBFFF4198UL)
-#define VI_ATTR_USB_RECV_INTR_SIZE (0x3FFF41B0UL)
-#define VI_ATTR_USB_RECV_INTR_DATA (0xBFFF41B1UL)
-
-/*- Attributes (platform dependent size) ------------------------------------*/
-
-#if defined(_VI_INT64_UINT64_DEFINED) && defined(_VISA_ENV_IS_64_BIT)
-#define VI_ATTR_USER_DATA_64 (0x3FFF000AUL)
-#define VI_ATTR_RET_COUNT_64 (0x3FFF4028UL)
-#define VI_ATTR_USER_DATA (VI_ATTR_USER_DATA_64)
-#define VI_ATTR_RET_COUNT (VI_ATTR_RET_COUNT_64)
-#else
-#define VI_ATTR_USER_DATA (VI_ATTR_USER_DATA_32)
-#define VI_ATTR_RET_COUNT (VI_ATTR_RET_COUNT_32)
-#endif
-
-#if defined(_VI_INT64_UINT64_DEFINED)
-#define VI_ATTR_WIN_BASE_ADDR_64 (0x3FFF009BUL)
-#define VI_ATTR_WIN_SIZE_64 (0x3FFF009CUL)
-#define VI_ATTR_MEM_BASE_64 (0x3FFF00D0UL)
-#define VI_ATTR_MEM_SIZE_64 (0x3FFF00D1UL)
-#endif
-#if defined(_VI_INT64_UINT64_DEFINED) && defined(_VISA_ENV_IS_64_BIT)
-#define VI_ATTR_WIN_BASE_ADDR (VI_ATTR_WIN_BASE_ADDR_64)
-#define VI_ATTR_WIN_SIZE (VI_ATTR_WIN_SIZE_64)
-#define VI_ATTR_MEM_BASE (VI_ATTR_MEM_BASE_64)
-#define VI_ATTR_MEM_SIZE (VI_ATTR_MEM_SIZE_64)
-#else
-#define VI_ATTR_WIN_BASE_ADDR (VI_ATTR_WIN_BASE_ADDR_32)
-#define VI_ATTR_WIN_SIZE (VI_ATTR_WIN_SIZE_32)
-#define VI_ATTR_MEM_BASE (VI_ATTR_MEM_BASE_32)
-#define VI_ATTR_MEM_SIZE (VI_ATTR_MEM_SIZE_32)
-#endif
-
-/*- Event Types -------------------------------------------------------------*/
-
-#define VI_EVENT_IO_COMPLETION (0x3FFF2009UL)
-#define VI_EVENT_TRIG (0xBFFF200AUL)
-#define VI_EVENT_SERVICE_REQ (0x3FFF200BUL)
-#define VI_EVENT_CLEAR (0x3FFF200DUL)
-#define VI_EVENT_EXCEPTION (0xBFFF200EUL)
-#define VI_EVENT_GPIB_CIC (0x3FFF2012UL)
-#define VI_EVENT_GPIB_TALK (0x3FFF2013UL)
-#define VI_EVENT_GPIB_LISTEN (0x3FFF2014UL)
-#define VI_EVENT_VXI_VME_SYSFAIL (0x3FFF201DUL)
-#define VI_EVENT_VXI_VME_SYSRESET (0x3FFF201EUL)
-#define VI_EVENT_VXI_SIGP (0x3FFF2020UL)
-#define VI_EVENT_VXI_VME_INTR (0xBFFF2021UL)
-#define VI_EVENT_PXI_INTR (0x3FFF2022UL)
-#define VI_EVENT_TCPIP_CONNECT (0x3FFF2036UL)
-#define VI_EVENT_USB_INTR (0x3FFF2037UL)
-
-#define VI_ALL_ENABLED_EVENTS (0x3FFF7FFFUL)
-
-/*- Completion and Error Codes ----------------------------------------------*/
-
-#define VI_SUCCESS_EVENT_EN (0x3FFF0002L) /* 3FFF0002, 1073676290 */
-#define VI_SUCCESS_EVENT_DIS (0x3FFF0003L) /* 3FFF0003, 1073676291 */
-#define VI_SUCCESS_QUEUE_EMPTY (0x3FFF0004L) /* 3FFF0004, 1073676292 */
-#define VI_SUCCESS_TERM_CHAR (0x3FFF0005L) /* 3FFF0005, 1073676293 */
-#define VI_SUCCESS_MAX_CNT (0x3FFF0006L) /* 3FFF0006, 1073676294 */
-#define VI_SUCCESS_DEV_NPRESENT (0x3FFF007DL) /* 3FFF007D, 1073676413 */
-#define VI_SUCCESS_TRIG_MAPPED (0x3FFF007EL) /* 3FFF007E, 1073676414 */
-#define VI_SUCCESS_QUEUE_NEMPTY (0x3FFF0080L) /* 3FFF0080, 1073676416 */
-#define VI_SUCCESS_NCHAIN (0x3FFF0098L) /* 3FFF0098, 1073676440 */
-#define VI_SUCCESS_NESTED_SHARED (0x3FFF0099L) /* 3FFF0099, 1073676441 */
-#define VI_SUCCESS_NESTED_EXCLUSIVE (0x3FFF009AL) /* 3FFF009A, 1073676442 */
-#define VI_SUCCESS_SYNC (0x3FFF009BL) /* 3FFF009B, 1073676443 */
-
-#define VI_WARN_QUEUE_OVERFLOW (0x3FFF000CL) /* 3FFF000C, 1073676300 */
-#define VI_WARN_CONFIG_NLOADED (0x3FFF0077L) /* 3FFF0077, 1073676407 */
-#define VI_WARN_NULL_OBJECT (0x3FFF0082L) /* 3FFF0082, 1073676418 */
-#define VI_WARN_NSUP_ATTR_STATE (0x3FFF0084L) /* 3FFF0084, 1073676420 */
-#define VI_WARN_UNKNOWN_STATUS (0x3FFF0085L) /* 3FFF0085, 1073676421 */
-#define VI_WARN_NSUP_BUF (0x3FFF0088L) /* 3FFF0088, 1073676424 */
-#define VI_WARN_EXT_FUNC_NIMPL (0x3FFF00A9L) /* 3FFF00A9, 1073676457 */
-
-#define VI_ERROR_SYSTEM_ERROR (_VI_ERROR+0x3FFF0000L) /* BFFF0000, -1073807360 */
-#define VI_ERROR_INV_OBJECT (_VI_ERROR+0x3FFF000EL) /* BFFF000E, -1073807346 */
-#define VI_ERROR_RSRC_LOCKED (_VI_ERROR+0x3FFF000FL) /* BFFF000F, -1073807345 */
-#define VI_ERROR_INV_EXPR (_VI_ERROR+0x3FFF0010L) /* BFFF0010, -1073807344 */
-#define VI_ERROR_RSRC_NFOUND (_VI_ERROR+0x3FFF0011L) /* BFFF0011, -1073807343 */
-#define VI_ERROR_INV_RSRC_NAME (_VI_ERROR+0x3FFF0012L) /* BFFF0012, -1073807342 */
-#define VI_ERROR_INV_ACC_MODE (_VI_ERROR+0x3FFF0013L) /* BFFF0013, -1073807341 */
-#define VI_ERROR_TMO (_VI_ERROR+0x3FFF0015L) /* BFFF0015, -1073807339 */
-#define VI_ERROR_CLOSING_FAILED (_VI_ERROR+0x3FFF0016L) /* BFFF0016, -1073807338 */
-#define VI_ERROR_INV_DEGREE (_VI_ERROR+0x3FFF001BL) /* BFFF001B, -1073807333 */
-#define VI_ERROR_INV_JOB_ID (_VI_ERROR+0x3FFF001CL) /* BFFF001C, -1073807332 */
-#define VI_ERROR_NSUP_ATTR (_VI_ERROR+0x3FFF001DL) /* BFFF001D, -1073807331 */
-#define VI_ERROR_NSUP_ATTR_STATE (_VI_ERROR+0x3FFF001EL) /* BFFF001E, -1073807330 */
-#define VI_ERROR_ATTR_READONLY (_VI_ERROR+0x3FFF001FL) /* BFFF001F, -1073807329 */
-#define VI_ERROR_INV_LOCK_TYPE (_VI_ERROR+0x3FFF0020L) /* BFFF0020, -1073807328 */
-#define VI_ERROR_INV_ACCESS_KEY (_VI_ERROR+0x3FFF0021L) /* BFFF0021, -1073807327 */
-#define VI_ERROR_INV_EVENT (_VI_ERROR+0x3FFF0026L) /* BFFF0026, -1073807322 */
-#define VI_ERROR_INV_MECH (_VI_ERROR+0x3FFF0027L) /* BFFF0027, -1073807321 */
-#define VI_ERROR_HNDLR_NINSTALLED (_VI_ERROR+0x3FFF0028L) /* BFFF0028, -1073807320 */
-#define VI_ERROR_INV_HNDLR_REF (_VI_ERROR+0x3FFF0029L) /* BFFF0029, -1073807319 */
-#define VI_ERROR_INV_CONTEXT (_VI_ERROR+0x3FFF002AL) /* BFFF002A, -1073807318 */
-#define VI_ERROR_QUEUE_OVERFLOW (_VI_ERROR+0x3FFF002DL) /* BFFF002D, -1073807315 */
-#define VI_ERROR_NENABLED (_VI_ERROR+0x3FFF002FL) /* BFFF002F, -1073807313 */
-#define VI_ERROR_ABORT (_VI_ERROR+0x3FFF0030L) /* BFFF0030, -1073807312 */
-#define VI_ERROR_RAW_WR_PROT_VIOL (_VI_ERROR+0x3FFF0034L) /* BFFF0034, -1073807308 */
-#define VI_ERROR_RAW_RD_PROT_VIOL (_VI_ERROR+0x3FFF0035L) /* BFFF0035, -1073807307 */
-#define VI_ERROR_OUTP_PROT_VIOL (_VI_ERROR+0x3FFF0036L) /* BFFF0036, -1073807306 */
-#define VI_ERROR_INP_PROT_VIOL (_VI_ERROR+0x3FFF0037L) /* BFFF0037, -1073807305 */
-#define VI_ERROR_BERR (_VI_ERROR+0x3FFF0038L) /* BFFF0038, -1073807304 */
-#define VI_ERROR_IN_PROGRESS (_VI_ERROR+0x3FFF0039L) /* BFFF0039, -1073807303 */
-#define VI_ERROR_INV_SETUP (_VI_ERROR+0x3FFF003AL) /* BFFF003A, -1073807302 */
-#define VI_ERROR_QUEUE_ERROR (_VI_ERROR+0x3FFF003BL) /* BFFF003B, -1073807301 */
-#define VI_ERROR_ALLOC (_VI_ERROR+0x3FFF003CL) /* BFFF003C, -1073807300 */
-#define VI_ERROR_INV_MASK (_VI_ERROR+0x3FFF003DL) /* BFFF003D, -1073807299 */
-#define VI_ERROR_IO (_VI_ERROR+0x3FFF003EL) /* BFFF003E, -1073807298 */
-#define VI_ERROR_INV_FMT (_VI_ERROR+0x3FFF003FL) /* BFFF003F, -1073807297 */
-#define VI_ERROR_NSUP_FMT (_VI_ERROR+0x3FFF0041L) /* BFFF0041, -1073807295 */
-#define VI_ERROR_LINE_IN_USE (_VI_ERROR+0x3FFF0042L) /* BFFF0042, -1073807294 */
-#define VI_ERROR_NSUP_MODE (_VI_ERROR+0x3FFF0046L) /* BFFF0046, -1073807290 */
-#define VI_ERROR_SRQ_NOCCURRED (_VI_ERROR+0x3FFF004AL) /* BFFF004A, -1073807286 */
-#define VI_ERROR_INV_SPACE (_VI_ERROR+0x3FFF004EL) /* BFFF004E, -1073807282 */
-#define VI_ERROR_INV_OFFSET (_VI_ERROR+0x3FFF0051L) /* BFFF0051, -1073807279 */
-#define VI_ERROR_INV_WIDTH (_VI_ERROR+0x3FFF0052L) /* BFFF0052, -1073807278 */
-#define VI_ERROR_NSUP_OFFSET (_VI_ERROR+0x3FFF0054L) /* BFFF0054, -1073807276 */
-#define VI_ERROR_NSUP_VAR_WIDTH (_VI_ERROR+0x3FFF0055L) /* BFFF0055, -1073807275 */
-#define VI_ERROR_WINDOW_NMAPPED (_VI_ERROR+0x3FFF0057L) /* BFFF0057, -1073807273 */
-#define VI_ERROR_RESP_PENDING (_VI_ERROR+0x3FFF0059L) /* BFFF0059, -1073807271 */
-#define VI_ERROR_NLISTENERS (_VI_ERROR+0x3FFF005FL) /* BFFF005F, -1073807265 */
-#define VI_ERROR_NCIC (_VI_ERROR+0x3FFF0060L) /* BFFF0060, -1073807264 */
-#define VI_ERROR_NSYS_CNTLR (_VI_ERROR+0x3FFF0061L) /* BFFF0061, -1073807263 */
-#define VI_ERROR_NSUP_OPER (_VI_ERROR+0x3FFF0067L) /* BFFF0067, -1073807257 */
-#define VI_ERROR_INTR_PENDING (_VI_ERROR+0x3FFF0068L) /* BFFF0068, -1073807256 */
-#define VI_ERROR_ASRL_PARITY (_VI_ERROR+0x3FFF006AL) /* BFFF006A, -1073807254 */
-#define VI_ERROR_ASRL_FRAMING (_VI_ERROR+0x3FFF006BL) /* BFFF006B, -1073807253 */
-#define VI_ERROR_ASRL_OVERRUN (_VI_ERROR+0x3FFF006CL) /* BFFF006C, -1073807252 */
-#define VI_ERROR_TRIG_NMAPPED (_VI_ERROR+0x3FFF006EL) /* BFFF006E, -1073807250 */
-#define VI_ERROR_NSUP_ALIGN_OFFSET (_VI_ERROR+0x3FFF0070L) /* BFFF0070, -1073807248 */
-#define VI_ERROR_USER_BUF (_VI_ERROR+0x3FFF0071L) /* BFFF0071, -1073807247 */
-#define VI_ERROR_RSRC_BUSY (_VI_ERROR+0x3FFF0072L) /* BFFF0072, -1073807246 */
-#define VI_ERROR_NSUP_WIDTH (_VI_ERROR+0x3FFF0076L) /* BFFF0076, -1073807242 */
-#define VI_ERROR_INV_PARAMETER (_VI_ERROR+0x3FFF0078L) /* BFFF0078, -1073807240 */
-#define VI_ERROR_INV_PROT (_VI_ERROR+0x3FFF0079L) /* BFFF0079, -1073807239 */
-#define VI_ERROR_INV_SIZE (_VI_ERROR+0x3FFF007BL) /* BFFF007B, -1073807237 */
-#define VI_ERROR_WINDOW_MAPPED (_VI_ERROR+0x3FFF0080L) /* BFFF0080, -1073807232 */
-#define VI_ERROR_NIMPL_OPER (_VI_ERROR+0x3FFF0081L) /* BFFF0081, -1073807231 */
-#define VI_ERROR_INV_LENGTH (_VI_ERROR+0x3FFF0083L) /* BFFF0083, -1073807229 */
-#define VI_ERROR_INV_MODE (_VI_ERROR+0x3FFF0091L) /* BFFF0091, -1073807215 */
-#define VI_ERROR_SESN_NLOCKED (_VI_ERROR+0x3FFF009CL) /* BFFF009C, -1073807204 */
-#define VI_ERROR_MEM_NSHARED (_VI_ERROR+0x3FFF009DL) /* BFFF009D, -1073807203 */
-#define VI_ERROR_LIBRARY_NFOUND (_VI_ERROR+0x3FFF009EL) /* BFFF009E, -1073807202 */
-#define VI_ERROR_NSUP_INTR (_VI_ERROR+0x3FFF009FL) /* BFFF009F, -1073807201 */
-#define VI_ERROR_INV_LINE (_VI_ERROR+0x3FFF00A0L) /* BFFF00A0, -1073807200 */
-#define VI_ERROR_FILE_ACCESS (_VI_ERROR+0x3FFF00A1L) /* BFFF00A1, -1073807199 */
-#define VI_ERROR_FILE_IO (_VI_ERROR+0x3FFF00A2L) /* BFFF00A2, -1073807198 */
-#define VI_ERROR_NSUP_LINE (_VI_ERROR+0x3FFF00A3L) /* BFFF00A3, -1073807197 */
-#define VI_ERROR_NSUP_MECH (_VI_ERROR+0x3FFF00A4L) /* BFFF00A4, -1073807196 */
-#define VI_ERROR_INTF_NUM_NCONFIG (_VI_ERROR+0x3FFF00A5L) /* BFFF00A5, -1073807195 */
-#define VI_ERROR_CONN_LOST (_VI_ERROR+0x3FFF00A6L) /* BFFF00A6, -1073807194 */
-#define VI_ERROR_MACHINE_NAVAIL (_VI_ERROR+0x3FFF00A7L) /* BFFF00A7, -1073807193 */
-#define VI_ERROR_NPERMISSION (_VI_ERROR+0x3FFF00A8L) /* BFFF00A8, -1073807192 */
-
-/*- Other VISA Definitions --------------------------------------------------*/
-
-#define VI_VERSION_MAJOR(ver) ((((ViVersion)ver) & 0xFFF00000UL) >> 20)
-#define VI_VERSION_MINOR(ver) ((((ViVersion)ver) & 0x000FFF00UL) >> 8)
-#define VI_VERSION_SUBMINOR(ver) ((((ViVersion)ver) & 0x000000FFUL) )
-
-#define VI_FIND_BUFLEN (256)
-
-#define VI_INTF_GPIB (1)
-#define VI_INTF_VXI (2)
-#define VI_INTF_GPIB_VXI (3)
-#define VI_INTF_ASRL (4)
-#define VI_INTF_PXI (5)
-#define VI_INTF_TCPIP (6)
-#define VI_INTF_USB (7)
-
-#define VI_PROT_NORMAL (1)
-#define VI_PROT_FDC (2)
-#define VI_PROT_HS488 (3)
-#define VI_PROT_4882_STRS (4)
-#define VI_PROT_USBTMC_VENDOR (5)
-
-#define VI_FDC_NORMAL (1)
-#define VI_FDC_STREAM (2)
-
-#define VI_LOCAL_SPACE (0)
-#define VI_A16_SPACE (1)
-#define VI_A24_SPACE (2)
-#define VI_A32_SPACE (3)
-#define VI_A64_SPACE (4)
-#define VI_PXI_ALLOC_SPACE (9)
-#define VI_PXI_CFG_SPACE (10)
-#define VI_PXI_BAR0_SPACE (11)
-#define VI_PXI_BAR1_SPACE (12)
-#define VI_PXI_BAR2_SPACE (13)
-#define VI_PXI_BAR3_SPACE (14)
-#define VI_PXI_BAR4_SPACE (15)
-#define VI_PXI_BAR5_SPACE (16)
-#define VI_OPAQUE_SPACE (0xFFFF)
-
-#define VI_UNKNOWN_LA (-1)
-#define VI_UNKNOWN_SLOT (-1)
-#define VI_UNKNOWN_LEVEL (-1)
-#define VI_UNKNOWN_CHASSIS (-1)
-
-#define VI_QUEUE (1)
-#define VI_HNDLR (2)
-#define VI_SUSPEND_HNDLR (4)
-#define VI_ALL_MECH (0xFFFF)
-
-#define VI_ANY_HNDLR (0)
-
-#define VI_TRIG_ALL (-2)
-#define VI_TRIG_SW (-1)
-#define VI_TRIG_TTL0 (0)
-#define VI_TRIG_TTL1 (1)
-#define VI_TRIG_TTL2 (2)
-#define VI_TRIG_TTL3 (3)
-#define VI_TRIG_TTL4 (4)
-#define VI_TRIG_TTL5 (5)
-#define VI_TRIG_TTL6 (6)
-#define VI_TRIG_TTL7 (7)
-#define VI_TRIG_ECL0 (8)
-#define VI_TRIG_ECL1 (9)
-#define VI_TRIG_PANEL_IN (27)
-#define VI_TRIG_PANEL_OUT (28)
-
-#define VI_TRIG_PROT_DEFAULT (0)
-#define VI_TRIG_PROT_ON (1)
-#define VI_TRIG_PROT_OFF (2)
-#define VI_TRIG_PROT_SYNC (5)
-#define VI_TRIG_PROT_RESERVE (6)
-#define VI_TRIG_PROT_UNRESERVE (7)
-
-#define VI_READ_BUF (1)
-#define VI_WRITE_BUF (2)
-#define VI_READ_BUF_DISCARD (4)
-#define VI_WRITE_BUF_DISCARD (8)
-#define VI_IO_IN_BUF (16)
-#define VI_IO_OUT_BUF (32)
-#define VI_IO_IN_BUF_DISCARD (64)
-#define VI_IO_OUT_BUF_DISCARD (128)
-
-#define VI_FLUSH_ON_ACCESS (1)
-#define VI_FLUSH_WHEN_FULL (2)
-#define VI_FLUSH_DISABLE (3)
-
-#define VI_NMAPPED (1)
-#define VI_USE_OPERS (2)
-#define VI_DEREF_ADDR (3)
-#define VI_DEREF_ADDR_BYTE_SWAP (4)
-
-#define VI_TMO_IMMEDIATE (0L)
-#define VI_TMO_INFINITE (0xFFFFFFFFUL)
-
-#define VI_NO_LOCK (0)
-#define VI_EXCLUSIVE_LOCK (1)
-#define VI_SHARED_LOCK (2)
-#define VI_LOAD_CONFIG (4)
-
-#define VI_NO_SEC_ADDR (0xFFFF)
-
-#define VI_ASRL_PAR_NONE (0)
-#define VI_ASRL_PAR_ODD (1)
-#define VI_ASRL_PAR_EVEN (2)
-#define VI_ASRL_PAR_MARK (3)
-#define VI_ASRL_PAR_SPACE (4)
-
-#define VI_ASRL_STOP_ONE (10)
-#define VI_ASRL_STOP_ONE5 (15)
-#define VI_ASRL_STOP_TWO (20)
-
-#define VI_ASRL_FLOW_NONE (0)
-#define VI_ASRL_FLOW_XON_XOFF (1)
-#define VI_ASRL_FLOW_RTS_CTS (2)
-#define VI_ASRL_FLOW_DTR_DSR (4)
-
-#define VI_ASRL_END_NONE (0)
-#define VI_ASRL_END_LAST_BIT (1)
-#define VI_ASRL_END_TERMCHAR (2)
-#define VI_ASRL_END_BREAK (3)
-
-#define VI_STATE_ASSERTED (1)
-#define VI_STATE_UNASSERTED (0)
-#define VI_STATE_UNKNOWN (-1)
-
-#define VI_BIG_ENDIAN (0)
-#define VI_LITTLE_ENDIAN (1)
-
-#define VI_DATA_PRIV (0)
-#define VI_DATA_NPRIV (1)
-#define VI_PROG_PRIV (2)
-#define VI_PROG_NPRIV (3)
-#define VI_BLCK_PRIV (4)
-#define VI_BLCK_NPRIV (5)
-#define VI_D64_PRIV (6)
-#define VI_D64_NPRIV (7)
-
-#define VI_WIDTH_8 (1)
-#define VI_WIDTH_16 (2)
-#define VI_WIDTH_32 (4)
-#define VI_WIDTH_64 (8)
-
-#define VI_GPIB_REN_DEASSERT (0)
-#define VI_GPIB_REN_ASSERT (1)
-#define VI_GPIB_REN_DEASSERT_GTL (2)
-#define VI_GPIB_REN_ASSERT_ADDRESS (3)
-#define VI_GPIB_REN_ASSERT_LLO (4)
-#define VI_GPIB_REN_ASSERT_ADDRESS_LLO (5)
-#define VI_GPIB_REN_ADDRESS_GTL (6)
-
-#define VI_GPIB_ATN_DEASSERT (0)
-#define VI_GPIB_ATN_ASSERT (1)
-#define VI_GPIB_ATN_DEASSERT_HANDSHAKE (2)
-#define VI_GPIB_ATN_ASSERT_IMMEDIATE (3)
-
-#define VI_GPIB_HS488_DISABLED (0)
-#define VI_GPIB_HS488_NIMPL (-1)
-
-#define VI_GPIB_UNADDRESSED (0)
-#define VI_GPIB_TALKER (1)
-#define VI_GPIB_LISTENER (2)
-
-#define VI_VXI_CMD16 (0x0200)
-#define VI_VXI_CMD16_RESP16 (0x0202)
-#define VI_VXI_RESP16 (0x0002)
-#define VI_VXI_CMD32 (0x0400)
-#define VI_VXI_CMD32_RESP16 (0x0402)
-#define VI_VXI_CMD32_RESP32 (0x0404)
-#define VI_VXI_RESP32 (0x0004)
-
-#define VI_ASSERT_SIGNAL (-1)
-#define VI_ASSERT_USE_ASSIGNED (0)
-#define VI_ASSERT_IRQ1 (1)
-#define VI_ASSERT_IRQ2 (2)
-#define VI_ASSERT_IRQ3 (3)
-#define VI_ASSERT_IRQ4 (4)
-#define VI_ASSERT_IRQ5 (5)
-#define VI_ASSERT_IRQ6 (6)
-#define VI_ASSERT_IRQ7 (7)
-
-#define VI_UTIL_ASSERT_SYSRESET (1)
-#define VI_UTIL_ASSERT_SYSFAIL (2)
-#define VI_UTIL_DEASSERT_SYSFAIL (3)
-
-#define VI_VXI_CLASS_MEMORY (0)
-#define VI_VXI_CLASS_EXTENDED (1)
-#define VI_VXI_CLASS_MESSAGE (2)
-#define VI_VXI_CLASS_REGISTER (3)
-#define VI_VXI_CLASS_OTHER (4)
-
-#define VI_PXI_ADDR_NONE (0)
-#define VI_PXI_ADDR_MEM (1)
-#define VI_PXI_ADDR_IO (2)
-#define VI_PXI_ADDR_CFG (3)
-
-#define VI_TRIG_UNKNOWN (-1)
-
-#define VI_PXI_LBUS_UNKNOWN (-1)
-#define VI_PXI_LBUS_NONE (0)
-#define VI_PXI_LBUS_STAR_TRIG_BUS_0 (1000)
-#define VI_PXI_LBUS_STAR_TRIG_BUS_1 (1001)
-#define VI_PXI_LBUS_STAR_TRIG_BUS_2 (1002)
-#define VI_PXI_LBUS_STAR_TRIG_BUS_3 (1003)
-#define VI_PXI_LBUS_STAR_TRIG_BUS_4 (1004)
-#define VI_PXI_LBUS_STAR_TRIG_BUS_5 (1005)
-#define VI_PXI_LBUS_STAR_TRIG_BUS_6 (1006)
-#define VI_PXI_LBUS_STAR_TRIG_BUS_7 (1007)
-#define VI_PXI_LBUS_STAR_TRIG_BUS_8 (1008)
-#define VI_PXI_LBUS_STAR_TRIG_BUS_9 (1009)
-#define VI_PXI_STAR_TRIG_CONTROLLER (1413)
-
-/*- Backward Compatibility Macros -------------------------------------------*/
-
-#define viGetDefaultRM(vi) viOpenDefaultRM(vi)
-#define VI_ERROR_INV_SESSION (VI_ERROR_INV_OBJECT)
-#define VI_INFINITE (VI_TMO_INFINITE)
-#define VI_NORMAL (VI_PROT_NORMAL)
-#define VI_FDC (VI_PROT_FDC)
-#define VI_HS488 (VI_PROT_HS488)
-#define VI_ASRL488 (VI_PROT_4882_STRS)
-#define VI_ASRL_IN_BUF (VI_IO_IN_BUF)
-#define VI_ASRL_OUT_BUF (VI_IO_OUT_BUF)
-#define VI_ASRL_IN_BUF_DISCARD (VI_IO_IN_BUF_DISCARD)
-#define VI_ASRL_OUT_BUF_DISCARD (VI_IO_OUT_BUF_DISCARD)
-
-/*- National Instruments ----------------------------------------------------*/
-
-#define VI_INTF_RIO (8)
-#define VI_INTF_FIREWIRE (9)
-
-#define VI_ATTR_SYNC_MXI_ALLOW_EN (0x3FFF0161UL) /* ViBoolean, read/write */
-
-/* This is for VXI SERVANT resources */
-
-#define VI_EVENT_VXI_DEV_CMD (0xBFFF200FUL)
-#define VI_ATTR_VXI_DEV_CMD_TYPE (0x3FFF4037UL) /* ViInt16, read-only */
-#define VI_ATTR_VXI_DEV_CMD_VALUE (0x3FFF4038UL) /* ViUInt32, read-only */
-
-#define VI_VXI_DEV_CMD_TYPE_16 (16)
-#define VI_VXI_DEV_CMD_TYPE_32 (32)
-
-ViStatus _VI_FUNC viVxiServantResponse(ViSession vi, ViInt16 mode, ViUInt32 resp);
-/* mode values include VI_VXI_RESP16, VI_VXI_RESP32, and the next 2 values */
-#define VI_VXI_RESP_NONE (0)
-#define VI_VXI_RESP_PROT_ERROR (-1)
-
-/* This allows extended Serial support on Win32 and on NI ENET Serial products */
-
-#define VI_ATTR_ASRL_DISCARD_NULL (0x3FFF00B0UL)
-#define VI_ATTR_ASRL_CONNECTED (0x3FFF01BBUL)
-#define VI_ATTR_ASRL_BREAK_STATE (0x3FFF01BCUL)
-#define VI_ATTR_ASRL_BREAK_LEN (0x3FFF01BDUL)
-#define VI_ATTR_ASRL_ALLOW_TRANSMIT (0x3FFF01BEUL)
-#define VI_ATTR_ASRL_WIRE_MODE (0x3FFF01BFUL)
-
-#define VI_ASRL_WIRE_485_4 (0)
-#define VI_ASRL_WIRE_485_2_DTR_ECHO (1)
-#define VI_ASRL_WIRE_485_2_DTR_CTRL (2)
-#define VI_ASRL_WIRE_485_2_AUTO (3)
-#define VI_ASRL_WIRE_232_DTE (128)
-#define VI_ASRL_WIRE_232_DCE (129)
-#define VI_ASRL_WIRE_232_AUTO (130)
-
-#define VI_EVENT_ASRL_BREAK (0x3FFF2023UL)
-#define VI_EVENT_ASRL_CTS (0x3FFF2029UL)
-#define VI_EVENT_ASRL_DSR (0x3FFF202AUL)
-#define VI_EVENT_ASRL_DCD (0x3FFF202CUL)
-#define VI_EVENT_ASRL_RI (0x3FFF202EUL)
-#define VI_EVENT_ASRL_CHAR (0x3FFF2035UL)
-#define VI_EVENT_ASRL_TERMCHAR (0x3FFF2024UL)
-
-/* This is for fast viPeek/viPoke macros */
-
-#if defined(NIVISA_PEEKPOKE)
-
-#if defined(NIVISA_PEEKPOKE_SUPP)
-#undef NIVISA_PEEKPOKE_SUPP
-#endif
-
-#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) && !defined(_NI_mswin16_)
-/* This macro is supported for all Win32 compilers, including CVI. */
-#define NIVISA_PEEKPOKE_SUPP
-#elif (defined(_WINDOWS) || defined(_Windows)) && !defined(_CVI_) && !defined(_NI_mswin16_)
-/* This macro is supported for Borland and Microsoft compilers on Win16, but not CVI. */
-#define NIVISA_PEEKPOKE_SUPP
-#elif defined(_CVI_) && defined(_NI_sparc_)
-/* This macro is supported for Solaris 1 and 2, from CVI only. */
-#define NIVISA_PEEKPOKE_SUPP
-#else
-/* This macro is not supported on other platforms. */
-#endif
-
-#if defined(NIVISA_PEEKPOKE_SUPP)
-
-extern ViBoolean NI_viImplVISA1;
-ViStatus _VI_FUNC NI_viOpenDefaultRM (ViPSession vi);
-#define viOpenDefaultRM(vi) NI_viOpenDefaultRM(vi)
-
-#define viPeek8(vi,addr,val) \
- { \
- if ((NI_viImplVISA1) && (*((ViPUInt32)(vi)))) \
- { \
- do (*((ViPUInt8)(val)) = *((volatile ViUInt8 _VI_PTR)(addr))); \
- while (**((volatile ViUInt8 _VI_PTR _VI_PTR)(vi)) & 0x10); \
- } \
- else \
- { \
- (viPeek8)((vi),(addr),(val)); \
- } \
- }
-
-#define viPoke8(vi,addr,val) \
- { \
- if ((NI_viImplVISA1) && (*((ViPUInt32)(vi)))) \
- { \
- do (*((volatile ViUInt8 _VI_PTR)(addr)) = ((ViUInt8)(val))); \
- while (**((volatile ViUInt8 _VI_PTR _VI_PTR)(vi)) & 0x10); \
- } \
- else \
- { \
- (viPoke8)((vi),(addr),(val)); \
- } \
- }
-
-#define viPeek16(vi,addr,val) \
- { \
- if ((NI_viImplVISA1) && (*((ViPUInt32)(vi)))) \
- { \
- do (*((ViPUInt16)(val)) = *((volatile ViUInt16 _VI_PTR)(addr))); \
- while (**((volatile ViUInt8 _VI_PTR _VI_PTR)(vi)) & 0x10); \
- } \
- else \
- { \
- (viPeek16)((vi),(addr),(val)); \
- } \
- }
-
-#define viPoke16(vi,addr,val) \
- { \
- if ((NI_viImplVISA1) && (*((ViPUInt32)(vi)))) \
- { \
- do (*((volatile ViUInt16 _VI_PTR)(addr)) = ((ViUInt16)(val))); \
- while (**((volatile ViUInt8 _VI_PTR _VI_PTR)(vi)) & 0x10); \
- } \
- else \
- { \
- (viPoke16)((vi),(addr),(val)); \
- } \
- }
-
-#define viPeek32(vi,addr,val) \
- { \
- if ((NI_viImplVISA1) && (*((ViPUInt32)(vi)))) \
- { \
- do (*((ViPUInt32)(val)) = *((volatile ViUInt32 _VI_PTR)(addr))); \
- while (**((volatile ViUInt8 _VI_PTR _VI_PTR)(vi)) & 0x10); \
- } \
- else \
- { \
- (viPeek32)((vi),(addr),(val)); \
- } \
- }
-
-#define viPoke32(vi,addr,val) \
- { \
- if ((NI_viImplVISA1) && (*((ViPUInt32)(vi)))) \
- { \
- do (*((volatile ViUInt32 _VI_PTR)(addr)) = ((ViUInt32)(val))); \
- while (**((volatile ViUInt8 _VI_PTR _VI_PTR)(vi)) & 0x10); \
- } \
- else \
- { \
- (viPoke32)((vi),(addr),(val)); \
- } \
- }
-
-#endif
-
-#endif
-
-#if defined(NIVISA_PXI) || defined(PXISAVISA_PXI)
-
-#if 0
-/* The following 2 attributes were incorrectly implemented in earlier
- versions of NI-VISA. You should now query VI_ATTR_MANF_ID or
- VI_ATTR_MODEL_CODE. Those attributes contain sub-vendor information
- when it exists. To get both the actual primary and subvendor codes
- from the device, you should call viIn16 using VI_PXI_CFG_SPACE. */
-#define VI_ATTR_PXI_SUB_MANF_ID (0x3FFF0203UL)
-#define VI_ATTR_PXI_SUB_MODEL_CODE (0x3FFF0204UL)
-#endif
-
-#define VI_ATTR_PXI_SRC_TRIG_BUS (0x3FFF020DUL)
-#define VI_ATTR_PXI_DEST_TRIG_BUS (0x3FFF020EUL)
-
-#define VI_ATTR_PXI_RECV_INTR_SEQ (0x3FFF4240UL)
-#define VI_ATTR_PXI_RECV_INTR_DATA (0x3FFF4241UL)
-
-#endif
-
-#if defined(NIVISA_USB)
-
-#define VI_ATTR_USB_BULK_OUT_PIPE (0x3FFF01A2UL)
-#define VI_ATTR_USB_BULK_IN_PIPE (0x3FFF01A3UL)
-#define VI_ATTR_USB_INTR_IN_PIPE (0x3FFF01A4UL)
-#define VI_ATTR_USB_CLASS (0x3FFF01A5UL)
-#define VI_ATTR_USB_SUBCLASS (0x3FFF01A6UL)
-#define VI_ATTR_USB_ALT_SETTING (0x3FFF01A8UL)
-#define VI_ATTR_USB_END_IN (0x3FFF01A9UL)
-#define VI_ATTR_USB_NUM_INTFCS (0x3FFF01AAUL)
-#define VI_ATTR_USB_NUM_PIPES (0x3FFF01ABUL)
-#define VI_ATTR_USB_BULK_OUT_STATUS (0x3FFF01ACUL)
-#define VI_ATTR_USB_BULK_IN_STATUS (0x3FFF01ADUL)
-#define VI_ATTR_USB_INTR_IN_STATUS (0x3FFF01AEUL)
-#define VI_ATTR_USB_CTRL_PIPE (0x3FFF01B0UL)
-
-#define VI_USB_PIPE_STATE_UNKNOWN (-1)
-#define VI_USB_PIPE_READY (0)
-#define VI_USB_PIPE_STALLED (1)
-
-#define VI_USB_END_NONE (0)
-#define VI_USB_END_SHORT (4)
-#define VI_USB_END_SHORT_OR_COUNT (5)
-
-#endif
-
-#define VI_ATTR_FIREWIRE_DEST_UPPER_OFFSET (0x3FFF01F0UL)
-#define VI_ATTR_FIREWIRE_SRC_UPPER_OFFSET (0x3FFF01F1UL)
-#define VI_ATTR_FIREWIRE_WIN_UPPER_OFFSET (0x3FFF01F2UL)
-#define VI_ATTR_FIREWIRE_VENDOR_ID (0x3FFF01F3UL)
-#define VI_ATTR_FIREWIRE_LOWER_CHIP_ID (0x3FFF01F4UL)
-#define VI_ATTR_FIREWIRE_UPPER_CHIP_ID (0x3FFF01F5UL)
-
-#define VI_FIREWIRE_DFLT_SPACE (5)
-
-#if defined(__cplusplus) || defined(__cplusplus__)
- }
-#endif
-
-#endif
-
-/*- The End -----------------------------------------------------------------*/
diff --git a/third_party/allwpilib_2017/hal/lib/athena/visa/visatype.h b/third_party/allwpilib_2017/hal/lib/athena/visa/visatype.h
deleted file mode 100644
index ef089dd..0000000
--- a/third_party/allwpilib_2017/hal/lib/athena/visa/visatype.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/*---------------------------------------------------------------------------*/
-/* Distributed by IVI Foundation Inc. */
-/* */
-/* Do not modify the contents of this file. */
-/*---------------------------------------------------------------------------*/
-/* */
-/* Title : VISATYPE.H */
-/* Date : 04-14-2006 */
-/* Purpose : Fundamental VISA data types and macro definitions */
-/* */
-/*---------------------------------------------------------------------------*/
-
-#ifndef __VISATYPE_HEADER__
-#define __VISATYPE_HEADER__
-
-#if defined(_WIN64)
-#define _VI_FAR
-#define _VI_FUNC __fastcall
-#define _VI_FUNCC __fastcall
-#define _VI_FUNCH __fastcall
-#define _VI_SIGNED signed
-#elif (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) && !defined(_NI_mswin16_)
-#define _VI_FAR
-#define _VI_FUNC __stdcall
-#define _VI_FUNCC __cdecl
-#define _VI_FUNCH __stdcall
-#define _VI_SIGNED signed
-#elif defined(_CVI_) && defined(_NI_i386_)
-#define _VI_FAR
-#define _VI_FUNC _pascal
-#define _VI_FUNCC
-#define _VI_FUNCH _pascal
-#define _VI_SIGNED signed
-#elif (defined(_WINDOWS) || defined(_Windows)) && !defined(_NI_mswin16_)
-#define _VI_FAR _far
-#define _VI_FUNC _far _pascal _export
-#define _VI_FUNCC _far _cdecl _export
-#define _VI_FUNCH _far _pascal
-#define _VI_SIGNED signed
-#elif (defined(hpux) || defined(__hpux)) && (defined(__cplusplus) || defined(__cplusplus__))
-#define _VI_FAR
-#define _VI_FUNC
-#define _VI_FUNCC
-#define _VI_FUNCH
-#define _VI_SIGNED
-#else
-#define _VI_FAR
-#define _VI_FUNC
-#define _VI_FUNCC
-#define _VI_FUNCH
-#define _VI_SIGNED signed
-#endif
-
-#define _VI_ERROR (-2147483647L-1) /* 0x80000000 */
-#define _VI_PTR _VI_FAR *
-
-/*- VISA Types --------------------------------------------------------------*/
-
-#ifndef _VI_INT64_UINT64_DEFINED
-#if defined(_WIN64) || ((defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) && !defined(_NI_mswin16_))
-#if (defined(_MSC_VER) && (_MSC_VER >= 1200)) || (defined(_CVI_) && (_CVI_ >= 700)) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0520))
-typedef unsigned __int64 ViUInt64;
-typedef _VI_SIGNED __int64 ViInt64;
-#define _VI_INT64_UINT64_DEFINED
-#if defined(_WIN64)
-#define _VISA_ENV_IS_64_BIT
-#else
-/* This is a 32-bit OS, not a 64-bit OS */
-#endif
-#endif
-#elif defined(__GNUC__) && (__GNUC__ >= 3)
-#include <limits.h>
-#include <sys/types.h>
-typedef u_int64_t ViUInt64;
-typedef int64_t ViInt64;
-#define _VI_INT64_UINT64_DEFINED
-#if defined(LONG_MAX) && (LONG_MAX > 0x7FFFFFFFL)
-#define _VISA_ENV_IS_64_BIT
-#else
-/* This is a 32-bit OS, not a 64-bit OS */
-#endif
-#else
-/* This platform does not support 64-bit types */
-#endif
-#endif
-
-#if defined(_VI_INT64_UINT64_DEFINED)
-typedef ViUInt64 _VI_PTR ViPUInt64;
-typedef ViUInt64 _VI_PTR ViAUInt64;
-typedef ViInt64 _VI_PTR ViPInt64;
-typedef ViInt64 _VI_PTR ViAInt64;
-#endif
-
-#if defined(LONG_MAX) && (LONG_MAX > 0x7FFFFFFFL)
-typedef unsigned int ViUInt32;
-typedef _VI_SIGNED int ViInt32;
-#else
-typedef unsigned long ViUInt32;
-typedef _VI_SIGNED long ViInt32;
-#endif
-
-typedef ViUInt32 _VI_PTR ViPUInt32;
-typedef ViUInt32 _VI_PTR ViAUInt32;
-typedef ViInt32 _VI_PTR ViPInt32;
-typedef ViInt32 _VI_PTR ViAInt32;
-
-typedef unsigned short ViUInt16;
-typedef ViUInt16 _VI_PTR ViPUInt16;
-typedef ViUInt16 _VI_PTR ViAUInt16;
-
-typedef _VI_SIGNED short ViInt16;
-typedef ViInt16 _VI_PTR ViPInt16;
-typedef ViInt16 _VI_PTR ViAInt16;
-
-typedef unsigned char ViUInt8;
-typedef ViUInt8 _VI_PTR ViPUInt8;
-typedef ViUInt8 _VI_PTR ViAUInt8;
-
-typedef _VI_SIGNED char ViInt8;
-typedef ViInt8 _VI_PTR ViPInt8;
-typedef ViInt8 _VI_PTR ViAInt8;
-
-typedef char ViChar;
-typedef ViChar _VI_PTR ViPChar;
-typedef ViChar _VI_PTR ViAChar;
-
-typedef unsigned char ViByte;
-typedef ViByte _VI_PTR ViPByte;
-typedef ViByte _VI_PTR ViAByte;
-
-typedef void _VI_PTR ViAddr;
-typedef ViAddr _VI_PTR ViPAddr;
-typedef ViAddr _VI_PTR ViAAddr;
-
-typedef float ViReal32;
-typedef ViReal32 _VI_PTR ViPReal32;
-typedef ViReal32 _VI_PTR ViAReal32;
-
-typedef double ViReal64;
-typedef ViReal64 _VI_PTR ViPReal64;
-typedef ViReal64 _VI_PTR ViAReal64;
-
-typedef ViPByte ViBuf;
-typedef ViPByte ViPBuf;
-typedef ViPByte _VI_PTR ViABuf;
-
-typedef ViPChar ViString;
-typedef ViPChar ViPString;
-typedef ViPChar _VI_PTR ViAString;
-
-typedef ViString ViRsrc;
-typedef ViString ViPRsrc;
-typedef ViString _VI_PTR ViARsrc;
-
-typedef ViUInt16 ViBoolean;
-typedef ViBoolean _VI_PTR ViPBoolean;
-typedef ViBoolean _VI_PTR ViABoolean;
-
-typedef ViInt32 ViStatus;
-typedef ViStatus _VI_PTR ViPStatus;
-typedef ViStatus _VI_PTR ViAStatus;
-
-typedef ViUInt32 ViVersion;
-typedef ViVersion _VI_PTR ViPVersion;
-typedef ViVersion _VI_PTR ViAVersion;
-
-typedef ViUInt32 ViObject;
-typedef ViObject _VI_PTR ViPObject;
-typedef ViObject _VI_PTR ViAObject;
-
-typedef ViObject ViSession;
-typedef ViSession _VI_PTR ViPSession;
-typedef ViSession _VI_PTR ViASession;
-
-typedef ViUInt32 ViAttr;
-
-#ifndef _VI_CONST_STRING_DEFINED
-typedef const ViChar * ViConstString;
-#define _VI_CONST_STRING_DEFINED
-#endif
-
-/*- Completion and Error Codes ----------------------------------------------*/
-
-#define VI_SUCCESS (0L)
-
-/*- Other VISA Definitions --------------------------------------------------*/
-
-#define VI_NULL (0)
-
-#define VI_TRUE (1)
-#define VI_FALSE (0)
-
-/*- Backward Compatibility Macros -------------------------------------------*/
-
-#define VISAFN _VI_FUNC
-#define ViPtr _VI_PTR
-
-#endif
-
-/*- The End -----------------------------------------------------------------*/
-
diff --git a/third_party/allwpilib_2017/hal/lib/shared/handles/HandlesInternal.cpp b/third_party/allwpilib_2017/hal/lib/shared/handles/HandlesInternal.cpp
deleted file mode 100644
index 26441d3..0000000
--- a/third_party/allwpilib_2017/hal/lib/shared/handles/HandlesInternal.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/handles/HandlesInternal.h"
-
-namespace hal {
-HAL_PortHandle createPortHandle(uint8_t channel, uint8_t module) {
- // set last 8 bits, then shift to first 8 bits
- HAL_PortHandle handle = static_cast<HAL_PortHandle>(HAL_HandleEnum::Port);
- handle = handle << 24;
- // shift module and add to 3rd set of 8 bits
- int32_t temp = module;
- temp = (temp << 8) & 0xff00;
- handle += temp;
- // add channel to last 8 bits
- handle += channel;
- return handle;
-}
-
-HAL_PortHandle createPortHandleForSPI(uint8_t channel) {
- // set last 8 bits, then shift to first 8 bits
- HAL_PortHandle handle = static_cast<HAL_PortHandle>(HAL_HandleEnum::Port);
- handle = handle << 16;
- // set second set up bits to 1
- int32_t temp = 1;
- temp = (temp << 8) & 0xff00;
- handle += temp;
- // shift to last set of bits
- handle = handle << 8;
- // add channel to last 8 bits
- handle += channel;
- return handle;
-}
-
-HAL_Handle createHandle(int16_t index, HAL_HandleEnum handleType) {
- if (index < 0) return HAL_kInvalidHandle;
- uint8_t hType = static_cast<uint8_t>(handleType);
- if (hType == 0 || hType > 127) return HAL_kInvalidHandle;
- // set last 8 bits, then shift to first 8 bits
- HAL_Handle handle = hType;
- handle = handle << 24;
- // add index to set last 16 bits
- handle += index;
- return handle;
-}
-} // namespace hal
diff --git a/third_party/allwpilib_2017/hal/lib/sim/HALDesktop.cpp b/third_party/allwpilib_2017/hal/lib/sim/HALDesktop.cpp
deleted file mode 100644
index adbc0dc..0000000
--- a/third_party/allwpilib_2017/hal/lib/sim/HALDesktop.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-// nothing here yet!
diff --git a/third_party/allwpilib_2017/license.txt b/third_party/allwpilib_2017/license.txt
deleted file mode 100644
index 9c33de4..0000000
--- a/third_party/allwpilib_2017/license.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-* Copyright (c) 2009-2016 FIRST
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the FIRST nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY FIRST AND CONTRIBUTORS``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR
-* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/third_party/allwpilib_2017/settings.gradle b/third_party/allwpilib_2017/settings.gradle
deleted file mode 100644
index ef54d01..0000000
--- a/third_party/allwpilib_2017/settings.gradle
+++ /dev/null
@@ -1,13 +0,0 @@
-include 'hal',
- 'wpilibc',
- 'wpilibcIntegrationTests',
- 'wpilibj',
- 'wpilibjIntegrationTests',
- 'myRobot',
- 'myRobotCpp'
-
-if (hasProperty("makeSim")){
- include 'simulation',
- 'simulation:JavaGazebo',
- 'simulation:SimDS'
-}
diff --git a/third_party/allwpilib_2017/styleguide/checkstyle.xml b/third_party/allwpilib_2017/styleguide/checkstyle.xml
deleted file mode 100644
index bfafc17..0000000
--- a/third_party/allwpilib_2017/styleguide/checkstyle.xml
+++ /dev/null
@@ -1,217 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE module PUBLIC
- "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
- "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
-
-<!--
- Checkstyle configuration that checks the Google coding conventions from Google Java Style
- that can be found at https://google.github.io/styleguide/javaguide.html.
-
- Checkstyle is very configurable. Be sure to read the documentation at
- http://checkstyle.sf.net (or in your downloaded distribution).
-
- To completely disable a check, just comment it out or delete it from the file.
-
- Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
- -->
-
-<module name = "Checker">
- <property name="charset" value="UTF-8"/>
-
- <property name="severity" value="error"/>
-
- <module name="SuppressionFilter">
- <property name="file" value="styleguide/suppressions.xml" />
- </module>
-
- <property name="fileExtensions" value="java, properties, xml"/>
- <!-- Checks for whitespace -->
- <!-- See http://checkstyle.sf.net/config_whitespace.html -->
- <module name="FileTabCharacter">
- <property name="eachLine" value="true"/>
- </module>
-
- <module name="SuppressWarningsFilter" />
-
- <module name="TreeWalker">
- <module name="SuppressWarningsHolder" />
- <module name="OuterTypeFilename"/>
- <module name="IllegalTokenText">
- <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
- <property name="format" value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
- <property name="message" value="Avoid using corresponding octal or Unicode escape."/>
- </module>
- <module name="AvoidEscapedUnicodeCharacters">
- <property name="allowEscapesForControlCharacters" value="true"/>
- <property name="allowByTailComment" value="true"/>
- <property name="allowNonPrintableEscapes" value="true"/>
- </module>
- <module name="LineLength">
- <property name="max" value="100"/>
- <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
- </module>
- <module name="AvoidStarImport"/>
- <module name="RedundantImport"/>
- <module name="UnusedImports"/>
- <module name="OneTopLevelClass"/>
- <module name="NoLineWrap"/>
- <module name="EmptyBlock">
- <property name="option" value="TEXT"/>
- <property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
- </module>
- <module name="NeedBraces"/>
- <module name="LeftCurly">
- <property name="maxLineLength" value="100"/>
- </module>
- <module name="RightCurly"/>
- <module name="RightCurly">
- <property name="option" value="alone"/>
- <property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
- </module>
- <module name="WhitespaceAround">
- <property name="allowEmptyConstructors" value="true"/>
- <property name="allowEmptyMethods" value="true"/>
- <property name="allowEmptyTypes" value="true"/>
- <property name="allowEmptyLoops" value="true"/>
- <message key="ws.notFollowed"
- value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
- <message key="ws.notPreceded"
- value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
- </module>
- <module name="OneStatementPerLine"/>
- <module name="MultipleVariableDeclarations"/>
- <module name="ArrayTypeStyle"/>
- <module name="MissingSwitchDefault"/>
- <module name="FallThrough"/>
- <module name="UpperEll"/>
- <module name="ModifierOrder"/>
- <module name="EmptyLineSeparator">
- <property name="allowNoEmptyLineBetweenFields" value="true"/>
- </module>
- <module name="SeparatorWrap">
- <property name="tokens" value="DOT"/>
- <property name="option" value="nl"/>
- </module>
- <module name="SeparatorWrap">
- <property name="tokens" value="COMMA"/>
- <property name="option" value="EOL"/>
- </module>
- <module name="PackageName">
- <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
- <message key="name.invalidPattern"
- value="Package name ''{0}'' must match pattern ''{1}''."/>
- </module>
- <module name="TypeName">
- <message key="name.invalidPattern"
- value="Type name ''{0}'' must match pattern ''{1}''."/>
- </module>
- <module name="MemberName">
- <property name="format" value="^m_[a-z][a-z0-9][a-zA-Z0-9]*$"/>
- <message key="name.invalidPattern"
- value="Member name ''{0}'' must match pattern ''{1}''."/>
- </module>
- <module name="ParameterName">
- <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
- <message key="name.invalidPattern"
- value="Parameter name ''{0}'' must match pattern ''{1}''."/>
- </module>
- <module name="CatchParameterName">
- <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
- <message key="name.invalidPattern"
- value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
- </module>
- <module name="LocalVariableName">
- <property name="tokens" value="VARIABLE_DEF"/>
- <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
- <property name="allowOneCharVarInForLoop" value="true"/>
- <message key="name.invalidPattern"
- value="Local variable name ''{0}'' must match pattern ''{1}''."/>
- </module>
- <module name="ClassTypeParameterName">
- <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
- <message key="name.invalidPattern"
- value="Class type name ''{0}'' must match pattern ''{1}''."/>
- </module>
- <module name="MethodTypeParameterName">
- <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
- <message key="name.invalidPattern"
- value="Method type name ''{0}'' must match pattern ''{1}''."/>
- </module>
- <module name="InterfaceTypeParameterName">
- <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
- <message key="name.invalidPattern"
- value="Interface type name ''{0}'' must match pattern ''{1}''."/>
- </module>
- <module name="NoFinalizer"/>
- <module name="GenericWhitespace">
- <message key="ws.followed"
- value="GenericWhitespace ''{0}'' is followed by whitespace."/>
- <message key="ws.preceded"
- value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
- <message key="ws.illegalFollow"
- value="GenericWhitespace ''{0}'' should followed by whitespace."/>
- <message key="ws.notPreceded"
- value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
- </module>
- <module name="Indentation">
- <property name="basicOffset" value="2"/>
- <property name="braceAdjustment" value="0"/>
- <property name="caseIndent" value="2"/>
- <property name="throwsIndent" value="4"/>
- <property name="lineWrappingIndentation" value="4"/>
- <property name="arrayInitIndent" value="2"/>
- </module>
- <module name="AbbreviationAsWordInName">
- <property name="ignoreFinal" value="false"/>
- <property name="allowedAbbreviationLength" value="3"/>
- </module>
- <module name="OverloadMethodsDeclarationOrder"/>
- <module name="VariableDeclarationUsageDistance"/>
- <module name="MethodParamPad"/>
- <module name="OperatorWrap">
- <property name="option" value="NL"/>
- <property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/>
- </module>
- <module name="AnnotationLocation">
- <property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
- </module>
- <module name="AnnotationLocation">
- <property name="tokens" value="VARIABLE_DEF"/>
- <property name="allowSamelineMultipleAnnotations" value="true"/>
- </module>
- <module name="NonEmptyAtclauseDescription"/>
- <module name="JavadocTagContinuationIndentation"/>
- <module name="SummaryJavadoc">
- <property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
- </module>
- <module name="JavadocParagraph"/>
- <module name="AtclauseOrder">
- <property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
- <property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
- </module>
- <module name="JavadocMethod">
- <property name="scope" value="public"/>
- <property name="allowMissingParamTags" value="true"/>
- <property name="allowMissingThrowsTags" value="true"/>
- <property name="allowMissingReturnTag" value="true"/>
- <property name="minLineCount" value="2"/>
- <property name="allowedAnnotations"
- value="Override, Test, Before, After, BeforeClass, AfterClass, Parameters"/>
- <property name="allowUndeclaredRTE" value="true"/>
- <property name="allowThrowsTagsForSubclasses" value="true"/>
- <property name="suppressLoadErrors" value="true"/>
- </module>
- <module name="MethodName">
- <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
- <message key="name.invalidPattern"
- value="Method name ''{0}'' must match pattern ''{1}''."/>
- </module>
- <module name="SingleLineJavadoc">
- <property name="ignoreInlineTags" value="false"/>
- </module>
- <module name="EmptyCatchBlock">
- <property name="exceptionVariableName" value="expected"/>
- </module>
- <module name="CommentsIndentation"/>
- </module>
-</module>
diff --git a/third_party/allwpilib_2017/styleguide/pmd-ruleset.xml b/third_party/allwpilib_2017/styleguide/pmd-ruleset.xml
deleted file mode 100644
index dc5c1da..0000000
--- a/third_party/allwpilib_2017/styleguide/pmd-ruleset.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<ruleset name="WPILibRuleset"
- xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
- <rule ref="rulesets/java/basic.xml" />
- <rule ref="rulesets/java/braces.xml" />
- <rule ref="rulesets/java/empty.xml" />
- <rule ref="rulesets/java/empty.xml/EmptyCatchBlock">
- <properties>
- <property name="allowCommentedBlocks" value="true"/>
- </properties>
- </rule>
- <rule ref="rulesets/java/imports.xml" />
- <rule ref="rulesets/java/junit.xml">
- <exclude name="JUnitTestContainsTooManyAsserts" />
- </rule>
- <rule ref="rulesets/java/strings.xml">
- <exclude name="AvoidDuplicateLiterals" />
- </rule>
- <rule ref="rulesets/java/unnecessary.xml" />
- <rule ref="rulesets/java/unusedcode.xml" />
- <rule ref="rulesets/java/unusedcode.xml/UnusedFormalParameter">
- <properties>
- <property name="checkAll" value="true"/>
- </properties>
- </rule>
-</ruleset>
diff --git a/third_party/allwpilib_2017/styleguide/suppressions.xml b/third_party/allwpilib_2017/styleguide/suppressions.xml
deleted file mode 100644
index b969dee..0000000
--- a/third_party/allwpilib_2017/styleguide/suppressions.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE suppressions PUBLIC
- "-//Puppy Crawl//DTD Suppressions 1.1//EN"
- "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
-<suppressions>
- <suppress files=".*sim.*" checks="[a-zA-Z0-9]*"/>
-</suppressions>
diff --git a/third_party/allwpilib_2017/test-scripts/.gitattributes b/third_party/allwpilib_2017/test-scripts/.gitattributes
deleted file mode 100644
index cb5c152..0000000
--- a/third_party/allwpilib_2017/test-scripts/.gitattributes
+++ /dev/null
@@ -1,4 +0,0 @@
-# Set the default behavior, in case people don't have core.autocrlf set.
-* text=auto
-
-*.sh text eol=lf
diff --git a/third_party/allwpilib_2017/test-scripts/README.md b/third_party/allwpilib_2017/test-scripts/README.md
deleted file mode 100644
index a96764e..0000000
--- a/third_party/allwpilib_2017/test-scripts/README.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# WPILIB TEST SCRIPTS
-## Overview
-These test scripts are designed to allow the user of the WPILib test framework to quickly and easily deploy and run their tests on the WPI roboRIO.
-
-In order for the automated test system to work there is a driverstation onboard the roboRIO that handles a queue of users waiting to use the driver station. All of the interaction with this queue is handled internally by test scripts contained within this folder.
-
-If you deploy code to the test stand using the Eclipse plugins, you _must_ remove the build artifacts in `/home/lvuser`, or you will break tests.
-
-## roboRIO Setup
-The roboRIO on the test bench must be updated everytime NI releases a new image.
-
-1. [Use the roboRIO Imaging Tool to format the roboRIO with the lastest image.](https://wpilib.screenstepslive.com/s/4485/m/13503/l/144984-imaging-your-roborio)
-2. [Install Java on the roboRIO.](https://wpilib.screenstepslive.com/s/4485/m/13503/l/599747-installing-java-8-on-the-roborio-using-the-frc-roborio-java-installer-java-only)
-3. SFTP the [teststand, netconsole, and libstdc++ ipk files](https://users.wpi.edu/~phplenefisch/ipk/) on to the roboRIO.
-4. ssh on to the roboRIO as the admin user (ex: `ssh admin@roboRIO-190-FRC.local`)
-5. Use opkg to install the ipk files (ex: `opkg install teststand_1.2-1_armv7a-vfp.ipk`)
-6. Reboot the roboRIO
diff --git a/third_party/allwpilib_2017/test-scripts/config.sh b/third_party/allwpilib_2017/test-scripts/config.sh
deleted file mode 100755
index 1d2688e..0000000
--- a/third_party/allwpilib_2017/test-scripts/config.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env bash
-#*----------------------------------------------------------------------------*#
-#* Copyright (c) FIRST 2014. 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. *#
-#*----------------------------------------------------------------------------*#
-
-# If this is changed, update the .gitignore
-# so that test results are not commited to the repo
-DEFAULT_LOCAL_TEST_RESULTS_DIR=../test-reports
-
-ROBOT_ADDRESS=admin@roboRIO-190-FRC.local
-ADMIN_ROBOT_ADDRESS=admin@roboRIO-190-FRC.local
-DEFAULT_LOCAL_RUN_TEST_SCRIPT="run-tests-on-robot.sh"
-
-DEFAULT_DESTINATION_DIR=/home/admin
-DEFAULT_TEST_SCP_DIR=${DEFAULT_DESTINATION_DIR}/deployedTests
-DEFAULT_DESTINATION_TEST_RESULTS_DIR=${DEFAULT_DESTINATION_DIR}/testResults
-
-# C++ test variables
-DEFAULT_CPP_TEST_NAME=FRCUserProgram
-DEFAULT_CPP_TEST_ARGS="--gtest_color=yes"
-DEFAULT_LOCAL_CPP_TEST_FILE=../wpilibcIntegrationTests/build/exe/fRCUserProgram/FRCUserProgram
-
-CPP_REPORT=cppreport.xml
-DEFAULT_LOCAL_CPP_TEST_RESULT=${DEFAULT_LOCAL_TEST_RESULTS_DIR}/${CPP_REPORT}
-DEFAULT_DESTINATION_CPP_TEST_RESULTS=${DEFAULT_DESTINATION_TEST_RESULTS_DIR}/${CPP_REPORT}
-
-# Java test variables
-DEFAULT_JAVA_TEST_NAME=FRCUserProgram.jar
-DEFAULT_JAVA_TEST_ARGS=""
-
-DEFAULT_LOCAL_JAVA_TEST_FILE=../wpilibjIntegrationTests/build/libs/wpilibjIntegrationTests-all.jar
-
-JAVA_REPORT=javareport.xml
-DEFAULT_LIBRARY_NATIVE_FILES=../wpilibjIntegrationTests/build/nativelibraries
-DEFAULT_LIBRARY_NATIVE_DESTINATION=/usr/local/frc/lib
-DEFAULT_LOCAL_JAVA_TEST_RESULT=${DEFAULT_LOCAL_TEST_RESULTS_DIR}/${JAVA_REPORT}
-DEFAULT_DESTINATION_JAVA_TEST_RESULTS=${DEFAULT_DESTINATION_TEST_RESULTS_DIR}/AntReports/TEST-edu.wpi.first.wpilibj.test.TestSuite.xml
diff --git a/third_party/allwpilib_2017/test-scripts/deploy-and-run-test-on-robot.sh b/third_party/allwpilib_2017/test-scripts/deploy-and-run-test-on-robot.sh
deleted file mode 100755
index a4232e6..0000000
--- a/third_party/allwpilib_2017/test-scripts/deploy-and-run-test-on-robot.sh
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env bash
-#*----------------------------------------------------------------------------*#
-#* Copyright (c) FIRST 2014. 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. *#
-#*----------------------------------------------------------------------------*#
-
-# Configurable variables
-source config.sh
-
-# Java variables
-DEFAULT_DESTINATION_JAVA_TEST_FILE=${DEFAULT_TEST_SCP_DIR}/${DEFAULT_JAVA_TEST_NAME}
-
-# C++ Variables
-DEFAULT_DESTINATION_CPP_TEST_FILE=${DEFAULT_TEST_SCP_DIR}/${DEFAULT_CPP_TEST_NAME}
-
-DEFAULT_DESTINATION_RUN_TEST_SCRIPT=${DEFAULT_DESTINATION_DIR}/${DEFAULT_LOCAL_RUN_TEST_SCRIPT}
-
-usage="$(basename "$0") [-h] (java|cpp) [-m] [-A] [arg] [arg]...
-A script designed to run the integration tests.
-This script should only be run on the roborio.
-Where:
- -h Show this help text.
- -m The driver station mutex will be handled manually.
- -A Disable language recomended arguments.
- arg Additional arguments to be passed to test."
-
-
-# These variables are set when the language is selected
-LANGUAGE=none
-LOCAL_TEST_FILE=none
-DESTINATION_TEST_FILE=none
-LIBRARY_FILES=none
-TEST_RUN_ARGS=""
-
-# Begin searching for options from the third paramater on
-PARAM_ARGS=${@:2}
-
-if [[ "$1" = java ]]; then
- LANGUAGE=$1
- LOCAL_TEST_FILE=$DEFAULT_LOCAL_JAVA_TEST_FILE
- DESTINATION_TEST_FILE=$DEFAULT_DESTINATION_JAVA_TEST_FILE
-elif [[ "$1" = cpp ]]; then
- LANGUAGE=$1
- LOCAL_TEST_FILE=$DEFAULT_LOCAL_CPP_TEST_FILE
- DESTINATION_TEST_FILE=$DEFAULT_DESTINATION_CPP_TEST_FILE
-elif [[ "$1" = "-h" ]]; then
- printf "Usage:\n"
- echo "$usage"
- exit
-else
- printf "Invalid language selection: %s\n\n" "$1" >&2
- echo "$usage" >&2
- exit 1
-fi
-
-# Check if the test file to upload exists
-if [[ ! -e ${LOCAL_TEST_FILE} ]]; then
- printf "The test file does not exist: %s\nAre you sure that you compiled the tests??\n\n" "${LOCAL_TEST_FILE}" >&2
- echo "$usage" >&2
- exit 1
-fi
-
-MUTEX_OVERRIDE_PARAM_TEXT=""
-if [[ "$2" = "-m" ]]; then
- MUTEX_OVERRIDE_PARAM_TEXT="-m "
- TEST_RUN_ARGS="${@:3}"
-else
- TEST_RUN_ARGS="${@:2}"
-fi
-
-shopt -s huponexit
-
-SCP_TEST_SCRIPT="scp config.sh ${DEFAULT_LOCAL_RUN_TEST_SCRIPT} ${ROBOT_ADDRESS}:/${DEFAULT_DESTINATION_DIR}"
-SSH_CHMOD_AND_MAKE_TEMP_TEST_DIR="ssh -t ${ROBOT_ADDRESS} \"chmod a+x ${DEFAULT_DESTINATION_RUN_TEST_SCRIPT}; mkdir ${DEFAULT_TEST_SCP_DIR}; touch ${DESTINATION_TEST_FILE}\""
-SCP_TEST_PROGRAM="scp ${LOCAL_TEST_FILE} ${ROBOT_ADDRESS}:${DESTINATION_TEST_FILE}"
-SSH_RUN_TESTS="ssh -t ${ROBOT_ADDRESS} ${DEFAULT_DESTINATION_RUN_TEST_SCRIPT} ${LANGUAGE} $(whoami) ${MUTEX_OVERRIDE_PARAM_TEXT}-d ${DEFAULT_TEST_SCP_DIR} ${TEST_RUN_ARGS}"
-SCP_NATIVE_LIBRARIES="scp ${DEFAULT_LIBRARY_NATIVE_FILES}/* ${ROBOT_ADDRESS}:${DEFAULT_LIBRARY_NATIVE_DESTINATION}"
-CONFIG_NATIVE_LIBRARIES="ssh -t ${ADMIN_ROBOT_ADDRESS} ldconfig"
-
-if [ $(which sshpass) ]; then
- sshpass -p "" ${SCP_NATIVE_LIBRARIES}
- sshpass -p "" ${CONFIG_NATIVE_LIBRARIES}
- sshpass -p "" ${SCP_TEST_SCRIPT}
- sshpass -p "" ${SSH_CHMOD_AND_MAKE_TEMP_TEST_DIR}
- sshpass -p "" ${SCP_TEST_PROGRAM}
- sshpass -p "" ${SSH_RUN_TESTS}
-else
- eval ${SCP_NATIVE_LIBRARIES}
- eval ${CONFIG_NATIVE_LIBRARIES}
- eval ${SCP_TEST_SCRIPT}
- eval ${SSH_CHMOD_AND_MAKE_TEMP_TEST_DIR}
- eval ${SCP_TEST_PROGRAM}
- eval ${SSH_RUN_TESTS}
-fi
diff --git a/third_party/allwpilib_2017/test-scripts/jenkins-run-tests-get-results.sh b/third_party/allwpilib_2017/test-scripts/jenkins-run-tests-get-results.sh
deleted file mode 100755
index 71b4945..0000000
--- a/third_party/allwpilib_2017/test-scripts/jenkins-run-tests-get-results.sh
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/env bash
-#*----------------------------------------------------------------------------*#
-#* Copyright (c) FIRST 2014. 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. *#
-#*----------------------------------------------------------------------------*#
-
-# Configurable variables
-source config.sh
-
-# Setup the mutex release before we grab it
-mutexTaken=false
-# This function should run even if the script exits abnormally
-function finish {
- if [ "$mutexTaken" == true ]; then
- SSH_GIVE_MUTEX="ssh -t ${ROBOT_ADDRESS} /usr/local/frc/bin/teststand give --name=$(whoami)"
- if [ $(which sshpass) ]; then
- sshpass -p "" ${SSH_GIVE_MUTEX}
- else
- printf "WARNING!!! THIS IS HOW THE MUTEX IS RELEASED!\nIF YOU CHOOSE TO 'ctr+c' NOW YOU WILL HAVE TO HAND BACK THE MUTEX MANUALLY ON THE ROBOT.\n"
- eval ${SSH_GIVE_MUTEX}
- fi
- mutexTaken=false
- fi
-}
-trap finish EXIT SIGINT
-
-
-
-# Take the mutex from the driver station
-mutexTaken=true
-SSH_TAKE_MUTEX="ssh -t ${ROBOT_ADDRESS} /usr/local/frc/bin/teststand take --name=$(whoami)"
-if [ $(which sshpass) ]; then
- sshpass -p "" ${SSH_TAKE_MUTEX}
-else
- eval ${SSH_TAKE_MUTEX}
-fi
-
-# If there are already test results in the repository then remove them
-if [[ -e ${DEFAULT_LOCAL_TEST_RESULTS_DIR} ]]; then
- rm -R ${DEFAULT_LOCAL_TEST_RESULTS_DIR}
-fi
-
-# Make the directory where the tests should live
-mkdir ${DEFAULT_LOCAL_TEST_RESULTS_DIR} 2>/dev/null
-
-# Remove the preivous test results from the the robot
-SSH_REMOVE_OLD_TEST_RESULTS="ssh -t ${ROBOT_ADDRESS} rm -R ${DEFAULT_DESTINATION_TEST_RESULTS_DIR}; mkdir ${DEFAULT_DESTINATION_TEST_RESULTS_DIR}"
-if [ $(which sshpass) ]; then
- sshpass -p "" ${SSH_REMOVE_OLD_TEST_RESULTS}
-else
- eval ${SSH_REMOVE_OLD_TEST_RESULTS}
-fi
-
-printf "Running cpp test\n"
-
-# Run the C++ Tests
-./deploy-and-run-test-on-robot.sh cpp -m -A "--gtest_output=xml:${DEFAULT_DESTINATION_CPP_TEST_RESULTS}"
-
-# Retrive the C++ Test Results
-SCP_GET_CPP_TEST_RESULT="scp ${ROBOT_ADDRESS}:${DEFAULT_DESTINATION_CPP_TEST_RESULTS} ${DEFAULT_LOCAL_CPP_TEST_RESULT}"
-if [ $(which sshpass) ]; then
- sshpass -p "" ${SCP_GET_CPP_TEST_RESULT}
-else
- eval ${SCP_GET_CPP_TEST_RESULT}
-fi
-
-# Run the Java Tests
-./deploy-and-run-test-on-robot.sh java -m
-
-# Retrive the Java Test Results
-SCP_GET_JAVA_TEST_RESULT="scp ${ROBOT_ADDRESS}:${DEFAULT_DESTINATION_JAVA_TEST_RESULTS} ${DEFAULT_LOCAL_JAVA_TEST_RESULT}"
-if [ $(which sshpass) ]; then
- sshpass -p "" ${SCP_GET_JAVA_TEST_RESULT}
-else
- eval ${SCP_GET_JAVA_TEST_RESULT}
-fi
-
-# Make sure that we got test results back.
-if [ ! -e ${DEFAULT_LOCAL_CPP_TEST_RESULT} ]; then
- echo "There are no results from the C++ tests; they must have failed."
- exit 100
-fi
-
-if [ ! -e ${DEFAULT_LOCAL_JAVA_TEST_RESULT} ]; then
- echo "There are no results from the Java tests; they must have failed."
- exit 101
-fi
-
-# The mutex is released when this program exits
diff --git a/third_party/allwpilib_2017/test-scripts/run-tests-on-robot.sh b/third_party/allwpilib_2017/test-scripts/run-tests-on-robot.sh
deleted file mode 100755
index 4785dd5..0000000
--- a/third_party/allwpilib_2017/test-scripts/run-tests-on-robot.sh
+++ /dev/null
@@ -1,200 +0,0 @@
-#!/usr/bin/env bash
-#*----------------------------------------------------------------------------*#
-#* Copyright (c) FIRST 2014. 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. *#
-#*----------------------------------------------------------------------------*#
-
-# This file is intended to be run in the DEFAULT_TEST_DIR on the roboRIO.
-# Do not attempt to run this file on your local system.
-# There is one file (delploy-and-run-test-on-robot.sh) that is designed to
-# deploy this file allong with the compiled tests for you.
-
-# Configurable variables
-source config.sh
-
-DEFAULT_TEST_DIR=${DEFAULT_DESTINATION_DIR}
-DEFAULT_PATH_TO_JRE=/usr/local/frc/JRE/bin/java
-
-usage="$(basename "$0") [-h] (java|cpp) name [-d test_dir] [-m] [-A] [arg] [arg]...
-A script designed to run the integration tests.
-This script should only be run on the roborio.
-Where:
- -h Show this help text
- name The name of the user trying to run the tests (used for driver station)
- -d The directory where the tests have been placed.
- This is done to prevent overwriting an already running program
- in the case where another user already has the driver station mutex.
- This scrip will automatically move the test into the ${DEFAULT_TEST_DIR}
- directory when the driver station mutex is released.
- Default: Assumes the test is in the same directory as this scrip.
- -m The driver station mutex will be handled manually.
- -A Do not use the default arguments for the given language.
- arg The arguments to be passed to test."
-
-mutexTaken=false
-driverStationEnabled=false
-# This function should run even if the script exits abnormally
-function finish {
- if [ "$driverStationEnabled" == true ]; then
- /usr/local/frc/bin/teststand ds --name="${NAME}" disable
- driverStationEnabled=false
- fi
- if [ "$mutexTaken" == true ]; then
- /usr/local/frc/bin/teststand give --name="${NAME}"
- mutexTaken=false
- fi
-}
-trap finish EXIT SIGINT
-
-# This function should be run asynchronysly to enable the tests 10
-# seconds after they have been run.
-function enableIn10Seconds {
- /usr/local/frc/bin/teststand ds --name="${NAME}" disable
- driverStationEnabled=true
- sleep 10
- /usr/local/frc/bin/teststand ds --name="${NAME}" enable
-}
-
-# Are you trying to run this program on a platform other than the roboRIO?
-if [[ ! -e "${DEFAULT_TEST_DIR}" ]]; then
- printf "Failed to find %s\nAre you trying to run this file on your local computer?\n" "${DEFAULT_TEST_DIR}"
- printf "This script should only be run on the roboRIO.\n\n"
- echo "$usage"
- exit 1
-fi
-
-LANGUAGE=none
-TEST_FILE=none
-NAME=$2
-TEST_DIR="$DEFAULT_TEST_DIR"
-# Begin searching for options from the third paramater on
-PARAM_ARGS=${@:3}
-# Where the test arguments start
-TEST_RUN_ARGS=${@:3}
-RUN_WITH_DEFAULT_ARGS=true
-DEFAULT_ARGS=""
-MUTEX_OVERRIDE=false
-
-# Determine the language that we are attempting to run
-if [[ "$1" = java ]]; then
- LANGUAGE=$1
- TEST_FILE=$DEFAULT_JAVA_TEST_NAME
- DEFAULT_ARGS=$DEFAULT_JAVA_TEST_ARGS
-elif [[ "$1" = cpp ]]; then
- LANGUAGE=$1
- TEST_FILE=$DEFAULT_CPP_TEST_NAME
- DEFAULT_ARGS=$DEFAULT_CPP_TEST_ARGS
-elif [[ "$1" = "-h" ]]; then
- #If the first argument is the help option
- #Allow it to be searhced for in getopts
- PARAM_ARGS=${@}
-else
- printf "Invalid language selection: %s\n\n" "$1" >&2
- echo "$usage" >&2
- exit 1
-fi
-
-PARAM_COUNTER=2
-printf "Param Args ${PARAM_ARGS}\n"
-
-# Check for optional paramaters
-while getopts ':hmd:A' option $PARAM_ARGS ; do
- case "$option" in
- h)
- # Print the help message
- printf "Usage:\n"
- echo "$usage"
- exit
- ;;
- A)
- # Remove the default arguments
- RUN_WITH_DEFAULT_ARGS=false
- PARAM_COUNTER=$[$PARAM_COUNTER +1]
- ;;
- m)
- MUTEX_OVERRIDE=true
- PARAM_COUNTER=$[$PARAM_COUNTER +1]
- ;;
- d)
- TEST_DIR=$OPTARG
- # Since we are selecting the directory the run args start from the 5th argument
- PARAM_COUNTER=$[$PARAM_COUNTER +2]
- ;;
- ?)
- # When an unknown param is found then we are done so break
- break
- ;;
- esac
-done
-
-TEST_RUN_ARGS=${@:$[$PARAM_COUNTER +1]}
-
-if [[ "$RUN_WITH_DEFAULT_ARGS" == true ]]; then
- TEST_RUN_ARGS="${DEFAULT_ARGS} ${TEST_RUN_ARGS}"
-fi
-
-# Make sure at least two paramaters are passed or four if running with -d option
-if [[ $# -lt $PARAM_COUNTER ]]; then
- printf "Invalid arg count. Should be %s, was %s.\n" "${PARAM_COUNTER}" "$#"
- echo "$usage"
- exit 1
-fi
-
-# If the mutex has been retrived a higher level in the tree
-if [ "$MUTEX_OVERRIDE" == false ]; then
- # Attempt to take the mutex for the driver station
- mutexTaken=true
- /usr/local/frc/bin/teststand take --name="${NAME}"
-else
- printf "Override driver station control enabled.\n"
-fi
-
-# Kill all running robot programs
-killall java FRCUserProgram
-
-# Once we have the mutex no other tests are running
-# If we are running with the -d argument move the test to the DEFAULT_TEST_DIR
-if [[ ! -e "${TEST_DIR}/${TEST_FILE}" ]]; then
- printf "Failed to find %s.\nDid you copy the test file correctly?\n" "${TEST_DIR}/${TEST_FILE}"
- echo "$usage"
- exit 1
-elif [[ $TEST_DIR != "$DEFAULT_TEST_DIR" ]]; then
- mv "${TEST_DIR}/${TEST_FILE}" "${DEFAULT_TEST_DIR}"
-fi
-
-# Make sure the excecutable file has permission to run
-
-# Setup the driver station to enable automatically in 10 seconds without waiting for the function to excecute.
-enableIn10Seconds&
-
-# Get the serial number and FPGADeviceCode for this rio
-export serialnum=`/sbin/fw_printenv -n serial#`
-export eval `/sbin/fw_printenv DeviceCode FPGADeviceCode DeviceDesc TargetClass`
-
-# Store the run command for the language
-RUN_COMMAND=none
-if [[ ${LANGUAGE} = java ]]; then
- chmod a+x ${DEFAULT_JAVA_TEST_NAME}
- RUN_COMMAND="env LD_LIBRARY_PATH=/opt/GenICam_v3_0_NI/bin/Linux32_ARM/:/usr/local/frc/lib ${DEFAULT_PATH_TO_JRE} -ea -jar ${DEFAULT_JAVA_TEST_NAME} ${TEST_RUN_ARGS}"
-elif [[ ${LANGUAGE} = cpp ]]; then
- chmod a+x ${DEFAULT_CPP_TEST_NAME}
- RUN_COMMAND="./${DEFAULT_CPP_TEST_NAME} ${TEST_RUN_ARGS}"
-fi
-
-printf "Running: %s\n\n" "${RUN_COMMAND}"
-COREDUMP_DIR=${DEFAULT_DESTINATION_TEST_RESULTS_DIR}/coredump
-mkdir -p ${COREDUMP_DIR}
-CORE_LOCATION=${COREDUMP_DIR}/core
-echo ${CORE_LOCATION} > /proc/sys/kernel/core_pattern
-ulimit -c unlimited
-eval ${RUN_COMMAND}
-if [[ $? -gt 127 && -e ${CORE_LOCATION} ]]; then
- mv ${CORE_LOCATION} ${COREDUMP_DIR}/core.${LANGUAGE}
- if [[ ${LANGUAGE} = java ]]; then
- cp -p ${DEFAULT_JAVA_TEST_NAME} ${COREDUMP_DIR}/
- elif [[ ${LANGUAGE} = cpp ]]; then
- cp -p ${DEFAULT_CPP_TEST_NAME} ${COREDUMP_DIR}/
- fi
-fi
diff --git a/third_party/allwpilib_2017/test-scripts/spawn_driver_station.sh b/third_party/allwpilib_2017/test-scripts/spawn_driver_station.sh
deleted file mode 100755
index d41b41d..0000000
--- a/third_party/allwpilib_2017/test-scripts/spawn_driver_station.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env bash
-#*----------------------------------------------------------------------------*#
-#* Copyright (c) FIRST 2014. 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. *#
-#*----------------------------------------------------------------------------*#
-
-source config.sh
-
-TESTSTAND_SERVE_COMMAND="/usr/local/frc/bin/teststand serve"
-
-#Checks to see if the mutex driver station is running. If it isn't then start it.
-
-SSH_CHECK_FOR_TESTSTAND="ssh -qn ${ADMIN_ROBOT_ADDRESS} 'pidof ${TESTSTAND_SERVE_COMMAND}' &>/dev/null"
-
-TESTSTAND_SERVE_COMMAND="nohup ${TESTSTAND_SERVE_COMMAND} > /dev/null 2>&1 < /dev/null &"
-
-if [ $(which sshpass) ]; then
- SSH_CHECK_FOR_TESTSTAND="sshpass -p '' ${SSH_CHECK_FOR_TESTSTAND}"
-fi
-
-echo $SSH_CHECK_FOR_TESTSTAND
-
-if $(eval $SSH_CHECK_FOR_TESTSTAND); then
- echo "Driver Station is already running";
- exit 0;
-fi
-
-echo "Starting Driver Station";
-
-function startDS {
- SSH_START_TESTSTAND_DRIVER_STATION="ssh ${ADMIN_ROBOT_ADDRESS} ${TESTSTAND_SERVE_COMMAND}"
- if [ $(which sshpass) ]; then
- sshpass -p "" ${SSH_START_TESTSTAND_DRIVER_STATION}
- else
- eval ${SSH_START_TESTSTAND_DRIVER_STATION}
- fi
-}
-
-startDS&
-
-sleep 1
diff --git a/third_party/allwpilib_2017/wpilibc/athena.gradle b/third_party/allwpilib_2017/wpilibc/athena.gradle
deleted file mode 100644
index 17c04e2..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena.gradle
+++ /dev/null
@@ -1,157 +0,0 @@
-defineNetworkTablesProperties()
-defineWpiUtilProperties()
-defineCsCoreProperties()
-
-debugStripSetup(project)
-
-def ntSourceDir = "$buildDir/ntSources"
-
-model {
- components {
- wpilibc(NativeLibrarySpec) {
- targetPlatform 'roborio-arm'
- binaries.all {
- tasks.withType(CppCompile) {
- dependsOn generateCppVersion
- cppCompiler.args "-DNAMESPACED_WPILIB"
- addNiLibraryLinks(linker, targetPlatform)
- addNetworkTablesLibraryLinks(it, linker, targetPlatform)
- addCsCoreLibraryLinks(it, linker, targetPlatform)
- }
- }
- sources {
- cpp {
- source {
- srcDirs = ["${project.shared}/src", "${project.athena}/src"]
- includes = ['**/*.cpp']
- }
- exportedHeaders {
- srcDirs = ["${project.shared}/include", "${project.athena}/include", netTablesInclude, wpiUtilInclude, csCoreInclude]
- includes = ['**/*.h']
- }
- lib project: ':hal', library: 'HALAthena', linkage: 'shared'
- }
- }
- }
- }
- tasks { tasks ->
- tasks.wpilibcZip.dependsOn tasks.wpilibcSharedLibrary
- }
-}
-
-task wpilibcZip(type: Zip) {
- description = 'Zips all of the libraries for wpilibc'
- group = 'WPILib'
- baseName = 'wpilibc'
- destinationDir = project.buildDir
- duplicatesStrategy = 'exclude'
-
- // Include the shared library file and header files from this project
- model {
- binaries {
- withType(SharedLibraryBinarySpec) { spec ->
- from(spec.sharedLibraryFile) {
- into 'lib'
- }
- from(new File(spec.sharedLibraryFile.absolutePath + ".debug")) {
- into 'lib'
- }
- }
- }
- }
-
- from (file("${project.shared}/include")) {
- into 'include'
- }
-
- from (file("${project.athena}/include")) {
- into 'include'
- }
-
- // Finally, include all of the shared library objects from the ni directory
- from(project.file('../ni-libraries/lib')) {
- include 'libwpi.so'
- into 'lib'
- }
-}
-
-if (checkDoxygen()) {
- configurations.create('doc')
- dependencies {
- doc ntcoreDep('cpp', 'sources', 'zip')
- }
-
- task unzipCppNtSources(type: Copy) {
- description = 'Unzips the C++ networktables sources for doc creation.'
- group = 'Dependencies'
- configurations.doc.files.each {
- from zipTree(it)
- }
- exclude 'META-INF/*'
- into ntSourceDir
- }
-
- doxygen {
- def halLocation = '../hal'
- source new File("${project.shared}/src")
- source new File("${project.shared}/include")
- source new File("${project.athena}/src")
- source new File("${project.athena}/include")
- source new File("$ntSourceDir/src")
- source new File("$ntSourceDir/include")
- source new File("$halLocation/shared")
- source new File("$halLocation/athena")
- source new File("$halLocation/include")
- // template file('cpp.doxy')
- exclude 'nivision.h'
- extension_mapping 'inc=C++'
- project_name 'WPILibC++'
- javadoc_autobrief true
- recursive true
- quiet true
- warnings false
- warn_if_doc_error false
- warn_no_paramdoc false
- warn_format false
- warn_logfile false
- warn_if_undocumented false
- generate_latex false
- html_timestamp true
- generate_treeview true
- outputDir new File("$buildDir/docs")
- }
-
- doxygen.dependsOn unzipCppNtSources
-
- task doxygenZip(type: Zip) {
- description = 'Generates doxygen zip file for publishing'
- group = 'WPILib'
- dependsOn doxygen
- duplicatesStrategy = 'exclude'
-
- from doxygen.outputDir
- }
-}
-
-publishing {
- publications {
- wpilibc(MavenPublication) {
- artifact wpilibcZip
- if (checkDoxygen()) {
- artifact (doxygenZip) {
- classifier = 'doxygen'
- }
- }
-
- groupId 'edu.wpi.first.wpilibc'
- artifactId 'athena'
- version WPILibVersion.version
- }
- }
-
- setupWpilibRepo(it)
-}
-
-clean {
- ntSourceDir
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/ADXL345_I2C.h b/third_party/allwpilib_2017/wpilibc/athena/include/ADXL345_I2C.h
deleted file mode 100644
index 9f29592..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/ADXL345_I2C.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "I2C.h"
-#include "LiveWindow/LiveWindowSendable.h"
-#include "interfaces/Accelerometer.h"
-
-namespace frc {
-
-/**
- * ADXL345 Accelerometer on I2C.
- *
- * This class allows access to a Analog Devices ADXL345 3-axis accelerometer on
- * an I2C bus.
- * This class assumes the default (not alternate) sensor address of 0x1D (7-bit
- * address).
- */
-class ADXL345_I2C : public Accelerometer, public LiveWindowSendable {
- protected:
- static const int kAddress = 0x1D;
- static const int kPowerCtlRegister = 0x2D;
- static const int kDataFormatRegister = 0x31;
- static const int kDataRegister = 0x32;
- static constexpr double kGsPerLSB = 0.00390625;
- enum PowerCtlFields {
- kPowerCtl_Link = 0x20,
- kPowerCtl_AutoSleep = 0x10,
- kPowerCtl_Measure = 0x08,
- kPowerCtl_Sleep = 0x04
- };
- enum DataFormatFields {
- kDataFormat_SelfTest = 0x80,
- kDataFormat_SPI = 0x40,
- kDataFormat_IntInvert = 0x20,
- kDataFormat_FullRes = 0x08,
- kDataFormat_Justify = 0x04
- };
-
- public:
- enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 };
- struct AllAxes {
- double XAxis;
- double YAxis;
- double ZAxis;
- };
-
- public:
- explicit ADXL345_I2C(I2C::Port port, Range range = kRange_2G,
- int deviceAddress = kAddress);
- virtual ~ADXL345_I2C() = default;
-
- ADXL345_I2C(const ADXL345_I2C&) = delete;
- ADXL345_I2C& operator=(const ADXL345_I2C&) = delete;
-
- // Accelerometer interface
- void SetRange(Range range) override;
- double GetX() override;
- double GetY() override;
- double GetZ() override;
-
- virtual double GetAcceleration(Axes axis);
- virtual AllAxes GetAccelerations();
-
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subtable) override;
- void UpdateTable() override;
- std::shared_ptr<ITable> GetTable() const override;
- void StartLiveWindowMode() override {}
- void StopLiveWindowMode() override {}
-
- protected:
- I2C m_i2c;
-
- private:
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/ADXL345_SPI.h b/third_party/allwpilib_2017/wpilibc/athena/include/ADXL345_SPI.h
deleted file mode 100644
index 73fe942..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/ADXL345_SPI.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "LiveWindow/LiveWindowSendable.h"
-#include "SPI.h"
-#include "SensorBase.h"
-#include "interfaces/Accelerometer.h"
-
-namespace frc {
-
-class DigitalInput;
-class DigitalOutput;
-
-/**
- * ADXL345 Accelerometer on SPI.
- *
- * This class allows access to an Analog Devices ADXL345 3-axis accelerometer
- * via SPI.
- * This class assumes the sensor is wired in 4-wire SPI mode.
- */
-class ADXL345_SPI : public Accelerometer, public LiveWindowSendable {
- protected:
- static const int kPowerCtlRegister = 0x2D;
- static const int kDataFormatRegister = 0x31;
- static const int kDataRegister = 0x32;
- static constexpr double kGsPerLSB = 0.00390625;
- enum SPIAddressFields { kAddress_Read = 0x80, kAddress_MultiByte = 0x40 };
- enum PowerCtlFields {
- kPowerCtl_Link = 0x20,
- kPowerCtl_AutoSleep = 0x10,
- kPowerCtl_Measure = 0x08,
- kPowerCtl_Sleep = 0x04
- };
- enum DataFormatFields {
- kDataFormat_SelfTest = 0x80,
- kDataFormat_SPI = 0x40,
- kDataFormat_IntInvert = 0x20,
- kDataFormat_FullRes = 0x08,
- kDataFormat_Justify = 0x04
- };
-
- public:
- enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 };
- struct AllAxes {
- double XAxis;
- double YAxis;
- double ZAxis;
- };
-
- public:
- explicit ADXL345_SPI(SPI::Port port, Range range = kRange_2G);
- virtual ~ADXL345_SPI() = default;
-
- ADXL345_SPI(const ADXL345_SPI&) = delete;
- ADXL345_SPI& operator=(const ADXL345_SPI&) = delete;
-
- // Accelerometer interface
- void SetRange(Range range) override;
- double GetX() override;
- double GetY() override;
- double GetZ() override;
-
- virtual double GetAcceleration(Axes axis);
- virtual AllAxes GetAccelerations();
-
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subtable) override;
- void UpdateTable() override;
- std::shared_ptr<ITable> GetTable() const override;
- void StartLiveWindowMode() override {}
- void StopLiveWindowMode() override {}
-
- protected:
- SPI m_spi;
-
- private:
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/ADXL362.h b/third_party/allwpilib_2017/wpilibc/athena/include/ADXL362.h
deleted file mode 100644
index 98c8ae2..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/ADXL362.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "LiveWindow/LiveWindowSendable.h"
-#include "SPI.h"
-#include "SensorBase.h"
-#include "interfaces/Accelerometer.h"
-
-namespace frc {
-
-class DigitalInput;
-class DigitalOutput;
-
-/**
- * ADXL362 SPI Accelerometer.
- *
- * This class allows access to an Analog Devices ADXL362 3-axis accelerometer.
- */
-class ADXL362 : public Accelerometer, public LiveWindowSendable {
- public:
- enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 };
- struct AllAxes {
- double XAxis;
- double YAxis;
- double ZAxis;
- };
-
- public:
- explicit ADXL362(Range range = kRange_2G);
- explicit ADXL362(SPI::Port port, Range range = kRange_2G);
- virtual ~ADXL362() = default;
-
- ADXL362(const ADXL362&) = delete;
- ADXL362& operator=(const ADXL362&) = delete;
-
- // Accelerometer interface
- void SetRange(Range range) override;
- double GetX() override;
- double GetY() override;
- double GetZ() override;
-
- virtual double GetAcceleration(Axes axis);
- virtual AllAxes GetAccelerations();
-
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subtable) override;
- void UpdateTable() override;
- std::shared_ptr<ITable> GetTable() const override;
- void StartLiveWindowMode() override {}
- void StopLiveWindowMode() override {}
-
- private:
- SPI m_spi;
- double m_gsPerLSB = 0.001;
-
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/ADXRS450_Gyro.h b/third_party/allwpilib_2017/wpilibc/athena/include/ADXRS450_Gyro.h
deleted file mode 100644
index 5c52f7e..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/ADXRS450_Gyro.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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 <memory>
-
-#include "GyroBase.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "Notifier.h"
-#include "SPI.h"
-
-namespace frc {
-
-/**
- * Use a rate gyro to return the robots heading relative to a starting position.
- * The Gyro class tracks the robots heading based on the starting position. As
- * the robot rotates the new heading is computed by integrating the rate of
- * rotation returned by the sensor. When the class is instantiated, it does a
- * short calibration routine where it samples the gyro while at rest to
- * determine the default offset. This is subtracted from each sample to
- * determine the heading.
- *
- * This class is for the digital ADXRS450 gyro sensor that connects via SPI.
- */
-class ADXRS450_Gyro : public GyroBase {
- public:
- ADXRS450_Gyro();
- explicit ADXRS450_Gyro(SPI::Port port);
- virtual ~ADXRS450_Gyro() = default;
-
- double GetAngle() const override;
- double GetRate() const override;
- void Reset() override;
- void Calibrate() override;
-
- private:
- SPI m_spi;
-
- uint16_t ReadRegister(int reg);
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogAccelerometer.h b/third_party/allwpilib_2017/wpilibc/athena/include/AnalogAccelerometer.h
deleted file mode 100644
index 9f97032..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogAccelerometer.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "AnalogInput.h"
-#include "LiveWindow/LiveWindowSendable.h"
-#include "PIDSource.h"
-#include "SensorBase.h"
-
-namespace frc {
-
-/**
- * Handle operation of an analog accelerometer.
- * The accelerometer reads acceleration directly through the sensor. Many
- * sensors have multiple axis and can be treated as multiple devices. Each is
- * calibrated by finding the center value over a period of time.
- */
-class AnalogAccelerometer : public SensorBase,
- public PIDSource,
- public LiveWindowSendable {
- public:
- explicit AnalogAccelerometer(int channel);
- explicit AnalogAccelerometer(AnalogInput* channel);
- explicit AnalogAccelerometer(std::shared_ptr<AnalogInput> channel);
- virtual ~AnalogAccelerometer() = default;
-
- double GetAcceleration() const;
- void SetSensitivity(double sensitivity);
- void SetZero(double zero);
- double PIDGet() override;
-
- void UpdateTable() override;
- void StartLiveWindowMode() override;
- void StopLiveWindowMode() override;
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subTable) override;
- std::shared_ptr<ITable> GetTable() const override;
-
- private:
- void InitAccelerometer();
-
- std::shared_ptr<AnalogInput> m_analogInput;
- double m_voltsPerG = 1.0;
- double m_zeroGVoltage = 2.5;
-
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogGyro.h b/third_party/allwpilib_2017/wpilibc/athena/include/AnalogGyro.h
deleted file mode 100644
index 43fc7cf..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogGyro.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-
-#include "GyroBase.h"
-#include "HAL/Types.h"
-
-namespace frc {
-
-class AnalogInput;
-
-/**
- * Use a rate gyro to return the robots heading relative to a starting position.
- * The Gyro class tracks the robots heading based on the starting position. As
- * the robot rotates the new heading is computed by integrating the rate of
- * rotation returned by the sensor. When the class is instantiated, it does a
- * short calibration routine where it samples the gyro while at rest to
- * determine the default offset. This is subtracted from each sample to
- * determine the heading. This gyro class must be used with a channel that is
- * assigned one of the Analog accumulators from the FPGA. See AnalogInput for
- * the current accumulator assignments.
- *
- * This class is for gyro sensors that connect to an analog input.
- */
-class AnalogGyro : public GyroBase {
- public:
- static const int kOversampleBits = 10;
- static const int kAverageBits = 0;
- static constexpr double kSamplesPerSecond = 50.0;
- static constexpr double kCalibrationSampleTime = 5.0;
- static constexpr double kDefaultVoltsPerDegreePerSecond = 0.007;
-
- explicit AnalogGyro(int channel);
- explicit AnalogGyro(AnalogInput* channel);
- explicit AnalogGyro(std::shared_ptr<AnalogInput> channel);
- AnalogGyro(int channel, int center, double offset);
- AnalogGyro(std::shared_ptr<AnalogInput> channel, int center, double offset);
- virtual ~AnalogGyro();
-
- double GetAngle() const override;
- double GetRate() const override;
- virtual int GetCenter() const;
- virtual double GetOffset() const;
- void SetSensitivity(double voltsPerDegreePerSecond);
- void SetDeadband(double volts);
- void Reset() override;
- virtual void InitGyro();
- void Calibrate() override;
-
- protected:
- std::shared_ptr<AnalogInput> m_analog;
-
- private:
- HAL_GyroHandle m_gyroHandle = HAL_kInvalidHandle;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogInput.h b/third_party/allwpilib_2017/wpilibc/athena/include/AnalogInput.h
deleted file mode 100644
index d27e19d..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogInput.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "HAL/Types.h"
-#include "SensorBase.h"
-
-namespace frc {
-
-/**
- * Analog input class.
- *
- * Connected to each analog channel is an averaging and oversampling engine.
- * This engine accumulates the specified ( by SetAverageBits() and
- * SetOversampleBits() ) number of samples before returning a new value. This
- * is not a sliding window average. The only difference between the oversampled
- * samples and the averaged samples is that the oversampled samples are simply
- * accumulated effectively increasing the resolution, while the averaged samples
- * are divided by the number of samples to retain the resolution, but get more
- * stable values.
- */
-class AnalogInput : public SensorBase {
- friend class AnalogTrigger;
- friend class AnalogGyro;
-
- public:
- static const int kAccumulatorModuleNumber = 1;
- static const int kAccumulatorNumChannels = 2;
- static const int kAccumulatorChannels[kAccumulatorNumChannels];
-
- explicit AnalogInput(int channel);
- virtual ~AnalogInput();
-
- int GetValue() const;
- int GetAverageValue() const;
-
- double GetVoltage() const;
- double GetAverageVoltage() const;
-
- int GetChannel() const;
-
- void SetAverageBits(int bits);
- int GetAverageBits() const;
- void SetOversampleBits(int bits);
- int GetOversampleBits() const;
-
- int GetLSBWeight() const;
- int GetOffset() const;
-
- bool IsAccumulatorChannel() const;
- void InitAccumulator();
- void SetAccumulatorInitialValue(int64_t value);
- void ResetAccumulator();
- void SetAccumulatorCenter(int center);
- void SetAccumulatorDeadband(int deadband);
- int64_t GetAccumulatorValue() const;
- int64_t GetAccumulatorCount() const;
- void GetAccumulatorOutput(int64_t& value, int64_t& count) const;
-
- static void SetSampleRate(double samplesPerSecond);
- static double GetSampleRate();
-
- private:
- int m_channel;
- // TODO: Adjust HAL to avoid use of raw pointers.
- HAL_AnalogInputHandle m_port;
- int64_t m_accumulatorOffset;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogOutput.h b/third_party/allwpilib_2017/wpilibc/athena/include/AnalogOutput.h
deleted file mode 100644
index d948851..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogOutput.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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 <stdint.h>
-
-#include <memory>
-#include <string>
-
-#include "HAL/AnalogOutput.h"
-#include "SensorBase.h"
-
-namespace frc {
-
-/**
- * MXP analog output class.
- */
-class AnalogOutput : public SensorBase {
- public:
- explicit AnalogOutput(int channel);
- virtual ~AnalogOutput();
-
- void SetVoltage(double voltage);
- double GetVoltage() const;
- int GetChannel();
-
- protected:
- int m_channel;
- HAL_AnalogOutputHandle m_port;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogPotentiometer.h b/third_party/allwpilib_2017/wpilibc/athena/include/AnalogPotentiometer.h
deleted file mode 100644
index 2f2360c..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogPotentiometer.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <memory>
-#include <string>
-
-#include "AnalogInput.h"
-#include "LiveWindow/LiveWindowSendable.h"
-#include "interfaces/Potentiometer.h"
-
-namespace frc {
-
-/**
- * Class for reading analog potentiometers. Analog potentiometers read
- * in an analog voltage that corresponds to a position. The position is
- * in whichever units you choose, by way of the scaling and offset
- * constants passed to the constructor.
- */
-class AnalogPotentiometer : public Potentiometer, public LiveWindowSendable {
- public:
- /**
- * AnalogPotentiometer constructor.
- *
- * Use the fullRange and offset values so that the output produces
- * meaningful values. I.E: you have a 270 degree potentiometer and
- * you want the output to be degrees with the halfway point as 0
- * degrees. The fullRange value is 270.0(degrees) and the offset is
- * -135.0 since the halfway point after scaling is 135 degrees.
- *
- * This will calculate the result from the fullRange times the
- * fraction of the supply voltage, plus the offset.
- *
- * @param channel The analog channel this potentiometer is plugged into.
- * @param fullRange The scaling to multiply the voltage by to get a meaningful
- * unit.
- * @param offset The offset to add to the scaled value for controlling the
- * zero value
- */
- explicit AnalogPotentiometer(int channel, double fullRange = 1.0,
- double offset = 0.0);
-
- explicit AnalogPotentiometer(AnalogInput* input, double fullRange = 1.0,
- double offset = 0.0);
-
- explicit AnalogPotentiometer(std::shared_ptr<AnalogInput> input,
- double fullRange = 1.0, double offset = 0.0);
-
- virtual ~AnalogPotentiometer() = default;
-
- /**
- * Get the current reading of the potentiomer.
- *
- * @return The current position of the potentiometer.
- */
- double Get() const override;
-
- /**
- * Implement the PIDSource interface.
- *
- * @return The current reading.
- */
- double PIDGet() override;
-
- /*
- * Live Window code, only does anything if live window is activated.
- */
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subtable) override;
- void UpdateTable() override;
- std::shared_ptr<ITable> GetTable() const override;
-
- /**
- * AnalogPotentiometers don't have to do anything special when entering the
- * LiveWindow.
- */
- void StartLiveWindowMode() override {}
-
- /**
- * AnalogPotentiometers don't have to do anything special when exiting the
- * LiveWindow.
- */
- void StopLiveWindowMode() override {}
-
- private:
- std::shared_ptr<AnalogInput> m_analog_input;
- double m_fullRange, m_offset;
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogTrigger.h b/third_party/allwpilib_2017/wpilibc/athena/include/AnalogTrigger.h
deleted file mode 100644
index 90bbc05..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogTrigger.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-
-#include "AnalogTriggerOutput.h"
-#include "HAL/Types.h"
-#include "SensorBase.h"
-
-namespace frc {
-
-class AnalogInput;
-
-class AnalogTrigger : public SensorBase {
- friend class AnalogTriggerOutput;
-
- public:
- explicit AnalogTrigger(int channel);
- explicit AnalogTrigger(AnalogInput* channel);
- virtual ~AnalogTrigger();
-
- void SetLimitsVoltage(double lower, double upper);
- void SetLimitsRaw(int lower, int upper);
- void SetAveraged(bool useAveragedValue);
- void SetFiltered(bool useFilteredValue);
- int GetIndex() const;
- bool GetInWindow();
- bool GetTriggerState();
- std::shared_ptr<AnalogTriggerOutput> CreateOutput(
- AnalogTriggerType type) const;
-
- private:
- int m_index;
- HAL_AnalogTriggerHandle m_trigger;
- AnalogInput* m_analogInput = nullptr;
- bool m_ownsAnalog = false;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogTriggerOutput.h b/third_party/allwpilib_2017/wpilibc/athena/include/AnalogTriggerOutput.h
deleted file mode 100644
index 0ab932a..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogTriggerOutput.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "DigitalSource.h"
-#include "HAL/AnalogTrigger.h"
-
-namespace frc {
-
-class AnalogTrigger;
-
-/**
- * Class to represent a specific output from an analog trigger.
- *
- * This class is used to get the current output value and also as a
- * DigitalSource to provide routing of an output to digital subsystems on the
- * FPGA such as Counter, Encoder, and Interrupt.
- *
- * The TriggerState output indicates the primary output value of the trigger.
- * If the analog signal is less than the lower limit, the output is false. If
- * the analog value is greater than the upper limit, then the output is true.
- * If the analog value is in between, then the trigger output state maintains
- * its most recent value.
- *
- * The InWindow output indicates whether or not the analog signal is inside the
- * range defined by the limits.
- *
- * The RisingPulse and FallingPulse outputs detect an instantaneous transition
- * from above the upper limit to below the lower limit, and vise versa. These
- * pulses represent a rollover condition of a sensor and can be routed to an up
- * / down counter or to interrupts. Because the outputs generate a pulse, they
- * cannot be read directly. To help ensure that a rollover condition is not
- * missed, there is an average rejection filter available that operates on the
- * upper 8 bits of a 12 bit number and selects the nearest outlyer of 3 samples.
- * This will reject a sample that is (due to averaging or sampling) errantly
- * between the two limits. This filter will fail if more than one sample in a
- * row is errantly in between the two limits. You may see this problem if
- * attempting to use this feature with a mechanical rollover sensor, such as a
- * 360 degree no-stop potentiometer without signal conditioning, because the
- * rollover transition is not sharp / clean enough. Using the averaging engine
- * may help with this, but rotational speeds of the sensor will then be limited.
- */
-class AnalogTriggerOutput : public DigitalSource {
- friend class AnalogTrigger;
-
- public:
- virtual ~AnalogTriggerOutput();
- bool Get() const;
-
- // DigitalSource interface
- HAL_Handle GetPortHandleForRouting() const override;
- AnalogTriggerType GetAnalogTriggerTypeForRouting() const override;
- bool IsAnalogTrigger() const override;
- int GetChannel() const override;
-
- protected:
- AnalogTriggerOutput(const AnalogTrigger& trigger,
- AnalogTriggerType outputType);
-
- private:
- // Uses reference rather than smart pointer because a user can not construct
- // an AnalogTriggerOutput themselves and because the AnalogTriggerOutput
- // should always be in scope at the same time as an AnalogTrigger.
- const AnalogTrigger& m_trigger;
- AnalogTriggerType m_outputType;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogTriggerType.h b/third_party/allwpilib_2017/wpilibc/athena/include/AnalogTriggerType.h
deleted file mode 100644
index 9105e99..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/AnalogTriggerType.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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
-
-namespace frc {
-
-enum class AnalogTriggerType {
- kInWindow = 0,
- kState = 1,
- kRisingPulse = 2,
- kFallingPulse = 3
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/BuiltInAccelerometer.h b/third_party/allwpilib_2017/wpilibc/athena/include/BuiltInAccelerometer.h
deleted file mode 100644
index d620653..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/BuiltInAccelerometer.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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 <memory>
-#include <string>
-
-#include "SensorBase.h"
-
-namespace frc {
-
-/**
- * Built-in accelerometer.
- *
- * This class allows access to the roboRIO's internal accelerometer.
- */
-class BuiltInAccelerometer : public SensorBase {
- public:
- enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2 };
-
- explicit BuiltInAccelerometer(Range range = kRange_8G);
- virtual ~BuiltInAccelerometer() = default;
-
- void SetRange(Range range);
- double GetX();
- double GetY();
- double GetZ();
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/CANSpeedController.h b/third_party/allwpilib_2017/wpilibc/athena/include/CANSpeedController.h
deleted file mode 100644
index a0f31ad..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/CANSpeedController.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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 "SpeedController.h"
-
-namespace frc {
-
-/**
- * Interface for "smart" CAN-based speed controllers.
- */
-class CANSpeedController : public SpeedController {
- public:
- enum ControlMode {
- kPercentVbus = 0,
- kCurrent = 1,
- kSpeed = 2,
- kPosition = 3,
- kVoltage = 4,
- kFollower = 5,
- kMotionProfile = 6,
- };
-
- // Helper function for the ControlMode enum
- virtual bool IsModePID(ControlMode mode) const = 0;
-
- enum Faults {
- kCurrentFault = 1,
- kTemperatureFault = 2,
- kBusVoltageFault = 4,
- kGateDriverFault = 8,
- /* SRX extensions */
- kFwdLimitSwitch = 0x10,
- kRevLimitSwitch = 0x20,
- kFwdSoftLimit = 0x40,
- kRevSoftLimit = 0x80,
- };
-
- enum Limits { kForwardLimit = 1, kReverseLimit = 2 };
-
- enum NeutralMode {
- /** Use the NeutralMode that is set by the jumper wire on the CAN device */
- kNeutralMode_Jumper = 0,
- /** Stop the motor's rotation by applying a force. */
- kNeutralMode_Brake = 1,
- /** Do not attempt to stop the motor. Instead allow it to coast to a stop
- without applying resistance. */
- kNeutralMode_Coast = 2
- };
-
- enum LimitMode {
- /** Only use switches for limits */
- kLimitMode_SwitchInputsOnly = 0,
- /** Use both switches and soft limits */
- kLimitMode_SoftPositionLimits = 1,
- /* SRX extensions */
- /** Disable switches and disable soft limits */
- kLimitMode_SrxDisableSwitchInputs = 2,
- };
-
- virtual double Get() const = 0;
- virtual void Set(double value) = 0;
- virtual void StopMotor() = 0;
- virtual void Disable() = 0;
- virtual void SetP(double p) = 0;
- virtual void SetI(double i) = 0;
- virtual void SetD(double d) = 0;
- virtual void SetPID(double p, double i, double d) = 0;
- virtual double GetP() const = 0;
- virtual double GetI() const = 0;
- virtual double GetD() const = 0;
- virtual double GetBusVoltage() const = 0;
- virtual double GetOutputVoltage() const = 0;
- virtual double GetOutputCurrent() const = 0;
- virtual double GetTemperature() const = 0;
- virtual double GetPosition() const = 0;
- virtual double GetSpeed() const = 0;
- virtual bool GetForwardLimitOK() const = 0;
- virtual bool GetReverseLimitOK() const = 0;
- virtual uint16_t GetFaults() const = 0;
- virtual void SetVoltageRampRate(double rampRate) = 0;
- virtual int GetFirmwareVersion() const = 0;
- virtual void ConfigNeutralMode(NeutralMode mode) = 0;
- virtual void ConfigEncoderCodesPerRev(uint16_t codesPerRev) = 0;
- virtual void ConfigPotentiometerTurns(uint16_t turns) = 0;
- virtual void ConfigSoftPositionLimits(double forwardLimitPosition,
- double reverseLimitPosition) = 0;
- virtual void DisableSoftPositionLimits() = 0;
- virtual void ConfigLimitMode(LimitMode mode) = 0;
- virtual void ConfigForwardLimit(double forwardLimitPosition) = 0;
- virtual void ConfigReverseLimit(double reverseLimitPosition) = 0;
- virtual void ConfigMaxOutputVoltage(double voltage) = 0;
- virtual void ConfigFaultTime(double faultTime) = 0;
- // Hold off on interface until we figure out ControlMode enums.
- // virtual void SetControlMode(ControlMode mode) = 0;
- // virtual ControlMode GetControlMode() const = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/CameraServer.h b/third_party/allwpilib_2017/wpilibc/athena/include/CameraServer.h
deleted file mode 100644
index 5dde767..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/CameraServer.h
+++ /dev/null
@@ -1,312 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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 <mutex>
-#include <string>
-#include <vector>
-
-#include "ErrorBase.h"
-#include "cscore.h"
-#include "llvm/DenseMap.h"
-#include "llvm/StringMap.h"
-#include "llvm/StringRef.h"
-#include "networktables/NetworkTable.h"
-
-namespace frc {
-
-/**
- * Singleton class for creating and keeping camera servers.
- * Also publishes camera information to NetworkTables.
- */
-class CameraServer : public ErrorBase {
- public:
- static constexpr uint16_t kBasePort = 1181;
- static constexpr int kSize640x480 = 0;
- static constexpr int kSize320x240 = 1;
- static constexpr int kSize160x120 = 2;
-
- /**
- * Get the CameraServer instance.
- */
- static CameraServer* GetInstance();
-
- /**
- * Start automatically capturing images to send to the dashboard.
- *
- * <p>You should call this method to see a camera feed on the dashboard.
- * If you also want to perform vision processing on the roboRIO, use
- * getVideo() to get access to the camera images.
- *
- * The first time this overload is called, it calls
- * {@link #StartAutomaticCapture(int)} with device 0, creating a camera
- * named "USB Camera 0". Subsequent calls increment the device number
- * (e.g. 1, 2, etc).
- */
- cs::UsbCamera StartAutomaticCapture();
-
- /**
- * Start automatically capturing images to send to the dashboard.
- *
- * <p>This overload calls {@link #StartAutomaticCapture(String, int)} with
- * a name of "USB Camera {dev}".
- *
- * @param dev The device number of the camera interface
- */
- cs::UsbCamera StartAutomaticCapture(int dev);
-
- /**
- * Start automatically capturing images to send to the dashboard.
- *
- * @param name The name to give the camera
- * @param dev The device number of the camera interface
- */
- cs::UsbCamera StartAutomaticCapture(llvm::StringRef name, int dev);
-
- /**
- * Start automatically capturing images to send to the dashboard.
- *
- * @param name The name to give the camera
- * @param path The device path (e.g. "/dev/video0") of the camera
- */
- cs::UsbCamera StartAutomaticCapture(llvm::StringRef name,
- llvm::StringRef path);
-
- /**
- * Start automatically capturing images to send to the dashboard from
- * an existing camera.
- *
- * @param camera Camera
- */
- void StartAutomaticCapture(const cs::VideoSource& camera);
-
- /**
- * Adds an Axis IP camera.
- *
- * <p>This overload calls {@link #AddAxisCamera(String, String)} with
- * name "Axis Camera".
- *
- * @param host Camera host IP or DNS name (e.g. "10.x.y.11")
- */
- cs::AxisCamera AddAxisCamera(llvm::StringRef host);
-
- /**
- * Adds an Axis IP camera.
- *
- * <p>This overload calls {@link #AddAxisCamera(String, String)} with
- * name "Axis Camera".
- *
- * @param host Camera host IP or DNS name (e.g. "10.x.y.11")
- */
- cs::AxisCamera AddAxisCamera(const char* host);
-
- /**
- * Adds an Axis IP camera.
- *
- * <p>This overload calls {@link #AddAxisCamera(String, String)} with
- * name "Axis Camera".
- *
- * @param host Camera host IP or DNS name (e.g. "10.x.y.11")
- */
- cs::AxisCamera AddAxisCamera(const std::string& host);
-
- /**
- * Adds an Axis IP camera.
- *
- * <p>This overload calls {@link #AddAxisCamera(String, String[])} with
- * name "Axis Camera".
- *
- * @param hosts Array of Camera host IPs/DNS names
- */
- cs::AxisCamera AddAxisCamera(llvm::ArrayRef<std::string> hosts);
-
- /**
- * Adds an Axis IP camera.
- *
- * <p>This overload calls {@link #AddAxisCamera(String, String[])} with
- * name "Axis Camera".
- *
- * @param hosts Array of Camera host IPs/DNS names
- */
- template <typename T>
- cs::AxisCamera AddAxisCamera(std::initializer_list<T> hosts);
-
- /**
- * Adds an Axis IP camera.
- *
- * @param name The name to give the camera
- * @param host Camera host IP or DNS name (e.g. "10.x.y.11")
- */
- cs::AxisCamera AddAxisCamera(llvm::StringRef name, llvm::StringRef host);
-
- /**
- * Adds an Axis IP camera.
- *
- * @param name The name to give the camera
- * @param host Camera host IP or DNS name (e.g. "10.x.y.11")
- */
- cs::AxisCamera AddAxisCamera(llvm::StringRef name, const char* host);
-
- /**
- * Adds an Axis IP camera.
- *
- * @param name The name to give the camera
- * @param host Camera host IP or DNS name (e.g. "10.x.y.11")
- */
- cs::AxisCamera AddAxisCamera(llvm::StringRef name, const std::string& host);
-
- /**
- * Adds an Axis IP camera.
- *
- * @param name The name to give the camera
- * @param hosts Array of Camera host IPs/DNS names
- */
- cs::AxisCamera AddAxisCamera(llvm::StringRef name,
- llvm::ArrayRef<std::string> hosts);
-
- /**
- * Adds an Axis IP camera.
- *
- * @param name The name to give the camera
- * @param hosts Array of Camera host IPs/DNS names
- */
- template <typename T>
- cs::AxisCamera AddAxisCamera(llvm::StringRef name,
- std::initializer_list<T> hosts);
-
- /**
- * Get OpenCV access to the primary camera feed. This allows you to
- * get images from the camera for image processing on the roboRIO.
- *
- * <p>This is only valid to call after a camera feed has been added
- * with startAutomaticCapture() or addServer().
- */
- cs::CvSink GetVideo();
-
- /**
- * Get OpenCV access to the specified camera. This allows you to get
- * images from the camera for image processing on the roboRIO.
- *
- * @param camera Camera (e.g. as returned by startAutomaticCapture).
- */
- cs::CvSink GetVideo(const cs::VideoSource& camera);
-
- /**
- * Get OpenCV access to the specified camera. This allows you to get
- * images from the camera for image processing on the roboRIO.
- *
- * @param name Camera name
- */
- cs::CvSink GetVideo(llvm::StringRef name);
-
- /**
- * Create a MJPEG stream with OpenCV input. This can be called to pass custom
- * annotated images to the dashboard.
- *
- * @param name Name to give the stream
- * @param width Width of the image being sent
- * @param height Height of the image being sent
- */
- cs::CvSource PutVideo(llvm::StringRef name, int width, int height);
-
- /**
- * Adds a MJPEG server at the next available port.
- *
- * @param name Server name
- */
- cs::MjpegServer AddServer(llvm::StringRef name);
-
- /**
- * Adds a MJPEG server.
- *
- * @param name Server name
- */
- cs::MjpegServer AddServer(llvm::StringRef name, int port);
-
- /**
- * Adds an already created server.
- *
- * @param server Server
- */
- void AddServer(const cs::VideoSink& server);
-
- /**
- * Removes a server by name.
- *
- * @param name Server name
- */
- void RemoveServer(llvm::StringRef name);
-
- /**
- * Get server for the primary camera feed.
- *
- * <p>This is only valid to call after a camera feed has been added
- * with StartAutomaticCapture() or AddServer().
- */
- cs::VideoSink GetServer();
-
- /**
- * Gets a server by name.
- *
- * @param name Server name
- */
- cs::VideoSink GetServer(llvm::StringRef name);
-
- /**
- * Adds an already created camera.
- *
- * @param camera Camera
- */
- void AddCamera(const cs::VideoSource& camera);
-
- /**
- * Removes a camera by name.
- *
- * @param name Camera name
- */
- void RemoveCamera(llvm::StringRef name);
-
- /**
- * Sets the size of the image to use. Use the public kSize constants to set
- * the correct mode, or set it directly on a camera and call the appropriate
- * StartAutomaticCapture method.
- *
- * @deprecated Use SetResolution on the UsbCamera returned by
- * StartAutomaticCapture() instead.
- * @param size The size to use
- */
- void SetSize(int size);
-
- private:
- CameraServer();
-
- std::shared_ptr<ITable> GetSourceTable(CS_Source source);
- std::vector<std::string> GetSinkStreamValues(CS_Sink sink);
- std::vector<std::string> GetSourceStreamValues(CS_Source source);
- void UpdateStreamValues();
-
- static constexpr char const* kPublishName = "/CameraPublisher";
-
- std::mutex m_mutex;
- std::atomic<int> m_defaultUsbDevice;
- std::string m_primarySourceName;
- llvm::StringMap<cs::VideoSource> m_sources;
- llvm::StringMap<cs::VideoSink> m_sinks;
- llvm::DenseMap<CS_Source, std::shared_ptr<ITable>> m_tables;
- std::shared_ptr<NetworkTable> m_publishTable;
- cs::VideoListener m_videoListener;
- int m_tableListener;
- int m_nextPort;
- std::vector<std::string> m_addresses;
-};
-
-} // namespace frc
-
-#include "CameraServer.inc"
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/CameraServer.inc b/third_party/allwpilib_2017/wpilibc/athena/include/CameraServer.inc
deleted file mode 100644
index 66050c2..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/CameraServer.inc
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <string>
-#include <vector>
-
-namespace frc {
-
-template <typename T>
-inline cs::AxisCamera CameraServer::AddAxisCamera(
- std::initializer_list<T> hosts) {
- return AddAxisCamera("Axis Camera", hosts);
-}
-
-template <typename T>
-inline cs::AxisCamera CameraServer::AddAxisCamera(
- llvm::StringRef name, std::initializer_list<T> hosts) {
- std::vector<std::string> vec;
- vec.reserve(hosts.size());
- for (const auto& host : hosts) vec.emplace_back(host);
- return AddAxisCamera(name, vec);
-}
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Compressor.h b/third_party/allwpilib_2017/wpilibc/athena/include/Compressor.h
deleted file mode 100644
index a2464b4..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Compressor.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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 <memory>
-#include <string>
-
-#include "HAL/Types.h"
-#include "SensorBase.h"
-
-namespace frc {
-
-/**
- * PCM compressor
- */
-class Compressor : public SensorBase {
- public:
- // Default PCM ID is 0
- explicit Compressor(int pcmID = GetDefaultSolenoidModule());
- virtual ~Compressor() = default;
-
- void Start();
- void Stop();
- bool Enabled() const;
-
- bool GetPressureSwitchValue() const;
-
- double GetCompressorCurrent() const;
-
- void SetClosedLoopControl(bool on);
- bool GetClosedLoopControl() const;
-
- bool GetCompressorCurrentTooHighFault() const;
- bool GetCompressorCurrentTooHighStickyFault() const;
- bool GetCompressorShortedStickyFault() const;
- bool GetCompressorShortedFault() const;
- bool GetCompressorNotConnectedStickyFault() const;
- bool GetCompressorNotConnectedFault() const;
- void ClearAllPCMStickyFaults();
-
- protected:
- HAL_CompressorHandle m_compressorHandle;
-
- private:
- void SetCompressor(bool on);
- int m_module;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/ControllerPower.h b/third_party/allwpilib_2017/wpilibc/athena/include/ControllerPower.h
deleted file mode 100644
index f6b4720..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/ControllerPower.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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
-
-namespace frc {
-
-class ControllerPower {
- public:
- static double GetInputVoltage();
- static double GetInputCurrent();
- static double GetVoltage3V3();
- static double GetCurrent3V3();
- static bool GetEnabled3V3();
- static int GetFaultCount3V3();
- static double GetVoltage5V();
- static double GetCurrent5V();
- static bool GetEnabled5V();
- static int GetFaultCount5V();
- static double GetVoltage6V();
- static double GetCurrent6V();
- static bool GetEnabled6V();
- static int GetFaultCount6V();
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Counter.h b/third_party/allwpilib_2017/wpilibc/athena/include/Counter.h
deleted file mode 100644
index 2dfb9eb..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Counter.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "AnalogTrigger.h"
-#include "CounterBase.h"
-#include "HAL/Counter.h"
-#include "HAL/Types.h"
-#include "SensorBase.h"
-#include "support/deprecated.h"
-
-namespace frc {
-
-class DigitalGlitchFilter;
-
-/**
- * Class for counting the number of ticks on a digital input channel.
- * This is a general purpose class for counting repetitive events. It can return
- * the number of counts, the period of the most recent cycle, and detect when
- * the signal being counted has stopped by supplying a maximum cycle time.
- *
- * All counters will immediately start counting - Reset() them if you need them
- * to be zeroed before use.
- */
-class Counter : public SensorBase,
- public CounterBase {
- public:
- enum Mode {
- kTwoPulse = 0,
- kSemiperiod = 1,
- kPulseLength = 2,
- kExternalDirection = 3
- };
- explicit Counter(Mode mode = kTwoPulse);
- explicit Counter(int channel);
- explicit Counter(DigitalSource* source);
- explicit Counter(std::shared_ptr<DigitalSource> source);
- WPI_DEPRECATED("Use pass-by-reference instead.")
- explicit Counter(AnalogTrigger* trigger);
- explicit Counter(const AnalogTrigger& trigger);
- Counter(EncodingType encodingType, DigitalSource* upSource,
- DigitalSource* downSource, bool inverted);
- Counter(EncodingType encodingType, std::shared_ptr<DigitalSource> upSource,
- std::shared_ptr<DigitalSource> downSource, bool inverted);
- virtual ~Counter();
-
- void SetUpSource(int channel);
- void SetUpSource(AnalogTrigger* analogTrigger, AnalogTriggerType triggerType);
- void SetUpSource(std::shared_ptr<AnalogTrigger> analogTrigger,
- AnalogTriggerType triggerType);
- void SetUpSource(DigitalSource* source);
- void SetUpSource(std::shared_ptr<DigitalSource> source);
- void SetUpSource(DigitalSource& source);
- void SetUpSourceEdge(bool risingEdge, bool fallingEdge);
- void ClearUpSource();
-
- void SetDownSource(int channel);
- void SetDownSource(AnalogTrigger* analogTrigger,
- AnalogTriggerType triggerType);
- void SetDownSource(std::shared_ptr<AnalogTrigger> analogTrigger,
- AnalogTriggerType triggerType);
- void SetDownSource(DigitalSource* source);
- void SetDownSource(std::shared_ptr<DigitalSource> source);
- void SetDownSource(DigitalSource& source);
- void SetDownSourceEdge(bool risingEdge, bool fallingEdge);
- void ClearDownSource();
-
- void SetUpDownCounterMode();
- void SetExternalDirectionMode();
- void SetSemiPeriodMode(bool highSemiPeriod);
- void SetPulseLengthMode(double threshold);
-
- void SetReverseDirection(bool reverseDirection);
-
- // CounterBase interface
- int Get() const override;
- void Reset() override;
- double GetPeriod() const override;
- void SetMaxPeriod(double maxPeriod) override;
- void SetUpdateWhenEmpty(bool enabled);
- bool GetStopped() const override;
- bool GetDirection() const override;
-
- void SetSamplesToAverage(int samplesToAverage);
- int GetSamplesToAverage() const;
- int GetFPGAIndex() const { return m_index; }
-
- protected:
- // Makes the counter count up.
- std::shared_ptr<DigitalSource> m_upSource;
- // Makes the counter count down.
- std::shared_ptr<DigitalSource> m_downSource;
- // The FPGA counter object
- HAL_CounterHandle m_counter = HAL_kInvalidHandle;
-
- private:
- int m_index = 0; ///< The index of this counter.
-
- friend class DigitalGlitchFilter;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/CounterBase.h b/third_party/allwpilib_2017/wpilibc/athena/include/CounterBase.h
deleted file mode 100644
index 868dbe6..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/CounterBase.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <stdint.h>
-
-namespace frc {
-
-/**
- * Interface for counting the number of ticks on a digital input channel.
- * Encoders, Gear tooth sensors, and counters should all subclass this so it can
- * be used to build more advanced classes for control and driving.
- *
- * All counters will immediately start counting - Reset() them if you need them
- * to be zeroed before use.
- */
-class CounterBase {
- public:
- enum EncodingType { k1X, k2X, k4X };
-
- virtual ~CounterBase() = default;
- virtual int Get() const = 0;
- virtual void Reset() = 0;
- virtual double GetPeriod() const = 0;
- virtual void SetMaxPeriod(double maxPeriod) = 0;
- virtual bool GetStopped() const = 0;
- virtual bool GetDirection() const = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/DigitalGlitchFilter.h b/third_party/allwpilib_2017/wpilibc/athena/include/DigitalGlitchFilter.h
deleted file mode 100644
index f5c882c..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/DigitalGlitchFilter.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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 <array>
-
-#include "DigitalSource.h"
-#include "HAL/cpp/priority_mutex.h"
-
-namespace frc {
-
-class Encoder;
-class Counter;
-
-/**
- * Class to enable glitch filtering on a set of digital inputs.
- * This class will manage adding and removing digital inputs from a FPGA glitch
- * filter. The filter lets the user configure the time that an input must remain
- * high or low before it is classified as high or low.
- */
-class DigitalGlitchFilter : public SensorBase {
- public:
- DigitalGlitchFilter();
- ~DigitalGlitchFilter();
-
- void Add(DigitalSource* input);
- void Add(Encoder* input);
- void Add(Counter* input);
-
- void Remove(DigitalSource* input);
- void Remove(Encoder* input);
- void Remove(Counter* input);
-
- void SetPeriodCycles(int fpga_cycles);
- void SetPeriodNanoSeconds(uint64_t nanoseconds);
-
- int GetPeriodCycles();
- uint64_t GetPeriodNanoSeconds();
-
- private:
- // Sets the filter for the input to be the requested index. A value of 0
- // disables the filter, and the filter value must be between 1 and 3,
- // inclusive.
- void DoAdd(DigitalSource* input, int requested_index);
-
- int m_channelIndex = -1;
- static priority_mutex m_mutex;
- static ::std::array<bool, 3> m_filterAllocated;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/DigitalInput.h b/third_party/allwpilib_2017/wpilibc/athena/include/DigitalInput.h
deleted file mode 100644
index e7b2d2f..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/DigitalInput.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <stdint.h>
-
-#include <memory>
-#include <string>
-
-#include "DigitalSource.h"
-
-namespace frc {
-
-class DigitalGlitchFilter;
-
-/**
- * Class to read a digital input.
- * This class will read digital inputs and return the current value on the
- * channel. Other devices such as encoders, gear tooth sensors, etc. that are
- * implemented elsewhere will automatically allocate digital inputs and outputs
- * as required. This class is only for devices like switches etc. that aren't
- * implemented anywhere else.
- */
-class DigitalInput : public DigitalSource {
- public:
- explicit DigitalInput(int channel);
- virtual ~DigitalInput();
- bool Get() const;
- int GetChannel() const override;
-
- // Digital Source Interface
- HAL_Handle GetPortHandleForRouting() const override;
- AnalogTriggerType GetAnalogTriggerTypeForRouting() const override;
- bool IsAnalogTrigger() const override;
-
- private:
- int m_channel;
- HAL_DigitalHandle m_handle;
-
- friend class DigitalGlitchFilter;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/DigitalOutput.h b/third_party/allwpilib_2017/wpilibc/athena/include/DigitalOutput.h
deleted file mode 100644
index b262b28..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/DigitalOutput.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "DigitalSource.h"
-#include "HAL/Types.h"
-
-namespace frc {
-
-/**
- * Class to write to digital outputs.
- * Write values to the digital output channels. Other devices implemented
- * elsewhere will allocate channels automatically so for those devices it
- * shouldn't be done here.
- */
-class DigitalOutput : public DigitalSource {
- public:
- explicit DigitalOutput(int channel);
- virtual ~DigitalOutput();
- void Set(bool value);
- bool Get() const;
- int GetChannel() const override;
- void Pulse(double length);
- bool IsPulsing() const;
- void SetPWMRate(double rate);
- void EnablePWM(double initialDutyCycle);
- void DisablePWM();
- void UpdateDutyCycle(double dutyCycle);
-
- // Digital Source Interface
- HAL_Handle GetPortHandleForRouting() const override;
- AnalogTriggerType GetAnalogTriggerTypeForRouting() const override;
- bool IsAnalogTrigger() const override;
-
- private:
- int m_channel;
- HAL_DigitalHandle m_handle;
- HAL_DigitalPWMHandle m_pwmGenerator;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/DigitalSource.h b/third_party/allwpilib_2017/wpilibc/athena/include/DigitalSource.h
deleted file mode 100644
index d3d6523..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/DigitalSource.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "HAL/Types.h"
-#include "InterruptableSensorBase.h"
-
-namespace frc {
-
-/**
- * DigitalSource Interface.
- * The DigitalSource represents all the possible inputs for a counter or a
- * quadrature encoder. The source may be
- * either a digital input or an analog input. If the caller just provides a
- * channel, then a digital input will be
- * constructed and freed when finished for the source. The source can either be
- * a digital input or analog trigger
- * but not both.
- */
-class DigitalSource : public InterruptableSensorBase {
- public:
- virtual ~DigitalSource() = default;
- virtual HAL_Handle GetPortHandleForRouting() const = 0;
- virtual AnalogTriggerType GetAnalogTriggerTypeForRouting() const = 0;
- virtual bool IsAnalogTrigger() const = 0;
- virtual int GetChannel() const = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/DoubleSolenoid.h b/third_party/allwpilib_2017/wpilibc/athena/include/DoubleSolenoid.h
deleted file mode 100644
index 0a25870..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/DoubleSolenoid.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "HAL/Types.h"
-#include "LiveWindow/LiveWindowSendable.h"
-#include "SolenoidBase.h"
-#include "tables/ITableListener.h"
-
-namespace frc {
-
-/**
- * DoubleSolenoid class for running 2 channels of high voltage Digital Output
- * (PCM).
- *
- * The DoubleSolenoid class is typically used for pneumatics solenoids that
- * have two positions controlled by two separate channels.
- */
-class DoubleSolenoid : public SolenoidBase,
- public LiveWindowSendable,
- public ITableListener {
- public:
- enum Value { kOff, kForward, kReverse };
-
- explicit DoubleSolenoid(int forwardChannel, int reverseChannel);
- DoubleSolenoid(int moduleNumber, int forwardChannel, int reverseChannel);
- virtual ~DoubleSolenoid();
- virtual void Set(Value value);
- virtual Value Get() const;
- bool IsFwdSolenoidBlackListed() const;
- bool IsRevSolenoidBlackListed() const;
-
- void ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew);
- void UpdateTable();
- void StartLiveWindowMode();
- void StopLiveWindowMode();
- std::string GetSmartDashboardType() const;
- void InitTable(std::shared_ptr<ITable> subTable);
- std::shared_ptr<ITable> GetTable() const;
-
- private:
- int m_forwardChannel; ///< The forward channel on the module to control.
- int m_reverseChannel; ///< The reverse channel on the module to control.
- int m_forwardMask; ///< The mask for the forward channel.
- int m_reverseMask; ///< The mask for the reverse channel.
- HAL_SolenoidHandle m_forwardHandle = HAL_kInvalidHandle;
- HAL_SolenoidHandle m_reverseHandle = HAL_kInvalidHandle;
-
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/DriverStation.h b/third_party/allwpilib_2017/wpilibc/athena/include/DriverStation.h
deleted file mode 100644
index f38b299..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/DriverStation.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <condition_variable>
-#include <memory>
-#include <string>
-#include <thread>
-
-#include "HAL/DriverStation.h"
-#include "HAL/cpp/priority_condition_variable.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "RobotState.h"
-#include "SensorBase.h"
-#include "llvm/StringRef.h"
-
-namespace frc {
-
-/**
- * Provide access to the network communication data to / from the Driver
- * Station.
- */
-class DriverStation : public SensorBase, public RobotStateInterface {
- public:
- enum Alliance { kRed, kBlue, kInvalid };
-
- virtual ~DriverStation();
- static DriverStation& GetInstance();
- static void ReportError(llvm::StringRef error);
- static void ReportWarning(llvm::StringRef error);
- static void ReportError(bool is_error, int code, llvm::StringRef error,
- llvm::StringRef location, llvm::StringRef stack);
-
- static const int kJoystickPorts = 6;
-
- double GetStickAxis(int stick, int axis);
- int GetStickPOV(int stick, int pov);
- int GetStickButtons(int stick) const;
- bool GetStickButton(int stick, int button);
-
- int GetStickAxisCount(int stick) const;
- int GetStickPOVCount(int stick) const;
- int GetStickButtonCount(int stick) const;
-
- bool GetJoystickIsXbox(int stick) const;
- int GetJoystickType(int stick) const;
- std::string GetJoystickName(int stick) const;
- int GetJoystickAxisType(int stick, int axis) const;
-
- bool IsEnabled() const override;
- bool IsDisabled() const override;
- bool IsAutonomous() const override;
- bool IsOperatorControl() const override;
- bool IsTest() const override;
- bool IsDSAttached() const;
- bool IsNewControlData() const;
- bool IsFMSAttached() const;
- bool IsSysActive() const;
- bool IsBrownedOut() const;
-
- Alliance GetAlliance() const;
- int GetLocation() const;
- void WaitForData();
- bool WaitForData(double timeout);
- double GetMatchTime() const;
- double GetBatteryVoltage() const;
-
- /** Only to be used to tell the Driver Station what code you claim to be
- * executing for diagnostic purposes only
- * @param entering If true, starting disabled code; if false, leaving disabled
- * code */
- void InDisabled(bool entering) { m_userInDisabled = entering; }
- /** Only to be used to tell the Driver Station what code you claim to be
- * executing for diagnostic purposes only
- * @param entering If true, starting autonomous code; if false, leaving
- * autonomous code */
- void InAutonomous(bool entering) { m_userInAutonomous = entering; }
- /** Only to be used to tell the Driver Station what code you claim to be
- * executing for diagnostic purposes only
- * @param entering If true, starting teleop code; if false, leaving teleop
- * code */
- void InOperatorControl(bool entering) { m_userInTeleop = entering; }
- /** Only to be used to tell the Driver Station what code you claim to be
- * executing for diagnostic purposes only
- * @param entering If true, starting test code; if false, leaving test code */
- void InTest(bool entering) { m_userInTest = entering; }
-
- protected:
- void GetData();
-
- private:
- DriverStation();
- void Run();
- void UpdateControlWord(bool force, HAL_ControlWord& controlWord) const;
-
- // Joystick User Data
- std::unique_ptr<HAL_JoystickAxes[]> m_joystickAxes;
- std::unique_ptr<HAL_JoystickPOVs[]> m_joystickPOVs;
- std::unique_ptr<HAL_JoystickButtons[]> m_joystickButtons;
- std::unique_ptr<HAL_JoystickDescriptor[]> m_joystickDescriptor;
-
- // Joystick Cached Data
- std::unique_ptr<HAL_JoystickAxes[]> m_joystickAxesCache;
- std::unique_ptr<HAL_JoystickPOVs[]> m_joystickPOVsCache;
- std::unique_ptr<HAL_JoystickButtons[]> m_joystickButtonsCache;
- std::unique_ptr<HAL_JoystickDescriptor[]> m_joystickDescriptorCache;
-
- // Internal Driver Station thread
- std::thread m_dsThread;
- std::atomic<bool> m_isRunning{false};
-
- // WPILib WaitForData control variables
- bool m_waitForDataPredicate = false;
- std::condition_variable_any m_waitForDataCond;
- priority_mutex m_waitForDataMutex;
-
- mutable std::atomic<bool> m_newControlData{false};
-
- mutable priority_mutex m_joystickDataMutex;
-
- // Robot state status variables
- bool m_userInDisabled = false;
- bool m_userInAutonomous = false;
- bool m_userInTeleop = false;
- bool m_userInTest = false;
-
- // Control word variables
- mutable HAL_ControlWord m_controlWordCache;
- mutable std::chrono::steady_clock::time_point m_lastControlWordUpdate;
- mutable priority_mutex m_controlWordMutex;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Encoder.h b/third_party/allwpilib_2017/wpilibc/athena/include/Encoder.h
deleted file mode 100644
index 03a5bb3..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Encoder.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "Counter.h"
-#include "CounterBase.h"
-#include "HAL/Encoder.h"
-#include "SensorBase.h"
-
-namespace frc {
-
-class DigitalSource;
-class DigitalGlitchFilter;
-
-/**
- * Class to read quad encoders.
- * Quadrature encoders are devices that count shaft rotation and can sense
- * direction. The output of the QuadEncoder class is an integer that can count
- * either up or down, and can go negative for reverse direction counting. When
- * creating QuadEncoders, a direction is supplied that changes the sense of the
- * output to make code more readable if the encoder is mounted such that forward
- * movement generates negative values. Quadrature encoders have two digital
- * outputs, an A Channel and a B Channel that are out of phase with each other
- * to allow the FPGA to do direction sensing.
- *
- * All encoders will immediately start counting - Reset() them if you need them
- * to be zeroed before use.
- */
-class Encoder : public SensorBase,
- public CounterBase {
- public:
- enum IndexingType {
- kResetWhileHigh,
- kResetWhileLow,
- kResetOnFallingEdge,
- kResetOnRisingEdge
- };
-
- Encoder(int aChannel, int bChannel, bool reverseDirection = false,
- EncodingType encodingType = k4X);
- Encoder(std::shared_ptr<DigitalSource> aSource,
- std::shared_ptr<DigitalSource> bSource, bool reverseDirection = false,
- EncodingType encodingType = k4X);
- Encoder(DigitalSource* aSource, DigitalSource* bSource,
- bool reverseDirection = false, EncodingType encodingType = k4X);
- Encoder(DigitalSource& aSource, DigitalSource& bSource,
- bool reverseDirection = false, EncodingType encodingType = k4X);
- virtual ~Encoder();
-
- // CounterBase interface
- int Get() const override;
- int GetRaw() const;
- int GetEncodingScale() const;
- void Reset() override;
- double GetPeriod() const override;
- void SetMaxPeriod(double maxPeriod) override;
- bool GetStopped() const override;
- bool GetDirection() const override;
-
- double GetDistance() const;
- double GetRate() const;
- void SetMinRate(double minRate);
- void SetDistancePerPulse(double distancePerPulse);
- void SetReverseDirection(bool reverseDirection);
- void SetSamplesToAverage(int samplesToAverage);
- int GetSamplesToAverage() const;
-
- void SetIndexSource(int channel, IndexingType type = kResetOnRisingEdge);
- WPI_DEPRECATED("Use pass-by-reference instead.")
- void SetIndexSource(DigitalSource* source,
- IndexingType type = kResetOnRisingEdge);
- void SetIndexSource(const DigitalSource& source,
- IndexingType type = kResetOnRisingEdge);
-
- int GetFPGAIndex() const;
-
- private:
- void InitEncoder(bool reverseDirection, EncodingType encodingType);
-
- double DecodingScaleFactor() const;
-
- std::shared_ptr<DigitalSource> m_aSource; // the A phase of the quad encoder
- std::shared_ptr<DigitalSource> m_bSource; // the B phase of the quad encoder
- std::unique_ptr<DigitalSource> m_indexSource = nullptr;
- HAL_EncoderHandle m_encoder = HAL_kInvalidHandle;
-
- friend class DigitalGlitchFilter;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/GearTooth.h b/third_party/allwpilib_2017/wpilibc/athena/include/GearTooth.h
deleted file mode 100644
index 8236db4..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/GearTooth.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "Counter.h"
-
-namespace frc {
-
-/**
- * Alias for counter class.
- * Implement the gear tooth sensor supplied by FIRST. Currently there is no
- * reverse sensing on the gear tooth sensor, but in future versions we might
- * implement the necessary timing in the FPGA to sense direction.
- */
-class GearTooth : public Counter {
- public:
- /// 55 uSec for threshold
- static constexpr double kGearToothThreshold = 55e-6;
- explicit GearTooth(int channel, bool directionSensitive = false);
- explicit GearTooth(DigitalSource* source, bool directionSensitive = false);
- explicit GearTooth(std::shared_ptr<DigitalSource> source,
- bool directionSensitive = false);
- virtual ~GearTooth() = default;
- void EnableDirectionSensing(bool directionSensitive);
-
- std::string GetSmartDashboardType() const override;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/I2C.h b/third_party/allwpilib_2017/wpilibc/athena/include/I2C.h
deleted file mode 100644
index 78decc5..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/I2C.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "SensorBase.h"
-
-namespace frc {
-
-/**
- * I2C bus interface class.
- *
- * This class is intended to be used by sensor (and other I2C device) drivers.
- * It probably should not be used directly.
- *
- */
-class I2C : SensorBase {
- public:
- enum Port { kOnboard, kMXP };
-
- I2C(Port port, int deviceAddress);
- virtual ~I2C();
-
- I2C(const I2C&) = delete;
- I2C& operator=(const I2C&) = delete;
-
- bool Transaction(uint8_t* dataToSend, int sendSize, uint8_t* dataReceived,
- int receiveSize);
- bool AddressOnly();
- bool Write(int registerAddress, uint8_t data);
- bool WriteBulk(uint8_t* data, int count);
- bool Read(int registerAddress, int count, uint8_t* data);
- bool ReadOnly(int count, uint8_t* buffer);
- // void Broadcast(int registerAddress, uint8_t data);
- bool VerifySensor(int registerAddress, int count, const uint8_t* expected);
-
- private:
- Port m_port;
- int m_deviceAddress;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Internal/HardwareHLReporting.h b/third_party/allwpilib_2017/wpilibc/athena/include/Internal/HardwareHLReporting.h
deleted file mode 100644
index d866192..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Internal/HardwareHLReporting.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 "HLUsageReporting.h"
-
-namespace frc {
-
-class HardwareHLReporting : public HLUsageReportingInterface {
- public:
- virtual void ReportScheduler();
- virtual void ReportSmartDashboard();
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/InterruptableSensorBase.h b/third_party/allwpilib_2017/wpilibc/athena/include/InterruptableSensorBase.h
deleted file mode 100644
index 49d877f..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/InterruptableSensorBase.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-
-#include "AnalogTriggerType.h"
-#include "HAL/Interrupts.h"
-#include "SensorBase.h"
-
-namespace frc {
-
-class InterruptableSensorBase : public SensorBase {
- public:
- enum WaitResult {
- kTimeout = 0x0,
- kRisingEdge = 0x1,
- kFallingEdge = 0x100,
- kBoth = 0x101,
- };
-
- InterruptableSensorBase();
- virtual ~InterruptableSensorBase() = default;
- virtual HAL_Handle GetPortHandleForRouting() const = 0;
- virtual AnalogTriggerType GetAnalogTriggerTypeForRouting() const = 0;
- virtual void RequestInterrupts(
- HAL_InterruptHandlerFunction handler,
- void* param); ///< Asynchronus handler version.
- virtual void RequestInterrupts(); ///< Synchronus Wait version.
- virtual void
- CancelInterrupts(); ///< Free up the underlying chipobject functions.
- virtual WaitResult WaitForInterrupt(
- double timeout,
- bool ignorePrevious = true); ///< Synchronus version.
- virtual void
- EnableInterrupts(); ///< Enable interrupts - after finishing setup.
- virtual void DisableInterrupts(); ///< Disable, but don't deallocate.
- virtual double ReadRisingTimestamp(); ///< Return the timestamp for the
- /// rising interrupt that occurred.
- virtual double ReadFallingTimestamp(); ///< Return the timestamp for the
- /// falling interrupt that occurred.
- virtual void SetUpSourceEdge(bool risingEdge, bool fallingEdge);
-
- protected:
- HAL_InterruptHandle m_interrupt = HAL_kInvalidHandle;
- void AllocateInterrupts(bool watcher);
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/IterativeRobot.h b/third_party/allwpilib_2017/wpilibc/athena/include/IterativeRobot.h
deleted file mode 100644
index 34847d6..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/IterativeRobot.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "RobotBase.h"
-
-namespace frc {
-
-/**
- * IterativeRobot implements a specific type of Robot Program framework,
- * extending the RobotBase class.
- *
- * The IterativeRobot class is intended to be subclassed by a user creating a
- * robot program.
- *
- * This class is intended to implement the "old style" default code, by
- * providing the following functions which are called by the main loop,
- * StartCompetition(), at the appropriate times:
- *
- * RobotInit() -- provide for initialization at robot power-on
- *
- * Init() functions -- each of the following functions is called once when the
- * appropriate mode is entered:
- * - DisabledInit() -- called only when first disabled
- * - AutonomousInit() -- called each and every time autonomous is entered from
- * another mode
- * - TeleopInit() -- called each and every time teleop is entered from
- * another mode
- * - TestInit() -- called each and every time test is entered from
- * another mode
- *
- * Periodic() functions -- each of these functions is called each time a
- * new packet is received from the driver station:
- * - RobotPeriodic()
- * - DisabledPeriodic()
- * - AutonomousPeriodic()
- * - TeleopPeriodic()
- * - TestPeriodic()
- *
- */
-
-class IterativeRobot : public RobotBase {
- public:
- virtual void StartCompetition();
-
- virtual void RobotInit();
- virtual void DisabledInit();
- virtual void AutonomousInit();
- virtual void TeleopInit();
- virtual void TestInit();
-
- virtual void RobotPeriodic();
- virtual void DisabledPeriodic();
- virtual void AutonomousPeriodic();
- virtual void TeleopPeriodic();
- virtual void TestPeriodic();
-
- protected:
- virtual ~IterativeRobot() = default;
- IterativeRobot() = default;
-
- private:
- bool m_disabledInitialized = false;
- bool m_autonomousInitialized = false;
- bool m_teleopInitialized = false;
- bool m_testInitialized = false;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Jaguar.h b/third_party/allwpilib_2017/wpilibc/athena/include/Jaguar.h
deleted file mode 100644
index 1c29fde..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Jaguar.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "PWMSpeedController.h"
-
-namespace frc {
-
-/**
- * Luminary Micro / Vex Robotics Jaguar Speed Controller with PWM control
- */
-class Jaguar : public PWMSpeedController {
- public:
- explicit Jaguar(int channel);
- virtual ~Jaguar() = default;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/MotorSafety.h b/third_party/allwpilib_2017/wpilibc/athena/include/MotorSafety.h
deleted file mode 100644
index 27c938c..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/MotorSafety.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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
-
-#define DEFAULT_SAFETY_EXPIRATION 0.1
-
-#include <sstream>
-
-namespace frc {
-
-class MotorSafety {
- public:
- virtual void SetExpiration(double timeout) = 0;
- virtual double GetExpiration() const = 0;
- virtual bool IsAlive() const = 0;
- virtual void StopMotor() = 0;
- virtual void SetSafetyEnabled(bool enabled) = 0;
- virtual bool IsSafetyEnabled() const = 0;
- virtual void GetDescription(std::ostringstream& desc) const = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/MotorSafetyHelper.h b/third_party/allwpilib_2017/wpilibc/athena/include/MotorSafetyHelper.h
deleted file mode 100644
index 829a9db..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/MotorSafetyHelper.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <set>
-
-#include "ErrorBase.h"
-#include "HAL/cpp/priority_mutex.h"
-
-namespace frc {
-
-class MotorSafety;
-
-class MotorSafetyHelper : public ErrorBase {
- public:
- explicit MotorSafetyHelper(MotorSafety* safeObject);
- ~MotorSafetyHelper();
- void Feed();
- void SetExpiration(double expirationTime);
- double GetExpiration() const;
- bool IsAlive() const;
- void Check();
- void SetSafetyEnabled(bool enabled);
- bool IsSafetyEnabled() const;
- static void CheckMotors();
-
- private:
- // the expiration time for this object
- double m_expiration;
- // true if motor safety is enabled for this motor
- bool m_enabled;
- // the FPGA clock value when this motor has expired
- double m_stopTime;
- // protect accesses to the state for this object
- mutable priority_recursive_mutex m_syncMutex;
- // the object that is using the helper
- MotorSafety* m_safeObject;
- // List of all existing MotorSafetyHelper objects.
- static std::set<MotorSafetyHelper*> m_helperList;
- // protect accesses to the list of helpers
- static priority_recursive_mutex m_listMutex;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Notifier.h b/third_party/allwpilib_2017/wpilibc/athena/include/Notifier.h
deleted file mode 100644
index 0ea50ff..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Notifier.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <functional>
-#include <utility>
-
-#include "ErrorBase.h"
-#include "HAL/Notifier.h"
-#include "HAL/cpp/priority_mutex.h"
-
-namespace frc {
-
-typedef std::function<void()> TimerEventHandler;
-
-class Notifier : public ErrorBase {
- public:
- explicit Notifier(TimerEventHandler handler);
-
- template <typename Callable, typename Arg, typename... Args>
- Notifier(Callable&& f, Arg&& arg, Args&&... args)
- : Notifier(std::bind(std::forward<Callable>(f), std::forward<Arg>(arg),
- std::forward<Args>(args)...)) {}
-
- virtual ~Notifier();
-
- Notifier(const Notifier&) = delete;
- Notifier& operator=(const Notifier&) = delete;
-
- void StartSingle(double delay);
- void StartPeriodic(double period);
- void Stop();
-
- private:
- // update the HAL alarm
- void UpdateAlarm();
- // HAL callback
- static void Notify(uint64_t currentTimeInt, HAL_NotifierHandle handle);
-
- // used to constrain execution between destructors and callback
- static priority_mutex m_destructorMutex;
- // held while updating process information
- priority_mutex m_processMutex;
- // HAL handle, atomic for proper destruction
- std::atomic<HAL_NotifierHandle> m_notifier{0};
- // address of the handler
- TimerEventHandler m_handler;
- // the absolute expiration time
- double m_expirationTime = 0;
- // the relative time (either periodic or single)
- double m_period = 0;
- // true if this is a periodic event
- bool m_periodic = false;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/PWM.h b/third_party/allwpilib_2017/wpilibc/athena/include/PWM.h
deleted file mode 100644
index 7778036..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/PWM.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "HAL/Types.h"
-#include "SensorBase.h"
-
-namespace frc {
-
-/**
- * Class implements the PWM generation in the FPGA.
- *
- * The values supplied as arguments for PWM outputs range from -1.0 to 1.0. They
- * are mapped to the hardware dependent values, in this case 0-2000 for the
- * FPGA. Changes are immediately sent to the FPGA, and the update occurs at the
- * next FPGA cycle. There is no delay.
- *
- * As of revision 0.1.10 of the FPGA, the FPGA interprets the 0-2000 values as
- * follows:
- * - 2000 = maximum pulse width
- * - 1999 to 1001 = linear scaling from "full forward" to "center"
- * - 1000 = center value
- * - 999 to 2 = linear scaling from "center" to "full reverse"
- * - 1 = minimum pulse width (currently .5ms)
- * - 0 = disabled (i.e. PWM output is held low)
- */
-class PWM : public SensorBase {
- public:
- enum PeriodMultiplier {
- kPeriodMultiplier_1X = 1,
- kPeriodMultiplier_2X = 2,
- kPeriodMultiplier_4X = 4
- };
-
- explicit PWM(int channel);
- virtual ~PWM();
- virtual void SetRaw(uint16_t value);
- virtual uint16_t GetRaw() const;
- virtual void SetPosition(double pos);
- virtual double GetPosition() const;
- virtual void SetSpeed(double speed);
- virtual double GetSpeed() const;
- virtual void SetDisabled();
- void SetPeriodMultiplier(PeriodMultiplier mult);
- void SetZeroLatch();
- void EnableDeadbandElimination(bool eliminateDeadband);
- void SetBounds(double max, double deadbandMax, double center,
- double deadbandMin, double min);
- void SetRawBounds(int max, int deadbandMax, int center, int deadbandMin,
- int min);
- void GetRawBounds(int32_t* max, int32_t* deadbandMax, int32_t* center,
- int32_t* deadbandMin, int32_t* min);
- int GetChannel() const { return m_channel; }
-
- protected:
-
- private:
- int m_channel;
- HAL_DigitalHandle m_handle;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/PWMSpeedController.h b/third_party/allwpilib_2017/wpilibc/athena/include/PWMSpeedController.h
deleted file mode 100644
index 9060413..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/PWMSpeedController.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "SafePWM.h"
-#include "SpeedController.h"
-
-namespace frc {
-
-/**
- * Common base class for all PWM Speed Controllers
- */
-class PWMSpeedController : public SafePWM, public SpeedController {
- public:
- virtual ~PWMSpeedController() = default;
- void Set(double value) override;
- double Get() const override;
- void Disable() override;
- void StopMotor() override;
-
- void PIDWrite(double output) override;
-
- void SetInverted(bool isInverted) override;
- bool GetInverted() const override;
-
- protected:
- explicit PWMSpeedController(int channel);
-
- private:
- bool m_isInverted = false;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/PowerDistributionPanel.h b/third_party/allwpilib_2017/wpilibc/athena/include/PowerDistributionPanel.h
deleted file mode 100644
index f5223f3..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/PowerDistributionPanel.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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 <memory>
-#include <string>
-
-#include "SensorBase.h"
-
-namespace frc {
-
-/**
- * Class for getting voltage, current, temperature, power and energy from the
- * CAN PDP.
- */
-class PowerDistributionPanel : public SensorBase {
- public:
- PowerDistributionPanel();
- explicit PowerDistributionPanel(int module);
-
- double GetVoltage() const;
- double GetTemperature() const;
- double GetCurrent(int channel) const;
- double GetTotalCurrent() const;
- double GetTotalPower() const;
- double GetTotalEnergy() const;
- void ResetTotalEnergy();
- void ClearStickyFaults();
-
- private:
- int m_module;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Preferences.h b/third_party/allwpilib_2017/wpilibc/athena/include/Preferences.h
deleted file mode 100644
index 1dcd39b..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Preferences.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "ErrorBase.h"
-#include "networktables/NetworkTable.h"
-#include "tables/ITableListener.h"
-
-namespace frc {
-
-/**
- * The preferences class provides a relatively simple way to save important
- * values to the roboRIO to access the next time the roboRIO is booted.
- *
- * <p>This class loads and saves from a file inside the roboRIO. The user can
- * not access the file directly, but may modify values at specific fields which
- * will then be automatically periodically saved to the file by the NetworkTable
- * server.</p>
- *
- * <p>This class is thread safe.</p>
- *
- * <p>This will also interact with {@link NetworkTable} by creating a table
- * called "Preferences" with all the key-value pairs.</p>
- */
-class Preferences : public ErrorBase {
- public:
- static Preferences* GetInstance();
-
- std::vector<std::string> GetKeys();
- std::string GetString(llvm::StringRef key, llvm::StringRef defaultValue = "");
- int GetInt(llvm::StringRef key, int defaultValue = 0);
- double GetDouble(llvm::StringRef key, double defaultValue = 0.0);
- float GetFloat(llvm::StringRef key, float defaultValue = 0.0);
- bool GetBoolean(llvm::StringRef key, bool defaultValue = false);
- int64_t GetLong(llvm::StringRef key, int64_t defaultValue = 0);
- void PutString(llvm::StringRef key, llvm::StringRef value);
- void PutInt(llvm::StringRef key, int value);
- void PutDouble(llvm::StringRef key, double value);
- void PutFloat(llvm::StringRef key, float value);
- void PutBoolean(llvm::StringRef key, bool value);
- void PutLong(llvm::StringRef key, int64_t value);
- WPI_DEPRECATED(
- "Saving is now automatically performed by the NetworkTables server.")
- void Save();
- bool ContainsKey(llvm::StringRef key);
- void Remove(llvm::StringRef key);
-
- protected:
- Preferences();
- virtual ~Preferences() = default;
-
- private:
- std::shared_ptr<ITable> m_table;
- class Listener : public ITableListener {
- public:
- void ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew) override;
- void ValueChangedEx(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value,
- uint32_t flags) override;
- };
- Listener m_listener;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Relay.h b/third_party/allwpilib_2017/wpilibc/athena/include/Relay.h
deleted file mode 100644
index de550d2..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Relay.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "HAL/Types.h"
-#include "SensorBase.h"
-
-namespace frc {
-
-/**
- * Class for Spike style relay outputs.
- * Relays are intended to be connected to spikes or similar relays. The relay
- * channels controls a pair of pins that are either both off, one on, the other
- * on, or both on. This translates into two spike outputs at 0v, one at 12v and
- * one at 0v, one at 0v and the other at 12v, or two spike outputs at 12V. This
- * allows off, full forward, or full reverse control of motors without variable
- * speed. It also allows the two channels (forward and reverse) to be used
- * independently for something that does not care about voltage polarity (like
- * a solenoid).
- */
-class Relay : public SensorBase {
- public:
- enum Value { kOff, kOn, kForward, kReverse };
- enum Direction { kBothDirections, kForwardOnly, kReverseOnly };
-
- explicit Relay(int channel, Direction direction = kBothDirections);
- virtual ~Relay();
-
- void Set(Value value);
- Value Get() const;
- int GetChannel() const;
-
- private:
- int m_channel;
- Direction m_direction;
-
- HAL_RelayHandle m_forwardHandle = HAL_kInvalidHandle;
- HAL_RelayHandle m_reverseHandle = HAL_kInvalidHandle;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/RobotBase.h b/third_party/allwpilib_2017/wpilibc/athena/include/RobotBase.h
deleted file mode 100644
index 26a0c91..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/RobotBase.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <cstdio>
-#include <iostream>
-#include <thread>
-
-#include "Base.h"
-#include "HAL/HAL.h"
-
-namespace frc {
-
-class DriverStation;
-
-#define START_ROBOT_CLASS(_ClassName_) \
- int main() { \
- if (!HAL_Initialize(0)) { \
- std::cerr << "FATAL ERROR: HAL could not be initialized" << std::endl; \
- return -1; \
- } \
- HAL_Report(HALUsageReporting::kResourceType_Language, \
- HALUsageReporting::kLanguage_CPlusPlus); \
- static _ClassName_ robot; \
- std::printf("\n********** Robot program starting **********\n"); \
- robot.StartCompetition(); \
- }
-
-/**
- * Implement a Robot Program framework.
- * The RobotBase class is intended to be subclassed by a user creating a robot
- * program. Overridden Autonomous() and OperatorControl() methods are called at
- * the appropriate time as the match proceeds. In the current implementation,
- * the Autonomous code will run to completion before the OperatorControl code
- * could start. In the future the Autonomous code might be spawned as a task,
- * then killed at the end of the Autonomous period.
- */
-class RobotBase {
- public:
- bool IsEnabled() const;
- bool IsDisabled() const;
- bool IsAutonomous() const;
- bool IsOperatorControl() const;
- bool IsTest() const;
- bool IsNewDataAvailable() const;
- static std::thread::id GetThreadId();
- virtual void StartCompetition() = 0;
-
- protected:
- RobotBase();
- virtual ~RobotBase() = default;
-
- RobotBase(const RobotBase&) = delete;
- RobotBase& operator=(const RobotBase&) = delete;
-
- DriverStation& m_ds;
-
- static std::thread::id m_threadId;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/RobotDrive.h b/third_party/allwpilib_2017/wpilibc/athena/include/RobotDrive.h
deleted file mode 100644
index 8e23e62..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/RobotDrive.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <sstream>
-
-#include "ErrorBase.h"
-#include "MotorSafety.h"
-#include "MotorSafetyHelper.h"
-
-namespace frc {
-
-class SpeedController;
-class GenericHID;
-
-/**
- * Utility class for handling Robot drive based on a definition of the motor
- * configuration.
- * The robot drive class handles basic driving for a robot. Currently, 2 and 4
- * motor tank and mecanum drive trains are supported. In the future other drive
- * types like swerve might be implemented. Motor channel numbers are passed
- * supplied on creation of the class. Those are used for either the Drive
- * function (intended for hand created drive code, such as autonomous) or with
- * the Tank/Arcade functions intended to be used for Operator Control driving.
- */
-class RobotDrive : public MotorSafety, public ErrorBase {
- public:
- enum MotorType {
- kFrontLeftMotor = 0,
- kFrontRightMotor = 1,
- kRearLeftMotor = 2,
- kRearRightMotor = 3
- };
-
- RobotDrive(int leftMotorChannel, int rightMotorChannel);
- RobotDrive(int frontLeftMotorChannel, int rearLeftMotorChannel,
- int frontRightMotorChannel, int rearRightMotorChannel);
- RobotDrive(SpeedController* leftMotor, SpeedController* rightMotor);
- RobotDrive(SpeedController& leftMotor, SpeedController& rightMotor);
- RobotDrive(std::shared_ptr<SpeedController> leftMotor,
- std::shared_ptr<SpeedController> rightMotor);
- RobotDrive(SpeedController* frontLeftMotor, SpeedController* rearLeftMotor,
- SpeedController* frontRightMotor, SpeedController* rearRightMotor);
- RobotDrive(SpeedController& frontLeftMotor, SpeedController& rearLeftMotor,
- SpeedController& frontRightMotor, SpeedController& rearRightMotor);
- RobotDrive(std::shared_ptr<SpeedController> frontLeftMotor,
- std::shared_ptr<SpeedController> rearLeftMotor,
- std::shared_ptr<SpeedController> frontRightMotor,
- std::shared_ptr<SpeedController> rearRightMotor);
- virtual ~RobotDrive() = default;
-
- RobotDrive(const RobotDrive&) = delete;
- RobotDrive& operator=(const RobotDrive&) = delete;
-
- void Drive(double outputMagnitude, double curve);
- void TankDrive(GenericHID* leftStick, GenericHID* rightStick,
- bool squaredInputs = true);
- void TankDrive(GenericHID& leftStick, GenericHID& rightStick,
- bool squaredInputs = true);
- void TankDrive(GenericHID* leftStick, int leftAxis, GenericHID* rightStick,
- int rightAxis, bool squaredInputs = true);
- void TankDrive(GenericHID& leftStick, int leftAxis, GenericHID& rightStick,
- int rightAxis, bool squaredInputs = true);
- void TankDrive(double leftValue, double rightValue,
- bool squaredInputs = true);
- void ArcadeDrive(GenericHID* stick, bool squaredInputs = true);
- void ArcadeDrive(GenericHID& stick, bool squaredInputs = true);
- void ArcadeDrive(GenericHID* moveStick, int moveChannel,
- GenericHID* rotateStick, int rotateChannel,
- bool squaredInputs = true);
- void ArcadeDrive(GenericHID& moveStick, int moveChannel,
- GenericHID& rotateStick, int rotateChannel,
- bool squaredInputs = true);
- void ArcadeDrive(double moveValue, double rotateValue,
- bool squaredInputs = true);
- void MecanumDrive_Cartesian(double x, double y, double rotation,
- double gyroAngle = 0.0);
- void MecanumDrive_Polar(double magnitude, double direction, double rotation);
- void HolonomicDrive(double magnitude, double direction, double rotation);
- virtual void SetLeftRightMotorOutputs(double leftOutput, double rightOutput);
- void SetInvertedMotor(MotorType motor, bool isInverted);
- void SetSensitivity(double sensitivity);
- void SetMaxOutput(double maxOutput);
-
- void SetExpiration(double timeout) override;
- double GetExpiration() const override;
- bool IsAlive() const override;
- void StopMotor() override;
- bool IsSafetyEnabled() const override;
- void SetSafetyEnabled(bool enabled) override;
- void GetDescription(std::ostringstream& desc) const override;
-
- protected:
- void InitRobotDrive();
- double Limit(double num);
- void Normalize(double* wheelSpeeds);
- void RotateVector(double& x, double& y, double angle);
-
- static const int kMaxNumberOfMotors = 4;
- double m_sensitivity = 0.5;
- double m_maxOutput = 1.0;
- std::shared_ptr<SpeedController> m_frontLeftMotor;
- std::shared_ptr<SpeedController> m_frontRightMotor;
- std::shared_ptr<SpeedController> m_rearLeftMotor;
- std::shared_ptr<SpeedController> m_rearRightMotor;
- std::unique_ptr<MotorSafetyHelper> m_safetyHelper;
-
- private:
- int GetNumMotors() {
- int motors = 0;
- if (m_frontLeftMotor) motors++;
- if (m_frontRightMotor) motors++;
- if (m_rearLeftMotor) motors++;
- if (m_rearRightMotor) motors++;
- return motors;
- }
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/SD540.h b/third_party/allwpilib_2017/wpilibc/athena/include/SD540.h
deleted file mode 100644
index 65c49a8..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/SD540.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "PWMSpeedController.h"
-
-namespace frc {
-
-/**
- * Mindsensors SD540 Speed Controller
- */
-class SD540 : public PWMSpeedController {
- public:
- explicit SD540(int channel);
- virtual ~SD540() = default;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/SPI.h b/third_party/allwpilib_2017/wpilibc/athena/include/SPI.h
deleted file mode 100644
index 6a69e61..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/SPI.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "SensorBase.h"
-
-namespace frc {
-
-class DigitalOutput;
-class DigitalInput;
-
-/**
- * SPI bus interface class.
- *
- * This class is intended to be used by sensor (and other SPI device) drivers.
- * It probably should not be used directly.
- *
- */
-class SPI : public SensorBase {
- public:
- enum Port { kOnboardCS0, kOnboardCS1, kOnboardCS2, kOnboardCS3, kMXP };
- explicit SPI(Port SPIport);
- virtual ~SPI();
-
- SPI(const SPI&) = delete;
- SPI& operator=(const SPI&) = delete;
-
- void SetClockRate(double hz);
-
- void SetMSBFirst();
- void SetLSBFirst();
-
- void SetSampleDataOnFalling();
- void SetSampleDataOnRising();
-
- void SetClockActiveLow();
- void SetClockActiveHigh();
-
- void SetChipSelectActiveHigh();
- void SetChipSelectActiveLow();
-
- virtual int Write(uint8_t* data, int size);
- virtual int Read(bool initiate, uint8_t* dataReceived, int size);
- virtual int Transaction(uint8_t* dataToSend, uint8_t* dataReceived, int size);
-
- void InitAccumulator(double period, int cmd, int xfer_size, int valid_mask,
- int valid_value, int data_shift, int data_size,
- bool is_signed, bool big_endian);
- void FreeAccumulator();
- void ResetAccumulator();
- void SetAccumulatorCenter(int center);
- void SetAccumulatorDeadband(int deadband);
- int GetAccumulatorLastValue() const;
- int64_t GetAccumulatorValue() const;
- int64_t GetAccumulatorCount() const;
- double GetAccumulatorAverage() const;
- void GetAccumulatorOutput(int64_t& value, int64_t& count) const;
-
- protected:
- int m_port;
- bool m_msbFirst = false; // default little-endian
- bool m_sampleOnTrailing = false; // default data updated on falling edge
- bool m_clk_idle_high = false; // default clock active high
-
- private:
- void Init();
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/SafePWM.h b/third_party/allwpilib_2017/wpilibc/athena/include/SafePWM.h
deleted file mode 100644
index 16a64c1..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/SafePWM.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <sstream>
-
-#include "MotorSafety.h"
-#include "MotorSafetyHelper.h"
-#include "PWM.h"
-
-namespace frc {
-
-/**
- * A safe version of the PWM class.
- * It is safe because it implements the MotorSafety interface that provides
- * timeouts in the event that the motor value is not updated before the
- * expiration time. This delegates the actual work to a MotorSafetyHelper
- * object that is used for all objects that implement MotorSafety.
- */
-class SafePWM : public PWM, public MotorSafety {
- public:
- explicit SafePWM(int channel);
- virtual ~SafePWM() = default;
-
- void SetExpiration(double timeout);
- double GetExpiration() const;
- bool IsAlive() const;
- void StopMotor();
- bool IsSafetyEnabled() const;
- void SetSafetyEnabled(bool enabled);
- void GetDescription(std::ostringstream& desc) const;
-
- virtual void SetSpeed(double speed);
-
- private:
- std::unique_ptr<MotorSafetyHelper> m_safetyHelper;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/SampleRobot.h b/third_party/allwpilib_2017/wpilibc/athena/include/SampleRobot.h
deleted file mode 100644
index 09051e5..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/SampleRobot.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "RobotBase.h"
-
-namespace frc {
-
-class SampleRobot : public RobotBase {
- public:
- SampleRobot();
- virtual ~SampleRobot() = default;
- virtual void RobotInit();
- virtual void Disabled();
- virtual void Autonomous();
- virtual void OperatorControl();
- virtual void Test();
- virtual void RobotMain();
- void StartCompetition();
-
- private:
- bool m_robotMainOverridden;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/SensorBase.h b/third_party/allwpilib_2017/wpilibc/athena/include/SensorBase.h
deleted file mode 100644
index 09720fc..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/SensorBase.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <stdint.h>
-
-#include "Base.h"
-#include "ErrorBase.h"
-
-namespace frc {
-
-/**
- * Base class for all sensors.
- * Stores most recent status information as well as containing utility functions
- * for checking channels and error processing.
- */
-class SensorBase : public ErrorBase {
- public:
- SensorBase() = default;
- virtual ~SensorBase() = default;
-
- SensorBase(const SensorBase&) = delete;
- SensorBase& operator=(const SensorBase&) = delete;
-
- static int GetDefaultSolenoidModule() { return 0; }
-
- static bool CheckSolenoidModule(int moduleNumber);
- static bool CheckDigitalChannel(int channel);
- static bool CheckRelayChannel(int channel);
- static bool CheckPWMChannel(int channel);
- static bool CheckAnalogInputChannel(int channel);
- static bool CheckAnalogOutputChannel(int channel);
- static bool CheckSolenoidChannel(int channel);
- static bool CheckPDPChannel(int channel);
-
- static const int kDigitalChannels;
- static const int kAnalogInputs;
- static const int kAnalogOutputs;
- static const int kSolenoidChannels;
- static const int kSolenoidModules;
- static const int kPwmChannels;
- static const int kRelayChannels;
- static const int kPDPChannels;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/SerialPort.h b/third_party/allwpilib_2017/wpilibc/athena/include/SerialPort.h
deleted file mode 100644
index 7590b4f..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/SerialPort.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <string>
-
-#include "ErrorBase.h"
-#include "llvm/StringRef.h"
-#include "support/deprecated.h"
-
-namespace frc {
-
-/**
- * Driver for the RS-232 serial port on the roboRIO.
- *
- * The current implementation uses the VISA formatted I/O mode. This means that
- * all traffic goes through the fomatted buffers. This allows the intermingled
- * use of Printf(), Scanf(), and the raw buffer accessors Read() and Write().
- *
- * More information can be found in the NI-VISA User Manual here:
- * http://www.ni.com/pdf/manuals/370423a.pdf
- * and the NI-VISA Programmer's Reference Manual here:
- * http://www.ni.com/pdf/manuals/370132c.pdf
- */
-class SerialPort : public ErrorBase {
- public:
- enum Parity {
- kParity_None = 0,
- kParity_Odd = 1,
- kParity_Even = 2,
- kParity_Mark = 3,
- kParity_Space = 4
- };
- enum StopBits {
- kStopBits_One = 10,
- kStopBits_OnePointFive = 15,
- kStopBits_Two = 20
- };
- enum FlowControl {
- kFlowControl_None = 0,
- kFlowControl_XonXoff = 1,
- kFlowControl_RtsCts = 2,
- kFlowControl_DtrDsr = 4
- };
- enum WriteBufferMode { kFlushOnAccess = 1, kFlushWhenFull = 2 };
- enum Port { kOnboard = 0, kMXP = 1, kUSB = 2, kUSB1 = 2, kUSB2 = 3 };
-
- SerialPort(int baudRate, Port port = kOnboard, int dataBits = 8,
- Parity parity = kParity_None, StopBits stopBits = kStopBits_One);
- ~SerialPort();
-
- SerialPort(const SerialPort&) = delete;
- SerialPort& operator=(const SerialPort&) = delete;
-
- void SetFlowControl(FlowControl flowControl);
- void EnableTermination(char terminator = '\n');
- void DisableTermination();
- int GetBytesReceived();
- int Read(char* buffer, int count);
- WPI_DEPRECATED(
- "Potential for unexpected behavior. Please use StringRef overload for "
- "custom length buffers using std::string")
- int Write(const std::string& buffer, int count);
- int Write(const char* buffer, int count);
- int Write(llvm::StringRef buffer);
- void SetTimeout(double timeout);
- void SetReadBufferSize(int size);
- void SetWriteBufferSize(int size);
- void SetWriteBufferMode(WriteBufferMode mode);
- void Flush();
- void Reset();
-
- private:
- int m_resourceManagerHandle = 0;
- int m_portHandle = 0;
- bool m_consoleModeEnabled = false;
- int m_port;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Servo.h b/third_party/allwpilib_2017/wpilibc/athena/include/Servo.h
deleted file mode 100644
index ac7b413..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Servo.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "PWM.h"
-
-namespace frc {
-
-/**
- * Standard hobby style servo.
- *
- * The range parameters default to the appropriate values for the Hitec HS-322HD
- * servo provided
- * in the FIRST Kit of Parts in 2008.
- */
-class Servo : public PWM {
- public:
- explicit Servo(int channel);
- virtual ~Servo();
- void Set(double value);
- void SetOffline();
- double Get() const;
- void SetAngle(double angle);
- double GetAngle() const;
- static double GetMaxAngle() { return kMaxServoAngle; }
- static double GetMinAngle() { return kMinServoAngle; }
-
- private:
- double GetServoAngleRange() const { return kMaxServoAngle - kMinServoAngle; }
-
- static constexpr double kMaxServoAngle = 180.0;
- static constexpr double kMinServoAngle = 0.0;
-
- static constexpr double kDefaultMaxServoPWM = 2.4;
- static constexpr double kDefaultMinServoPWM = .6;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Solenoid.h b/third_party/allwpilib_2017/wpilibc/athena/include/Solenoid.h
deleted file mode 100644
index 4db8ac3..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Solenoid.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "HAL/Types.h"
-#include "SolenoidBase.h"
-
-namespace frc {
-
-/**
- * Solenoid class for running high voltage Digital Output (PCM).
- *
- * The Solenoid class is typically used for pneumatics solenoids, but could be
- * used for any device within the current spec of the PCM.
- */
-class Solenoid : public SolenoidBase {
- public:
- explicit Solenoid(int channel);
- Solenoid(int moduleNumber, int channel);
- virtual ~Solenoid();
- virtual void Set(bool on);
- virtual bool Get() const;
- bool IsBlackListed() const;
-
- private:
- HAL_SolenoidHandle m_solenoidHandle = HAL_kInvalidHandle;
- int m_channel; ///< The channel on the module to control.
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/SolenoidBase.h b/third_party/allwpilib_2017/wpilibc/athena/include/SolenoidBase.h
deleted file mode 100644
index 5cd327e..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/SolenoidBase.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-
-#include "SensorBase.h"
-
-namespace frc {
-
-/**
- * SolenoidBase class is the common base class for the Solenoid and
- * DoubleSolenoid classes.
- */
-class SolenoidBase : public SensorBase {
- public:
- virtual ~SolenoidBase() = default;
- int GetAll(int module = 0) const;
- void SetAll(int value, int module = 0);
-
- int GetPCMSolenoidBlackList(int module) const;
- bool GetPCMSolenoidVoltageStickyFault(int module) const;
- bool GetPCMSolenoidVoltageFault(int module) const;
- void ClearAllPCMStickyFaults(int module);
-
- protected:
- explicit SolenoidBase(int pcmID);
- static const int m_maxModules = 63;
- static const int m_maxPorts = 8;
- // static void* m_ports[m_maxModules][m_maxPorts];
- int m_moduleNumber; ///< Slot number where the module is plugged into
- /// the chassis.
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Spark.h b/third_party/allwpilib_2017/wpilibc/athena/include/Spark.h
deleted file mode 100644
index 8602dbc..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Spark.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "PWMSpeedController.h"
-
-namespace frc {
-
-/**
- * REV Robotics Speed Controller
- */
-class Spark : public PWMSpeedController {
- public:
- explicit Spark(int channel);
- virtual ~Spark() = default;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/SpeedController.h b/third_party/allwpilib_2017/wpilibc/athena/include/SpeedController.h
deleted file mode 100644
index 3458e7f..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/SpeedController.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "PIDOutput.h"
-
-namespace frc {
-
-/**
- * Interface for speed controlling devices.
- */
-class SpeedController : public PIDOutput {
- public:
- virtual ~SpeedController() = default;
- /**
- * Common interface for setting the speed of a speed controller.
- *
- * @param speed The speed to set. Value should be between -1.0 and 1.0.
- */
- virtual void Set(double speed) = 0;
-
- /**
- * Common interface for getting the current set speed of a speed controller.
- *
- * @return The current set speed. Value is between -1.0 and 1.0.
- */
- virtual double Get() const = 0;
-
- /**
- * Common interface for inverting direction of a speed controller.
- * @param isInverted The state of inversion, true is inverted.
- */
- virtual void SetInverted(bool isInverted) = 0;
- /**
-
- * Common interface for disabling a motor.
- */
- virtual void Disable() = 0;
-
- /**
- * Common interface for returning the inversion state of a speed controller.
- * @return isInverted The state of inversion, true is inverted.
- */
- virtual bool GetInverted() const = 0;
-
- /**
- * Common interface to stop the motor until Set is called again.
- */
- virtual void StopMotor() = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Talon.h b/third_party/allwpilib_2017/wpilibc/athena/include/Talon.h
deleted file mode 100644
index 6b8fb7f..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Talon.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "PWM.h"
-
-namespace frc {
-
-/**
- * Cross the Road Electronics (CTRE) Talon and Talon SR Speed Controller
- */
-class Talon : public PWM {
- public:
- explicit Talon(int channel);
- virtual ~Talon() = default;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/TalonSRX.h b/third_party/allwpilib_2017/wpilibc/athena/include/TalonSRX.h
deleted file mode 100644
index ecc5997..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/TalonSRX.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "PWMSpeedController.h"
-
-namespace frc {
-
-/**
- * Cross the Road Electronics (CTRE) Talon SRX Speed Controller with PWM control
- */
-class TalonSRX : public PWMSpeedController {
- public:
- explicit TalonSRX(int channel);
- virtual ~TalonSRX() = default;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Task.h b/third_party/allwpilib_2017/wpilibc/athena/include/Task.h
deleted file mode 100644
index 646a400..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Task.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <string>
-#include <thread>
-
-#include "ErrorBase.h"
-#include "HAL/HAL.h"
-#include "support/deprecated.h"
-
-namespace frc {
-
-/**
- * Wrapper class around std::thread that allows changing thread priority
- */
-class WPI_DEPRECATED(
- "Task API scheduled for removal in 2018. Replace with std::thread, and use "
- "Threads API for setting priority") Task : public ErrorBase {
- public:
- static const int kDefaultPriority = 60;
-
- Task() = default;
- Task(const Task&) = delete;
- Task& operator=(const Task&) = delete;
- Task& operator=(Task&& task);
-
- template <class Function, class... Args>
- Task(const std::string& name, Function&& function, Args&&... args);
-
- virtual ~Task();
-
- bool joinable() const noexcept;
- void join();
- void detach();
- std::thread::id get_id() const noexcept;
- std::thread::native_handle_type native_handle();
-
- bool Verify();
-
- int GetPriority();
-
- bool SetPriority(int priority);
-
- std::string GetName() const;
-
- private:
- std::thread m_thread;
- std::string m_taskName;
-
- typedef int32_t TASK_STATUS;
-
- static constexpr int32_t TASK_OK = 0;
- static constexpr int32_t TASK_ERROR = -1;
- static constexpr int32_t TaskLib_ILLEGAL_PRIORITY = 22; // 22 is EINVAL
-
- bool HandleError(TASK_STATUS results);
- TASK_STATUS VerifyTaskId();
- TASK_STATUS GetTaskPriority(int32_t* priority);
- TASK_STATUS SetTaskPriority(int32_t priority);
-};
-
-} // namespace frc
-
-#include "Task.inc"
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Task.inc b/third_party/allwpilib_2017/wpilibc/athena/include/Task.inc
deleted file mode 100644
index e56b5ee..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Task.inc
+++ /dev/null
@@ -1,44 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <stdint.h>
-
-#include <atomic>
-#include <iostream>
-#include <string>
-#include <utility>
-
-namespace frc {
-
-/**
- * Create and launch a task.
- *
- * @param name The name of the task. "FRC_" will be prepended to the task name.
- * @param function The address of the function to run as the new task.
- * @param args A parameter pack of arguments to pass to the function.
- */
-template <class Function, class... Args>
-Task::Task(const std::string& name, Function&& function, Args&&... args) {
- m_taskName = "FRC_";
- m_taskName += name;
-
- std::cout << "[HAL] Starting task " << m_taskName << "..." << std::endl;
-
- m_thread = std::thread(std::forward<std::decay_t<Function>>(function),
- std::forward<Args>(args)...);
- // TODO: lvuser does not currently have permissions to set the priority.
- // SetPriority(kDefaultPriority);
-
- static std::atomic<int32_t> instances{0};
- instances++;
- HAL_Report(HALUsageReporting::kResourceType_Task, instances, 0,
- m_taskName.c_str());
-}
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Threads.h b/third_party/allwpilib_2017/wpilibc/athena/include/Threads.h
deleted file mode 100644
index 57c86cf..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Threads.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <thread>
-
-namespace frc {
-
-int GetThreadPriority(std::thread& thread, bool* isRealTime);
-int GetCurrentThreadPriority(bool* isRealTime);
-bool SetThreadPriority(std::thread& thread, bool realTime, int priority);
-bool SetCurrentThreadPriority(bool realTime, int priority);
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Ultrasonic.h b/third_party/allwpilib_2017/wpilibc/athena/include/Ultrasonic.h
deleted file mode 100644
index f3a457c..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Ultrasonic.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <set>
-#include <string>
-#include <thread>
-
-#include "Counter.h"
-#include "LiveWindow/LiveWindowSendable.h"
-#include "PIDSource.h"
-#include "SensorBase.h"
-
-namespace frc {
-
-class DigitalInput;
-class DigitalOutput;
-
-/**
- * Ultrasonic rangefinder class.
- * The Ultrasonic rangefinder measures absolute distance based on the round-trip
- * time of a ping generated by the controller. These sensors use two
- * transducers, a speaker and a microphone both tuned to the ultrasonic range. A
- * common ultrasonic sensor, the Daventech SRF04 requires a short pulse to be
- * generated on a digital channel. This causes the chirp to be emitted. A second
- * line becomes high as the ping is transmitted and goes low when the echo is
- * received. The time that the line is high determines the round trip distance
- * (time of flight).
- */
-class Ultrasonic : public SensorBase,
- public PIDSource,
- public LiveWindowSendable {
- public:
- enum DistanceUnit { kInches = 0, kMilliMeters = 1 };
-
- Ultrasonic(DigitalOutput* pingChannel, DigitalInput* echoChannel,
- DistanceUnit units = kInches);
-
- Ultrasonic(DigitalOutput& pingChannel, DigitalInput& echoChannel,
- DistanceUnit units = kInches);
-
- Ultrasonic(std::shared_ptr<DigitalOutput> pingChannel,
- std::shared_ptr<DigitalInput> echoChannel,
- DistanceUnit units = kInches);
- Ultrasonic(int pingChannel, int echoChannel, DistanceUnit units = kInches);
- virtual ~Ultrasonic();
-
- void Ping();
- bool IsRangeValid() const;
- static void SetAutomaticMode(bool enabling);
- double GetRangeInches() const;
- double GetRangeMM() const;
- bool IsEnabled() const { return m_enabled; }
- void SetEnabled(bool enable) { m_enabled = enable; }
-
- double PIDGet() override;
- void SetPIDSourceType(PIDSourceType pidSource) override;
- void SetDistanceUnits(DistanceUnit units);
- DistanceUnit GetDistanceUnits() const;
-
- void UpdateTable() override;
- void StartLiveWindowMode() override;
- void StopLiveWindowMode() override;
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subTable) override;
- std::shared_ptr<ITable> GetTable() const override;
-
- private:
- void Initialize();
-
- static void UltrasonicChecker();
-
- // Time (sec) for the ping trigger pulse.
- static constexpr double kPingTime = 10 * 1e-6;
- // Priority that the ultrasonic round robin task runs.
- static const int kPriority = 64;
- // Max time (ms) between readings.
- static constexpr double kMaxUltrasonicTime = 0.1;
- static constexpr double kSpeedOfSoundInchesPerSec = 1130.0 * 12.0;
-
- static std::thread
- m_thread; // thread doing the round-robin automatic sensing
- static std::set<Ultrasonic*> m_sensors; // ultrasonic sensors
- static std::atomic<bool> m_automaticEnabled; // automatic round robin mode
-
- std::shared_ptr<DigitalOutput> m_pingChannel;
- std::shared_ptr<DigitalInput> m_echoChannel;
- bool m_enabled = false;
- Counter m_counter;
- DistanceUnit m_units;
-
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Victor.h b/third_party/allwpilib_2017/wpilibc/athena/include/Victor.h
deleted file mode 100644
index 2dbcb20..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Victor.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "PWMSpeedController.h"
-
-namespace frc {
-
-/**
- * Vex Robotics Victor 888 Speed Controller
- *
- * The Vex Robotics Victor 884 Speed Controller can also be used with this
- * class but may need to be calibrated per the Victor 884 user manual.
- */
-class Victor : public PWMSpeedController {
- public:
- explicit Victor(int channel);
- virtual ~Victor() = default;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/VictorSP.h b/third_party/allwpilib_2017/wpilibc/athena/include/VictorSP.h
deleted file mode 100644
index 2061ee4..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/VictorSP.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "PWM.h"
-
-namespace frc {
-
-/**
- * Vex Robotics Victor SP Speed Controller
- */
-class VictorSP : public PWM {
- public:
- explicit VictorSP(int channel);
- virtual ~VictorSP() = default;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/WPILib.h b/third_party/allwpilib_2017/wpilibc/athena/include/WPILib.h
deleted file mode 100644
index 5fe5c74..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/WPILib.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "ADXL345_I2C.h"
-#include "ADXL345_SPI.h"
-#include "ADXL362.h"
-#include "ADXRS450_Gyro.h"
-#include "AnalogAccelerometer.h"
-#include "AnalogGyro.h"
-#include "AnalogInput.h"
-#include "AnalogOutput.h"
-#include "AnalogPotentiometer.h"
-#include "AnalogTrigger.h"
-#include "AnalogTriggerOutput.h"
-#include "BuiltInAccelerometer.h"
-#include "Buttons/InternalButton.h"
-#include "Buttons/JoystickButton.h"
-#include "Buttons/NetworkButton.h"
-#include "CameraServer.h"
-#include "Commands/Command.h"
-#include "Commands/CommandGroup.h"
-#include "Commands/PIDCommand.h"
-#include "Commands/PIDSubsystem.h"
-#include "Commands/PrintCommand.h"
-#include "Commands/Scheduler.h"
-#include "Commands/StartCommand.h"
-#include "Commands/Subsystem.h"
-#include "Commands/WaitCommand.h"
-#include "Commands/WaitForChildren.h"
-#include "Commands/WaitUntilCommand.h"
-#include "Compressor.h"
-#include "ControllerPower.h"
-#include "Counter.h"
-#include "DigitalInput.h"
-#include "DigitalOutput.h"
-#include "DigitalSource.h"
-#include "DoubleSolenoid.h"
-#include "DriverStation.h"
-#include "Encoder.h"
-#include "ErrorBase.h"
-#include "Filters/LinearDigitalFilter.h"
-#include "GearTooth.h"
-#include "GenericHID.h"
-#include "I2C.h"
-#include "InterruptableSensorBase.h"
-#include "IterativeRobot.h"
-#include "Jaguar.h"
-#include "Joystick.h"
-#include "Notifier.h"
-#include "PIDController.h"
-#include "PIDOutput.h"
-#include "PIDSource.h"
-#include "PWM.h"
-#include "PWMSpeedController.h"
-#include "PowerDistributionPanel.h"
-#include "Preferences.h"
-#include "Relay.h"
-#include "RobotBase.h"
-#include "RobotDrive.h"
-#include "SD540.h"
-#include "SPI.h"
-#include "SampleRobot.h"
-#include "SensorBase.h"
-#include "SerialPort.h"
-#include "Servo.h"
-#include "SmartDashboard/SendableChooser.h"
-#include "SmartDashboard/SmartDashboard.h"
-#include "Solenoid.h"
-#include "Spark.h"
-#include "SpeedController.h"
-#include "Talon.h"
-#include "TalonSRX.h"
-#include "Threads.h"
-#include "Timer.h"
-#include "Ultrasonic.h"
-#include "Utility.h"
-#include "Victor.h"
-#include "VictorSP.h"
-#include "WPIErrors.h"
-#include "XboxController.h"
-#include "interfaces/Accelerometer.h"
-#include "interfaces/Gyro.h"
-#include "interfaces/Potentiometer.h"
-#include "vision/VisionRunner.h"
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/vision/VisionPipeline.h b/third_party/allwpilib_2017/wpilibc/athena/include/vision/VisionPipeline.h
deleted file mode 100644
index bccd50b..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/vision/VisionPipeline.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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
-
-namespace cv {
-class Mat;
-}
-
-namespace frc {
-
-/**
- * A vision pipeline is responsible for running a group of
- * OpenCV algorithms to extract data from an image.
- *
- * @see VisionRunner
- */
-class VisionPipeline {
- public:
- virtual ~VisionPipeline() = default;
-
- /**
- * Processes the image input and sets the result objects.
- * Implementations should make these objects accessible.
- */
- virtual void Process(cv::Mat& mat) = 0;
-};
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/vision/VisionRunner.h b/third_party/allwpilib_2017/wpilibc/athena/include/vision/VisionRunner.h
deleted file mode 100644
index 76c1213..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/vision/VisionRunner.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <functional>
-#include <memory>
-
-#include "ErrorBase.h"
-#include "cscore.h"
-#include "vision/VisionPipeline.h"
-
-namespace frc {
-
-/**
- * Non-template base class for VisionRunner.
- */
-class VisionRunnerBase : public ErrorBase {
- public:
- explicit VisionRunnerBase(cs::VideoSource videoSource);
- ~VisionRunnerBase() override;
-
- VisionRunnerBase(const VisionRunnerBase&) = delete;
- VisionRunnerBase& operator=(const VisionRunnerBase&) = delete;
-
- void RunOnce();
-
- void RunForever();
-
- protected:
- virtual void DoProcess(cv::Mat& image) = 0;
-
- private:
- std::unique_ptr<cv::Mat> m_image;
- cs::CvSink m_cvSink;
-};
-
-/**
- * A vision runner is a convenient wrapper object to make it easy to run vision
- * pipelines from robot code. The easiest way to use this is to run it in a
- * std::thread and use the listener to take snapshots of the pipeline's outputs.
- *
- * @see VisionPipeline
- */
-template <typename T>
-class VisionRunner : public VisionRunnerBase {
- public:
- VisionRunner(cs::VideoSource videoSource, T* pipeline,
- std::function<void(T&)> listener);
- virtual ~VisionRunner() = default;
-
- protected:
- void DoProcess(cv::Mat& image) override;
-
- private:
- T* m_pipeline;
- std::function<void(T&)> m_listener;
-};
-} // namespace frc
-
-#include "VisionRunner.inc"
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/vision/VisionRunner.inc b/third_party/allwpilib_2017/wpilibc/athena/include/vision/VisionRunner.inc
deleted file mode 100644
index 991c898..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/include/vision/VisionRunner.inc
+++ /dev/null
@@ -1,36 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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
-
-namespace frc {
-
-/**
- * Creates a new vision runner. It will take images from the {@code
- * videoSource}, send them to the {@code pipeline}, and call the {@code
- * listener} when the pipeline has finished to alert user code when it is safe
- * to access the pipeline's outputs.
- *
- * @param videoSource the video source to use to supply images for the pipeline
- * @param pipeline the vision pipeline to run
- * @param listener a function to call after the pipeline has finished
- * running
- */
-template <typename T>
-VisionRunner<T>::VisionRunner(cs::VideoSource videoSource, T* pipeline,
- std::function<void(T&)> listener)
- : VisionRunnerBase(videoSource),
- m_pipeline(pipeline),
- m_listener(listener) {}
-
-template <typename T>
-void VisionRunner<T>::DoProcess(cv::Mat& image) {
- m_pipeline->Process(image);
- m_listener(*m_pipeline);
-}
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/ADXL345_I2C.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/ADXL345_I2C.cpp
deleted file mode 100644
index 5179c1c..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/ADXL345_I2C.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "ADXL345_I2C.h"
-
-#include "HAL/HAL.h"
-#include "I2C.h"
-#include "LiveWindow/LiveWindow.h"
-
-using namespace frc;
-
-const int ADXL345_I2C::kAddress;
-const int ADXL345_I2C::kPowerCtlRegister;
-const int ADXL345_I2C::kDataFormatRegister;
-const int ADXL345_I2C::kDataRegister;
-constexpr double ADXL345_I2C::kGsPerLSB;
-
-/**
- * Constructs the ADXL345 Accelerometer over I2C.
- *
- * @param port The I2C port the accelerometer is attached to
- * @param range The range (+ or -) that the accelerometer will measure
- * @param deviceAddress The I2C address of the accelerometer (0x1D or 0x53)
- */
-ADXL345_I2C::ADXL345_I2C(I2C::Port port, Range range, int deviceAddress)
- : m_i2c(port, deviceAddress) {
- // Turn on the measurements
- m_i2c.Write(kPowerCtlRegister, kPowerCtl_Measure);
- // Specify the data format to read
- SetRange(range);
-
- HAL_Report(HALUsageReporting::kResourceType_ADXL345,
- HALUsageReporting::kADXL345_I2C, 0);
- LiveWindow::GetInstance()->AddSensor("ADXL345_I2C", port, this);
-}
-
-void ADXL345_I2C::SetRange(Range range) {
- m_i2c.Write(kDataFormatRegister,
- kDataFormat_FullRes | static_cast<uint8_t>(range));
-}
-
-double ADXL345_I2C::GetX() { return GetAcceleration(kAxis_X); }
-
-double ADXL345_I2C::GetY() { return GetAcceleration(kAxis_Y); }
-
-double ADXL345_I2C::GetZ() { return GetAcceleration(kAxis_Z); }
-
-/**
- * Get the acceleration of one axis in Gs.
- *
- * @param axis The axis to read from.
- * @return Acceleration of the ADXL345 in Gs.
- */
-double ADXL345_I2C::GetAcceleration(ADXL345_I2C::Axes axis) {
- int16_t rawAccel = 0;
- m_i2c.Read(kDataRegister + static_cast<int>(axis), sizeof(rawAccel),
- reinterpret_cast<uint8_t*>(&rawAccel));
- return rawAccel * kGsPerLSB;
-}
-
-/**
- * Get the acceleration of all axes in Gs.
- *
- * @return An object containing the acceleration measured on each axis of the
- * ADXL345 in Gs.
- */
-ADXL345_I2C::AllAxes ADXL345_I2C::GetAccelerations() {
- AllAxes data = AllAxes();
- int16_t rawData[3];
- m_i2c.Read(kDataRegister, sizeof(rawData),
- reinterpret_cast<uint8_t*>(rawData));
-
- data.XAxis = rawData[0] * kGsPerLSB;
- data.YAxis = rawData[1] * kGsPerLSB;
- data.ZAxis = rawData[2] * kGsPerLSB;
- return data;
-}
-
-std::string ADXL345_I2C::GetSmartDashboardType() const {
- return "3AxisAccelerometer";
-}
-
-void ADXL345_I2C::InitTable(std::shared_ptr<ITable> subtable) {
- m_table = subtable;
- UpdateTable();
-}
-
-void ADXL345_I2C::UpdateTable() {
- m_table->PutNumber("X", GetX());
- m_table->PutNumber("Y", GetY());
- m_table->PutNumber("Z", GetZ());
-}
-
-std::shared_ptr<ITable> ADXL345_I2C::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/ADXL345_SPI.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/ADXL345_SPI.cpp
deleted file mode 100644
index 3fefa9f..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/ADXL345_SPI.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "ADXL345_SPI.h"
-
-#include "DigitalInput.h"
-#include "DigitalOutput.h"
-#include "HAL/HAL.h"
-#include "LiveWindow/LiveWindow.h"
-
-using namespace frc;
-
-const int ADXL345_SPI::kPowerCtlRegister;
-const int ADXL345_SPI::kDataFormatRegister;
-const int ADXL345_SPI::kDataRegister;
-constexpr double ADXL345_SPI::kGsPerLSB;
-
-/**
- * Constructor.
- *
- * @param port The SPI port the accelerometer is attached to
- * @param range The range (+ or -) that the accelerometer will measure
- */
-ADXL345_SPI::ADXL345_SPI(SPI::Port port, ADXL345_SPI::Range range)
- : m_spi(port) {
- m_spi.SetClockRate(500000);
- m_spi.SetMSBFirst();
- m_spi.SetSampleDataOnFalling();
- m_spi.SetClockActiveLow();
- m_spi.SetChipSelectActiveHigh();
-
- uint8_t commands[2];
- // Turn on the measurements
- commands[0] = kPowerCtlRegister;
- commands[1] = kPowerCtl_Measure;
- m_spi.Transaction(commands, commands, 2);
-
- SetRange(range);
-
- HAL_Report(HALUsageReporting::kResourceType_ADXL345,
- HALUsageReporting::kADXL345_SPI);
-
- LiveWindow::GetInstance()->AddSensor("ADXL345_SPI", port, this);
-}
-
-void ADXL345_SPI::SetRange(Range range) {
- uint8_t commands[2];
-
- // Specify the data format to read
- commands[0] = kDataFormatRegister;
- commands[1] = kDataFormat_FullRes | static_cast<uint8_t>(range & 0x03);
- m_spi.Transaction(commands, commands, 2);
-}
-
-double ADXL345_SPI::GetX() { return GetAcceleration(kAxis_X); }
-
-double ADXL345_SPI::GetY() { return GetAcceleration(kAxis_Y); }
-
-double ADXL345_SPI::GetZ() { return GetAcceleration(kAxis_Z); }
-
-/**
- * Get the acceleration of one axis in Gs.
- *
- * @param axis The axis to read from.
- * @return Acceleration of the ADXL345 in Gs.
- */
-double ADXL345_SPI::GetAcceleration(ADXL345_SPI::Axes axis) {
- uint8_t buffer[3];
- uint8_t command[3] = {0, 0, 0};
- command[0] = (kAddress_Read | kAddress_MultiByte | kDataRegister) +
- static_cast<uint8_t>(axis);
- m_spi.Transaction(command, buffer, 3);
-
- // Sensor is little endian... swap bytes
- int16_t rawAccel = buffer[2] << 8 | buffer[1];
- return rawAccel * kGsPerLSB;
-}
-
-/**
- * Get the acceleration of all axes in Gs.
- *
- * @return An object containing the acceleration measured on each axis of the
- * ADXL345 in Gs.
- */
-ADXL345_SPI::AllAxes ADXL345_SPI::GetAccelerations() {
- AllAxes data = AllAxes();
- uint8_t dataBuffer[7] = {0, 0, 0, 0, 0, 0, 0};
- int16_t rawData[3];
-
- // Select the data address.
- dataBuffer[0] = (kAddress_Read | kAddress_MultiByte | kDataRegister);
- m_spi.Transaction(dataBuffer, dataBuffer, 7);
-
- for (int i = 0; i < 3; i++) {
- // Sensor is little endian... swap bytes
- rawData[i] = dataBuffer[i * 2 + 2] << 8 | dataBuffer[i * 2 + 1];
- }
-
- data.XAxis = rawData[0] * kGsPerLSB;
- data.YAxis = rawData[1] * kGsPerLSB;
- data.ZAxis = rawData[2] * kGsPerLSB;
-
- return data;
-}
-
-std::string ADXL345_SPI::GetSmartDashboardType() const {
- return "3AxisAccelerometer";
-}
-
-void ADXL345_SPI::InitTable(std::shared_ptr<ITable> subtable) {
- m_table = subtable;
- UpdateTable();
-}
-
-void ADXL345_SPI::UpdateTable() {
- if (m_table != nullptr) {
- m_table->PutNumber("X", GetX());
- m_table->PutNumber("Y", GetY());
- m_table->PutNumber("Z", GetZ());
- }
-}
-
-std::shared_ptr<ITable> ADXL345_SPI::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/ADXL362.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/ADXL362.cpp
deleted file mode 100644
index 4a4d0c8..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/ADXL362.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "ADXL362.h"
-
-#include "DigitalInput.h"
-#include "DigitalOutput.h"
-#include "DriverStation.h"
-#include "HAL/HAL.h"
-#include "LiveWindow/LiveWindow.h"
-
-using namespace frc;
-
-static int kRegWrite = 0x0A;
-static int kRegRead = 0x0B;
-
-static int kPartIdRegister = 0x02;
-static int kDataRegister = 0x0E;
-static int kFilterCtlRegister = 0x2C;
-static int kPowerCtlRegister = 0x2D;
-
-// static int kFilterCtl_Range2G = 0x00;
-// static int kFilterCtl_Range4G = 0x40;
-// static int kFilterCtl_Range8G = 0x80;
-static int kFilterCtl_ODR_100Hz = 0x03;
-
-static int kPowerCtl_UltraLowNoise = 0x20;
-// static int kPowerCtl_AutoSleep = 0x04;
-static int kPowerCtl_Measure = 0x02;
-
-/**
- * Constructor. Uses the onboard CS1.
- *
- * @param range The range (+ or -) that the accelerometer will measure.
- */
-ADXL362::ADXL362(Range range) : ADXL362(SPI::Port::kOnboardCS1, range) {}
-
-/**
- * Constructor.
- *
- * @param port The SPI port the accelerometer is attached to
- * @param range The range (+ or -) that the accelerometer will measure.
- */
-ADXL362::ADXL362(SPI::Port port, Range range) : m_spi(port) {
- m_spi.SetClockRate(3000000);
- m_spi.SetMSBFirst();
- m_spi.SetSampleDataOnFalling();
- m_spi.SetClockActiveLow();
- m_spi.SetChipSelectActiveLow();
-
- // Validate the part ID
- uint8_t commands[3];
- commands[0] = kRegRead;
- commands[1] = kPartIdRegister;
- commands[2] = 0;
- m_spi.Transaction(commands, commands, 3);
- if (commands[2] != 0xF2) {
- DriverStation::ReportError("could not find ADXL362");
- m_gsPerLSB = 0.0;
- return;
- }
-
- SetRange(range);
-
- // Turn on the measurements
- commands[0] = kRegWrite;
- commands[1] = kPowerCtlRegister;
- commands[2] = kPowerCtl_Measure | kPowerCtl_UltraLowNoise;
- m_spi.Write(commands, 3);
-
- HAL_Report(HALUsageReporting::kResourceType_ADXL362, port);
-
- LiveWindow::GetInstance()->AddSensor("ADXL362", port, this);
-}
-
-void ADXL362::SetRange(Range range) {
- if (m_gsPerLSB == 0.0) return;
-
- uint8_t commands[3];
-
- switch (range) {
- case kRange_2G:
- m_gsPerLSB = 0.001;
- break;
- case kRange_4G:
- m_gsPerLSB = 0.002;
- break;
- case kRange_8G:
- case kRange_16G: // 16G not supported; treat as 8G
- m_gsPerLSB = 0.004;
- break;
- }
-
- // Specify the data format to read
- commands[0] = kRegWrite;
- commands[1] = kFilterCtlRegister;
- commands[2] =
- kFilterCtl_ODR_100Hz | static_cast<uint8_t>((range & 0x03) << 6);
- m_spi.Write(commands, 3);
-}
-
-double ADXL362::GetX() { return GetAcceleration(kAxis_X); }
-
-double ADXL362::GetY() { return GetAcceleration(kAxis_Y); }
-
-double ADXL362::GetZ() { return GetAcceleration(kAxis_Z); }
-
-/**
- * Get the acceleration of one axis in Gs.
- *
- * @param axis The axis to read from.
- * @return Acceleration of the ADXL362 in Gs.
- */
-double ADXL362::GetAcceleration(ADXL362::Axes axis) {
- if (m_gsPerLSB == 0.0) return 0.0;
-
- uint8_t buffer[4];
- uint8_t command[4] = {0, 0, 0, 0};
- command[0] = kRegRead;
- command[1] = kDataRegister + static_cast<uint8_t>(axis);
- m_spi.Transaction(command, buffer, 4);
-
- // Sensor is little endian... swap bytes
- int16_t rawAccel = buffer[3] << 8 | buffer[2];
- return rawAccel * m_gsPerLSB;
-}
-
-/**
- * Get the acceleration of all axes in Gs.
- *
- * @return An object containing the acceleration measured on each axis of the
- * ADXL362 in Gs.
- */
-ADXL362::AllAxes ADXL362::GetAccelerations() {
- AllAxes data = AllAxes();
- if (m_gsPerLSB == 0.0) {
- data.XAxis = data.YAxis = data.ZAxis = 0.0;
- return data;
- }
-
- uint8_t dataBuffer[8] = {0, 0, 0, 0, 0, 0, 0, 0};
- int16_t rawData[3];
-
- // Select the data address.
- dataBuffer[0] = kRegRead;
- dataBuffer[1] = kDataRegister;
- m_spi.Transaction(dataBuffer, dataBuffer, 8);
-
- for (int i = 0; i < 3; i++) {
- // Sensor is little endian... swap bytes
- rawData[i] = dataBuffer[i * 2 + 3] << 8 | dataBuffer[i * 2 + 2];
- }
-
- data.XAxis = rawData[0] * m_gsPerLSB;
- data.YAxis = rawData[1] * m_gsPerLSB;
- data.ZAxis = rawData[2] * m_gsPerLSB;
-
- return data;
-}
-
-std::string ADXL362::GetSmartDashboardType() const {
- return "3AxisAccelerometer";
-}
-
-void ADXL362::InitTable(std::shared_ptr<ITable> subtable) {
- m_table = subtable;
- UpdateTable();
-}
-
-void ADXL362::UpdateTable() {
- if (m_table != nullptr) {
- m_table->PutNumber("X", GetX());
- m_table->PutNumber("Y", GetY());
- m_table->PutNumber("Z", GetZ());
- }
-}
-
-std::shared_ptr<ITable> ADXL362::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/ADXRS450_Gyro.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/ADXRS450_Gyro.cpp
deleted file mode 100644
index fb4a62f..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/ADXRS450_Gyro.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "ADXRS450_Gyro.h"
-
-#include "DriverStation.h"
-#include "HAL/HAL.h"
-#include "LiveWindow/LiveWindow.h"
-#include "Timer.h"
-
-using namespace frc;
-
-static constexpr double kSamplePeriod = 0.001;
-static constexpr double kCalibrationSampleTime = 5.0;
-static constexpr double kDegreePerSecondPerLSB = 0.0125;
-
-static constexpr int kRateRegister = 0x00;
-static constexpr int kTemRegister = 0x02;
-static constexpr int kLoCSTRegister = 0x04;
-static constexpr int kHiCSTRegister = 0x06;
-static constexpr int kQuadRegister = 0x08;
-static constexpr int kFaultRegister = 0x0A;
-static constexpr int kPIDRegister = 0x0C;
-static constexpr int kSNHighRegister = 0x0E;
-static constexpr int kSNLowRegister = 0x10;
-
-/**
- * Initialize the gyro.
- *
- * Calibrate the gyro by running for a number of samples and computing the
- * center value. Then use the center value as the Accumulator center value for
- * subsequent measurements.
- *
- * It's important to make sure that the robot is not moving while the centering
- * calculations are in progress, this is typically done when the robot is first
- * turned on while it's sitting at rest before the competition starts.
- */
-void ADXRS450_Gyro::Calibrate() {
- Wait(0.1);
-
- m_spi.SetAccumulatorCenter(0);
- m_spi.ResetAccumulator();
-
- Wait(kCalibrationSampleTime);
-
- m_spi.SetAccumulatorCenter(static_cast<int>(m_spi.GetAccumulatorAverage()));
- m_spi.ResetAccumulator();
-}
-
-/**
- * Gyro constructor on onboard CS0.
- */
-ADXRS450_Gyro::ADXRS450_Gyro() : ADXRS450_Gyro(SPI::kOnboardCS0) {}
-
-/**
- * Gyro constructor on the specified SPI port.
- *
- * @param port The SPI port the gyro is attached to.
- */
-ADXRS450_Gyro::ADXRS450_Gyro(SPI::Port port) : m_spi(port) {
- m_spi.SetClockRate(3000000);
- m_spi.SetMSBFirst();
- m_spi.SetSampleDataOnRising();
- m_spi.SetClockActiveHigh();
- m_spi.SetChipSelectActiveLow();
-
- // Validate the part ID
- if ((ReadRegister(kPIDRegister) & 0xff00) != 0x5200) {
- DriverStation::ReportError("could not find ADXRS450 gyro");
- return;
- }
-
- m_spi.InitAccumulator(kSamplePeriod, 0x20000000u, 4, 0x0c00000eu, 0x04000000u,
- 10u, 16u, true, true);
-
- Calibrate();
-
- HAL_Report(HALUsageReporting::kResourceType_ADXRS450, port);
- LiveWindow::GetInstance()->AddSensor("ADXRS450_Gyro", port, this);
-}
-
-static bool CalcParity(int v) {
- bool parity = false;
- while (v != 0) {
- parity = !parity;
- v = v & (v - 1);
- }
- return parity;
-}
-
-static inline int BytesToIntBE(uint8_t* buf) {
- int result = static_cast<int>(buf[0]) << 24;
- result |= static_cast<int>(buf[1]) << 16;
- result |= static_cast<int>(buf[2]) << 8;
- result |= static_cast<int>(buf[3]);
- return result;
-}
-
-uint16_t ADXRS450_Gyro::ReadRegister(int reg) {
- int cmd = 0x80000000 | static_cast<int>(reg) << 17;
- if (!CalcParity(cmd)) cmd |= 1u;
-
- // big endian
- uint8_t buf[4] = {static_cast<uint8_t>((cmd >> 24) & 0xff),
- static_cast<uint8_t>((cmd >> 16) & 0xff),
- static_cast<uint8_t>((cmd >> 8) & 0xff),
- static_cast<uint8_t>(cmd & 0xff)};
-
- m_spi.Write(buf, 4);
- m_spi.Read(false, buf, 4);
- if ((buf[0] & 0xe0) == 0) return 0; // error, return 0
- return static_cast<uint16_t>((BytesToIntBE(buf) >> 5) & 0xffff);
-}
-
-/**
- * Reset the gyro.
- *
- * Resets the gyro to a heading of zero. This can be used if there is
- * significant drift in the gyro and it needs to be recalibrated after it has
- * been running.
- */
-void ADXRS450_Gyro::Reset() { m_spi.ResetAccumulator(); }
-
-/**
- * Return the actual angle in degrees that the robot is currently facing.
- *
- * The angle is based on the current accumulator value corrected by the
- * oversampling rate, the gyro type and the A/D calibration values.
- * The angle is continuous, that is it will continue from 360->361 degrees. This
- * allows algorithms that wouldn't want to see a discontinuity in the gyro
- * output as it sweeps from 360 to 0 on the second time around.
- *
- * @return the current heading of the robot in degrees. This heading is based on
- * integration of the returned rate from the gyro.
- */
-double ADXRS450_Gyro::GetAngle() const {
- return m_spi.GetAccumulatorValue() * kDegreePerSecondPerLSB * kSamplePeriod;
-}
-
-/**
- * Return the rate of rotation of the gyro
- *
- * The rate is based on the most recent reading of the gyro analog value
- *
- * @return the current rate in degrees per second
- */
-double ADXRS450_Gyro::GetRate() const {
- return static_cast<double>(m_spi.GetAccumulatorLastValue()) *
- kDegreePerSecondPerLSB;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/AnalogAccelerometer.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/AnalogAccelerometer.cpp
deleted file mode 100644
index 6b2e1e9..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/AnalogAccelerometer.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "AnalogAccelerometer.h"
-
-#include "HAL/HAL.h"
-#include "LiveWindow/LiveWindow.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Common function for initializing the accelerometer.
- */
-void AnalogAccelerometer::InitAccelerometer() {
- HAL_Report(HALUsageReporting::kResourceType_Accelerometer,
- m_analogInput->GetChannel());
- LiveWindow::GetInstance()->AddSensor("Accelerometer",
- m_analogInput->GetChannel(), this);
-}
-
-/**
- * Create a new instance of an accelerometer.
- *
- * The constructor allocates desired analog input.
- *
- * @param channel The channel number for the analog input the accelerometer is
- * connected to
- */
-AnalogAccelerometer::AnalogAccelerometer(int channel) {
- m_analogInput = std::make_shared<AnalogInput>(channel);
- InitAccelerometer();
-}
-
-/**
- * Create a new instance of Accelerometer from an existing AnalogInput.
- *
- * Make a new instance of accelerometer given an AnalogInput. This is
- * particularly useful if the port is going to be read as an analog channel as
- * well as through the Accelerometer class.
- *
- * @param channel The existing AnalogInput object for the analog input the
- * accelerometer is connected to
- */
-AnalogAccelerometer::AnalogAccelerometer(AnalogInput* channel)
- : m_analogInput(channel, NullDeleter<AnalogInput>()) {
- if (channel == nullptr) {
- wpi_setWPIError(NullParameter);
- } else {
- InitAccelerometer();
- }
-}
-
-/**
- * Create a new instance of Accelerometer from an existing AnalogInput.
- *
- * Make a new instance of accelerometer given an AnalogInput. This is
- * particularly useful if the port is going to be read as an analog channel as
- * well as through the Accelerometer class.
- *
- * @param channel The existing AnalogInput object for the analog input the
- * accelerometer is connected to
- */
-AnalogAccelerometer::AnalogAccelerometer(std::shared_ptr<AnalogInput> channel)
- : m_analogInput(channel) {
- if (channel == nullptr) {
- wpi_setWPIError(NullParameter);
- } else {
- InitAccelerometer();
- }
-}
-
-/**
- * Return the acceleration in Gs.
- *
- * The acceleration is returned units of Gs.
- *
- * @return The current acceleration of the sensor in Gs.
- */
-double AnalogAccelerometer::GetAcceleration() const {
- return (m_analogInput->GetAverageVoltage() - m_zeroGVoltage) / m_voltsPerG;
-}
-
-/**
- * Set the accelerometer sensitivity.
- *
- * This sets the sensitivity of the accelerometer used for calculating the
- * acceleration. The sensitivity varies by accelerometer model. There are
- * constants defined for various models.
- *
- * @param sensitivity The sensitivity of accelerometer in Volts per G.
- */
-void AnalogAccelerometer::SetSensitivity(double sensitivity) {
- m_voltsPerG = sensitivity;
-}
-
-/**
- * Set the voltage that corresponds to 0 G.
- *
- * The zero G voltage varies by accelerometer model. There are constants defined
- * for various models.
- *
- * @param zero The zero G voltage.
- */
-void AnalogAccelerometer::SetZero(double zero) { m_zeroGVoltage = zero; }
-
-/**
- * Get the Acceleration for the PID Source parent.
- *
- * @return The current acceleration in Gs.
- */
-double AnalogAccelerometer::PIDGet() { return GetAcceleration(); }
-
-void AnalogAccelerometer::UpdateTable() {
- if (m_table != nullptr) {
- m_table->PutNumber("Value", GetAcceleration());
- }
-}
-
-void AnalogAccelerometer::StartLiveWindowMode() {}
-
-void AnalogAccelerometer::StopLiveWindowMode() {}
-
-std::string AnalogAccelerometer::GetSmartDashboardType() const {
- return "Accelerometer";
-}
-
-void AnalogAccelerometer::InitTable(std::shared_ptr<ITable> subTable) {
- m_table = subTable;
- UpdateTable();
-}
-
-std::shared_ptr<ITable> AnalogAccelerometer::GetTable() const {
- return m_table;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/AnalogGyro.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/AnalogGyro.cpp
deleted file mode 100644
index d3e2cc6..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/AnalogGyro.cpp
+++ /dev/null
@@ -1,284 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "AnalogGyro.h"
-#include "HAL/AnalogGyro.h"
-
-#include <climits>
-
-#include "AnalogInput.h"
-#include "HAL/Errors.h"
-#include "HAL/HAL.h"
-#include "LiveWindow/LiveWindow.h"
-#include "Timer.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-const int AnalogGyro::kOversampleBits;
-const int AnalogGyro::kAverageBits;
-constexpr double AnalogGyro::kSamplesPerSecond;
-constexpr double AnalogGyro::kCalibrationSampleTime;
-constexpr double AnalogGyro::kDefaultVoltsPerDegreePerSecond;
-
-/**
- * Gyro constructor using the Analog Input channel number.
- *
- * @param channel The analog channel the gyro is connected to. Gyros can only
- * be used on on-board Analog Inputs 0-1.
- */
-AnalogGyro::AnalogGyro(int channel)
- : AnalogGyro(std::make_shared<AnalogInput>(channel)) {}
-
-/**
- * Gyro constructor with a precreated AnalogInput object.
- *
- * Use this constructor when the analog channel needs to be shared.
- * This object will not clean up the AnalogInput object when using this
- * constructor.
- *
- * Gyros can only be used on on-board channels 0-1.
- *
- * @param channel A pointer to the AnalogInput object that the gyro is
- * connected to.
- */
-AnalogGyro::AnalogGyro(AnalogInput* channel)
- : AnalogGyro(
- std::shared_ptr<AnalogInput>(channel, NullDeleter<AnalogInput>())) {}
-
-/**
- * Gyro constructor with a precreated AnalogInput object.
- *
- * Use this constructor when the analog channel needs to be shared.
- * This object will not clean up the AnalogInput object when using this
- * constructor.
- *
- * @param channel A pointer to the AnalogInput object that the gyro is
- * connected to.
- */
-AnalogGyro::AnalogGyro(std::shared_ptr<AnalogInput> channel)
- : m_analog(channel) {
- if (channel == nullptr) {
- wpi_setWPIError(NullParameter);
- } else {
- InitGyro();
- Calibrate();
- }
-}
-
-/**
- * Gyro constructor using the Analog Input channel number with parameters for
- * presetting the center and offset values. Bypasses calibration.
- *
- * @param channel The analog channel the gyro is connected to. Gyros can only
- * be used on on-board Analog Inputs 0-1.
- * @param center Preset uncalibrated value to use as the accumulator center
- * value.
- * @param offset Preset uncalibrated value to use as the gyro offset.
- */
-AnalogGyro::AnalogGyro(int channel, int center, double offset) {
- m_analog = std::make_shared<AnalogInput>(channel);
- InitGyro();
- int32_t status = 0;
- HAL_SetAnalogGyroParameters(m_gyroHandle, kDefaultVoltsPerDegreePerSecond,
- offset, center, &status);
- if (status != 0) {
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- m_gyroHandle = HAL_kInvalidHandle;
- return;
- }
- Reset();
-}
-
-/**
- * Gyro constructor with a precreated AnalogInput object and calibrated
- * parameters.
- *
- * Use this constructor when the analog channel needs to be shared.
- * This object will not clean up the AnalogInput object when using this
- * constructor.
- *
- * @param channel A pointer to the AnalogInput object that the gyro is
- * connected to.
- */
-AnalogGyro::AnalogGyro(std::shared_ptr<AnalogInput> channel, int center,
- double offset)
- : m_analog(channel) {
- if (channel == nullptr) {
- wpi_setWPIError(NullParameter);
- } else {
- InitGyro();
- int32_t status = 0;
- HAL_SetAnalogGyroParameters(m_gyroHandle, kDefaultVoltsPerDegreePerSecond,
- offset, center, &status);
- if (status != 0) {
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- m_gyroHandle = HAL_kInvalidHandle;
- return;
- }
- Reset();
- }
-}
-
-/**
- * AnalogGyro Destructor
- *
- */
-AnalogGyro::~AnalogGyro() { HAL_FreeAnalogGyro(m_gyroHandle); }
-
-/**
- * Reset the gyro.
- *
- * Resets the gyro to a heading of zero. This can be used if there is
- * significant drift in the gyro and it needs to be recalibrated after it has
- * been running.
- */
-void AnalogGyro::Reset() {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_ResetAnalogGyro(m_gyroHandle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Initialize the gyro. Calibration is handled by Calibrate().
- */
-void AnalogGyro::InitGyro() {
- if (StatusIsFatal()) return;
- if (m_gyroHandle == HAL_kInvalidHandle) {
- int32_t status = 0;
- m_gyroHandle = HAL_InitializeAnalogGyro(m_analog->m_port, &status);
- if (status == PARAMETER_OUT_OF_RANGE) {
- wpi_setWPIErrorWithContext(ParameterOutOfRange,
- " channel (must be accumulator channel)");
- m_analog = nullptr;
- m_gyroHandle = HAL_kInvalidHandle;
- return;
- }
- if (status != 0) {
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- m_analog = nullptr;
- m_gyroHandle = HAL_kInvalidHandle;
- return;
- }
- }
-
- int32_t status = 0;
- HAL_SetupAnalogGyro(m_gyroHandle, &status);
- if (status != 0) {
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- m_analog = nullptr;
- m_gyroHandle = HAL_kInvalidHandle;
- return;
- }
-
- HAL_Report(HALUsageReporting::kResourceType_Gyro, m_analog->GetChannel());
- LiveWindow::GetInstance()->AddSensor("AnalogGyro", m_analog->GetChannel(),
- this);
-}
-
-void AnalogGyro::Calibrate() {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_CalibrateAnalogGyro(m_gyroHandle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Return the actual angle in degrees that the robot is currently facing.
- *
- * The angle is based on the current accumulator value corrected by the
- * oversampling rate, the gyro type and the A/D calibration values.
- * The angle is continuous, that is it will continue from 360->361 degrees. This
- * allows algorithms that wouldn't want to see a discontinuity in the gyro
- * output as it sweeps from 360 to 0 on the second time around.
- *
- * @return the current heading of the robot in degrees. This heading is based on
- * integration of the returned rate from the gyro.
- */
-double AnalogGyro::GetAngle() const {
- if (StatusIsFatal()) return 0.0;
- int32_t status = 0;
- double value = HAL_GetAnalogGyroAngle(m_gyroHandle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Return the rate of rotation of the gyro
- *
- * The rate is based on the most recent reading of the gyro analog value
- *
- * @return the current rate in degrees per second
- */
-double AnalogGyro::GetRate() const {
- if (StatusIsFatal()) return 0.0;
- int32_t status = 0;
- double value = HAL_GetAnalogGyroRate(m_gyroHandle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Return the gyro offset value. If run after calibration,
- * the offset value can be used as a preset later.
- *
- * @return the current offset value
- */
-double AnalogGyro::GetOffset() const {
- if (StatusIsFatal()) return 0.0;
- int32_t status = 0;
- double value = HAL_GetAnalogGyroOffset(m_gyroHandle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Return the gyro center value. If run after calibration,
- * the center value can be used as a preset later.
- *
- * @return the current center value
- */
-int AnalogGyro::GetCenter() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
- int value = HAL_GetAnalogGyroCenter(m_gyroHandle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Set the gyro sensitivity.
- *
- * This takes the number of volts/degree/second sensitivity of the gyro and uses
- * it in subsequent calculations to allow the code to work with multiple gyros.
- * This value is typically found in the gyro datasheet.
- *
- * @param voltsPerDegreePerSecond The sensitivity in Volts/degree/second
- */
-void AnalogGyro::SetSensitivity(double voltsPerDegreePerSecond) {
- int32_t status = 0;
- HAL_SetAnalogGyroVoltsPerDegreePerSecond(m_gyroHandle,
- voltsPerDegreePerSecond, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set the size of the neutral zone.
- *
- * Any voltage from the gyro less than this amount from the center is
- * considered stationary. Setting a deadband will decrease the amount of drift
- * when the gyro isn't rotating, but will make it less accurate.
- *
- * @param volts The size of the deadband in volts
- */
-void AnalogGyro::SetDeadband(double volts) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetAnalogGyroDeadband(m_gyroHandle, volts, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/AnalogInput.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/AnalogInput.cpp
deleted file mode 100644
index 479c96d..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/AnalogInput.cpp
+++ /dev/null
@@ -1,405 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "AnalogInput.h"
-#include "HAL/AnalogInput.h"
-
-#include <sstream>
-
-#include "HAL/AnalogAccumulator.h"
-#include "HAL/HAL.h"
-#include "HAL/Ports.h"
-#include "Timer.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-const int AnalogInput::kAccumulatorModuleNumber;
-const int AnalogInput::kAccumulatorNumChannels;
-const int AnalogInput::kAccumulatorChannels[] = {0, 1};
-
-/**
- * Construct an analog input.
- *
- * @param channel The channel number on the roboRIO to represent. 0-3 are
- * on-board 4-7 are on the MXP port.
- */
-AnalogInput::AnalogInput(int channel) {
- std::stringstream buf;
- buf << "Analog Input " << channel;
-
- if (!SensorBase::CheckAnalogInputChannel(channel)) {
- wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
- return;
- }
-
- m_channel = channel;
-
- HAL_PortHandle port = HAL_GetPort(channel);
- int32_t status = 0;
- m_port = HAL_InitializeAnalogInputPort(port, &status);
- if (status != 0) {
- wpi_setErrorWithContextRange(status, 0, HAL_GetNumAnalogInputs(), channel,
- HAL_GetErrorMessage(status));
- m_channel = std::numeric_limits<int>::max();
- m_port = HAL_kInvalidHandle;
- return;
- }
-
- HAL_Report(HALUsageReporting::kResourceType_AnalogChannel, channel);
-}
-
-/**
- * Channel destructor.
- */
-AnalogInput::~AnalogInput() {
- HAL_FreeAnalogInputPort(m_port);
- m_port = HAL_kInvalidHandle;
-}
-
-/**
- * Get a sample straight from this channel.
- *
- * The sample is a 12-bit value representing the 0V to 5V range of the A/D
- * converter in the module. The units are in A/D converter codes. Use
- * GetVoltage() to get the analog value in calibrated units.
- *
- * @return A sample straight from this channel.
- */
-int AnalogInput::GetValue() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
- int value = HAL_GetAnalogValue(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Get a sample from the output of the oversample and average engine for this
- * channel.
- *
- * The sample is 12-bit + the bits configured in SetOversampleBits().
- * The value configured in SetAverageBits() will cause this value to be averaged
- * 2**bits number of samples.
- * This is not a sliding window. The sample will not change until
- * 2**(OversampleBits + AverageBits) samples
- * have been acquired from the module on this channel.
- * Use GetAverageVoltage() to get the analog value in calibrated units.
- *
- * @return A sample from the oversample and average engine for this channel.
- */
-int AnalogInput::GetAverageValue() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
- int value = HAL_GetAnalogAverageValue(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Get a scaled sample straight from this channel.
- *
- * The value is scaled to units of Volts using the calibrated scaling data from
- * GetLSBWeight() and GetOffset().
- *
- * @return A scaled sample straight from this channel.
- */
-double AnalogInput::GetVoltage() const {
- if (StatusIsFatal()) return 0.0;
- int32_t status = 0;
- double voltage = HAL_GetAnalogVoltage(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return voltage;
-}
-
-/**
- * Get a scaled sample from the output of the oversample and average engine for
- * this channel.
- *
- * The value is scaled to units of Volts using the calibrated scaling data from
- * GetLSBWeight() and GetOffset().
- * Using oversampling will cause this value to be higher resolution, but it will
- * update more slowly.
- * Using averaging will cause this value to be more stable, but it will update
- * more slowly.
- *
- * @return A scaled sample from the output of the oversample and average engine
- * for this channel.
- */
-double AnalogInput::GetAverageVoltage() const {
- if (StatusIsFatal()) return 0.0;
- int32_t status = 0;
- double voltage = HAL_GetAnalogAverageVoltage(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return voltage;
-}
-
-/**
- * Get the factory scaling least significant bit weight constant.
- *
- * Volts = ((LSB_Weight * 1e-9) * raw) - (Offset * 1e-9)
- *
- * @return Least significant bit weight.
- */
-int AnalogInput::GetLSBWeight() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
- int lsbWeight = HAL_GetAnalogLSBWeight(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return lsbWeight;
-}
-
-/**
- * Get the factory scaling offset constant.
- *
- * Volts = ((LSB_Weight * 1e-9) * raw) - (Offset * 1e-9)
- *
- * @return Offset constant.
- */
-int AnalogInput::GetOffset() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
- int offset = HAL_GetAnalogOffset(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return offset;
-}
-
-/**
- * Get the channel number.
- *
- * @return The channel number.
- */
-int AnalogInput::GetChannel() const {
- if (StatusIsFatal()) return 0;
- return m_channel;
-}
-
-/**
- * Set the number of averaging bits.
- *
- * This sets the number of averaging bits. The actual number of averaged samples
- * is 2^bits.
- * Use averaging to improve the stability of your measurement at the expense of
- * sampling rate.
- * The averaging is done automatically in the FPGA.
- *
- * @param bits Number of bits of averaging.
- */
-void AnalogInput::SetAverageBits(int bits) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetAnalogAverageBits(m_port, bits, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Get the number of averaging bits previously configured.
- *
- * This gets the number of averaging bits from the FPGA. The actual number of
- * averaged samples is 2^bits. The averaging is done automatically in the FPGA.
- *
- * @return Number of bits of averaging previously configured.
- */
-int AnalogInput::GetAverageBits() const {
- int32_t status = 0;
- int averageBits = HAL_GetAnalogAverageBits(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return averageBits;
-}
-
-/**
- * Set the number of oversample bits.
- *
- * This sets the number of oversample bits. The actual number of oversampled
- * values is 2^bits. Use oversampling to improve the resolution of your
- * measurements at the expense of sampling rate. The oversampling is done
- * automatically in the FPGA.
- *
- * @param bits Number of bits of oversampling.
- */
-void AnalogInput::SetOversampleBits(int bits) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetAnalogOversampleBits(m_port, bits, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Get the number of oversample bits previously configured.
- *
- * This gets the number of oversample bits from the FPGA. The actual number of
- * oversampled values is 2^bits. The oversampling is done automatically in the
- * FPGA.
- *
- * @return Number of bits of oversampling previously configured.
- */
-int AnalogInput::GetOversampleBits() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
- int oversampleBits = HAL_GetAnalogOversampleBits(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return oversampleBits;
-}
-
-/**
- * Is the channel attached to an accumulator.
- *
- * @return The analog input is attached to an accumulator.
- */
-bool AnalogInput::IsAccumulatorChannel() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool isAccum = HAL_IsAccumulatorChannel(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return isAccum;
-}
-
-/**
- * Initialize the accumulator.
- */
-void AnalogInput::InitAccumulator() {
- if (StatusIsFatal()) return;
- m_accumulatorOffset = 0;
- int32_t status = 0;
- HAL_InitAccumulator(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set an initial value for the accumulator.
- *
- * This will be added to all values returned to the user.
- *
- * @param initialValue The value that the accumulator should start from when
- * reset.
- */
-void AnalogInput::SetAccumulatorInitialValue(int64_t initialValue) {
- if (StatusIsFatal()) return;
- m_accumulatorOffset = initialValue;
-}
-
-/**
- * Resets the accumulator to the initial value.
- */
-void AnalogInput::ResetAccumulator() {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_ResetAccumulator(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- if (!StatusIsFatal()) {
- // Wait until the next sample, so the next call to GetAccumulator*()
- // won't have old values.
- const double sampleTime = 1.0 / GetSampleRate();
- const double overSamples = 1 << GetOversampleBits();
- const double averageSamples = 1 << GetAverageBits();
- Wait(sampleTime * overSamples * averageSamples);
- }
-}
-
-/**
- * Set the center value of the accumulator.
- *
- * The center value is subtracted from each A/D value before it is added to the
- * accumulator. This is used for the center value of devices like gyros and
- * accelerometers to take the device offset into account when integrating.
- *
- * This center value is based on the output of the oversampled and averaged
- * source from the accumulator channel. Because of this, any non-zero
- * oversample bits will affect the size of the value for this field.
- */
-void AnalogInput::SetAccumulatorCenter(int center) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetAccumulatorCenter(m_port, center, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set the accumulator's deadband.
- */
-void AnalogInput::SetAccumulatorDeadband(int deadband) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetAccumulatorDeadband(m_port, deadband, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Read the accumulated value.
- *
- * Read the value that has been accumulating.
- * The accumulator is attached after the oversample and average engine.
- *
- * @return The 64-bit value accumulated since the last Reset().
- */
-int64_t AnalogInput::GetAccumulatorValue() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
- int64_t value = HAL_GetAccumulatorValue(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value + m_accumulatorOffset;
-}
-
-/**
- * Read the number of accumulated values.
- *
- * Read the count of the accumulated values since the accumulator was last
- * Reset().
- *
- * @return The number of times samples from the channel were accumulated.
- */
-int64_t AnalogInput::GetAccumulatorCount() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
- int64_t count = HAL_GetAccumulatorCount(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return count;
-}
-
-/**
- * Read the accumulated value and the number of accumulated values atomically.
- *
- * This function reads the value and count from the FPGA atomically.
- * This can be used for averaging.
- *
- * @param value Reference to the 64-bit accumulated output.
- * @param count Reference to the number of accumulation cycles.
- */
-void AnalogInput::GetAccumulatorOutput(int64_t& value, int64_t& count) const {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_GetAccumulatorOutput(m_port, &value, &count, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- value += m_accumulatorOffset;
-}
-
-/**
- * Set the sample rate per channel for all analog channels.
- *
- * The maximum rate is 500kS/s divided by the number of channels in use.
- * This is 62500 samples/s per channel.
- *
- * @param samplesPerSecond The number of samples per second.
- */
-void AnalogInput::SetSampleRate(double samplesPerSecond) {
- int32_t status = 0;
- HAL_SetAnalogSampleRate(samplesPerSecond, &status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Get the current sample rate for all channels
- *
- * @return Sample rate.
- */
-double AnalogInput::GetSampleRate() {
- int32_t status = 0;
- double sampleRate = HAL_GetAnalogSampleRate(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return sampleRate;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/AnalogOutput.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/AnalogOutput.cpp
deleted file mode 100644
index e4a65fb..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/AnalogOutput.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "AnalogOutput.h"
-
-#include <limits>
-#include <sstream>
-
-#include "HAL/HAL.h"
-#include "HAL/Ports.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Construct an analog output on the given channel.
- *
- * All analog outputs are located on the MXP port.
- *
- * @param channel The channel number on the roboRIO to represent.
- */
-AnalogOutput::AnalogOutput(int channel) {
- std::stringstream buf;
- buf << "analog input " << channel;
-
- if (!SensorBase::CheckAnalogOutputChannel(channel)) {
- wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
- m_channel = std::numeric_limits<int>::max();
- m_port = HAL_kInvalidHandle;
- return;
- }
-
- m_channel = channel;
-
- HAL_PortHandle port = HAL_GetPort(m_channel);
- int32_t status = 0;
- m_port = HAL_InitializeAnalogOutputPort(port, &status);
- if (status != 0) {
- wpi_setErrorWithContextRange(status, 0, HAL_GetNumAnalogOutputs(), channel,
- HAL_GetErrorMessage(status));
- m_channel = std::numeric_limits<int>::max();
- m_port = HAL_kInvalidHandle;
- return;
- }
-
- HAL_Report(HALUsageReporting::kResourceType_AnalogOutput, m_channel);
-}
-
-/**
- * Destructor.
- *
- * Frees analog output resource.
- */
-AnalogOutput::~AnalogOutput() { HAL_FreeAnalogOutputPort(m_port); }
-
-/**
- * Get the channel of this AnalogOutput.
- */
-int AnalogOutput::GetChannel() { return m_channel; }
-
-/**
- * Set the value of the analog output.
- *
- * @param voltage The output value in Volts, from 0.0 to +5.0
- */
-void AnalogOutput::SetVoltage(double voltage) {
- int32_t status = 0;
- HAL_SetAnalogOutput(m_port, voltage, &status);
-
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Get the voltage of the analog output
- *
- * @return The value in Volts, from 0.0 to +5.0
- */
-double AnalogOutput::GetVoltage() const {
- int32_t status = 0;
- double voltage = HAL_GetAnalogOutput(m_port, &status);
-
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- return voltage;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/AnalogPotentiometer.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/AnalogPotentiometer.cpp
deleted file mode 100644
index 7afc247..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/AnalogPotentiometer.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "AnalogPotentiometer.h"
-
-#include "ControllerPower.h"
-
-using namespace frc;
-
-/**
- * Construct an Analog Potentiometer object from a channel number.
- *
- * @param channel The channel number on the roboRIO to represent. 0-3 are
- * on-board 4-7 are on the MXP port.
- * @param fullRange The angular value (in desired units) representing the full
- * 0-5V range of the input.
- * @param offset The angular value (in desired units) representing the
- * angular output at 0V.
- */
-AnalogPotentiometer::AnalogPotentiometer(int channel, double fullRange,
- double offset)
- : m_analog_input(std::make_unique<AnalogInput>(channel)),
- m_fullRange(fullRange),
- m_offset(offset) {}
-
-/**
- * Construct an Analog Potentiometer object from an existing Analog Input
- * pointer.
- *
- * @param channel The existing Analog Input pointer
- * @param fullRange The angular value (in desired units) representing the full
- * 0-5V range of the input.
- * @param offset The angular value (in desired units) representing the
- * angular output at 0V.
- */
-AnalogPotentiometer::AnalogPotentiometer(AnalogInput* input, double fullRange,
- double offset)
- : m_analog_input(input, NullDeleter<AnalogInput>()),
- m_fullRange(fullRange),
- m_offset(offset) {}
-
-/**
- * Construct an Analog Potentiometer object from an existing Analog Input
- * pointer.
- *
- * @param channel The existing Analog Input pointer
- * @param fullRange The angular value (in desired units) representing the full
- * 0-5V range of the input.
- * @param offset The angular value (in desired units) representing the
- * angular output at 0V.
- */
-AnalogPotentiometer::AnalogPotentiometer(std::shared_ptr<AnalogInput> input,
- double fullRange, double offset)
- : m_analog_input(input), m_fullRange(fullRange), m_offset(offset) {}
-
-/**
- * Get the current reading of the potentiometer.
- *
- * @return The current position of the potentiometer (in the units used for
- * fullRange and offset).
- */
-double AnalogPotentiometer::Get() const {
- return (m_analog_input->GetVoltage() / ControllerPower::GetVoltage5V()) *
- m_fullRange +
- m_offset;
-}
-
-/**
- * Implement the PIDSource interface.
- *
- * @return The current reading.
- */
-double AnalogPotentiometer::PIDGet() { return Get(); }
-
-/**
- * @return the Smart Dashboard Type
- */
-std::string AnalogPotentiometer::GetSmartDashboardType() const {
- return "Analog Input";
-}
-
-/**
- * Live Window code, only does anything if live window is activated.
- */
-void AnalogPotentiometer::InitTable(std::shared_ptr<ITable> subtable) {
- m_table = subtable;
- UpdateTable();
-}
-
-void AnalogPotentiometer::UpdateTable() {
- if (m_table != nullptr) {
- m_table->PutNumber("Value", Get());
- }
-}
-
-std::shared_ptr<ITable> AnalogPotentiometer::GetTable() const {
- return m_table;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/AnalogTrigger.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/AnalogTrigger.cpp
deleted file mode 100644
index 220c897..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/AnalogTrigger.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "AnalogTrigger.h"
-
-#include <memory>
-
-#include "AnalogInput.h"
-#include "HAL/HAL.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Constructor for an analog trigger given a channel number.
- *
- * @param channel The channel number on the roboRIO to represent. 0-3 are
- * on-board 4-7 are on the MXP port.
- */
-AnalogTrigger::AnalogTrigger(int channel)
- : AnalogTrigger(new AnalogInput(channel)) {
- m_ownsAnalog = true;
-}
-
-/**
- * Construct an analog trigger given an analog input.
- *
- * This should be used in the case of sharing an analog channel between the
- * trigger and an analog input object.
- *
- * @param channel The pointer to the existing AnalogInput object
- */
-AnalogTrigger::AnalogTrigger(AnalogInput* input) {
- m_analogInput = input;
- int32_t status = 0;
- int index = 0;
- m_trigger = HAL_InitializeAnalogTrigger(input->m_port, &index, &status);
- if (status != 0) {
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- m_index = std::numeric_limits<int>::max();
- m_trigger = HAL_kInvalidHandle;
- return;
- }
- m_index = index;
-
- HAL_Report(HALUsageReporting::kResourceType_AnalogTrigger, input->m_channel);
-}
-
-AnalogTrigger::~AnalogTrigger() {
- int32_t status = 0;
- HAL_CleanAnalogTrigger(m_trigger, &status);
-
- if (m_ownsAnalog && m_analogInput != nullptr) {
- delete m_analogInput;
- }
-}
-
-/**
- * Set the upper and lower limits of the analog trigger.
- *
- * The limits are given in ADC codes. If oversampling is used, the units must
- * be scaled appropriately.
- *
- * @param lower The lower limit of the trigger in ADC codes (12-bit values).
- * @param upper The upper limit of the trigger in ADC codes (12-bit values).
- */
-void AnalogTrigger::SetLimitsRaw(int lower, int upper) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetAnalogTriggerLimitsRaw(m_trigger, lower, upper, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set the upper and lower limits of the analog trigger.
- *
- * The limits are given as floating point voltage values.
- *
- * @param lower The lower limit of the trigger in Volts.
- * @param upper The upper limit of the trigger in Volts.
- */
-void AnalogTrigger::SetLimitsVoltage(double lower, double upper) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetAnalogTriggerLimitsVoltage(m_trigger, lower, upper, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Configure the analog trigger to use the averaged vs. raw values.
- *
- * If the value is true, then the averaged value is selected for the analog
- * trigger, otherwise the immediate value is used.
- *
- * @param useAveragedValue If true, use the Averaged value, otherwise use the
- * instantaneous reading
- */
-void AnalogTrigger::SetAveraged(bool useAveragedValue) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetAnalogTriggerAveraged(m_trigger, useAveragedValue, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Configure the analog trigger to use a filtered value.
- *
- * The analog trigger will operate with a 3 point average rejection filter. This
- * is designed to help with 360 degree pot applications for the period where
- * the pot crosses through zero.
- *
- * @param useFilteredValue If true, use the 3 point rejection filter, otherwise
- * use the unfiltered value
- */
-void AnalogTrigger::SetFiltered(bool useFilteredValue) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetAnalogTriggerFiltered(m_trigger, useFilteredValue, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Return the index of the analog trigger.
- *
- * This is the FPGA index of this analog trigger instance.
- *
- * @return The index of the analog trigger.
- */
-int AnalogTrigger::GetIndex() const {
- if (StatusIsFatal()) return -1;
- return m_index;
-}
-
-/**
- * Return the InWindow output of the analog trigger.
- *
- * True if the analog input is between the upper and lower limits.
- *
- * @return True if the analog input is between the upper and lower limits.
- */
-bool AnalogTrigger::GetInWindow() {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool result = HAL_GetAnalogTriggerInWindow(m_trigger, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return result;
-}
-
-/**
- * Return the TriggerState output of the analog trigger.
- *
- * True if above upper limit.
- * False if below lower limit.
- * If in Hysteresis, maintain previous state.
- *
- * @return True if above upper limit. False if below lower limit. If in
- * Hysteresis, maintain previous state.
- */
-bool AnalogTrigger::GetTriggerState() {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool result = HAL_GetAnalogTriggerTriggerState(m_trigger, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return result;
-}
-
-/**
- * Creates an AnalogTriggerOutput object.
- *
- * Gets an output object that can be used for routing.
- * Caller is responsible for deleting the AnalogTriggerOutput object.
- *
- * @param type An enum of the type of output object to create.
- * @return A pointer to a new AnalogTriggerOutput object.
- */
-std::shared_ptr<AnalogTriggerOutput> AnalogTrigger::CreateOutput(
- AnalogTriggerType type) const {
- if (StatusIsFatal()) return nullptr;
- return std::shared_ptr<AnalogTriggerOutput>(
- new AnalogTriggerOutput(*this, type), NullDeleter<AnalogTriggerOutput>());
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/AnalogTriggerOutput.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/AnalogTriggerOutput.cpp
deleted file mode 100644
index e43f5ba..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/AnalogTriggerOutput.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "AnalogTriggerOutput.h"
-
-#include "AnalogTrigger.h"
-#include "HAL/HAL.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Create an object that represents one of the four outputs from an analog
- * trigger.
- *
- * Because this class derives from DigitalSource, it can be passed into routing
- * functions for Counter, Encoder, etc.
- *
- * @param trigger A pointer to the trigger for which this is an output.
- * @param outputType An enum that specifies the output on the trigger to
- * represent.
- */
-AnalogTriggerOutput::AnalogTriggerOutput(const AnalogTrigger& trigger,
- AnalogTriggerType outputType)
- : m_trigger(trigger), m_outputType(outputType) {
- HAL_Report(HALUsageReporting::kResourceType_AnalogTriggerOutput,
- trigger.GetIndex(), static_cast<uint8_t>(outputType));
-}
-
-AnalogTriggerOutput::~AnalogTriggerOutput() {
- if (m_interrupt != HAL_kInvalidHandle) {
- int32_t status = 0;
- HAL_CleanInterrupts(m_interrupt, &status);
- // ignore status, as an invalid handle just needs to be ignored.
- m_interrupt = HAL_kInvalidHandle;
- }
-}
-
-/**
- * Get the state of the analog trigger output.
- *
- * @return The state of the analog trigger output.
- */
-bool AnalogTriggerOutput::Get() const {
- int32_t status = 0;
- bool result = HAL_GetAnalogTriggerOutput(
- m_trigger.m_trigger, static_cast<HAL_AnalogTriggerType>(m_outputType),
- &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return result;
-}
-
-/**
- * @return The HAL Handle to the specified source.
- */
-HAL_Handle AnalogTriggerOutput::GetPortHandleForRouting() const {
- return m_trigger.m_trigger;
-}
-
-/**
- * Is source an AnalogTrigger
- */
-bool AnalogTriggerOutput::IsAnalogTrigger() const { return true; }
-
-/**
- * @return The type of analog trigger output to be used.
- */
-AnalogTriggerType AnalogTriggerOutput::GetAnalogTriggerTypeForRouting() const {
- return m_outputType;
-}
-
-/**
- * @return The channel of the source.
- */
-int AnalogTriggerOutput::GetChannel() const { return m_trigger.m_index; }
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/BuiltInAccelerometer.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/BuiltInAccelerometer.cpp
deleted file mode 100644
index 5249b17..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/BuiltInAccelerometer.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "BuiltInAccelerometer.h"
-
-#include "HAL/Accelerometer.h"
-#include "HAL/HAL.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Constructor.
- *
- * @param range The range the accelerometer will measure
- */
-BuiltInAccelerometer::BuiltInAccelerometer(Range range) {
- SetRange(range);
-
- HAL_Report(HALUsageReporting::kResourceType_Accelerometer, 0, 0,
- "Built-in accelerometer");
-}
-
-void BuiltInAccelerometer::SetRange(Range range) {
- HAL_SetAccelerometerActive(false);
- HAL_SetAccelerometerRange((HAL_AccelerometerRange)range);
- HAL_SetAccelerometerActive(true);
-}
-
-/**
- * @return The acceleration of the roboRIO along the X axis in g-forces
- */
-double BuiltInAccelerometer::GetX() { return HAL_GetAccelerometerX(); }
-
-/**
- * @return The acceleration of the roboRIO along the Y axis in g-forces
- */
-double BuiltInAccelerometer::GetY() { return HAL_GetAccelerometerY(); }
-
-/**
- * @return The acceleration of the roboRIO along the Z axis in g-forces
- */
-double BuiltInAccelerometer::GetZ() { return HAL_GetAccelerometerZ(); }
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/CameraServer.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/CameraServer.cpp
deleted file mode 100644
index 8492133..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/CameraServer.cpp
+++ /dev/null
@@ -1,712 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "CameraServer.h"
-
-#include "Utility.h"
-#include "WPIErrors.h"
-#include "llvm/SmallString.h"
-#include "llvm/raw_ostream.h"
-#include "ntcore_cpp.h"
-
-using namespace frc;
-
-CameraServer* CameraServer::GetInstance() {
- static CameraServer instance;
- return &instance;
-}
-
-static llvm::StringRef MakeSourceValue(CS_Source source,
- llvm::SmallVectorImpl<char>& buf) {
- CS_Status status = 0;
- buf.clear();
- switch (cs::GetSourceKind(source, &status)) {
- case cs::VideoSource::kUsb: {
- llvm::StringRef prefix{"usb:"};
- buf.append(prefix.begin(), prefix.end());
- auto path = cs::GetUsbCameraPath(source, &status);
- buf.append(path.begin(), path.end());
- break;
- }
- case cs::VideoSource::kHttp: {
- llvm::StringRef prefix{"ip:"};
- buf.append(prefix.begin(), prefix.end());
- auto urls = cs::GetHttpCameraUrls(source, &status);
- if (!urls.empty()) buf.append(urls[0].begin(), urls[0].end());
- break;
- }
- case cs::VideoSource::kCv:
- // FIXME: Should be "cv:", but LabVIEW dashboard requires "usb:".
- // https://github.com/wpilibsuite/allwpilib/issues/407
- return "usb:";
- default:
- return "unknown:";
- }
-
- return llvm::StringRef{buf.begin(), buf.size()};
-}
-
-static std::string MakeStreamValue(llvm::StringRef address, int port) {
- std::string rv;
- llvm::raw_string_ostream stream(rv);
- stream << "mjpg:http://" << address << ':' << port << "/?action=stream";
- stream.flush();
- return rv;
-}
-
-std::shared_ptr<ITable> CameraServer::GetSourceTable(CS_Source source) {
- std::lock_guard<std::mutex> lock(m_mutex);
- return m_tables.lookup(source);
-}
-
-std::vector<std::string> CameraServer::GetSinkStreamValues(CS_Sink sink) {
- CS_Status status = 0;
-
- // Ignore all but MjpegServer
- if (cs::GetSinkKind(sink, &status) != CS_SINK_MJPEG)
- return std::vector<std::string>{};
-
- // Get port
- int port = cs::GetMjpegServerPort(sink, &status);
-
- // Generate values
- std::vector<std::string> values;
- auto listenAddress = cs::GetMjpegServerListenAddress(sink, &status);
- if (!listenAddress.empty()) {
- // If a listen address is specified, only use that
- values.emplace_back(MakeStreamValue(listenAddress, port));
- } else {
- // Otherwise generate for hostname and all interface addresses
- values.emplace_back(MakeStreamValue(cs::GetHostname() + ".local", port));
-
- for (const auto& addr : m_addresses) {
- if (addr == "127.0.0.1") continue; // ignore localhost
- values.emplace_back(MakeStreamValue(addr, port));
- }
- }
-
- return values;
-}
-
-std::vector<std::string> CameraServer::GetSourceStreamValues(CS_Source source) {
- CS_Status status = 0;
-
- // Ignore all but HttpCamera
- if (cs::GetSourceKind(source, &status) != CS_SOURCE_HTTP)
- return std::vector<std::string>{};
-
- // Generate values
- auto values = cs::GetHttpCameraUrls(source, &status);
- for (auto& value : values) value = "mjpg:" + value;
-
- // Look to see if we have a passthrough server for this source
- for (const auto& i : m_sinks) {
- CS_Sink sink = i.second.GetHandle();
- CS_Source sinkSource = cs::GetSinkSource(sink, &status);
- if (source == sinkSource &&
- cs::GetSinkKind(sink, &status) == CS_SINK_MJPEG) {
- // Add USB-only passthrough
- int port = cs::GetMjpegServerPort(sink, &status);
- values.emplace_back(MakeStreamValue("172.22.11.2", port));
- break;
- }
- }
-
- // Set table value
- return values;
-}
-
-void CameraServer::UpdateStreamValues() {
- std::lock_guard<std::mutex> lock(m_mutex);
- // Over all the sinks...
- for (const auto& i : m_sinks) {
- CS_Status status = 0;
- CS_Sink sink = i.second.GetHandle();
-
- // Get the source's subtable (if none exists, we're done)
- CS_Source source = cs::GetSinkSource(sink, &status);
- if (source == 0) continue;
- auto table = m_tables.lookup(source);
- if (table) {
- // Don't set stream values if this is a HttpCamera passthrough
- if (cs::GetSourceKind(source, &status) == CS_SOURCE_HTTP) continue;
-
- // Set table value
- auto values = GetSinkStreamValues(sink);
- if (!values.empty()) table->PutStringArray("streams", values);
- }
- }
-
- // Over all the sources...
- for (const auto& i : m_sources) {
- CS_Source source = i.second.GetHandle();
-
- // Get the source's subtable (if none exists, we're done)
- auto table = m_tables.lookup(source);
- if (table) {
- // Set table value
- auto values = GetSourceStreamValues(source);
- if (!values.empty()) table->PutStringArray("streams", values);
- }
- }
-}
-
-static std::string PixelFormatToString(int pixelFormat) {
- switch (pixelFormat) {
- case cs::VideoMode::PixelFormat::kMJPEG:
- return "MJPEG";
- case cs::VideoMode::PixelFormat::kYUYV:
- return "YUYV";
- case cs::VideoMode::PixelFormat::kRGB565:
- return "RGB565";
- case cs::VideoMode::PixelFormat::kBGR:
- return "BGR";
- case cs::VideoMode::PixelFormat::kGray:
- return "Gray";
- default:
- return "Unknown";
- }
-}
-#if 0
-static cs::VideoMode::PixelFormat PixelFormatFromString(llvm::StringRef str) {
- if (str == "MJPEG" || str == "mjpeg" || str == "JPEG" || str == "jpeg")
- return cs::VideoMode::PixelFormat::kMJPEG;
- if (str == "YUYV" || str == "yuyv") return cs::VideoMode::PixelFormat::kYUYV;
- if (str == "RGB565" || str == "rgb565")
- return cs::VideoMode::PixelFormat::kRGB565;
- if (str == "BGR" || str == "bgr") return cs::VideoMode::PixelFormat::kBGR;
- if (str == "GRAY" || str == "Gray" || str == "gray")
- return cs::VideoMode::PixelFormat::kGray;
- return cs::VideoMode::PixelFormat::kUnknown;
-}
-
-static cs::VideoMode VideoModeFromString(llvm::StringRef modeStr) {
- cs::VideoMode mode;
- size_t pos;
-
- // width: [0-9]+
- pos = modeStr.find_first_not_of("0123456789");
- llvm::StringRef widthStr = modeStr.slice(0, pos);
- modeStr = modeStr.drop_front(pos).ltrim(); // drop whitespace too
-
- // 'x'
- if (modeStr.empty() || modeStr[0] != 'x') return mode;
- modeStr = modeStr.drop_front(1).ltrim(); // drop whitespace too
-
- // height: [0-9]+
- pos = modeStr.find_first_not_of("0123456789");
- llvm::StringRef heightStr = modeStr.slice(0, pos);
- modeStr = modeStr.drop_front(pos).ltrim(); // drop whitespace too
-
- // format: all characters until whitespace
- pos = modeStr.find_first_of(" \t\n\v\f\r");
- llvm::StringRef formatStr = modeStr.slice(0, pos);
- modeStr = modeStr.drop_front(pos).ltrim(); // drop whitespace too
-
- // fps: [0-9.]+
- pos = modeStr.find_first_not_of("0123456789.");
- llvm::StringRef fpsStr = modeStr.slice(0, pos);
- modeStr = modeStr.drop_front(pos).ltrim(); // drop whitespace too
-
- // "fps"
- if (!modeStr.startswith("fps")) return mode;
-
- // make fps an integer string by dropping after the decimal
- fpsStr = fpsStr.slice(0, fpsStr.find('.'));
-
- // convert width, height, and fps to integers
- if (widthStr.getAsInteger(10, mode.width)) return mode;
- if (heightStr.getAsInteger(10, mode.height)) return mode;
- if (fpsStr.getAsInteger(10, mode.fps)) return mode;
-
- // convert format to enum value
- mode.pixelFormat = PixelFormatFromString(formatStr);
-
- return mode;
-}
-#endif
-static std::string VideoModeToString(const cs::VideoMode& mode) {
- std::string rv;
- llvm::raw_string_ostream oss{rv};
- oss << mode.width << "x" << mode.height;
- oss << " " << PixelFormatToString(mode.pixelFormat) << " ";
- oss << mode.fps << " fps";
- return oss.str();
-}
-
-static std::vector<std::string> GetSourceModeValues(int source) {
- std::vector<std::string> rv;
- CS_Status status = 0;
- for (const auto& mode : cs::EnumerateSourceVideoModes(source, &status))
- rv.emplace_back(VideoModeToString(mode));
- return rv;
-}
-
-static inline llvm::StringRef Concatenate(llvm::StringRef lhs,
- llvm::StringRef rhs,
- llvm::SmallVectorImpl<char>& buf) {
- buf.clear();
- llvm::raw_svector_ostream oss{buf};
- oss << lhs << rhs;
- return oss.str();
-}
-
-static void PutSourcePropertyValue(ITable* table, const cs::VideoEvent& event,
- bool isNew) {
- llvm::SmallString<64> name;
- llvm::SmallString<64> infoName;
- if (llvm::StringRef{event.name}.startswith("raw_")) {
- name = "RawProperty/";
- name += event.name;
- infoName = "RawPropertyInfo/";
- infoName += event.name;
- } else {
- name = "Property/";
- name += event.name;
- infoName = "PropertyInfo/";
- infoName += event.name;
- }
-
- llvm::SmallString<64> buf;
- CS_Status status = 0;
- switch (event.propertyKind) {
- case cs::VideoProperty::kBoolean:
- if (isNew)
- table->SetDefaultBoolean(name, event.value != 0);
- else
- table->PutBoolean(name, event.value != 0);
- break;
- case cs::VideoProperty::kInteger:
- case cs::VideoProperty::kEnum:
- if (isNew) {
- table->SetDefaultNumber(name, event.value);
- table->PutNumber(Concatenate(infoName, "/min", buf),
- cs::GetPropertyMin(event.propertyHandle, &status));
- table->PutNumber(Concatenate(infoName, "/max", buf),
- cs::GetPropertyMax(event.propertyHandle, &status));
- table->PutNumber(Concatenate(infoName, "/step", buf),
- cs::GetPropertyStep(event.propertyHandle, &status));
- table->PutNumber(Concatenate(infoName, "/default", buf),
- cs::GetPropertyDefault(event.propertyHandle, &status));
- } else {
- table->PutNumber(name, event.value);
- }
- break;
- case cs::VideoProperty::kString:
- if (isNew)
- table->SetDefaultString(name, event.valueStr);
- else
- table->PutString(name, event.valueStr);
- break;
- default:
- break;
- }
-}
-
-CameraServer::CameraServer()
- : m_publishTable{NetworkTable::GetTable(kPublishName)},
- m_nextPort(kBasePort) {
- // We publish sources to NetworkTables using the following structure:
- // "/CameraPublisher/{Source.Name}/" - root
- // - "source" (string): Descriptive, prefixed with type (e.g. "usb:0")
- // - "streams" (string array): URLs that can be used to stream data
- // - "description" (string): Description of the source
- // - "connected" (boolean): Whether source is connected
- // - "mode" (string): Current video mode
- // - "modes" (string array): Available video modes
- // - "Property/{Property}" - Property values
- // - "PropertyInfo/{Property}" - Property supporting information
-
- // Listener for video events
- m_videoListener = cs::VideoListener{
- [=](const cs::VideoEvent& event) {
- CS_Status status = 0;
- switch (event.kind) {
- case cs::VideoEvent::kSourceCreated: {
- // Create subtable for the camera
- auto table = m_publishTable->GetSubTable(event.name);
- {
- std::lock_guard<std::mutex> lock(m_mutex);
- m_tables.insert(std::make_pair(event.sourceHandle, table));
- }
- llvm::SmallString<64> buf;
- table->PutString("source",
- MakeSourceValue(event.sourceHandle, buf));
- llvm::SmallString<64> descBuf;
- table->PutString(
- "description",
- cs::GetSourceDescription(event.sourceHandle, descBuf, &status));
- table->PutBoolean("connected", cs::IsSourceConnected(
- event.sourceHandle, &status));
- table->PutStringArray("streams",
- GetSourceStreamValues(event.sourceHandle));
- auto mode = cs::GetSourceVideoMode(event.sourceHandle, &status);
- table->SetDefaultString("mode", VideoModeToString(mode));
- table->PutStringArray("modes",
- GetSourceModeValues(event.sourceHandle));
- break;
- }
- case cs::VideoEvent::kSourceDestroyed: {
- auto table = GetSourceTable(event.sourceHandle);
- if (table) {
- table->PutString("source", "");
- table->PutStringArray("streams", std::vector<std::string>{});
- table->PutStringArray("modes", std::vector<std::string>{});
- }
- break;
- }
- case cs::VideoEvent::kSourceConnected: {
- auto table = GetSourceTable(event.sourceHandle);
- if (table) {
- // update the description too (as it may have changed)
- llvm::SmallString<64> descBuf;
- table->PutString("description",
- cs::GetSourceDescription(event.sourceHandle,
- descBuf, &status));
- table->PutBoolean("connected", true);
- }
- break;
- }
- case cs::VideoEvent::kSourceDisconnected: {
- auto table = GetSourceTable(event.sourceHandle);
- if (table) table->PutBoolean("connected", false);
- break;
- }
- case cs::VideoEvent::kSourceVideoModesUpdated: {
- auto table = GetSourceTable(event.sourceHandle);
- if (table)
- table->PutStringArray("modes",
- GetSourceModeValues(event.sourceHandle));
- break;
- }
- case cs::VideoEvent::kSourceVideoModeChanged: {
- auto table = GetSourceTable(event.sourceHandle);
- if (table) table->PutString("mode", VideoModeToString(event.mode));
- break;
- }
- case cs::VideoEvent::kSourcePropertyCreated: {
- auto table = GetSourceTable(event.sourceHandle);
- if (table) PutSourcePropertyValue(table.get(), event, true);
- break;
- }
- case cs::VideoEvent::kSourcePropertyValueUpdated: {
- auto table = GetSourceTable(event.sourceHandle);
- if (table) PutSourcePropertyValue(table.get(), event, false);
- break;
- }
- case cs::VideoEvent::kSourcePropertyChoicesUpdated: {
- auto table = GetSourceTable(event.sourceHandle);
- if (table) {
- llvm::SmallString<64> name{"PropertyInfo/"};
- name += event.name;
- name += "/choices";
- auto choices =
- cs::GetEnumPropertyChoices(event.propertyHandle, &status);
- table->PutStringArray(name, choices);
- }
- break;
- }
- case cs::VideoEvent::kSinkSourceChanged:
- case cs::VideoEvent::kSinkCreated:
- case cs::VideoEvent::kSinkDestroyed: {
- UpdateStreamValues();
- break;
- }
- case cs::VideoEvent::kNetworkInterfacesChanged: {
- m_addresses = cs::GetNetworkInterfaces();
- break;
- }
- default:
- break;
- }
- },
- 0x4fff, true};
-
- // Listener for NetworkTable events
- // We don't currently support changing settings via NT due to
- // synchronization issues, so just update to current setting if someone
- // else tries to change it.
- llvm::SmallString<64> buf;
- m_tableListener = nt::AddEntryListener(
- Concatenate(kPublishName, "/", buf),
- [=](unsigned int uid, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, unsigned int flags) {
- llvm::StringRef relativeKey =
- key.substr(llvm::StringRef(kPublishName).size() + 1);
-
- // get source (sourceName/...)
- auto subKeyIndex = relativeKey.find('/');
- if (subKeyIndex == llvm::StringRef::npos) return;
- llvm::StringRef sourceName = relativeKey.slice(0, subKeyIndex);
- auto sourceIt = m_sources.find(sourceName);
- if (sourceIt == m_sources.end()) return;
-
- // get subkey
- relativeKey = relativeKey.substr(subKeyIndex + 1);
-
- // handle standard names
- llvm::StringRef propName;
- if (relativeKey == "mode") {
- // reset to current mode
- nt::SetEntryValue(key, nt::Value::MakeString(VideoModeToString(
- sourceIt->second.GetVideoMode())));
- return;
- } else if (relativeKey.startswith("Property/")) {
- propName = relativeKey.substr(9);
- } else if (relativeKey.startswith("RawProperty/")) {
- propName = relativeKey.substr(12);
- } else {
- return; // ignore
- }
-
- // everything else is a property
- auto property = sourceIt->second.GetProperty(propName);
- switch (property.GetKind()) {
- case cs::VideoProperty::kNone:
- return;
- case cs::VideoProperty::kBoolean:
- nt::SetEntryValue(key, nt::Value::MakeBoolean(property.Get() != 0));
- return;
- case cs::VideoProperty::kInteger:
- case cs::VideoProperty::kEnum:
- nt::SetEntryValue(key, nt::Value::MakeDouble(property.Get()));
- return;
- case cs::VideoProperty::kString:
- nt::SetEntryValue(key, nt::Value::MakeString(property.GetString()));
- return;
- default:
- return;
- }
- },
- NT_NOTIFY_IMMEDIATE | NT_NOTIFY_UPDATE);
-}
-
-cs::UsbCamera CameraServer::StartAutomaticCapture() {
- return StartAutomaticCapture(m_defaultUsbDevice++);
-}
-
-cs::UsbCamera CameraServer::StartAutomaticCapture(int dev) {
- llvm::SmallString<64> buf;
- llvm::raw_svector_ostream name{buf};
- name << "USB Camera " << dev;
-
- cs::UsbCamera camera{name.str(), dev};
- StartAutomaticCapture(camera);
- return camera;
-}
-
-cs::UsbCamera CameraServer::StartAutomaticCapture(llvm::StringRef name,
- int dev) {
- cs::UsbCamera camera{name, dev};
- StartAutomaticCapture(camera);
- return camera;
-}
-
-cs::UsbCamera CameraServer::StartAutomaticCapture(llvm::StringRef name,
- llvm::StringRef path) {
- cs::UsbCamera camera{name, path};
- StartAutomaticCapture(camera);
- return camera;
-}
-
-cs::AxisCamera CameraServer::AddAxisCamera(llvm::StringRef host) {
- return AddAxisCamera("Axis Camera", host);
-}
-
-cs::AxisCamera CameraServer::AddAxisCamera(const char* host) {
- return AddAxisCamera("Axis Camera", host);
-}
-
-cs::AxisCamera CameraServer::AddAxisCamera(const std::string& host) {
- return AddAxisCamera("Axis Camera", host);
-}
-
-cs::AxisCamera CameraServer::AddAxisCamera(llvm::ArrayRef<std::string> hosts) {
- return AddAxisCamera("Axis Camera", hosts);
-}
-
-cs::AxisCamera CameraServer::AddAxisCamera(llvm::StringRef name,
- llvm::StringRef host) {
- cs::AxisCamera camera{name, host};
- StartAutomaticCapture(camera);
- return camera;
-}
-
-cs::AxisCamera CameraServer::AddAxisCamera(llvm::StringRef name,
- const char* host) {
- cs::AxisCamera camera{name, host};
- StartAutomaticCapture(camera);
- return camera;
-}
-
-cs::AxisCamera CameraServer::AddAxisCamera(llvm::StringRef name,
- const std::string& host) {
- cs::AxisCamera camera{name, host};
- StartAutomaticCapture(camera);
- return camera;
-}
-
-cs::AxisCamera CameraServer::AddAxisCamera(llvm::StringRef name,
- llvm::ArrayRef<std::string> hosts) {
- cs::AxisCamera camera{name, hosts};
- StartAutomaticCapture(camera);
- return camera;
-}
-
-void CameraServer::StartAutomaticCapture(const cs::VideoSource& camera) {
- llvm::SmallString<64> name{"serve_"};
- name += camera.GetName();
-
- AddCamera(camera);
- auto server = AddServer(name);
- server.SetSource(camera);
-}
-
-cs::CvSink CameraServer::GetVideo() {
- cs::VideoSource source;
- {
- std::lock_guard<std::mutex> lock(m_mutex);
- if (m_primarySourceName.empty()) {
- wpi_setWPIErrorWithContext(CameraServerError, "no camera available");
- return cs::CvSink{};
- }
- auto it = m_sources.find(m_primarySourceName);
- if (it == m_sources.end()) {
- wpi_setWPIErrorWithContext(CameraServerError, "no camera available");
- return cs::CvSink{};
- }
- source = it->second;
- }
- return GetVideo(std::move(source));
-}
-
-cs::CvSink CameraServer::GetVideo(const cs::VideoSource& camera) {
- llvm::SmallString<64> name{"opencv_"};
- name += camera.GetName();
-
- {
- std::lock_guard<std::mutex> lock(m_mutex);
- auto it = m_sinks.find(name);
- if (it != m_sinks.end()) {
- auto kind = it->second.GetKind();
- if (kind != cs::VideoSink::kCv) {
- llvm::SmallString<64> buf;
- llvm::raw_svector_ostream err{buf};
- err << "expected OpenCV sink, but got " << kind;
- wpi_setWPIErrorWithContext(CameraServerError, err.str());
- return cs::CvSink{};
- }
- return *static_cast<cs::CvSink*>(&it->second);
- }
- }
-
- cs::CvSink newsink{name};
- newsink.SetSource(camera);
- AddServer(newsink);
- return newsink;
-}
-
-cs::CvSink CameraServer::GetVideo(llvm::StringRef name) {
- cs::VideoSource source;
- {
- std::lock_guard<std::mutex> lock(m_mutex);
- auto it = m_sources.find(name);
- if (it == m_sources.end()) {
- llvm::SmallString<64> buf;
- llvm::raw_svector_ostream err{buf};
- err << "could not find camera " << name;
- wpi_setWPIErrorWithContext(CameraServerError, err.str());
- return cs::CvSink{};
- }
- source = it->second;
- }
- return GetVideo(source);
-}
-
-cs::CvSource CameraServer::PutVideo(llvm::StringRef name, int width,
- int height) {
- cs::CvSource source{name, cs::VideoMode::kMJPEG, width, height, 30};
- StartAutomaticCapture(source);
- return source;
-}
-
-cs::MjpegServer CameraServer::AddServer(llvm::StringRef name) {
- int port;
- {
- std::lock_guard<std::mutex> lock(m_mutex);
- port = m_nextPort++;
- }
- return AddServer(name, port);
-}
-
-cs::MjpegServer CameraServer::AddServer(llvm::StringRef name, int port) {
- cs::MjpegServer server{name, port};
- AddServer(server);
- return server;
-}
-
-void CameraServer::AddServer(const cs::VideoSink& server) {
- std::lock_guard<std::mutex> lock(m_mutex);
- m_sinks.emplace_second(server.GetName(), server);
-}
-
-void CameraServer::RemoveServer(llvm::StringRef name) {
- std::lock_guard<std::mutex> lock(m_mutex);
- m_sinks.erase(name);
-}
-
-cs::VideoSink CameraServer::GetServer() {
- llvm::SmallString<64> name;
- {
- std::lock_guard<std::mutex> lock(m_mutex);
- if (m_primarySourceName.empty()) {
- wpi_setWPIErrorWithContext(CameraServerError, "no camera available");
- return cs::VideoSink{};
- }
- name = "serve_";
- name += m_primarySourceName;
- }
- return GetServer(name);
-}
-
-cs::VideoSink CameraServer::GetServer(llvm::StringRef name) {
- std::lock_guard<std::mutex> lock(m_mutex);
- auto it = m_sinks.find(name);
- if (it == m_sinks.end()) {
- llvm::SmallString<64> buf;
- llvm::raw_svector_ostream err{buf};
- err << "could not find server " << name;
- wpi_setWPIErrorWithContext(CameraServerError, err.str());
- return cs::VideoSink{};
- }
- return it->second;
-}
-
-void CameraServer::AddCamera(const cs::VideoSource& camera) {
- std::string name = camera.GetName();
- std::lock_guard<std::mutex> lock(m_mutex);
- if (m_primarySourceName.empty()) m_primarySourceName = name;
- m_sources.emplace_second(name, camera);
-}
-
-void CameraServer::RemoveCamera(llvm::StringRef name) {
- std::lock_guard<std::mutex> lock(m_mutex);
- m_sources.erase(name);
-}
-
-void CameraServer::SetSize(int size) {
- std::lock_guard<std::mutex> lock(m_mutex);
- if (m_primarySourceName.empty()) return;
- auto it = m_sources.find(m_primarySourceName);
- if (it == m_sources.end()) return;
- if (size == kSize160x120)
- it->second.SetResolution(160, 120);
- else if (size == kSize320x240)
- it->second.SetResolution(320, 240);
- else if (size == kSize640x480)
- it->second.SetResolution(640, 480);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Compressor.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Compressor.cpp
deleted file mode 100644
index e69a983..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Compressor.cpp
+++ /dev/null
@@ -1,299 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Compressor.h"
-#include "HAL/Compressor.h"
-
-#include "HAL/HAL.h"
-#include "HAL/Ports.h"
-#include "HAL/Solenoid.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Constructor.
- *
- * @param module The PCM ID to use (0-62)
- */
-Compressor::Compressor(int pcmID) : m_module(pcmID) {
- int32_t status = 0;
- m_compressorHandle = HAL_InitializeCompressor(m_module, &status);
- if (status != 0) {
- wpi_setErrorWithContextRange(status, 0, HAL_GetNumPCMModules(), pcmID,
- HAL_GetErrorMessage(status));
- return;
- }
- SetClosedLoopControl(true);
-}
-
-/**
- * Starts closed-loop control. Note that closed loop control is enabled by
- * default.
- */
-void Compressor::Start() {
- if (StatusIsFatal()) return;
- SetClosedLoopControl(true);
-}
-
-/**
- * Stops closed-loop control. Note that closed loop control is enabled by
- * default.
- */
-void Compressor::Stop() {
- if (StatusIsFatal()) return;
- SetClosedLoopControl(false);
-}
-
-/**
- * Check if compressor output is active.
- *
- * @return true if the compressor is on
- */
-bool Compressor::Enabled() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool value;
-
- value = HAL_GetCompressor(m_compressorHandle, &status);
-
- if (status) {
- wpi_setWPIError(Timeout);
- }
-
- return value;
-}
-
-/**
- * Check if the pressure switch is triggered.
- *
- * @return true if pressure is low
- */
-bool Compressor::GetPressureSwitchValue() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool value;
-
- value = HAL_GetCompressorPressureSwitch(m_compressorHandle, &status);
-
- if (status) {
- wpi_setWPIError(Timeout);
- }
-
- return value;
-}
-
-/**
- * Query how much current the compressor is drawing.
- *
- * @return The current through the compressor, in amps
- */
-double Compressor::GetCompressorCurrent() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
- double value;
-
- value = HAL_GetCompressorCurrent(m_compressorHandle, &status);
-
- if (status) {
- wpi_setWPIError(Timeout);
- }
-
- return value;
-}
-
-/**
- * Enables or disables automatically turning the compressor on when the
- * pressure is low.
- *
- * @param on Set to true to enable closed loop control of the compressor. False
- * to disable.
- */
-void Compressor::SetClosedLoopControl(bool on) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
-
- HAL_SetCompressorClosedLoopControl(m_compressorHandle, on, &status);
-
- if (status) {
- wpi_setWPIError(Timeout);
- }
-}
-
-/**
- * Returns true if the compressor will automatically turn on when the
- * pressure is low.
- *
- * @return True if closed loop control of the compressor is enabled. False if
- * disabled.
- */
-bool Compressor::GetClosedLoopControl() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool value;
-
- value = HAL_GetCompressorClosedLoopControl(m_compressorHandle, &status);
-
- if (status) {
- wpi_setWPIError(Timeout);
- }
-
- return value;
-}
-
-/**
- * Query if the compressor output has been disabled due to high current draw.
- *
- * @return true if PCM is in fault state : Compressor Drive is
- * disabled due to compressor current being too high.
- */
-bool Compressor::GetCompressorCurrentTooHighFault() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool value;
-
- value = HAL_GetCompressorCurrentTooHighFault(m_compressorHandle, &status);
-
- if (status) {
- wpi_setWPIError(Timeout);
- }
-
- return value;
-}
-
-/**
- * Query if the compressor output has been disabled due to high current draw
- * (sticky).
- *
- * A sticky fault will not clear on device reboot, it must be cleared through
- * code or the webdash.
- *
- * @return true if PCM sticky fault is set : Compressor Drive is
- * disabled due to compressor current being too high.
- */
-bool Compressor::GetCompressorCurrentTooHighStickyFault() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool value;
-
- value =
- HAL_GetCompressorCurrentTooHighStickyFault(m_compressorHandle, &status);
-
- if (status) {
- wpi_setWPIError(Timeout);
- }
-
- return value;
-}
-
-/**
- * Query if the compressor output has been disabled due to a short circuit
- * (sticky).
- *
- * A sticky fault will not clear on device reboot, it must be cleared through
- * code or the webdash.
- *
- * @return true if PCM sticky fault is set : Compressor output
- * appears to be shorted.
- */
-bool Compressor::GetCompressorShortedStickyFault() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool value;
-
- value = HAL_GetCompressorShortedStickyFault(m_compressorHandle, &status);
-
- if (status) {
- wpi_setWPIError(Timeout);
- }
-
- return value;
-}
-
-/**
- * Query if the compressor output has been disabled due to a short circuit.
- *
- * @return true if PCM is in fault state : Compressor output
- * appears to be shorted.
- */
-bool Compressor::GetCompressorShortedFault() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool value;
-
- value = HAL_GetCompressorShortedFault(m_compressorHandle, &status);
-
- if (status) {
- wpi_setWPIError(Timeout);
- }
-
- return value;
-}
-
-/**
- * Query if the compressor output does not appear to be wired (sticky).
- *
- * A sticky fault will not clear on device reboot, it must be cleared through
- * code or the webdash.
- *
- * @return true if PCM sticky fault is set : Compressor does not
- * appear to be wired, i.e. compressor is not drawing enough current.
- */
-bool Compressor::GetCompressorNotConnectedStickyFault() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool value;
-
- value = HAL_GetCompressorNotConnectedStickyFault(m_compressorHandle, &status);
-
- if (status) {
- wpi_setWPIError(Timeout);
- }
-
- return value;
-}
-
-/**
- * Query if the compressor output does not appear to be wired.
- *
- * @return true if PCM is in fault state : Compressor does not
- * appear to be wired, i.e. compressor is not drawing enough current.
- */
-bool Compressor::GetCompressorNotConnectedFault() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool value;
-
- value = HAL_GetCompressorNotConnectedFault(m_compressorHandle, &status);
-
- if (status) {
- wpi_setWPIError(Timeout);
- }
-
- return value;
-}
-
-/**
- * Clear ALL sticky faults inside PCM that Compressor is wired to.
- *
- * If a sticky fault is set, then it will be persistently cleared. Compressor
- * drive maybe momentarily disable while flags are being cleared. Care should
- * be taken to not call this too frequently, otherwise normal compressor
- * functionality may be prevented.
- *
- * If no sticky faults are set then this call will have no effect.
- */
-void Compressor::ClearAllPCMStickyFaults() {
- if (StatusIsFatal()) return;
- int32_t status = 0;
-
- HAL_ClearAllPCMStickyFaults(m_module, &status);
-
- if (status) {
- wpi_setWPIError(Timeout);
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/ControllerPower.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/ControllerPower.cpp
deleted file mode 100644
index 8694781..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/ControllerPower.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "ControllerPower.h"
-
-#include <stdint.h>
-
-#include "ErrorBase.h"
-#include "HAL/HAL.h"
-#include "HAL/Power.h"
-
-using namespace frc;
-
-/**
- * Get the input voltage to the robot controller.
- *
- * @return The controller input voltage value in Volts
- */
-double ControllerPower::GetInputVoltage() {
- int32_t status = 0;
- double retVal = HAL_GetVinVoltage(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Get the input current to the robot controller.
- *
- * @return The controller input current value in Amps
- */
-double ControllerPower::GetInputCurrent() {
- int32_t status = 0;
- double retVal = HAL_GetVinCurrent(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Get the voltage of the 6V rail.
- *
- * @return The controller 6V rail voltage value in Volts
- */
-double ControllerPower::GetVoltage6V() {
- int32_t status = 0;
- double retVal = HAL_GetUserVoltage6V(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Get the current output of the 6V rail.
- *
- * @return The controller 6V rail output current value in Amps
- */
-double ControllerPower::GetCurrent6V() {
- int32_t status = 0;
- double retVal = HAL_GetUserCurrent6V(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Get the enabled state of the 6V rail. The rail may be disabled due to a
- * controller brownout, a short circuit on the rail, or controller over-voltage.
- *
- * @return The controller 6V rail enabled value. True for enabled.
- */
-bool ControllerPower::GetEnabled6V() {
- int32_t status = 0;
- bool retVal = HAL_GetUserActive6V(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Get the count of the total current faults on the 6V rail since the controller
- * has booted.
- *
- * @return The number of faults.
- */
-int ControllerPower::GetFaultCount6V() {
- int32_t status = 0;
- int retVal = HAL_GetUserCurrentFaults6V(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Get the voltage of the 5V rail.
- *
- * @return The controller 5V rail voltage value in Volts
- */
-double ControllerPower::GetVoltage5V() {
- int32_t status = 0;
- double retVal = HAL_GetUserVoltage5V(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Get the current output of the 5V rail.
- *
- * @return The controller 5V rail output current value in Amps
- */
-double ControllerPower::GetCurrent5V() {
- int32_t status = 0;
- double retVal = HAL_GetUserCurrent5V(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Get the enabled state of the 5V rail. The rail may be disabled due to a
- * controller brownout, a short circuit on the rail, or controller over-voltage.
- *
- * @return The controller 5V rail enabled value. True for enabled.
- */
-bool ControllerPower::GetEnabled5V() {
- int32_t status = 0;
- bool retVal = HAL_GetUserActive5V(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Get the count of the total current faults on the 5V rail since the controller
- * has booted.
- *
- * @return The number of faults
- */
-int ControllerPower::GetFaultCount5V() {
- int32_t status = 0;
- int retVal = HAL_GetUserCurrentFaults5V(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Get the voltage of the 3.3V rail.
- *
- * @return The controller 3.3V rail voltage value in Volts
- */
-double ControllerPower::GetVoltage3V3() {
- int32_t status = 0;
- double retVal = HAL_GetUserVoltage3V3(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Get the current output of the 3.3V rail.
- *
- * @return The controller 3.3V rail output current value in Amps
- */
-double ControllerPower::GetCurrent3V3() {
- int32_t status = 0;
- double retVal = HAL_GetUserCurrent3V3(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Get the enabled state of the 3.3V rail. The rail may be disabled due to a
- * controller brownout, a short circuit on the rail, or controller over-voltage.
- *
- * @return The controller 3.3V rail enabled value. True for enabled.
- */
-bool ControllerPower::GetEnabled3V3() {
- int32_t status = 0;
- bool retVal = HAL_GetUserActive3V3(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Get the count of the total current faults on the 3.3V rail since the
- * controller has booted.
- *
- * @return The number of faults
- */
-int ControllerPower::GetFaultCount3V3() {
- int32_t status = 0;
- int retVal = HAL_GetUserCurrentFaults3V3(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Counter.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Counter.cpp
deleted file mode 100644
index f580c1e..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Counter.cpp
+++ /dev/null
@@ -1,618 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Counter.h"
-
-#include "AnalogTrigger.h"
-#include "DigitalInput.h"
-#include "HAL/HAL.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Create an instance of a counter where no sources are selected.
- *
- * They all must be selected by calling functions to specify the upsource and
- * the downsource independently.
- *
- * This creates a ChipObject counter and initializes status variables
- * appropriately.
- *
- * The counter will start counting immediately.
- *
- * @param mode The counter mode
- */
-Counter::Counter(Mode mode) {
- int32_t status = 0;
- m_counter = HAL_InitializeCounter((HAL_Counter_Mode)mode, &m_index, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- SetMaxPeriod(.5);
-
- HAL_Report(HALUsageReporting::kResourceType_Counter, m_index, mode);
-}
-
-/**
- * Create an instance of a counter from a Digital Source (such as a Digital
- * Input).
- *
- * This is used if an existing digital input is to be shared by multiple other
- * objects such as encoders or if the Digital Source is not a Digital Input
- * channel (such as an Analog Trigger).
- *
- * The counter will start counting immediately.
- * @param source A pointer to the existing DigitalSource object. It will be set
- * as the Up Source.
- */
-Counter::Counter(DigitalSource* source) : Counter(kTwoPulse) {
- SetUpSource(source);
- ClearDownSource();
-}
-
-/**
- * Create an instance of a counter from a Digital Source (such as a Digital
- * Input).
- *
- * This is used if an existing digital input is to be shared by multiple other
- * objects such as encoders or if the Digital Source is not a Digital Input
- * channel (such as an Analog Trigger).
- *
- * The counter will start counting immediately.
- *
- * @param source A pointer to the existing DigitalSource object. It will be
- * set as the Up Source.
- */
-Counter::Counter(std::shared_ptr<DigitalSource> source) : Counter(kTwoPulse) {
- SetUpSource(source);
- ClearDownSource();
-}
-
-/**
- * Create an instance of a Counter object.
- *
- * Create an up-Counter instance given a channel.
- *
- * The counter will start counting immediately.
- *
- * @param channel The DIO channel to use as the up source. 0-9 are on-board,
- * 10-25 are on the MXP
- */
-Counter::Counter(int channel) : Counter(kTwoPulse) {
- SetUpSource(channel);
- ClearDownSource();
-}
-
-/**
- * Create an instance of a Counter object.
- *
- * Create an instance of a simple up-Counter given an analog trigger.
- * Use the trigger state output from the analog trigger.
- *
- * The counter will start counting immediately.
- *
- * @param trigger The pointer to the existing AnalogTrigger object.
- */
-WPI_DEPRECATED("Use pass-by-reference instead.")
-Counter::Counter(AnalogTrigger* trigger) : Counter(kTwoPulse) {
- SetUpSource(trigger->CreateOutput(AnalogTriggerType::kState));
- ClearDownSource();
-}
-
-/**
- * Create an instance of a Counter object.
- *
- * Create an instance of a simple up-Counter given an analog trigger.
- * Use the trigger state output from the analog trigger.
- *
- * The counter will start counting immediately.
- *
- * @param trigger The reference to the existing AnalogTrigger object.
- */
-Counter::Counter(const AnalogTrigger& trigger) : Counter(kTwoPulse) {
- SetUpSource(trigger.CreateOutput(AnalogTriggerType::kState));
- ClearDownSource();
-}
-
-/**
- * Create an instance of a Counter object.
- *
- * Creates a full up-down counter given two Digital Sources.
- *
- * @param encodingType The quadrature decoding mode (1x or 2x)
- * @param upSource The pointer to the DigitalSource to set as the up source
- * @param downSource The pointer to the DigitalSource to set as the down
- * source
- * @param inverted True to invert the output (reverse the direction)
- */
-Counter::Counter(EncodingType encodingType, DigitalSource* upSource,
- DigitalSource* downSource, bool inverted)
- : Counter(encodingType, std::shared_ptr<DigitalSource>(
- upSource, NullDeleter<DigitalSource>()),
- std::shared_ptr<DigitalSource>(downSource,
- NullDeleter<DigitalSource>()),
- inverted) {}
-
-/**
- * Create an instance of a Counter object.
- *
- * Creates a full up-down counter given two Digital Sources.
- *
- * @param encodingType The quadrature decoding mode (1x or 2x)
- * @param upSource The pointer to the DigitalSource to set as the up source
- * @param downSource The pointer to the DigitalSource to set as the down
- * source
- * @param inverted True to invert the output (reverse the direction)
- */
-Counter::Counter(EncodingType encodingType,
- std::shared_ptr<DigitalSource> upSource,
- std::shared_ptr<DigitalSource> downSource, bool inverted)
- : Counter(kExternalDirection) {
- if (encodingType != k1X && encodingType != k2X) {
- wpi_setWPIErrorWithContext(
- ParameterOutOfRange,
- "Counter only supports 1X and 2X quadrature decoding.");
- return;
- }
- SetUpSource(upSource);
- SetDownSource(downSource);
- int32_t status = 0;
-
- if (encodingType == k1X) {
- SetUpSourceEdge(true, false);
- HAL_SetCounterAverageSize(m_counter, 1, &status);
- } else {
- SetUpSourceEdge(true, true);
- HAL_SetCounterAverageSize(m_counter, 2, &status);
- }
-
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- SetDownSourceEdge(inverted, true);
-}
-
-/**
- * Delete the Counter object.
- */
-Counter::~Counter() {
- SetUpdateWhenEmpty(true);
-
- int32_t status = 0;
- HAL_FreeCounter(m_counter, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- m_counter = HAL_kInvalidHandle;
-}
-
-/**
- * Set the upsource for the counter as a digital input channel.
- *
- * @param channel The DIO channel to use as the up source. 0-9 are on-board,
- * 10-25 are on the MXP
- */
-void Counter::SetUpSource(int channel) {
- if (StatusIsFatal()) return;
- SetUpSource(std::make_shared<DigitalInput>(channel));
-}
-
-/**
- * Set the up counting source to be an analog trigger.
- *
- * @param analogTrigger The analog trigger object that is used for the Up Source
- * @param triggerType The analog trigger output that will trigger the counter.
- */
-void Counter::SetUpSource(AnalogTrigger* analogTrigger,
- AnalogTriggerType triggerType) {
- SetUpSource(std::shared_ptr<AnalogTrigger>(analogTrigger,
- NullDeleter<AnalogTrigger>()),
- triggerType);
-}
-
-/**
- * Set the up counting source to be an analog trigger.
- *
- * @param analogTrigger The analog trigger object that is used for the Up Source
- * @param triggerType The analog trigger output that will trigger the counter.
- */
-void Counter::SetUpSource(std::shared_ptr<AnalogTrigger> analogTrigger,
- AnalogTriggerType triggerType) {
- if (StatusIsFatal()) return;
- SetUpSource(analogTrigger->CreateOutput(triggerType));
-}
-
-/**
- * Set the source object that causes the counter to count up.
- *
- * Set the up counting DigitalSource.
- *
- * @param source Pointer to the DigitalSource object to set as the up source
- */
-void Counter::SetUpSource(std::shared_ptr<DigitalSource> source) {
- if (StatusIsFatal()) return;
- m_upSource = source;
- if (m_upSource->StatusIsFatal()) {
- CloneError(*m_upSource);
- } else {
- int32_t status = 0;
- HAL_SetCounterUpSource(
- m_counter, source->GetPortHandleForRouting(),
- (HAL_AnalogTriggerType)source->GetAnalogTriggerTypeForRouting(),
- &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- }
-}
-
-void Counter::SetUpSource(DigitalSource* source) {
- SetUpSource(
- std::shared_ptr<DigitalSource>(source, NullDeleter<DigitalSource>()));
-}
-
-/**
- * Set the source object that causes the counter to count up.
- *
- * Set the up counting DigitalSource.
- *
- * @param source Reference to the DigitalSource object to set as the up source
- */
-void Counter::SetUpSource(DigitalSource& source) {
- SetUpSource(
- std::shared_ptr<DigitalSource>(&source, NullDeleter<DigitalSource>()));
-}
-
-/**
- * Set the edge sensitivity on an up counting source.
- *
- * Set the up source to either detect rising edges or falling edges or both.
- *
- * @param risingEdge True to trigger on rising edges
- * @param fallingEdge True to trigger on falling edges
- */
-void Counter::SetUpSourceEdge(bool risingEdge, bool fallingEdge) {
- if (StatusIsFatal()) return;
- if (m_upSource == nullptr) {
- wpi_setWPIErrorWithContext(
- NullParameter,
- "Must set non-nullptr UpSource before setting UpSourceEdge");
- }
- int32_t status = 0;
- HAL_SetCounterUpSourceEdge(m_counter, risingEdge, fallingEdge, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Disable the up counting source to the counter.
- */
-void Counter::ClearUpSource() {
- if (StatusIsFatal()) return;
- m_upSource.reset();
- int32_t status = 0;
- HAL_ClearCounterUpSource(m_counter, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set the down counting source to be a digital input channel.
- *
- * @param channel The DIO channel to use as the up source. 0-9 are on-board,
- * 10-25 are on the MXP
- */
-void Counter::SetDownSource(int channel) {
- if (StatusIsFatal()) return;
- SetDownSource(std::make_shared<DigitalInput>(channel));
-}
-
-/**
- * Set the down counting source to be an analog trigger.
- *
- * @param analogTrigger The analog trigger object that is used for the Down
- * Source
- * @param triggerType The analog trigger output that will trigger the counter.
- */
-void Counter::SetDownSource(AnalogTrigger* analogTrigger,
- AnalogTriggerType triggerType) {
- SetDownSource(std::shared_ptr<AnalogTrigger>(analogTrigger,
- NullDeleter<AnalogTrigger>()),
- triggerType);
-}
-
-/**
- * Set the down counting source to be an analog trigger.
- *
- * @param analogTrigger The analog trigger object that is used for the Down
- * Source
- * @param triggerType The analog trigger output that will trigger the counter.
- */
-void Counter::SetDownSource(std::shared_ptr<AnalogTrigger> analogTrigger,
- AnalogTriggerType triggerType) {
- if (StatusIsFatal()) return;
- SetDownSource(analogTrigger->CreateOutput(triggerType));
-}
-
-/**
- * Set the source object that causes the counter to count down.
- *
- * Set the down counting DigitalSource.
- *
- * @param source Pointer to the DigitalSource object to set as the down source
- */
-void Counter::SetDownSource(std::shared_ptr<DigitalSource> source) {
- if (StatusIsFatal()) return;
- m_downSource = source;
- if (m_downSource->StatusIsFatal()) {
- CloneError(*m_downSource);
- } else {
- int32_t status = 0;
- HAL_SetCounterDownSource(
- m_counter, source->GetPortHandleForRouting(),
- (HAL_AnalogTriggerType)source->GetAnalogTriggerTypeForRouting(),
- &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- }
-}
-
-void Counter::SetDownSource(DigitalSource* source) {
- SetDownSource(
- std::shared_ptr<DigitalSource>(source, NullDeleter<DigitalSource>()));
-}
-
-/**
- * Set the source object that causes the counter to count down.
- *
- * Set the down counting DigitalSource.
- *
- * @param source Reference to the DigitalSource object to set as the down source
- */
-void Counter::SetDownSource(DigitalSource& source) {
- SetDownSource(
- std::shared_ptr<DigitalSource>(&source, NullDeleter<DigitalSource>()));
-}
-
-/**
- * Set the edge sensitivity on a down counting source.
- *
- * Set the down source to either detect rising edges or falling edges.
- *
- * @param risingEdge True to trigger on rising edges
- * @param fallingEdge True to trigger on falling edges
- */
-void Counter::SetDownSourceEdge(bool risingEdge, bool fallingEdge) {
- if (StatusIsFatal()) return;
- if (m_downSource == nullptr) {
- wpi_setWPIErrorWithContext(
- NullParameter,
- "Must set non-nullptr DownSource before setting DownSourceEdge");
- }
- int32_t status = 0;
- HAL_SetCounterDownSourceEdge(m_counter, risingEdge, fallingEdge, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Disable the down counting source to the counter.
- */
-void Counter::ClearDownSource() {
- if (StatusIsFatal()) return;
- m_downSource.reset();
- int32_t status = 0;
- HAL_ClearCounterDownSource(m_counter, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set standard up / down counting mode on this counter.
- *
- * Up and down counts are sourced independently from two inputs.
- */
-void Counter::SetUpDownCounterMode() {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetCounterUpDownMode(m_counter, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set external direction mode on this counter.
- *
- * Counts are sourced on the Up counter input.
- * The Down counter input represents the direction to count.
- */
-void Counter::SetExternalDirectionMode() {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetCounterExternalDirectionMode(m_counter, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set Semi-period mode on this counter.
- *
- * Counts up on both rising and falling edges.
- */
-void Counter::SetSemiPeriodMode(bool highSemiPeriod) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetCounterSemiPeriodMode(m_counter, highSemiPeriod, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Configure the counter to count in up or down based on the length of the input
- * pulse.
- *
- * This mode is most useful for direction sensitive gear tooth sensors.
- *
- * @param threshold The pulse length beyond which the counter counts the
- * opposite direction. Units are seconds.
- */
-void Counter::SetPulseLengthMode(double threshold) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetCounterPulseLengthMode(m_counter, threshold, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Get the Samples to Average which specifies the number of samples of the timer
- * to average when calculating the period.
- *
- * Perform averaging to account for mechanical imperfections or as oversampling
- * to increase resolution.
- *
- * @return The number of samples being averaged (from 1 to 127)
- */
-int Counter::GetSamplesToAverage() const {
- int32_t status = 0;
- int samples = HAL_GetCounterSamplesToAverage(m_counter, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return samples;
-}
-
-/**
- * Set the Samples to Average which specifies the number of samples of the timer
- * to average when calculating the period. Perform averaging to account for
- * mechanical imperfections or as oversampling to increase resolution.
- *
- * @param samplesToAverage The number of samples to average from 1 to 127.
- */
-void Counter::SetSamplesToAverage(int samplesToAverage) {
- if (samplesToAverage < 1 || samplesToAverage > 127) {
- wpi_setWPIErrorWithContext(
- ParameterOutOfRange,
- "Average counter values must be between 1 and 127");
- }
- int32_t status = 0;
- HAL_SetCounterSamplesToAverage(m_counter, samplesToAverage, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Read the current counter value.
- *
- * Read the value at this instant. It may still be running, so it reflects the
- * current value. Next time it is read, it might have a different value.
- */
-int Counter::Get() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
- int value = HAL_GetCounter(m_counter, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Reset the Counter to zero.
- *
- * Set the counter value to zero. This doesn't effect the running state of the
- * counter, just sets the current value to zero.
- */
-void Counter::Reset() {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_ResetCounter(m_counter, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Get the Period of the most recent count.
- *
- * Returns the time interval of the most recent count. This can be used for
- * velocity calculations to determine shaft speed.
- *
- * @returns The period between the last two pulses in units of seconds.
- */
-double Counter::GetPeriod() const {
- if (StatusIsFatal()) return 0.0;
- int32_t status = 0;
- double value = HAL_GetCounterPeriod(m_counter, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Set the maximum period where the device is still considered "moving".
- *
- * Sets the maximum period where the device is considered moving. This value is
- * used to determine the "stopped" state of the counter using the GetStopped
- * method.
- *
- * @param maxPeriod The maximum period where the counted device is considered
- * moving in seconds.
- */
-void Counter::SetMaxPeriod(double maxPeriod) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetCounterMaxPeriod(m_counter, maxPeriod, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Select whether you want to continue updating the event timer output when
- * there are no samples captured.
- *
- * The output of the event timer has a buffer of periods that are averaged and
- * posted to a register on the FPGA. When the timer detects that the event
- * source has stopped (based on the MaxPeriod) the buffer of samples to be
- * averaged is emptied. If you enable the update when empty, you will be
- * notified of the stopped source and the event time will report 0 samples.
- * If you disable update when empty, the most recent average will remain on
- * the output until a new sample is acquired. You will never see 0 samples
- * output (except when there have been no events since an FPGA reset) and you
- * will likely not see the stopped bit become true (since it is updated at the
- * end of an average and there are no samples to average).
- *
- * @param enabled True to enable update when empty
- */
-void Counter::SetUpdateWhenEmpty(bool enabled) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetCounterUpdateWhenEmpty(m_counter, enabled, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Determine if the clock is stopped.
- *
- * Determine if the clocked input is stopped based on the MaxPeriod value set
- * using the SetMaxPeriod method. If the clock exceeds the MaxPeriod, then the
- * device (and counter) are assumed to be stopped and it returns true.
- *
- * @return Returns true if the most recent counter period exceeds the MaxPeriod
- * value set by SetMaxPeriod.
- */
-bool Counter::GetStopped() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool value = HAL_GetCounterStopped(m_counter, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * The last direction the counter value changed.
- *
- * @return The last direction the counter value changed.
- */
-bool Counter::GetDirection() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool value = HAL_GetCounterDirection(m_counter, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Set the Counter to return reversed sensing on the direction.
- *
- * This allows counters to change the direction they are counting in the case of
- * 1X and 2X quadrature encoding only. Any other counter mode isn't supported.
- *
- * @param reverseDirection true if the value counted should be negated.
- */
-void Counter::SetReverseDirection(bool reverseDirection) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetCounterReverseDirection(m_counter, reverseDirection, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/DigitalGlitchFilter.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/DigitalGlitchFilter.cpp
deleted file mode 100644
index 287ff88..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/DigitalGlitchFilter.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "DigitalGlitchFilter.h"
-
-#include <algorithm>
-#include <array>
-
-#include "Counter.h"
-#include "Encoder.h"
-#include "HAL/Constants.h"
-#include "HAL/DIO.h"
-#include "HAL/HAL.h"
-#include "Utility.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-std::array<bool, 3> DigitalGlitchFilter::m_filterAllocated = {
- {false, false, false}};
-priority_mutex DigitalGlitchFilter::m_mutex;
-
-DigitalGlitchFilter::DigitalGlitchFilter() {
- std::lock_guard<priority_mutex> sync(m_mutex);
- auto index =
- std::find(m_filterAllocated.begin(), m_filterAllocated.end(), false);
- wpi_assert(index != m_filterAllocated.end());
-
- m_channelIndex = std::distance(m_filterAllocated.begin(), index);
- *index = true;
-
- HAL_Report(HALUsageReporting::kResourceType_DigitalFilter, m_channelIndex);
-}
-
-DigitalGlitchFilter::~DigitalGlitchFilter() {
- if (m_channelIndex >= 0) {
- std::lock_guard<priority_mutex> sync(m_mutex);
- m_filterAllocated[m_channelIndex] = false;
- }
-}
-
-/**
- * Assigns the DigitalSource to this glitch filter.
- *
- * @param input The DigitalSource to add.
- */
-void DigitalGlitchFilter::Add(DigitalSource* input) {
- DoAdd(input, m_channelIndex + 1);
-}
-
-void DigitalGlitchFilter::DoAdd(DigitalSource* input, int requested_index) {
- // Some sources from Counters and Encoders are null. By pushing the check
- // here, we catch the issue more generally.
- if (input) {
- // we don't support GlitchFilters on AnalogTriggers.
- if (input->IsAnalogTrigger()) {
- wpi_setErrorWithContext(
- -1, "Analog Triggers not supported for DigitalGlitchFilters");
- return;
- }
- int32_t status = 0;
- HAL_SetFilterSelect(input->GetPortHandleForRouting(), requested_index,
- &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- // Validate that we set it correctly.
- int actual_index =
- HAL_GetFilterSelect(input->GetPortHandleForRouting(), &status);
- wpi_assertEqual(actual_index, requested_index);
-
- HAL_Report(HALUsageReporting::kResourceType_DigitalInput,
- input->GetChannel());
- }
-}
-
-/**
- * Assigns the Encoder to this glitch filter.
- *
- * @param input The Encoder to add.
- */
-void DigitalGlitchFilter::Add(Encoder* input) {
- Add(input->m_aSource.get());
- if (StatusIsFatal()) {
- return;
- }
- Add(input->m_bSource.get());
-}
-
-/**
- * Assigns the Counter to this glitch filter.
- *
- * @param input The Counter to add.
- */
-void DigitalGlitchFilter::Add(Counter* input) {
- Add(input->m_upSource.get());
- if (StatusIsFatal()) {
- return;
- }
- Add(input->m_downSource.get());
-}
-
-/**
- * Removes a digital input from this filter.
- *
- * Removes the DigitalSource from this glitch filter and re-assigns it to
- * the default filter.
- *
- * @param input The DigitalSource to remove.
- */
-void DigitalGlitchFilter::Remove(DigitalSource* input) { DoAdd(input, 0); }
-
-/**
- * Removes an encoder from this filter.
- *
- * Removes the Encoder from this glitch filter and re-assigns it to
- * the default filter.
- *
- * @param input The Encoder to remove.
- */
-void DigitalGlitchFilter::Remove(Encoder* input) {
- Remove(input->m_aSource.get());
- if (StatusIsFatal()) {
- return;
- }
- Remove(input->m_bSource.get());
-}
-
-/**
- * Removes a counter from this filter.
- *
- * Removes the Counter from this glitch filter and re-assigns it to
- * the default filter.
- *
- * @param input The Counter to remove.
- */
-void DigitalGlitchFilter::Remove(Counter* input) {
- Remove(input->m_upSource.get());
- if (StatusIsFatal()) {
- return;
- }
- Remove(input->m_downSource.get());
-}
-
-/**
- * Sets the number of cycles that the input must not change state for.
- *
- * @param fpga_cycles The number of FPGA cycles.
- */
-void DigitalGlitchFilter::SetPeriodCycles(int fpga_cycles) {
- int32_t status = 0;
- HAL_SetFilterPeriod(m_channelIndex, fpga_cycles, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Sets the number of nanoseconds that the input must not change state for.
- *
- * @param nanoseconds The number of nanoseconds.
- */
-void DigitalGlitchFilter::SetPeriodNanoSeconds(uint64_t nanoseconds) {
- int32_t status = 0;
- int fpga_cycles =
- nanoseconds * HAL_GetSystemClockTicksPerMicrosecond() / 4 / 1000;
- HAL_SetFilterPeriod(m_channelIndex, fpga_cycles, &status);
-
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Gets the number of cycles that the input must not change state for.
- *
- * @return The number of cycles.
- */
-int DigitalGlitchFilter::GetPeriodCycles() {
- int32_t status = 0;
- int fpga_cycles = HAL_GetFilterPeriod(m_channelIndex, &status);
-
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- return fpga_cycles;
-}
-
-/**
- * Gets the number of nanoseconds that the input must not change state for.
- *
- * @return The number of nanoseconds.
- */
-uint64_t DigitalGlitchFilter::GetPeriodNanoSeconds() {
- int32_t status = 0;
- int fpga_cycles = HAL_GetFilterPeriod(m_channelIndex, &status);
-
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- return static_cast<uint64_t>(fpga_cycles) * 1000L /
- static_cast<uint64_t>(HAL_GetSystemClockTicksPerMicrosecond() / 4);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/DigitalInput.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/DigitalInput.cpp
deleted file mode 100644
index f7c3f8a..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/DigitalInput.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "DigitalInput.h"
-
-#include <limits>
-#include <sstream>
-
-#include "HAL/DIO.h"
-#include "HAL/HAL.h"
-#include "HAL/Ports.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Create an instance of a Digital Input class.
- *
- * Creates a digital input given a channel.
- *
- * @param channel The DIO channel 0-9 are on-board, 10-25 are on the MXP port
- */
-DigitalInput::DigitalInput(int channel) {
- std::stringstream buf;
-
- if (!CheckDigitalChannel(channel)) {
- buf << "Digital Channel " << channel;
- wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
- m_channel = std::numeric_limits<int>::max();
- return;
- }
- m_channel = channel;
-
- int32_t status = 0;
- m_handle = HAL_InitializeDIOPort(HAL_GetPort(channel), true, &status);
- if (status != 0) {
- wpi_setErrorWithContextRange(status, 0, HAL_GetNumDigitalChannels(),
- channel, HAL_GetErrorMessage(status));
- m_handle = HAL_kInvalidHandle;
- m_channel = std::numeric_limits<int>::max();
- return;
- }
-
- HAL_Report(HALUsageReporting::kResourceType_DigitalInput, channel);
-}
-
-/**
- * Free resources associated with the Digital Input class.
- */
-DigitalInput::~DigitalInput() {
- if (StatusIsFatal()) return;
- if (m_interrupt != HAL_kInvalidHandle) {
- int32_t status = 0;
- HAL_CleanInterrupts(m_interrupt, &status);
- // ignore status, as an invalid handle just needs to be ignored.
- m_interrupt = HAL_kInvalidHandle;
- }
-
- HAL_FreeDIOPort(m_handle);
-}
-
-/**
- * Get the value from a digital input channel.
- *
- * Retrieve the value of a single digital input channel from the FPGA.
- */
-bool DigitalInput::Get() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool value = HAL_GetDIO(m_handle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * @return The GPIO channel number that this object represents.
- */
-int DigitalInput::GetChannel() const { return m_channel; }
-
-/**
- * @return The HAL Handle to the specified source.
- */
-HAL_Handle DigitalInput::GetPortHandleForRouting() const { return m_handle; }
-
-/**
- * Is source an AnalogTrigger
- */
-bool DigitalInput::IsAnalogTrigger() const { return false; }
-
-/**
- * @return The type of analog trigger output to be used. 0 for Digitals
- */
-AnalogTriggerType DigitalInput::GetAnalogTriggerTypeForRouting() const {
- return (AnalogTriggerType)0;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/DigitalOutput.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/DigitalOutput.cpp
deleted file mode 100644
index b46ef13..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/DigitalOutput.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "DigitalOutput.h"
-
-#include <limits>
-#include <sstream>
-
-#include "HAL/DIO.h"
-#include "HAL/HAL.h"
-#include "HAL/Ports.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Create an instance of a digital output.
- *
- * Create a digital output given a channel.
- *
- * @param channel The digital channel 0-9 are on-board, 10-25 are on the MXP
- * port
- */
-DigitalOutput::DigitalOutput(int channel) {
- std::stringstream buf;
-
- m_pwmGenerator = HAL_kInvalidHandle;
- if (!CheckDigitalChannel(channel)) {
- buf << "Digital Channel " << channel;
- wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
- m_channel = std::numeric_limits<int>::max();
- return;
- }
- m_channel = channel;
-
- int32_t status = 0;
- m_handle = HAL_InitializeDIOPort(HAL_GetPort(channel), false, &status);
- if (status != 0) {
- wpi_setErrorWithContextRange(status, 0, HAL_GetNumDigitalChannels(),
- channel, HAL_GetErrorMessage(status));
- m_channel = std::numeric_limits<int>::max();
- m_handle = HAL_kInvalidHandle;
- return;
- }
-
- HAL_Report(HALUsageReporting::kResourceType_DigitalOutput, channel);
-}
-
-/**
- * Free the resources associated with a digital output.
- */
-DigitalOutput::~DigitalOutput() {
- if (StatusIsFatal()) return;
- // Disable the PWM in case it was running.
- DisablePWM();
-
- HAL_FreeDIOPort(m_handle);
-}
-
-/**
- * Set the value of a digital output.
- *
- * Set the value of a digital output to either one (true) or zero (false).
- *
- * @param value 1 (true) for high, 0 (false) for disabled
- */
-void DigitalOutput::Set(bool value) {
- if (StatusIsFatal()) return;
-
- int32_t status = 0;
- HAL_SetDIO(m_handle, value, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Gets the value being output from the Digital Output.
- *
- * @return the state of the digital output.
- */
-bool DigitalOutput::Get() const {
- if (StatusIsFatal()) return false;
-
- int32_t status = 0;
- bool val = HAL_GetDIO(m_handle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return val;
-}
-
-/**
- * @return The GPIO channel number that this object represents.
- */
-int DigitalOutput::GetChannel() const { return m_channel; }
-
-/**
- * Output a single pulse on the digital output line.
- *
- * Send a single pulse on the digital output line where the pulse duration is
- * specified in seconds. Maximum pulse length is 0.0016 seconds.
- *
- * @param length The pulse length in seconds
- */
-void DigitalOutput::Pulse(double length) {
- if (StatusIsFatal()) return;
-
- int32_t status = 0;
- HAL_Pulse(m_handle, length, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Determine if the pulse is still going.
- *
- * Determine if a previously started pulse is still going.
- */
-bool DigitalOutput::IsPulsing() const {
- if (StatusIsFatal()) return false;
-
- int32_t status = 0;
- bool value = HAL_IsPulsing(m_handle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Change the PWM frequency of the PWM output on a Digital Output line.
- *
- * The valid range is from 0.6 Hz to 19 kHz. The frequency resolution is
- * logarithmic.
- *
- * There is only one PWM frequency for all digital channels.
- *
- * @param rate The frequency to output all digital output PWM signals.
- */
-void DigitalOutput::SetPWMRate(double rate) {
- if (StatusIsFatal()) return;
-
- int32_t status = 0;
- HAL_SetDigitalPWMRate(rate, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Enable a PWM Output on this line.
- *
- * Allocate one of the 6 DO PWM generator resources from this module.
- *
- * Supply the initial duty-cycle to output so as to avoid a glitch when first
- * starting.
- *
- * The resolution of the duty cycle is 8-bit for low frequencies (1kHz or less)
- * but is reduced the higher the frequency of the PWM signal is.
- *
- * @param initialDutyCycle The duty-cycle to start generating. [0..1]
- */
-void DigitalOutput::EnablePWM(double initialDutyCycle) {
- if (m_pwmGenerator != HAL_kInvalidHandle) return;
-
- int32_t status = 0;
-
- if (StatusIsFatal()) return;
- m_pwmGenerator = HAL_AllocateDigitalPWM(&status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- if (StatusIsFatal()) return;
- HAL_SetDigitalPWMDutyCycle(m_pwmGenerator, initialDutyCycle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- if (StatusIsFatal()) return;
- HAL_SetDigitalPWMOutputChannel(m_pwmGenerator, m_channel, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Change this line from a PWM output back to a static Digital Output line.
- *
- * Free up one of the 6 DO PWM generator resources that were in use.
- */
-void DigitalOutput::DisablePWM() {
- if (StatusIsFatal()) return;
- if (m_pwmGenerator == HAL_kInvalidHandle) return;
-
- int32_t status = 0;
-
- // Disable the output by routing to a dead bit.
- HAL_SetDigitalPWMOutputChannel(m_pwmGenerator, kDigitalChannels, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- HAL_FreeDigitalPWM(m_pwmGenerator, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- m_pwmGenerator = HAL_kInvalidHandle;
-}
-
-/**
- * Change the duty-cycle that is being generated on the line.
- *
- * The resolution of the duty cycle is 8-bit for low frequencies (1kHz or less)
- * but is reduced the higher the frequency of the PWM signal is.
- *
- * @param dutyCycle The duty-cycle to change to. [0..1]
- */
-void DigitalOutput::UpdateDutyCycle(double dutyCycle) {
- if (StatusIsFatal()) return;
-
- int32_t status = 0;
- HAL_SetDigitalPWMDutyCycle(m_pwmGenerator, dutyCycle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * @return The HAL Handle to the specified source.
- */
-HAL_Handle DigitalOutput::GetPortHandleForRouting() const { return m_handle; }
-
-/**
- * Is source an AnalogTrigger
- */
-bool DigitalOutput::IsAnalogTrigger() const { return false; }
-
-/**
- * @return The type of analog trigger output to be used. 0 for Digitals
- */
-AnalogTriggerType DigitalOutput::GetAnalogTriggerTypeForRouting() const {
- return (AnalogTriggerType)0;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/DoubleSolenoid.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/DoubleSolenoid.cpp
deleted file mode 100644
index 1954ada..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/DoubleSolenoid.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "DoubleSolenoid.h"
-
-#include <sstream>
-
-#include "HAL/HAL.h"
-#include "HAL/Ports.h"
-#include "HAL/Solenoid.h"
-#include "LiveWindow/LiveWindow.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Constructor.
- *
- * Uses the default PCM ID of 0.
- *
- * @param forwardChannel The forward channel number on the PCM (0..7).
- * @param reverseChannel The reverse channel number on the PCM (0..7).
- */
-DoubleSolenoid::DoubleSolenoid(int forwardChannel, int reverseChannel)
- : DoubleSolenoid(GetDefaultSolenoidModule(), forwardChannel,
- reverseChannel) {}
-
-/**
- * Constructor.
- *
- * @param moduleNumber The CAN ID of the PCM.
- * @param forwardChannel The forward channel on the PCM to control (0..7).
- * @param reverseChannel The reverse channel on the PCM to control (0..7).
- */
-DoubleSolenoid::DoubleSolenoid(int moduleNumber, int forwardChannel,
- int reverseChannel)
- : SolenoidBase(moduleNumber),
- m_forwardChannel(forwardChannel),
- m_reverseChannel(reverseChannel) {
- std::stringstream buf;
- if (!CheckSolenoidModule(m_moduleNumber)) {
- buf << "Solenoid Module " << m_moduleNumber;
- wpi_setWPIErrorWithContext(ModuleIndexOutOfRange, buf.str());
- return;
- }
- if (!CheckSolenoidChannel(m_forwardChannel)) {
- buf << "Solenoid Module " << m_forwardChannel;
- wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
- return;
- }
- if (!CheckSolenoidChannel(m_reverseChannel)) {
- buf << "Solenoid Module " << m_reverseChannel;
- wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
- return;
- }
- int32_t status = 0;
- m_forwardHandle = HAL_InitializeSolenoidPort(
- HAL_GetPortWithModule(moduleNumber, m_forwardChannel), &status);
- if (status != 0) {
- wpi_setErrorWithContextRange(status, 0, HAL_GetNumSolenoidChannels(),
- forwardChannel, HAL_GetErrorMessage(status));
- m_forwardHandle = HAL_kInvalidHandle;
- m_reverseHandle = HAL_kInvalidHandle;
- return;
- }
-
- m_reverseHandle = HAL_InitializeSolenoidPort(
- HAL_GetPortWithModule(moduleNumber, m_reverseChannel), &status);
- if (status != 0) {
- wpi_setErrorWithContextRange(status, 0, HAL_GetNumSolenoidChannels(),
- reverseChannel, HAL_GetErrorMessage(status));
- // free forward solenoid
- HAL_FreeSolenoidPort(m_forwardHandle);
- m_forwardHandle = HAL_kInvalidHandle;
- m_reverseHandle = HAL_kInvalidHandle;
- return;
- }
-
- m_forwardMask = 1 << m_forwardChannel;
- m_reverseMask = 1 << m_reverseChannel;
-
- HAL_Report(HALUsageReporting::kResourceType_Solenoid, m_forwardChannel,
- m_moduleNumber);
- HAL_Report(HALUsageReporting::kResourceType_Solenoid, m_reverseChannel,
- m_moduleNumber);
- LiveWindow::GetInstance()->AddActuator("DoubleSolenoid", m_moduleNumber,
- m_forwardChannel, this);
-}
-
-/**
- * Destructor.
- */
-DoubleSolenoid::~DoubleSolenoid() {
- HAL_FreeSolenoidPort(m_forwardHandle);
- HAL_FreeSolenoidPort(m_reverseHandle);
- if (m_table != nullptr) m_table->RemoveTableListener(this);
-}
-
-/**
- * Set the value of a solenoid.
- *
- * @param value The value to set (Off, Forward or Reverse)
- */
-void DoubleSolenoid::Set(Value value) {
- if (StatusIsFatal()) return;
-
- bool forward = false;
- bool reverse = false;
- switch (value) {
- case kOff:
- forward = false;
- reverse = false;
- break;
- case kForward:
- forward = true;
- reverse = false;
- break;
- case kReverse:
- forward = false;
- reverse = true;
- break;
- }
- int fstatus = 0;
- HAL_SetSolenoid(m_forwardHandle, forward, &fstatus);
- int rstatus = 0;
- HAL_SetSolenoid(m_reverseHandle, reverse, &rstatus);
-
- wpi_setErrorWithContext(fstatus, HAL_GetErrorMessage(fstatus));
- wpi_setErrorWithContext(rstatus, HAL_GetErrorMessage(rstatus));
-}
-
-/**
- * Read the current value of the solenoid.
- *
- * @return The current value of the solenoid.
- */
-DoubleSolenoid::Value DoubleSolenoid::Get() const {
- if (StatusIsFatal()) return kOff;
- int fstatus = 0;
- int rstatus = 0;
- bool valueForward = HAL_GetSolenoid(m_forwardHandle, &fstatus);
- bool valueReverse = HAL_GetSolenoid(m_reverseHandle, &rstatus);
-
- wpi_setErrorWithContext(fstatus, HAL_GetErrorMessage(fstatus));
- wpi_setErrorWithContext(rstatus, HAL_GetErrorMessage(rstatus));
-
- if (valueForward) return kForward;
- if (valueReverse) return kReverse;
- return kOff;
-}
-/**
- * Check if the forward solenoid is blacklisted.
- *
- * If a solenoid is shorted, it is added to the blacklist and
- * disabled until power cycle, or until faults are cleared.
- * @see ClearAllPCMStickyFaults()
- *
- * @return If solenoid is disabled due to short.
- */
-bool DoubleSolenoid::IsFwdSolenoidBlackListed() const {
- int blackList = GetPCMSolenoidBlackList(m_moduleNumber);
- return (blackList & m_forwardMask) ? 1 : 0;
-}
-/**
- * Check if the reverse solenoid is blacklisted.
- *
- * If a solenoid is shorted, it is added to the blacklist and
- * disabled until power cycle, or until faults are cleared.
- * @see ClearAllPCMStickyFaults()
- *
- * @return If solenoid is disabled due to short.
- */
-bool DoubleSolenoid::IsRevSolenoidBlackListed() const {
- int blackList = GetPCMSolenoidBlackList(m_moduleNumber);
- return (blackList & m_reverseMask) ? 1 : 0;
-}
-
-void DoubleSolenoid::ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value,
- bool isNew) {
- if (!value->IsString()) return;
- Value lvalue = kOff;
- if (value->GetString() == "Forward")
- lvalue = kForward;
- else if (value->GetString() == "Reverse")
- lvalue = kReverse;
- Set(lvalue);
-}
-
-void DoubleSolenoid::UpdateTable() {
- if (m_table != nullptr) {
- m_table->PutString(
- "Value", (Get() == kForward ? "Forward"
- : (Get() == kReverse ? "Reverse" : "Off")));
- }
-}
-
-void DoubleSolenoid::StartLiveWindowMode() {
- Set(kOff);
- if (m_table != nullptr) {
- m_table->AddTableListener("Value", this, true);
- }
-}
-
-void DoubleSolenoid::StopLiveWindowMode() {
- Set(kOff);
- if (m_table != nullptr) {
- m_table->RemoveTableListener(this);
- }
-}
-
-std::string DoubleSolenoid::GetSmartDashboardType() const {
- return "Double Solenoid";
-}
-
-void DoubleSolenoid::InitTable(std::shared_ptr<ITable> subTable) {
- m_table = subTable;
- UpdateTable();
-}
-
-std::shared_ptr<ITable> DoubleSolenoid::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/DriverStation.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/DriverStation.cpp
deleted file mode 100644
index 50b610d..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/DriverStation.cpp
+++ /dev/null
@@ -1,629 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "DriverStation.h"
-
-#include <chrono>
-
-#include "AnalogInput.h"
-#include "FRC_NetworkCommunication/FRCComm.h"
-#include "HAL/HAL.h"
-#include "HAL/Power.h"
-#include "Timer.h"
-#include "Utility.h"
-#include "WPIErrors.h"
-#include "llvm/SmallString.h"
-
-using namespace frc;
-
-const double JOYSTICK_UNPLUGGED_MESSAGE_INTERVAL = 1.0;
-
-const int DriverStation::kJoystickPorts;
-
-DriverStation::~DriverStation() {
- m_isRunning = false;
- m_dsThread.join();
-}
-
-/**
- * Return a pointer to the singleton DriverStation.
- *
- * @return Pointer to the DS instance
- */
-DriverStation& DriverStation::GetInstance() {
- static DriverStation instance;
- return instance;
-}
-
-/**
- * Report an error to the DriverStation messages window.
- *
- * The error is also printed to the program console.
- */
-void DriverStation::ReportError(llvm::StringRef error) {
- llvm::SmallString<128> temp;
- HAL_SendError(1, 1, 0, error.c_str(temp), "", "", 1);
-}
-
-/**
- * Report a warning to the DriverStation messages window.
- *
- * The warning is also printed to the program console.
- */
-void DriverStation::ReportWarning(llvm::StringRef error) {
- llvm::SmallString<128> temp;
- HAL_SendError(0, 1, 0, error.c_str(temp), "", "", 1);
-}
-
-/**
- * Report an error to the DriverStation messages window.
- *
- * The error is also printed to the program console.
- */
-void DriverStation::ReportError(bool is_error, int32_t code,
- llvm::StringRef error, llvm::StringRef location,
- llvm::StringRef stack) {
- llvm::SmallString<128> errorTemp;
- llvm::SmallString<128> locationTemp;
- llvm::SmallString<128> stackTemp;
- HAL_SendError(is_error, code, 0, error.c_str(errorTemp),
- location.c_str(locationTemp), stack.c_str(stackTemp), 1);
-}
-
-/**
- * Get the value of the axis on a joystick.
- *
- * This depends on the mapping of the joystick connected to the specified port.
- *
- * @param stick The joystick to read.
- * @param axis The analog axis value to read from the joystick.
- * @return The value of the axis on the joystick.
- */
-double DriverStation::GetStickAxis(int stick, int axis) {
- if (stick >= kJoystickPorts) {
- wpi_setWPIError(BadJoystickIndex);
- return 0;
- }
- std::unique_lock<priority_mutex> lock(m_joystickDataMutex);
- if (axis >= m_joystickAxes[stick].count) {
- // Unlock early so error printing isn't locked.
- m_joystickDataMutex.unlock();
- lock.release();
- if (axis >= HAL_kMaxJoystickAxes)
- wpi_setWPIError(BadJoystickAxis);
- return 0.0;
- }
-
- return m_joystickAxes[stick].axes[axis];
-}
-
-/**
- * Get the state of a POV on the joystick.
- *
- * @return the angle of the POV in degrees, or -1 if the POV is not pressed.
- */
-int DriverStation::GetStickPOV(int stick, int pov) {
- if (stick >= kJoystickPorts) {
- wpi_setWPIError(BadJoystickIndex);
- return -1;
- }
- std::unique_lock<priority_mutex> lock(m_joystickDataMutex);
- if (pov >= m_joystickPOVs[stick].count) {
- // Unlock early so error printing isn't locked.
- lock.unlock();
- if (pov >= HAL_kMaxJoystickPOVs)
- wpi_setWPIError(BadJoystickAxis);
- return -1;
- }
-
- return m_joystickPOVs[stick].povs[pov];
-}
-
-/**
- * The state of the buttons on the joystick.
- *
- * @param stick The joystick to read.
- * @return The state of the buttons on the joystick.
- */
-int DriverStation::GetStickButtons(int stick) const {
- if (stick >= kJoystickPorts) {
- wpi_setWPIError(BadJoystickIndex);
- return 0;
- }
- std::lock_guard<priority_mutex> lock(m_joystickDataMutex);
- return m_joystickButtons[stick].buttons;
-}
-
-/**
- * The state of one joystick button. Button indexes begin at 1.
- *
- * @param stick The joystick to read.
- * @param button The button index, beginning at 1.
- * @return The state of the joystick button.
- */
-bool DriverStation::GetStickButton(int stick, int button) {
- if (stick >= kJoystickPorts) {
- wpi_setWPIError(BadJoystickIndex);
- return false;
- }
- if (button == 0) {
- return false;
- }
- std::unique_lock<priority_mutex> lock(m_joystickDataMutex);
- if (button > m_joystickButtons[stick].count) {
- // Unlock early so error printing isn't locked.
- lock.unlock();
- return false;
- }
-
- return ((0x1 << (button - 1)) & m_joystickButtons[stick].buttons) != 0;
-}
-
-/**
- * Returns the number of axes on a given joystick port.
- *
- * @param stick The joystick port number
- * @return The number of axes on the indicated joystick
- */
-int DriverStation::GetStickAxisCount(int stick) const {
- if (stick >= kJoystickPorts) {
- wpi_setWPIError(BadJoystickIndex);
- return 0;
- }
- std::lock_guard<priority_mutex> lock(m_joystickDataMutex);
- return m_joystickAxes[stick].count;
-}
-
-/**
- * Returns the number of POVs on a given joystick port.
- *
- * @param stick The joystick port number
- * @return The number of POVs on the indicated joystick
- */
-int DriverStation::GetStickPOVCount(int stick) const {
- if (stick >= kJoystickPorts) {
- wpi_setWPIError(BadJoystickIndex);
- return 0;
- }
- std::lock_guard<priority_mutex> lock(m_joystickDataMutex);
- return m_joystickPOVs[stick].count;
-}
-
-/**
- * Returns the number of buttons on a given joystick port.
- *
- * @param stick The joystick port number
- * @return The number of buttons on the indicated joystick
- */
-int DriverStation::GetStickButtonCount(int stick) const {
- if (stick >= kJoystickPorts) {
- wpi_setWPIError(BadJoystickIndex);
- return 0;
- }
- std::lock_guard<priority_mutex> lock(m_joystickDataMutex);
- return m_joystickButtons[stick].count;
-}
-
-/**
- * Returns a boolean indicating if the controller is an xbox controller.
- *
- * @param stick The joystick port number
- * @return A boolean that is true if the controller is an xbox controller.
- */
-bool DriverStation::GetJoystickIsXbox(int stick) const {
- if (stick >= kJoystickPorts) {
- wpi_setWPIError(BadJoystickIndex);
- return false;
- }
- std::lock_guard<priority_mutex> lock(m_joystickDataMutex);
- return static_cast<bool>(m_joystickDescriptor[stick].isXbox);
-}
-
-/**
- * Returns the type of joystick at a given port.
- *
- * @param stick The joystick port number
- * @return The HID type of joystick at the given port
- */
-int DriverStation::GetJoystickType(int stick) const {
- if (stick >= kJoystickPorts) {
- wpi_setWPIError(BadJoystickIndex);
- return -1;
- }
- std::lock_guard<priority_mutex> lock(m_joystickDataMutex);
- return static_cast<int>(m_joystickDescriptor[stick].type);
-}
-
-/**
- * Returns the name of the joystick at the given port.
- *
- * @param stick The joystick port number
- * @return The name of the joystick at the given port
- */
-std::string DriverStation::GetJoystickName(int stick) const {
- if (stick >= kJoystickPorts) {
- wpi_setWPIError(BadJoystickIndex);
- }
- std::lock_guard<priority_mutex> lock(m_joystickDataMutex);
- std::string retVal(m_joystickDescriptor[stick].name);
- return retVal;
-}
-
-/**
- * Returns the types of Axes on a given joystick port.
- *
- * @param stick The joystick port number and the target axis
- * @return What type of axis the axis is reporting to be
- */
-int DriverStation::GetJoystickAxisType(int stick, int axis) const {
- if (stick >= kJoystickPorts) {
- wpi_setWPIError(BadJoystickIndex);
- return -1;
- }
- std::lock_guard<priority_mutex> lock(m_joystickDataMutex);
- return m_joystickDescriptor[stick].axisTypes[axis];
-}
-
-/**
- * Check if the DS has enabled the robot.
- *
- * @return True if the robot is enabled and the DS is connected
- */
-bool DriverStation::IsEnabled() const {
- HAL_ControlWord controlWord;
- UpdateControlWord(false, controlWord);
- return controlWord.enabled && controlWord.dsAttached;
-}
-
-/**
- * Check if the robot is disabled.
- *
- * @return True if the robot is explicitly disabled or the DS is not connected
- */
-bool DriverStation::IsDisabled() const {
- HAL_ControlWord controlWord;
- UpdateControlWord(false, controlWord);
- return !(controlWord.enabled && controlWord.dsAttached);
-}
-
-/**
- * Check if the DS is commanding autonomous mode.
- *
- * @return True if the robot is being commanded to be in autonomous mode
- */
-bool DriverStation::IsAutonomous() const {
- HAL_ControlWord controlWord;
- UpdateControlWord(false, controlWord);
- return controlWord.autonomous;
-}
-
-/**
- * Check if the DS is commanding teleop mode.
- *
- * @return True if the robot is being commanded to be in teleop mode
- */
-bool DriverStation::IsOperatorControl() const {
- HAL_ControlWord controlWord;
- UpdateControlWord(false, controlWord);
- return !(controlWord.autonomous || controlWord.test);
-}
-
-/**
- * Check if the DS is commanding test mode.
- *
- * @return True if the robot is being commanded to be in test mode
- */
-bool DriverStation::IsTest() const {
- HAL_ControlWord controlWord;
- UpdateControlWord(false, controlWord);
- return controlWord.test;
-}
-
-/**
- * Check if the DS is attached.
- *
- * @return True if the DS is connected to the robot
- */
-bool DriverStation::IsDSAttached() const {
- HAL_ControlWord controlWord;
- UpdateControlWord(false, controlWord);
- return controlWord.dsAttached;
-}
-
-/**
- * Has a new control packet from the driver station arrived since the last time
- * this function was called?
- *
- * Warning: If you call this function from more than one place at the same time,
- * you will not get the intended behavior.
- *
- * @return True if the control data has been updated since the last call.
- */
-bool DriverStation::IsNewControlData() const {
- return m_newControlData.exchange(false);
-}
-
-/**
- * Is the driver station attached to a Field Management System?
- *
- * @return True if the robot is competing on a field being controlled by a Field
- * Management System
- */
-bool DriverStation::IsFMSAttached() const {
- HAL_ControlWord controlWord;
- UpdateControlWord(false, controlWord);
- return controlWord.fmsAttached;
-}
-
-/**
- * Check if the FPGA outputs are enabled.
- *
- * The outputs may be disabled if the robot is disabled or e-stopped, the
- * watchdog has expired, or if the roboRIO browns out.
- *
- * @return True if the FPGA outputs are enabled.
- */
-bool DriverStation::IsSysActive() const {
- int32_t status = 0;
- bool retVal = HAL_GetSystemActive(&status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Check if the system is browned out.
- *
- * @return True if the system is browned out
- */
-bool DriverStation::IsBrownedOut() const {
- int32_t status = 0;
- bool retVal = HAL_GetBrownedOut(&status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Return the alliance that the driver station says it is on.
- *
- * This could return kRed or kBlue.
- *
- * @return The Alliance enum (kRed, kBlue or kInvalid)
- */
-DriverStation::Alliance DriverStation::GetAlliance() const {
- int32_t status = 0;
- auto allianceStationID = HAL_GetAllianceStation(&status);
- switch (allianceStationID) {
- case HAL_AllianceStationID_kRed1:
- case HAL_AllianceStationID_kRed2:
- case HAL_AllianceStationID_kRed3:
- return kRed;
- case HAL_AllianceStationID_kBlue1:
- case HAL_AllianceStationID_kBlue2:
- case HAL_AllianceStationID_kBlue3:
- return kBlue;
- default:
- return kInvalid;
- }
-}
-
-/**
- * Return the driver station location on the field.
- *
- * This could return 1, 2, or 3.
- *
- * @return The location of the driver station (1-3, 0 for invalid)
- */
-int DriverStation::GetLocation() const {
- int32_t status = 0;
- auto allianceStationID = HAL_GetAllianceStation(&status);
- switch (allianceStationID) {
- case HAL_AllianceStationID_kRed1:
- case HAL_AllianceStationID_kBlue1:
- return 1;
- case HAL_AllianceStationID_kRed2:
- case HAL_AllianceStationID_kBlue2:
- return 2;
- case HAL_AllianceStationID_kRed3:
- case HAL_AllianceStationID_kBlue3:
- return 3;
- default:
- return 0;
- }
-}
-
-/**
- * Wait until a new packet comes from the driver station.
- *
- * This blocks on a semaphore, so the waiting is efficient.
- *
- * This is a good way to delay processing until there is new driver station data
- * to act on.
- */
-void DriverStation::WaitForData() { WaitForData(0); }
-
-/**
- * Wait until a new packet comes from the driver station, or wait for a timeout.
- *
- * If the timeout is less then or equal to 0, wait indefinitely.
- *
- * Timeout is in milliseconds
- *
- * This blocks on a semaphore, so the waiting is efficient.
- *
- * This is a good way to delay processing until there is new driver station data
- * to act on.
- *
- * @param timeout Timeout time in seconds
- *
- * @return true if new data, otherwise false
- */
-bool DriverStation::WaitForData(double timeout) {
-#if defined(_MSC_VER) && _MSC_VER < 1900
- auto timeoutTime = std::chrono::steady_clock::now() +
- std::chrono::duration<int64_t, std::nano>(
- static_cast<int64_t>(timeout * 1e9));
-#else
- auto timeoutTime =
- std::chrono::steady_clock::now() + std::chrono::duration<double>(timeout);
-#endif
-
- std::unique_lock<priority_mutex> lock(m_waitForDataMutex);
- while (!m_waitForDataPredicate) {
- if (timeout > 0) {
- auto timedOut = m_waitForDataCond.wait_until(lock, timeoutTime);
- if (timedOut == std::cv_status::timeout) {
- return false;
- }
- } else {
- m_waitForDataCond.wait(lock);
- }
- }
- m_waitForDataPredicate = false;
- return true;
-}
-
-/**
- * Return the approximate match time.
- *
- * The FMS does not send an official match time to the robots, but does send an
- * approximate match time. The value will count down the time remaining in the
- * current period (auto or teleop).
- *
- * Warning: This is not an official time (so it cannot be used to dispute ref
- * calls or guarantee that a function will trigger before the match ends).
- *
- * The Practice Match function of the DS approximates the behaviour seen on the
- * field.
- *
- * @return Time remaining in current match period (auto or teleop)
- */
-double DriverStation::GetMatchTime() const {
- int32_t status;
- return HAL_GetMatchTime(&status);
-}
-
-/**
- * Read the battery voltage.
- *
- * @return The battery voltage in Volts.
- */
-double DriverStation::GetBatteryVoltage() const {
- int32_t status = 0;
- double voltage = HAL_GetVinVoltage(&status);
- wpi_setErrorWithContext(status, "getVinVoltage");
-
- return voltage;
-}
-
-/**
- * Copy data from the DS task for the user.
- *
- * If no new data exists, it will just be returned, otherwise
- * the data will be copied from the DS polling loop.
- */
-void DriverStation::GetData() {
- // Get the status of all of the joysticks, and save to the cache
- for (uint8_t stick = 0; stick < kJoystickPorts; stick++) {
- HAL_GetJoystickAxes(stick, &m_joystickAxesCache[stick]);
- HAL_GetJoystickPOVs(stick, &m_joystickPOVsCache[stick]);
- HAL_GetJoystickButtons(stick, &m_joystickButtonsCache[stick]);
- HAL_GetJoystickDescriptor(stick, &m_joystickDescriptorCache[stick]);
- }
- // Force a control word update, to make sure the data is the newest.
- HAL_ControlWord controlWord;
- UpdateControlWord(true, controlWord);
- // Obtain a write lock on the data, swap the cached data into the
- // main data arrays
- std::lock_guard<priority_mutex> lock(m_joystickDataMutex);
- m_joystickAxes.swap(m_joystickAxesCache);
- m_joystickPOVs.swap(m_joystickPOVsCache);
- m_joystickButtons.swap(m_joystickButtonsCache);
- m_joystickDescriptor.swap(m_joystickDescriptorCache);
-}
-
-/**
- * DriverStation constructor.
- *
- * This is only called once the first time GetInstance() is called
- */
-DriverStation::DriverStation() {
- m_joystickAxes = std::make_unique<HAL_JoystickAxes[]>(kJoystickPorts);
- m_joystickPOVs = std::make_unique<HAL_JoystickPOVs[]>(kJoystickPorts);
- m_joystickButtons = std::make_unique<HAL_JoystickButtons[]>(kJoystickPorts);
- m_joystickDescriptor =
- std::make_unique<HAL_JoystickDescriptor[]>(kJoystickPorts);
- m_joystickAxesCache = std::make_unique<HAL_JoystickAxes[]>(kJoystickPorts);
- m_joystickPOVsCache = std::make_unique<HAL_JoystickPOVs[]>(kJoystickPorts);
- m_joystickButtonsCache =
- std::make_unique<HAL_JoystickButtons[]>(kJoystickPorts);
- m_joystickDescriptorCache =
- std::make_unique<HAL_JoystickDescriptor[]>(kJoystickPorts);
-
- // All joysticks should default to having zero axes, povs and buttons, so
- // uninitialized memory doesn't get sent to speed controllers.
- for (unsigned int i = 0; i < kJoystickPorts; i++) {
- m_joystickAxes[i].count = 0;
- m_joystickPOVs[i].count = 0;
- m_joystickButtons[i].count = 0;
- m_joystickDescriptor[i].isXbox = 0;
- m_joystickDescriptor[i].type = -1;
- m_joystickDescriptor[i].name[0] = '\0';
-
- m_joystickAxesCache[i].count = 0;
- m_joystickPOVsCache[i].count = 0;
- m_joystickButtonsCache[i].count = 0;
- m_joystickDescriptorCache[i].isXbox = 0;
- m_joystickDescriptorCache[i].type = -1;
- m_joystickDescriptorCache[i].name[0] = '\0';
- }
-
- m_dsThread = std::thread(&DriverStation::Run, this);
-}
-
-void DriverStation::Run() {
- m_isRunning = true;
- while (m_isRunning) {
- HAL_WaitForDSData();
- GetData();
- // notify IsNewControlData variables
- m_newControlData = true;
-
- // notify WaitForData block
- {
- std::lock_guard<priority_mutex> lock(m_waitForDataMutex);
- m_waitForDataPredicate = true;
- }
- m_waitForDataCond.notify_all();
-
- if (m_userInDisabled) HAL_ObserveUserProgramDisabled();
- if (m_userInAutonomous) HAL_ObserveUserProgramAutonomous();
- if (m_userInTeleop) HAL_ObserveUserProgramTeleop();
- if (m_userInTest) HAL_ObserveUserProgramTest();
- }
-}
-
-/**
- * Gets ControlWord data from the cache. If 50ms has passed, or the force
- * parameter is set, the cached data is updated. Otherwise the data is just
- * copied from the cache.
- *
- * @param force True to force an update to the cache, otherwise update if 50ms
- * have passed.
- * @param controlWord Structure to put the return control word data into.
- */
-void DriverStation::UpdateControlWord(bool force,
- HAL_ControlWord& controlWord) const {
- auto now = std::chrono::steady_clock::now();
- std::lock_guard<priority_mutex> lock(m_controlWordMutex);
- // Update every 50 ms or on force.
- if ((now - m_lastControlWordUpdate > std::chrono::milliseconds(50)) ||
- force) {
- HAL_GetControlWord(&m_controlWordCache);
- m_lastControlWordUpdate = now;
- }
- controlWord = m_controlWordCache;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Encoder.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Encoder.cpp
deleted file mode 100644
index df55f1e..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Encoder.cpp
+++ /dev/null
@@ -1,474 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Encoder.h"
-
-#include "DigitalInput.h"
-#include "HAL/HAL.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Common initialization code for Encoders.
- *
- * This code allocates resources for Encoders and is common to all constructors.
- *
- * The counter will start counting immediately.
- *
- * @param reverseDirection If true, counts down instead of up (this is all
- * relative)
- * @param encodingType either k1X, k2X, or k4X to indicate 1X, 2X or 4X
- * decoding. If 4X is selected, then an encoder FPGA
- * object is used and the returned counts will be 4x
- * the encoder spec'd value since all rising and
- * falling edges are counted. If 1X or 2X are selected
- * then a counter object will be used and the returned
- * value will either exactly match the spec'd count or
- * be double (2x) the spec'd count.
- */
-void Encoder::InitEncoder(bool reverseDirection, EncodingType encodingType) {
- int32_t status = 0;
- m_encoder = HAL_InitializeEncoder(
- m_aSource->GetPortHandleForRouting(),
- (HAL_AnalogTriggerType)m_aSource->GetAnalogTriggerTypeForRouting(),
- m_bSource->GetPortHandleForRouting(),
- (HAL_AnalogTriggerType)m_bSource->GetAnalogTriggerTypeForRouting(),
- reverseDirection, (HAL_EncoderEncodingType)encodingType, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- HAL_Report(HALUsageReporting::kResourceType_Encoder, GetFPGAIndex(),
- encodingType);
-}
-
-/**
- * Encoder constructor.
- *
- * Construct a Encoder given a and b channels.
- *
- * The counter will start counting immediately.
- *
- * @param aChannel The a channel DIO channel. 0-9 are on-board, 10-25
- * are on the MXP port
- * @param bChannel The b channel DIO channel. 0-9 are on-board, 10-25
- * are on the MXP port
- * @param reverseDirection represents the orientation of the encoder and
- * inverts the output values if necessary so forward
- * represents positive values.
- * @param encodingType either k1X, k2X, or k4X to indicate 1X, 2X or 4X
- * decoding. If 4X is selected, then an encoder FPGA
- * object is used and the returned counts will be 4x
- * the encoder spec'd value since all rising and
- * falling edges are counted. If 1X or 2X are selected
- * then a counter object will be used and the returned
- * value will either exactly match the spec'd count or
- * be double (2x) the spec'd count.
- */
-Encoder::Encoder(int aChannel, int bChannel, bool reverseDirection,
- EncodingType encodingType) {
- m_aSource = std::make_shared<DigitalInput>(aChannel);
- m_bSource = std::make_shared<DigitalInput>(bChannel);
- InitEncoder(reverseDirection, encodingType);
-}
-
-/**
- * Encoder constructor.
- *
- * Construct a Encoder given a and b channels as digital inputs. This is used in
- * the case where the digital inputs are shared. The Encoder class will not
- * allocate the digital inputs and assume that they already are counted.
- *
- * The counter will start counting immediately.
- *
- * @param aSource The source that should be used for the a channel.
- * @param bSource the source that should be used for the b channel.
- * @param reverseDirection represents the orientation of the encoder and
- * inverts the output values if necessary so forward
- * represents positive values.
- * @param encodingType either k1X, k2X, or k4X to indicate 1X, 2X or 4X
- * decoding. If 4X is selected, then an encoder FPGA
- * object is used and the returned counts will be 4x
- * the encoder spec'd value since all rising and
- * falling edges are counted. If 1X or 2X are selected
- * then a counter object will be used and the returned
- * value will either exactly match the spec'd count or
- * be double (2x) the spec'd count.
- */
-Encoder::Encoder(DigitalSource* aSource, DigitalSource* bSource,
- bool reverseDirection, EncodingType encodingType)
- : m_aSource(aSource, NullDeleter<DigitalSource>()),
- m_bSource(bSource, NullDeleter<DigitalSource>()) {
- if (m_aSource == nullptr || m_bSource == nullptr)
- wpi_setWPIError(NullParameter);
- else
- InitEncoder(reverseDirection, encodingType);
-}
-
-Encoder::Encoder(std::shared_ptr<DigitalSource> aSource,
- std::shared_ptr<DigitalSource> bSource, bool reverseDirection,
- EncodingType encodingType)
- : m_aSource(aSource), m_bSource(bSource) {
- if (m_aSource == nullptr || m_bSource == nullptr)
- wpi_setWPIError(NullParameter);
- else
- InitEncoder(reverseDirection, encodingType);
-}
-
-/**
- * Encoder constructor.
- *
- * Construct a Encoder given a and b channels as digital inputs. This is used in
- * the case where the digital inputs are shared. The Encoder class will not
- * allocate the digital inputs and assume that they already are counted.
- *
- * The counter will start counting immediately.
- *
- * @param aSource The source that should be used for the a channel.
- * @param bSource the source that should be used for the b channel.
- * @param reverseDirection represents the orientation of the encoder and
- * inverts the output values if necessary so forward
- * represents positive values.
- * @param encodingType either k1X, k2X, or k4X to indicate 1X, 2X or 4X
- * decoding. If 4X is selected, then an encoder FPGA
- * object is used and the returned counts will be 4x
- * the encoder spec'd value since all rising and
- * falling edges are counted. If 1X or 2X are selected
- * then a counter object will be used and the returned
- * value will either exactly match the spec'd count or
- * be double (2x) the spec'd count.
- */
-Encoder::Encoder(DigitalSource& aSource, DigitalSource& bSource,
- bool reverseDirection, EncodingType encodingType)
- : m_aSource(&aSource, NullDeleter<DigitalSource>()),
- m_bSource(&bSource, NullDeleter<DigitalSource>()) {
- InitEncoder(reverseDirection, encodingType);
-}
-
-/**
- * Free the resources for an Encoder.
- *
- * Frees the FPGA resources associated with an Encoder.
- */
-Encoder::~Encoder() {
- int32_t status = 0;
- HAL_FreeEncoder(m_encoder, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * The encoding scale factor 1x, 2x, or 4x, per the requested encodingType.
- *
- * Used to divide raw edge counts down to spec'd counts.
- */
-int Encoder::GetEncodingScale() const {
- int32_t status = 0;
- int val = HAL_GetEncoderEncodingScale(m_encoder, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return val;
-}
-
-/**
- * Gets the raw value from the encoder.
- *
- * The raw value is the actual count unscaled by the 1x, 2x, or 4x scale
- * factor.
- *
- * @return Current raw count from the encoder
- */
-int Encoder::GetRaw() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
- int value = HAL_GetEncoderRaw(m_encoder, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Gets the current count.
- *
- * Returns the current count on the Encoder. This method compensates for the
- * decoding type.
- *
- * @return Current count from the Encoder adjusted for the 1x, 2x, or 4x scale
- * factor.
- */
-int Encoder::Get() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
- int value = HAL_GetEncoder(m_encoder, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Reset the Encoder distance to zero.
- *
- * Resets the current count to zero on the encoder.
- */
-void Encoder::Reset() {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_ResetEncoder(m_encoder, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Returns the period of the most recent pulse.
- *
- * Returns the period of the most recent Encoder pulse in seconds.
- * This method compensates for the decoding type.
- *
- * @deprecated Use GetRate() in favor of this method. This returns unscaled
- * periods and GetRate() scales using value from
- * SetDistancePerPulse().
- *
- * @return Period in seconds of the most recent pulse.
- */
-double Encoder::GetPeriod() const {
- if (StatusIsFatal()) return 0.0;
- int32_t status = 0;
- double value = HAL_GetEncoderPeriod(m_encoder, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Sets the maximum period for stopped detection.
- *
- * Sets the value that represents the maximum period of the Encoder before it
- * will assume that the attached device is stopped. This timeout allows users
- * to determine if the wheels or other shaft has stopped rotating.
- * This method compensates for the decoding type.
- *
- * @deprecated Use SetMinRate() in favor of this method. This takes unscaled
- * periods and SetMinRate() scales using value from
- * SetDistancePerPulse().
- *
- * @param maxPeriod The maximum time between rising and falling edges before
- * the FPGA will report the device stopped. This is expressed
- * in seconds.
- */
-void Encoder::SetMaxPeriod(double maxPeriod) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetEncoderMaxPeriod(m_encoder, maxPeriod, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Determine if the encoder is stopped.
- *
- * Using the MaxPeriod value, a boolean is returned that is true if the encoder
- * is considered stopped and false if it is still moving. A stopped encoder is
- * one where the most recent pulse width exceeds the MaxPeriod.
- *
- * @return True if the encoder is considered stopped.
- */
-bool Encoder::GetStopped() const {
- if (StatusIsFatal()) return true;
- int32_t status = 0;
- bool value = HAL_GetEncoderStopped(m_encoder, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * The last direction the encoder value changed.
- *
- * @return The last direction the encoder value changed.
- */
-bool Encoder::GetDirection() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool value = HAL_GetEncoderDirection(m_encoder, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * The scale needed to convert a raw counter value into a number of encoder
- * pulses.
- */
-double Encoder::DecodingScaleFactor() const {
- if (StatusIsFatal()) return 0.0;
- int32_t status = 0;
- double val = HAL_GetEncoderDecodingScaleFactor(m_encoder, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return val;
-}
-
-/**
- * Get the distance the robot has driven since the last reset.
- *
- * @return The distance driven since the last reset as scaled by the value from
- * SetDistancePerPulse().
- */
-double Encoder::GetDistance() const {
- if (StatusIsFatal()) return 0.0;
- int32_t status = 0;
- double value = HAL_GetEncoderDistance(m_encoder, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Get the current rate of the encoder.
- *
- * Units are distance per second as scaled by the value from
- * SetDistancePerPulse().
- *
- * @return The current rate of the encoder.
- */
-double Encoder::GetRate() const {
- if (StatusIsFatal()) return 0.0;
- int32_t status = 0;
- double value = HAL_GetEncoderRate(m_encoder, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Set the minimum rate of the device before the hardware reports it stopped.
- *
- * @param minRate The minimum rate. The units are in distance per second as
- * scaled by the value from SetDistancePerPulse().
- */
-void Encoder::SetMinRate(double minRate) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetEncoderMinRate(m_encoder, minRate, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set the distance per pulse for this encoder.
- *
- * This sets the multiplier used to determine the distance driven based on the
- * count value from the encoder.
- *
- * Do not include the decoding type in this scale. The library already
- * compensates for the decoding type.
- *
- * Set this value based on the encoder's rated Pulses per Revolution and
- * factor in gearing reductions following the encoder shaft.
- *
- * This distance can be in any units you like, linear or angular.
- *
- * @param distancePerPulse The scale factor that will be used to convert pulses
- * to useful units.
- */
-void Encoder::SetDistancePerPulse(double distancePerPulse) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetEncoderDistancePerPulse(m_encoder, distancePerPulse, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set the direction sensing for this encoder.
- *
- * This sets the direction sensing on the encoder so that it could count in the
- * correct software direction regardless of the mounting.
- *
- * @param reverseDirection true if the encoder direction should be reversed
- */
-void Encoder::SetReverseDirection(bool reverseDirection) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetEncoderReverseDirection(m_encoder, reverseDirection, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set the Samples to Average which specifies the number of samples of the timer
- * to average when calculating the period.
- *
- * Perform averaging to account for mechanical imperfections or as oversampling
- * to increase resolution.
- *
- * @param samplesToAverage The number of samples to average from 1 to 127.
- */
-void Encoder::SetSamplesToAverage(int samplesToAverage) {
- if (samplesToAverage < 1 || samplesToAverage > 127) {
- wpi_setWPIErrorWithContext(
- ParameterOutOfRange,
- "Average counter values must be between 1 and 127");
- return;
- }
- int32_t status = 0;
- HAL_SetEncoderSamplesToAverage(m_encoder, samplesToAverage, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Get the Samples to Average which specifies the number of samples of the timer
- * to average when calculating the period.
- *
- * Perform averaging to account for mechanical imperfections or as oversampling
- * to increase resolution.
- *
- * @return The number of samples being averaged (from 1 to 127)
- */
-int Encoder::GetSamplesToAverage() const {
- int32_t status = 0;
- int result = HAL_GetEncoderSamplesToAverage(m_encoder, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return result;
-}
-
-/**
- * Set the index source for the encoder.
- *
- * When this source is activated, the encoder count automatically resets.
- *
- * @param channel A DIO channel to set as the encoder index
- * @param type The state that will cause the encoder to reset
- */
-void Encoder::SetIndexSource(int channel, Encoder::IndexingType type) {
- // Force digital input if just given an index
- m_indexSource = std::make_unique<DigitalInput>(channel);
- SetIndexSource(m_indexSource.get(), type);
-}
-
-/**
- * Set the index source for the encoder.
- *
- * When this source is activated, the encoder count automatically resets.
- *
- * @param channel A digital source to set as the encoder index
- * @param type The state that will cause the encoder to reset
- */
-WPI_DEPRECATED("Use pass-by-reference instead.")
-void Encoder::SetIndexSource(DigitalSource* source,
- Encoder::IndexingType type) {
- SetIndexSource(*source, type);
-}
-
-/**
- * Set the index source for the encoder.
- *
- * When this source is activated, the encoder count automatically resets.
- *
- * @param channel A digital source to set as the encoder index
- * @param type The state that will cause the encoder to reset
- */
-void Encoder::SetIndexSource(const DigitalSource& source,
- Encoder::IndexingType type) {
- int32_t status = 0;
- HAL_SetEncoderIndexSource(
- m_encoder, source.GetPortHandleForRouting(),
- (HAL_AnalogTriggerType)source.GetAnalogTriggerTypeForRouting(),
- (HAL_EncoderIndexingType)type, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-int Encoder::GetFPGAIndex() const {
- int32_t status = 0;
- int val = HAL_GetEncoderFPGAIndex(m_encoder, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return val;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/GearTooth.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/GearTooth.cpp
deleted file mode 100644
index 210f12d..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/GearTooth.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "GearTooth.h"
-
-#include "LiveWindow/LiveWindow.h"
-
-using namespace frc;
-
-constexpr double GearTooth::kGearToothThreshold;
-
-/**
- * Common code called by the constructors.
- */
-void GearTooth::EnableDirectionSensing(bool directionSensitive) {
- if (directionSensitive) {
- SetPulseLengthMode(kGearToothThreshold);
- }
-}
-
-/**
- * Construct a GearTooth sensor given a channel.
- *
- * @param channel The DIO channel that the sensor is connected to.
- * 0-9 are on-board, 10-25 are on the MXP.
- * @param directionSensitive True to enable the pulse length decoding in
- * hardware to specify count direction.
- */
-GearTooth::GearTooth(int channel, bool directionSensitive) : Counter(channel) {
- EnableDirectionSensing(directionSensitive);
- LiveWindow::GetInstance()->AddSensor("GearTooth", channel, this);
-}
-
-/**
- * Construct a GearTooth sensor given a digital input.
- *
- * This should be used when sharing digital inputs.
- *
- * @param source A pointer to the existing DigitalSource object
- * (such as a DigitalInput)
- * @param directionSensitive True to enable the pulse length decoding in
- * hardware to specify count direction.
- */
-GearTooth::GearTooth(DigitalSource* source, bool directionSensitive)
- : Counter(source) {
- EnableDirectionSensing(directionSensitive);
-}
-
-/**
- * Construct a GearTooth sensor given a digital input.
- *
- * This should be used when sharing digital inputs.
- *
- * @param source A reference to the existing DigitalSource object
- * (such as a DigitalInput)
- * @param directionSensitive True to enable the pulse length decoding in
- * hardware to specify count direction.
- */
-GearTooth::GearTooth(std::shared_ptr<DigitalSource> source,
- bool directionSensitive)
- : Counter(source) {
- EnableDirectionSensing(directionSensitive);
-}
-
-std::string GearTooth::GetSmartDashboardType() const { return "GearTooth"; }
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/GenericHID.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/GenericHID.cpp
deleted file mode 100644
index 8878276..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/GenericHID.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "GenericHID.h"
-
-#include "DriverStation.h"
-#include "HAL/HAL.h"
-
-using namespace frc;
-
-GenericHID::GenericHID(int port) : m_ds(DriverStation::GetInstance()) {
- m_port = port;
-}
-
-/**
- * Get the value of the axis.
- *
- * @param axis The axis to read, starting at 0.
- * @return The value of the axis.
- */
-double GenericHID::GetRawAxis(int axis) const {
- return m_ds.GetStickAxis(m_port, axis);
-}
-
-/**
- * Get the button value (starting at button 1)
- *
- * The buttons are returned in a single 16 bit value with one bit representing
- * the state of each button. The appropriate button is returned as a boolean
- * value.
- *
- * @param button The button number to be read (starting at 1)
- * @return The state of the button.
- **/
-bool GenericHID::GetRawButton(int button) const {
- return m_ds.GetStickButton(m_port, button);
-}
-
-/**
- * Get the angle in degrees of a POV on the HID.
- *
- * The POV angles start at 0 in the up direction, and increase clockwise
- * (e.g. right is 90, upper-left is 315).
- *
- * @param pov The index of the POV to read (starting at 0)
- * @return the angle of the POV in degrees, or -1 if the POV is not pressed.
- */
-int GenericHID::GetPOV(int pov) const {
- return m_ds.GetStickPOV(GetPort(), pov);
-}
-
-/**
- * Get the number of POVs for the HID.
- *
- * @return the number of POVs for the current HID
- */
-int GenericHID::GetPOVCount() const { return m_ds.GetStickPOVCount(GetPort()); }
-
-/**
- * Get the port number of the HID.
- *
- * @return The port number of the HID.
- */
-int GenericHID::GetPort() const { return m_port; }
-
-/**
- * Get the type of the HID.
- *
- * @return the type of the HID.
- */
-GenericHID::HIDType GenericHID::GetType() const {
- return static_cast<HIDType>(m_ds.GetJoystickType(m_port));
-}
-
-/**
- * Get the name of the HID.
- *
- * @return the name of the HID.
- */
-std::string GenericHID::GetName() const { return m_ds.GetJoystickName(m_port); }
-
-/**
- * Set a single HID output value for the HID.
- *
- * @param outputNumber The index of the output to set (1-32)
- * @param value The value to set the output to
- */
-
-void GenericHID::SetOutput(int outputNumber, bool value) {
- m_outputs =
- (m_outputs & ~(1 << (outputNumber - 1))) | (value << (outputNumber - 1));
-
- HAL_SetJoystickOutputs(m_port, m_outputs, m_leftRumble, m_rightRumble);
-}
-
-/**
- * Set all output values for the HID.
- *
- * @param value The 32 bit output value (1 bit for each output)
- */
-void GenericHID::SetOutputs(int value) {
- m_outputs = value;
- HAL_SetJoystickOutputs(m_port, m_outputs, m_leftRumble, m_rightRumble);
-}
-
-/**
- * Set the rumble output for the HID.
- *
- * The DS currently supports 2 rumble values, left rumble and right rumble.
- *
- * @param type Which rumble value to set
- * @param value The normalized value (0 to 1) to set the rumble to
- */
-void GenericHID::SetRumble(RumbleType type, double value) {
- if (value < 0)
- value = 0;
- else if (value > 1)
- value = 1;
- if (type == kLeftRumble) {
- m_leftRumble = value * 65535;
- } else {
- m_rightRumble = value * 65535;
- }
- HAL_SetJoystickOutputs(m_port, m_outputs, m_leftRumble, m_rightRumble);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/I2C.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/I2C.cpp
deleted file mode 100644
index 6c35e3b..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/I2C.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/I2C.h"
-#include "I2C.h"
-
-#include "HAL/HAL.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Constructor.
- *
- * @param port The I2C port to which the device is connected.
- * @param deviceAddress The address of the device on the I2C bus.
- */
-I2C::I2C(Port port, int deviceAddress)
- : m_port(port), m_deviceAddress(deviceAddress) {
- int32_t status = 0;
- HAL_InitializeI2C(m_port, &status);
- // wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- HAL_Report(HALUsageReporting::kResourceType_I2C, deviceAddress);
-}
-
-/**
- * Destructor.
- */
-I2C::~I2C() { HAL_CloseI2C(m_port); }
-
-/**
- * Generic transaction.
- *
- * This is a lower-level interface to the I2C hardware giving you more control
- * over each transaction.
- *
- * @param dataToSend Buffer of data to send as part of the transaction.
- * @param sendSize Number of bytes to send as part of the transaction.
- * @param dataReceived Buffer to read data into.
- * @param receiveSize Number of bytes to read from the device.
- * @return Transfer Aborted... false for success, true for aborted.
- */
-bool I2C::Transaction(uint8_t* dataToSend, int sendSize, uint8_t* dataReceived,
- int receiveSize) {
- int32_t status = 0;
- status = HAL_TransactionI2C(m_port, m_deviceAddress, dataToSend, sendSize,
- dataReceived, receiveSize);
- // wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return status < 0;
-}
-
-/**
- * Attempt to address a device on the I2C bus.
- *
- * This allows you to figure out if there is a device on the I2C bus that
- * responds to the address specified in the constructor.
- *
- * @return Transfer Aborted... false for success, true for aborted.
- */
-bool I2C::AddressOnly() { return Transaction(nullptr, 0, nullptr, 0); }
-
-/**
- * Execute a write transaction with the device.
- *
- * Write a single byte to a register on a device and wait until the
- * transaction is complete.
- *
- * @param registerAddress The address of the register on the device to be
- * written.
- * @param data The byte to write to the register on the device.
- * @return Transfer Aborted... false for success, true for aborted.
- */
-bool I2C::Write(int registerAddress, uint8_t data) {
- uint8_t buffer[2];
- buffer[0] = registerAddress;
- buffer[1] = data;
- int32_t status = 0;
- status = HAL_WriteI2C(m_port, m_deviceAddress, buffer, sizeof(buffer));
- return status < 0;
-}
-
-/**
- * Execute a bulk write transaction with the device.
- *
- * Write multiple bytes to a device and wait until the
- * transaction is complete.
- *
- * @param data The data to write to the register on the device.
- * @param count The number of bytes to be written.
- * @return Transfer Aborted... false for success, true for aborted.
- */
-bool I2C::WriteBulk(uint8_t* data, int count) {
- int32_t status = 0;
- status = HAL_WriteI2C(m_port, m_deviceAddress, data, count);
- return status < 0;
-}
-
-/**
- * Execute a read transaction with the device.
- *
- * Read bytes from a device.
- * Most I2C devices will auto-increment the register pointer internally allowing
- * you to read consecutive registers on a device in a single transaction.
- *
- * @param registerAddress The register to read first in the transaction.
- * @param count The number of bytes to read in the transaction.
- * @param buffer A pointer to the array of bytes to store the data
- * read from the device.
- * @return Transfer Aborted... false for success, true for aborted.
- */
-bool I2C::Read(int registerAddress, int count, uint8_t* buffer) {
- if (count < 1) {
- wpi_setWPIErrorWithContext(ParameterOutOfRange, "count");
- return true;
- }
- if (buffer == nullptr) {
- wpi_setWPIErrorWithContext(NullParameter, "buffer");
- return true;
- }
- uint8_t regAddr = registerAddress;
- return Transaction(®Addr, sizeof(regAddr), buffer, count);
-}
-
-/**
- * Execute a read only transaction with the device.
- *
- * Read bytes from a device. This method does not write any data to prompt the
- * device.
- *
- * @param buffer A pointer to the array of bytes to store the data read from
- * the device.
- * @param count The number of bytes to read in the transaction.
- * @return Transfer Aborted... false for success, true for aborted.
- */
-bool I2C::ReadOnly(int count, uint8_t* buffer) {
- if (count < 1) {
- wpi_setWPIErrorWithContext(ParameterOutOfRange, "count");
- return true;
- }
- if (buffer == nullptr) {
- wpi_setWPIErrorWithContext(NullParameter, "buffer");
- return true;
- }
- return HAL_ReadI2C(m_port, m_deviceAddress, buffer, count) < 0;
-}
-
-/**
- * Send a broadcast write to all devices on the I2C bus.
- *
- * This is not currently implemented!
- *
- * @param registerAddress The register to write on all devices on the bus.
- * @param data The value to write to the devices.
- */
-// [[gnu::warning("I2C::Broadcast() is not implemented.")]] void I2C::Broadcast(
-// int registerAddress, uint8_t data) {}
-
-/**
- * Verify that a device's registers contain expected values.
- *
- * Most devices will have a set of registers that contain a known value that
- * can be used to identify them. This allows an I2C device driver to easily
- * verify that the device contains the expected value.
- *
- * @pre The device must support and be configured to use register
- * auto-increment.
- *
- * @param registerAddress The base register to start reading from the device.
- * @param count The size of the field to be verified.
- * @param expected A buffer containing the values expected from the
- * device.
- */
-bool I2C::VerifySensor(int registerAddress, int count,
- const uint8_t* expected) {
- // TODO: Make use of all 7 read bytes
- uint8_t deviceData[4];
- for (int i = 0, curRegisterAddress = registerAddress; i < count;
- i += 4, curRegisterAddress += 4) {
- int toRead = count - i < 4 ? count - i : 4;
- // Read the chunk of data. Return false if the sensor does not respond.
- if (Read(curRegisterAddress, toRead, deviceData)) return false;
-
- for (int j = 0; j < toRead; j++) {
- if (deviceData[j] != expected[i + j]) return false;
- }
- }
- return true;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Internal/HardwareHLReporting.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Internal/HardwareHLReporting.cpp
deleted file mode 100644
index 8c66d1c..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Internal/HardwareHLReporting.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Internal/HardwareHLReporting.h"
-
-#include "HAL/HAL.h"
-
-using namespace frc;
-
-void HardwareHLReporting::ReportScheduler() {
- HAL_Report(HALUsageReporting::kResourceType_Command,
- HALUsageReporting::kCommand_Scheduler);
-}
-
-void HardwareHLReporting::ReportSmartDashboard() {
- HAL_Report(HALUsageReporting::kResourceType_SmartDashboard, 0);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/InterruptableSensorBase.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/InterruptableSensorBase.cpp
deleted file mode 100644
index 7545b1b..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/InterruptableSensorBase.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "InterruptableSensorBase.h"
-
-#include "HAL/HAL.h"
-#include "Utility.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-InterruptableSensorBase::InterruptableSensorBase() {}
-
-/**
- * Request one of the 8 interrupts asynchronously on this digital input.
- *
- * Request interrupts in asynchronous mode where the user's interrupt handler
- * will be called when the interrupt fires. Users that want control over the
- * thread priority should use the synchronous method with their own spawned
- * thread. The default is interrupt on rising edges only.
- */
-void InterruptableSensorBase::RequestInterrupts(
- HAL_InterruptHandlerFunction handler, void* param) {
- if (StatusIsFatal()) return;
-
- wpi_assert(m_interrupt == HAL_kInvalidHandle);
- AllocateInterrupts(false);
- if (StatusIsFatal()) return; // if allocate failed, out of interrupts
-
- int32_t status = 0;
- HAL_RequestInterrupts(
- m_interrupt, GetPortHandleForRouting(),
- static_cast<HAL_AnalogTriggerType>(GetAnalogTriggerTypeForRouting()),
- &status);
- SetUpSourceEdge(true, false);
- HAL_AttachInterruptHandler(m_interrupt, handler, param, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Request one of the 8 interrupts synchronously on this digital input.
- *
- * Request interrupts in synchronous mode where the user program will have to
- * explicitly wait for the interrupt to occur using WaitForInterrupt.
- * The default is interrupt on rising edges only.
- */
-void InterruptableSensorBase::RequestInterrupts() {
- if (StatusIsFatal()) return;
-
- wpi_assert(m_interrupt == HAL_kInvalidHandle);
- AllocateInterrupts(true);
- if (StatusIsFatal()) return; // if allocate failed, out of interrupts
-
- int32_t status = 0;
- HAL_RequestInterrupts(
- m_interrupt, GetPortHandleForRouting(),
- static_cast<HAL_AnalogTriggerType>(GetAnalogTriggerTypeForRouting()),
- &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- SetUpSourceEdge(true, false);
-}
-
-void InterruptableSensorBase::AllocateInterrupts(bool watcher) {
- wpi_assert(m_interrupt == HAL_kInvalidHandle);
- // Expects the calling leaf class to allocate an interrupt index.
- int32_t status = 0;
- m_interrupt = HAL_InitializeInterrupts(watcher, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Cancel interrupts on this device.
- *
- * This deallocates all the chipobject structures and disables any interrupts.
- */
-void InterruptableSensorBase::CancelInterrupts() {
- if (StatusIsFatal()) return;
- wpi_assert(m_interrupt != HAL_kInvalidHandle);
- int32_t status = 0;
- HAL_CleanInterrupts(m_interrupt, &status);
- // ignore status, as an invalid handle just needs to be ignored.
- m_interrupt = HAL_kInvalidHandle;
-}
-
-/**
- * In synchronous mode, wait for the defined interrupt to occur.
- *
- * You should <b>NOT</b> attempt to read the sensor from another thread while
- * waiting for an interrupt. This is not threadsafe, and can cause memory
- * corruption
- *
- * @param timeout Timeout in seconds
- * @param ignorePrevious If true, ignore interrupts that happened before
- * WaitForInterrupt was called.
- * @return What interrupts fired
- */
-InterruptableSensorBase::WaitResult InterruptableSensorBase::WaitForInterrupt(
- double timeout, bool ignorePrevious) {
- if (StatusIsFatal()) return InterruptableSensorBase::kTimeout;
- wpi_assert(m_interrupt != HAL_kInvalidHandle);
- int32_t status = 0;
- int result;
-
- result = HAL_WaitForInterrupt(m_interrupt, timeout, ignorePrevious, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- // Rising edge result is the interrupt bit set in the byte 0xFF
- // Falling edge result is the interrupt bit set in the byte 0xFF00
- // Set any bit set to be true for that edge, and AND the 2 results
- // together to match the existing enum for all interrupts
- int32_t rising = (result & 0xFF) ? 0x1 : 0x0;
- int32_t falling = ((result & 0xFF00) ? 0x0100 : 0x0);
- return static_cast<WaitResult>(falling | rising);
-}
-
-/**
- * Enable interrupts to occur on this input.
- *
- * Interrupts are disabled when the RequestInterrupt call is made. This gives
- * time to do the setup of the other options before starting to field
- * interrupts.
- */
-void InterruptableSensorBase::EnableInterrupts() {
- if (StatusIsFatal()) return;
- wpi_assert(m_interrupt != HAL_kInvalidHandle);
- int32_t status = 0;
- HAL_EnableInterrupts(m_interrupt, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Disable Interrupts without without deallocating structures.
- */
-void InterruptableSensorBase::DisableInterrupts() {
- if (StatusIsFatal()) return;
- wpi_assert(m_interrupt != HAL_kInvalidHandle);
- int32_t status = 0;
- HAL_DisableInterrupts(m_interrupt, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Return the timestamp for the rising interrupt that occurred most recently.
- *
- * This is in the same time domain as GetClock().
- * The rising-edge interrupt should be enabled with
- * {@link #DigitalInput.SetUpSourceEdge}
- *
- * @return Timestamp in seconds since boot.
- */
-double InterruptableSensorBase::ReadRisingTimestamp() {
- if (StatusIsFatal()) return 0.0;
- wpi_assert(m_interrupt != HAL_kInvalidHandle);
- int32_t status = 0;
- double timestamp = HAL_ReadInterruptRisingTimestamp(m_interrupt, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return timestamp;
-}
-
-/**
- * Return the timestamp for the falling interrupt that occurred most recently.
- *
- * This is in the same time domain as GetClock().
- * The falling-edge interrupt should be enabled with
- * {@link #DigitalInput.SetUpSourceEdge}
- *
- * @return Timestamp in seconds since boot.
-*/
-double InterruptableSensorBase::ReadFallingTimestamp() {
- if (StatusIsFatal()) return 0.0;
- wpi_assert(m_interrupt != HAL_kInvalidHandle);
- int32_t status = 0;
- double timestamp = HAL_ReadInterruptFallingTimestamp(m_interrupt, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return timestamp;
-}
-
-/**
- * Set which edge to trigger interrupts on
- *
- * @param risingEdge true to interrupt on rising edge
- * @param fallingEdge true to interrupt on falling edge
- */
-void InterruptableSensorBase::SetUpSourceEdge(bool risingEdge,
- bool fallingEdge) {
- if (StatusIsFatal()) return;
- if (m_interrupt == HAL_kInvalidHandle) {
- wpi_setWPIErrorWithContext(
- NullParameter,
- "You must call RequestInterrupts before SetUpSourceEdge");
- return;
- }
- if (m_interrupt != HAL_kInvalidHandle) {
- int32_t status = 0;
- HAL_SetInterruptUpSourceEdge(m_interrupt, risingEdge, fallingEdge, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/IterativeRobot.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/IterativeRobot.cpp
deleted file mode 100644
index 3b4e64f..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/IterativeRobot.cpp
+++ /dev/null
@@ -1,263 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "IterativeRobot.h"
-
-#include "DriverStation.h"
-#include "HAL/HAL.h"
-#include "LiveWindow/LiveWindow.h"
-#include "networktables/NetworkTable.h"
-
-using namespace frc;
-
-/**
- * Provide an alternate "main loop" via StartCompetition().
- *
- * This specific StartCompetition() implements "main loop" behaviour synced with
- * the DS packets.
- */
-void IterativeRobot::StartCompetition() {
- HAL_Report(HALUsageReporting::kResourceType_Framework,
- HALUsageReporting::kFramework_Iterative);
-
- LiveWindow* lw = LiveWindow::GetInstance();
- // first and one-time initialization
- NetworkTable::GetTable("LiveWindow")
- ->GetSubTable("~STATUS~")
- ->PutBoolean("LW Enabled", false);
- RobotInit();
-
- // Tell the DS that the robot is ready to be enabled
- HAL_ObserveUserProgramStarting();
-
- // loop forever, calling the appropriate mode-dependent function
- lw->SetEnabled(false);
- while (true) {
- // wait for driver station data so the loop doesn't hog the CPU
- m_ds.WaitForData();
- // Call the appropriate function depending upon the current robot mode
- if (IsDisabled()) {
- // call DisabledInit() if we are now just entering disabled mode from
- // either a different mode or from power-on
- if (!m_disabledInitialized) {
- lw->SetEnabled(false);
- DisabledInit();
- m_disabledInitialized = true;
- // reset the initialization flags for the other modes
- m_autonomousInitialized = false;
- m_teleopInitialized = false;
- m_testInitialized = false;
- }
- HAL_ObserveUserProgramDisabled();
- DisabledPeriodic();
- } else if (IsAutonomous()) {
- // call AutonomousInit() if we are now just entering autonomous mode from
- // either a different mode or from power-on
- if (!m_autonomousInitialized) {
- lw->SetEnabled(false);
- AutonomousInit();
- m_autonomousInitialized = true;
- // reset the initialization flags for the other modes
- m_disabledInitialized = false;
- m_teleopInitialized = false;
- m_testInitialized = false;
- }
- HAL_ObserveUserProgramAutonomous();
- AutonomousPeriodic();
- } else if (IsTest()) {
- // call TestInit() if we are now just entering test mode from
- // either a different mode or from power-on
- if (!m_testInitialized) {
- lw->SetEnabled(true);
- TestInit();
- m_testInitialized = true;
- // reset the initialization flags for the other modes
- m_disabledInitialized = false;
- m_autonomousInitialized = false;
- m_teleopInitialized = false;
- }
- HAL_ObserveUserProgramTest();
- TestPeriodic();
- } else {
- // call TeleopInit() if we are now just entering teleop mode from
- // either a different mode or from power-on
- if (!m_teleopInitialized) {
- lw->SetEnabled(false);
- TeleopInit();
- m_teleopInitialized = true;
- // reset the initialization flags for the other modes
- m_disabledInitialized = false;
- m_autonomousInitialized = false;
- m_testInitialized = false;
- Scheduler::GetInstance()->SetEnabled(true);
- }
- HAL_ObserveUserProgramTeleop();
- TeleopPeriodic();
- }
- RobotPeriodic();
- }
-}
-
-/**
- * Robot-wide initialization code should go here.
- *
- * Users should override this method for default Robot-wide initialization which
- * will be called when the robot is first powered on. It will be called exactly
- * one time.
- *
- * Warning: the Driver Station "Robot Code" light and FMS "Robot Ready"
- * indicators will be off until RobotInit() exits. Code in RobotInit() that
- * waits for enable will cause the robot to never indicate that the code is
- * ready, causing the robot to be bypassed in a match.
- */
-void IterativeRobot::RobotInit() {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
-}
-
-/**
- * Initialization code for disabled mode should go here.
- *
- * Users should override this method for initialization code which will be
- * called each time
- * the robot enters disabled mode.
- */
-void IterativeRobot::DisabledInit() {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
-}
-
-/**
- * Initialization code for autonomous mode should go here.
- *
- * Users should override this method for initialization code which will be
- * called each time the robot enters autonomous mode.
- */
-void IterativeRobot::AutonomousInit() {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
-}
-
-/**
- * Initialization code for teleop mode should go here.
- *
- * Users should override this method for initialization code which will be
- * called each time the robot enters teleop mode.
- */
-void IterativeRobot::TeleopInit() {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
-}
-
-/**
- * Initialization code for test mode should go here.
- *
- * Users should override this method for initialization code which will be
- * called each time the robot enters test mode.
- */
-void IterativeRobot::TestInit() {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
-}
-
-/**
- * Periodic code for all modes should go here.
- *
- * This function is called each time a new packet is received from the driver
- * station.
- *
- * Packets are received approximately every 20ms. Fixed loop timing is not
- * guaranteed due to network timing variability and the function may not be
- * called at all if the Driver Station is disconnected. For most use cases the
- * variable timing will not be an issue. If your code does require guaranteed
- * fixed periodic timing, consider using Notifier or PIDController instead.
- */
-void IterativeRobot::RobotPeriodic() {
- static bool firstRun = true;
- if (firstRun) {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
- firstRun = false;
- }
-}
-
-/**
- * Periodic code for disabled mode should go here.
- *
- * Users should override this method for code which will be called each time a
- * new packet is received from the driver station and the robot is in disabled
- * mode.
- *
- * Packets are received approximately every 20ms. Fixed loop timing is not
- * guaranteed due to network timing variability and the function may not be
- * called at all if the Driver Station is disconnected. For most use cases the
- * variable timing will not be an issue. If your code does require guaranteed
- * fixed periodic timing, consider using Notifier or PIDController instead.
- */
-void IterativeRobot::DisabledPeriodic() {
- static bool firstRun = true;
- if (firstRun) {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
- firstRun = false;
- }
-}
-
-/**
- * Periodic code for autonomous mode should go here.
- *
- * Users should override this method for code which will be called each time a
- * new packet is received from the driver station and the robot is in autonomous
- * mode.
- *
- * Packets are received approximately every 20ms. Fixed loop timing is not
- * guaranteed due to network timing variability and the function may not be
- * called at all if the Driver Station is disconnected. For most use cases the
- * variable timing will not be an issue. If your code does require guaranteed
- * fixed periodic timing, consider using Notifier or PIDController instead.
- */
-void IterativeRobot::AutonomousPeriodic() {
- static bool firstRun = true;
- if (firstRun) {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
- firstRun = false;
- }
-}
-
-/**
- * Periodic code for teleop mode should go here.
- *
- * Users should override this method for code which will be called each time a
- * new packet is received from the driver station and the robot is in teleop
- * mode.
- *
- * Packets are received approximately every 20ms. Fixed loop timing is not
- * guaranteed due to network timing variability and the function may not be
- * called at all if the Driver Station is disconnected. For most use cases the
- * variable timing will not be an issue. If your code does require guaranteed
- * fixed periodic timing, consider using Notifier or PIDController instead.
- */
-void IterativeRobot::TeleopPeriodic() {
- static bool firstRun = true;
- if (firstRun) {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
- firstRun = false;
- }
-}
-
-/**
- * Periodic code for test mode should go here.
- *
- * Users should override this method for code which will be called each time a
- * new packet is received from the driver station and the robot is in test mode.
- *
- * Packets are received approximately every 20ms. Fixed loop timing is not
- * guaranteed due to network timing variability and the function may not be
- * called at all if the Driver Station is disconnected. For most use cases the
- * variable timing will not be an issue. If your code does require guaranteed
- * fixed periodic timing, consider using Notifier or PIDController instead.
- */
-void IterativeRobot::TestPeriodic() {
- static bool firstRun = true;
- if (firstRun) {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
- firstRun = false;
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Jaguar.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Jaguar.cpp
deleted file mode 100644
index 1d6cce8..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Jaguar.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Jaguar.h"
-
-#include "HAL/HAL.h"
-#include "LiveWindow/LiveWindow.h"
-
-using namespace frc;
-
-/**
- * Constructor for a Jaguar connected via PWM.
- *
- * @param channel The PWM channel that the Jaguar is attached to. 0-9 are
- * on-board, 10-19 are on the MXP port
- */
-Jaguar::Jaguar(int channel) : PWMSpeedController(channel) {
- /**
- * Input profile defined by Luminary Micro.
- *
- * Full reverse ranges from 0.671325ms to 0.6972211ms
- * Proportional reverse ranges from 0.6972211ms to 1.4482078ms
- * Neutral ranges from 1.4482078ms to 1.5517922ms
- * Proportional forward ranges from 1.5517922ms to 2.3027789ms
- * Full forward ranges from 2.3027789ms to 2.328675ms
- */
- SetBounds(2.31, 1.55, 1.507, 1.454, .697);
- SetPeriodMultiplier(kPeriodMultiplier_1X);
- SetSpeed(0.0);
- SetZeroLatch();
-
- HAL_Report(HALUsageReporting::kResourceType_Jaguar, GetChannel());
- LiveWindow::GetInstance()->AddActuator("Jaguar", GetChannel(), this);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Joystick.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Joystick.cpp
deleted file mode 100644
index 809950b..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Joystick.cpp
+++ /dev/null
@@ -1,281 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Joystick.h"
-
-#include <cmath>
-
-#include "DriverStation.h"
-#include "HAL/HAL.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-const int Joystick::kDefaultXAxis;
-const int Joystick::kDefaultYAxis;
-const int Joystick::kDefaultZAxis;
-const int Joystick::kDefaultTwistAxis;
-const int Joystick::kDefaultThrottleAxis;
-const int Joystick::kDefaultTriggerButton;
-const int Joystick::kDefaultTopButton;
-static Joystick* joysticks[DriverStation::kJoystickPorts];
-static bool joySticksInitialized = false;
-
-/**
- * Construct an instance of a joystick.
- *
- * The joystick index is the USB port on the Driver Station.
- *
- * @param port The port on the Driver Station that the joystick is plugged into
- * (0-5).
- */
-Joystick::Joystick(int port) : Joystick(port, kNumAxisTypes, kNumButtonTypes) {
- m_axes[kXAxis] = kDefaultXAxis;
- m_axes[kYAxis] = kDefaultYAxis;
- m_axes[kZAxis] = kDefaultZAxis;
- m_axes[kTwistAxis] = kDefaultTwistAxis;
- m_axes[kThrottleAxis] = kDefaultThrottleAxis;
-
- m_buttons[kTriggerButton] = kDefaultTriggerButton;
- m_buttons[kTopButton] = kDefaultTopButton;
-
- HAL_Report(HALUsageReporting::kResourceType_Joystick, port);
-}
-
-/**
- * Version of the constructor to be called by sub-classes.
- *
- * This constructor allows the subclass to configure the number of constants
- * for axes and buttons.
- *
- * @param port The port on the Driver Station that the joystick is
- * plugged into.
- * @param numAxisTypes The number of axis types in the enum.
- * @param numButtonTypes The number of button types in the enum.
- */
-Joystick::Joystick(int port, int numAxisTypes, int numButtonTypes)
- : JoystickBase(port),
- m_ds(DriverStation::GetInstance()),
- m_axes(numAxisTypes),
- m_buttons(numButtonTypes) {
- if (!joySticksInitialized) {
- for (auto& joystick : joysticks) joystick = nullptr;
- joySticksInitialized = true;
- }
- if (GetPort() >= DriverStation::kJoystickPorts) {
- wpi_setWPIError(BadJoystickIndex);
- } else {
- joysticks[GetPort()] = this;
- }
-}
-
-Joystick* Joystick::GetStickForPort(int port) {
- Joystick* stick = joysticks[port];
- if (stick == nullptr) {
- stick = new Joystick(port);
- joysticks[port] = stick;
- }
- return stick;
-}
-
-/**
- * Get the X value of the joystick.
- *
- * This depends on the mapping of the joystick connected to the current port.
- *
- * @param hand This parameter is ignored for the Joystick class and is only
- * here to complete the GenericHID interface.
- */
-double Joystick::GetX(JoystickHand hand) const {
- return GetRawAxis(m_axes[kXAxis]);
-}
-
-/**
- * Get the Y value of the joystick.
- *
- * This depends on the mapping of the joystick connected to the current port.
- *
- * @param hand This parameter is ignored for the Joystick class and is only
- * here to complete the GenericHID interface.
- */
-double Joystick::GetY(JoystickHand hand) const {
- return GetRawAxis(m_axes[kYAxis]);
-}
-
-/**
- * Get the Z value of the current joystick.
- *
- * This depends on the mapping of the joystick connected to the current port.
- */
-double Joystick::GetZ(JoystickHand hand) const {
- return GetRawAxis(m_axes[kZAxis]);
-}
-
-/**
- * Get the twist value of the current joystick.
- *
- * This depends on the mapping of the joystick connected to the current port.
- */
-double Joystick::GetTwist() const { return GetRawAxis(m_axes[kTwistAxis]); }
-
-/**
- * Get the throttle value of the current joystick.
- *
- * This depends on the mapping of the joystick connected to the current port.
- */
-double Joystick::GetThrottle() const {
- return GetRawAxis(m_axes[kThrottleAxis]);
-}
-
-/**
- * For the current joystick, return the axis determined by the argument.
- *
- * This is for cases where the joystick axis is returned programatically,
- * otherwise one of the previous functions would be preferable (for example
- * GetX()).
- *
- * @param axis The axis to read.
- * @return The value of the axis.
- */
-double Joystick::GetAxis(AxisType axis) const {
- switch (axis) {
- case kXAxis:
- return this->GetX();
- case kYAxis:
- return this->GetY();
- case kZAxis:
- return this->GetZ();
- case kTwistAxis:
- return this->GetTwist();
- case kThrottleAxis:
- return this->GetThrottle();
- default:
- wpi_setWPIError(BadJoystickAxis);
- return 0.0;
- }
-}
-
-/**
- * Read the state of the trigger on the joystick.
- *
- * Look up which button has been assigned to the trigger and read its state.
- *
- * @param hand This parameter is ignored for the Joystick class and is only
- * here to complete the GenericHID interface.
- * @return The state of the trigger.
- */
-bool Joystick::GetTrigger(JoystickHand hand) const {
- return GetRawButton(m_buttons[kTriggerButton]);
-}
-
-/**
- * Read the state of the top button on the joystick.
- *
- * Look up which button has been assigned to the top and read its state.
- *
- * @param hand This parameter is ignored for the Joystick class and is only
- * here to complete the GenericHID interface.
- * @return The state of the top button.
- */
-bool Joystick::GetTop(JoystickHand hand) const {
- return GetRawButton(m_buttons[kTopButton]);
-}
-
-/**
- * Get buttons based on an enumerated type.
- *
- * The button type will be looked up in the list of buttons and then read.
- *
- * @param button The type of button to read.
- * @return The state of the button.
- */
-bool Joystick::GetButton(ButtonType button) const {
- switch (button) {
- case kTriggerButton:
- return GetTrigger();
- case kTopButton:
- return GetTop();
- default:
- return false;
- }
-}
-
-/**
- * Get the number of axis for a joystick
- *
- * @return the number of axis for the current joystick
- */
-int Joystick::GetAxisCount() const { return m_ds.GetStickAxisCount(GetPort()); }
-
-/**
- * Get the axis type of a joystick axis.
- *
- * @return the axis type of a joystick axis.
- */
-int Joystick::GetAxisType(int axis) const {
- return m_ds.GetJoystickAxisType(GetPort(), axis);
-}
-
-/**
- * Get the number of buttons for a joystick.
- *
- * @return the number of buttons on the current joystick
- */
-int Joystick::GetButtonCount() const {
- return m_ds.GetStickButtonCount(GetPort());
-}
-
-/**
- * Get the channel currently associated with the specified axis.
- *
- * @param axis The axis to look up the channel for.
- * @return The channel fr the axis.
- */
-int Joystick::GetAxisChannel(AxisType axis) const { return m_axes[axis]; }
-
-/**
- * Set the channel associated with a specified axis.
- *
- * @param axis The axis to set the channel for.
- * @param channel The channel to set the axis to.
- */
-void Joystick::SetAxisChannel(AxisType axis, int channel) {
- m_axes[axis] = channel;
-}
-
-/**
- * Get the magnitude of the direction vector formed by the joystick's
- * current position relative to its origin.
- *
- * @return The magnitude of the direction vector
- */
-double Joystick::GetMagnitude() const {
- return std::sqrt(std::pow(GetX(), 2) + std::pow(GetY(), 2));
-}
-
-/**
- * Get the direction of the vector formed by the joystick and its origin
- * in radians.
- *
- * @return The direction of the vector in radians
- */
-double Joystick::GetDirectionRadians() const {
- return std::atan2(GetX(), -GetY());
-}
-
-/**
- * Get the direction of the vector formed by the joystick and its origin
- * in degrees.
- *
- * uses std::acos(-1) to represent Pi due to absence of readily accessible Pi
- * constant in C++
- *
- * @return The direction of the vector in degrees
- */
-double Joystick::GetDirectionDegrees() const {
- return (180 / std::acos(-1)) * GetDirectionRadians();
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/MotorSafetyHelper.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/MotorSafetyHelper.cpp
deleted file mode 100644
index 9f1ee89..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/MotorSafetyHelper.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "MotorSafetyHelper.h"
-
-#include <sstream>
-
-#include "DriverStation.h"
-#include "MotorSafety.h"
-#include "Timer.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-std::set<MotorSafetyHelper*> MotorSafetyHelper::m_helperList;
-priority_recursive_mutex MotorSafetyHelper::m_listMutex;
-
-/**
- * The constructor for a MotorSafetyHelper object.
- *
- * The helper object is constructed for every object that wants to implement the
- * Motor Safety protocol. The helper object has the code to actually do the
- * timing and call the motors Stop() method when the timeout expires. The motor
- * object is expected to call the Feed() method whenever the motors value is
- * updated.
- *
- * @param safeObject a pointer to the motor object implementing MotorSafety.
- * This is used to call the Stop() method on the motor.
- */
-MotorSafetyHelper::MotorSafetyHelper(MotorSafety* safeObject)
- : m_safeObject(safeObject) {
- m_enabled = false;
- m_expiration = DEFAULT_SAFETY_EXPIRATION;
- m_stopTime = Timer::GetFPGATimestamp();
-
- std::lock_guard<priority_recursive_mutex> sync(m_listMutex);
- m_helperList.insert(this);
-}
-
-MotorSafetyHelper::~MotorSafetyHelper() {
- std::lock_guard<priority_recursive_mutex> sync(m_listMutex);
- m_helperList.erase(this);
-}
-
-/**
- * Feed the motor safety object.
- * Resets the timer on this object that is used to do the timeouts.
- */
-void MotorSafetyHelper::Feed() {
- std::lock_guard<priority_recursive_mutex> sync(m_syncMutex);
- m_stopTime = Timer::GetFPGATimestamp() + m_expiration;
-}
-
-/**
- * Set the expiration time for the corresponding motor safety object.
- * @param expirationTime The timeout value in seconds.
- */
-void MotorSafetyHelper::SetExpiration(double expirationTime) {
- std::lock_guard<priority_recursive_mutex> sync(m_syncMutex);
- m_expiration = expirationTime;
-}
-
-/**
- * Retrieve the timeout value for the corresponding motor safety object.
- * @return the timeout value in seconds.
- */
-double MotorSafetyHelper::GetExpiration() const {
- std::lock_guard<priority_recursive_mutex> sync(m_syncMutex);
- return m_expiration;
-}
-
-/**
- * Determine if the motor is still operating or has timed out.
- * @return a true value if the motor is still operating normally and hasn't
- * timed out.
- */
-bool MotorSafetyHelper::IsAlive() const {
- std::lock_guard<priority_recursive_mutex> sync(m_syncMutex);
- return !m_enabled || m_stopTime > Timer::GetFPGATimestamp();
-}
-
-/**
- * Check if this motor has exceeded its timeout.
- * This method is called periodically to determine if this motor has exceeded
- * its timeout value. If it has, the stop method is called, and the motor is
- * shut down until its value is updated again.
- */
-void MotorSafetyHelper::Check() {
- DriverStation& ds = DriverStation::GetInstance();
- if (!m_enabled || ds.IsDisabled() || ds.IsTest()) return;
-
- std::lock_guard<priority_recursive_mutex> sync(m_syncMutex);
- if (m_stopTime < Timer::GetFPGATimestamp()) {
- std::ostringstream desc;
- m_safeObject->GetDescription(desc);
- desc << "... Output not updated often enough.";
- wpi_setWPIErrorWithContext(Timeout, desc.str().c_str());
- m_safeObject->StopMotor();
- }
-}
-
-/**
- * Enable/disable motor safety for this device
- * Turn on and off the motor safety option for this PWM object.
- * @param enabled True if motor safety is enforced for this object
- */
-void MotorSafetyHelper::SetSafetyEnabled(bool enabled) {
- std::lock_guard<priority_recursive_mutex> sync(m_syncMutex);
- m_enabled = enabled;
-}
-
-/**
- * Return the state of the motor safety enabled flag
- * Return if the motor safety is currently enabled for this devicce.
- * @return True if motor safety is enforced for this device
- */
-bool MotorSafetyHelper::IsSafetyEnabled() const {
- std::lock_guard<priority_recursive_mutex> sync(m_syncMutex);
- return m_enabled;
-}
-
-/**
- * Check the motors to see if any have timed out.
- * This static method is called periodically to poll all the motors and stop
- * any that have timed out.
- */
-void MotorSafetyHelper::CheckMotors() {
- std::lock_guard<priority_recursive_mutex> sync(m_listMutex);
- for (auto elem : m_helperList) {
- elem->Check();
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Notifier.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Notifier.cpp
deleted file mode 100644
index 67abe37..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Notifier.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Notifier.h"
-
-#include "HAL/HAL.h"
-#include "Timer.h"
-#include "Utility.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-priority_mutex Notifier::m_destructorMutex;
-
-/**
- * Create a Notifier for timer event notification.
- *
- * @param handler The handler is called at the notification time which is set
- * using StartSingle or StartPeriodic.
- */
-Notifier::Notifier(TimerEventHandler handler) {
- if (handler == nullptr)
- wpi_setWPIErrorWithContext(NullParameter, "handler must not be nullptr");
- m_handler = handler;
- int32_t status = 0;
- m_notifier = HAL_InitializeNotifier(&Notifier::Notify, this, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Free the resources for a timer event.
- */
-Notifier::~Notifier() {
- int32_t status = 0;
- // atomically set handle to 0, then clean
- HAL_NotifierHandle handle = m_notifier.exchange(0);
- HAL_CleanNotifier(handle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- /* Acquire the mutex; this makes certain that the handler is not being
- * executed by the interrupt manager.
- */
- std::lock_guard<priority_mutex> lockStatic(Notifier::m_destructorMutex);
- std::lock_guard<priority_mutex> lock(m_processMutex);
-}
-
-/**
- * Update the HAL alarm time.
- */
-void Notifier::UpdateAlarm() {
- int32_t status = 0;
- // Return if we are being destructed, or were not created successfully
- if (m_notifier == 0) return;
- HAL_UpdateNotifierAlarm(
- m_notifier, static_cast<uint64_t>(m_expirationTime * 1e6), &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Notify is called by the HAL layer. We simply need to pass it through to
- * the user handler.
- */
-void Notifier::Notify(uint64_t currentTimeInt, HAL_NotifierHandle handle) {
- Notifier* notifier;
- {
- // Lock static mutex to grab the notifier param
- std::lock_guard<priority_mutex> lock(Notifier::m_destructorMutex);
- int32_t status = 0;
- auto notifierPointer = HAL_GetNotifierParam(handle, &status);
- if (notifierPointer == nullptr) return;
- notifier = static_cast<Notifier*>(notifierPointer);
- notifier->m_processMutex.lock();
- }
-
- if (notifier->m_periodic) {
- notifier->m_expirationTime += notifier->m_period;
- notifier->UpdateAlarm();
- }
-
- auto handler = notifier->m_handler;
-
- if (handler) handler();
- notifier->m_processMutex.unlock();
-}
-
-/**
- * Register for single event notification.
- *
- * A timer event is queued for a single event after the specified delay.
- *
- * @param delay Seconds to wait before the handler is called.
- */
-void Notifier::StartSingle(double delay) {
- std::lock_guard<priority_mutex> sync(m_processMutex);
- m_periodic = false;
- m_period = delay;
- m_expirationTime = GetClock() + m_period;
- UpdateAlarm();
-}
-
-/**
- * Register for periodic event notification.
- *
- * A timer event is queued for periodic event notification. Each time the
- * interrupt occurs, the event will be immediately requeued for the same time
- * interval.
- *
- * @param period Period in seconds to call the handler starting one period
- * after the call to this method.
- */
-void Notifier::StartPeriodic(double period) {
- std::lock_guard<priority_mutex> sync(m_processMutex);
- m_periodic = true;
- m_period = period;
- m_expirationTime = GetClock() + m_period;
- UpdateAlarm();
-}
-
-/**
- * Stop timer events from occuring.
- *
- * Stop any repeating timer events from occuring. This will also remove any
- * single notification events from the queue.
- *
- * If a timer-based call to the registered handler is in progress, this function
- * will block until the handler call is complete.
- */
-void Notifier::Stop() {
- int32_t status = 0;
- HAL_StopNotifierAlarm(m_notifier, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- // Wait for a currently executing handler to complete before returning from
- // Stop()
- std::lock_guard<priority_mutex> lockStatic(Notifier::m_destructorMutex);
- std::lock_guard<priority_mutex> lock(m_processMutex);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/PIDController.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/PIDController.cpp
deleted file mode 100644
index d81d681..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/PIDController.cpp
+++ /dev/null
@@ -1,636 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "PIDController.h"
-
-#include <cmath>
-#include <vector>
-
-#include "HAL/HAL.h"
-#include "Notifier.h"
-#include "PIDOutput.h"
-#include "PIDSource.h"
-
-using namespace frc;
-
-static const std::string kP = "p";
-static const std::string kI = "i";
-static const std::string kD = "d";
-static const std::string kF = "f";
-static const std::string kSetpoint = "setpoint";
-static const std::string kEnabled = "enabled";
-
-/**
- * Allocate a PID object with the given constants for P, I, D.
- *
- * @param Kp the proportional coefficient
- * @param Ki the integral coefficient
- * @param Kd the derivative coefficient
- * @param source The PIDSource object that is used to get values
- * @param output The PIDOutput object that is set to the output value
- * @param period the loop time for doing calculations. This particularly
- * effects calculations of the integral and differental terms.
- * The default is 50ms.
- */
-PIDController::PIDController(double Kp, double Ki, double Kd, PIDSource* source,
- PIDOutput* output, double period)
- : PIDController(Kp, Ki, Kd, 0.0, source, output, period) {}
-
-/**
- * Allocate a PID object with the given constants for P, I, D.
- *
- * @param Kp the proportional coefficient
- * @param Ki the integral coefficient
- * @param Kd the derivative coefficient
- * @param source The PIDSource object that is used to get values
- * @param output The PIDOutput object that is set to the output value
- * @param period the loop time for doing calculations. This particularly
- * effects calculations of the integral and differental terms.
- * The default is 50ms.
- */
-PIDController::PIDController(double Kp, double Ki, double Kd, double Kf,
- PIDSource* source, PIDOutput* output,
- double period) {
- m_controlLoop = std::make_unique<Notifier>(&PIDController::Calculate, this);
-
- m_P = Kp;
- m_I = Ki;
- m_D = Kd;
- m_F = Kf;
-
- m_pidInput = source;
- m_pidOutput = output;
- m_period = period;
-
- m_controlLoop->StartPeriodic(m_period);
- m_setpointTimer.Start();
-
- static int instances = 0;
- instances++;
- HAL_Report(HALUsageReporting::kResourceType_PIDController, instances);
-}
-
-PIDController::~PIDController() {
- // forcefully stopping the notifier so the callback can successfully run.
- m_controlLoop->Stop();
- if (m_table != nullptr) m_table->RemoveTableListener(this);
-}
-
-/**
- * Read the input, calculate the output accordingly, and write to the output.
- * This should only be called by the Notifier.
- */
-void PIDController::Calculate() {
- bool enabled;
- PIDSource* pidInput;
- PIDOutput* pidOutput;
-
- {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- pidInput = m_pidInput;
- pidOutput = m_pidOutput;
- enabled = m_enabled;
- }
-
- if (pidInput == nullptr) return;
- if (pidOutput == nullptr) return;
-
- if (enabled) {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- double input = pidInput->PIDGet();
- double result;
- PIDOutput* pidOutput;
-
- m_error = GetContinuousError(m_setpoint - input);
-
- if (m_pidInput->GetPIDSourceType() == PIDSourceType::kRate) {
- if (m_P != 0) {
- double potentialPGain = (m_totalError + m_error) * m_P;
- if (potentialPGain < m_maximumOutput) {
- if (potentialPGain > m_minimumOutput)
- m_totalError += m_error;
- else
- m_totalError = m_minimumOutput / m_P;
- } else {
- m_totalError = m_maximumOutput / m_P;
- }
- }
-
- m_result = m_D * m_error + m_P * m_totalError + CalculateFeedForward();
- } else {
- if (m_I != 0) {
- double potentialIGain = (m_totalError + m_error) * m_I;
- if (potentialIGain < m_maximumOutput) {
- if (potentialIGain > m_minimumOutput)
- m_totalError += m_error;
- else
- m_totalError = m_minimumOutput / m_I;
- } else {
- m_totalError = m_maximumOutput / m_I;
- }
- }
-
- m_result = m_P * m_error + m_I * m_totalError +
- m_D * (m_error - m_prevError) + CalculateFeedForward();
- }
- m_prevError = m_error;
-
- if (m_result > m_maximumOutput)
- m_result = m_maximumOutput;
- else if (m_result < m_minimumOutput)
- m_result = m_minimumOutput;
-
- pidOutput = m_pidOutput;
- result = m_result;
-
- pidOutput->PIDWrite(result);
-
- // Update the buffer.
- m_buf.push(m_error);
- m_bufTotal += m_error;
- // Remove old elements when buffer is full.
- if (m_buf.size() > m_bufLength) {
- m_bufTotal -= m_buf.front();
- m_buf.pop();
- }
- }
-}
-
-/**
- * Calculate the feed forward term.
- *
- * Both of the provided feed forward calculations are velocity feed forwards.
- * If a different feed forward calculation is desired, the user can override
- * this function and provide his or her own. This function does no
- * synchronization because the PIDController class only calls it in synchronized
- * code, so be careful if calling it oneself.
- *
- * If a velocity PID controller is being used, the F term should be set to 1
- * over the maximum setpoint for the output. If a position PID controller is
- * being used, the F term should be set to 1 over the maximum speed for the
- * output measured in setpoint units per this controller's update period (see
- * the default period in this class's constructor).
- */
-double PIDController::CalculateFeedForward() {
- if (m_pidInput->GetPIDSourceType() == PIDSourceType::kRate) {
- return m_F * GetSetpoint();
- } else {
- double temp = m_F * GetDeltaSetpoint();
- m_prevSetpoint = m_setpoint;
- m_setpointTimer.Reset();
- return temp;
- }
-}
-
-/**
- * Set the PID Controller gain parameters.
- *
- * Set the proportional, integral, and differential coefficients.
- *
- * @param p Proportional coefficient
- * @param i Integral coefficient
- * @param d Differential coefficient
- */
-void PIDController::SetPID(double p, double i, double d) {
- {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- m_P = p;
- m_I = i;
- m_D = d;
- }
-
- if (m_table != nullptr) {
- m_table->PutNumber("p", m_P);
- m_table->PutNumber("i", m_I);
- m_table->PutNumber("d", m_D);
- }
-}
-
-/**
- * Set the PID Controller gain parameters.
- *
- * Set the proportional, integral, and differential coefficients.
- *
- * @param p Proportional coefficient
- * @param i Integral coefficient
- * @param d Differential coefficient
- * @param f Feed forward coefficient
- */
-void PIDController::SetPID(double p, double i, double d, double f) {
- {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- m_P = p;
- m_I = i;
- m_D = d;
- m_F = f;
- }
-
- if (m_table != nullptr) {
- m_table->PutNumber("p", m_P);
- m_table->PutNumber("i", m_I);
- m_table->PutNumber("d", m_D);
- m_table->PutNumber("f", m_F);
- }
-}
-
-/**
- * Get the Proportional coefficient.
- *
- * @return proportional coefficient
- */
-double PIDController::GetP() const {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- return m_P;
-}
-
-/**
- * Get the Integral coefficient.
- *
- * @return integral coefficient
- */
-double PIDController::GetI() const {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- return m_I;
-}
-
-/**
- * Get the Differential coefficient.
- *
- * @return differential coefficient
- */
-double PIDController::GetD() const {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- return m_D;
-}
-
-/**
- * Get the Feed forward coefficient.
- *
- * @return Feed forward coefficient
- */
-double PIDController::GetF() const {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- return m_F;
-}
-
-/**
- * Return the current PID result.
- *
- * This is always centered on zero and constrained the the max and min outs.
- *
- * @return the latest calculated output
- */
-double PIDController::Get() const {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- return m_result;
-}
-
-/**
- * Set the PID controller to consider the input to be continuous,
- *
- * Rather then using the max and min in as constraints, it considers them to
- * be the same point and automatically calculates the shortest route to
- * the setpoint.
- *
- * @param continuous true turns on continuous, false turns off continuous
- */
-void PIDController::SetContinuous(bool continuous) {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- m_continuous = continuous;
-}
-
-/**
- * Sets the maximum and minimum values expected from the input.
- *
- * @param minimumInput the minimum value expected from the input
- * @param maximumInput the maximum value expected from the output
- */
-void PIDController::SetInputRange(double minimumInput, double maximumInput) {
- {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- m_minimumInput = minimumInput;
- m_maximumInput = maximumInput;
- }
-
- SetSetpoint(m_setpoint);
-}
-
-/**
- * Sets the minimum and maximum values to write.
- *
- * @param minimumOutput the minimum value to write to the output
- * @param maximumOutput the maximum value to write to the output
- */
-void PIDController::SetOutputRange(double minimumOutput, double maximumOutput) {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- m_minimumOutput = minimumOutput;
- m_maximumOutput = maximumOutput;
-}
-
-/**
- * Set the setpoint for the PIDController.
- *
- * Clears the queue for GetAvgError().
- *
- * @param setpoint the desired setpoint
- */
-void PIDController::SetSetpoint(double setpoint) {
- {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
-
- if (m_maximumInput > m_minimumInput) {
- if (setpoint > m_maximumInput)
- m_setpoint = m_maximumInput;
- else if (setpoint < m_minimumInput)
- m_setpoint = m_minimumInput;
- else
- m_setpoint = setpoint;
- } else {
- m_setpoint = setpoint;
- }
-
- // Clear m_buf.
- m_buf = std::queue<double>();
- m_bufTotal = 0;
- }
-
- if (m_table != nullptr) {
- m_table->PutNumber("setpoint", m_setpoint);
- }
-}
-
-/**
- * Returns the current setpoint of the PIDController.
- *
- * @return the current setpoint
- */
-double PIDController::GetSetpoint() const {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- return m_setpoint;
-}
-
-/**
- * Returns the change in setpoint over time of the PIDController.
- *
- * @return the change in setpoint over time
- */
-double PIDController::GetDeltaSetpoint() const {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- return (m_setpoint - m_prevSetpoint) / m_setpointTimer.Get();
-}
-
-/**
- * Returns the current difference of the input from the setpoint.
- *
- * @return the current error
- */
-double PIDController::GetError() const {
- double setpoint = GetSetpoint();
- {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- return GetContinuousError(setpoint - m_pidInput->PIDGet());
- }
-}
-
-/**
- * Sets what type of input the PID controller will use.
- */
-void PIDController::SetPIDSourceType(PIDSourceType pidSource) {
- m_pidInput->SetPIDSourceType(pidSource);
-}
-/**
- * Returns the type of input the PID controller is using.
- *
- * @return the PID controller input type
- */
-PIDSourceType PIDController::GetPIDSourceType() const {
- return m_pidInput->GetPIDSourceType();
-}
-
-/**
- * Returns the current average of the error over the past few iterations.
- *
- * You can specify the number of iterations to average with SetToleranceBuffer()
- * (defaults to 1). This is the same value that is used for OnTarget().
- *
- * @return the average error
- */
-double PIDController::GetAvgError() const {
- double avgError = 0;
- {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- // Don't divide by zero.
- if (m_buf.size()) avgError = m_bufTotal / m_buf.size();
- }
- return avgError;
-}
-
-/*
- * Set the percentage error which is considered tolerable for use with
- * OnTarget.
- *
- * @param percentage error which is tolerable
- */
-void PIDController::SetTolerance(double percent) {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- m_toleranceType = kPercentTolerance;
- m_tolerance = percent;
-}
-
-/*
- * Set the absolute error which is considered tolerable for use with
- * OnTarget.
- *
- * @param percentage error which is tolerable
- */
-void PIDController::SetAbsoluteTolerance(double absTolerance) {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- m_toleranceType = kAbsoluteTolerance;
- m_tolerance = absTolerance;
-}
-
-/*
- * Set the percentage error which is considered tolerable for use with
- * OnTarget.
- *
- * @param percentage error which is tolerable
- */
-void PIDController::SetPercentTolerance(double percent) {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- m_toleranceType = kPercentTolerance;
- m_tolerance = percent;
-}
-
-/*
- * Set the number of previous error samples to average for tolerancing. When
- * determining whether a mechanism is on target, the user may want to use a
- * rolling average of previous measurements instead of a precise position or
- * velocity. This is useful for noisy sensors which return a few erroneous
- * measurements when the mechanism is on target. However, the mechanism will
- * not register as on target for at least the specified bufLength cycles.
- *
- * @param bufLength Number of previous cycles to average. Defaults to 1.
- */
-void PIDController::SetToleranceBuffer(int bufLength) {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- m_bufLength = bufLength;
-
- // Cut the buffer down to size if needed.
- while (m_buf.size() > static_cast<uint32_t>(bufLength)) {
- m_bufTotal -= m_buf.front();
- m_buf.pop();
- }
-}
-
-/*
- * Return true if the error is within the percentage of the total input range,
- * determined by SetTolerance. This asssumes that the maximum and minimum input
- * were set using SetInput.
- *
- * Currently this just reports on target as the actual value passes through the
- * setpoint. Ideally it should be based on being within the tolerance for some
- * period of time.
- *
- * This will return false until at least one input value has been computed.
- */
-bool PIDController::OnTarget() const {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- if (m_buf.size() == 0) return false;
- double error = GetAvgError();
- switch (m_toleranceType) {
- case kPercentTolerance:
- return std::fabs(error) <
- m_tolerance / 100 * (m_maximumInput - m_minimumInput);
- break;
- case kAbsoluteTolerance:
- return std::fabs(error) < m_tolerance;
- break;
- case kNoTolerance:
- // TODO: this case needs an error
- return false;
- }
- return false;
-}
-
-/**
- * Begin running the PIDController.
- */
-void PIDController::Enable() {
- {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- m_enabled = true;
- }
-
- if (m_table != nullptr) {
- m_table->PutBoolean("enabled", true);
- }
-}
-
-/**
- * Stop running the PIDController, this sets the output to zero before stopping.
- */
-void PIDController::Disable() {
- {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- m_pidOutput->PIDWrite(0);
- m_enabled = false;
- }
-
- if (m_table != nullptr) {
- m_table->PutBoolean("enabled", false);
- }
-}
-
-/**
- * Return true if PIDController is enabled.
- */
-bool PIDController::IsEnabled() const {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- return m_enabled;
-}
-
-/**
- * Reset the previous error, the integral term, and disable the controller.
- */
-void PIDController::Reset() {
- Disable();
-
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- m_prevError = 0;
- m_totalError = 0;
- m_result = 0;
-}
-
-std::string PIDController::GetSmartDashboardType() const {
- return "PIDController";
-}
-
-void PIDController::InitTable(std::shared_ptr<ITable> subtable) {
- if (m_table != nullptr) m_table->RemoveTableListener(this);
- m_table = subtable;
- if (m_table != nullptr) {
- m_table->PutNumber(kP, GetP());
- m_table->PutNumber(kI, GetI());
- m_table->PutNumber(kD, GetD());
- m_table->PutNumber(kF, GetF());
- m_table->PutNumber(kSetpoint, GetSetpoint());
- m_table->PutBoolean(kEnabled, IsEnabled());
- m_table->AddTableListener(this, false);
- }
-}
-
-/**
- * Wraps error around for continuous inputs. The original error is returned if
- * continuous mode is disabled. This is an unsynchronized function.
- *
- * @param error The current error of the PID controller.
- * @return Error for continuous inputs.
- */
-double PIDController::GetContinuousError(double error) const {
- if (m_continuous) {
- if (std::fabs(error) > (m_maximumInput - m_minimumInput) / 2) {
- if (error > 0) {
- return error - (m_maximumInput - m_minimumInput);
- } else {
- return error + (m_maximumInput - m_minimumInput);
- }
- }
- }
-
- return error;
-}
-
-std::shared_ptr<ITable> PIDController::GetTable() const { return m_table; }
-
-void PIDController::ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew) {
- if (key == kP || key == kI || key == kD || key == kF) {
- if (m_P != m_table->GetNumber(kP, 0.0) ||
- m_I != m_table->GetNumber(kI, 0.0) ||
- m_D != m_table->GetNumber(kD, 0.0) ||
- m_F != m_table->GetNumber(kF, 0.0)) {
- SetPID(m_table->GetNumber(kP, 0.0), m_table->GetNumber(kI, 0.0),
- m_table->GetNumber(kD, 0.0), m_table->GetNumber(kF, 0.0));
- }
- } else if (key == kSetpoint && value->IsDouble() &&
- m_setpoint != value->GetDouble()) {
- SetSetpoint(value->GetDouble());
- } else if (key == kEnabled && value->IsBoolean() &&
- m_enabled != value->GetBoolean()) {
- if (value->GetBoolean()) {
- Enable();
- } else {
- Disable();
- }
- }
-}
-
-void PIDController::UpdateTable() {}
-
-void PIDController::StartLiveWindowMode() { Disable(); }
-
-void PIDController::StopLiveWindowMode() {}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/PWM.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/PWM.cpp
deleted file mode 100644
index 41f63b5..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/PWM.cpp
+++ /dev/null
@@ -1,311 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/PWM.h"
-#include "PWM.h"
-
-#include <sstream>
-
-#include "HAL/HAL.h"
-#include "HAL/Ports.h"
-#include "Utility.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Allocate a PWM given a channel number.
- *
- * Checks channel value range and allocates the appropriate channel.
- * The allocation is only done to help users ensure that they don't double
- * assign channels.
- *
- * @param channel The PWM channel number. 0-9 are on-board, 10-19 are on the
- * MXP port
- */
-PWM::PWM(int channel) {
- std::stringstream buf;
-
- if (!CheckPWMChannel(channel)) {
- buf << "PWM Channel " << channel;
- wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
- return;
- }
-
- int32_t status = 0;
- m_handle = HAL_InitializePWMPort(HAL_GetPort(channel), &status);
- if (status != 0) {
- wpi_setErrorWithContextRange(status, 0, HAL_GetNumPWMChannels(), channel,
- HAL_GetErrorMessage(status));
- m_channel = std::numeric_limits<int>::max();
- m_handle = HAL_kInvalidHandle;
- return;
- }
-
- m_channel = channel;
-
- HAL_SetPWMDisabled(m_handle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- status = 0;
- HAL_SetPWMEliminateDeadband(m_handle, false, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- HAL_Report(HALUsageReporting::kResourceType_PWM, channel);
-}
-
-/**
- * Free the PWM channel.
- *
- * Free the resource associated with the PWM channel and set the value to 0.
- */
-PWM::~PWM() {
- int32_t status = 0;
-
- HAL_SetPWMDisabled(m_handle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- HAL_FreePWMPort(m_handle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Optionally eliminate the deadband from a speed controller.
- *
- * @param eliminateDeadband If true, set the motor curve on the Jaguar to
- * eliminate the deadband in the middle of the range.
- * Otherwise, keep the full range without modifying
- * any values.
- */
-void PWM::EnableDeadbandElimination(bool eliminateDeadband) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetPWMEliminateDeadband(m_handle, eliminateDeadband, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set the bounds on the PWM pulse widths.
- *
- * This sets the bounds on the PWM values for a particular type of controller.
- * The values determine the upper and lower speeds as well as the deadband
- * bracket.
- *
- * @param max The max PWM pulse width in ms
- * @param deadbandMax The high end of the deadband range pulse width in ms
- * @param center The center (off) pulse width in ms
- * @param deadbandMin The low end of the deadband pulse width in ms
- * @param min The minimum pulse width in ms
- */
-void PWM::SetBounds(double max, double deadbandMax, double center,
- double deadbandMin, double min) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetPWMConfig(m_handle, max, deadbandMax, center, deadbandMin, min,
- &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set the bounds on the PWM values.
- *
- * This sets the bounds on the PWM values for a particular each type of
- * controller. The values determine the upper and lower speeds as well as the
- * deadband bracket.
- *
- * @param max The Minimum pwm value
- * @param deadbandMax The high end of the deadband range
- * @param center The center speed (off)
- * @param deadbandMin The low end of the deadband range
- * @param min The minimum pwm value
- */
-void PWM::SetRawBounds(int max, int deadbandMax, int center, int deadbandMin,
- int min) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetPWMConfigRaw(m_handle, max, deadbandMax, center, deadbandMin, min,
- &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Get the bounds on the PWM values.
- *
- * This Gets the bounds on the PWM values for a particular each type of
- * controller. The values determine the upper and lower speeds as well as the
- * deadband bracket.
- *
- * @param max The Minimum pwm value
- * @param deadbandMax The high end of the deadband range
- * @param center The center speed (off)
- * @param deadbandMin The low end of the deadband range
- * @param min The minimum pwm value
- */
-void PWM::GetRawBounds(int* max, int* deadbandMax, int* center,
- int* deadbandMin, int* min) {
- int32_t status = 0;
- HAL_GetPWMConfigRaw(m_handle, max, deadbandMax, center, deadbandMin, min,
- &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set the PWM value based on a position.
- *
- * This is intended to be used by servos.
- *
- * @pre SetMaxPositivePwm() called.
- * @pre SetMinNegativePwm() called.
- *
- * @param pos The position to set the servo between 0.0 and 1.0.
- */
-void PWM::SetPosition(double pos) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetPWMPosition(m_handle, pos, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Get the PWM value in terms of a position.
- *
- * This is intended to be used by servos.
- *
- * @pre SetMaxPositivePwm() called.
- * @pre SetMinNegativePwm() called.
- *
- * @return The position the servo is set to between 0.0 and 1.0.
- */
-double PWM::GetPosition() const {
- if (StatusIsFatal()) return 0.0;
- int32_t status = 0;
- double position = HAL_GetPWMPosition(m_handle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return position;
-}
-
-/**
- * Set the PWM value based on a speed.
- *
- * This is intended to be used by speed controllers.
- *
- * @pre SetMaxPositivePwm() called.
- * @pre SetMinPositivePwm() called.
- * @pre SetCenterPwm() called.
- * @pre SetMaxNegativePwm() called.
- * @pre SetMinNegativePwm() called.
- *
- * @param speed The speed to set the speed controller between -1.0 and 1.0.
- */
-void PWM::SetSpeed(double speed) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetPWMSpeed(m_handle, speed, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Get the PWM value in terms of speed.
- *
- * This is intended to be used by speed controllers.
- *
- * @pre SetMaxPositivePwm() called.
- * @pre SetMinPositivePwm() called.
- * @pre SetMaxNegativePwm() called.
- * @pre SetMinNegativePwm() called.
- *
- * @return The most recently set speed between -1.0 and 1.0.
- */
-double PWM::GetSpeed() const {
- if (StatusIsFatal()) return 0.0;
- int32_t status = 0;
- double speed = HAL_GetPWMSpeed(m_handle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return speed;
-}
-
-/**
- * Set the PWM value directly to the hardware.
- *
- * Write a raw value to a PWM channel.
- *
- * @param value Raw PWM value.
- */
-void PWM::SetRaw(uint16_t value) {
- if (StatusIsFatal()) return;
-
- int32_t status = 0;
- HAL_SetPWMRaw(m_handle, value, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Get the PWM value directly from the hardware.
- *
- * Read a raw value from a PWM channel.
- *
- * @return Raw PWM control value.
- */
-uint16_t PWM::GetRaw() const {
- if (StatusIsFatal()) return 0;
-
- int32_t status = 0;
- uint16_t value = HAL_GetPWMRaw(m_handle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- return value;
-}
-
-/**
- * Slow down the PWM signal for old devices.
- *
- * @param mult The period multiplier to apply to this channel
- */
-void PWM::SetPeriodMultiplier(PeriodMultiplier mult) {
- if (StatusIsFatal()) return;
-
- int32_t status = 0;
-
- switch (mult) {
- case kPeriodMultiplier_4X:
- HAL_SetPWMPeriodScale(m_handle, 3,
- &status); // Squelch 3 out of 4 outputs
- break;
- case kPeriodMultiplier_2X:
- HAL_SetPWMPeriodScale(m_handle, 1,
- &status); // Squelch 1 out of 2 outputs
- break;
- case kPeriodMultiplier_1X:
- HAL_SetPWMPeriodScale(m_handle, 0, &status); // Don't squelch any outputs
- break;
- default:
- wpi_assert(false);
- }
-
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Temporarily disables the PWM output. The next set call will reenable
- * the output.
- */
-void PWM::SetDisabled() {
- if (StatusIsFatal()) return;
-
- int32_t status = 0;
-
- HAL_SetPWMDisabled(m_handle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-void PWM::SetZeroLatch() {
- if (StatusIsFatal()) return;
-
- int32_t status = 0;
-
- HAL_LatchPWMZero(m_handle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/PWMSpeedController.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/PWMSpeedController.cpp
deleted file mode 100644
index 6c5ed5a..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/PWMSpeedController.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "PWMSpeedController.h"
-
-using namespace frc;
-
-/**
- * Constructor for a PWM Speed Controller connected via PWM.
- *
- * @param channel The PWM channel that the controller is attached to. 0-9 are
- * on-board, 10-19 are on the MXP port
- */
-PWMSpeedController::PWMSpeedController(int channel) : SafePWM(channel) {}
-
-/**
- * Set the PWM value.
- *
- * The PWM value is set using a range of -1.0 to 1.0, appropriately
- * scaling the value for the FPGA.
- *
- * @param speed The speed value between -1.0 and 1.0 to set.
- */
-void PWMSpeedController::Set(double speed) {
- SetSpeed(m_isInverted ? -speed : speed);
-}
-
-/**
- * Get the recently set value of the PWM.
- *
- * @return The most recently set value for the PWM between -1.0 and 1.0.
- */
-double PWMSpeedController::Get() const { return GetSpeed(); }
-
-/**
- * Common interface for disabling a motor.
- */
-void PWMSpeedController::Disable() { SetDisabled(); }
-
-/**
- * Common interface for inverting direction of a speed controller.
- *
- * @param isInverted The state of inversion, true is inverted.
- */
-void PWMSpeedController::SetInverted(bool isInverted) {
- m_isInverted = isInverted;
-}
-
-/**
- * Common interface for the inverting direction of a speed controller.
- *
- * @return isInverted The state of inversion, true is inverted.
- *
- */
-bool PWMSpeedController::GetInverted() const { return m_isInverted; }
-
-/**
- * Write out the PID value as seen in the PIDOutput base object.
- *
- * @param output Write out the PWM value as was found in the PIDController
- */
-void PWMSpeedController::PIDWrite(double output) { Set(output); }
-
-/**
- * Common interface to stop the motor until Set is called again.
- */
-void PWMSpeedController::StopMotor() { this->SafePWM::StopMotor(); }
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/PowerDistributionPanel.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/PowerDistributionPanel.cpp
deleted file mode 100644
index d0c0b7c..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/PowerDistributionPanel.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "PowerDistributionPanel.h"
-
-#include <sstream>
-
-#include "HAL/HAL.h"
-#include "HAL/PDP.h"
-#include "HAL/Ports.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-PowerDistributionPanel::PowerDistributionPanel() : PowerDistributionPanel(0) {}
-
-/**
- * Initialize the PDP.
- */
-PowerDistributionPanel::PowerDistributionPanel(int module) : m_module(module) {
- int32_t status = 0;
- HAL_InitializePDP(m_module, &status);
- if (status != 0) {
- wpi_setErrorWithContextRange(status, 0, HAL_GetNumPDPModules(), module,
- HAL_GetErrorMessage(status));
- m_module = -1;
- return;
- }
-}
-
-/**
- * Query the input voltage of the PDP.
- *
- * @return The voltage of the PDP in volts
- */
-double PowerDistributionPanel::GetVoltage() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
-
- double voltage = HAL_GetPDPVoltage(m_module, &status);
-
- if (status) {
- wpi_setWPIErrorWithContext(Timeout, "");
- }
-
- return voltage;
-}
-
-/**
- * Query the temperature of the PDP.
- *
- * @return The temperature of the PDP in degrees Celsius
- */
-double PowerDistributionPanel::GetTemperature() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
-
- double temperature = HAL_GetPDPTemperature(m_module, &status);
-
- if (status) {
- wpi_setWPIErrorWithContext(Timeout, "");
- }
-
- return temperature;
-}
-
-/**
- * Query the current of a single channel of the PDP.
- *
- * @return The current of one of the PDP channels (channels 0-15) in Amperes
- */
-double PowerDistributionPanel::GetCurrent(int channel) const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
-
- if (!CheckPDPChannel(channel)) {
- std::stringstream buf;
- buf << "PDP Channel " << channel;
- wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
- }
-
- double current = HAL_GetPDPChannelCurrent(m_module, channel, &status);
-
- if (status) {
- wpi_setWPIErrorWithContext(Timeout, "");
- }
-
- return current;
-}
-
-/**
- * Query the total current of all monitored PDP channels (0-15).
- *
- * @return The the total current drawn from the PDP channels in Amperes
- */
-double PowerDistributionPanel::GetTotalCurrent() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
-
- double current = HAL_GetPDPTotalCurrent(m_module, &status);
-
- if (status) {
- wpi_setWPIErrorWithContext(Timeout, "");
- }
-
- return current;
-}
-
-/**
- * Query the total power drawn from the monitored PDP channels.
- *
- * @return The the total power drawn from the PDP channels in Watts
- */
-double PowerDistributionPanel::GetTotalPower() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
-
- double power = HAL_GetPDPTotalPower(m_module, &status);
-
- if (status) {
- wpi_setWPIErrorWithContext(Timeout, "");
- }
-
- return power;
-}
-
-/**
- * Query the total energy drawn from the monitored PDP channels.
- *
- * @return The the total energy drawn from the PDP channels in Joules
- */
-double PowerDistributionPanel::GetTotalEnergy() const {
- if (StatusIsFatal()) return 0;
- int32_t status = 0;
-
- double energy = HAL_GetPDPTotalEnergy(m_module, &status);
-
- if (status) {
- wpi_setWPIErrorWithContext(Timeout, "");
- }
-
- return energy;
-}
-
-/**
- * Reset the total energy drawn from the PDP.
- *
- * @see PowerDistributionPanel#GetTotalEnergy
- */
-void PowerDistributionPanel::ResetTotalEnergy() {
- if (StatusIsFatal()) return;
- int32_t status = 0;
-
- HAL_ResetPDPTotalEnergy(m_module, &status);
-
- if (status) {
- wpi_setWPIErrorWithContext(Timeout, "");
- }
-}
-
-/**
- * Remove all of the fault flags on the PDP.
- */
-void PowerDistributionPanel::ClearStickyFaults() {
- if (StatusIsFatal()) return;
- int32_t status = 0;
-
- HAL_ClearPDPStickyFaults(m_module, &status);
-
- if (status) {
- wpi_setWPIErrorWithContext(Timeout, "");
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Preferences.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Preferences.cpp
deleted file mode 100644
index a913ba0..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Preferences.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Preferences.h"
-
-#include <algorithm>
-
-#include "HAL/HAL.h"
-#include "WPIErrors.h"
-#include "llvm/StringRef.h"
-
-using namespace frc;
-
-/** The Preferences table name */
-static llvm::StringRef kTableName{"Preferences"};
-
-void Preferences::Listener::ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value,
- bool isNew) {}
-void Preferences::Listener::ValueChangedEx(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value,
- uint32_t flags) {
- source->SetPersistent(key);
-}
-
-Preferences::Preferences() : m_table(NetworkTable::GetTable(kTableName)) {
- m_table->AddTableListenerEx(&m_listener, NT_NOTIFY_NEW | NT_NOTIFY_IMMEDIATE);
- HAL_Report(HALUsageReporting::kResourceType_Preferences, 0);
-}
-
-/**
- * Get the one and only {@link Preferences} object.
- *
- * @return pointer to the {@link Preferences}
- */
-Preferences* Preferences::GetInstance() {
- static Preferences instance;
- return &instance;
-}
-
-/**
- * Returns a vector of all the keys.
- *
- * @return a vector of the keys
- */
-std::vector<std::string> Preferences::GetKeys() { return m_table->GetKeys(); }
-
-/**
- * Returns the string at the given key. If this table does not have a value
- * for that position, then the given defaultValue will be returned.
- *
- * @param key the key
- * @param defaultValue the value to return if none exists in the table
- * @return either the value in the table, or the defaultValue
- */
-std::string Preferences::GetString(llvm::StringRef key,
- llvm::StringRef defaultValue) {
- return m_table->GetString(key, defaultValue);
-}
-
-/**
- * Returns the int at the given key. If this table does not have a value for
- * that position, then the given defaultValue value will be returned.
- *
- * @param key the key
- * @param defaultValue the value to return if none exists in the table
- * @return either the value in the table, or the defaultValue
- */
-int Preferences::GetInt(llvm::StringRef key, int defaultValue) {
- return static_cast<int>(m_table->GetNumber(key, defaultValue));
-}
-
-/**
- * Returns the double at the given key. If this table does not have a value
- * for that position, then the given defaultValue value will be returned.
- *
- * @param key the key
- * @param defaultValue the value to return if none exists in the table
- * @return either the value in the table, or the defaultValue
- */
-double Preferences::GetDouble(llvm::StringRef key, double defaultValue) {
- return m_table->GetNumber(key, defaultValue);
-}
-
-/**
- * Returns the float at the given key. If this table does not have a value
- * for that position, then the given defaultValue value will be returned.
- *
- * @param key the key
- * @param defaultValue the value to return if none exists in the table
- * @return either the value in the table, or the defaultValue
- */
-float Preferences::GetFloat(llvm::StringRef key, float defaultValue) {
- return m_table->GetNumber(key, defaultValue);
-}
-
-/**
- * Returns the boolean at the given key. If this table does not have a value
- * for that position, then the given defaultValue value will be returned.
- *
- * @param key the key
- * @param defaultValue the value to return if none exists in the table
- * @return either the value in the table, or the defaultValue
- */
-bool Preferences::GetBoolean(llvm::StringRef key, bool defaultValue) {
- return m_table->GetBoolean(key, defaultValue);
-}
-
-/**
- * Returns the long (int64_t) at the given key. If this table does not have a
- * value for that position, then the given defaultValue value will be returned.
- *
- * @param key the key
- * @param defaultValue the value to return if none exists in the table
- * @return either the value in the table, or the defaultValue
- */
-int64_t Preferences::GetLong(llvm::StringRef key, int64_t defaultValue) {
- return static_cast<int64_t>(m_table->GetNumber(key, defaultValue));
-}
-
-/**
- * Puts the given string into the preferences table.
- *
- * <p>The value may not have quotation marks, nor may the key
- * have any whitespace nor an equals sign</p>
- *
- * @param key the key
- * @param value the value
- */
-void Preferences::PutString(llvm::StringRef key, llvm::StringRef value) {
- m_table->PutString(key, value);
- m_table->SetPersistent(key);
-}
-
-/**
- * Puts the given int into the preferences table.
- *
- * <p>The key may not have any whitespace nor an equals sign</p>
- *
- * @param key the key
- * @param value the value
- */
-void Preferences::PutInt(llvm::StringRef key, int value) {
- m_table->PutNumber(key, value);
- m_table->SetPersistent(key);
-}
-
-/**
- * Puts the given double into the preferences table.
- *
- * <p>The key may not have any whitespace nor an equals sign</p>
- *
- * @param key the key
- * @param value the value
- */
-void Preferences::PutDouble(llvm::StringRef key, double value) {
- m_table->PutNumber(key, value);
- m_table->SetPersistent(key);
-}
-
-/**
- * Puts the given float into the preferences table.
- *
- * <p>The key may not have any whitespace nor an equals sign</p>
- *
- * @param key the key
- * @param value the value
- */
-void Preferences::PutFloat(llvm::StringRef key, float value) {
- m_table->PutNumber(key, value);
- m_table->SetPersistent(key);
-}
-
-/**
- * Puts the given boolean into the preferences table.
- *
- * <p>The key may not have any whitespace nor an equals sign</p>
- *
- * @param key the key
- * @param value the value
- */
-void Preferences::PutBoolean(llvm::StringRef key, bool value) {
- m_table->PutBoolean(key, value);
- m_table->SetPersistent(key);
-}
-
-/**
- * Puts the given long (int64_t) into the preferences table.
- *
- * <p>The key may not have any whitespace nor an equals sign</p>
- *
- * @param key the key
- * @param value the value
- */
-void Preferences::PutLong(llvm::StringRef key, int64_t value) {
- m_table->PutNumber(key, value);
- m_table->SetPersistent(key);
-}
-
-/**
- * This function is no longer required, as NetworkTables automatically
- * saves persistent values (which all Preferences values are) periodically
- * when running as a server.
- * @deprecated backwards compatibility shim
- */
-void Preferences::Save() {}
-
-/**
- * Returns whether or not there is a key with the given name.
- *
- * @param key the key
- * @return if there is a value at the given key
- */
-bool Preferences::ContainsKey(llvm::StringRef key) {
- return m_table->ContainsKey(key);
-}
-
-/**
- * Remove a preference.
- *
- * @param key the key
- */
-void Preferences::Remove(llvm::StringRef key) { m_table->Delete(key); }
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Relay.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Relay.cpp
deleted file mode 100644
index 3e9597a..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Relay.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Relay.h"
-#include "Relay.h"
-
-#include <sstream>
-
-#include "HAL/HAL.h"
-#include "HAL/Ports.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Relay constructor given a channel.
- *
- * This code initializes the relay and reserves all resources that need to be
- * locked. Initially the relay is set to both lines at 0v.
- *
- * @param channel The channel number (0-3).
- * @param direction The direction that the Relay object will control.
- */
-Relay::Relay(int channel, Relay::Direction direction)
- : m_channel(channel), m_direction(direction) {
- std::stringstream buf;
- if (!SensorBase::CheckRelayChannel(m_channel)) {
- buf << "Relay Channel " << m_channel;
- wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
- return;
- }
-
- HAL_PortHandle portHandle = HAL_GetPort(channel);
-
- if (m_direction == kBothDirections || m_direction == kForwardOnly) {
- int32_t status = 0;
- m_forwardHandle = HAL_InitializeRelayPort(portHandle, true, &status);
- if (status != 0) {
- wpi_setErrorWithContextRange(status, 0, HAL_GetNumRelayChannels(),
- channel, HAL_GetErrorMessage(status));
- m_forwardHandle = HAL_kInvalidHandle;
- m_reverseHandle = HAL_kInvalidHandle;
- return;
- }
- HAL_Report(HALUsageReporting::kResourceType_Relay, m_channel);
- }
- if (m_direction == kBothDirections || m_direction == kReverseOnly) {
- int32_t status = 0;
- m_reverseHandle = HAL_InitializeRelayPort(portHandle, false, &status);
- if (status != 0) {
- wpi_setErrorWithContextRange(status, 0, HAL_GetNumRelayChannels(),
- channel, HAL_GetErrorMessage(status));
- m_forwardHandle = HAL_kInvalidHandle;
- m_reverseHandle = HAL_kInvalidHandle;
- return;
- }
-
- HAL_Report(HALUsageReporting::kResourceType_Relay, m_channel + 128);
- }
-
- int32_t status = 0;
- if (m_forwardHandle != HAL_kInvalidHandle) {
- HAL_SetRelay(m_forwardHandle, false, &status);
- if (status != 0) {
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- m_forwardHandle = HAL_kInvalidHandle;
- m_reverseHandle = HAL_kInvalidHandle;
- return;
- }
- }
- if (m_reverseHandle != HAL_kInvalidHandle) {
- HAL_SetRelay(m_reverseHandle, false, &status);
- if (status != 0) {
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- m_forwardHandle = HAL_kInvalidHandle;
- m_reverseHandle = HAL_kInvalidHandle;
- return;
- }
- }
-}
-
-/**
- * Free the resource associated with a relay.
- *
- * The relay channels are set to free and the relay output is turned off.
- */
-Relay::~Relay() {
- int32_t status = 0;
- HAL_SetRelay(m_forwardHandle, false, &status);
- HAL_SetRelay(m_reverseHandle, false, &status);
- // ignore errors, as we want to make sure a free happens.
- if (m_forwardHandle != HAL_kInvalidHandle) HAL_FreeRelayPort(m_forwardHandle);
- if (m_reverseHandle != HAL_kInvalidHandle) HAL_FreeRelayPort(m_reverseHandle);
-}
-
-/**
- * Set the relay state.
- *
- * Valid values depend on which directions of the relay are controlled by the
- * object.
- *
- * When set to kBothDirections, the relay can be any of the four states:
- * 0v-0v, 0v-12v, 12v-0v, 12v-12v
- *
- * When set to kForwardOnly or kReverseOnly, you can specify the constant for
- * the direction or you can simply specify kOff and kOn. Using only kOff and
- * kOn is recommended.
- *
- * @param value The state to set the relay.
- */
-void Relay::Set(Relay::Value value) {
- if (StatusIsFatal()) return;
-
- int32_t status = 0;
-
- switch (value) {
- case kOff:
- if (m_direction == kBothDirections || m_direction == kForwardOnly) {
- HAL_SetRelay(m_forwardHandle, false, &status);
- }
- if (m_direction == kBothDirections || m_direction == kReverseOnly) {
- HAL_SetRelay(m_reverseHandle, false, &status);
- }
- break;
- case kOn:
- if (m_direction == kBothDirections || m_direction == kForwardOnly) {
- HAL_SetRelay(m_forwardHandle, true, &status);
- }
- if (m_direction == kBothDirections || m_direction == kReverseOnly) {
- HAL_SetRelay(m_reverseHandle, true, &status);
- }
- break;
- case kForward:
- if (m_direction == kReverseOnly) {
- wpi_setWPIError(IncompatibleMode);
- break;
- }
- if (m_direction == kBothDirections || m_direction == kForwardOnly) {
- HAL_SetRelay(m_forwardHandle, true, &status);
- }
- if (m_direction == kBothDirections) {
- HAL_SetRelay(m_reverseHandle, false, &status);
- }
- break;
- case kReverse:
- if (m_direction == kForwardOnly) {
- wpi_setWPIError(IncompatibleMode);
- break;
- }
- if (m_direction == kBothDirections) {
- HAL_SetRelay(m_forwardHandle, false, &status);
- }
- if (m_direction == kBothDirections || m_direction == kReverseOnly) {
- HAL_SetRelay(m_reverseHandle, true, &status);
- }
- break;
- }
-
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Get the Relay State
- *
- * Gets the current state of the relay.
- *
- * When set to kForwardOnly or kReverseOnly, value is returned as kOn/kOff not
- * kForward/kReverse (per the recommendation in Set)
- *
- * @return The current state of the relay as a Relay::Value
- */
-Relay::Value Relay::Get() const {
- int32_t status;
-
- if (HAL_GetRelay(m_forwardHandle, &status)) {
- if (HAL_GetRelay(m_reverseHandle, &status)) {
- return kOn;
- } else {
- if (m_direction == kForwardOnly) {
- return kOn;
- } else {
- return kForward;
- }
- }
- } else {
- if (HAL_GetRelay(m_reverseHandle, &status)) {
- if (m_direction == kReverseOnly) {
- return kOn;
- } else {
- return kReverse;
- }
- } else {
- return kOff;
- }
- }
-
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-int Relay::GetChannel() const { return m_channel; }
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/RobotBase.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/RobotBase.cpp
deleted file mode 100644
index b821fa5..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/RobotBase.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "RobotBase.h"
-
-#include <cstdio>
-
-#include "DriverStation.h"
-#include "HAL/HAL.h"
-#include "HLUsageReporting.h"
-#include "Internal/HardwareHLReporting.h"
-#include "RobotState.h"
-#include "Utility.h"
-#include "WPILibVersion.h"
-
-using namespace frc;
-
-std::thread::id RobotBase::m_threadId;
-
-/**
- * Constructor for a generic robot program.
- *
- * User code should be placed in the constructor that runs before the Autonomous
- * or Operator Control period starts. The constructor will run to completion
- * before Autonomous is entered.
- *
- * This must be used to ensure that the communications code starts. In the
- * future it would be nice to put this code into it's own task that loads on
- * boot so ensure that it runs.
- */
-RobotBase::RobotBase() : m_ds(DriverStation::GetInstance()) {
- m_threadId = std::this_thread::get_id();
-
- RobotState::SetImplementation(DriverStation::GetInstance());
- HLUsageReporting::SetImplementation(new HardwareHLReporting());
-
- std::FILE* file = nullptr;
- file = std::fopen("/tmp/frc_versions/FRC_Lib_Version.ini", "w");
-
- if (file != nullptr) {
- std::fputs("C++ ", file);
- std::fputs(WPILibVersion, file);
- std::fclose(file);
- }
-}
-
-/**
- * Determine if the Robot is currently enabled.
- * @return True if the Robot is currently enabled by the field controls.
- */
-bool RobotBase::IsEnabled() const { return m_ds.IsEnabled(); }
-
-/**
- * Determine if the Robot is currently disabled.
- * @return True if the Robot is currently disabled by the field controls.
- */
-bool RobotBase::IsDisabled() const { return m_ds.IsDisabled(); }
-
-/**
- * Determine if the robot is currently in Autonomous mode.
- * @return True if the robot is currently operating Autonomously as determined
- * by the field controls.
- */
-bool RobotBase::IsAutonomous() const { return m_ds.IsAutonomous(); }
-
-/**
- * Determine if the robot is currently in Operator Control mode.
- * @return True if the robot is currently operating in Tele-Op mode as
- * determined by the field controls.
- */
-bool RobotBase::IsOperatorControl() const { return m_ds.IsOperatorControl(); }
-
-/**
- * Determine if the robot is currently in Test mode.
- * @return True if the robot is currently running tests as determined by the
- * field controls.
- */
-bool RobotBase::IsTest() const { return m_ds.IsTest(); }
-
-/**
- * Indicates if new data is available from the driver station.
- * @return Has new data arrived over the network since the last time this
- * function was called?
- */
-bool RobotBase::IsNewDataAvailable() const { return m_ds.IsNewControlData(); }
-
-/**
- * Gets the ID of the main robot thread
- */
-std::thread::id RobotBase::GetThreadId() { return m_threadId; }
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/RobotDrive.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/RobotDrive.cpp
deleted file mode 100644
index 73011a4..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/RobotDrive.cpp
+++ /dev/null
@@ -1,747 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "RobotDrive.h"
-
-#include <algorithm>
-#include <cmath>
-
-#include "GenericHID.h"
-#include "HAL/HAL.h"
-#include "Joystick.h"
-#include "Talon.h"
-#include "Utility.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-const int RobotDrive::kMaxNumberOfMotors;
-
-static auto make_shared_nodelete(SpeedController* ptr) {
- return std::shared_ptr<SpeedController>(ptr, NullDeleter<SpeedController>());
-}
-
-/*
- * Driving functions
- * These functions provide an interface to multiple motors that is used for C
- * programming.
- * The Drive(speed, direction) function is the main part of the set that makes
- * it easy to set speeds and direction independently in one call.
- */
-
-/**
- * Common function to initialize all the robot drive constructors.
- *
- * Create a motor safety object (the real reason for the common code) and
- * initialize all the motor assignments. The default timeout is set for the
- * robot drive.
- */
-void RobotDrive::InitRobotDrive() {
- m_safetyHelper = std::make_unique<MotorSafetyHelper>(this);
- m_safetyHelper->SetSafetyEnabled(true);
-}
-
-/**
- * Constructor for RobotDrive with 2 motors specified with channel numbers.
- *
- * Set up parameters for a two wheel drive system where the
- * left and right motor pwm channels are specified in the call.
- * This call assumes Talons for controlling the motors.
- *
- * @param leftMotorChannel The PWM channel number that drives the left motor.
- * 0-9 are on-board, 10-19 are on the MXP port
- * @param rightMotorChannel The PWM channel number that drives the right motor.
- * 0-9 are on-board, 10-19 are on the MXP port
- */
-RobotDrive::RobotDrive(int leftMotorChannel, int rightMotorChannel) {
- InitRobotDrive();
- m_rearLeftMotor = std::make_shared<Talon>(leftMotorChannel);
- m_rearRightMotor = std::make_shared<Talon>(rightMotorChannel);
- SetLeftRightMotorOutputs(0.0, 0.0);
-}
-
-/**
- * Constructor for RobotDrive with 4 motors specified with channel numbers.
- *
- * Set up parameters for a four wheel drive system where all four motor
- * pwm channels are specified in the call.
- * This call assumes Talons for controlling the motors.
- *
- * @param frontLeftMotor Front left motor channel number. 0-9 are on-board,
- * 10-19 are on the MXP port
- * @param rearLeftMotor Rear Left motor channel number. 0-9 are on-board,
- * 10-19 are on the MXP port
- * @param frontRightMotor Front right motor channel number. 0-9 are on-board,
- * 10-19 are on the MXP port
- * @param rearRightMotor Rear Right motor channel number. 0-9 are on-board,
- * 10-19 are on the MXP port
- */
-RobotDrive::RobotDrive(int frontLeftMotor, int rearLeftMotor,
- int frontRightMotor, int rearRightMotor) {
- InitRobotDrive();
- m_rearLeftMotor = std::make_shared<Talon>(rearLeftMotor);
- m_rearRightMotor = std::make_shared<Talon>(rearRightMotor);
- m_frontLeftMotor = std::make_shared<Talon>(frontLeftMotor);
- m_frontRightMotor = std::make_shared<Talon>(frontRightMotor);
- SetLeftRightMotorOutputs(0.0, 0.0);
-}
-
-/**
- * Constructor for RobotDrive with 2 motors specified as SpeedController
- * objects.
- *
- * The SpeedController version of the constructor enables programs to use the
- * RobotDrive classes with subclasses of the SpeedController objects, for
- * example, versions with ramping or reshaping of the curve to suit motor bias
- * or deadband elimination.
- *
- * @param leftMotor The left SpeedController object used to drive the robot.
- * @param rightMotor The right SpeedController object used to drive the robot.
- */
-RobotDrive::RobotDrive(SpeedController* leftMotor,
- SpeedController* rightMotor) {
- InitRobotDrive();
- if (leftMotor == nullptr || rightMotor == nullptr) {
- wpi_setWPIError(NullParameter);
- m_rearLeftMotor = m_rearRightMotor = nullptr;
- return;
- }
- m_rearLeftMotor = make_shared_nodelete(leftMotor);
- m_rearRightMotor = make_shared_nodelete(rightMotor);
-}
-
-// TODO: Change to rvalue references & move syntax.
-RobotDrive::RobotDrive(SpeedController& leftMotor,
- SpeedController& rightMotor) {
- InitRobotDrive();
- m_rearLeftMotor = make_shared_nodelete(&leftMotor);
- m_rearRightMotor = make_shared_nodelete(&rightMotor);
-}
-
-RobotDrive::RobotDrive(std::shared_ptr<SpeedController> leftMotor,
- std::shared_ptr<SpeedController> rightMotor) {
- InitRobotDrive();
- if (leftMotor == nullptr || rightMotor == nullptr) {
- wpi_setWPIError(NullParameter);
- m_rearLeftMotor = m_rearRightMotor = nullptr;
- return;
- }
- m_rearLeftMotor = leftMotor;
- m_rearRightMotor = rightMotor;
-}
-
-/**
- * Constructor for RobotDrive with 4 motors specified as SpeedController
- * objects.
- *
- * Speed controller input version of RobotDrive (see previous comments).
- *
- * @param frontLeftMotor The front left SpeedController object used to drive
- * the robot.
- * @param rearLeftMotor The back left SpeedController object used to drive
- * the robot.
- * @param frontRightMotor The front right SpeedController object used to drive
- * the robot.
- * @param rearRightMotor The back right SpeedController object used to drive
- * the robot.
- */
-RobotDrive::RobotDrive(SpeedController* frontLeftMotor,
- SpeedController* rearLeftMotor,
- SpeedController* frontRightMotor,
- SpeedController* rearRightMotor) {
- InitRobotDrive();
- if (frontLeftMotor == nullptr || rearLeftMotor == nullptr ||
- frontRightMotor == nullptr || rearRightMotor == nullptr) {
- wpi_setWPIError(NullParameter);
- return;
- }
- m_frontLeftMotor = make_shared_nodelete(frontLeftMotor);
- m_rearLeftMotor = make_shared_nodelete(rearLeftMotor);
- m_frontRightMotor = make_shared_nodelete(frontRightMotor);
- m_rearRightMotor = make_shared_nodelete(rearRightMotor);
-}
-
-RobotDrive::RobotDrive(SpeedController& frontLeftMotor,
- SpeedController& rearLeftMotor,
- SpeedController& frontRightMotor,
- SpeedController& rearRightMotor) {
- InitRobotDrive();
- m_frontLeftMotor = make_shared_nodelete(&frontLeftMotor);
- m_rearLeftMotor = make_shared_nodelete(&rearLeftMotor);
- m_frontRightMotor = make_shared_nodelete(&frontRightMotor);
- m_rearRightMotor = make_shared_nodelete(&rearRightMotor);
-}
-
-RobotDrive::RobotDrive(std::shared_ptr<SpeedController> frontLeftMotor,
- std::shared_ptr<SpeedController> rearLeftMotor,
- std::shared_ptr<SpeedController> frontRightMotor,
- std::shared_ptr<SpeedController> rearRightMotor) {
- InitRobotDrive();
- if (frontLeftMotor == nullptr || rearLeftMotor == nullptr ||
- frontRightMotor == nullptr || rearRightMotor == nullptr) {
- wpi_setWPIError(NullParameter);
- return;
- }
- m_frontLeftMotor = frontLeftMotor;
- m_rearLeftMotor = rearLeftMotor;
- m_frontRightMotor = frontRightMotor;
- m_rearRightMotor = rearRightMotor;
-}
-
-/**
- * Drive the motors at "outputMagnitude" and "curve".
- * Both outputMagnitude and curve are -1.0 to +1.0 values, where 0.0 represents
- * stopped and not turning. curve < 0 will turn left and curve > 0 will turn
- * right.
- *
- * The algorithm for steering provides a constant turn radius for any normal
- * speed range, both forward and backward. Increasing m_sensitivity causes
- * sharper turns for fixed values of curve.
- *
- * This function will most likely be used in an autonomous routine.
- *
- * @param outputMagnitude The speed setting for the outside wheel in a turn,
- * forward or backwards, +1 to -1.
- * @param curve The rate of turn, constant for different forward
- * speeds. Set curve < 0 for left turn or curve > 0 for
- * right turn.
- *
- * Set curve = e^(-r/w) to get a turn radius r for wheelbase w of your robot.
- * Conversely, turn radius r = -ln(curve)*w for a given value of curve and
- * wheelbase w.
- */
-void RobotDrive::Drive(double outputMagnitude, double curve) {
- double leftOutput, rightOutput;
- static bool reported = false;
- if (!reported) {
- HAL_Report(HALUsageReporting::kResourceType_RobotDrive, GetNumMotors(),
- HALUsageReporting::kRobotDrive_ArcadeRatioCurve);
- reported = true;
- }
-
- if (curve < 0) {
- double value = std::log(-curve);
- double ratio = (value - m_sensitivity) / (value + m_sensitivity);
- if (ratio == 0) ratio = .0000000001;
- leftOutput = outputMagnitude / ratio;
- rightOutput = outputMagnitude;
- } else if (curve > 0) {
- double value = std::log(curve);
- double ratio = (value - m_sensitivity) / (value + m_sensitivity);
- if (ratio == 0) ratio = .0000000001;
- leftOutput = outputMagnitude;
- rightOutput = outputMagnitude / ratio;
- } else {
- leftOutput = outputMagnitude;
- rightOutput = outputMagnitude;
- }
- SetLeftRightMotorOutputs(leftOutput, rightOutput);
-}
-
-/**
- * Provide tank steering using the stored robot configuration.
- *
- * Drive the robot using two joystick inputs. The Y-axis will be selected from
- * each Joystick object.
- *
- * @param leftStick The joystick to control the left side of the robot.
- * @param rightStick The joystick to control the right side of the robot.
- */
-void RobotDrive::TankDrive(GenericHID* leftStick, GenericHID* rightStick,
- bool squaredInputs) {
- if (leftStick == nullptr || rightStick == nullptr) {
- wpi_setWPIError(NullParameter);
- return;
- }
- TankDrive(leftStick->GetY(), rightStick->GetY(), squaredInputs);
-}
-
-void RobotDrive::TankDrive(GenericHID& leftStick, GenericHID& rightStick,
- bool squaredInputs) {
- TankDrive(leftStick.GetY(), rightStick.GetY(), squaredInputs);
-}
-
-/**
- * Provide tank steering using the stored robot configuration.
- *
- * This function lets you pick the axis to be used on each Joystick object for
- * the left and right sides of the robot.
- *
- * @param leftStick The Joystick object to use for the left side of the robot.
- * @param leftAxis The axis to select on the left side Joystick object.
- * @param rightStick The Joystick object to use for the right side of the
- * robot.
- * @param rightAxis The axis to select on the right side Joystick object.
- */
-void RobotDrive::TankDrive(GenericHID* leftStick, int leftAxis,
- GenericHID* rightStick, int rightAxis,
- bool squaredInputs) {
- if (leftStick == nullptr || rightStick == nullptr) {
- wpi_setWPIError(NullParameter);
- return;
- }
- TankDrive(leftStick->GetRawAxis(leftAxis), rightStick->GetRawAxis(rightAxis),
- squaredInputs);
-}
-
-void RobotDrive::TankDrive(GenericHID& leftStick, int leftAxis,
- GenericHID& rightStick, int rightAxis,
- bool squaredInputs) {
- TankDrive(leftStick.GetRawAxis(leftAxis), rightStick.GetRawAxis(rightAxis),
- squaredInputs);
-}
-
-/**
- * Provide tank steering using the stored robot configuration.
- *
- * This function lets you directly provide joystick values from any source.
- *
- * @param leftValue The value of the left stick.
- * @param rightValue The value of the right stick.
- */
-void RobotDrive::TankDrive(double leftValue, double rightValue,
- bool squaredInputs) {
- static bool reported = false;
- if (!reported) {
- HAL_Report(HALUsageReporting::kResourceType_RobotDrive, GetNumMotors(),
- HALUsageReporting::kRobotDrive_Tank);
- reported = true;
- }
-
- // square the inputs (while preserving the sign) to increase fine control
- // while permitting full power
- leftValue = Limit(leftValue);
- rightValue = Limit(rightValue);
- if (squaredInputs) {
- if (leftValue >= 0.0) {
- leftValue = (leftValue * leftValue);
- } else {
- leftValue = -(leftValue * leftValue);
- }
- if (rightValue >= 0.0) {
- rightValue = (rightValue * rightValue);
- } else {
- rightValue = -(rightValue * rightValue);
- }
- }
-
- SetLeftRightMotorOutputs(leftValue, rightValue);
-}
-
-/**
- * Arcade drive implements single stick driving.
- *
- * Given a single Joystick, the class assumes the Y axis for the move value and
- * the X axis for the rotate value.
- * (Should add more information here regarding the way that arcade drive works.)
- *
- * @param stick The joystick to use for Arcade single-stick driving.
- * The Y-axis will be selected for forwards/backwards and
- * the X-axis will be selected for rotation rate.
- * @param squaredInputs If true, the sensitivity will be increased for small
- * values
- */
-void RobotDrive::ArcadeDrive(GenericHID* stick, bool squaredInputs) {
- // simply call the full-featured ArcadeDrive with the appropriate values
- ArcadeDrive(stick->GetY(), stick->GetX(), squaredInputs);
-}
-
-/**
- * Arcade drive implements single stick driving.
- *
- * Given a single Joystick, the class assumes the Y axis for the move value and
- * the X axis for the rotate value.
- * (Should add more information here regarding the way that arcade drive works.)
- *
- * @param stick The joystick to use for Arcade single-stick driving.
- * The Y-axis will be selected for forwards/backwards and
- * the X-axis will be selected for rotation rate.
- * @param squaredInputs If true, the sensitivity will be increased for small
- * values
- */
-void RobotDrive::ArcadeDrive(GenericHID& stick, bool squaredInputs) {
- // simply call the full-featured ArcadeDrive with the appropriate values
- ArcadeDrive(stick.GetY(), stick.GetX(), squaredInputs);
-}
-
-/**
- * Arcade drive implements single stick driving.
- *
- * Given two joystick instances and two axis, compute the values to send to
- * either two or four motors.
- *
- * @param moveStick The Joystick object that represents the
- * forward/backward direction
- * @param moveAxis The axis on the moveStick object to use for
- * forwards/backwards (typically Y_AXIS)
- * @param rotateStick The Joystick object that represents the rotation value
- * @param rotateAxis The axis on the rotation object to use for the rotate
- * right/left (typically X_AXIS)
- * @param squaredInputs Setting this parameter to true increases the
- * sensitivity at lower speeds
- */
-void RobotDrive::ArcadeDrive(GenericHID* moveStick, int moveAxis,
- GenericHID* rotateStick, int rotateAxis,
- bool squaredInputs) {
- double moveValue = moveStick->GetRawAxis(moveAxis);
- double rotateValue = rotateStick->GetRawAxis(rotateAxis);
-
- ArcadeDrive(moveValue, rotateValue, squaredInputs);
-}
-
-/**
- * Arcade drive implements single stick driving.
- *
- * Given two joystick instances and two axis, compute the values to send to
- * either two or four motors.
- *
- * @param moveStick The Joystick object that represents the
- * forward/backward direction
- * @param moveAxis The axis on the moveStick object to use for
- * forwards/backwards (typically Y_AXIS)
- * @param rotateStick The Joystick object that represents the rotation value
- * @param rotateAxis The axis on the rotation object to use for the rotate
- * right/left (typically X_AXIS)
- * @param squaredInputs Setting this parameter to true increases the
- * sensitivity at lower speeds
- */
-void RobotDrive::ArcadeDrive(GenericHID& moveStick, int moveAxis,
- GenericHID& rotateStick, int rotateAxis,
- bool squaredInputs) {
- double moveValue = moveStick.GetRawAxis(moveAxis);
- double rotateValue = rotateStick.GetRawAxis(rotateAxis);
-
- ArcadeDrive(moveValue, rotateValue, squaredInputs);
-}
-
-/**
- * Arcade drive implements single stick driving.
- *
- * This function lets you directly provide joystick values from any source.
- *
- * @param moveValue The value to use for fowards/backwards
- * @param rotateValue The value to use for the rotate right/left
- * @param squaredInputs If set, increases the sensitivity at low speeds
- */
-void RobotDrive::ArcadeDrive(double moveValue, double rotateValue,
- bool squaredInputs) {
- static bool reported = false;
- if (!reported) {
- HAL_Report(HALUsageReporting::kResourceType_RobotDrive, GetNumMotors(),
- HALUsageReporting::kRobotDrive_ArcadeStandard);
- reported = true;
- }
-
- // local variables to hold the computed PWM values for the motors
- double leftMotorOutput;
- double rightMotorOutput;
-
- moveValue = Limit(moveValue);
- rotateValue = Limit(rotateValue);
-
- if (squaredInputs) {
- // square the inputs (while preserving the sign) to increase fine control
- // while permitting full power
- if (moveValue >= 0.0) {
- moveValue = (moveValue * moveValue);
- } else {
- moveValue = -(moveValue * moveValue);
- }
- if (rotateValue >= 0.0) {
- rotateValue = (rotateValue * rotateValue);
- } else {
- rotateValue = -(rotateValue * rotateValue);
- }
- }
-
- if (moveValue > 0.0) {
- if (rotateValue > 0.0) {
- leftMotorOutput = moveValue - rotateValue;
- rightMotorOutput = std::max(moveValue, rotateValue);
- } else {
- leftMotorOutput = std::max(moveValue, -rotateValue);
- rightMotorOutput = moveValue + rotateValue;
- }
- } else {
- if (rotateValue > 0.0) {
- leftMotorOutput = -std::max(-moveValue, rotateValue);
- rightMotorOutput = moveValue + rotateValue;
- } else {
- leftMotorOutput = moveValue - rotateValue;
- rightMotorOutput = -std::max(-moveValue, -rotateValue);
- }
- }
- SetLeftRightMotorOutputs(leftMotorOutput, rightMotorOutput);
-}
-
-/**
- * Drive method for Mecanum wheeled robots.
- *
- * A method for driving with Mecanum wheeled robots. There are 4 wheels
- * on the robot, arranged so that the front and back wheels are toed in 45
- * degrees.
- * When looking at the wheels from the top, the roller axles should form an X
- * across the robot.
- *
- * This is designed to be directly driven by joystick axes.
- *
- * @param x The speed that the robot should drive in the X direction.
- * [-1.0..1.0]
- * @param y The speed that the robot should drive in the Y direction.
- * This input is inverted to match the forward == -1.0 that
- * joysticks produce. [-1.0..1.0]
- * @param rotation The rate of rotation for the robot that is completely
- * independent of the translation. [-1.0..1.0]
- * @param gyroAngle The current angle reading from the gyro. Use this to
- * implement field-oriented controls.
- */
-void RobotDrive::MecanumDrive_Cartesian(double x, double y, double rotation,
- double gyroAngle) {
- static bool reported = false;
- if (!reported) {
- HAL_Report(HALUsageReporting::kResourceType_RobotDrive, GetNumMotors(),
- HALUsageReporting::kRobotDrive_MecanumCartesian);
- reported = true;
- }
-
- double xIn = x;
- double yIn = y;
- // Negate y for the joystick.
- yIn = -yIn;
- // Compenstate for gyro angle.
- RotateVector(xIn, yIn, gyroAngle);
-
- double wheelSpeeds[kMaxNumberOfMotors];
- wheelSpeeds[kFrontLeftMotor] = xIn + yIn + rotation;
- wheelSpeeds[kFrontRightMotor] = -xIn + yIn - rotation;
- wheelSpeeds[kRearLeftMotor] = -xIn + yIn + rotation;
- wheelSpeeds[kRearRightMotor] = xIn + yIn - rotation;
-
- Normalize(wheelSpeeds);
-
- m_frontLeftMotor->Set(wheelSpeeds[kFrontLeftMotor] * m_maxOutput);
- m_frontRightMotor->Set(wheelSpeeds[kFrontRightMotor] * m_maxOutput);
- m_rearLeftMotor->Set(wheelSpeeds[kRearLeftMotor] * m_maxOutput);
- m_rearRightMotor->Set(wheelSpeeds[kRearRightMotor] * m_maxOutput);
-
- m_safetyHelper->Feed();
-}
-
-/**
- * Drive method for Mecanum wheeled robots.
- *
- * A method for driving with Mecanum wheeled robots. There are 4 wheels
- * on the robot, arranged so that the front and back wheels are toed in 45
- * degrees.
- * When looking at the wheels from the top, the roller axles should form an X
- * across the robot.
- *
- * @param magnitude The speed that the robot should drive in a given direction.
- * [-1.0..1.0]
- * @param direction The direction the robot should drive in degrees. The
- * direction and maginitute are independent of the rotation
- * rate.
- * @param rotation The rate of rotation for the robot that is completely
- * independent of the magnitute or direction. [-1.0..1.0]
- */
-void RobotDrive::MecanumDrive_Polar(double magnitude, double direction,
- double rotation) {
- static bool reported = false;
- if (!reported) {
- HAL_Report(HALUsageReporting::kResourceType_RobotDrive, GetNumMotors(),
- HALUsageReporting::kRobotDrive_MecanumPolar);
- reported = true;
- }
-
- // Normalized for full power along the Cartesian axes.
- magnitude = Limit(magnitude) * std::sqrt(2.0);
- // The rollers are at 45 degree angles.
- double dirInRad = (direction + 45.0) * 3.14159 / 180.0;
- double cosD = std::cos(dirInRad);
- double sinD = std::sin(dirInRad);
-
- double wheelSpeeds[kMaxNumberOfMotors];
- wheelSpeeds[kFrontLeftMotor] = sinD * magnitude + rotation;
- wheelSpeeds[kFrontRightMotor] = cosD * magnitude - rotation;
- wheelSpeeds[kRearLeftMotor] = cosD * magnitude + rotation;
- wheelSpeeds[kRearRightMotor] = sinD * magnitude - rotation;
-
- Normalize(wheelSpeeds);
-
- m_frontLeftMotor->Set(wheelSpeeds[kFrontLeftMotor] * m_maxOutput);
- m_frontRightMotor->Set(wheelSpeeds[kFrontRightMotor] * m_maxOutput);
- m_rearLeftMotor->Set(wheelSpeeds[kRearLeftMotor] * m_maxOutput);
- m_rearRightMotor->Set(wheelSpeeds[kRearRightMotor] * m_maxOutput);
-
- m_safetyHelper->Feed();
-}
-
-/**
- * Holonomic Drive method for Mecanum wheeled robots.
- *
- * This is an alias to MecanumDrive_Polar() for backward compatability
- *
- * @param magnitude The speed that the robot should drive in a given direction.
- * [-1.0..1.0]
- * @param direction The direction the robot should drive. The direction and
- * magnitude are independent of the rotation rate.
- * @param rotation The rate of rotation for the robot that is completely
- * independent of the magnitude or direction. [-1.0..1.0]
- */
-void RobotDrive::HolonomicDrive(double magnitude, double direction,
- double rotation) {
- MecanumDrive_Polar(magnitude, direction, rotation);
-}
-
-/**
- * Set the speed of the right and left motors.
- *
- * This is used once an appropriate drive setup function is called such as
- * TwoWheelDrive(). The motors are set to "leftOutput" and "rightOutput"
- * and includes flipping the direction of one side for opposing motors.
- *
- * @param leftOutput The speed to send to the left side of the robot.
- * @param rightOutput The speed to send to the right side of the robot.
- */
-void RobotDrive::SetLeftRightMotorOutputs(double leftOutput,
- double rightOutput) {
- wpi_assert(m_rearLeftMotor != nullptr && m_rearRightMotor != nullptr);
-
- if (m_frontLeftMotor != nullptr)
- m_frontLeftMotor->Set(Limit(leftOutput) * m_maxOutput);
- m_rearLeftMotor->Set(Limit(leftOutput) * m_maxOutput);
-
- if (m_frontRightMotor != nullptr)
- m_frontRightMotor->Set(-Limit(rightOutput) * m_maxOutput);
- m_rearRightMotor->Set(-Limit(rightOutput) * m_maxOutput);
-
- m_safetyHelper->Feed();
-}
-
-/**
- * Limit motor values to the -1.0 to +1.0 range.
- */
-double RobotDrive::Limit(double num) {
- if (num > 1.0) {
- return 1.0;
- }
- if (num < -1.0) {
- return -1.0;
- }
- return num;
-}
-
-/**
- * Normalize all wheel speeds if the magnitude of any wheel is greater than 1.0.
- */
-void RobotDrive::Normalize(double* wheelSpeeds) {
- double maxMagnitude = std::fabs(wheelSpeeds[0]);
- int i;
- for (i = 1; i < kMaxNumberOfMotors; i++) {
- double temp = std::fabs(wheelSpeeds[i]);
- if (maxMagnitude < temp) maxMagnitude = temp;
- }
- if (maxMagnitude > 1.0) {
- for (i = 0; i < kMaxNumberOfMotors; i++) {
- wheelSpeeds[i] = wheelSpeeds[i] / maxMagnitude;
- }
- }
-}
-
-/**
- * Rotate a vector in Cartesian space.
- */
-void RobotDrive::RotateVector(double& x, double& y, double angle) {
- double cosA = std::cos(angle * (3.14159 / 180.0));
- double sinA = std::sin(angle * (3.14159 / 180.0));
- double xOut = x * cosA - y * sinA;
- double yOut = x * sinA + y * cosA;
- x = xOut;
- y = yOut;
-}
-
-/*
- * Invert a motor direction.
- *
- * This is used when a motor should run in the opposite direction as the drive
- * code would normally run it. Motors that are direct drive would be inverted,
- * the Drive code assumes that the motors are geared with one reversal.
- *
- * @param motor The motor index to invert.
- * @param isInverted True if the motor should be inverted when operated.
- */
-void RobotDrive::SetInvertedMotor(MotorType motor, bool isInverted) {
- if (motor < 0 || motor > 3) {
- wpi_setWPIError(InvalidMotorIndex);
- return;
- }
- switch (motor) {
- case kFrontLeftMotor:
- m_frontLeftMotor->SetInverted(isInverted);
- break;
- case kFrontRightMotor:
- m_frontRightMotor->SetInverted(isInverted);
- break;
- case kRearLeftMotor:
- m_rearLeftMotor->SetInverted(isInverted);
- break;
- case kRearRightMotor:
- m_rearRightMotor->SetInverted(isInverted);
- break;
- }
-}
-
-/**
- * Set the turning sensitivity.
- *
- * This only impacts the Drive() entry-point.
- *
- * @param sensitivity Effectively sets the turning sensitivity (or turn radius
- * for a given value)
- */
-void RobotDrive::SetSensitivity(double sensitivity) {
- m_sensitivity = sensitivity;
-}
-
-/**
- * Configure the scaling factor for using RobotDrive with motor controllers in a
- * mode other than PercentVbus.
- *
- * @param maxOutput Multiplied with the output percentage computed by the drive
- * functions.
- */
-void RobotDrive::SetMaxOutput(double maxOutput) { m_maxOutput = maxOutput; }
-
-void RobotDrive::SetExpiration(double timeout) {
- m_safetyHelper->SetExpiration(timeout);
-}
-
-double RobotDrive::GetExpiration() const {
- return m_safetyHelper->GetExpiration();
-}
-
-bool RobotDrive::IsAlive() const { return m_safetyHelper->IsAlive(); }
-
-bool RobotDrive::IsSafetyEnabled() const {
- return m_safetyHelper->IsSafetyEnabled();
-}
-
-void RobotDrive::SetSafetyEnabled(bool enabled) {
- m_safetyHelper->SetSafetyEnabled(enabled);
-}
-
-void RobotDrive::GetDescription(std::ostringstream& desc) const {
- desc << "RobotDrive";
-}
-
-void RobotDrive::StopMotor() {
- if (m_frontLeftMotor != nullptr) m_frontLeftMotor->StopMotor();
- if (m_frontRightMotor != nullptr) m_frontRightMotor->StopMotor();
- if (m_rearLeftMotor != nullptr) m_rearLeftMotor->StopMotor();
- if (m_rearRightMotor != nullptr) m_rearRightMotor->StopMotor();
- m_safetyHelper->Feed();
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/SD540.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/SD540.cpp
deleted file mode 100644
index 02430ff..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/SD540.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "SD540.h"
-
-#include "HAL/HAL.h"
-#include "LiveWindow/LiveWindow.h"
-
-using namespace frc;
-
-/**
- * Note that the SD540 uses the following bounds for PWM values. These values
- * should work reasonably well for most controllers, but if users experience
- * issues such as asymmetric behavior around the deadband or inability to
- * saturate the controller in either direction, calibration is recommended.
- * The calibration procedure can be found in the SD540 User Manual available
- * from Mindsensors.
- *
- * 2.05ms = full "forward"
- * 1.55ms = the "high end" of the deadband range
- * 1.50ms = center of the deadband range (off)
- * 1.44ms = the "low end" of the deadband range
- * 0.94ms = full "reverse"
- */
-
-/**
- * Constructor for a SD540.
- *
- * @param channel The PWM channel that the SD540 is attached to. 0-9 are
- * on-board, 10-19 are on the MXP port
- */
-SD540::SD540(int channel) : PWMSpeedController(channel) {
- SetBounds(2.05, 1.55, 1.50, 1.44, .94);
- SetPeriodMultiplier(kPeriodMultiplier_1X);
- SetSpeed(0.0);
- SetZeroLatch();
-
- HAL_Report(HALUsageReporting::kResourceType_MindsensorsSD540, GetChannel());
- LiveWindow::GetInstance()->AddActuator("SD540", GetChannel(), this);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/SPI.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/SPI.cpp
deleted file mode 100644
index 0dd2204..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/SPI.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/SPI.h"
-#include "SPI.h"
-
-#include <cstring>
-
-#include "HAL/HAL.h"
-#include "WPIErrors.h"
-#include "llvm/SmallVector.h"
-
-using namespace frc;
-
-/**
- * Constructor
- *
- * @param SPIport the physical SPI port
- */
-SPI::SPI(Port SPIport) {
- m_port = SPIport;
- int32_t status = 0;
- HAL_InitializeSPI(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- static int instances = 0;
- instances++;
- HAL_Report(HALUsageReporting::kResourceType_SPI, instances);
-}
-
-/**
- * Destructor.
- */
-SPI::~SPI() { HAL_CloseSPI(m_port); }
-
-/**
- * Configure the rate of the generated clock signal.
- *
- * The default value is 500,000Hz.
- * The maximum value is 4,000,000Hz.
- *
- * @param hz The clock rate in Hertz.
- */
-void SPI::SetClockRate(double hz) { HAL_SetSPISpeed(m_port, hz); }
-
-/**
- * Configure the order that bits are sent and received on the wire
- * to be most significant bit first.
- */
-void SPI::SetMSBFirst() {
- m_msbFirst = true;
- HAL_SetSPIOpts(m_port, m_msbFirst, m_sampleOnTrailing, m_clk_idle_high);
-}
-
-/**
- * Configure the order that bits are sent and received on the wire
- * to be least significant bit first.
- */
-void SPI::SetLSBFirst() {
- m_msbFirst = false;
- HAL_SetSPIOpts(m_port, m_msbFirst, m_sampleOnTrailing, m_clk_idle_high);
-}
-
-/**
- * Configure that the data is stable on the falling edge and the data
- * changes on the rising edge.
- */
-void SPI::SetSampleDataOnFalling() {
- m_sampleOnTrailing = true;
- HAL_SetSPIOpts(m_port, m_msbFirst, m_sampleOnTrailing, m_clk_idle_high);
-}
-
-/**
- * Configure that the data is stable on the rising edge and the data
- * changes on the falling edge.
- */
-void SPI::SetSampleDataOnRising() {
- m_sampleOnTrailing = false;
- HAL_SetSPIOpts(m_port, m_msbFirst, m_sampleOnTrailing, m_clk_idle_high);
-}
-
-/**
- * Configure the clock output line to be active low.
- * This is sometimes called clock polarity high or clock idle high.
- */
-void SPI::SetClockActiveLow() {
- m_clk_idle_high = true;
- HAL_SetSPIOpts(m_port, m_msbFirst, m_sampleOnTrailing, m_clk_idle_high);
-}
-
-/**
- * Configure the clock output line to be active high.
- * This is sometimes called clock polarity low or clock idle low.
- */
-void SPI::SetClockActiveHigh() {
- m_clk_idle_high = false;
- HAL_SetSPIOpts(m_port, m_msbFirst, m_sampleOnTrailing, m_clk_idle_high);
-}
-
-/**
- * Configure the chip select line to be active high.
- */
-void SPI::SetChipSelectActiveHigh() {
- int32_t status = 0;
- HAL_SetSPIChipSelectActiveHigh(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Configure the chip select line to be active low.
- */
-void SPI::SetChipSelectActiveLow() {
- int32_t status = 0;
- HAL_SetSPIChipSelectActiveLow(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Write data to the slave device. Blocks until there is space in the
- * output FIFO.
- *
- * If not running in output only mode, also saves the data received
- * on the MISO input during the transfer into the receive FIFO.
- */
-int SPI::Write(uint8_t* data, int size) {
- int retVal = 0;
- retVal = HAL_WriteSPI(m_port, data, size);
- return retVal;
-}
-
-/**
- * Read a word from the receive FIFO.
- *
- * Waits for the current transfer to complete if the receive FIFO is empty.
- *
- * If the receive FIFO is empty, there is no active transfer, and initiate
- * is false, errors.
- *
- * @param initiate If true, this function pushes "0" into the transmit buffer
- * and initiates a transfer. If false, this function assumes
- * that data is already in the receive FIFO from a previous
- * write.
- */
-int SPI::Read(bool initiate, uint8_t* dataReceived, int size) {
- int retVal = 0;
- if (initiate) {
- llvm::SmallVector<uint8_t, 32> dataToSend;
- dataToSend.resize(size);
- retVal = HAL_TransactionSPI(m_port, dataToSend.data(), dataReceived, size);
- } else {
- retVal = HAL_ReadSPI(m_port, dataReceived, size);
- }
- return retVal;
-}
-
-/**
- * Perform a simultaneous read/write transaction with the device
- *
- * @param dataToSend The data to be written out to the device
- * @param dataReceived Buffer to receive data from the device
- * @param size The length of the transaction, in bytes
- */
-int SPI::Transaction(uint8_t* dataToSend, uint8_t* dataReceived, int size) {
- int retVal = 0;
- retVal = HAL_TransactionSPI(m_port, dataToSend, dataReceived, size);
- return retVal;
-}
-
-/**
- * Initialize the accumulator.
- *
- * @param period Time between reads
- * @param cmd SPI command to send to request data
- * @param xfer_size SPI transfer size, in bytes
- * @param valid_mask Mask to apply to received data for validity checking
- * @param valid_data After valid_mask is applied, required matching value for
- * validity checking
- * @param data_shift Bit shift to apply to received data to get actual data
- * value
- * @param data_size Size (in bits) of data field
- * @param is_signed Is data field signed?
- * @param big_endian Is device big endian?
- */
-void SPI::InitAccumulator(double period, int cmd, int xfer_size, int valid_mask,
- int valid_value, int data_shift, int data_size,
- bool is_signed, bool big_endian) {
- int32_t status = 0;
- HAL_InitSPIAccumulator(m_port, static_cast<int32_t>(period * 1e6), cmd,
- xfer_size, valid_mask, valid_value, data_shift,
- data_size, is_signed, big_endian, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Frees the accumulator.
- */
-void SPI::FreeAccumulator() {
- int32_t status = 0;
- HAL_FreeSPIAccumulator(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Resets the accumulator to zero.
- */
-void SPI::ResetAccumulator() {
- int32_t status = 0;
- HAL_ResetSPIAccumulator(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set the center value of the accumulator.
- *
- * The center value is subtracted from each value before it is added to the
- * accumulator. This is used for the center value of devices like gyros and
- * accelerometers to make integration work and to take the device offset into
- * account when integrating.
- */
-void SPI::SetAccumulatorCenter(int center) {
- int32_t status = 0;
- HAL_SetSPIAccumulatorCenter(m_port, center, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set the accumulator's deadband.
- */
-void SPI::SetAccumulatorDeadband(int deadband) {
- int32_t status = 0;
- HAL_SetSPIAccumulatorDeadband(m_port, deadband, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Read the last value read by the accumulator engine.
- */
-int SPI::GetAccumulatorLastValue() const {
- int32_t status = 0;
- int retVal = HAL_GetSPIAccumulatorLastValue(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Read the accumulated value.
- *
- * @return The 64-bit value accumulated since the last Reset().
- */
-int64_t SPI::GetAccumulatorValue() const {
- int32_t status = 0;
- int64_t retVal = HAL_GetSPIAccumulatorValue(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Read the number of accumulated values.
- *
- * Read the count of the accumulated values since the accumulator was last
- * Reset().
- *
- * @return The number of times samples from the channel were accumulated.
- */
-int64_t SPI::GetAccumulatorCount() const {
- int32_t status = 0;
- int64_t retVal = HAL_GetSPIAccumulatorCount(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Read the average of the accumulated value.
- *
- * @return The accumulated average value (value / count).
- */
-double SPI::GetAccumulatorAverage() const {
- int32_t status = 0;
- double retVal = HAL_GetSPIAccumulatorAverage(m_port, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Read the accumulated value and the number of accumulated values atomically.
- *
- * This function reads the value and count atomically.
- * This can be used for averaging.
- *
- * @param value Pointer to the 64-bit accumulated output.
- * @param count Pointer to the number of accumulation cycles.
- */
-void SPI::GetAccumulatorOutput(int64_t& value, int64_t& count) const {
- int32_t status = 0;
- HAL_GetSPIAccumulatorOutput(m_port, &value, &count, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/SafePWM.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/SafePWM.cpp
deleted file mode 100644
index cd62192..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/SafePWM.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "SafePWM.h"
-
-using namespace frc;
-
-/**
- * Constructor for a SafePWM object taking a channel number.
- *
- * @param channel The PWM channel number 0-9 are on-board, 10-19 are on the MXP
- * port
- */
-SafePWM::SafePWM(int channel) : PWM(channel) {
- m_safetyHelper = std::make_unique<MotorSafetyHelper>(this);
- m_safetyHelper->SetSafetyEnabled(false);
-}
-
-/**
- * Set the expiration time for the PWM object.
- *
- * @param timeout The timeout (in seconds) for this motor object
- */
-void SafePWM::SetExpiration(double timeout) {
- m_safetyHelper->SetExpiration(timeout);
-}
-
-/**
- * Return the expiration time for the PWM object.
- *
- * @returns The expiration time value.
- */
-double SafePWM::GetExpiration() const {
- return m_safetyHelper->GetExpiration();
-}
-
-/**
- * Check if the PWM object is currently alive or stopped due to a timeout.
- *
- * @return a bool value that is true if the motor has NOT timed out and should
- * still be running.
- */
-bool SafePWM::IsAlive() const { return m_safetyHelper->IsAlive(); }
-
-/**
- * Stop the motor associated with this PWM object.
- *
- * This is called by the MotorSafetyHelper object when it has a timeout for this
- * PWM and needs to stop it from running.
- */
-void SafePWM::StopMotor() { SetDisabled(); }
-
-/**
- * Enable/disable motor safety for this device.
- *
- * Turn on and off the motor safety option for this PWM object.
- *
- * @param enabled True if motor safety is enforced for this object
- */
-void SafePWM::SetSafetyEnabled(bool enabled) {
- m_safetyHelper->SetSafetyEnabled(enabled);
-}
-
-/**
- * Check if motor safety is enabled for this object.
- *
- * @returns True if motor safety is enforced for this object
- */
-bool SafePWM::IsSafetyEnabled() const {
- return m_safetyHelper->IsSafetyEnabled();
-}
-
-void SafePWM::GetDescription(std::ostringstream& desc) const {
- desc << "PWM " << GetChannel();
-}
-
-/**
- * Feed the MotorSafety timer when setting the speed.
- *
- * This method is called by the subclass motor whenever it updates its speed,
- * thereby reseting the timeout value.
- *
- * @param speed Value to pass to the PWM class
- */
-void SafePWM::SetSpeed(double speed) {
- PWM::SetSpeed(speed);
- m_safetyHelper->Feed();
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/SampleRobot.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/SampleRobot.cpp
deleted file mode 100644
index eaa828b..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/SampleRobot.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "SampleRobot.h"
-
-#include "DriverStation.h"
-#include "Timer.h"
-
-using namespace frc;
-
-SampleRobot::SampleRobot() : m_robotMainOverridden(true) {}
-
-/**
- * Robot-wide initialization code should go here.
- *
- * Users should override this method for default Robot-wide initialization which
- * will be called when the robot is first powered on. It will be called exactly
- * one time.
- *
- * Warning: the Driver Station "Robot Code" light and FMS "Robot Ready"
- * indicators will be off until RobotInit() exits. Code in RobotInit() that
- * waits for enable will cause the robot to never indicate that the code is
- * ready, causing the robot to be bypassed in a match.
- */
-void SampleRobot::RobotInit() {
- std::printf("Default %s() method... Override me!\n", __FUNCTION__);
-}
-
-/**
- * Disabled should go here.
- *
- * Programmers should override this method to run code that should run while the
- * field is disabled.
- */
-void SampleRobot::Disabled() {
- std::printf("Default %s() method... Override me!\n", __FUNCTION__);
-}
-
-/**
- * Autonomous should go here.
- *
- * Programmers should override this method to run code that should run while the
- * field is in the autonomous period. This will be called once each time the
- * robot enters the autonomous state.
- */
-void SampleRobot::Autonomous() {
- std::printf("Default %s() method... Override me!\n", __FUNCTION__);
-}
-
-/**
- * Operator control (tele-operated) code should go here.
- *
- * Programmers should override this method to run code that should run while the
- * field is in the Operator Control (tele-operated) period. This is called once
- * each time the robot enters the teleop state.
- */
-void SampleRobot::OperatorControl() {
- std::printf("Default %s() method... Override me!\n", __FUNCTION__);
-}
-
-/**
- * Test program should go here.
- *
- * Programmers should override this method to run code that executes while the
- * robot is in test mode. This will be called once whenever the robot enters
- * test mode
- */
-void SampleRobot::Test() {
- std::printf("Default %s() method... Override me!\n", __FUNCTION__);
-}
-
-/**
- * Robot main program for free-form programs.
- *
- * This should be overridden by user subclasses if the intent is to not use the
- * Autonomous() and OperatorControl() methods. In that case, the program is
- * responsible for sensing when to run the autonomous and operator control
- * functions in their program.
- *
- * This method will be called immediately after the constructor is called. If it
- * has not been overridden by a user subclass (i.e. the default version runs),
- * then the Autonomous() and OperatorControl() methods will be called.
- */
-void SampleRobot::RobotMain() { m_robotMainOverridden = false; }
-
-/**
- * Start a competition.
- *
- * This code needs to track the order of the field starting to ensure that
- * everything happens in the right order. Repeatedly run the correct method,
- * either Autonomous or OperatorControl or Test when the robot is enabled.
- * After running the correct method, wait for some state to change, either the
- * other mode starts or the robot is disabled. Then go back and wait for the
- * robot to be enabled again.
- */
-void SampleRobot::StartCompetition() {
- HAL_Report(HALUsageReporting::kResourceType_Framework,
- HALUsageReporting::kFramework_Simple);
-
- RobotInit();
-
- // Tell the DS that the robot is ready to be enabled
- HAL_ObserveUserProgramStarting();
-
- RobotMain();
-
- if (!m_robotMainOverridden) {
- // first and one-time initialization
-
- while (true) {
- if (IsDisabled()) {
- m_ds.InDisabled(true);
- Disabled();
- m_ds.InDisabled(false);
- while (IsDisabled()) m_ds.WaitForData();
- } else if (IsAutonomous()) {
- m_ds.InAutonomous(true);
- Autonomous();
- m_ds.InAutonomous(false);
- while (IsAutonomous() && IsEnabled()) m_ds.WaitForData();
- } else if (IsTest()) {
- m_ds.InTest(true);
- Test();
- m_ds.InTest(false);
- while (IsTest() && IsEnabled()) m_ds.WaitForData();
- } else {
- m_ds.InOperatorControl(true);
- OperatorControl();
- m_ds.InOperatorControl(false);
- while (IsOperatorControl() && IsEnabled()) m_ds.WaitForData();
- }
- }
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/SensorBase.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/SensorBase.cpp
deleted file mode 100644
index 1a4987c..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/SensorBase.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "SensorBase.h"
-
-#include "FRC_NetworkCommunication/LoadOut.h"
-#include "HAL/AnalogInput.h"
-#include "HAL/AnalogOutput.h"
-#include "HAL/DIO.h"
-#include "HAL/HAL.h"
-#include "HAL/PDP.h"
-#include "HAL/PWM.h"
-#include "HAL/Ports.h"
-#include "HAL/Relay.h"
-#include "HAL/Solenoid.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-const int SensorBase::kDigitalChannels = HAL_GetNumDigitalChannels();
-const int SensorBase::kAnalogInputs = HAL_GetNumAnalogInputs();
-const int SensorBase::kSolenoidChannels = HAL_GetNumSolenoidChannels();
-const int SensorBase::kSolenoidModules = HAL_GetNumPCMModules();
-const int SensorBase::kPwmChannels = HAL_GetNumPWMChannels();
-const int SensorBase::kRelayChannels = HAL_GetNumRelayHeaders();
-const int SensorBase::kPDPChannels = HAL_GetNumPDPChannels();
-
-/**
- * Check that the solenoid module number is valid.
- *
- * @return Solenoid module is valid and present
- */
-bool SensorBase::CheckSolenoidModule(int moduleNumber) {
- return HAL_CheckSolenoidModule(moduleNumber);
-}
-
-/**
- * Check that the digital channel number is valid.
- *
- * Verify that the channel number is one of the legal channel numbers. Channel
- * numbers are 1-based.
- *
- * @return Digital channel is valid
- */
-bool SensorBase::CheckDigitalChannel(int channel) {
- return HAL_CheckDIOChannel(channel);
-}
-
-/**
- * Check that the relay channel number is valid.
- *
- * Verify that the channel number is one of the legal channel numbers. Channel
- * numbers are 0-based.
- *
- * @return Relay channel is valid
- */
-bool SensorBase::CheckRelayChannel(int channel) {
- return HAL_CheckRelayChannel(channel);
-}
-
-/**
- * Check that the digital channel number is valid.
- *
- * Verify that the channel number is one of the legal channel numbers. Channel
- * numbers are 1-based.
- *
- * @return PWM channel is valid
- */
-bool SensorBase::CheckPWMChannel(int channel) {
- return HAL_CheckPWMChannel(channel);
-}
-
-/**
- * Check that the analog input number is value.
- *
- * Verify that the analog input number is one of the legal channel numbers.
- * Channel numbers are 0-based.
- *
- * @return Analog channel is valid
- */
-bool SensorBase::CheckAnalogInputChannel(int channel) {
- return HAL_CheckAnalogInputChannel(channel);
-}
-
-/**
- * Check that the analog output number is valid.
- *
- * Verify that the analog output number is one of the legal channel numbers.
- * Channel numbers are 0-based.
- *
- * @return Analog channel is valid
- */
-bool SensorBase::CheckAnalogOutputChannel(int channel) {
- return HAL_CheckAnalogOutputChannel(channel);
-}
-
-/**
- * Verify that the solenoid channel number is within limits.
- *
- * @return Solenoid channel is valid
- */
-bool SensorBase::CheckSolenoidChannel(int channel) {
- return HAL_CheckSolenoidChannel(channel);
-}
-
-/**
- * Verify that the power distribution channel number is within limits.
- *
- * @return PDP channel is valid
- */
-bool SensorBase::CheckPDPChannel(int channel) {
- return HAL_CheckPDPModule(channel);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/SerialPort.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/SerialPort.cpp
deleted file mode 100644
index 56435a9..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/SerialPort.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/SerialPort.h"
-#include "SerialPort.h"
-
-#include "HAL/HAL.h"
-
-// static ViStatus _VI_FUNCH ioCompleteHandler (ViSession vi, ViEventType
-// eventType, ViEvent event, ViAddr userHandle);
-
-using namespace frc;
-
-/**
- * Create an instance of a Serial Port class.
- *
- * @param baudRate The baud rate to configure the serial port.
- * @param port The physical port to use
- * @param dataBits The number of data bits per transfer. Valid values are
- * between 5 and 8 bits.
- * @param parity Select the type of parity checking to use.
- * @param stopBits The number of stop bits to use as defined by the enum
- * StopBits.
- */
-SerialPort::SerialPort(int baudRate, Port port, int dataBits,
- SerialPort::Parity parity,
- SerialPort::StopBits stopBits) {
- int32_t status = 0;
-
- m_port = port;
-
- HAL_InitializeSerialPort(static_cast<HAL_SerialPort>(port), &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- // Don't continue if initialization failed
- if (status < 0) return;
- HAL_SetSerialBaudRate(static_cast<HAL_SerialPort>(port), baudRate, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- HAL_SetSerialDataBits(static_cast<HAL_SerialPort>(port), dataBits, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- HAL_SetSerialParity(static_cast<HAL_SerialPort>(port), parity, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- HAL_SetSerialStopBits(static_cast<HAL_SerialPort>(port), stopBits, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-
- // Set the default timeout to 5 seconds.
- SetTimeout(5.0);
-
- // Don't wait until the buffer is full to transmit.
- SetWriteBufferMode(kFlushOnAccess);
-
- EnableTermination();
-
- // viInstallHandler(m_portHandle, VI_EVENT_IO_COMPLETION, ioCompleteHandler,
- // this);
- // viEnableEvent(m_portHandle, VI_EVENT_IO_COMPLETION, VI_HNDLR, VI_NULL);
-
- HAL_Report(HALUsageReporting::kResourceType_SerialPort, 0);
-}
-
-/**
- * Destructor.
- */
-SerialPort::~SerialPort() {
- int32_t status = 0;
- HAL_CloseSerial(static_cast<HAL_SerialPort>(m_port), &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Set the type of flow control to enable on this port.
- *
- * By default, flow control is disabled.
- */
-void SerialPort::SetFlowControl(SerialPort::FlowControl flowControl) {
- int32_t status = 0;
- HAL_SetSerialFlowControl(static_cast<HAL_SerialPort>(m_port), flowControl,
- &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Enable termination and specify the termination character.
- *
- * Termination is currently only implemented for receive.
- * When the the terminator is recieved, the Read() or Scanf() will return
- * fewer bytes than requested, stopping after the terminator.
- *
- * @param terminator The character to use for termination.
- */
-void SerialPort::EnableTermination(char terminator) {
- int32_t status = 0;
- HAL_EnableSerialTermination(static_cast<HAL_SerialPort>(m_port), terminator,
- &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Disable termination behavior.
- */
-void SerialPort::DisableTermination() {
- int32_t status = 0;
- HAL_DisableSerialTermination(static_cast<HAL_SerialPort>(m_port), &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Get the number of bytes currently available to read from the serial port.
- *
- * @return The number of bytes available to read
- */
-int SerialPort::GetBytesReceived() {
- int32_t status = 0;
- int retVal =
- HAL_GetSerialBytesReceived(static_cast<HAL_SerialPort>(m_port), &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Read raw bytes out of the buffer.
- *
- * @param buffer Pointer to the buffer to store the bytes in.
- * @param count The maximum number of bytes to read.
- * @return The number of bytes actually read into the buffer.
- */
-int SerialPort::Read(char* buffer, int count) {
- int32_t status = 0;
- int retVal = HAL_ReadSerial(static_cast<HAL_SerialPort>(m_port), buffer,
- count, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Write raw bytes to the buffer. Deprecated, please use StringRef overload. Use
- * Write({data, len}) to get a buffer that is shorter then the length of the
- * std::string.
- *
- * @param buffer Pointer to the buffer to read the bytes from. If string.size()
- * is less then count, only the length of string.size() will be sent.
- * @param count The maximum number of bytes to write.
- * @return The number of bytes actually written into the port.
- */
-int SerialPort::Write(const std::string& buffer, int count) {
- return Write(llvm::StringRef(
- buffer.data(), std::min(static_cast<int>(buffer.size()), count)));
-}
-
-/**
- * Write raw bytes to the buffer.
- *
- * @param buffer Pointer to the buffer to read the bytes from.
- * @param count The maximum number of bytes to write.
- * @return The number of bytes actually written into the port.
- */
-int SerialPort::Write(const char* buffer, int count) {
- return Write(llvm::StringRef(buffer, static_cast<size_t>(count)));
-}
-
-/**
- * Write raw bytes to the buffer.
- *
- * @param buffer StringRef to the buffer to read the bytes from.
- * @return The number of bytes actually written into the port.
- */
-int SerialPort::Write(llvm::StringRef buffer) {
- int32_t status = 0;
- int retVal = HAL_WriteSerial(static_cast<HAL_SerialPort>(m_port),
- buffer.data(), buffer.size(), &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return retVal;
-}
-
-/**
- * Configure the timeout of the serial port.
- *
- * This defines the timeout for transactions with the hardware.
- * It will affect reads and very large writes.
- *
- * @param timeout The number of seconds to to wait for I/O.
- */
-void SerialPort::SetTimeout(double timeout) {
- int32_t status = 0;
- HAL_SetSerialTimeout(static_cast<HAL_SerialPort>(m_port), timeout, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Specify the size of the input buffer.
- *
- * Specify the amount of data that can be stored before data
- * from the device is returned to Read or Scanf. If you want
- * data that is recieved to be returned immediately, set this to 1.
- *
- * It the buffer is not filled before the read timeout expires, all
- * data that has been received so far will be returned.
- *
- * @param size The read buffer size.
- */
-void SerialPort::SetReadBufferSize(int size) {
- int32_t status = 0;
- HAL_SetSerialReadBufferSize(static_cast<HAL_SerialPort>(m_port), size,
- &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Specify the size of the output buffer.
- *
- * Specify the amount of data that can be stored before being
- * transmitted to the device.
- *
- * @param size The write buffer size.
- */
-void SerialPort::SetWriteBufferSize(int size) {
- int32_t status = 0;
- HAL_SetSerialWriteBufferSize(static_cast<HAL_SerialPort>(m_port), size,
- &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Specify the flushing behavior of the output buffer.
- *
- * When set to kFlushOnAccess, data is synchronously written to the serial port
- * after each call to either Printf() or Write().
- *
- * When set to kFlushWhenFull, data will only be written to the serial port when
- * the buffer is full or when Flush() is called.
- *
- * @param mode The write buffer mode.
- */
-void SerialPort::SetWriteBufferMode(SerialPort::WriteBufferMode mode) {
- int32_t status = 0;
- HAL_SetSerialWriteMode(static_cast<HAL_SerialPort>(m_port), mode, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Force the output buffer to be written to the port.
- *
- * This is used when SetWriteBufferMode() is set to kFlushWhenFull to force a
- * flush before the buffer is full.
- */
-void SerialPort::Flush() {
- int32_t status = 0;
- HAL_FlushSerial(static_cast<HAL_SerialPort>(m_port), &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Reset the serial port driver to a known state.
- *
- * Empty the transmit and receive buffers in the device and formatted I/O.
- */
-void SerialPort::Reset() {
- int32_t status = 0;
- HAL_ClearSerial(static_cast<HAL_SerialPort>(m_port), &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Servo.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Servo.cpp
deleted file mode 100644
index 0d344b7..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Servo.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Servo.h"
-
-using namespace frc;
-
-constexpr double Servo::kMaxServoAngle;
-constexpr double Servo::kMinServoAngle;
-
-constexpr double Servo::kDefaultMaxServoPWM;
-constexpr double Servo::kDefaultMinServoPWM;
-
-/**
- * @param channel The PWM channel to which the servo is attached. 0-9 are
- * on-board, 10-19 are on the MXP port
- */
-Servo::Servo(int channel) : PWM(channel) {
- // Set minimum and maximum PWM values supported by the servo
- SetBounds(kDefaultMaxServoPWM, 0.0, 0.0, 0.0, kDefaultMinServoPWM);
-
- // Assign defaults for period multiplier for the servo PWM control signal
- SetPeriodMultiplier(kPeriodMultiplier_4X);
-}
-
-Servo::~Servo() {}
-
-/**
- * Set the servo position.
- *
- * Servo values range from 0.0 to 1.0 corresponding to the range of full left to
- * full right.
- *
- * @param value Position from 0.0 to 1.0.
- */
-void Servo::Set(double value) { SetPosition(value); }
-
-/**
- * Set the servo to offline.
- *
- * Set the servo raw value to 0 (undriven)
- */
-void Servo::SetOffline() { SetRaw(0); }
-
-/**
- * Get the servo position.
- *
- * Servo values range from 0.0 to 1.0 corresponding to the range of full left to
- * full right.
- *
- * @return Position from 0.0 to 1.0.
- */
-double Servo::Get() const { return GetPosition(); }
-
-/**
- * Set the servo angle.
- *
- * Assume that the servo angle is linear with respect to the PWM value (big
- * assumption, need to test).
- *
- * Servo angles that are out of the supported range of the servo simply
- * "saturate" in that direction. In other words, if the servo has a range of
- * (X degrees to Y degrees) than angles of less than X result in an angle of
- * X being set and angles of more than Y degrees result in an angle of Y being
- * set.
- *
- * @param degrees The angle in degrees to set the servo.
- */
-void Servo::SetAngle(double degrees) {
- if (degrees < kMinServoAngle) {
- degrees = kMinServoAngle;
- } else if (degrees > kMaxServoAngle) {
- degrees = kMaxServoAngle;
- }
-
- SetPosition((degrees - kMinServoAngle) / GetServoAngleRange());
-}
-
-/**
- * Get the servo angle.
- *
- * Assume that the servo angle is linear with respect to the PWM value (big
- * assumption, need to test).
- *
- * @return The angle in degrees to which the servo is set.
- */
-double Servo::GetAngle() const {
- return GetPosition() * GetServoAngleRange() + kMinServoAngle;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Solenoid.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Solenoid.cpp
deleted file mode 100644
index 324e673..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Solenoid.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Solenoid.h"
-#include "Solenoid.h"
-
-#include <sstream>
-
-#include "HAL/HAL.h"
-#include "HAL/Ports.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Constructor using the default PCM ID (0).
- *
- * @param channel The channel on the PCM to control (0..7).
- */
-Solenoid::Solenoid(int channel)
- : Solenoid(GetDefaultSolenoidModule(), channel) {}
-
-/**
- * Constructor.
- *
- * @param moduleNumber The CAN ID of the PCM the solenoid is attached to
- * @param channel The channel on the PCM to control (0..7).
- */
-Solenoid::Solenoid(int moduleNumber, int channel)
- : SolenoidBase(moduleNumber), m_channel(channel) {
- std::stringstream buf;
- if (!CheckSolenoidModule(m_moduleNumber)) {
- buf << "Solenoid Module " << m_moduleNumber;
- wpi_setWPIErrorWithContext(ModuleIndexOutOfRange, buf.str());
- return;
- }
- if (!CheckSolenoidChannel(m_channel)) {
- buf << "Solenoid Module " << m_channel;
- wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
- return;
- }
-
- int32_t status = 0;
- m_solenoidHandle = HAL_InitializeSolenoidPort(
- HAL_GetPortWithModule(moduleNumber, channel), &status);
- if (status != 0) {
- wpi_setErrorWithContextRange(status, 0, HAL_GetNumSolenoidChannels(),
- channel, HAL_GetErrorMessage(status));
- m_solenoidHandle = HAL_kInvalidHandle;
- return;
- }
-
- HAL_Report(HALUsageReporting::kResourceType_Solenoid, m_channel,
- m_moduleNumber);
-}
-
-/**
- * Destructor.
- */
-Solenoid::~Solenoid() {
- HAL_FreeSolenoidPort(m_solenoidHandle);
-}
-
-/**
- * Set the value of a solenoid.
- *
- * @param on Turn the solenoid output off or on.
- */
-void Solenoid::Set(bool on) {
- if (StatusIsFatal()) return;
- int32_t status = 0;
- HAL_SetSolenoid(m_solenoidHandle, on, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Read the current value of the solenoid.
- *
- * @return The current value of the solenoid.
- */
-bool Solenoid::Get() const {
- if (StatusIsFatal()) return false;
- int32_t status = 0;
- bool value = HAL_GetSolenoid(m_solenoidHandle, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-/**
- * Check if solenoid is blacklisted.
- *
- * If a solenoid is shorted, it is added to the blacklist and
- * disabled until power cycle, or until faults are cleared.
- *
- * @see ClearAllPCMStickyFaults()
- *
- * @return If solenoid is disabled due to short.
- */
-bool Solenoid::IsBlackListed() const {
- int value = GetPCMSolenoidBlackList(m_moduleNumber) & (1 << m_channel);
- return (value != 0);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/SolenoidBase.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/SolenoidBase.cpp
deleted file mode 100644
index e61208e..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/SolenoidBase.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "SolenoidBase.h"
-
-#include "HAL/HAL.h"
-#include "HAL/Solenoid.h"
-
-using namespace frc;
-
-/**
- * Constructor
- *
- * @param moduleNumber The CAN PCM ID.
- */
-SolenoidBase::SolenoidBase(int moduleNumber) : m_moduleNumber(moduleNumber) {}
-
-/**
- * Read all 8 solenoids as a single byte
- *
- * @return The current value of all 8 solenoids on the module.
- */
-int SolenoidBase::GetAll(int module) const {
- int value = 0;
- int32_t status = 0;
- value = HAL_GetAllSolenoids(static_cast<int>(module), &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
- return value;
-}
-
-void SolenoidBase::SetAll(int value, int module) {
- int32_t status = 0;
- HAL_SetAllSolenoids(static_cast<int>(module), value, &status);
- wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
-}
-
-/**
- * Reads complete solenoid blacklist for all 8 solenoids as a single byte.
- *
- * If a solenoid is shorted, it is added to the blacklist and
- * disabled until power cycle, or until faults are cleared.
- * @see ClearAllPCMStickyFaults()
- *
- * @return The solenoid blacklist of all 8 solenoids on the module.
- */
-int SolenoidBase::GetPCMSolenoidBlackList(int module) const {
- int32_t status = 0;
- return HAL_GetPCMSolenoidBlackList(static_cast<int>(module), &status);
-}
-
-/**
- * @return true if PCM sticky fault is set : The common highside solenoid
- * voltage rail is too low, most likely a solenoid channel is shorted.
- */
-bool SolenoidBase::GetPCMSolenoidVoltageStickyFault(int module) const {
- int32_t status = 0;
- return HAL_GetPCMSolenoidVoltageStickyFault(static_cast<int>(module),
- &status);
-}
-
-/**
- * @return true if PCM is in fault state : The common highside solenoid voltage
- * rail is too low, most likely a solenoid channel is shorted.
- */
-bool SolenoidBase::GetPCMSolenoidVoltageFault(int module) const {
- int32_t status = 0;
- return HAL_GetPCMSolenoidVoltageFault(static_cast<int>(module), &status);
-}
-
-/**
- * Clear ALL sticky faults inside PCM that Compressor is wired to.
- *
- * If a sticky fault is set, then it will be persistently cleared. Compressor
- * drive maybe momentarily disable while flags are being cleared. Care should
- * be taken to not call this too frequently, otherwise normal compressor
- * functionality may be prevented.
- *
- * If no sticky faults are set then this call will have no effect.
- */
-void SolenoidBase::ClearAllPCMStickyFaults(int module) {
- int32_t status = 0;
- return HAL_ClearAllPCMStickyFaults(static_cast<int>(module), &status);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Spark.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Spark.cpp
deleted file mode 100644
index 1790806..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Spark.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Spark.h"
-
-#include "HAL/HAL.h"
-#include "LiveWindow/LiveWindow.h"
-
-using namespace frc;
-
-/**
- * Note that the Spark uses the following bounds for PWM values. These values
- * should work reasonably well for most controllers, but if users experience
- * issues such as asymmetric behavior around the deadband or inability to
- * saturate the controller in either direction, calibration is recommended.
- * The calibration procedure can be found in the Spark User Manual available
- * from REV Robotics.
- *
- * 2.003ms = full "forward"
- * 1.55ms = the "high end" of the deadband range
- * 1.50ms = center of the deadband range (off)
- * 1.46ms = the "low end" of the deadband range
- * 0.999ms = full "reverse"
- */
-
-/**
- * Constructor for a Spark.
- *
- * @param channel The PWM channel that the Spark is attached to. 0-9 are
- * on-board, 10-19 are on the MXP port
- */
-Spark::Spark(int channel) : PWMSpeedController(channel) {
- SetBounds(2.003, 1.55, 1.50, 1.46, .999);
- SetPeriodMultiplier(kPeriodMultiplier_1X);
- SetSpeed(0.0);
- SetZeroLatch();
-
- HAL_Report(HALUsageReporting::kResourceType_RevSPARK, GetChannel());
- LiveWindow::GetInstance()->AddActuator("Spark", GetChannel(), this);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Talon.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Talon.cpp
deleted file mode 100644
index ca2e6c3..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Talon.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Talon.h"
-
-#include "HAL/HAL.h"
-
-using namespace frc;
-
-/**
- * Constructor for a Talon (original or Talon SR).
- *
- * @param channel The PWM channel number that the Talon is attached to. 0-9 are
- * on-board, 10-19 are on the MXP port
- */
-Talon::Talon(int channel) : PWM(channel) {
- /* Note that the Talon uses the following bounds for PWM values. These values
- * should work reasonably well for most controllers, but if users experience
- * issues such as asymmetric behavior around the deadband or inability to
- * saturate the controller in either direction, calibration is recommended.
- * The calibration procedure can be found in the Talon User Manual available
- * from CTRE.
- *
- * 2.037ms = full "forward"
- * 1.539ms = the "high end" of the deadband range
- * 1.513ms = center of the deadband range (off)
- * 1.487ms = the "low end" of the deadband range
- * 0.989ms = full "reverse"
- */
- SetBounds(2.037, 1.539, 1.513, 1.487, .989);
- SetPeriodMultiplier(kPeriodMultiplier_1X);
- SetSpeed(0.0);
- SetZeroLatch();
-
- HAL_Report(HALUsageReporting::kResourceType_Talon, GetChannel());
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/TalonSRX.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/TalonSRX.cpp
deleted file mode 100644
index 71b1b02..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/TalonSRX.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "TalonSRX.h"
-
-#include "HAL/HAL.h"
-#include "LiveWindow/LiveWindow.h"
-
-using namespace frc;
-
-/**
- * Construct a TalonSRX connected via PWM.
- *
- * @param channel The PWM channel that the TalonSRX is attached to. 0-9 are
- * on-board, 10-19 are on the MXP port
- */
-TalonSRX::TalonSRX(int channel) : PWMSpeedController(channel) {
- /* Note that the TalonSRX uses the following bounds for PWM values. These
- * values should work reasonably well for most controllers, but if users
- * experience issues such as asymmetric behavior around the deadband or
- * inability to saturate the controller in either direction, calibration is
- * recommended. The calibration procedure can be found in the TalonSRX User
- * Manual available from Cross The Road Electronics.
- * 2.004ms = full "forward"
- * 1.52ms = the "high end" of the deadband range
- * 1.50ms = center of the deadband range (off)
- * 1.48ms = the "low end" of the deadband range
- * 0.997ms = full "reverse"
- */
- SetBounds(2.004, 1.52, 1.50, 1.48, .997);
- SetPeriodMultiplier(kPeriodMultiplier_1X);
- SetSpeed(0.0);
- SetZeroLatch();
-
- HAL_Report(HALUsageReporting::kResourceType_TalonSRX, GetChannel());
- LiveWindow::GetInstance()->AddActuator("TalonSRX", GetChannel(), this);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Task.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Task.cpp
deleted file mode 100644
index e7dbc9a..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Task.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Task.h"
-
-#include <signal.h>
-
-#include <cerrno>
-
-#include "WPIErrors.h"
-
-namespace frc {
-
-const int Task::kDefaultPriority;
-
-Task& Task::operator=(Task&& task) {
- m_thread.swap(task.m_thread);
- m_taskName = std::move(task.m_taskName);
-
- return *this;
-}
-
-Task::~Task() {
- if (m_thread.joinable()) {
- std::cout << "[HAL] Exited task " << m_taskName << std::endl;
- }
-}
-
-bool Task::joinable() const noexcept { return m_thread.joinable(); }
-
-void Task::join() { m_thread.join(); }
-
-void Task::detach() { m_thread.detach(); }
-
-std::thread::id Task::get_id() const noexcept { return m_thread.get_id(); }
-
-std::thread::native_handle_type Task::native_handle() {
- return m_thread.native_handle();
-}
-
-/**
- * Verifies a task still exists.
- *
- * @return true on success.
- */
-bool Task::Verify() { return VerifyTaskId() == TASK_OK; }
-
-/**
- * Gets the priority of a task.
- *
- * @return task priority or 0 if an error occured
- */
-int Task::GetPriority() {
- int priority;
- if (HandleError(GetTaskPriority(&priority)))
- return priority;
- else
- return 0;
-}
-
-/**
- * This routine changes a task's priority to a specified priority.
- * Priorities range from 1, the lowest priority, to 99, the highest priority.
- * Default task priority is 60.
- *
- * @param priority The priority at which the internal thread should run.
- * @return true on success.
- */
-bool Task::SetPriority(int priority) {
- return HandleError(SetTaskPriority(priority));
-}
-
-/**
- * Returns the name of the task.
- *
- * @return The name of the task.
- */
-std::string Task::GetName() const { return m_taskName; }
-
-Task::TASK_STATUS Task::VerifyTaskId() {
- auto task = m_thread.native_handle();
- if (pthread_kill(task, 0) == 0) {
- return TASK_OK;
- } else {
- return TASK_ERROR;
- }
-}
-
-Task::TASK_STATUS Task::GetTaskPriority(int32_t* priority) {
- auto task = m_thread.native_handle();
- int32_t policy = 0;
- struct sched_param param;
-
- if (VerifyTaskId() == TASK_OK &&
- pthread_getschedparam(task, &policy, ¶m) == 0) {
- *priority = param.sched_priority;
- return TASK_OK;
- } else {
- return TASK_ERROR;
- }
-}
-
-Task::TASK_STATUS Task::SetTaskPriority(int32_t priority) {
- auto task = m_thread.native_handle();
- int32_t policy = 0;
- struct sched_param param;
-
- if (VerifyTaskId() == TASK_OK &&
- pthread_getschedparam(task, &policy, ¶m) == 0) {
- param.sched_priority = priority;
- if (pthread_setschedparam(task, SCHED_FIFO, ¶m) == 0) {
- return TASK_OK;
- } else {
- return TASK_ERROR;
- }
- } else {
- return TASK_ERROR;
- }
-}
-
-/**
- * Handles errors generated by task related code.
- */
-bool Task::HandleError(TASK_STATUS results) {
- if (results != TASK_ERROR) return true;
- int errsv = errno;
- if (errsv == TaskLib_ILLEGAL_PRIORITY) {
- wpi_setWPIErrorWithContext(TaskPriorityError, m_taskName.c_str());
- } else {
- std::printf("ERROR: errno=%i", errsv);
- wpi_setWPIErrorWithContext(TaskError, m_taskName.c_str());
- }
- return false;
-}
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Threads.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Threads.cpp
deleted file mode 100644
index 2ac0f65..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Threads.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/Threads.h"
-#include "Threads.h"
-
-#include "ErrorBase.h"
-#include "HAL/HAL.h"
-
-namespace frc {
-/**
- * Get the thread priority for the specified thread.
- *
- * @param thread Reference to the thread to get the priority for
- * @param isRealTime Set to true if thread is realtime, otherwise false
- * @return The current thread priority. Scaled 1-99, with 1 being highest.
- */
-int GetThreadPriority(std::thread& thread, bool* isRealTime) {
- int32_t status = 0;
- HAL_Bool rt = false;
- auto native = thread.native_handle();
- auto ret = HAL_GetThreadPriority(&native, &rt, &status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- *isRealTime = rt;
- return ret;
-}
-
-/**
- * Get the thread priority for the current thread
- *
- * @param isRealTime Set to true if thread is realtime, otherwise false
- * @return The current thread priority. Scaled 1-99.
- */
-int GetCurrentThreadPriority(bool* isRealTime) {
- int32_t status = 0;
- HAL_Bool rt = false;
- auto ret = HAL_GetCurrentThreadPriority(&rt, &status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- *isRealTime = rt;
- return ret;
-}
-
-/**
- * Sets the thread priority for the specified thread
- *
- * @param thread Reference to the thread to set the priority of
- * @param realTime Set to true to set a realtime priority, false for standard
- * priority
- * @param priority Priority to set the thread to. Scaled 1-99, with 1 being
- * highest. On RoboRIO, priority is ignored for non realtime setting
- *
- * @return The success state of setting the priority
- */
-bool SetThreadPriority(std::thread& thread, bool realTime, int priority) {
- int32_t status = 0;
- auto native = thread.native_handle();
- auto ret = HAL_SetThreadPriority(&native, realTime, priority, &status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return ret;
-}
-
-/**
- * Sets the thread priority for the current thread
- *
- * @param realTime Set to true to set a realtime priority, false for standard
- * priority
- * @param priority Priority to set the thread to. Scaled 1-99, with 1 being
- * highest. On RoboRIO, priority is ignored for non realtime setting
- *
- * @return The success state of setting the priority
- */
-bool SetCurrentThreadPriority(bool realTime, int priority) {
- int32_t status = 0;
- auto ret = HAL_SetCurrentThreadPriority(realTime, priority, &status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return ret;
-}
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Timer.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Timer.cpp
deleted file mode 100644
index 04e7428..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Timer.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Timer.h"
-
-#include <chrono>
-#include <iostream>
-#include <thread>
-
-#include "DriverStation.h"
-#include "HAL/HAL.h"
-#include "Utility.h"
-
-namespace frc {
-
-/**
- * Pause the task for a specified time.
- *
- * Pause the execution of the program for a specified period of time given in
- * seconds. Motors will continue to run at their last assigned values, and
- * sensors will continue to update. Only the task containing the wait will
- * pause until the wait time is expired.
- *
- * @param seconds Length of time to pause, in seconds.
- */
-void Wait(double seconds) {
- if (seconds < 0.0) return;
- std::this_thread::sleep_for(std::chrono::duration<double>(seconds));
-}
-
-/**
- * Return the FPGA system clock time in seconds.
- * This is deprecated and just forwards to Timer::GetFPGATimestamp().
- * @return Robot running time in seconds.
- */
-double GetClock() { return Timer::GetFPGATimestamp(); }
-
-/**
- * @brief Gives real-time clock system time with nanosecond resolution
- * @return The time, just in case you want the robot to start autonomous at 8pm
- * on Saturday.
- */
-double GetTime() {
- using namespace std::chrono;
- return duration_cast<duration<double>>(system_clock::now().time_since_epoch())
- .count();
-}
-
-} // namespace frc
-
-using namespace frc;
-
-// for compatibility with msvc12--see C2864
-const double Timer::kRolloverTime = (1ll << 32) / 1e6;
-/**
- * Create a new timer object.
- *
- * Create a new timer object and reset the time to zero. The timer is initially
- * not running and
- * must be started.
- */
-Timer::Timer() {
- // Creates a semaphore to control access to critical regions.
- // Initially 'open'
- Reset();
-}
-
-/**
- * Get the current time from the timer. If the clock is running it is derived
- * from the current system clock the start time stored in the timer class. If
- * the clock is not running, then return the time when it was last stopped.
- *
- * @return Current time value for this timer in seconds
- */
-double Timer::Get() const {
- double result;
- double currentTime = GetFPGATimestamp();
-
- std::lock_guard<priority_mutex> sync(m_mutex);
- if (m_running) {
- // If the current time is before the start time, then the FPGA clock
- // rolled over. Compensate by adding the ~71 minutes that it takes
- // to roll over to the current time.
- if (currentTime < m_startTime) {
- currentTime += kRolloverTime;
- }
-
- result = (currentTime - m_startTime) + m_accumulatedTime;
- } else {
- result = m_accumulatedTime;
- }
-
- return result;
-}
-
-/**
- * Reset the timer by setting the time to 0.
- *
- * Make the timer startTime the current time so new requests will be relative to
- * now.
- */
-void Timer::Reset() {
- std::lock_guard<priority_mutex> sync(m_mutex);
- m_accumulatedTime = 0;
- m_startTime = GetFPGATimestamp();
-}
-
-/**
- * Start the timer running.
- *
- * Just set the running flag to true indicating that all time requests should be
- * relative to the system clock.
- */
-void Timer::Start() {
- std::lock_guard<priority_mutex> sync(m_mutex);
- if (!m_running) {
- m_startTime = GetFPGATimestamp();
- m_running = true;
- }
-}
-
-/**
- * Stop the timer.
- *
- * This computes the time as of now and clears the running flag, causing all
- * subsequent time requests to be read from the accumulated time rather than
- * looking at the system clock.
- */
-void Timer::Stop() {
- double temp = Get();
-
- std::lock_guard<priority_mutex> sync(m_mutex);
- if (m_running) {
- m_accumulatedTime = temp;
- m_running = false;
- }
-}
-
-/**
- * Check if the period specified has passed and if it has, advance the start
- * time by that period. This is useful to decide if it's time to do periodic
- * work without drifting later by the time it took to get around to checking.
- *
- * @param period The period to check for (in seconds).
- * @return True if the period has passed.
- */
-bool Timer::HasPeriodPassed(double period) {
- if (Get() > period) {
- std::lock_guard<priority_mutex> sync(m_mutex);
- // Advance the start time by the period.
- m_startTime += period;
- // Don't set it to the current time... we want to avoid drift.
- return true;
- }
- return false;
-}
-
-/**
- * Return the FPGA system clock time in seconds.
- *
- * Return the time from the FPGA hardware clock in seconds since the FPGA
- * started. Rolls over after 71 minutes.
- *
- * @returns Robot running time in seconds.
- */
-double Timer::GetFPGATimestamp() {
- // FPGA returns the timestamp in microseconds
- // Call the helper GetFPGATime() in Utility.cpp
- return GetFPGATime() * 1.0e-6;
-}
-
-/**
- * Return the approximate match time The FMS does not currently send the
- * official match time to
- * the robots This returns the time since the enable signal sent from the Driver
- * Station At the
- * beginning of autonomous, the time is reset to 0.0 seconds At the beginning of
- * teleop, the time
- * is reset to +15.0 seconds If the robot is disabled, this returns 0.0 seconds
- * Warning: This is
- * not an official time (so it cannot be used to argue with referees).
- *
- * @return Match time in seconds since the beginning of autonomous
- */
-double Timer::GetMatchTime() {
- return DriverStation::GetInstance().GetMatchTime();
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Ultrasonic.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Ultrasonic.cpp
deleted file mode 100644
index 4b3549e..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Ultrasonic.cpp
+++ /dev/null
@@ -1,337 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Ultrasonic.h"
-
-#include "Counter.h"
-#include "DigitalInput.h"
-#include "DigitalOutput.h"
-#include "HAL/HAL.h"
-#include "LiveWindow/LiveWindow.h"
-#include "Timer.h"
-#include "Utility.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-// Time (sec) for the ping trigger pulse.
-constexpr double Ultrasonic::kPingTime;
-// Priority that the ultrasonic round robin task runs.
-const int Ultrasonic::kPriority;
-// Max time (ms) between readings.
-constexpr double Ultrasonic::kMaxUltrasonicTime;
-constexpr double Ultrasonic::kSpeedOfSoundInchesPerSec;
-// automatic round robin mode
-std::atomic<bool> Ultrasonic::m_automaticEnabled{false};
-std::set<Ultrasonic*> Ultrasonic::m_sensors;
-std::thread Ultrasonic::m_thread;
-
-/**
- * Background task that goes through the list of ultrasonic sensors and pings
- * each one in turn. The counter is configured to read the timing of the
- * returned echo pulse.
- *
- * DANGER WILL ROBINSON, DANGER WILL ROBINSON:
- * This code runs as a task and assumes that none of the ultrasonic sensors
- * will change while it's running. Make sure to disable automatic mode before
- * touching the list.
- */
-void Ultrasonic::UltrasonicChecker() {
- while (m_automaticEnabled) {
- for (auto& sensor : m_sensors) {
- if (!m_automaticEnabled) break;
-
- if (sensor->IsEnabled()) {
- sensor->m_pingChannel->Pulse(kPingTime); // do the ping
- }
-
- Wait(0.1); // wait for ping to return
- }
- }
-}
-
-/**
- * Initialize the Ultrasonic Sensor.
- *
- * This is the common code that initializes the ultrasonic sensor given that
- * there are two digital I/O channels allocated. If the system was running in
- * automatic mode (round robin) when the new sensor is added, it is stopped,
- * the sensor is added, then automatic mode is restored.
- */
-void Ultrasonic::Initialize() {
- bool originalMode = m_automaticEnabled;
- SetAutomaticMode(false); // kill task when adding a new sensor
- // link this instance on the list
- m_sensors.insert(this);
-
- m_counter.SetMaxPeriod(1.0);
- m_counter.SetSemiPeriodMode(true);
- m_counter.Reset();
- m_enabled = true; // make it available for round robin scheduling
- SetAutomaticMode(originalMode);
-
- static int instances = 0;
- instances++;
- HAL_Report(HALUsageReporting::kResourceType_Ultrasonic, instances);
- LiveWindow::GetInstance()->AddSensor("Ultrasonic",
- m_echoChannel->GetChannel(), this);
-}
-
-/**
- * Create an instance of the Ultrasonic Sensor.
- *
- * This is designed to support the Daventech SRF04 and Vex ultrasonic
- * sensors.
- *
- * @param pingChannel The digital output channel that sends the pulse to
- * initiate the sensor sending the ping.
- * @param echoChannel The digital input channel that receives the echo. The
- * length of time that the echo is high represents the
- * round trip time of the ping, and the distance.
- * @param units The units returned in either kInches or kMilliMeters
- */
-Ultrasonic::Ultrasonic(int pingChannel, int echoChannel, DistanceUnit units)
- : m_pingChannel(std::make_shared<DigitalOutput>(pingChannel)),
- m_echoChannel(std::make_shared<DigitalInput>(echoChannel)),
- m_counter(m_echoChannel) {
- m_units = units;
- Initialize();
-}
-
-/**
- * Create an instance of an Ultrasonic Sensor from a DigitalInput for the echo
- * channel and a DigitalOutput for the ping channel.
- *
- * @param pingChannel The digital output object that starts the sensor doing a
- * ping. Requires a 10uS pulse to start.
- * @param echoChannel The digital input object that times the return pulse to
- * determine the range.
- * @param units The units returned in either kInches or kMilliMeters
- */
-Ultrasonic::Ultrasonic(DigitalOutput* pingChannel, DigitalInput* echoChannel,
- DistanceUnit units)
- : m_pingChannel(pingChannel, NullDeleter<DigitalOutput>()),
- m_echoChannel(echoChannel, NullDeleter<DigitalInput>()),
- m_counter(m_echoChannel) {
- if (pingChannel == nullptr || echoChannel == nullptr) {
- wpi_setWPIError(NullParameter);
- m_units = units;
- return;
- }
- m_units = units;
- Initialize();
-}
-
-/**
- * Create an instance of an Ultrasonic Sensor from a DigitalInput for the echo
- * channel and a DigitalOutput for the ping channel.
- *
- * @param pingChannel The digital output object that starts the sensor doing a
- * ping. Requires a 10uS pulse to start.
- * @param echoChannel The digital input object that times the return pulse to
- * determine the range.
- * @param units The units returned in either kInches or kMilliMeters
- */
-Ultrasonic::Ultrasonic(DigitalOutput& pingChannel, DigitalInput& echoChannel,
- DistanceUnit units)
- : m_pingChannel(&pingChannel, NullDeleter<DigitalOutput>()),
- m_echoChannel(&echoChannel, NullDeleter<DigitalInput>()),
- m_counter(m_echoChannel) {
- m_units = units;
- Initialize();
-}
-
-/**
- * Create an instance of an Ultrasonic Sensor from a DigitalInput for the echo
- * channel and a DigitalOutput for the ping channel.
- *
- * @param pingChannel The digital output object that starts the sensor doing a
- * ping. Requires a 10uS pulse to start.
- * @param echoChannel The digital input object that times the return pulse to
- * determine the range.
- * @param units The units returned in either kInches or kMilliMeters
- */
-Ultrasonic::Ultrasonic(std::shared_ptr<DigitalOutput> pingChannel,
- std::shared_ptr<DigitalInput> echoChannel,
- DistanceUnit units)
- : m_pingChannel(pingChannel),
- m_echoChannel(echoChannel),
- m_counter(m_echoChannel) {
- m_units = units;
- Initialize();
-}
-
-/**
- * Destructor for the ultrasonic sensor.
- *
- * Delete the instance of the ultrasonic sensor by freeing the allocated digital
- * channels. If the system was in automatic mode (round robin), then it is
- * stopped, then started again after this sensor is removed (provided this
- * wasn't the last sensor).
- */
-Ultrasonic::~Ultrasonic() {
- bool wasAutomaticMode = m_automaticEnabled;
- SetAutomaticMode(false);
-
- // No synchronization needed because the background task is stopped.
- m_sensors.erase(this);
-
- if (!m_sensors.empty() && wasAutomaticMode) {
- SetAutomaticMode(true);
- }
-}
-
-/**
- * Turn Automatic mode on/off.
- *
- * When in Automatic mode, all sensors will fire in round robin, waiting a set
- * time between each sensor.
- *
- * @param enabling Set to true if round robin scheduling should start for all
- * the ultrasonic sensors. This scheduling method assures that
- * the sensors are non-interfering because no two sensors fire
- * at the same time. If another scheduling algorithm is
- * prefered, it can be implemented by pinging the sensors
- * manually and waiting for the results to come back.
- */
-void Ultrasonic::SetAutomaticMode(bool enabling) {
- if (enabling == m_automaticEnabled) return; // ignore the case of no change
-
- m_automaticEnabled = enabling;
-
- if (enabling) {
- /* Clear all the counters so no data is valid. No synchronization is needed
- * because the background task is stopped.
- */
- for (auto& sensor : m_sensors) {
- sensor->m_counter.Reset();
- }
-
- m_thread = std::thread(&Ultrasonic::UltrasonicChecker);
-
- // TODO: Currently, lvuser does not have permissions to set task priorities.
- // Until that is the case, uncommenting this will break user code that calls
- // Ultrasonic::SetAutomicMode().
- // m_task.SetPriority(kPriority);
- } else {
- // Wait for background task to stop running
- m_thread.join();
-
- /* Clear all the counters (data now invalid) since automatic mode is
- * disabled. No synchronization is needed because the background task is
- * stopped.
- */
- for (auto& sensor : m_sensors) {
- sensor->m_counter.Reset();
- }
- }
-}
-
-/**
- * Single ping to ultrasonic sensor.
- *
- * Send out a single ping to the ultrasonic sensor. This only works if automatic
- * (round robin) mode is disabled. A single ping is sent out, and the counter
- * should count the semi-period when it comes in. The counter is reset to make
- * the current value invalid.
- */
-void Ultrasonic::Ping() {
- wpi_assert(!m_automaticEnabled);
- m_counter.Reset(); // reset the counter to zero (invalid data now)
- m_pingChannel->Pulse(
- kPingTime); // do the ping to start getting a single range
-}
-
-/**
- * Check if there is a valid range measurement.
- *
- * The ranges are accumulated in a counter that will increment on each edge of
- * the echo (return) signal. If the count is not at least 2, then the range has
- * not yet been measured, and is invalid.
- */
-bool Ultrasonic::IsRangeValid() const { return m_counter.Get() > 1; }
-
-/**
- * Get the range in inches from the ultrasonic sensor.
- *
- * @return double Range in inches of the target returned from the ultrasonic
- * sensor. If there is no valid value yet, i.e. at least one
- * measurement hasn't completed, then return 0.
- */
-double Ultrasonic::GetRangeInches() const {
- if (IsRangeValid())
- return m_counter.GetPeriod() * kSpeedOfSoundInchesPerSec / 2.0;
- else
- return 0;
-}
-
-/**
- * Get the range in millimeters from the ultrasonic sensor.
- *
- * @return double Range in millimeters of the target returned by the ultrasonic
- * sensor. If there is no valid value yet, i.e. at least one
- * measurement hasn't completed, then return 0.
- */
-double Ultrasonic::GetRangeMM() const { return GetRangeInches() * 25.4; }
-
-/**
- * Get the range in the current DistanceUnit for the PIDSource base object.
- *
- * @return The range in DistanceUnit
- */
-double Ultrasonic::PIDGet() {
- switch (m_units) {
- case Ultrasonic::kInches:
- return GetRangeInches();
- case Ultrasonic::kMilliMeters:
- return GetRangeMM();
- default:
- return 0.0;
- }
-}
-
-void Ultrasonic::SetPIDSourceType(PIDSourceType pidSource) {
- if (wpi_assert(pidSource == PIDSourceType::kDisplacement)) {
- m_pidSource = pidSource;
- }
-}
-
-/**
- * Set the current DistanceUnit that should be used for the PIDSource base
- * object.
- *
- * @param units The DistanceUnit that should be used.
- */
-void Ultrasonic::SetDistanceUnits(DistanceUnit units) { m_units = units; }
-
-/**
- * Get the current DistanceUnit that is used for the PIDSource base object.
- *
- * @return The type of DistanceUnit that is being used.
- */
-Ultrasonic::DistanceUnit Ultrasonic::GetDistanceUnits() const {
- return m_units;
-}
-
-void Ultrasonic::UpdateTable() {
- if (m_table != nullptr) {
- m_table->PutNumber("Value", GetRangeInches());
- }
-}
-
-void Ultrasonic::StartLiveWindowMode() {}
-
-void Ultrasonic::StopLiveWindowMode() {}
-
-std::string Ultrasonic::GetSmartDashboardType() const { return "Ultrasonic"; }
-
-void Ultrasonic::InitTable(std::shared_ptr<ITable> subTable) {
- m_table = subTable;
- UpdateTable();
-}
-
-std::shared_ptr<ITable> Ultrasonic::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Utility.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Utility.cpp
deleted file mode 100644
index 741691a..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Utility.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Utility.h"
-
-#include <cxxabi.h>
-#include <execinfo.h>
-
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <sstream>
-
-#include "ErrorBase.h"
-#include "HAL/DriverStation.h"
-#include "HAL/HAL.h"
-#include "llvm/SmallString.h"
-
-using namespace frc;
-
-/**
- * Assert implementation.
- * This allows breakpoints to be set on an assert.
- * The users don't call this, but instead use the wpi_assert macros in
- * Utility.h.
- */
-bool wpi_assert_impl(bool conditionValue, llvm::StringRef conditionText,
- llvm::StringRef message, llvm::StringRef fileName,
- int lineNumber, llvm::StringRef funcName) {
- if (!conditionValue) {
- std::stringstream locStream;
- locStream << funcName << " [";
- llvm::SmallString<128> fileTemp;
- locStream << basename(fileName.c_str(fileTemp)) << ":" << lineNumber << "]";
-
- std::stringstream errorStream;
-
- errorStream << "Assertion \"" << conditionText << "\" ";
-
- if (message[0] != '\0') {
- errorStream << "failed: " << message << std::endl;
- } else {
- errorStream << "failed." << std::endl;
- }
-
- std::string stack = GetStackTrace(2);
- std::string location = locStream.str();
- std::string error = errorStream.str();
-
- // Print the error and send it to the DriverStation
- HAL_SendError(1, 1, 0, error.c_str(), location.c_str(), stack.c_str(), 1);
- }
-
- return conditionValue;
-}
-
-/**
- * Common error routines for wpi_assertEqual_impl and wpi_assertNotEqual_impl
- * This should not be called directly; it should only be used by
- * wpi_assertEqual_impl and wpi_assertNotEqual_impl.
- */
-void wpi_assertEqual_common_impl(llvm::StringRef valueA, llvm::StringRef valueB,
- llvm::StringRef equalityType,
- llvm::StringRef message,
- llvm::StringRef fileName, int lineNumber,
- llvm::StringRef funcName) {
- std::stringstream locStream;
- locStream << funcName << " [";
- llvm::SmallString<128> fileTemp;
- locStream << basename(fileName.c_str(fileTemp)) << ":" << lineNumber << "]";
-
- std::stringstream errorStream;
-
- errorStream << "Assertion \"" << valueA << " " << equalityType << " "
- << valueB << "\" ";
-
- if (message[0] != '\0') {
- errorStream << "failed: " << message << std::endl;
- } else {
- errorStream << "failed." << std::endl;
- }
-
- std::string trace = GetStackTrace(3);
- std::string location = locStream.str();
- std::string error = errorStream.str();
-
- // Print the error and send it to the DriverStation
- HAL_SendError(1, 1, 0, error.c_str(), location.c_str(), trace.c_str(), 1);
-}
-
-/**
- * Assert equal implementation.
- * This determines whether the two given integers are equal. If not,
- * the value of each is printed along with an optional message string.
- * The users don't call this, but instead use the wpi_assertEqual macros in
- * Utility.h.
- */
-bool wpi_assertEqual_impl(int valueA, int valueB, llvm::StringRef valueAString,
- llvm::StringRef valueBString, llvm::StringRef message,
- llvm::StringRef fileName, int lineNumber,
- llvm::StringRef funcName) {
- if (!(valueA == valueB)) {
- wpi_assertEqual_common_impl(valueAString, valueBString, "==", message,
- fileName, lineNumber, funcName);
- }
- return valueA == valueB;
-}
-
-/**
- * Assert not equal implementation.
- * This determines whether the two given integers are equal. If so,
- * the value of each is printed along with an optional message string.
- * The users don't call this, but instead use the wpi_assertNotEqual macros in
- * Utility.h.
- */
-bool wpi_assertNotEqual_impl(int valueA, int valueB,
- llvm::StringRef valueAString,
- llvm::StringRef valueBString,
- llvm::StringRef message, llvm::StringRef fileName,
- int lineNumber, llvm::StringRef funcName) {
- if (!(valueA != valueB)) {
- wpi_assertEqual_common_impl(valueAString, valueBString, "!=", message,
- fileName, lineNumber, funcName);
- }
- return valueA != valueB;
-}
-
-namespace frc {
-
-/**
- * Return the FPGA Version number.
- *
- * For now, expect this to be competition year.
- * @return FPGA Version number.
- */
-int GetFPGAVersion() {
- int32_t status = 0;
- int version = HAL_GetFPGAVersion(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return version;
-}
-
-/**
- * Return the FPGA Revision number.
- * The format of the revision is 3 numbers.
- * The 12 most significant bits are the Major Revision.
- * the next 8 bits are the Minor Revision.
- * The 12 least significant bits are the Build Number.
- * @return FPGA Revision number.
- */
-int64_t GetFPGARevision() {
- int32_t status = 0;
- int64_t revision = HAL_GetFPGARevision(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return revision;
-}
-
-/**
- * Read the microsecond-resolution timer on the FPGA.
- *
- * @return The current time in microseconds according to the FPGA (since FPGA
- * reset).
- */
-uint64_t GetFPGATime() {
- int32_t status = 0;
- uint64_t time = HAL_GetFPGATime(&status);
- wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
- return time;
-}
-
-/**
- * Get the state of the "USER" button on the roboRIO.
- *
- * @return True if the button is currently pressed down
- */
-bool GetUserButton() {
- int32_t status = 0;
-
- bool value = HAL_GetFPGAButton(&status);
- wpi_setGlobalError(status);
-
- return value;
-}
-
-/**
- * Demangle a C++ symbol, used for printing stack traces.
- */
-static std::string demangle(char const* mangledSymbol) {
- char buffer[256];
- size_t length;
- int32_t status;
-
- if (std::sscanf(mangledSymbol, "%*[^(]%*[(]%255[^)+]", buffer)) {
- char* symbol = abi::__cxa_demangle(buffer, nullptr, &length, &status);
- if (status == 0) {
- return symbol;
- } else {
- // If the symbol couldn't be demangled, it's probably a C function,
- // so just return it as-is.
- return buffer;
- }
- }
-
- // If everything else failed, just return the mangled symbol
- return mangledSymbol;
-}
-
-/**
- * Get a stack trace, ignoring the first "offset" symbols.
- * @param offset The number of symbols at the top of the stack to ignore
- */
-std::string GetStackTrace(int offset) {
- void* stackTrace[128];
- int stackSize = backtrace(stackTrace, 128);
- char** mangledSymbols = backtrace_symbols(stackTrace, stackSize);
- std::stringstream trace;
-
- for (int i = offset; i < stackSize; i++) {
- // Only print recursive functions once in a row.
- if (i == 0 || stackTrace[i] != stackTrace[i - 1]) {
- trace << "\tat " << demangle(mangledSymbols[i]) << std::endl;
- }
- }
-
- std::free(mangledSymbols);
-
- return trace.str();
-}
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Victor.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Victor.cpp
deleted file mode 100644
index d06f091..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Victor.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Victor.h"
-
-#include "HAL/HAL.h"
-#include "LiveWindow/LiveWindow.h"
-
-using namespace frc;
-
-/**
- * Constructor for a Victor.
- *
- * @param channel The PWM channel number that the Victor is attached to. 0-9
- * are on-board, 10-19 are on the MXP port
- */
-Victor::Victor(int channel) : PWMSpeedController(channel) {
- /* Note that the Victor uses the following bounds for PWM values. These
- * values were determined empirically and optimized for the Victor 888. These
- * values should work reasonably well for Victor 884 controllers as well but
- * if users experience issues such as asymmetric behaviour around the deadband
- * or inability to saturate the controller in either direction, calibration is
- * recommended. The calibration procedure can be found in the Victor 884 User
- * Manual available from IFI.
- *
- * 2.027ms = full "forward"
- * 1.525ms = the "high end" of the deadband range
- * 1.507ms = center of the deadband range (off)
- * 1.49ms = the "low end" of the deadband range
- * 1.026ms = full "reverse"
- */
- SetBounds(2.027, 1.525, 1.507, 1.49, 1.026);
- SetPeriodMultiplier(kPeriodMultiplier_2X);
- SetSpeed(0.0);
- SetZeroLatch();
-
- LiveWindow::GetInstance()->AddActuator("Victor", GetChannel(), this);
- HAL_Report(HALUsageReporting::kResourceType_Victor, GetChannel());
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/VictorSP.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/VictorSP.cpp
deleted file mode 100644
index 749dcde..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/VictorSP.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "VictorSP.h"
-
-#include "HAL/HAL.h"
-
-using namespace frc;
-
-/**
- * Constructor for a VictorSP.
- *
- * @param channel The PWM channel that the VictorSP is attached to. 0-9 are
- * on-board, 10-19 are on the MXP port
- */
-VictorSP::VictorSP(int channel) : PWM(channel) {
- /**
- * Note that the VictorSP uses the following bounds for PWM values. These
- * values should work reasonably well for most controllers, but if users
- * experience issues such as asymmetric behavior around the deadband or
- * inability to saturate the controller in either direction, calibration is
- * recommended. The calibration procedure can be found in the VictorSP User
- * Manual available from Vex.
- *
- * 2.004ms = full "forward"
- * 1.52ms = the "high end" of the deadband range
- * 1.50ms = center of the deadband range (off)
- * 1.48ms = the "low end" of the deadband range
- * 0.997ms = full "reverse"
- */
- SetBounds(2.004, 1.52, 1.50, 1.48, .997);
- SetPeriodMultiplier(kPeriodMultiplier_1X);
- SetSpeed(0.0);
- SetZeroLatch();
-
- HAL_Report(HALUsageReporting::kResourceType_VictorSP, GetChannel());
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/XboxController.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/XboxController.cpp
deleted file mode 100644
index aa494dd..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/XboxController.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "XboxController.h"
-
-#include "DriverStation.h"
-#include "HAL/HAL.h"
-
-using namespace frc;
-
-/**
- * Construct an instance of an Xbox controller.
- *
- * The joystick index is the USB port on the Driver Station.
- *
- * @param port The port on the Driver Station that the joystick is plugged into
- * (0-5).
- */
-XboxController::XboxController(int port)
- : GamepadBase(port), m_ds(DriverStation::GetInstance()) {
- // HAL_Report(HALUsageReporting::kResourceType_XboxController, port);
- HAL_Report(HALUsageReporting::kResourceType_Joystick, port);
-}
-
-/**
- * Get the X axis value of the controller.
- *
- * @param hand Side of controller whose value should be returned.
- */
-double XboxController::GetX(JoystickHand hand) const {
- if (hand == kLeftHand) {
- return GetRawAxis(0);
- } else {
- return GetRawAxis(4);
- }
-}
-
-/**
- * Get the Y axis value of the controller.
- *
- * @param hand Side of controller whose value should be returned.
- */
-double XboxController::GetY(JoystickHand hand) const {
- if (hand == kLeftHand) {
- return GetRawAxis(1);
- } else {
- return GetRawAxis(5);
- }
-}
-
-/**
- * Read the value of the bumper button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- */
-bool XboxController::GetBumper(JoystickHand hand) const {
- if (hand == kLeftHand) {
- return GetRawButton(5);
- } else {
- return GetRawButton(6);
- }
-}
-
-/**
- * Read the value of the stick button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- * @return The state of the button.
- */
-bool XboxController::GetStickButton(JoystickHand hand) const {
- if (hand == kLeftHand) {
- return GetRawButton(9);
- } else {
- return GetRawButton(10);
- }
-}
-
-/**
- * Get the trigger axis value of the controller.
- *
- * @param hand Side of controller whose value should be returned.
- */
-double XboxController::GetTriggerAxis(JoystickHand hand) const {
- if (hand == kLeftHand) {
- return GetRawAxis(2);
- } else {
- return GetRawAxis(3);
- }
-}
-
-/**
- * Read the value of the A button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- * @return The state of the button.
- */
-bool XboxController::GetAButton() const { return GetRawButton(1); }
-
-/**
- * Read the value of the B button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- * @return The state of the button.
- */
-bool XboxController::GetBButton() const { return GetRawButton(2); }
-
-/**
- * Read the value of the X button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- * @return The state of the button.
- */
-bool XboxController::GetXButton() const { return GetRawButton(3); }
-
-/**
- * Read the value of the Y button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- * @return The state of the button.
- */
-bool XboxController::GetYButton() const { return GetRawButton(4); }
-
-/**
- * Read the value of the back button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- * @return The state of the button.
- */
-bool XboxController::GetBackButton() const { return GetRawButton(7); }
-
-/**
- * Read the value of the start button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- * @return The state of the button.
- */
-bool XboxController::GetStartButton() const { return GetRawButton(8); }
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/vision/VisionRunner.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/vision/VisionRunner.cpp
deleted file mode 100644
index 493c29e..0000000
--- a/third_party/allwpilib_2017/wpilibc/athena/src/vision/VisionRunner.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "vision/VisionRunner.h"
-
-#include "DriverStation.h"
-#include "RobotBase.h"
-#include "opencv2/core/mat.hpp"
-
-using namespace frc;
-
-/**
- * Creates a new vision runner. It will take images from the {@code
- * videoSource}, and call the virtual DoProcess() method.
- *
- * @param videoSource the video source to use to supply images for the pipeline
- */
-VisionRunnerBase::VisionRunnerBase(cs::VideoSource videoSource)
- : m_image(std::make_unique<cv::Mat>()), m_cvSink("VisionRunner CvSink") {
- m_cvSink.SetSource(videoSource);
-}
-
-// Located here and not in header due to cv::Mat forward declaration.
-VisionRunnerBase::~VisionRunnerBase() {}
-
-/**
- * Runs the pipeline one time, giving it the next image from the video source
- * specified in the constructor. This will block until the source either has an
- * image or throws an error. If the source successfully supplied a frame, the
- * pipeline's image input will be set, the pipeline will run, and the listener
- * specified in the constructor will be called to notify it that the pipeline
- * ran. This must be run in a dedicated thread, and cannot be used in the main
- * robot thread because it will freeze the robot program.
- *
- * <p>This method is exposed to allow teams to add additional functionality or
- * have their own ways to run the pipeline. Most teams, however, should just
- * use {@link #runForever} in its own thread using a std::thread.</p>
- */
-void VisionRunnerBase::RunOnce() {
- if (std::this_thread::get_id() == RobotBase::GetThreadId()) {
- wpi_setErrnoErrorWithContext(
- "VisionRunner::RunOnce() cannot be called from the main robot thread");
- return;
- }
- auto frameTime = m_cvSink.GrabFrame(*m_image);
- if (frameTime == 0) {
- auto error = m_cvSink.GetError();
- DriverStation::ReportError(error);
- } else {
- DoProcess(*m_image);
- }
-}
-
-/**
- * A convenience method that calls {@link #runOnce()} in an infinite loop. This
- * must be run in a dedicated thread, and cannot be used in the main robot
- * thread because it will freeze the robot program.
- *
- * <p><strong>Do not call this method directly from the main
- * thread.</strong></p>
- */
-void VisionRunnerBase::RunForever() {
- if (std::this_thread::get_id() == RobotBase::GetThreadId()) {
- wpi_setErrnoErrorWithContext(
- "VisionRunner::RunForever() cannot be called from the main robot "
- "thread");
- return;
- }
- while (true) {
- RunOnce();
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/build.gradle b/third_party/allwpilib_2017/wpilibc/build.gradle
deleted file mode 100644
index 4ebbcc9..0000000
--- a/third_party/allwpilib_2017/wpilibc/build.gradle
+++ /dev/null
@@ -1,70 +0,0 @@
-plugins {
- id 'org.ysb33r.doxygen' version '0.3'
- id 'cpp'
- id 'maven-publish'
-}
-
-evaluationDependsOn(':hal')
-
-ext.shared = 'shared'
-ext.athena = 'athena'
-ext.simulation = 'sim'
-
-def versionClass = """
-/*
- * Autogenerated file! Do not manually edit this file. This version is regenerated
- * any time the publish task is run, or when this file is deleted.
- */
-
-const char* WPILibVersion = "${WPILibVersion.version}";
-""".trim()
-
-def wpilibVersionFile = file('shared/src/WPILibVersion.cpp')
-
-def willPublish = false
-gradle.taskGraph.addTaskExecutionGraphListener { graph ->
- willPublish = graph.hasTask(publish)
-}
-
-task generateCppVersion() {
- description = 'Generates the wpilib version class'
- group = 'WPILib'
-
- // We follow a simple set of checks to determine whether we should generate a new version file:
- // 1. If the release type is not development, we generate a new verison file
- // 2. If there is no generated version number, we generate a new version file
- // 3. If there is a generated build number, and the release type is development, then we will
- // only generate if the publish task is run.
- doLast {
- if (!WPILibVersion.releaseType.toString().equalsIgnoreCase('official') && !willPublish && wpilibVersionFile.exists()) {
- return
- }
- println "Writing version ${WPILibVersion.version} to $wpilibVersionFile"
-
- if (wpilibVersionFile.exists()) {
- wpilibVersionFile.delete()
- }
- wpilibVersionFile.write(versionClass)
- }
-}
-
-clean {
- delete wpilibVersionFile
-}
-
-// Attempts to execute the doxygen command. If there is no exception, doxygen exists, so return true. If there's
-// an IOException, it doesn't exist, so return false
-ext.checkDoxygen = {
- try {
- 'doxygen'.execute()
- true
- } catch (IOException e) {
- false
- }
-}
-
-apply from: 'athena.gradle'
-
-if (enableSimulation){
- apply from: 'simulation.gradle'
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Base.h b/third_party/allwpilib_2017/wpilibc/shared/include/Base.h
deleted file mode 100644
index 8374d2a..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Base.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "HAL/cpp/make_unique.h"
-
-// MSVC 2013 doesn't allow "= default" on move constructors, but since we are
-// (currently) only actually using the move constructors in non-MSVC situations
-// (ie, wpilibC++Devices), we can just ignore it in MSVC.
-#if !defined(_MSC_VER)
-#define DEFAULT_MOVE_CONSTRUCTOR(ClassName) ClassName(ClassName&&) = default
-#else
-#define DEFAULT_MOVE_CONSTRUCTOR(ClassName)
-#endif
-
-#if (__cplusplus < 201103L)
-#if !defined(_MSC_VER)
-#define nullptr NULL
-#endif
-#define constexpr const
-#endif
-
-#if defined(_MSC_VER)
-#define noexcept throw()
-#endif
-
-// Provide std::decay_t when using GCC < 4.9
-#if defined(__GNUC__)
-#if __GNUC__ == 4 && __GNUC_MINOR__ < 9
-#include <type_traits>
-namespace std {
-template <class T>
-using decay_t = typename decay<T>::type;
-}
-#endif
-#endif
-
-namespace frc {
-
-// A struct to use as a deleter when a std::shared_ptr must wrap a raw pointer
-// that is being deleted by someone else.
-template <class T>
-struct NullDeleter {
- void operator()(T*) const noexcept {};
-};
-
-} // namespace frc
-
-#include <atomic>
-
-namespace frc {
-
-// Use this for determining whether the default move constructor has been
-// called on a containing object. This serves the purpose of allowing us to
-// use the default move constructor of an object for moving all the data around
-// while being able to use this to, for instance, chose not to de-allocate
-// a PWM port in a destructor.
-struct HasBeenMoved {
- HasBeenMoved(HasBeenMoved&& other) {
- other.moved = true;
- moved = false;
- }
- HasBeenMoved() = default;
- std::atomic<bool> moved{false};
- operator bool() const { return moved; }
-};
-
-} // namespace frc
-
-// For backwards compatibility
-#ifndef NAMESPACED_WPILIB
-using namespace frc; // NOLINT
-#endif
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/Button.h b/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/Button.h
deleted file mode 100644
index 12b4fce..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/Button.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 "Buttons/Trigger.h"
-#include "Commands/Command.h"
-
-namespace frc {
-
-/**
- * This class provides an easy way to link commands to OI inputs.
- *
- * It is very easy to link a button to a command. For instance, you could
- * link the trigger button of a joystick to a "score" command.
- *
- * This class represents a subclass of Trigger that is specifically aimed at
- * buttons on an operator interface as a common use case of the more generalized
- * Trigger objects. This is a simple wrapper around Trigger with the method
- * names
- * renamed to fit the Button object use.
- */
-class Button : public Trigger {
- public:
- virtual void WhenPressed(Command* command);
- virtual void WhileHeld(Command* command);
- virtual void WhenReleased(Command* command);
- virtual void CancelWhenPressed(Command* command);
- virtual void ToggleWhenPressed(Command* command);
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/ButtonScheduler.h b/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/ButtonScheduler.h
deleted file mode 100644
index 45c0204..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/ButtonScheduler.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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
-
-namespace frc {
-
-class Trigger;
-class Command;
-
-class ButtonScheduler {
- public:
- ButtonScheduler(bool last, Trigger* button, Command* orders);
- virtual ~ButtonScheduler() = default;
- virtual void Execute() = 0;
- void Start();
-
- protected:
- bool m_pressedLast;
- Trigger* m_button;
- Command* m_command;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/CancelButtonScheduler.h b/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/CancelButtonScheduler.h
deleted file mode 100644
index 3dd3259..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/CancelButtonScheduler.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 "Buttons/ButtonScheduler.h"
-
-namespace frc {
-
-class Trigger;
-class Command;
-
-class CancelButtonScheduler : public ButtonScheduler {
- public:
- CancelButtonScheduler(bool last, Trigger* button, Command* orders);
- virtual ~CancelButtonScheduler() = default;
- virtual void Execute();
-
- private:
- bool pressedLast;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/HeldButtonScheduler.h b/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/HeldButtonScheduler.h
deleted file mode 100644
index 7cedde3..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/HeldButtonScheduler.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 "Buttons/ButtonScheduler.h"
-
-namespace frc {
-
-class Trigger;
-class Command;
-
-class HeldButtonScheduler : public ButtonScheduler {
- public:
- HeldButtonScheduler(bool last, Trigger* button, Command* orders);
- virtual ~HeldButtonScheduler() = default;
- virtual void Execute();
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/InternalButton.h b/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/InternalButton.h
deleted file mode 100644
index 9c2fd8f..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/InternalButton.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 "Buttons/Button.h"
-
-namespace frc {
-
-class InternalButton : public Button {
- public:
- InternalButton() = default;
- explicit InternalButton(bool inverted);
- virtual ~InternalButton() = default;
-
- void SetInverted(bool inverted);
- void SetPressed(bool pressed);
-
- virtual bool Get();
-
- private:
- bool m_pressed = false;
- bool m_inverted = false;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/JoystickButton.h b/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/JoystickButton.h
deleted file mode 100644
index 5f079b4..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/JoystickButton.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 "Buttons/Button.h"
-#include "GenericHID.h"
-
-namespace frc {
-
-class JoystickButton : public Button {
- public:
- JoystickButton(GenericHID* joystick, int buttonNumber);
- virtual ~JoystickButton() = default;
-
- virtual bool Get();
-
- private:
- GenericHID* m_joystick;
- int m_buttonNumber;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/NetworkButton.h b/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/NetworkButton.h
deleted file mode 100644
index 9be23b7..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/NetworkButton.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <memory>
-#include <string>
-
-#include "Buttons/Button.h"
-
-namespace frc {
-
-class NetworkButton : public Button {
- public:
- NetworkButton(const std::string& tableName, const std::string& field);
- NetworkButton(std::shared_ptr<ITable> table, const std::string& field);
- virtual ~NetworkButton() = default;
-
- virtual bool Get();
-
- private:
- std::shared_ptr<ITable> m_netTable;
- std::string m_field;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/PressedButtonScheduler.h b/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/PressedButtonScheduler.h
deleted file mode 100644
index 15b7ec4..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/PressedButtonScheduler.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 "Buttons/ButtonScheduler.h"
-
-namespace frc {
-
-class Trigger;
-class Command;
-
-class PressedButtonScheduler : public ButtonScheduler {
- public:
- PressedButtonScheduler(bool last, Trigger* button, Command* orders);
- virtual ~PressedButtonScheduler() = default;
- virtual void Execute();
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/ReleasedButtonScheduler.h b/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/ReleasedButtonScheduler.h
deleted file mode 100644
index 34cbd54..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/ReleasedButtonScheduler.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 "Buttons/ButtonScheduler.h"
-
-namespace frc {
-
-class Trigger;
-class Command;
-
-class ReleasedButtonScheduler : public ButtonScheduler {
- public:
- ReleasedButtonScheduler(bool last, Trigger* button, Command* orders);
- virtual ~ReleasedButtonScheduler() = default;
- virtual void Execute();
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/ToggleButtonScheduler.h b/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/ToggleButtonScheduler.h
deleted file mode 100644
index b7464c8..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/ToggleButtonScheduler.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 "Buttons/ButtonScheduler.h"
-
-namespace frc {
-
-class Trigger;
-class Command;
-
-class ToggleButtonScheduler : public ButtonScheduler {
- public:
- ToggleButtonScheduler(bool last, Trigger* button, Command* orders);
- virtual ~ToggleButtonScheduler() = default;
- virtual void Execute();
-
- private:
- bool pressedLast;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/Trigger.h b/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/Trigger.h
deleted file mode 100644
index 8ab166c..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Buttons/Trigger.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <memory>
-#include <string>
-
-#include "SmartDashboard/Sendable.h"
-
-namespace frc {
-
-class Command;
-
-/**
- * This class provides an easy way to link commands to inputs.
- *
- * It is very easy to link a polled input to a command. For instance, you could
- * link the trigger button of a joystick to a "score" command or an encoder
- * reaching
- * a particular value.
- *
- * It is encouraged that teams write a subclass of Trigger if they want to have
- * something unusual (for instance, if they want to react to the user holding
- * a button while the robot is reading a certain sensor input). For this, they
- * only have to write the {@link Trigger#Get()} method to get the full
- * functionality
- * of the Trigger class.
- */
-class Trigger : public Sendable {
- public:
- Trigger() = default;
- virtual ~Trigger() = default;
- bool Grab();
- virtual bool Get() = 0;
- void WhenActive(Command* command);
- void WhileActive(Command* command);
- void WhenInactive(Command* command);
- void CancelWhenActive(Command* command);
- void ToggleWhenActive(Command* command);
-
- void InitTable(std::shared_ptr<ITable> subtable) override;
- std::shared_ptr<ITable> GetTable() const override;
- std::string GetSmartDashboardType() const override;
-
- protected:
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/CircularBuffer.h b/third_party/allwpilib_2017/wpilibc/shared/include/CircularBuffer.h
deleted file mode 100644
index d273992..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/CircularBuffer.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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 <cstddef>
-#include <vector>
-
-namespace frc {
-
-/**
- * This is a simple circular buffer so we don't need to "bucket brigade" copy
- * old values.
- */
-template <class T>
-class CircularBuffer {
- public:
- explicit CircularBuffer(size_t size);
-
- void PushFront(T value);
- void PushBack(T value);
- T PopFront();
- T PopBack();
- void Resize(size_t size);
- void Reset();
-
- T& operator[](size_t index);
- const T& operator[](size_t index) const;
-
- private:
- std::vector<T> m_data;
-
- // Index of element at front of buffer
- size_t m_front = 0;
-
- // Number of elements used in buffer
- size_t m_length = 0;
-
- size_t ModuloInc(size_t index);
- size_t ModuloDec(size_t index);
-};
-
-} // namespace frc
-
-#include "CircularBuffer.inc"
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/CircularBuffer.inc b/third_party/allwpilib_2017/wpilibc/shared/include/CircularBuffer.inc
deleted file mode 100644
index 6f1e2c3..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/CircularBuffer.inc
+++ /dev/null
@@ -1,189 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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 <algorithm>
-
-namespace frc {
-
-template <class T>
-CircularBuffer<T>::CircularBuffer(size_t size) : m_data(size, 0) {}
-
-/**
- * Push new value onto front of the buffer. The value at the back is overwritten
- * if the buffer is full.
- */
-template <class T>
-void CircularBuffer<T>::PushFront(T value) {
- if (m_data.size() == 0) {
- return;
- }
-
- m_front = ModuloDec(m_front);
-
- m_data[m_front] = value;
-
- if (m_length < m_data.size()) {
- m_length++;
- }
-}
-
-/**
- * Push new value onto back of the buffer. The value at the front is overwritten
- * if the buffer is full.
- */
-template <class T>
-void CircularBuffer<T>::PushBack(T value) {
- if (m_data.size() == 0) {
- return;
- }
-
- m_data[(m_front + m_length) % m_data.size()] = value;
-
- if (m_length < m_data.size()) {
- m_length++;
- } else {
- // Increment front if buffer is full to maintain size
- m_front = ModuloInc(m_front);
- }
-}
-
-/**
- * Pop value at front of buffer.
- */
-template <class T>
-T CircularBuffer<T>::PopFront() {
- // If there are no elements in the buffer, do nothing
- if (m_length == 0) {
- return 0;
- }
-
- T& temp = m_data[m_front];
- m_front = ModuloInc(m_front);
- m_length--;
- return temp;
-}
-
-/**
- * Pop value at back of buffer.
- */
-template <class T>
-T CircularBuffer<T>::PopBack() {
- // If there are no elements in the buffer, do nothing
- if (m_length == 0) {
- return 0;
- }
-
- m_length--;
- return m_data[(m_front + m_length) % m_data.size()];
-}
-
-/**
- * Resizes internal buffer to given size.
- */
-template <class T>
-void CircularBuffer<T>::Resize(size_t size) {
- if (size > m_data.size()) {
- // Find end of buffer
- size_t insertLocation = (m_front + m_length) % m_data.size();
-
- // If insertion location precedes front of buffer, push front index back
- if (insertLocation <= m_front) {
- m_front += size - m_data.size();
- }
-
- // Add elements to end of buffer
- m_data.insert(m_data.begin() + insertLocation, size - m_data.size(), 0);
- } else if (size < m_data.size()) {
- /* 1) Shift element block start at "front" left as many blocks as were
- * removed up to but not exceeding buffer[0]
- * 2) Shrink buffer, which will remove even more elements automatically if
- * necessary
- */
- size_t elemsToRemove = m_data.size() - size;
- auto frontIter = m_data.begin() + m_front;
- if (m_front < elemsToRemove) {
- /* Remove elements from end of buffer before shifting start of element
- * block. Doing so saves a few copies.
- */
- m_data.erase(frontIter + size, m_data.end());
-
- // Shift start of element block to left
- m_data.erase(m_data.begin(), frontIter);
-
- // Update metadata
- m_front = 0;
- } else {
- // Shift start of element block to left
- m_data.erase(frontIter - elemsToRemove, frontIter);
-
- // Update metadata
- m_front -= elemsToRemove;
- }
-
- /* Length only changes during a shrink if all unused spaces have been
- * removed. Length decreases as used spaces are removed to meet the
- * required size.
- */
- if (m_length > size) {
- m_length = size;
- }
- }
-}
-
-/**
- * Sets internal buffer contents to zero.
- */
-template <class T>
-void CircularBuffer<T>::Reset() {
- std::fill(m_data.begin(), m_data.end(), 0);
- m_front = 0;
- m_length = 0;
-}
-
-/**
- * @return Element at index starting from front of buffer.
- */
-template <class T>
-T& CircularBuffer<T>::operator[](size_t index) {
- return m_data[(m_front + index) % m_data.size()];
-}
-
-/**
- * @return Element at index starting from front of buffer.
- */
-template <class T>
-const T& CircularBuffer<T>::operator[](size_t index) const {
- return m_data[(m_front + index) % m_data.size()];
-}
-
-/**
- * Increment an index modulo the length of the buffer.
- *
- * @return The result of the modulo operation.
- */
-template <class T>
-size_t CircularBuffer<T>::ModuloInc(size_t index) {
- return (index + 1) % m_data.size();
-}
-
-/**
- * Decrement an index modulo the length of the buffer.
- *
- * @return The result of the modulo operation.
- */
-template <class T>
-size_t CircularBuffer<T>::ModuloDec(size_t index) {
- if (index == 0) {
- return m_data.size() - 1;
- } else {
- return index - 1;
- }
-}
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/Command.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/Command.h
deleted file mode 100644
index 19d1e7a..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/Command.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <memory>
-#include <set>
-#include <string>
-
-#include "ErrorBase.h"
-#include "SmartDashboard/NamedSendable.h"
-#include "tables/ITableListener.h"
-
-namespace frc {
-
-class CommandGroup;
-class Subsystem;
-
-/**
- * The Command class is at the very core of the entire command framework.
- * Every command can be started with a call to {@link Command#Start() Start()}.
- * Once a command is started it will call {@link Command#Initialize()
- * Initialize()}, and then will repeatedly call
- * {@link Command#Execute() Execute()} until the
- * {@link Command#IsFinished() IsFinished()} returns true. Once it does,
- * {@link Command#End() End()} will be called.
- *
- * <p>However, if at any point while it is running {@link Command#Cancel()
- * Cancel()} is called, then the command will be stopped and
- * {@link Command#Interrupted() Interrupted()} will be called.</p>
- *
- * <p>If a command uses a {@link Subsystem}, then it should specify that it does
- * so by calling the {@link Command#Requires(Subsystem) Requires(...)} method
- * in its constructor. Note that a Command may have multiple requirements, and
- * {@link Command#Requires(Subsystem) Requires(...)} should be called for each
- * one.</p>
- *
- * <p>If a command is running and a new command with shared requirements is
- * started, then one of two things will happen. If the active command is
- * interruptible, then {@link Command#Cancel() Cancel()} will be called and the
- * command will be removed to make way for the new one. If the active command
- * is not interruptible, the other one will not even be started, and the active
- * one will continue functioning.</p>
- *
- * @see CommandGroup
- * @see Subsystem
- */
-class Command : public ErrorBase, public NamedSendable, public ITableListener {
- friend class CommandGroup;
- friend class Scheduler;
-
- public:
- Command();
- explicit Command(const std::string& name);
- explicit Command(double timeout);
- Command(const std::string& name, double timeout);
- virtual ~Command();
- double TimeSinceInitialized() const;
- void Requires(Subsystem* s);
- bool IsCanceled() const;
- void Start();
- bool Run();
- void Cancel();
- bool IsRunning() const;
- bool IsInterruptible() const;
- void SetInterruptible(bool interruptible);
- bool DoesRequire(Subsystem* subsystem) const;
- typedef std::set<Subsystem*> SubsystemSet;
- SubsystemSet GetRequirements() const;
- CommandGroup* GetGroup() const;
- void SetRunWhenDisabled(bool run);
- bool WillRunWhenDisabled() const;
- int GetID() const;
-
- protected:
- void SetTimeout(double timeout);
- bool IsTimedOut() const;
- bool AssertUnlocked(const std::string& message);
- void SetParent(CommandGroup* parent);
- void ClearRequirements();
-
- virtual void Initialize();
- virtual void Execute();
-
- /**
- * Returns whether this command is finished.
- * If it is, then the command will be removed and {@link Command#end() end()}
- * will be called.
- *
- * <p>It may be useful for a team to reference the {@link Command#isTimedOut()
- * isTimedOut()} method for time-sensitive commands.</p>
- *
- * <p>Returning false will result in the command never ending automatically.
- * It may still be cancelled manually or interrupted by another command.
- * Returning true will result in the command executing once and finishing
- * immediately. We recommend using {@link InstantCommand} for this.</p>
- *
- * @return whether this command is finished.
- * @see Command#isTimedOut() isTimedOut()
- */
- virtual bool IsFinished() = 0;
-
- virtual void End();
- virtual void Interrupted();
-
- virtual void _Initialize();
- virtual void _Interrupted();
- virtual void _Execute();
- virtual void _End();
- virtual void _Cancel();
-
- friend class ConditionalCommand;
-
- private:
- void LockChanges();
- /*synchronized*/ void Removed();
- void StartRunning();
- void StartTiming();
-
- /** The name of this command */
- std::string m_name;
-
- /** The time since this command was initialized */
- double m_startTime = -1;
-
- /** The time (in seconds) before this command "times out" (or -1 if no
- * timeout) */
- double m_timeout;
-
- /** Whether or not this command has been initialized */
- bool m_initialized = false;
-
- /** The requirements (or null if no requirements) */
- SubsystemSet m_requirements;
-
- /** Whether or not it is running */
- bool m_running = false;
-
- /** Whether or not it is interruptible*/
- bool m_interruptible = true;
-
- /** Whether or not it has been canceled */
- bool m_canceled = false;
-
- /** Whether or not it has been locked */
- bool m_locked = false;
-
- /** Whether this command should run when the robot is disabled */
- bool m_runWhenDisabled = false;
-
- /** The {@link CommandGroup} this is in */
- CommandGroup* m_parent = nullptr;
-
- int m_commandID = m_commandCounter++;
- static int m_commandCounter;
-
- public:
- std::string GetName() const override;
- void InitTable(std::shared_ptr<ITable> subtable) override;
- std::shared_ptr<ITable> GetTable() const override;
- std::string GetSmartDashboardType() const override;
- void ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew) override;
-
- protected:
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/CommandGroup.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/CommandGroup.h
deleted file mode 100644
index a0315d5..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/CommandGroup.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <list>
-#include <string>
-#include <vector>
-
-#include "Commands/Command.h"
-#include "Commands/CommandGroupEntry.h"
-
-namespace frc {
-
-/**
- * A {@link CommandGroup} is a list of commands which are executed in sequence.
- *
- * <p>Commands in a {@link CommandGroup} are added using the {@link
- * CommandGroup#AddSequential(Command) AddSequential(...)} method and are
- * called sequentially. {@link CommandGroup CommandGroups} are themselves
- * {@link Command Commands} and can be given to other
- * {@link CommandGroup CommandGroups}.</p>
- *
- * <p>{@link CommandGroup CommandGroups} will carry all of the requirements of
- * their {@link Command subcommands}. Additional requirements can be specified
- * by calling {@link CommandGroup#Requires(Subsystem) Requires(...)} normally
- * in the constructor.</P>
- *
- * <p>CommandGroups can also execute commands in parallel, simply by adding them
- * using {@link CommandGroup#AddParallel(Command) AddParallel(...)}.</p>
- *
- * @see Command
- * @see Subsystem
- */
-class CommandGroup : public Command {
- public:
- CommandGroup() = default;
- explicit CommandGroup(const std::string& name);
- virtual ~CommandGroup() = default;
-
- void AddSequential(Command* command);
- void AddSequential(Command* command, double timeout);
- void AddParallel(Command* command);
- void AddParallel(Command* command, double timeout);
- bool IsInterruptible() const;
- int GetSize() const;
-
- protected:
- virtual void Initialize();
- virtual void Execute();
- virtual bool IsFinished();
- virtual void End();
- virtual void Interrupted();
- virtual void _Initialize();
- virtual void _Interrupted();
- virtual void _Execute();
- virtual void _End();
-
- private:
- void CancelConflicts(Command* command);
-
- /** The commands in this group (stored in entries) */
- std::vector<CommandGroupEntry> m_commands;
-
- /** The active children in this group (stored in entries) */
- std::list<CommandGroupEntry> m_children;
-
- /** The current command, -1 signifies that none have been run */
- int m_currentCommandIndex = -1;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/CommandGroupEntry.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/CommandGroupEntry.h
deleted file mode 100644
index b1f3e91..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/CommandGroupEntry.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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
-
-namespace frc {
-
-class Command;
-
-class CommandGroupEntry {
- public:
- typedef enum {
- kSequence_InSequence,
- kSequence_BranchPeer,
- kSequence_BranchChild
- } Sequence;
-
- CommandGroupEntry() = default;
- CommandGroupEntry(Command* command, Sequence state, double timeout = -1.0);
- bool IsTimedOut() const;
-
- double m_timeout = -1.0;
- Command* m_command = nullptr;
- Sequence m_state = kSequence_InSequence;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/ConditionalCommand.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/ConditionalCommand.h
deleted file mode 100644
index e7fcb3c..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/ConditionalCommand.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2017. 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 <string>
-
-#include "Commands/Command.h"
-#include "Commands/InstantCommand.h"
-
-namespace frc {
-
-/**
- * A {@link ConditionalCommand} is a {@link Command} that starts one of two
- * commands.
- *
- * <p>
- * A {@link ConditionalCommand} uses m_condition to determine whether it should
- * run m_onTrue or m_onFalse.
- * </p>
- *
- * <p>
- * A {@link ConditionalCommand} adds the proper {@link Command} to the {@link
- * Scheduler} during {@link ConditionalCommand#initialize()} and then {@link
- * ConditionalCommand#isFinished()} will return true once that {@link Command}
- * has finished executing.
- * </p>
- *
- * <p>
- * If no {@link Command} is specified for m_onFalse, the occurrence of that
- * condition will be a no-op.
- * </p>
- *
- * @see Command
- * @see Scheduler
- */
-class ConditionalCommand : public Command {
- public:
- explicit ConditionalCommand(Command* onTrue,
- Command* onFalse = new InstantCommand());
- ConditionalCommand(const std::string& name, Command* onTrue,
- Command* onFalse = new InstantCommand());
- virtual ~ConditionalCommand() = default;
-
- protected:
- /**
- * The Condition to test to determine which Command to run.
- *
- * @return true if m_onTrue should be run or false if m_onFalse should be run.
- */
- virtual bool Condition() = 0;
-
- void _Initialize() override;
- void _Cancel() override;
- bool IsFinished() override;
- void Interrupted() override;
-
- private:
- /**
- * The Command to execute if {@link ConditionalCommand#Condition()} returns
- * true
- */
- Command* m_onTrue;
-
- /**
- * The Command to execute if {@link ConditionalCommand#Condition()} returns
- * false
- */
- Command* m_onFalse;
-
- /**
- * Stores command chosen by condition
- */
- Command* m_chosenCommand = nullptr;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/InstantCommand.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/InstantCommand.h
deleted file mode 100644
index 1ac2bd0..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/InstantCommand.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <string>
-
-#include "Commands/Command.h"
-
-namespace frc {
-
-/**
- * This command will execute once, then finish immediately afterward.
- *
- * <p>Subclassing {@link InstantCommand} is shorthand for returning true from
- * {@link Command isFinished}.
- */
-class InstantCommand : public Command {
- public:
- explicit InstantCommand(const std::string& name);
- InstantCommand() = default;
- virtual ~InstantCommand() = default;
-
- protected:
- bool IsFinished() override;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/PIDCommand.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/PIDCommand.h
deleted file mode 100644
index 4cc426e..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/PIDCommand.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <memory>
-#include <string>
-
-#include "Commands/Command.h"
-#include "PIDController.h"
-#include "PIDOutput.h"
-#include "PIDSource.h"
-
-namespace frc {
-
-class PIDCommand : public Command, public PIDOutput, public PIDSource {
- public:
- PIDCommand(const std::string& name, double p, double i, double d);
- PIDCommand(const std::string& name, double p, double i, double d,
- double period);
- PIDCommand(const std::string& name, double p, double i, double d, double f,
- double period);
- PIDCommand(double p, double i, double d);
- PIDCommand(double p, double i, double d, double period);
- PIDCommand(double p, double i, double d, double f, double period);
- virtual ~PIDCommand() = default;
-
- void SetSetpointRelative(double deltaSetpoint);
-
- // PIDOutput interface
- virtual void PIDWrite(double output);
-
- // PIDSource interface
- virtual double PIDGet();
-
- protected:
- std::shared_ptr<PIDController> GetPIDController() const;
- virtual void _Initialize();
- virtual void _Interrupted();
- virtual void _End();
- void SetSetpoint(double setpoint);
- double GetSetpoint() const;
- double GetPosition();
-
- virtual double ReturnPIDInput() = 0;
- virtual void UsePIDOutput(double output) = 0;
-
- private:
- /** The internal {@link PIDController} */
- std::shared_ptr<PIDController> m_controller;
-
- public:
- void InitTable(std::shared_ptr<ITable> subtable) override;
- std::string GetSmartDashboardType() const override;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/PIDSubsystem.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/PIDSubsystem.h
deleted file mode 100644
index d73aef6..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/PIDSubsystem.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <memory>
-#include <string>
-
-#include "Commands/Subsystem.h"
-#include "PIDController.h"
-#include "PIDOutput.h"
-#include "PIDSource.h"
-
-namespace frc {
-
-/**
- * This class is designed to handle the case where there is a {@link Subsystem}
- * which uses a single {@link PIDController} almost constantly (for instance,
- * an elevator which attempts to stay at a constant height).
- *
- * <p>It provides some convenience methods to run an internal {@link
- * PIDController}. It also allows access to the internal {@link PIDController}
- * in order to give total control to the programmer.</p>
- *
- */
-class PIDSubsystem : public Subsystem, public PIDOutput, public PIDSource {
- public:
- PIDSubsystem(const std::string& name, double p, double i, double d);
- PIDSubsystem(const std::string& name, double p, double i, double d, double f);
- PIDSubsystem(const std::string& name, double p, double i, double d, double f,
- double period);
- PIDSubsystem(double p, double i, double d);
- PIDSubsystem(double p, double i, double d, double f);
- PIDSubsystem(double p, double i, double d, double f, double period);
- virtual ~PIDSubsystem() = default;
-
- void Enable();
- void Disable();
-
- // PIDOutput interface
- virtual void PIDWrite(double output);
-
- // PIDSource interface
- virtual double PIDGet();
- void SetSetpoint(double setpoint);
- void SetSetpointRelative(double deltaSetpoint);
- void SetInputRange(double minimumInput, double maximumInput);
- void SetOutputRange(double minimumOutput, double maximumOutput);
- double GetSetpoint();
- double GetPosition();
- double GetRate();
-
- virtual void SetAbsoluteTolerance(double absValue);
- virtual void SetPercentTolerance(double percent);
- virtual bool OnTarget() const;
-
- protected:
- std::shared_ptr<PIDController> GetPIDController();
-
- virtual double ReturnPIDInput() = 0;
- virtual void UsePIDOutput(double output) = 0;
-
- private:
- /** The internal {@link PIDController} */
- std::shared_ptr<PIDController> m_controller;
-
- public:
- void InitTable(std::shared_ptr<ITable> subtable) override;
- std::string GetSmartDashboardType() const override;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/PrintCommand.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/PrintCommand.h
deleted file mode 100644
index ee8396b..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/PrintCommand.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <string>
-
-#include "Commands/InstantCommand.h"
-
-namespace frc {
-
-class PrintCommand : public InstantCommand {
- public:
- explicit PrintCommand(const std::string& message);
- virtual ~PrintCommand() = default;
-
- protected:
- virtual void Initialize();
-
- private:
- std::string m_message;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/Scheduler.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/Scheduler.h
deleted file mode 100644
index eb749aa..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/Scheduler.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <list>
-#include <map>
-#include <memory>
-#include <set>
-#include <string>
-#include <vector>
-
-#include "Commands/Command.h"
-#include "ErrorBase.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "SmartDashboard/NamedSendable.h"
-#include "SmartDashboard/SmartDashboard.h"
-#include "networktables/NetworkTable.h"
-
-namespace frc {
-
-class ButtonScheduler;
-class Subsystem;
-
-class Scheduler : public ErrorBase, public NamedSendable {
- public:
- static Scheduler* GetInstance();
-
- void AddCommand(Command* command);
- void AddButton(ButtonScheduler* button);
- void RegisterSubsystem(Subsystem* subsystem);
- void Run();
- void Remove(Command* command);
- void RemoveAll();
- void ResetAll();
- void SetEnabled(bool enabled);
-
- void UpdateTable();
- std::string GetSmartDashboardType() const;
- void InitTable(std::shared_ptr<ITable> subTable);
- std::shared_ptr<ITable> GetTable() const;
- std::string GetName() const;
- std::string GetType() const;
-
- private:
- Scheduler();
- virtual ~Scheduler() = default;
-
- void ProcessCommandAddition(Command* command);
-
- Command::SubsystemSet m_subsystems;
- priority_mutex m_buttonsLock;
- typedef std::vector<ButtonScheduler*> ButtonVector;
- ButtonVector m_buttons;
- typedef std::vector<Command*> CommandVector;
- priority_mutex m_additionsLock;
- CommandVector m_additions;
- typedef std::set<Command*> CommandSet;
- CommandSet m_commands;
- bool m_adding = false;
- bool m_enabled = true;
- std::vector<std::string> commands;
- std::vector<double> ids;
- std::vector<double> toCancel;
- std::shared_ptr<ITable> m_table;
- bool m_runningCommandsChanged = false;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/StartCommand.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/StartCommand.h
deleted file mode 100644
index 9ac4d21..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/StartCommand.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 "Commands/InstantCommand.h"
-
-namespace frc {
-
-class StartCommand : public InstantCommand {
- public:
- explicit StartCommand(Command* commandToStart);
- virtual ~StartCommand() = default;
-
- protected:
- virtual void Initialize();
-
- private:
- Command* m_commandToFork;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/Subsystem.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/Subsystem.h
deleted file mode 100644
index 3121098..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/Subsystem.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <memory>
-#include <string>
-
-#include "ErrorBase.h"
-#include "SmartDashboard/NamedSendable.h"
-
-namespace frc {
-
-class Command;
-
-class Subsystem : public ErrorBase, public NamedSendable {
- friend class Scheduler;
-
- public:
- explicit Subsystem(const std::string& name);
- virtual ~Subsystem() = default;
-
- void SetDefaultCommand(Command* command);
- Command* GetDefaultCommand();
- void SetCurrentCommand(Command* command);
- Command* GetCurrentCommand() const;
- virtual void InitDefaultCommand();
-
- private:
- void ConfirmCommand();
-
- Command* m_currentCommand = nullptr;
- bool m_currentCommandChanged = true;
- Command* m_defaultCommand = nullptr;
- std::string m_name;
- bool m_initializedDefaultCommand = false;
-
- public:
- std::string GetName() const override;
- void InitTable(std::shared_ptr<ITable> subtable) override;
- std::shared_ptr<ITable> GetTable() const override;
- std::string GetSmartDashboardType() const override;
-
- protected:
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/TimedCommand.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/TimedCommand.h
deleted file mode 100644
index 3331aa3..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/TimedCommand.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <string>
-
-#include "Commands/Command.h"
-
-namespace frc {
-
-/**
- * A {@link TimedCommand} will wait for a timeout before finishing.
- * {@link TimedCommand} is used to execute a command for a given amount of time.
- */
-class TimedCommand : public Command {
- public:
- TimedCommand(const std::string& name, double timeout);
- explicit TimedCommand(double timeout);
- virtual ~TimedCommand() = default;
-
- protected:
- bool IsFinished() override;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/WaitCommand.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/WaitCommand.h
deleted file mode 100644
index e1be8aa..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/WaitCommand.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <string>
-
-#include "Commands/TimedCommand.h"
-
-namespace frc {
-
-class WaitCommand : public TimedCommand {
- public:
- explicit WaitCommand(double timeout);
- WaitCommand(const std::string& name, double timeout);
- virtual ~WaitCommand() = default;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/WaitForChildren.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/WaitForChildren.h
deleted file mode 100644
index 3537805..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/WaitForChildren.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <string>
-
-#include "Commands/Command.h"
-
-namespace frc {
-
-class WaitForChildren : public Command {
- public:
- explicit WaitForChildren(double timeout);
- WaitForChildren(const std::string& name, double timeout);
- virtual ~WaitForChildren() = default;
-
- protected:
- virtual bool IsFinished();
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/WaitUntilCommand.h b/third_party/allwpilib_2017/wpilibc/shared/include/Commands/WaitUntilCommand.h
deleted file mode 100644
index 190522d..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Commands/WaitUntilCommand.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <string>
-
-#include "Commands/Command.h"
-
-namespace frc {
-
-class WaitUntilCommand : public Command {
- public:
- explicit WaitUntilCommand(double time);
- WaitUntilCommand(const std::string& name, double time);
- virtual ~WaitUntilCommand() = default;
-
- protected:
- virtual bool IsFinished();
-
- private:
- double m_time;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Controller.h b/third_party/allwpilib_2017/wpilibc/shared/include/Controller.h
deleted file mode 100644
index 68c2712..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Controller.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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
-
-namespace frc {
-
-/**
- * Interface for Controllers.
- * Common interface for controllers. Controllers run control loops, the most
- * common are PID controllers and their variants, but this includes anything
- * that is controlling an actuator in a separate thread.
- */
-class Controller {
- public:
- virtual ~Controller() = default;
-
- /**
- * Allows the control loop to run
- */
- virtual void Enable() = 0;
-
- /**
- * Stops the control loop from running until explicitly re-enabled by calling
- * enable()
- */
- virtual void Disable() = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Error.h b/third_party/allwpilib_2017/wpilibc/shared/include/Error.h
deleted file mode 100644
index 435c644..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Error.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <stdint.h>
-
-#include <string>
-
-#include "Base.h"
-#include "llvm/StringRef.h"
-
-#ifdef _WIN32
-#include <Windows.h>
-// Windows.h defines #define GetMessage GetMessageW, which we don't want.
-#undef GetMessage
-#endif
-
-namespace frc {
-
-// Forward declarations
-class ErrorBase;
-
-/**
- * Error object represents a library error.
- */
-class Error {
- public:
- typedef int Code;
-
- Error() = default;
-
- Error(const Error&) = delete;
- Error& operator=(const Error&) = delete;
-
- void Clone(const Error& error);
- Code GetCode() const;
- std::string GetMessage() const;
- std::string GetFilename() const;
- std::string GetFunction() const;
- int GetLineNumber() const;
- const ErrorBase* GetOriginatingObject() const;
- double GetTimestamp() const;
- void Clear();
- void Set(Code code, llvm::StringRef contextMessage, llvm::StringRef filename,
- llvm::StringRef function, int lineNumber,
- const ErrorBase* originatingObject);
-
- private:
- void Report();
-
- Code m_code = 0;
- std::string m_message;
- std::string m_filename;
- std::string m_function;
- int m_lineNumber = 0;
- const ErrorBase* m_originatingObject = nullptr;
- double m_timestamp = 0.0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/ErrorBase.h b/third_party/allwpilib_2017/wpilibc/shared/include/ErrorBase.h
deleted file mode 100644
index 652e8ea..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/ErrorBase.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "Base.h"
-#include "Error.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "llvm/StringRef.h"
-
-#define wpi_setErrnoErrorWithContext(context) \
- this->SetErrnoError((context), __FILE__, __FUNCTION__, __LINE__)
-#define wpi_setErrnoError() wpi_setErrnoErrorWithContext("")
-#define wpi_setImaqErrorWithContext(code, context) \
- do { \
- if ((code) != 0) \
- this->SetImaqError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
- } while (0)
-#define wpi_setErrorWithContext(code, context) \
- do { \
- if ((code) != 0) \
- this->SetError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
- } while (0)
-#define wpi_setErrorWithContextRange(code, min, max, req, context) \
- do { \
- if ((code) != 0) \
- this->SetErrorRange((code), (min), (max), (req), (context), __FILE__, \
- __FUNCTION__, __LINE__); \
- } while (0)
-#define wpi_setError(code) wpi_setErrorWithContext(code, "")
-#define wpi_setStaticErrorWithContext(object, code, context) \
- do { \
- if ((code) != 0) \
- object->SetError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
- } while (0)
-#define wpi_setStaticError(object, code) \
- wpi_setStaticErrorWithContext(object, code, "")
-#define wpi_setGlobalErrorWithContext(code, context) \
- do { \
- if ((code) != 0) \
- ::frc::ErrorBase::SetGlobalError((code), (context), __FILE__, \
- __FUNCTION__, __LINE__); \
- } while (0)
-#define wpi_setGlobalError(code) wpi_setGlobalErrorWithContext(code, "")
-#define wpi_setWPIErrorWithContext(error, context) \
- this->SetWPIError((wpi_error_s_##error), (wpi_error_value_##error), \
- (context), __FILE__, __FUNCTION__, __LINE__)
-#define wpi_setWPIError(error) (wpi_setWPIErrorWithContext(error, ""))
-#define wpi_setStaticWPIErrorWithContext(object, error, context) \
- object->SetWPIError((wpi_error_s_##error), (context), __FILE__, \
- __FUNCTION__, __LINE__)
-#define wpi_setStaticWPIError(object, error) \
- wpi_setStaticWPIErrorWithContext(object, error, "")
-#define wpi_setGlobalWPIErrorWithContext(error, context) \
- ::frc::ErrorBase::SetGlobalWPIError((wpi_error_s_##error), (context), \
- __FILE__, __FUNCTION__, __LINE__)
-#define wpi_setGlobalWPIError(error) wpi_setGlobalWPIErrorWithContext(error, "")
-
-namespace frc {
-
-/**
- * Base class for most objects.
- * ErrorBase is the base class for most objects since it holds the generated
- * error
- * for that object. In addition, there is a single instance of a global error
- * object
- */
-class ErrorBase {
- // TODO: Consider initializing instance variables and cleanup in destructor
- public:
- ErrorBase() = default;
- virtual ~ErrorBase() = default;
-
- ErrorBase(const ErrorBase&) = delete;
- ErrorBase& operator=(const ErrorBase&) = delete;
-
- virtual Error& GetError();
- virtual const Error& GetError() const;
- virtual void SetErrnoError(llvm::StringRef contextMessage,
- llvm::StringRef filename, llvm::StringRef function,
- int lineNumber) const;
- virtual void SetImaqError(int success, llvm::StringRef contextMessage,
- llvm::StringRef filename, llvm::StringRef function,
- int lineNumber) const;
- virtual void SetError(Error::Code code, llvm::StringRef contextMessage,
- llvm::StringRef filename, llvm::StringRef function,
- int lineNumber) const;
- virtual void SetErrorRange(Error::Code code, int32_t minRange,
- int32_t maxRange, int32_t requestedValue,
- llvm::StringRef contextMessage,
- llvm::StringRef filename, llvm::StringRef function,
- int lineNumber) const;
- virtual void SetWPIError(llvm::StringRef errorMessage, Error::Code code,
- llvm::StringRef contextMessage,
- llvm::StringRef filename, llvm::StringRef function,
- int lineNumber) const;
- virtual void CloneError(const ErrorBase& rhs) const;
- virtual void ClearError() const;
- virtual bool StatusIsFatal() const;
- static void SetGlobalError(Error::Code code, llvm::StringRef contextMessage,
- llvm::StringRef filename, llvm::StringRef function,
- int lineNumber);
- static void SetGlobalWPIError(llvm::StringRef errorMessage,
- llvm::StringRef contextMessage,
- llvm::StringRef filename,
- llvm::StringRef function, int lineNumber);
- static Error& GetGlobalError();
-
- protected:
- mutable Error m_error;
- // TODO: Replace globalError with a global list of all errors.
- static priority_mutex _globalErrorMutex;
- static Error _globalError;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Filters/Filter.h b/third_party/allwpilib_2017/wpilibc/shared/include/Filters/Filter.h
deleted file mode 100644
index eabc1c7..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Filters/Filter.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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 <memory>
-
-#include "PIDSource.h"
-
-namespace frc {
-
-/**
- * Interface for filters
- */
-class Filter : public PIDSource {
- public:
- explicit Filter(std::shared_ptr<PIDSource> source);
- virtual ~Filter() = default;
-
- // PIDSource interface
- void SetPIDSourceType(PIDSourceType pidSource) override;
- PIDSourceType GetPIDSourceType() const;
- double PIDGet() override = 0;
-
- /**
- * Returns the current filter estimate without also inserting new data as
- * PIDGet() would do.
- *
- * @return The current filter estimate
- */
- virtual double Get() const = 0;
-
- /**
- * Reset the filter state
- */
- virtual void Reset() = 0;
-
- protected:
- /**
- * Calls PIDGet() of source
- *
- * @return Current value of source
- */
- double PIDGetSource();
-
- private:
- std::shared_ptr<PIDSource> m_source;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Filters/LinearDigitalFilter.h b/third_party/allwpilib_2017/wpilibc/shared/include/Filters/LinearDigitalFilter.h
deleted file mode 100644
index a9fabc4..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Filters/LinearDigitalFilter.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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 <initializer_list>
-#include <memory>
-#include <vector>
-
-#include "CircularBuffer.h"
-#include "Filter.h"
-
-namespace frc {
-
-/**
- * This class implements a linear, digital filter. All types of FIR and IIR
- * filters are supported. Static factory methods are provided to create commonly
- * used types of filters.
- *
- * Filters are of the form:<br>
- * y[n] = (b0 * x[n] + b1 * x[n-1] + … + bP * x[n-P]) -
- * (a0 * y[n-1] + a2 * y[n-2] + … + aQ * y[n-Q])
- *
- * Where:<br>
- * y[n] is the output at time "n"<br>
- * x[n] is the input at time "n"<br>
- * y[n-1] is the output from the LAST time step ("n-1")<br>
- * x[n-1] is the input from the LAST time step ("n-1")<br>
- * b0 … bP are the "feedforward" (FIR) gains<br>
- * a0 … aQ are the "feedback" (IIR) gains<br>
- * IMPORTANT! Note the "-" sign in front of the feedback term! This is a common
- * convention in signal processing.
- *
- * What can linear filters do? Basically, they can filter, or diminish, the
- * effects of undesirable input frequencies. High frequencies, or rapid changes,
- * can be indicative of sensor noise or be otherwise undesirable. A "low pass"
- * filter smooths out the signal, reducing the impact of these high frequency
- * components. Likewise, a "high pass" filter gets rid of slow-moving signal
- * components, letting you detect large changes more easily.
- *
- * Example FRC applications of filters:
- * - Getting rid of noise from an analog sensor input (note: the roboRIO's FPGA
- * can do this faster in hardware)
- * - Smoothing out joystick input to prevent the wheels from slipping or the
- * robot from tipping
- * - Smoothing motor commands so that unnecessary strain isn't put on
- * electrical or mechanical components
- * - If you use clever gains, you can make a PID controller out of this class!
- *
- * For more on filters, I highly recommend the following articles:<br>
- * http://en.wikipedia.org/wiki/Linear_filter<br>
- * http://en.wikipedia.org/wiki/Iir_filter<br>
- * http://en.wikipedia.org/wiki/Fir_filter<br>
- *
- * Note 1: PIDGet() should be called by the user on a known, regular period.
- * You can set up a Notifier to do this (look at the WPILib PIDController
- * class), or do it "inline" with code in a periodic function.
- *
- * Note 2: For ALL filters, gains are necessarily a function of frequency. If
- * you make a filter that works well for you at, say, 100Hz, you will most
- * definitely need to adjust the gains if you then want to run it at 200Hz!
- * Combining this with Note 1 - the impetus is on YOU as a developer to make
- * sure PIDGet() gets called at the desired, constant frequency!
- */
-class LinearDigitalFilter : public Filter {
- public:
- LinearDigitalFilter(std::shared_ptr<PIDSource> source,
- std::initializer_list<double> ffGains,
- std::initializer_list<double> fbGains);
- LinearDigitalFilter(std::shared_ptr<PIDSource> source,
- std::initializer_list<double> ffGains,
- const std::vector<double>& fbGains);
- LinearDigitalFilter(std::shared_ptr<PIDSource> source,
- const std::vector<double>& ffGains,
- std::initializer_list<double> fbGains);
- LinearDigitalFilter(std::shared_ptr<PIDSource> source,
- const std::vector<double>& ffGains,
- const std::vector<double>& fbGains);
-
- // Static methods to create commonly used filters
- static LinearDigitalFilter SinglePoleIIR(std::shared_ptr<PIDSource> source,
- double timeConstant, double period);
- static LinearDigitalFilter HighPass(std::shared_ptr<PIDSource> source,
- double timeConstant, double period);
- static LinearDigitalFilter MovingAverage(std::shared_ptr<PIDSource> source,
- int taps);
-
- // Filter interface
- double Get() const override;
- void Reset() override;
-
- // PIDSource interface
- double PIDGet() override;
-
- private:
- CircularBuffer<double> m_inputs;
- CircularBuffer<double> m_outputs;
- std::vector<double> m_inputGains;
- std::vector<double> m_outputGains;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/GamepadBase.h b/third_party/allwpilib_2017/wpilibc/shared/include/GamepadBase.h
deleted file mode 100644
index b073c2c..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/GamepadBase.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 "GenericHID.h"
-
-namespace frc {
-
-/**
- * Gamepad Interface.
- */
-class GamepadBase : public GenericHID {
- public:
- explicit GamepadBase(int port);
- virtual ~GamepadBase() = default;
-
- virtual bool GetBumper(JoystickHand hand = kRightHand) const = 0;
- virtual bool GetStickButton(JoystickHand hand) const = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/GenericHID.h b/third_party/allwpilib_2017/wpilibc/shared/include/GenericHID.h
deleted file mode 100644
index 657abe6..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/GenericHID.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <stdint.h>
-
-#include <string>
-
-namespace frc {
-
-class DriverStation;
-
-/**
- * GenericHID Interface.
- */
-class GenericHID {
- public:
- typedef enum { kLeftRumble, kRightRumble } RumbleType;
-
- typedef enum {
- kUnknown = -1,
- kXInputUnknown = 0,
- kXInputGamepad = 1,
- kXInputWheel = 2,
- kXInputArcadeStick = 3,
- kXInputFlightStick = 4,
- kXInputDancePad = 5,
- kXInputGuitar = 6,
- kXInputGuitar2 = 7,
- kXInputDrumKit = 8,
- kXInputGuitar3 = 11,
- kXInputArcadePad = 19,
- kHIDJoystick = 20,
- kHIDGamepad = 21,
- kHIDDriving = 22,
- kHIDFlight = 23,
- kHID1stPerson = 24
- } HIDType;
-
- enum JoystickHand { kLeftHand = 0, kRightHand = 1 };
-
- explicit GenericHID(int port);
- virtual ~GenericHID() = default;
-
- virtual double GetX(JoystickHand hand = kRightHand) const = 0;
- virtual double GetY(JoystickHand hand = kRightHand) const = 0;
- virtual double GetRawAxis(int axis) const;
-
- bool GetRawButton(int button) const;
-
- int GetPOV(int pov = 0) const;
- int GetPOVCount() const;
-
- int GetPort() const;
- GenericHID::HIDType GetType() const;
- std::string GetName() const;
-
- void SetOutput(int outputNumber, bool value);
- void SetOutputs(int value);
- void SetRumble(RumbleType type, double value);
-
- private:
- DriverStation& m_ds;
- int m_port;
- int m_outputs = 0;
- uint16_t m_leftRumble = 0;
- uint16_t m_rightRumble = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/GyroBase.h b/third_party/allwpilib_2017/wpilibc/shared/include/GyroBase.h
deleted file mode 100644
index 3d55241..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/GyroBase.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "PIDSource.h"
-#include "SensorBase.h"
-#include "interfaces/Gyro.h"
-
-namespace frc {
-
-/**
- * GyroBase is the common base class for Gyro implementations such as
- * AnalogGyro.
- */
-class GyroBase : public Gyro,
- public SensorBase,
- public PIDSource {
- public:
- virtual ~GyroBase() = default;
-
- // PIDSource interface
- double PIDGet() override;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/HLUsageReporting.h b/third_party/allwpilib_2017/wpilibc/shared/include/HLUsageReporting.h
deleted file mode 100644
index 3d3c47b..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/HLUsageReporting.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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
-
-namespace frc {
-
-class HLUsageReportingInterface {
- public:
- virtual ~HLUsageReportingInterface() = default;
- virtual void ReportScheduler() = 0;
- virtual void ReportSmartDashboard() = 0;
-};
-
-class HLUsageReporting {
- private:
- static HLUsageReportingInterface* impl;
-
- public:
- static void SetImplementation(HLUsageReportingInterface* i);
- static void ReportScheduler();
- static void ReportSmartDashboard();
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Joystick.h b/third_party/allwpilib_2017/wpilibc/shared/include/Joystick.h
deleted file mode 100644
index e4ee16f..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Joystick.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <stdint.h>
-
-#include <memory>
-#include <vector>
-
-#include "ErrorBase.h"
-#include "JoystickBase.h"
-
-namespace frc {
-
-class DriverStation;
-
-/**
- * Handle input from standard Joysticks connected to the Driver Station.
- * This class handles standard input that comes from the Driver Station. Each
- * time a value is requested the most recent value is returned. There is a
- * single class instance for each joystick and the mapping of ports to hardware
- * buttons depends on the code in the Driver Station.
- */
-class Joystick : public JoystickBase, public ErrorBase {
- public:
- static const int kDefaultXAxis = 0;
- static const int kDefaultYAxis = 1;
- static const int kDefaultZAxis = 2;
- static const int kDefaultTwistAxis = 2;
- static const int kDefaultThrottleAxis = 3;
-
- typedef enum {
- kXAxis,
- kYAxis,
- kZAxis,
- kTwistAxis,
- kThrottleAxis,
- kNumAxisTypes
- } AxisType;
-
- static const int kDefaultTriggerButton = 1;
- static const int kDefaultTopButton = 2;
-
- typedef enum { kTriggerButton, kTopButton, kNumButtonTypes } ButtonType;
-
- explicit Joystick(int port);
- Joystick(int port, int numAxisTypes, int numButtonTypes);
- virtual ~Joystick() = default;
-
- Joystick(const Joystick&) = delete;
- Joystick& operator=(const Joystick&) = delete;
-
- int GetAxisChannel(AxisType axis) const;
- void SetAxisChannel(AxisType axis, int channel);
-
- double GetX(JoystickHand hand = kRightHand) const override;
- double GetY(JoystickHand hand = kRightHand) const override;
- double GetZ(JoystickHand hand = kRightHand) const override;
- double GetTwist() const override;
- double GetThrottle() const override;
- virtual double GetAxis(AxisType axis) const;
-
- bool GetTrigger(JoystickHand hand = kRightHand) const override;
- bool GetTop(JoystickHand hand = kRightHand) const override;
- bool GetButton(ButtonType button) const;
- static Joystick* GetStickForPort(int port);
-
- virtual double GetMagnitude() const;
- virtual double GetDirectionRadians() const;
- virtual double GetDirectionDegrees() const;
-
- int GetAxisType(int axis) const;
-
- int GetAxisCount() const;
- int GetButtonCount() const;
-
- private:
- DriverStation& m_ds;
- std::vector<int> m_axes;
- std::vector<int> m_buttons;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/JoystickBase.h b/third_party/allwpilib_2017/wpilibc/shared/include/JoystickBase.h
deleted file mode 100644
index 262c3e2..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/JoystickBase.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 "GenericHID.h"
-
-namespace frc {
-
-/**
- * Joystick Interface.
- */
-class JoystickBase : public GenericHID {
- public:
- explicit JoystickBase(int port);
- virtual ~JoystickBase() = default;
-
- virtual double GetZ(JoystickHand hand = kRightHand) const = 0;
- virtual double GetTwist() const = 0;
- virtual double GetThrottle() const = 0;
-
- virtual bool GetTrigger(JoystickHand hand = kRightHand) const = 0;
- virtual bool GetTop(JoystickHand hand = kRightHand) const = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/LiveWindow/LiveWindow.h b/third_party/allwpilib_2017/wpilibc/shared/include/LiveWindow/LiveWindow.h
deleted file mode 100644
index c2be96a..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/LiveWindow/LiveWindow.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2012-2017. 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 <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "Commands/Scheduler.h"
-#include "LiveWindow/LiveWindowSendable.h"
-#include "tables/ITable.h"
-
-namespace frc {
-
-struct LiveWindowComponent {
- std::string subsystem;
- std::string name;
- bool isSensor = false;
-
- LiveWindowComponent() = default;
- LiveWindowComponent(std::string subsystem, std::string name, bool isSensor) {
- this->subsystem = subsystem;
- this->name = name;
- this->isSensor = isSensor;
- }
-};
-
-/**
- * The LiveWindow class is the public interface for putting sensors and
- * actuators
- * on the LiveWindow.
- */
-class LiveWindow {
- public:
- static LiveWindow* GetInstance();
- void Run();
- void AddSensor(const std::string& subsystem, const std::string& name,
- LiveWindowSendable* component);
- void AddSensor(const std::string& subsystem, const std::string& name,
- LiveWindowSendable& component);
- void AddSensor(const std::string& subsystem, const std::string& name,
- std::shared_ptr<LiveWindowSendable> component);
- void AddActuator(const std::string& subsystem, const std::string& name,
- LiveWindowSendable* component);
- void AddActuator(const std::string& subsystem, const std::string& name,
- LiveWindowSendable& component);
- void AddActuator(const std::string& subsystem, const std::string& name,
- std::shared_ptr<LiveWindowSendable> component);
-
- void AddSensor(std::string type, int channel, LiveWindowSendable* component);
- void AddActuator(std::string type, int channel,
- LiveWindowSendable* component);
- void AddActuator(std::string type, int module, int channel,
- LiveWindowSendable* component);
-
- bool IsEnabled() const { return m_enabled; }
- void SetEnabled(bool enabled);
-
- protected:
- LiveWindow();
- virtual ~LiveWindow() = default;
-
- private:
- void UpdateValues();
- void Initialize();
- void InitializeLiveWindowComponents();
-
- std::vector<std::shared_ptr<LiveWindowSendable>> m_sensors;
- std::map<std::shared_ptr<LiveWindowSendable>, LiveWindowComponent>
- m_components;
-
- std::shared_ptr<ITable> m_liveWindowTable;
- std::shared_ptr<ITable> m_statusTable;
-
- Scheduler* m_scheduler;
-
- bool m_enabled = false;
- bool m_firstTime = true;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/LiveWindow/LiveWindowSendable.h b/third_party/allwpilib_2017/wpilibc/shared/include/LiveWindow/LiveWindowSendable.h
deleted file mode 100644
index 08b330d..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/LiveWindow/LiveWindowSendable.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2012-2017. 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 "SmartDashboard/Sendable.h"
-
-namespace frc {
-
-/**
- * Live Window Sendable is a special type of object sendable to the live window.
- */
-class LiveWindowSendable : public Sendable {
- public:
- /**
- * Update the table for this sendable object with the latest
- * values.
- */
- virtual void UpdateTable() = 0;
-
- /**
- * Start having this sendable object automatically respond to
- * value changes reflect the value on the table.
- */
- virtual void StartLiveWindowMode() = 0;
-
- /**
- * Stop having this sendable object automatically respond to value
- * changes.
- */
- virtual void StopLiveWindowMode() = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/LiveWindow/LiveWindowStatusListener.h b/third_party/allwpilib_2017/wpilibc/shared/include/LiveWindow/LiveWindowStatusListener.h
deleted file mode 100644
index ec6fc2f..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/LiveWindow/LiveWindowStatusListener.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2012-2017. 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 <memory>
-
-#include "tables/ITable.h"
-#include "tables/ITableListener.h"
-
-namespace frc {
-
-class LiveWindowStatusListener : public ITableListener {
- public:
- virtual void ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew);
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/PIDController.h b/third_party/allwpilib_2017/wpilibc/shared/include/PIDController.h
deleted file mode 100644
index a304f9c..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/PIDController.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <queue>
-#include <string>
-
-#include "Base.h"
-#include "Controller.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "LiveWindow/LiveWindow.h"
-#include "Notifier.h"
-#include "PIDInterface.h"
-#include "PIDSource.h"
-#include "Timer.h"
-
-namespace frc {
-
-class PIDOutput;
-
-/**
- * Class implements a PID Control Loop.
- *
- * Creates a separate thread which reads the given PIDSource and takes
- * care of the integral calculations, as well as writing the given PIDOutput.
- *
- * This feedback controller runs in discrete time, so time deltas are not used
- * in the integral and derivative calculations. Therefore, the sample rate
- * affects the controller's behavior for a given set of PID constants.
- */
-class PIDController : public LiveWindowSendable,
- public PIDInterface,
- public ITableListener {
- public:
- PIDController(double p, double i, double d, PIDSource* source,
- PIDOutput* output, double period = 0.05);
- PIDController(double p, double i, double d, double f, PIDSource* source,
- PIDOutput* output, double period = 0.05);
- virtual ~PIDController();
-
- PIDController(const PIDController&) = delete;
- PIDController& operator=(const PIDController) = delete;
-
- virtual double Get() const;
- virtual void SetContinuous(bool continuous = true);
- virtual void SetInputRange(double minimumInput, double maximumInput);
- virtual void SetOutputRange(double minimumOutput, double maximumOutput);
- void SetPID(double p, double i, double d) override;
- virtual void SetPID(double p, double i, double d, double f);
- double GetP() const override;
- double GetI() const override;
- double GetD() const override;
- virtual double GetF() const;
-
- void SetSetpoint(double setpoint) override;
- double GetSetpoint() const override;
- double GetDeltaSetpoint() const;
-
- virtual double GetError() const;
- virtual double GetAvgError() const;
-
- virtual void SetPIDSourceType(PIDSourceType pidSource);
- virtual PIDSourceType GetPIDSourceType() const;
-
- virtual void SetTolerance(double percent);
- virtual void SetAbsoluteTolerance(double absValue);
- virtual void SetPercentTolerance(double percentValue);
- virtual void SetToleranceBuffer(int buf = 1);
- virtual bool OnTarget() const;
-
- void Enable() override;
- void Disable() override;
- bool IsEnabled() const override;
-
- void Reset() override;
-
- void InitTable(std::shared_ptr<ITable> subtable) override;
-
- protected:
- PIDSource* m_pidInput;
- PIDOutput* m_pidOutput;
-
- std::shared_ptr<ITable> m_table;
- virtual void Calculate();
- virtual double CalculateFeedForward();
- double GetContinuousError(double error) const;
-
- private:
- // factor for "proportional" control
- double m_P;
- // factor for "integral" control
- double m_I;
- // factor for "derivative" control
- double m_D;
- // factor for "feed forward" control
- double m_F;
- // |maximum output|
- double m_maximumOutput = 1.0;
- // |minimum output|
- double m_minimumOutput = -1.0;
- // maximum input - limit setpoint to this
- double m_maximumInput = 0;
- // minimum input - limit setpoint to this
- double m_minimumInput = 0;
- // do the endpoints wrap around? eg. Absolute encoder
- bool m_continuous = false;
- // is the pid controller enabled
- bool m_enabled = false;
- // the prior error (used to compute velocity)
- double m_prevError = 0;
- // the sum of the errors for use in the integral calc
- double m_totalError = 0;
- enum {
- kAbsoluteTolerance,
- kPercentTolerance,
- kNoTolerance
- } m_toleranceType = kNoTolerance;
-
- // the percetage or absolute error that is considered on target.
- double m_tolerance = 0.05;
- double m_setpoint = 0;
- double m_prevSetpoint = 0;
- double m_error = 0;
- double m_result = 0;
- double m_period;
-
- // Length of buffer for averaging for tolerances.
- std::atomic<unsigned> m_bufLength{1};
- std::queue<double> m_buf;
- double m_bufTotal = 0;
-
- mutable priority_recursive_mutex m_mutex;
-
- std::unique_ptr<Notifier> m_controlLoop;
- Timer m_setpointTimer;
-
- std::shared_ptr<ITable> GetTable() const override;
- std::string GetSmartDashboardType() const override;
- void ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew) override;
- void UpdateTable() override;
- void StartLiveWindowMode() override;
- void StopLiveWindowMode() override;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/PIDInterface.h b/third_party/allwpilib_2017/wpilibc/shared/include/PIDInterface.h
deleted file mode 100644
index 608b8d8..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/PIDInterface.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 "Base.h"
-#include "Controller.h"
-#include "LiveWindow/LiveWindow.h"
-
-namespace frc {
-
-class PIDInterface : public Controller {
- virtual void SetPID(double p, double i, double d) = 0;
- virtual double GetP() const = 0;
- virtual double GetI() const = 0;
- virtual double GetD() const = 0;
-
- virtual void SetSetpoint(double setpoint) = 0;
- virtual double GetSetpoint() const = 0;
-
- virtual void Enable() = 0;
- virtual void Disable() = 0;
- virtual bool IsEnabled() const = 0;
-
- virtual void Reset() = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/PIDOutput.h b/third_party/allwpilib_2017/wpilibc/shared/include/PIDOutput.h
deleted file mode 100644
index efa4255..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/PIDOutput.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "Base.h"
-
-namespace frc {
-
-/**
- * PIDOutput interface is a generic output for the PID class.
- * PWMs use this class.
- * Users implement this interface to allow for a PIDController to
- * read directly from the inputs.
- */
-class PIDOutput {
- public:
- virtual void PIDWrite(double output) = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/PIDSource.h b/third_party/allwpilib_2017/wpilibc/shared/include/PIDSource.h
deleted file mode 100644
index 1f849c1..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/PIDSource.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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
-
-namespace frc {
-
-enum class PIDSourceType { kDisplacement, kRate };
-
-/**
- * PIDSource interface is a generic sensor source for the PID class.
- * All sensors that can be used with the PID class will implement the PIDSource
- * that returns a standard value that will be used in the PID code.
- */
-class PIDSource {
- public:
- virtual void SetPIDSourceType(PIDSourceType pidSource);
- PIDSourceType GetPIDSourceType() const;
- virtual double PIDGet() = 0;
-
- protected:
- PIDSourceType m_pidSource = PIDSourceType::kDisplacement;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Resource.h b/third_party/allwpilib_2017/wpilibc/shared/include/Resource.h
deleted file mode 100644
index d42ce50..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Resource.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <stdint.h>
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "ErrorBase.h"
-#include "HAL/cpp/priority_mutex.h"
-
-namespace frc {
-
-/**
- * The Resource class is a convenient way to track allocated resources.
- * It tracks them as indicies 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.
- */
-class Resource : public ErrorBase {
- public:
- virtual ~Resource() = default;
-
- Resource(const Resource&) = delete;
- Resource& operator=(const Resource&) = delete;
-
- static void CreateResourceObject(std::unique_ptr<Resource>& r,
- uint32_t elements);
- explicit Resource(uint32_t size);
- uint32_t Allocate(const std::string& resourceDesc);
- uint32_t Allocate(uint32_t index, const std::string& resourceDesc);
- void Free(uint32_t index);
-
- private:
- std::vector<bool> m_isAllocated;
- priority_recursive_mutex m_allocateLock;
-
- static priority_recursive_mutex m_createLock;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/RobotState.h b/third_party/allwpilib_2017/wpilibc/shared/include/RobotState.h
deleted file mode 100644
index 195bb62..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/RobotState.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-
-namespace frc {
-
-class RobotStateInterface {
- public:
- virtual ~RobotStateInterface() = default;
- virtual bool IsDisabled() const = 0;
- virtual bool IsEnabled() const = 0;
- virtual bool IsOperatorControl() const = 0;
- virtual bool IsAutonomous() const = 0;
- virtual bool IsTest() const = 0;
-};
-
-class RobotState {
- private:
- static std::shared_ptr<RobotStateInterface> impl;
-
- public:
- static void SetImplementation(RobotStateInterface& i);
- static void SetImplementation(std::shared_ptr<RobotStateInterface> i);
- static bool IsDisabled();
- static bool IsEnabled();
- static bool IsOperatorControl();
- static bool IsAutonomous();
- static bool IsTest();
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/NamedSendable.h b/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/NamedSendable.h
deleted file mode 100644
index 759447f..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/NamedSendable.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2012-2017. 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 <string>
-
-#include "SmartDashboard/Sendable.h"
-
-namespace frc {
-
-/**
- * The interface for sendable objects that gives the sendable a default name in
- * the Smart Dashboard
- *
- */
-class NamedSendable : public Sendable {
- public:
- /**
- * @return the name of the subtable of SmartDashboard that the Sendable object
- * will use
- */
- virtual std::string GetName() const = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/Sendable.h b/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/Sendable.h
deleted file mode 100644
index d7ca758..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/Sendable.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <memory>
-#include <string>
-
-#include "tables/ITable.h"
-
-namespace frc {
-
-class Sendable {
- public:
- /**
- * Initializes a table for this sendable object.
- * @param subtable The table to put the values in.
- */
- virtual void InitTable(std::shared_ptr<ITable> subtable) = 0;
-
- /**
- * @return the table that is currently associated with the sendable
- */
- virtual std::shared_ptr<ITable> GetTable() const = 0;
-
- /**
- * @return the string representation of the named data type that will be used
- * by the smart dashboard for this sendable
- */
- virtual std::string GetSmartDashboardType() const = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/SendableChooser.h b/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/SendableChooser.h
deleted file mode 100644
index 5dbee54..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/SendableChooser.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <memory>
-#include <string>
-
-#include "SmartDashboard/SendableChooserBase.h"
-#include "llvm/StringMap.h"
-#include "llvm/StringRef.h"
-#include "tables/ITable.h"
-
-namespace frc {
-
-/**
- * The {@link SendableChooser} class is a useful tool for presenting a selection
- * of options to the {@link SmartDashboard}.
- *
- * <p>For instance, you may wish to be able to select between multiple
- * autonomous modes. You can do this by putting every possible {@link Command}
- * you want to run as an autonomous into a {@link SendableChooser} and then put
- * it into the {@link SmartDashboard} to have a list of options appear on the
- * laptop. Once autonomous starts, simply ask the {@link SendableChooser} what
- * the selected value is.</p>
- *
- * @tparam T The type of values to be stored
- * @see SmartDashboard
- */
-template <class T>
-class SendableChooser : public SendableChooserBase {
- public:
- virtual ~SendableChooser() = default;
-
- void AddObject(llvm::StringRef name, const T& object);
- void AddDefault(llvm::StringRef name, const T& object);
- T GetSelected();
-
- void InitTable(std::shared_ptr<ITable> subtable) override;
-
- private:
- llvm::StringMap<T> m_choices;
-};
-
-} // namespace frc
-
-#include "SendableChooser.inc"
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/SendableChooser.inc b/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/SendableChooser.inc
deleted file mode 100644
index ba9363f..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/SendableChooser.inc
+++ /dev/null
@@ -1,83 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <algorithm>
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-namespace frc {
-
-/**
- * Adds the given object to the list of options.
- *
- * On the {@link SmartDashboard} on the desktop, the object will appear as the
- * given name.
- *
- * @param name the name of the option
- * @param object the option
- */
-template <class T>
-void SendableChooser<T>::AddObject(llvm::StringRef name, const T& object) {
- m_choices[name] = object;
-}
-
-/**
- * Add the given object to the list of options and marks it as the default.
- *
- * Functionally, this is very close to {@link SendableChooser#AddObject(const
- * char *name, void *object) AddObject(...)} except that it will use this as
- * the default option if none other is explicitly selected.
- *
- * @param name the name of the option
- * @param object the option
- */
-template <class T>
-void SendableChooser<T>::AddDefault(llvm::StringRef name, const T& object) {
- m_defaultChoice = name;
- AddObject(name, object);
-}
-
-/**
- * Returns the selected option.
- *
- * If there is none selected, it will return the default. If there is none
- * selected and no default, then it will return {@code nullptr}.
- *
- * @return the option selected
- */
-template <class T>
-T SendableChooser<T>::GetSelected() {
- std::string selected = m_table->GetString(kSelected, m_defaultChoice);
- if (selected == "") {
- return nullptr;
- } else {
- return m_choices[selected];
- }
-}
-
-template <class T>
-void SendableChooser<T>::InitTable(std::shared_ptr<ITable> subtable) {
- std::vector<std::string> keys;
- m_table = subtable;
- if (m_table != nullptr) {
- for (const auto& choice : m_choices) {
- keys.push_back(choice.first());
- }
-
- // Unlike std::map, llvm::StringMap elements are not sorted
- std::sort(keys.begin(), keys.end());
-
- m_table->PutValue(kOptions, nt::Value::MakeStringArray(std::move(keys)));
- m_table->PutString(kDefault, m_defaultChoice);
- }
-}
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/SendableChooserBase.h b/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/SendableChooserBase.h
deleted file mode 100644
index 04102ee..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/SendableChooserBase.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2017. 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 <memory>
-#include <string>
-
-#include "SmartDashboard/Sendable.h"
-#include "tables/ITable.h"
-
-namespace frc {
-
-/**
- * This class is a non-template base class for {@link SendableChooser}.
- *
- * It contains static, non-templated variables to avoid their duplication in the
- * template class.
- */
-class SendableChooserBase : public Sendable {
- public:
- virtual ~SendableChooserBase() = default;
-
- std::shared_ptr<ITable> GetTable() const override;
- std::string GetSmartDashboardType() const override;
-
- protected:
- static const char* kDefault;
- static const char* kOptions;
- static const char* kSelected;
-
- std::string m_defaultChoice;
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/SmartDashboard.h b/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/SmartDashboard.h
deleted file mode 100644
index 8656d73..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/SmartDashboard/SmartDashboard.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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 <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "SensorBase.h"
-#include "SmartDashboard/NamedSendable.h"
-#include "SmartDashboard/Sendable.h"
-#include "tables/ITable.h"
-
-namespace frc {
-
-class SmartDashboard : public SensorBase {
- public:
- static void init();
-
- static bool ContainsKey(llvm::StringRef key);
-
- static std::vector<std::string> GetKeys(int types = 0);
-
- static void SetPersistent(llvm::StringRef key);
- static void ClearPersistent(llvm::StringRef key);
- static bool IsPersistent(llvm::StringRef key);
-
- static void SetFlags(llvm::StringRef key, unsigned int flags);
- static void ClearFlags(llvm::StringRef key, unsigned int flags);
- static unsigned int GetFlags(llvm::StringRef key);
-
- static void Delete(llvm::StringRef key);
-
- static void PutData(llvm::StringRef key, Sendable* data);
- static void PutData(NamedSendable* value);
- static Sendable* GetData(llvm::StringRef keyName);
-
- static bool PutBoolean(llvm::StringRef keyName, bool value);
- static bool SetDefaultBoolean(llvm::StringRef key, bool defaultValue);
- static bool GetBoolean(llvm::StringRef keyName, bool defaultValue);
-
- static bool PutNumber(llvm::StringRef keyName, double value);
- static bool SetDefaultNumber(llvm::StringRef key, double defaultValue);
- static double GetNumber(llvm::StringRef keyName, double defaultValue);
-
- static bool PutString(llvm::StringRef keyName, llvm::StringRef value);
- static bool SetDefaultString(llvm::StringRef key,
- llvm::StringRef defaultValue);
- static std::string GetString(llvm::StringRef keyName,
- llvm::StringRef defaultValue);
-
- static bool PutBooleanArray(llvm::StringRef key, llvm::ArrayRef<int> value);
- static bool SetDefaultBooleanArray(llvm::StringRef key,
- llvm::ArrayRef<int> defaultValue);
- static std::vector<int> GetBooleanArray(llvm::StringRef key,
- llvm::ArrayRef<int> defaultValue);
-
- static bool PutNumberArray(llvm::StringRef key, llvm::ArrayRef<double> value);
- static bool SetDefaultNumberArray(llvm::StringRef key,
- llvm::ArrayRef<double> defaultValue);
- static std::vector<double> GetNumberArray(
- llvm::StringRef key, llvm::ArrayRef<double> defaultValue);
-
- static bool PutStringArray(llvm::StringRef key,
- llvm::ArrayRef<std::string> value);
- static bool SetDefaultStringArray(llvm::StringRef key,
- llvm::ArrayRef<std::string> defaultValue);
- static std::vector<std::string> GetStringArray(
- llvm::StringRef key, llvm::ArrayRef<std::string> defaultValue);
-
- static bool PutRaw(llvm::StringRef key, llvm::StringRef value);
- static bool SetDefaultRaw(llvm::StringRef key, llvm::StringRef defaultValue);
- static std::string GetRaw(llvm::StringRef key, llvm::StringRef defaultValue);
-
- static bool PutValue(llvm::StringRef keyName,
- std::shared_ptr<nt::Value> value);
- static bool SetDefaultValue(llvm::StringRef key,
- std::shared_ptr<nt::Value> defaultValue);
- static std::shared_ptr<nt::Value> GetValue(llvm::StringRef keyName);
-
- private:
- virtual ~SmartDashboard() = default;
-
- /** The {@link NetworkTable} used by {@link SmartDashboard} */
- static std::shared_ptr<ITable> m_table;
-
- /**
- * A map linking tables in the SmartDashboard to the
- * {@link SmartDashboardData} objects they came from.
- */
- static std::map<std::shared_ptr<ITable>, Sendable*> m_tablesToData;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Timer.h b/third_party/allwpilib_2017/wpilibc/shared/include/Timer.h
deleted file mode 100644
index c71e3c8..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Timer.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "Base.h"
-#include "HAL/cpp/priority_mutex.h"
-
-namespace frc {
-
-typedef void (*TimerInterruptHandler)(void* param);
-
-void Wait(double seconds);
-double GetClock();
-double GetTime();
-
-/**
- * Timer objects measure accumulated time in seconds.
- * The timer object functions like a stopwatch. It can be started, stopped, and
- * cleared. When the timer is running its value counts up in seconds. When
- * stopped, the timer holds the current value. The implementation simply records
- * the time when started and subtracts the current time whenever the value is
- * requested.
- */
-class Timer {
- public:
- Timer();
- virtual ~Timer() = default;
-
- Timer(const Timer&) = delete;
- Timer& operator=(const Timer&) = delete;
-
- double Get() const;
- void Reset();
- void Start();
- void Stop();
- bool HasPeriodPassed(double period);
-
- static double GetFPGATimestamp();
- static double GetPPCTimestamp();
- static double GetMatchTime();
-
- // The time, in seconds, at which the 32-bit FPGA timestamp rolls over to 0
- static const double kRolloverTime;
-
- private:
- double m_startTime = 0.0;
- double m_accumulatedTime = 0.0;
- bool m_running = false;
- mutable priority_mutex m_mutex;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/Utility.h b/third_party/allwpilib_2017/wpilibc/shared/include/Utility.h
deleted file mode 100644
index bf97692..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/Utility.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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
-
-/** @file
- * Contains global utility functions
- */
-
-#include <stdint.h>
-
-#include <string>
-
-#include "llvm/StringRef.h"
-
-#define wpi_assert(condition) \
- wpi_assert_impl(condition, #condition, "", __FILE__, __LINE__, __FUNCTION__)
-#define wpi_assertWithMessage(condition, message) \
- wpi_assert_impl(condition, #condition, message, __FILE__, __LINE__, \
- __FUNCTION__)
-
-#define wpi_assertEqual(a, b) \
- wpi_assertEqual_impl(a, b, #a, #b, "", __FILE__, __LINE__, __FUNCTION__)
-#define wpi_assertEqualWithMessage(a, b, message) \
- wpi_assertEqual_impl(a, b, #a, #b, message, __FILE__, __LINE__, __FUNCTION__)
-
-#define wpi_assertNotEqual(a, b) \
- wpi_assertNotEqual_impl(a, b, #a, #b, "", __FILE__, __LINE__, __FUNCTION__)
-#define wpi_assertNotEqualWithMessage(a, b, message) \
- wpi_assertNotEqual_impl(a, b, #a, #b, message, __FILE__, __LINE__, \
- __FUNCTION__)
-
-bool wpi_assert_impl(bool conditionValue, llvm::StringRef conditionText,
- llvm::StringRef message, llvm::StringRef fileName,
- int lineNumber, llvm::StringRef funcName);
-bool wpi_assertEqual_impl(int valueA, int valueB, llvm::StringRef valueAString,
- llvm::StringRef valueBString, llvm::StringRef message,
- llvm::StringRef fileName, int lineNumber,
- llvm::StringRef funcName);
-bool wpi_assertNotEqual_impl(int valueA, int valueB,
- llvm::StringRef valueAString,
- llvm::StringRef valueBString,
- llvm::StringRef message, llvm::StringRef fileName,
- int lineNumber, llvm::StringRef funcName);
-
-void wpi_suspendOnAssertEnabled(bool enabled);
-
-namespace frc {
-
-int GetFPGAVersion();
-int64_t GetFPGARevision();
-uint64_t GetFPGATime();
-bool GetUserButton();
-std::string GetStackTrace(int offset);
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/WPIErrors.h b/third_party/allwpilib_2017/wpilibc/shared/include/WPIErrors.h
deleted file mode 100644
index ece177c..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/WPIErrors.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <stdint.h>
-
-#ifdef WPI_ERRORS_DEFINE_STRINGS
-#define S(label, offset, message) \
- const char* wpi_error_s_##label = message; \
- const int wpi_error_value_##label = offset
-#else
-#define S(label, offset, message) \
- extern const char* wpi_error_s_##label; \
- const int wpi_error_value_##label = offset
-#endif
-
-/*
- * Fatal errors
- */
-S(ModuleIndexOutOfRange, -1,
- "Allocating module that is out of range or not found");
-S(ChannelIndexOutOfRange, -1, "Allocating channel that is out of range");
-S(NotAllocated, -2, "Attempting to free unallocated resource");
-S(ResourceAlreadyAllocated, -3, "Attempted to reuse an allocated resource");
-S(NoAvailableResources, -4, "No available resources to allocate");
-S(NullParameter, -5, "A pointer parameter to a method is nullptr");
-S(Timeout, -6, "A timeout has been exceeded");
-S(CompassManufacturerError, -7, "Compass manufacturer doesn't match HiTechnic");
-S(CompassTypeError, -8,
- "Compass type doesn't match expected type for HiTechnic compass");
-S(IncompatibleMode, -9, "The object is in an incompatible mode");
-S(AnalogTriggerLimitOrderError, -10,
- "AnalogTrigger limits error. Lower limit > Upper Limit");
-S(AnalogTriggerPulseOutputError, -11,
- "Attempted to read AnalogTrigger pulse output.");
-S(TaskError, -12, "Task can't be started");
-S(TaskIDError, -13, "Task error: Invalid ID.");
-S(TaskDeletedError, -14, "Task error: Task already deleted.");
-S(TaskOptionsError, -15, "Task error: Invalid options.");
-S(TaskMemoryError, -16, "Task can't be started due to insufficient memory.");
-S(TaskPriorityError, -17, "Task error: Invalid priority [1-255].");
-S(DriveUninitialized, -18, "RobotDrive not initialized for the C interface");
-S(CompressorNonMatching, -19,
- "Compressor slot/channel doesn't match previous instance");
-S(CompressorAlreadyDefined, -20, "Creating a second compressor instance");
-S(CompressorUndefined, -21,
- "Using compressor functions without defining compressor");
-S(InconsistentArrayValueAdded, -22,
- "When packing data into an array to the dashboard, not all values added were "
- "of the same type.");
-S(MismatchedComplexTypeClose, -23,
- "When packing data to the dashboard, a Close for a complex type was called "
- "without a matching Open.");
-S(DashboardDataOverflow, -24,
- "When packing data to the dashboard, too much data was packed and the buffer "
- "overflowed.");
-S(DashboardDataCollision, -25,
- "The same buffer was used for packing data and for printing.");
-S(EnhancedIOMissing, -26, "IO is not attached or Enhanced IO is not enabled.");
-S(LineNotOutput, -27,
- "Cannot SetDigitalOutput for a line not configured for output.");
-S(ParameterOutOfRange, -28, "A parameter is out of range.");
-S(SPIClockRateTooLow, -29, "SPI clock rate was below the minimum supported");
-S(JaguarVersionError, -30, "Jaguar firmware version error");
-S(JaguarMessageNotFound, -31, "Jaguar message not found");
-S(NetworkTablesReadError, -40, "Error reading NetworkTables socket");
-S(NetworkTablesBufferFull, -41, "Buffer full writing to NetworkTables socket");
-S(NetworkTablesWrongType, -42,
- "The wrong type was read from the NetworkTables entry");
-S(NetworkTablesCorrupt, -43, "NetworkTables data stream is corrupt");
-S(SmartDashboardMissingKey, -43, "SmartDashboard data does not exist");
-S(CommandIllegalUse, -50, "Illegal use of Command");
-S(UnsupportedInSimulation, -80, "Unsupported in simulation");
-S(CameraServerError, -90, "CameraServer error");
-
-/*
- * Warnings
- */
-S(SampleRateTooHigh, 1, "Analog module sample rate is too high");
-S(VoltageOutOfRange, 2,
- "Voltage to convert to raw value is out of range [-10; 10]");
-S(CompressorTaskError, 3, "Compressor task won't start");
-S(LoopTimingError, 4, "Digital module loop timing is not the expected value");
-S(NonBinaryDigitalValue, 5, "Digital output value is not 0 or 1");
-S(IncorrectBatteryChannel, 6,
- "Battery measurement channel is not correct value");
-S(BadJoystickIndex, 7, "Joystick index is out of range, should be 0-3");
-S(BadJoystickAxis, 8, "Joystick axis or POV is out of range");
-S(InvalidMotorIndex, 9, "Motor index is out of range, should be 0-3");
-S(DriverStationTaskError, 10, "Driver Station task won't start");
-S(EnhancedIOPWMPeriodOutOfRange, 11,
- "Driver Station Enhanced IO PWM Output period out of range.");
-S(SPIWriteNoMOSI, 12, "Cannot write to SPI port with no MOSI output");
-S(SPIReadNoMISO, 13, "Cannot read from SPI port with no MISO input");
-S(SPIReadNoData, 14, "No data available to read from SPI");
-S(IncompatibleState, 15,
- "Incompatible State: The operation cannot be completed");
-
-#undef S
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/WPILibVersion.h b/third_party/allwpilib_2017/wpilibc/shared/include/WPILibVersion.h
deleted file mode 100644
index 80c4a3c..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/WPILibVersion.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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
-
-/*
- * The corresponding WPILibVersion.cpp file is autogenerated by the build
- * system. If it does not exist, make sure that you run a build.
- */
-extern const char* WPILibVersion;
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/XboxController.h b/third_party/allwpilib_2017/wpilibc/shared/include/XboxController.h
deleted file mode 100644
index d60d656..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/XboxController.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 "ErrorBase.h"
-#include "GamepadBase.h"
-
-namespace frc {
-
-class DriverStation;
-
-/**
- * Handle input from Xbox 360 or Xbox One controllers connected to the Driver
- * Station.
- *
- * This class handles Xbox input that comes from the Driver Station. Each time a
- * value is requested the most recent value is returend. There is a single class
- * instance for each controller and the mapping of ports to hardware buttons
- * depends on the code in the Driver Station.
- */
-class XboxController : public GamepadBase, public ErrorBase {
- public:
- explicit XboxController(int port);
- virtual ~XboxController() = default;
-
- XboxController(const XboxController&) = delete;
- XboxController& operator=(const XboxController&) = delete;
-
- double GetX(JoystickHand hand) const override;
- double GetY(JoystickHand hand) const override;
-
- bool GetBumper(JoystickHand hand) const override;
- bool GetStickButton(JoystickHand hand) const override;
-
- virtual double GetTriggerAxis(JoystickHand hand) const;
-
- bool GetAButton() const;
- bool GetBButton() const;
- bool GetXButton() const;
- bool GetYButton() const;
- bool GetBackButton() const;
- bool GetStartButton() const;
-
- private:
- DriverStation& m_ds;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/interfaces/Accelerometer.h b/third_party/allwpilib_2017/wpilibc/shared/include/interfaces/Accelerometer.h
deleted file mode 100644
index f8491eb..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/interfaces/Accelerometer.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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
-
-namespace frc {
-
-/**
- * Interface for 3-axis accelerometers
- */
-class Accelerometer {
- public:
- virtual ~Accelerometer() = default;
-
- enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2, kRange_16G = 3 };
-
- /**
- * Common interface for setting the measuring range of an accelerometer.
- *
- * @param range The maximum acceleration, positive or negative, that the
- * accelerometer will measure. Not all accelerometers support all ranges.
- */
- virtual void SetRange(Range range) = 0;
-
- /**
- * Common interface for getting the x axis acceleration
- *
- * @return The acceleration along the x axis in g-forces
- */
- virtual double GetX() = 0;
-
- /**
- * Common interface for getting the y axis acceleration
- *
- * @return The acceleration along the y axis in g-forces
- */
- virtual double GetY() = 0;
-
- /**
- * Common interface for getting the z axis acceleration
- *
- * @return The acceleration along the z axis in g-forces
- */
- virtual double GetZ() = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/interfaces/Gyro.h b/third_party/allwpilib_2017/wpilibc/shared/include/interfaces/Gyro.h
deleted file mode 100644
index 6ae2f65..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/interfaces/Gyro.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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
-
-namespace frc {
-
-/**
- * Interface for yaw rate gyros
- */
-class Gyro {
- public:
- virtual ~Gyro() = default;
-
- /**
- * Calibrate the gyro by running for a number of samples and computing the
- * center value. Then use the center value as the Accumulator center value for
- * subsequent measurements. It's important to make sure that the robot is not
- * moving while the centering calculations are in progress, this is typically
- * done when the robot is first turned on while it's sitting at rest before
- * the competition starts.
- */
- virtual void Calibrate() = 0;
-
- /**
- * Reset the gyro. Resets the gyro to a heading of zero. This can be used if
- * there is significant drift in the gyro and it needs to be recalibrated
- * after it has been running.
- */
- virtual void Reset() = 0;
-
- /**
- * Return the actual angle in degrees that the robot is currently facing.
- *
- * The angle is based on the current accumulator value corrected by the
- * oversampling rate, the gyro type and the A/D calibration values. The angle
- * is continuous, that is it will continue from 360 to 361 degrees. This
- * allows algorithms that wouldn't want to see a discontinuity in the gyro
- * output as it sweeps past from 360 to 0 on the second time around.
- *
- * @return the current heading of the robot in degrees. This heading is based
- * on integration of the returned rate from the gyro.
- */
- virtual double GetAngle() const = 0;
-
- /**
- * Return the rate of rotation of the gyro
- *
- * The rate is based on the most recent reading of the gyro analog value
- *
- * @return the current rate in degrees per second
- */
- virtual double GetRate() const = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/include/interfaces/Potentiometer.h b/third_party/allwpilib_2017/wpilibc/shared/include/interfaces/Potentiometer.h
deleted file mode 100644
index b50a849..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/include/interfaces/Potentiometer.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "PIDSource.h"
-
-namespace frc {
-
-/**
- * Interface for potentiometers.
- */
-class Potentiometer : public PIDSource {
- public:
- virtual ~Potentiometer() = default;
-
- /**
- * Common interface for getting the current value of a potentiometer.
- *
- * @return The current set speed. Value is between -1.0 and 1.0.
- */
- virtual double Get() const = 0;
-
- void SetPIDSourceType(PIDSourceType pidSource) override;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/Button.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/Button.cpp
deleted file mode 100644
index 4edc64e..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/Button.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Buttons/Button.h"
-
-using namespace frc;
-
-/**
- * Specifies the command to run when a button is first pressed.
- *
- * @param command The pointer to the command to run
- */
-void Button::WhenPressed(Command* command) { WhenActive(command); }
-
-/**
- * Specifies the command to be scheduled while the button is pressed.
- *
- * The command will be scheduled repeatedly while the button is pressed and will
- * be canceled when the button is released.
- *
- * @param command The pointer to the command to run
- */
-void Button::WhileHeld(Command* command) { WhileActive(command); }
-
-/**
- * Specifies the command to run when the button is released.
- *
- * The command will be scheduled a single time.
- *
- * @param command The pointer to the command to run
- */
-void Button::WhenReleased(Command* command) { WhenInactive(command); }
-
-/**
- * Cancels the specificed command when the button is pressed.
- *
- * @param command The command to be canceled
- */
-void Button::CancelWhenPressed(Command* command) { CancelWhenActive(command); }
-
-/**
- * Toggle the specified command when the button is pressed.
- *
- * @param command The command to be toggled
- */
-void Button::ToggleWhenPressed(Command* command) { ToggleWhenActive(command); }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/ButtonScheduler.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/ButtonScheduler.cpp
deleted file mode 100644
index c1ce026..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/ButtonScheduler.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Buttons/ButtonScheduler.h"
-
-#include "Commands/Scheduler.h"
-
-using namespace frc;
-
-ButtonScheduler::ButtonScheduler(bool last, Trigger* button, Command* orders)
- : m_pressedLast(last), m_button(button), m_command(orders) {}
-
-void ButtonScheduler::Start() { Scheduler::GetInstance()->AddButton(this); }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/CancelButtonScheduler.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/CancelButtonScheduler.cpp
deleted file mode 100644
index c3c419e..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/CancelButtonScheduler.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Buttons/CancelButtonScheduler.h"
-
-#include "Buttons/Button.h"
-#include "Commands/Command.h"
-
-using namespace frc;
-
-CancelButtonScheduler::CancelButtonScheduler(bool last, Trigger* button,
- Command* orders)
- : ButtonScheduler(last, button, orders) {
- pressedLast = m_button->Grab();
-}
-
-void CancelButtonScheduler::Execute() {
- if (m_button->Grab()) {
- if (!pressedLast) {
- pressedLast = true;
- m_command->Cancel();
- }
- } else {
- pressedLast = false;
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/HeldButtonScheduler.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/HeldButtonScheduler.cpp
deleted file mode 100644
index 21f9652..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/HeldButtonScheduler.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Buttons/HeldButtonScheduler.h"
-
-#include "Buttons/Button.h"
-#include "Commands/Command.h"
-
-using namespace frc;
-
-HeldButtonScheduler::HeldButtonScheduler(bool last, Trigger* button,
- Command* orders)
- : ButtonScheduler(last, button, orders) {}
-
-void HeldButtonScheduler::Execute() {
- if (m_button->Grab()) {
- m_pressedLast = true;
- m_command->Start();
- } else {
- if (m_pressedLast) {
- m_pressedLast = false;
- m_command->Cancel();
- }
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/InternalButton.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/InternalButton.cpp
deleted file mode 100644
index 8969e38..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/InternalButton.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Buttons/InternalButton.h"
-
-using namespace frc;
-
-InternalButton::InternalButton(bool inverted)
- : m_pressed(inverted), m_inverted(inverted) {}
-
-void InternalButton::SetInverted(bool inverted) { m_inverted = inverted; }
-
-void InternalButton::SetPressed(bool pressed) { m_pressed = pressed; }
-
-bool InternalButton::Get() { return m_pressed ^ m_inverted; }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/JoystickButton.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/JoystickButton.cpp
deleted file mode 100644
index 92cec36..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/JoystickButton.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Buttons/JoystickButton.h"
-
-using namespace frc;
-
-JoystickButton::JoystickButton(GenericHID* joystick, int buttonNumber)
- : m_joystick(joystick), m_buttonNumber(buttonNumber) {}
-
-bool JoystickButton::Get() { return m_joystick->GetRawButton(m_buttonNumber); }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/NetworkButton.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/NetworkButton.cpp
deleted file mode 100644
index d0c5abf..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/NetworkButton.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Buttons/NetworkButton.h"
-
-#include "networktables/NetworkTable.h"
-
-using namespace frc;
-
-NetworkButton::NetworkButton(const std::string& tableName,
- const std::string& field)
- : // TODO how is this supposed to work???
- m_netTable(NetworkTable::GetTable(tableName)),
- m_field(field) {}
-
-NetworkButton::NetworkButton(std::shared_ptr<ITable> table,
- const std::string& field)
- : m_netTable(table), m_field(field) {}
-
-bool NetworkButton::Get() {
- /*if (m_netTable->isConnected())
- return m_netTable->GetBoolean(m_field.c_str());
- else
- return false;*/
- return m_netTable->GetBoolean(m_field, false);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/PressedButtonScheduler.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/PressedButtonScheduler.cpp
deleted file mode 100644
index d17ece3..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/PressedButtonScheduler.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Buttons/PressedButtonScheduler.h"
-
-#include "Buttons/Button.h"
-#include "Commands/Command.h"
-
-using namespace frc;
-
-PressedButtonScheduler::PressedButtonScheduler(bool last, Trigger* button,
- Command* orders)
- : ButtonScheduler(last, button, orders) {}
-
-void PressedButtonScheduler::Execute() {
- if (m_button->Grab()) {
- if (!m_pressedLast) {
- m_pressedLast = true;
- m_command->Start();
- }
- } else {
- m_pressedLast = false;
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/ReleasedButtonScheduler.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/ReleasedButtonScheduler.cpp
deleted file mode 100644
index a0ec57e..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/ReleasedButtonScheduler.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Buttons/ReleasedButtonScheduler.h"
-
-#include "Buttons/Button.h"
-#include "Commands/Command.h"
-
-using namespace frc;
-
-ReleasedButtonScheduler::ReleasedButtonScheduler(bool last, Trigger* button,
- Command* orders)
- : ButtonScheduler(last, button, orders) {}
-
-void ReleasedButtonScheduler::Execute() {
- if (m_button->Grab()) {
- m_pressedLast = true;
- } else {
- if (m_pressedLast) {
- m_pressedLast = false;
- m_command->Start();
- }
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/ToggleButtonScheduler.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/ToggleButtonScheduler.cpp
deleted file mode 100644
index 4225a80..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/ToggleButtonScheduler.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Buttons/ToggleButtonScheduler.h"
-
-#include "Buttons/Button.h"
-#include "Commands/Command.h"
-
-using namespace frc;
-
-ToggleButtonScheduler::ToggleButtonScheduler(bool last, Trigger* button,
- Command* orders)
- : ButtonScheduler(last, button, orders) {
- pressedLast = m_button->Grab();
-}
-
-void ToggleButtonScheduler::Execute() {
- if (m_button->Grab()) {
- if (!pressedLast) {
- pressedLast = true;
- if (m_command->IsRunning()) {
- m_command->Cancel();
- } else {
- m_command->Start();
- }
- }
- } else {
- pressedLast = false;
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/Trigger.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/Trigger.cpp
deleted file mode 100644
index f0e6bf3..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Buttons/Trigger.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Buttons/Button.h"
-#include "Buttons/CancelButtonScheduler.h"
-#include "Buttons/HeldButtonScheduler.h"
-#include "Buttons/PressedButtonScheduler.h"
-#include "Buttons/ReleasedButtonScheduler.h"
-#include "Buttons/ToggleButtonScheduler.h"
-
-using namespace frc;
-
-bool Trigger::Grab() {
- if (Get()) {
- return true;
- } else if (m_table != nullptr) {
- return m_table->GetBoolean("pressed", false);
- } else {
- return false;
- }
-}
-
-void Trigger::WhenActive(Command* command) {
- auto pbs = new PressedButtonScheduler(Grab(), this, command);
- pbs->Start();
-}
-
-void Trigger::WhileActive(Command* command) {
- auto hbs = new HeldButtonScheduler(Grab(), this, command);
- hbs->Start();
-}
-
-void Trigger::WhenInactive(Command* command) {
- auto rbs = new ReleasedButtonScheduler(Grab(), this, command);
- rbs->Start();
-}
-
-void Trigger::CancelWhenActive(Command* command) {
- auto cbs = new CancelButtonScheduler(Grab(), this, command);
- cbs->Start();
-}
-
-void Trigger::ToggleWhenActive(Command* command) {
- auto tbs = new ToggleButtonScheduler(Grab(), this, command);
- tbs->Start();
-}
-
-std::string Trigger::GetSmartDashboardType() const { return "Button"; }
-
-void Trigger::InitTable(std::shared_ptr<ITable> subtable) {
- m_table = subtable;
- if (m_table != nullptr) {
- m_table->PutBoolean("pressed", Get());
- }
-}
-
-std::shared_ptr<ITable> Trigger::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/Command.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/Command.cpp
deleted file mode 100644
index 3d7d2ac..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/Command.cpp
+++ /dev/null
@@ -1,459 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/Command.h"
-
-#include <typeinfo>
-
-#include "Commands/CommandGroup.h"
-#include "Commands/Scheduler.h"
-#include "RobotState.h"
-#include "Timer.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-static const std::string kName = "name";
-static const std::string kRunning = "running";
-static const std::string kIsParented = "isParented";
-
-int Command::m_commandCounter = 0;
-
-/**
- * Creates a new command.
- * The name of this command will be default.
- */
-Command::Command() : Command("", -1.0) {}
-
-/**
- * Creates a new command with the given name and no timeout.
- *
- * @param name the name for this command
- */
-Command::Command(const std::string& name) : Command(name, -1.0) {}
-
-/**
- * Creates a new command with the given timeout and a default name.
- *
- * @param timeout the time (in seconds) before this command "times out"
- * @see Command#isTimedOut() isTimedOut()
- */
-Command::Command(double timeout) : Command("", timeout) {}
-
-/**
- * Creates a new command with the given name and timeout.
- *
- * @param name the name of the command
- * @param timeout the time (in seconds) before this command "times out"
- * @see Command#isTimedOut() isTimedOut()
- */
-Command::Command(const std::string& name, double timeout) {
- // We use -1.0 to indicate no timeout.
- if (timeout < 0.0 && timeout != -1.0)
- wpi_setWPIErrorWithContext(ParameterOutOfRange, "timeout < 0.0");
-
- m_timeout = timeout;
-
- // If name contains an empty string
- if (name.length() == 0) {
- m_name = std::string("Command_") + std::string(typeid(*this).name());
- } else {
- m_name = name;
- }
-}
-
-Command::~Command() {
- if (m_table != nullptr) m_table->RemoveTableListener(this);
-}
-
-/**
- * Get the ID (sequence number) for this command.
- *
- * The ID is a unique sequence number that is incremented for each command.
- *
- * @return the ID of this command
- */
-int Command::GetID() const { return m_commandID; }
-
-/**
- * Sets the timeout of this command.
- *
- * @param timeout the timeout (in seconds)
- * @see Command#isTimedOut() isTimedOut()
- */
-void Command::SetTimeout(double timeout) {
- if (timeout < 0.0)
- wpi_setWPIErrorWithContext(ParameterOutOfRange, "timeout < 0.0");
- else
- m_timeout = timeout;
-}
-
-/**
- * Returns the time since this command was initialized (in seconds).
- *
- * This function will work even if there is no specified timeout.
- *
- * @return the time since this command was initialized (in seconds).
- */
-double Command::TimeSinceInitialized() const {
- if (m_startTime < 0.0)
- return 0.0;
- else
- return Timer::GetFPGATimestamp() - m_startTime;
-}
-
-/**
- * This method specifies that the given {@link Subsystem} is used by this
- * command.
- *
- * This method is crucial to the functioning of the Command System in general.
- *
- * <p>Note that the recommended way to call this method is in the
- * constructor.</p>
- *
- * @param subsystem the {@link Subsystem} required
- * @see Subsystem
- */
-void Command::Requires(Subsystem* subsystem) {
- if (!AssertUnlocked("Can not add new requirement to command")) return;
-
- if (subsystem != nullptr)
- m_requirements.insert(subsystem);
- else
- wpi_setWPIErrorWithContext(NullParameter, "subsystem");
-}
-
-/**
- * Called when the command has been removed.
- *
- * This will call {@link Command#interrupted() interrupted()} or
- * {@link Command#end() end()}.
- */
-void Command::Removed() {
- if (m_initialized) {
- if (IsCanceled()) {
- Interrupted();
- _Interrupted();
- } else {
- End();
- _End();
- }
- }
- m_initialized = false;
- m_canceled = false;
- m_running = false;
- if (m_table != nullptr) m_table->PutBoolean(kRunning, false);
-}
-
-/**
- * Starts up the command. Gets the command ready to start.
- *
- * <p>Note that the command will eventually start, however it will not
- * necessarily do so immediately, and may in fact be canceled before initialize
- * is even called.</p>
- */
-void Command::Start() {
- LockChanges();
- if (m_parent != nullptr)
- wpi_setWPIErrorWithContext(
- CommandIllegalUse,
- "Can not start a command that is part of a command group");
-
- Scheduler::GetInstance()->AddCommand(this);
-}
-
-/**
- * The run method is used internally to actually run the commands.
- *
- * @return whether or not the command should stay within the {@link Scheduler}.
- */
-bool Command::Run() {
- if (!m_runWhenDisabled && m_parent == nullptr && RobotState::IsDisabled())
- Cancel();
-
- if (IsCanceled()) return false;
-
- if (!m_initialized) {
- m_initialized = true;
- StartTiming();
- _Initialize();
- Initialize();
- }
- _Execute();
- Execute();
- return !IsFinished();
-}
-
-/**
- * The initialize method is called the first time this Command is run after
- * being started.
- */
-void Command::Initialize() {}
-
-/**
- * The execute method is called repeatedly until this Command either finishes
- * or is canceled.
- */
-void Command::Execute() {}
-
-/**
- * Called when the command ended peacefully. This is where you may want
- * to wrap up loose ends, like shutting off a motor that was being used
- * in the command.
- */
-void Command::End() {}
-
-/**
- * Called when the command ends because somebody called
- * {@link Command#cancel() cancel()} or another command shared the same
- * requirements as this one, and booted it out.
- *
- * <p>This is where you may want to wrap up loose ends, like shutting off a
- * motor that was being used in the command.</p>
- *
- * <p>Generally, it is useful to simply call the {@link Command#end() end()}
- * method within this method, as done here.</p>
- */
-void Command::Interrupted() { End(); }
-
-void Command::_Initialize() {}
-
-void Command::_Interrupted() {}
-
-void Command::_Execute() {}
-
-void Command::_End() {}
-
-/**
- * Called to indicate that the timer should start.
- *
- * This is called right before {@link Command#initialize() initialize()} is,
- * inside the {@link Command#run() run()} method.
- */
-void Command::StartTiming() { m_startTime = Timer::GetFPGATimestamp(); }
-
-/**
- * Returns whether or not the
- * {@link Command#timeSinceInitialized() timeSinceInitialized()} method returns
- * a number which is greater than or equal to the timeout for the command.
- *
- * If there is no timeout, this will always return false.
- *
- * @return whether the time has expired
- */
-bool Command::IsTimedOut() const {
- return m_timeout != -1 && TimeSinceInitialized() >= m_timeout;
-}
-
-/**
- * Returns the requirements (as an std::set of {@link Subsystem Subsystems}
- * pointers) of this command.
- *
- * @return the requirements (as an std::set of {@link Subsystem Subsystems}
- * pointers) of this command
- */
-Command::SubsystemSet Command::GetRequirements() const {
- return m_requirements;
-}
-
-/**
- * Prevents further changes from being made.
- */
-void Command::LockChanges() { m_locked = true; }
-
-/**
- * If changes are locked, then this will generate a CommandIllegalUse error.
- *
- * @param message the message to report on error (it is appended by a default
- * message)
- * @return true if assert passed, false if assert failed
- */
-bool Command::AssertUnlocked(const std::string& message) {
- if (m_locked) {
- std::string buf =
- message + " after being started or being added to a command group";
- wpi_setWPIErrorWithContext(CommandIllegalUse, buf);
- return false;
- }
- return true;
-}
-
-/**
- * Sets the parent of this command. No actual change is made to the group.
- *
- * @param parent the parent
- */
-void Command::SetParent(CommandGroup* parent) {
- if (parent == nullptr) {
- wpi_setWPIErrorWithContext(NullParameter, "parent");
- } else if (m_parent != nullptr) {
- wpi_setWPIErrorWithContext(CommandIllegalUse,
- "Can not give command to a command group after "
- "already being put in a command group");
- } else {
- LockChanges();
- m_parent = parent;
- if (m_table != nullptr) {
- m_table->PutBoolean(kIsParented, true);
- }
- }
-}
-
-/**
- * Clears list of subsystem requirements. This is only used by
- * {@link ConditionalCommand} so cancelling the chosen command works properly in
- * {@link CommandGroup}.
- */
-void Command::ClearRequirements() { m_requirements.clear(); }
-
-/**
- * This is used internally to mark that the command has been started.
- *
- * The lifecycle of a command is:
- *
- * startRunning() is called.
- * run() is called (multiple times potentially)
- * removed() is called
- *
- * It is very important that startRunning and removed be called in order or some
- * assumptions of the code will be broken.
- */
-void Command::StartRunning() {
- m_running = true;
- m_startTime = -1;
- if (m_table != nullptr) m_table->PutBoolean(kRunning, true);
-}
-
-/**
- * Returns whether or not the command is running.
- *
- * This may return true even if the command has just been canceled, as it may
- * not have yet called {@link Command#interrupted()}.
- *
- * @return whether or not the command is running
- */
-bool Command::IsRunning() const { return m_running; }
-
-/**
- * This will cancel the current command.
- *
- * <p>This will cancel the current command eventually. It can be called
- * multiple times. And it can be called when the command is not running. If
- * the command is running though, then the command will be marked as canceled
- * and eventually removed.</p>
- *
- * <p>A command can not be canceled if it is a part of a command group, you
- * must cancel the command group instead.</p>
- */
-void Command::Cancel() {
- if (m_parent != nullptr)
- wpi_setWPIErrorWithContext(
- CommandIllegalUse,
- "Can not cancel a command that is part of a command group");
-
- _Cancel();
-}
-
-/**
- * This works like cancel(), except that it doesn't throw an exception if it is
- * a part of a command group.
- *
- * Should only be called by the parent command group.
- */
-void Command::_Cancel() {
- if (IsRunning()) m_canceled = true;
-}
-
-/**
- * Returns whether or not this has been canceled.
- *
- * @return whether or not this has been canceled
- */
-bool Command::IsCanceled() const { return m_canceled; }
-
-/**
- * Returns whether or not this command can be interrupted.
- *
- * @return whether or not this command can be interrupted
- */
-bool Command::IsInterruptible() const { return m_interruptible; }
-
-/**
- * Sets whether or not this command can be interrupted.
- *
- * @param interruptible whether or not this command can be interrupted
- */
-void Command::SetInterruptible(bool interruptible) {
- m_interruptible = interruptible;
-}
-
-/**
- * Checks if the command requires the given {@link Subsystem}.
- *
- * @param system the system
- * @return whether or not the subsystem is required (false if given nullptr)
- */
-bool Command::DoesRequire(Subsystem* system) const {
- return m_requirements.count(system) > 0;
-}
-
-/**
- * Returns the {@link CommandGroup} that this command is a part of.
- *
- * Will return null if this {@link Command} is not in a group.
- *
- * @return the {@link CommandGroup} that this command is a part of (or null if
- * not in group)
- */
-CommandGroup* Command::GetGroup() const { return m_parent; }
-
-/**
- * Sets whether or not this {@link Command} should run when the robot is
- * disabled.
- *
- * <p>By default a command will not run when the robot is disabled, and will in
- * fact be canceled.</p>
- *
- * @param run whether or not this command should run when the robot is disabled
- */
-void Command::SetRunWhenDisabled(bool run) { m_runWhenDisabled = run; }
-
-/**
- * Returns whether or not this {@link Command} will run when the robot is
- * disabled, or if it will cancel itself.
- *
- * @return whether or not this {@link Command} will run when the robot is
- * disabled, or if it will cancel itself
- */
-bool Command::WillRunWhenDisabled() const { return m_runWhenDisabled; }
-
-std::string Command::GetName() const { return m_name; }
-
-std::string Command::GetSmartDashboardType() const { return "Command"; }
-
-void Command::InitTable(std::shared_ptr<ITable> subtable) {
- if (m_table != nullptr) m_table->RemoveTableListener(this);
- m_table = subtable;
- if (m_table != nullptr) {
- m_table->PutString(kName, GetName());
- m_table->PutBoolean(kRunning, IsRunning());
- m_table->PutBoolean(kIsParented, m_parent != nullptr);
- m_table->AddTableListener(kRunning, this, false);
- }
-}
-
-std::shared_ptr<ITable> Command::GetTable() const { return m_table; }
-
-void Command::ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew) {
- if (!value->IsBoolean()) return;
- if (value->GetBoolean()) {
- if (!IsRunning()) Start();
- } else {
- if (IsRunning()) Cancel();
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/CommandGroup.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/CommandGroup.cpp
deleted file mode 100644
index a19acbe..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/CommandGroup.cpp
+++ /dev/null
@@ -1,321 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/CommandGroup.h"
-
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Creates a new {@link CommandGroup CommandGroup} with the given name.
- * @param name the name for this command group
- */
-CommandGroup::CommandGroup(const std::string& name) : Command(name) {}
-
-/**
- * Adds a new {@link Command Command} to the group. The {@link Command Command}
- * will be started after all the previously added {@link Command Commands}.
- *
- * <p>Note that any requirements the given {@link Command Command} has will be
- * added to the group. For this reason, a {@link Command Command's}
- * requirements can not be changed after being added to a group.</p>
- *
- * <p>It is recommended that this method be called in the constructor.</p>
- *
- * @param command The {@link Command Command} to be added
- */
-void CommandGroup::AddSequential(Command* command) {
- if (command == nullptr) {
- wpi_setWPIErrorWithContext(NullParameter, "command");
- return;
- }
- if (!AssertUnlocked("Cannot add new command to command group")) return;
-
- command->SetParent(this);
-
- m_commands.push_back(
- CommandGroupEntry(command, CommandGroupEntry::kSequence_InSequence));
- // Iterate through command->GetRequirements() and call Requires() on each
- // required subsystem
- Command::SubsystemSet requirements = command->GetRequirements();
- auto iter = requirements.begin();
- for (; iter != requirements.end(); iter++) Requires(*iter);
-}
-
-/**
- * Adds a new {@link Command Command} to the group with a given timeout.
- * The {@link Command Command} will be started after all the previously added
- * commands.
- *
- * <p>Once the {@link Command Command} is started, it will be run until it
- * finishes or the time expires, whichever is sooner. Note that the given
- * {@link Command Command} will have no knowledge that it is on a timer.</p>
- *
- * <p>Note that any requirements the given {@link Command Command} has will be
- * added to the group. For this reason, a {@link Command Command's}
- * requirements can not be changed after being added to a group.</p>
- *
- * <p>It is recommended that this method be called in the constructor.</p>
- *
- * @param command The {@link Command Command} to be added
- * @param timeout The timeout (in seconds)
- */
-void CommandGroup::AddSequential(Command* command, double timeout) {
- if (command == nullptr) {
- wpi_setWPIErrorWithContext(NullParameter, "command");
- return;
- }
- if (!AssertUnlocked("Cannot add new command to command group")) return;
- if (timeout < 0.0) {
- wpi_setWPIErrorWithContext(ParameterOutOfRange, "timeout < 0.0");
- return;
- }
-
- command->SetParent(this);
-
- m_commands.push_back(CommandGroupEntry(
- command, CommandGroupEntry::kSequence_InSequence, timeout));
- // Iterate through command->GetRequirements() and call Requires() on each
- // required subsystem
- Command::SubsystemSet requirements = command->GetRequirements();
- auto iter = requirements.begin();
- for (; iter != requirements.end(); iter++) Requires(*iter);
-}
-
-/**
- * Adds a new child {@link Command} to the group. The {@link Command} will be
- * started after all the previously added {@link Command Commands}.
- *
- * <p>Instead of waiting for the child to finish, a {@link CommandGroup} will
- * have it run at the same time as the subsequent {@link Command Commands}.
- * The child will run until either it finishes, a new child with conflicting
- * requirements is started, or the main sequence runs a {@link Command} with
- * conflicting requirements. In the latter two cases, the child will be
- * canceled even if it says it can't be interrupted.</p>
- *
- * <p>Note that any requirements the given {@link Command Command} has will be
- * added to the group. For this reason, a {@link Command Command's}
- * requirements can not be changed after being added to a group.</p>
- *
- * <p>It is recommended that this method be called in the constructor.</p>
- *
- * @param command The command to be added
- */
-void CommandGroup::AddParallel(Command* command) {
- if (command == nullptr) {
- wpi_setWPIErrorWithContext(NullParameter, "command");
- return;
- }
- if (!AssertUnlocked("Cannot add new command to command group")) return;
-
- command->SetParent(this);
-
- m_commands.push_back(
- CommandGroupEntry(command, CommandGroupEntry::kSequence_BranchChild));
- // Iterate through command->GetRequirements() and call Requires() on each
- // required subsystem
- Command::SubsystemSet requirements = command->GetRequirements();
- auto iter = requirements.begin();
- for (; iter != requirements.end(); iter++) Requires(*iter);
-}
-
-/**
- * Adds a new child {@link Command} to the group with the given timeout. The
- * {@link Command} will be started after all the previously added
- * {@link Command Commands}.
- *
- * <p>Once the {@link Command Command} is started, it will run until it
- * finishes, is interrupted, or the time expires, whichever is sooner. Note
- * that the given {@link Command Command} will have no knowledge that it is on
- * a timer.</p>
- *
- * <p>Instead of waiting for the child to finish, a {@link CommandGroup} will
- * have it run at the same time as the subsequent {@link Command Commands}.
- * The child will run until either it finishes, the timeout expires, a new
- * child with conflicting requirements is started, or the main sequence runs a
- * {@link Command} with conflicting requirements. In the latter two cases, the
- * child will be canceled even if it says it can't be interrupted.</p>
- *
- * <p>Note that any requirements the given {@link Command Command} has will be
- * added to the group. For this reason, a {@link Command Command's}
- * requirements can not be changed after being added to a group.</p>
- *
- * <p>It is recommended that this method be called in the constructor.</p>
- *
- * @param command The command to be added
- * @param timeout The timeout (in seconds)
- */
-void CommandGroup::AddParallel(Command* command, double timeout) {
- if (command == nullptr) {
- wpi_setWPIErrorWithContext(NullParameter, "command");
- return;
- }
- if (!AssertUnlocked("Cannot add new command to command group")) return;
- if (timeout < 0.0) {
- wpi_setWPIErrorWithContext(ParameterOutOfRange, "timeout < 0.0");
- return;
- }
-
- command->SetParent(this);
-
- m_commands.push_back(CommandGroupEntry(
- command, CommandGroupEntry::kSequence_BranchChild, timeout));
- // Iterate through command->GetRequirements() and call Requires() on each
- // required subsystem
- Command::SubsystemSet requirements = command->GetRequirements();
- auto iter = requirements.begin();
- for (; iter != requirements.end(); iter++) Requires(*iter);
-}
-
-void CommandGroup::_Initialize() { m_currentCommandIndex = -1; }
-
-void CommandGroup::_Execute() {
- CommandGroupEntry entry;
- Command* cmd = nullptr;
- bool firstRun = false;
-
- if (m_currentCommandIndex == -1) {
- firstRun = true;
- m_currentCommandIndex = 0;
- }
-
- while (static_cast<size_t>(m_currentCommandIndex) < m_commands.size()) {
- if (cmd != nullptr) {
- if (entry.IsTimedOut()) cmd->_Cancel();
-
- if (cmd->Run()) {
- break;
- } else {
- cmd->Removed();
- m_currentCommandIndex++;
- firstRun = true;
- cmd = nullptr;
- continue;
- }
- }
-
- entry = m_commands[m_currentCommandIndex];
- cmd = nullptr;
-
- switch (entry.m_state) {
- case CommandGroupEntry::kSequence_InSequence:
- cmd = entry.m_command;
- if (firstRun) {
- cmd->StartRunning();
- CancelConflicts(cmd);
- firstRun = false;
- }
- break;
-
- case CommandGroupEntry::kSequence_BranchPeer:
- m_currentCommandIndex++;
- entry.m_command->Start();
- break;
-
- case CommandGroupEntry::kSequence_BranchChild:
- m_currentCommandIndex++;
- CancelConflicts(entry.m_command);
- entry.m_command->StartRunning();
- m_children.push_back(entry);
- break;
- }
- }
-
- // Run Children
- auto iter = m_children.begin();
- for (; iter != m_children.end();) {
- entry = *iter;
- Command* child = entry.m_command;
- if (entry.IsTimedOut()) child->_Cancel();
-
- if (!child->Run()) {
- child->Removed();
- iter = m_children.erase(iter);
- } else {
- iter++;
- }
- }
-}
-
-void CommandGroup::_End() {
- // Theoretically, we don't have to check this, but we do if teams override the
- // IsFinished method
- if (m_currentCommandIndex != -1 &&
- static_cast<size_t>(m_currentCommandIndex) < m_commands.size()) {
- Command* cmd = m_commands[m_currentCommandIndex].m_command;
- cmd->_Cancel();
- cmd->Removed();
- }
-
- auto iter = m_children.begin();
- for (; iter != m_children.end(); iter++) {
- Command* cmd = iter->m_command;
- cmd->_Cancel();
- cmd->Removed();
- }
- m_children.clear();
-}
-
-void CommandGroup::_Interrupted() { _End(); }
-
-// Can be overwritten by teams
-void CommandGroup::Initialize() {}
-
-// Can be overwritten by teams
-void CommandGroup::Execute() {}
-
-// Can be overwritten by teams
-void CommandGroup::End() {}
-
-// Can be overwritten by teams
-void CommandGroup::Interrupted() {}
-
-bool CommandGroup::IsFinished() {
- return static_cast<size_t>(m_currentCommandIndex) >= m_commands.size() &&
- m_children.empty();
-}
-
-bool CommandGroup::IsInterruptible() const {
- if (!Command::IsInterruptible()) return false;
-
- if (m_currentCommandIndex != -1 &&
- static_cast<size_t>(m_currentCommandIndex) < m_commands.size()) {
- Command* cmd = m_commands[m_currentCommandIndex].m_command;
- if (!cmd->IsInterruptible()) return false;
- }
-
- auto iter = m_children.cbegin();
- for (; iter != m_children.cend(); iter++) {
- if (!iter->m_command->IsInterruptible()) return false;
- }
-
- return true;
-}
-
-void CommandGroup::CancelConflicts(Command* command) {
- auto childIter = m_children.begin();
- for (; childIter != m_children.end();) {
- Command* child = childIter->m_command;
- bool erased = false;
-
- Command::SubsystemSet requirements = command->GetRequirements();
- auto requirementIter = requirements.begin();
- for (; requirementIter != requirements.end(); requirementIter++) {
- if (child->DoesRequire(*requirementIter)) {
- child->_Cancel();
- child->Removed();
- childIter = m_children.erase(childIter);
- erased = true;
- break;
- }
- }
- if (!erased) childIter++;
- }
-}
-
-int CommandGroup::GetSize() const { return m_children.size(); }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/CommandGroupEntry.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/CommandGroupEntry.cpp
deleted file mode 100644
index 22476bb..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/CommandGroupEntry.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/CommandGroupEntry.h"
-
-#include "Commands/Command.h"
-
-using namespace frc;
-
-CommandGroupEntry::CommandGroupEntry(Command* command, Sequence state,
- double timeout)
- : m_timeout(timeout), m_command(command), m_state(state) {}
-
-bool CommandGroupEntry::IsTimedOut() const {
- if (m_timeout < 0.0) return false;
- double time = m_command->TimeSinceInitialized();
- if (time == 0.0) return false;
- return time >= m_timeout;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/ConditionalCommand.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/ConditionalCommand.cpp
deleted file mode 100644
index 6d36086..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/ConditionalCommand.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/ConditionalCommand.h"
-
-#include "Commands/Scheduler.h"
-
-using namespace frc;
-
-/**
- * Creates a new ConditionalCommand with given onTrue and onFalse Commands.
- *
- * @param onTrue The Command to execute if {@link
- * ConditionalCommand#Condition()} returns true
- * @param onFalse The Command to execute if {@link
- * ConditionalCommand#Condition()} returns false
- */
-ConditionalCommand::ConditionalCommand(Command* onTrue, Command* onFalse) {
- m_onTrue = onTrue;
- m_onFalse = onFalse;
-
- for (auto requirement : m_onTrue->GetRequirements()) Requires(requirement);
- for (auto requirement : m_onFalse->GetRequirements()) Requires(requirement);
-}
-
-/**
- * Creates a new ConditionalCommand with given onTrue and onFalse Commands.
- *
- * @param name the name for this command group
- * @param onTrue The Command to execute if {@link
- * ConditionalCommand#Condition()} returns true
- * @param onFalse The Command to execute if {@link
- * ConditionalCommand#Condition()} returns false
- */
-ConditionalCommand::ConditionalCommand(const std::string& name, Command* onTrue,
- Command* onFalse)
- : Command(name) {
- m_onTrue = onTrue;
- m_onFalse = onFalse;
-
- for (auto requirement : m_onTrue->GetRequirements()) Requires(requirement);
- for (auto requirement : m_onFalse->GetRequirements()) Requires(requirement);
-}
-
-void ConditionalCommand::_Initialize() {
- if (Condition()) {
- m_chosenCommand = m_onTrue;
- } else {
- m_chosenCommand = m_onFalse;
- }
-
- /*
- * This is a hack to make cancelling the chosen command inside a CommandGroup
- * work properly
- */
- m_chosenCommand->ClearRequirements();
-
- m_chosenCommand->Start();
-}
-
-void ConditionalCommand::_Cancel() {
- if (m_chosenCommand != nullptr && m_chosenCommand->IsRunning()) {
- m_chosenCommand->Cancel();
- }
-
- Command::_Cancel();
-}
-
-bool ConditionalCommand::IsFinished() {
- return m_chosenCommand != nullptr && m_chosenCommand->IsRunning() &&
- m_chosenCommand->IsFinished();
-}
-
-void ConditionalCommand::Interrupted() {
- if (m_chosenCommand != nullptr && m_chosenCommand->IsRunning()) {
- m_chosenCommand->Cancel();
- }
-
- Command::Interrupted();
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/InstantCommand.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/InstantCommand.cpp
deleted file mode 100644
index ddae80c..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/InstantCommand.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/InstantCommand.h"
-
-using namespace frc;
-
-/**
- * Creates a new {@link InstantCommand} with the given name.
- * @param name the name for this command
- */
-InstantCommand::InstantCommand(const std::string& name) : Command(name) {}
-
-bool InstantCommand::IsFinished() { return true; }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/PIDCommand.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/PIDCommand.cpp
deleted file mode 100644
index 44d96a6..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/PIDCommand.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/PIDCommand.h"
-
-#include <cfloat>
-
-using namespace frc;
-
-PIDCommand::PIDCommand(const std::string& name, double p, double i, double d,
- double f, double period)
- : Command(name) {
- m_controller = std::make_shared<PIDController>(p, i, d, this, this, period);
-}
-
-PIDCommand::PIDCommand(double p, double i, double d, double f, double period) {
- m_controller =
- std::make_shared<PIDController>(p, i, d, f, this, this, period);
-}
-
-PIDCommand::PIDCommand(const std::string& name, double p, double i, double d)
- : Command(name) {
- m_controller = std::make_shared<PIDController>(p, i, d, this, this);
-}
-
-PIDCommand::PIDCommand(const std::string& name, double p, double i, double d,
- double period)
- : Command(name) {
- m_controller = std::make_shared<PIDController>(p, i, d, this, this, period);
-}
-
-PIDCommand::PIDCommand(double p, double i, double d) {
- m_controller = std::make_shared<PIDController>(p, i, d, this, this);
-}
-
-PIDCommand::PIDCommand(double p, double i, double d, double period) {
- m_controller = std::make_shared<PIDController>(p, i, d, this, this, period);
-}
-
-void PIDCommand::_Initialize() { m_controller->Enable(); }
-
-void PIDCommand::_End() { m_controller->Disable(); }
-
-void PIDCommand::_Interrupted() { _End(); }
-
-void PIDCommand::SetSetpointRelative(double deltaSetpoint) {
- SetSetpoint(GetSetpoint() + deltaSetpoint);
-}
-
-void PIDCommand::PIDWrite(double output) { UsePIDOutput(output); }
-
-double PIDCommand::PIDGet() { return ReturnPIDInput(); }
-
-std::shared_ptr<PIDController> PIDCommand::GetPIDController() const {
- return m_controller;
-}
-
-void PIDCommand::SetSetpoint(double setpoint) {
- m_controller->SetSetpoint(setpoint);
-}
-
-double PIDCommand::GetSetpoint() const { return m_controller->GetSetpoint(); }
-
-double PIDCommand::GetPosition() { return ReturnPIDInput(); }
-
-std::string PIDCommand::GetSmartDashboardType() const { return "PIDCommand"; }
-
-void PIDCommand::InitTable(std::shared_ptr<ITable> subtable) {
- m_controller->InitTable(subtable);
- Command::InitTable(subtable);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/PIDSubsystem.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/PIDSubsystem.cpp
deleted file mode 100644
index 89146e6..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/PIDSubsystem.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/PIDSubsystem.h"
-
-#include "PIDController.h"
-
-using namespace frc;
-
-/**
- * Instantiates a {@link PIDSubsystem} that will use the given p, i and d
- * values.
- *
- * @param name the name
- * @param p the proportional value
- * @param i the integral value
- * @param d the derivative value
- */
-PIDSubsystem::PIDSubsystem(const std::string& name, double p, double i,
- double d)
- : Subsystem(name) {
- m_controller = std::make_shared<PIDController>(p, i, d, this, this);
-}
-
-/**
- * Instantiates a {@link PIDSubsystem} that will use the given p, i and d
- * values.
- *
- * @param name the name
- * @param p the proportional value
- * @param i the integral value
- * @param d the derivative value
- * @param f the feedforward value
- */
-PIDSubsystem::PIDSubsystem(const std::string& name, double p, double i,
- double d, double f)
- : Subsystem(name) {
- m_controller = std::make_shared<PIDController>(p, i, d, f, this, this);
-}
-
-/**
- * Instantiates a {@link PIDSubsystem} that will use the given p, i and d
- * values.
- *
- * It will also space the time between PID loop calculations to be equal to the
- * given period.
- *
- * @param name the name
- * @param p the proportional value
- * @param i the integral value
- * @param d the derivative value
- * @param f the feedfoward value
- * @param period the time (in seconds) between calculations
- */
-PIDSubsystem::PIDSubsystem(const std::string& name, double p, double i,
- double d, double f, double period)
- : Subsystem(name) {
- m_controller =
- std::make_shared<PIDController>(p, i, d, f, this, this, period);
-}
-
-/**
- * Instantiates a {@link PIDSubsystem} that will use the given p, i and d
- * values.
- *
- * It will use the class name as its name.
- *
- * @param p the proportional value
- * @param i the integral value
- * @param d the derivative value
- */
-PIDSubsystem::PIDSubsystem(double p, double i, double d)
- : Subsystem("PIDSubsystem") {
- m_controller = std::make_shared<PIDController>(p, i, d, this, this);
-}
-
-/**
- * Instantiates a {@link PIDSubsystem} that will use the given p, i and d
- * values.
- *
- * It will use the class name as its name.
- *
- * @param p the proportional value
- * @param i the integral value
- * @param d the derivative value
- * @param f the feedforward value
- */
-PIDSubsystem::PIDSubsystem(double p, double i, double d, double f)
- : Subsystem("PIDSubsystem") {
- m_controller = std::make_shared<PIDController>(p, i, d, f, this, this);
-}
-
-/**
- * Instantiates a {@link PIDSubsystem} that will use the given p, i and d
- * values.
- *
- * It will use the class name as its name. It will also space the time
- * between PID loop calculations to be equal to the given period.
- *
- * @param p the proportional value
- * @param i the integral value
- * @param d the derivative value
- * @param f the feedforward value
- * @param period the time (in seconds) between calculations
- */
-PIDSubsystem::PIDSubsystem(double p, double i, double d, double f,
- double period)
- : Subsystem("PIDSubsystem") {
- m_controller =
- std::make_shared<PIDController>(p, i, d, f, this, this, period);
-}
-
-/**
- * Enables the internal {@link PIDController}.
- */
-void PIDSubsystem::Enable() { m_controller->Enable(); }
-
-/**
- * Disables the internal {@link PIDController}.
- */
-void PIDSubsystem::Disable() { m_controller->Disable(); }
-
-/**
- * Returns the {@link PIDController} used by this {@link PIDSubsystem}.
- *
- * Use this if you would like to fine tune the pid loop.
- *
- * @return the {@link PIDController} used by this {@link PIDSubsystem}
- */
-std::shared_ptr<PIDController> PIDSubsystem::GetPIDController() {
- return m_controller;
-}
-
-/**
- * Sets the setpoint to the given value.
- *
- * If {@link PIDCommand#SetRange(double, double) SetRange(...)} was called,
- * then the given setpoint will be trimmed to fit within the range.
- *
- * @param setpoint the new setpoint
- */
-void PIDSubsystem::SetSetpoint(double setpoint) {
- m_controller->SetSetpoint(setpoint);
-}
-
-/**
- * Adds the given value to the setpoint.
- *
- * If {@link PIDCommand#SetRange(double, double) SetRange(...)} was used,
- * then the bounds will still be honored by this method.
- *
- * @param deltaSetpoint the change in the setpoint
- */
-void PIDSubsystem::SetSetpointRelative(double deltaSetpoint) {
- SetSetpoint(GetSetpoint() + deltaSetpoint);
-}
-
-/**
- * Return the current setpoint.
- *
- * @return The current setpoint
- */
-double PIDSubsystem::GetSetpoint() { return m_controller->GetSetpoint(); }
-
-/**
- * Sets the maximum and minimum values expected from the input.
- *
- * @param minimumInput the minimum value expected from the input
- * @param maximumInput the maximum value expected from the output
- */
-void PIDSubsystem::SetInputRange(double minimumInput, double maximumInput) {
- m_controller->SetInputRange(minimumInput, maximumInput);
-}
-
-/**
- * Sets the maximum and minimum values to write.
- *
- * @param minimumOutput the minimum value to write to the output
- * @param maximumOutput the maximum value to write to the output
- */
-void PIDSubsystem::SetOutputRange(double minimumOutput, double maximumOutput) {
- m_controller->SetOutputRange(minimumOutput, maximumOutput);
-}
-
-/**
- * Set the absolute error which is considered tolerable for use with
- * OnTarget.
- *
- * @param absValue absolute error which is tolerable
- */
-void PIDSubsystem::SetAbsoluteTolerance(double absValue) {
- m_controller->SetAbsoluteTolerance(absValue);
-}
-
-/**
- * Set the percentage error which is considered tolerable for use with OnTarget.
- *
- * @param percent percentage error which is tolerable
- */
-void PIDSubsystem::SetPercentTolerance(double percent) {
- m_controller->SetPercentTolerance(percent);
-}
-
-/**
- * Return true if the error is within the percentage of the total input range,
- * determined by SetTolerance.
- *
- * This asssumes that the maximum and minimum input were set using SetInput.
- * Use OnTarget() in the IsFinished() method of commands that use this
- * subsystem.
- *
- * Currently this just reports on target as the actual value passes through the
- * setpoint. Ideally it should be based on being within the tolerance for some
- * period of time.
- *
- * @return true if the error is within the percentage tolerance of the input
- * range
- */
-bool PIDSubsystem::OnTarget() const { return m_controller->OnTarget(); }
-
-/**
- * Returns the current position.
- *
- * @return the current position
- */
-double PIDSubsystem::GetPosition() { return ReturnPIDInput(); }
-
-/**
- * Returns the current rate.
- *
- * @return the current rate
- */
-double PIDSubsystem::GetRate() { return ReturnPIDInput(); }
-
-void PIDSubsystem::PIDWrite(double output) { UsePIDOutput(output); }
-
-double PIDSubsystem::PIDGet() { return ReturnPIDInput(); }
-
-std::string PIDSubsystem::GetSmartDashboardType() const { return "PIDCommand"; }
-
-void PIDSubsystem::InitTable(std::shared_ptr<ITable> subtable) {
- m_controller->InitTable(subtable);
- Subsystem::InitTable(subtable);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/PrintCommand.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/PrintCommand.cpp
deleted file mode 100644
index afdcad5..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/PrintCommand.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/PrintCommand.h"
-
-#include <iostream>
-
-using namespace frc;
-
-PrintCommand::PrintCommand(const std::string& message)
- : InstantCommand("Print \"" + message + "\"") {
- m_message = message;
-}
-
-void PrintCommand::Initialize() { std::cout << m_message << "\n"; }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/Scheduler.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/Scheduler.cpp
deleted file mode 100644
index aa325b4..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/Scheduler.cpp
+++ /dev/null
@@ -1,279 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/Scheduler.h"
-
-#include <algorithm>
-#include <iostream>
-#include <set>
-
-#include "Buttons/ButtonScheduler.h"
-#include "Commands/Subsystem.h"
-#include "HLUsageReporting.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-Scheduler::Scheduler() { HLUsageReporting::ReportScheduler(); }
-
-/**
- * Returns the {@link Scheduler}, creating it if one does not exist.
- *
- * @return the {@link Scheduler}
- */
-Scheduler* Scheduler::GetInstance() {
- static Scheduler instance;
- return &instance;
-}
-
-void Scheduler::SetEnabled(bool enabled) { m_enabled = enabled; }
-
-/**
- * Add a command to be scheduled later.
- *
- * In any pass through the scheduler, all commands are added to the additions
- * list, then at the end of the pass, they are all scheduled.
- *
- * @param command The command to be scheduled
- */
-void Scheduler::AddCommand(Command* command) {
- std::lock_guard<priority_mutex> sync(m_additionsLock);
- if (std::find(m_additions.begin(), m_additions.end(), command) !=
- m_additions.end())
- return;
- m_additions.push_back(command);
-}
-
-void Scheduler::AddButton(ButtonScheduler* button) {
- std::lock_guard<priority_mutex> sync(m_buttonsLock);
- m_buttons.push_back(button);
-}
-
-void Scheduler::ProcessCommandAddition(Command* command) {
- if (command == nullptr) return;
-
- // Check to make sure no adding during adding
- if (m_adding) {
- wpi_setWPIErrorWithContext(IncompatibleState,
- "Can not start command from cancel method");
- return;
- }
-
- // Only add if not already in
- auto found = m_commands.find(command);
- if (found == m_commands.end()) {
- // Check that the requirements can be had
- Command::SubsystemSet requirements = command->GetRequirements();
- Command::SubsystemSet::iterator iter;
- for (iter = requirements.begin(); iter != requirements.end(); iter++) {
- Subsystem* lock = *iter;
- if (lock->GetCurrentCommand() != nullptr &&
- !lock->GetCurrentCommand()->IsInterruptible())
- return;
- }
-
- // Give it the requirements
- m_adding = true;
- for (iter = requirements.begin(); iter != requirements.end(); iter++) {
- Subsystem* lock = *iter;
- if (lock->GetCurrentCommand() != nullptr) {
- lock->GetCurrentCommand()->Cancel();
- Remove(lock->GetCurrentCommand());
- }
- lock->SetCurrentCommand(command);
- }
- m_adding = false;
-
- m_commands.insert(command);
-
- command->StartRunning();
- m_runningCommandsChanged = true;
- }
-}
-
-/**
- * Runs a single iteration of the loop.
- *
- * This method should be called often in order to have a functioning
- * {@link Command} system. The loop has five stages:
- *
- * <ol>
- * <li> Poll the Buttons </li>
- * <li> Execute/Remove the Commands </li>
- * <li> Send values to SmartDashboard </li>
- * <li> Add Commands </li>
- * <li> Add Defaults </li>
- * </ol>
- */
-void Scheduler::Run() {
- // Get button input (going backwards preserves button priority)
- {
- if (!m_enabled) return;
-
- std::lock_guard<priority_mutex> sync(m_buttonsLock);
- auto rButtonIter = m_buttons.rbegin();
- for (; rButtonIter != m_buttons.rend(); rButtonIter++) {
- (*rButtonIter)->Execute();
- }
- }
-
- m_runningCommandsChanged = false;
-
- // Loop through the commands
- auto commandIter = m_commands.begin();
- for (; commandIter != m_commands.end();) {
- Command* command = *commandIter;
- // Increment before potentially removing to keep the iterator valid
- commandIter++;
- if (!command->Run()) {
- Remove(command);
- m_runningCommandsChanged = true;
- }
- }
-
- // Add the new things
- {
- std::lock_guard<priority_mutex> sync(m_additionsLock);
- auto additionsIter = m_additions.begin();
- for (; additionsIter != m_additions.end(); additionsIter++) {
- ProcessCommandAddition(*additionsIter);
- }
- m_additions.clear();
- }
-
- // Add in the defaults
- auto subsystemIter = m_subsystems.begin();
- for (; subsystemIter != m_subsystems.end(); subsystemIter++) {
- Subsystem* lock = *subsystemIter;
- if (lock->GetCurrentCommand() == nullptr) {
- ProcessCommandAddition(lock->GetDefaultCommand());
- }
- lock->ConfirmCommand();
- }
-
- UpdateTable();
-}
-
-/**
- * Registers a {@link Subsystem} to this {@link Scheduler}, so that the {@link
- * Scheduler} might know if a default {@link Command} needs to be run.
- *
- * All {@link Subsystem Subsystems} should call this.
- *
- * @param system the system
- */
-void Scheduler::RegisterSubsystem(Subsystem* subsystem) {
- if (subsystem == nullptr) {
- wpi_setWPIErrorWithContext(NullParameter, "subsystem");
- return;
- }
- m_subsystems.insert(subsystem);
-}
-
-/**
- * Removes the {@link Command} from the {@link Scheduler}.
- *
- * @param command the command to remove
- */
-void Scheduler::Remove(Command* command) {
- if (command == nullptr) {
- wpi_setWPIErrorWithContext(NullParameter, "command");
- return;
- }
-
- if (!m_commands.erase(command)) return;
-
- Command::SubsystemSet requirements = command->GetRequirements();
- auto iter = requirements.begin();
- for (; iter != requirements.end(); iter++) {
- Subsystem* lock = *iter;
- lock->SetCurrentCommand(nullptr);
- }
-
- command->Removed();
-}
-
-void Scheduler::RemoveAll() {
- while (m_commands.size() > 0) {
- Remove(*m_commands.begin());
- }
-}
-
-/**
- * Completely resets the scheduler. Undefined behavior if running.
- */
-void Scheduler::ResetAll() {
- RemoveAll();
- m_subsystems.clear();
- m_buttons.clear();
- m_additions.clear();
- m_commands.clear();
- m_table = nullptr;
-}
-
-/**
- * Update the network tables associated with the Scheduler object on the
- * SmartDashboard.
- */
-void Scheduler::UpdateTable() {
- CommandSet::iterator commandIter;
- if (m_table != nullptr) {
- // Get the list of possible commands to cancel
- auto new_toCancel = m_table->GetValue("Cancel");
- if (new_toCancel)
- toCancel = new_toCancel->GetDoubleArray();
- else
- toCancel.resize(0);
- // m_table->RetrieveValue("Ids", *ids);
-
- // cancel commands that have had the cancel buttons pressed
- // on the SmartDashboad
- if (!toCancel.empty()) {
- for (commandIter = m_commands.begin(); commandIter != m_commands.end();
- ++commandIter) {
- for (size_t i = 0; i < toCancel.size(); i++) {
- Command* c = *commandIter;
- if (c->GetID() == toCancel[i]) {
- c->Cancel();
- }
- }
- }
- toCancel.resize(0);
- m_table->PutValue("Cancel", nt::Value::MakeDoubleArray(toCancel));
- }
-
- // Set the running commands
- if (m_runningCommandsChanged) {
- commands.resize(0);
- ids.resize(0);
- for (commandIter = m_commands.begin(); commandIter != m_commands.end();
- ++commandIter) {
- Command* c = *commandIter;
- commands.push_back(c->GetName());
- ids.push_back(c->GetID());
- }
- m_table->PutValue("Names", nt::Value::MakeStringArray(commands));
- m_table->PutValue("Ids", nt::Value::MakeDoubleArray(ids));
- }
- }
-}
-
-std::string Scheduler::GetName() const { return "Scheduler"; }
-
-std::string Scheduler::GetType() const { return "Scheduler"; }
-
-std::string Scheduler::GetSmartDashboardType() const { return "Scheduler"; }
-
-void Scheduler::InitTable(std::shared_ptr<ITable> subTable) {
- m_table = subTable;
-
- m_table->PutValue("Names", nt::Value::MakeStringArray(commands));
- m_table->PutValue("Ids", nt::Value::MakeDoubleArray(ids));
- m_table->PutValue("Cancel", nt::Value::MakeDoubleArray(toCancel));
-}
-
-std::shared_ptr<ITable> Scheduler::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/StartCommand.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/StartCommand.cpp
deleted file mode 100644
index 8b66c40..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/StartCommand.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/StartCommand.h"
-
-using namespace frc;
-
-StartCommand::StartCommand(Command* commandToStart)
- : InstantCommand("StartCommand") {
- m_commandToFork = commandToStart;
-}
-
-void StartCommand::Initialize() { m_commandToFork->Start(); }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/Subsystem.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/Subsystem.cpp
deleted file mode 100644
index 404d74f..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/Subsystem.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/Subsystem.h"
-
-#include "Commands/Command.h"
-#include "Commands/Scheduler.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Creates a subsystem with the given name.
- *
- * @param name the name of the subsystem
- */
-Subsystem::Subsystem(const std::string& name) {
- m_name = name;
- Scheduler::GetInstance()->RegisterSubsystem(this);
-}
-/**
- * Initialize the default command for this subsystem.
- *
- * This is meant to be the place to call SetDefaultCommand in a subsystem and
- * will be called on all the subsystems by the CommandBase method before the
- * program starts running by using the list of all registered Subsystems inside
- * the Scheduler.
- *
- * This should be overridden by a Subsystem that has a default Command
- */
-void Subsystem::InitDefaultCommand() {}
-
-/**
- * Sets the default command. If this is not called or is called with null,
- * then there will be no default command for the subsystem.
- *
- * <p><b>WARNING:</b> This should <b>NOT</b> be called in a constructor if the
- * subsystem is a singleton.</p>
- *
- * @param command the default command (or null if there should be none)
- */
-void Subsystem::SetDefaultCommand(Command* command) {
- if (command == nullptr) {
- m_defaultCommand = nullptr;
- } else {
- bool found = false;
- Command::SubsystemSet requirements = command->GetRequirements();
- auto iter = requirements.begin();
- for (; iter != requirements.end(); iter++) {
- if (*iter == this) {
- found = true;
- break;
- }
- }
-
- if (!found) {
- wpi_setWPIErrorWithContext(
- CommandIllegalUse, "A default command must require the subsystem");
- return;
- }
-
- m_defaultCommand = command;
- }
- if (m_table != nullptr) {
- if (m_defaultCommand != nullptr) {
- m_table->PutBoolean("hasDefault", true);
- m_table->PutString("default", m_defaultCommand->GetName());
- } else {
- m_table->PutBoolean("hasDefault", false);
- }
- }
-}
-
-/**
- * Returns the default command (or null if there is none).
- *
- * @return the default command
- */
-Command* Subsystem::GetDefaultCommand() {
- if (!m_initializedDefaultCommand) {
- m_initializedDefaultCommand = true;
- InitDefaultCommand();
- }
- return m_defaultCommand;
-}
-
-/**
- * Sets the current command.
- *
- * @param command the new current command
- */
-void Subsystem::SetCurrentCommand(Command* command) {
- m_currentCommand = command;
- m_currentCommandChanged = true;
-}
-
-/**
- * Returns the command which currently claims this subsystem.
- *
- * @return the command which currently claims this subsystem
- */
-Command* Subsystem::GetCurrentCommand() const { return m_currentCommand; }
-
-/**
- * Call this to alert Subsystem that the current command is actually the
- * command.
- *
- * Sometimes, the {@link Subsystem} is told that it has no command while the
- * {@link Scheduler} is going through the loop, only to be soon after given a
- * new one. This will avoid that situation.
- */
-void Subsystem::ConfirmCommand() {
- if (m_currentCommandChanged) {
- if (m_table != nullptr) {
- if (m_currentCommand != nullptr) {
- m_table->PutBoolean("hasCommand", true);
- m_table->PutString("command", m_currentCommand->GetName());
- } else {
- m_table->PutBoolean("hasCommand", false);
- }
- }
- m_currentCommandChanged = false;
- }
-}
-
-std::string Subsystem::GetName() const { return m_name; }
-
-std::string Subsystem::GetSmartDashboardType() const { return "Subsystem"; }
-
-void Subsystem::InitTable(std::shared_ptr<ITable> subtable) {
- m_table = subtable;
- if (m_table != nullptr) {
- if (m_defaultCommand != nullptr) {
- m_table->PutBoolean("hasDefault", true);
- m_table->PutString("default", m_defaultCommand->GetName());
- } else {
- m_table->PutBoolean("hasDefault", false);
- }
- if (m_currentCommand != nullptr) {
- m_table->PutBoolean("hasCommand", true);
- m_table->PutString("command", m_currentCommand->GetName());
- } else {
- m_table->PutBoolean("hasCommand", false);
- }
- }
-}
-
-std::shared_ptr<ITable> Subsystem::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/TimedCommand.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/TimedCommand.cpp
deleted file mode 100644
index d910749..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/TimedCommand.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/TimedCommand.h"
-
-using namespace frc;
-
-TimedCommand::TimedCommand(const std::string& name, double timeout)
- : Command(name, timeout) {}
-
-TimedCommand::TimedCommand(double timeout) : Command(timeout) {}
-
-bool TimedCommand::IsFinished() { return IsTimedOut(); }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/WaitCommand.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/WaitCommand.cpp
deleted file mode 100644
index 8bda85b..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/WaitCommand.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/WaitCommand.h"
-
-using namespace frc;
-
-WaitCommand::WaitCommand(double timeout)
- : TimedCommand("Wait(" + std::to_string(timeout) + ")", timeout) {}
-
-WaitCommand::WaitCommand(const std::string& name, double timeout)
- : TimedCommand(name, timeout) {}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/WaitForChildren.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/WaitForChildren.cpp
deleted file mode 100644
index e796299..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/WaitForChildren.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/WaitForChildren.h"
-
-#include "Commands/CommandGroup.h"
-
-using namespace frc;
-
-WaitForChildren::WaitForChildren(double timeout)
- : Command("WaitForChildren", timeout) {}
-
-WaitForChildren::WaitForChildren(const std::string& name, double timeout)
- : Command(name, timeout) {}
-
-bool WaitForChildren::IsFinished() {
- return GetGroup() == nullptr || GetGroup()->GetSize() == 0;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/WaitUntilCommand.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Commands/WaitUntilCommand.cpp
deleted file mode 100644
index b9bffb4..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Commands/WaitUntilCommand.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/WaitUntilCommand.h"
-
-#include "Timer.h"
-
-using namespace frc;
-
-/**
- * A {@link WaitCommand} will wait until a certain match time before finishing.
- *
- * This will wait until the game clock reaches some value, then continue to the
- * next command.
- * @see CommandGroup
- */
-WaitUntilCommand::WaitUntilCommand(double time)
- : Command("WaitUntilCommand", time) {
- m_time = time;
-}
-
-WaitUntilCommand::WaitUntilCommand(const std::string& name, double time)
- : Command(name, time) {
- m_time = time;
-}
-
-/**
- * Check if we've reached the actual finish time.
- */
-bool WaitUntilCommand::IsFinished() { return Timer::GetMatchTime() >= m_time; }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Error.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Error.cpp
deleted file mode 100644
index b853b50..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Error.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Error.h"
-
-#include <sstream>
-
-#include "DriverStation.h"
-#include "Timer.h"
-#include "Utility.h"
-
-using namespace frc;
-
-void Error::Clone(const Error& error) {
- m_code = error.m_code;
- m_message = error.m_message;
- m_filename = error.m_filename;
- m_function = error.m_function;
- m_lineNumber = error.m_lineNumber;
- m_originatingObject = error.m_originatingObject;
- m_timestamp = error.m_timestamp;
-}
-
-Error::Code Error::GetCode() const { return m_code; }
-
-std::string Error::GetMessage() const { return m_message; }
-
-std::string Error::GetFilename() const { return m_filename; }
-
-std::string Error::GetFunction() const { return m_function; }
-
-int Error::GetLineNumber() const { return m_lineNumber; }
-
-const ErrorBase* Error::GetOriginatingObject() const {
- return m_originatingObject;
-}
-
-double Error::GetTimestamp() const { return m_timestamp; }
-
-void Error::Set(Code code, llvm::StringRef contextMessage,
- llvm::StringRef filename, llvm::StringRef function,
- int lineNumber, const ErrorBase* originatingObject) {
- bool report = true;
-
- if (code == m_code && GetTime() - m_timestamp < 1) {
- report = false;
- }
-
- m_code = code;
- m_message = contextMessage;
- m_filename = filename;
- m_function = function;
- m_lineNumber = lineNumber;
- m_originatingObject = originatingObject;
-
- if (report) {
- m_timestamp = GetTime();
- Report();
- }
-}
-
-void Error::Report() {
- std::stringstream locStream;
- locStream << m_function << " [";
-
-#if defined(_WIN32)
- const int MAX_DIR = 100;
- char basename[MAX_DIR];
- _splitpath_s(m_filename.c_str(), nullptr, 0, basename, MAX_DIR, nullptr, 0,
- nullptr, 0);
- locStream << basename;
-#else
- locStream << basename(m_filename.c_str());
-#endif
- locStream << ":" << m_lineNumber << "]";
-
- DriverStation::ReportError(true, m_code, m_message, locStream.str(),
- GetStackTrace(4));
-}
-
-void Error::Clear() {
- m_code = 0;
- m_message = "";
- m_filename = "";
- m_function = "";
- m_lineNumber = 0;
- m_originatingObject = nullptr;
- m_timestamp = 0.0;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/ErrorBase.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/ErrorBase.cpp
deleted file mode 100644
index 3323fe2..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/ErrorBase.cpp
+++ /dev/null
@@ -1,231 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "ErrorBase.h"
-
-#include <cerrno>
-#include <cstdio>
-#include <cstring>
-#include <iomanip>
-#include <sstream>
-
-#define WPI_ERRORS_DEFINE_STRINGS
-#include "WPIErrors.h"
-
-using namespace frc;
-
-priority_mutex ErrorBase::_globalErrorMutex;
-Error ErrorBase::_globalError;
-
-/**
- * @brief Retrieve the current error.
- * Get the current error information associated with this sensor.
- */
-Error& ErrorBase::GetError() { return m_error; }
-
-const Error& ErrorBase::GetError() const { return m_error; }
-
-/**
- * @brief Clear the current error information associated with this sensor.
- */
-void ErrorBase::ClearError() const { m_error.Clear(); }
-
-/**
- * @brief Set error information associated with a C library call that set an
- * error to the "errno" global variable.
- *
- * @param contextMessage A custom message from the code that set the error.
- * @param filename Filename of the error source
- * @param function Function of the error source
- * @param lineNumber Line number of the error source
- */
-void ErrorBase::SetErrnoError(llvm::StringRef contextMessage,
- llvm::StringRef filename,
- llvm::StringRef function, int lineNumber) const {
- std::string err;
- int errNo = errno;
- if (errNo == 0) {
- err = "OK: ";
- err += contextMessage;
- } else {
- std::ostringstream oss;
- oss << std::strerror(errNo) << " (0x" << std::setfill('0') << std::hex
- << std::uppercase << std::setw(8) << errNo << "): " << contextMessage;
- err = oss.str();
- }
-
- // Set the current error information for this object.
- m_error.Set(-1, err, filename, function, lineNumber, this);
-
- // Update the global error if there is not one already set.
- std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
- if (_globalError.GetCode() == 0) {
- _globalError.Clone(m_error);
- }
-}
-
-/**
- * @brief Set the current error information associated from the nivision Imaq
- * API.
- *
- * @param success The return from the function
- * @param contextMessage A custom message from the code that set the error.
- * @param filename Filename of the error source
- * @param function Function of the error source
- * @param lineNumber Line number of the error source
- */
-void ErrorBase::SetImaqError(int success, llvm::StringRef contextMessage,
- llvm::StringRef filename, llvm::StringRef function,
- int lineNumber) const {
- // If there was an error
- if (success <= 0) {
- std::stringstream err;
- err << success << ": " << contextMessage;
-
- // Set the current error information for this object.
- m_error.Set(success, err.str(), filename, function, lineNumber, this);
-
- // Update the global error if there is not one already set.
- std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
- if (_globalError.GetCode() == 0) {
- _globalError.Clone(m_error);
- }
- }
-}
-
-/**
- * @brief Set the current error information associated with this sensor.
- *
- * @param code The error code
- * @param contextMessage A custom message from the code that set the error.
- * @param filename Filename of the error source
- * @param function Function of the error source
- * @param lineNumber Line number of the error source
- */
-void ErrorBase::SetError(Error::Code code, llvm::StringRef contextMessage,
- llvm::StringRef filename, llvm::StringRef function,
- int lineNumber) const {
- // If there was an error
- if (code != 0) {
- // Set the current error information for this object.
- m_error.Set(code, contextMessage, filename, function, lineNumber, this);
-
- // Update the global error if there is not one already set.
- std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
- if (_globalError.GetCode() == 0) {
- _globalError.Clone(m_error);
- }
- }
-}
-
-/**
- * @brief Set the current error information associated with this sensor.
- * Range versions use for initialization code.
- *
- * @param code The error code
- * @param minRange The minimum allowed allocation range
- * @param maxRange The maximum allowed allocation range
- * @param requestedValue The requested value to allocate
- * @param contextMessage A custom message from the code that set the error.
- * @param filename Filename of the error source
- * @param function Function of the error source
- * @param lineNumber Line number of the error source
- */
-void ErrorBase::SetErrorRange(Error::Code code, int32_t minRange,
- int32_t maxRange, int32_t requestedValue,
- llvm::StringRef contextMessage,
- llvm::StringRef filename,
- llvm::StringRef function, int lineNumber) const {
- // If there was an error
- if (code != 0) {
- size_t size = contextMessage.size() + 100;
- char* buf = new char[size];
- std::snprintf(
- buf, size,
- "%s, Minimum Value: %d, Maximum Value: %d, Requested Value: %d",
- contextMessage.data(), minRange, maxRange, requestedValue);
- // Set the current error information for this object.
- m_error.Set(code, buf, filename, function, lineNumber, this);
- delete[] buf;
-
- // Update the global error if there is not one already set.
- std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
- if (_globalError.GetCode() == 0) {
- _globalError.Clone(m_error);
- }
- }
-}
-
-/**
- * @brief Set the current error information associated with this sensor.
- *
- * @param errorMessage The error message from WPIErrors.h
- * @param contextMessage A custom message from the code that set the error.
- * @param filename Filename of the error source
- * @param function Function of the error source
- * @param lineNumber Line number of the error source
- */
-void ErrorBase::SetWPIError(llvm::StringRef errorMessage, Error::Code code,
- llvm::StringRef contextMessage,
- llvm::StringRef filename, llvm::StringRef function,
- int lineNumber) const {
- std::string err = errorMessage.str() + ": " + contextMessage.str();
-
- // Set the current error information for this object.
- m_error.Set(code, err, filename, function, lineNumber, this);
-
- // Update the global error if there is not one already set.
- std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
- if (_globalError.GetCode() == 0) {
- _globalError.Clone(m_error);
- }
-}
-
-void ErrorBase::CloneError(const ErrorBase& rhs) const {
- m_error.Clone(rhs.GetError());
-}
-
-/**
- * @brief Check if the current error code represents a fatal error.
- *
- * @return true if the current error is fatal.
- */
-bool ErrorBase::StatusIsFatal() const { return m_error.GetCode() < 0; }
-
-void ErrorBase::SetGlobalError(Error::Code code, llvm::StringRef contextMessage,
- llvm::StringRef filename,
- llvm::StringRef function, int lineNumber) {
- // If there was an error
- if (code != 0) {
- std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
-
- // Set the current error information for this object.
- _globalError.Set(code, contextMessage, filename, function, lineNumber,
- nullptr);
- }
-}
-
-void ErrorBase::SetGlobalWPIError(llvm::StringRef errorMessage,
- llvm::StringRef contextMessage,
- llvm::StringRef filename,
- llvm::StringRef function, int lineNumber) {
- std::string err = errorMessage.str() + ": " + contextMessage.str();
-
- std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
- if (_globalError.GetCode() != 0) {
- _globalError.Clear();
- }
- _globalError.Set(-1, err, filename, function, lineNumber, nullptr);
-}
-
-/**
- * Retrieve the current global error.
- */
-Error& ErrorBase::GetGlobalError() {
- std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
- return _globalError;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Filters/Filter.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Filters/Filter.cpp
deleted file mode 100644
index d2ac725..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Filters/Filter.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Filters/Filter.h"
-
-using namespace frc;
-
-Filter::Filter(std::shared_ptr<PIDSource> source) { m_source = source; }
-
-void Filter::SetPIDSourceType(PIDSourceType pidSource) {
- m_source->SetPIDSourceType(pidSource);
-}
-
-PIDSourceType Filter::GetPIDSourceType() const {
- return m_source->GetPIDSourceType();
-}
-
-double Filter::PIDGetSource() { return m_source->PIDGet(); }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Filters/LinearDigitalFilter.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Filters/LinearDigitalFilter.cpp
deleted file mode 100644
index af04fcb..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Filters/LinearDigitalFilter.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Filters/LinearDigitalFilter.h"
-
-#include <cassert>
-#include <cmath>
-
-using namespace frc;
-
-/**
- * Create a linear FIR or IIR filter.
- *
- * @param source The PIDSource object that is used to get values
- * @param ffGains The "feed forward" or FIR gains
- * @param fbGains The "feed back" or IIR gains
- */
-LinearDigitalFilter::LinearDigitalFilter(std::shared_ptr<PIDSource> source,
- std::initializer_list<double> ffGains,
- std::initializer_list<double> fbGains)
- : Filter(source),
- m_inputs(ffGains.size()),
- m_outputs(fbGains.size()),
- m_inputGains(ffGains),
- m_outputGains(fbGains) {}
-
-/**
- * Create a linear FIR or IIR filter.
- *
- * @param source The PIDSource object that is used to get values
- * @param ffGains The "feed forward" or FIR gains
- * @param fbGains The "feed back" or IIR gains
- */
-LinearDigitalFilter::LinearDigitalFilter(std::shared_ptr<PIDSource> source,
- std::initializer_list<double> ffGains,
- const std::vector<double>& fbGains)
- : Filter(source),
- m_inputs(ffGains.size()),
- m_outputs(fbGains.size()),
- m_inputGains(ffGains),
- m_outputGains(fbGains) {}
-
-/**
- * Create a linear FIR or IIR filter.
- *
- * @param source The PIDSource object that is used to get values
- * @param ffGains The "feed forward" or FIR gains
- * @param fbGains The "feed back" or IIR gains
- */
-LinearDigitalFilter::LinearDigitalFilter(std::shared_ptr<PIDSource> source,
- const std::vector<double>& ffGains,
- std::initializer_list<double> fbGains)
- : Filter(source),
- m_inputs(ffGains.size()),
- m_outputs(fbGains.size()),
- m_inputGains(ffGains),
- m_outputGains(fbGains) {}
-
-/**
- * Create a linear FIR or IIR filter.
- *
- * @param source The PIDSource object that is used to get values
- * @param ffGains The "feed forward" or FIR gains
- * @param fbGains The "feed back" or IIR gains
- */
-LinearDigitalFilter::LinearDigitalFilter(std::shared_ptr<PIDSource> source,
- const std::vector<double>& ffGains,
- const std::vector<double>& fbGains)
- : Filter(source),
- m_inputs(ffGains.size()),
- m_outputs(fbGains.size()),
- m_inputGains(ffGains),
- m_outputGains(fbGains) {}
-
-/**
- * Creates a one-pole IIR low-pass filter of the form:<br>
- * y[n] = (1 - gain) * x[n] + gain * y[n-1]<br>
- * where gain = e<sup>-dt / T</sup>, T is the time constant in seconds
- *
- * This filter is stable for time constants greater than zero.
- *
- * @param source The PIDSource object that is used to get values
- * @param timeConstant The discrete-time time constant in seconds
- * @param period The period in seconds between samples taken by the user
- */
-LinearDigitalFilter LinearDigitalFilter::SinglePoleIIR(
- std::shared_ptr<PIDSource> source, double timeConstant, double period) {
- double gain = std::exp(-period / timeConstant);
- return LinearDigitalFilter(std::move(source), {1.0 - gain}, {-gain});
-}
-
-/**
- * Creates a first-order high-pass filter of the form:<br>
- * y[n] = gain * x[n] + (-gain) * x[n-1] + gain * y[n-1]<br>
- * where gain = e<sup>-dt / T</sup>, T is the time constant in seconds
- *
- * This filter is stable for time constants greater than zero.
- *
- * @param source The PIDSource object that is used to get values
- * @param timeConstant The discrete-time time constant in seconds
- * @param period The period in seconds between samples taken by the user
- */
-LinearDigitalFilter LinearDigitalFilter::HighPass(
- std::shared_ptr<PIDSource> source, double timeConstant, double period) {
- double gain = std::exp(-period / timeConstant);
- return LinearDigitalFilter(std::move(source), {gain, -gain}, {-gain});
-}
-
-/**
- * Creates a K-tap FIR moving average filter of the form:<br>
- * y[n] = 1/k * (x[k] + x[k-1] + … + x[0])
- *
- * This filter is always stable.
- *
- * @param source The PIDSource object that is used to get values
- * @param taps The number of samples to average over. Higher = smoother but
- * slower
- */
-LinearDigitalFilter LinearDigitalFilter::MovingAverage(
- std::shared_ptr<PIDSource> source, int taps) {
- assert(taps > 0);
-
- std::vector<double> gains(taps, 1.0 / taps);
- return LinearDigitalFilter(std::move(source), gains, {});
-}
-
-double LinearDigitalFilter::Get() const {
- double retVal = 0.0;
-
- // Calculate the new value
- for (size_t i = 0; i < m_inputGains.size(); i++) {
- retVal += m_inputs[i] * m_inputGains[i];
- }
- for (size_t i = 0; i < m_outputGains.size(); i++) {
- retVal -= m_outputs[i] * m_outputGains[i];
- }
-
- return retVal;
-}
-
-void LinearDigitalFilter::Reset() {
- m_inputs.Reset();
- m_outputs.Reset();
-}
-
-/**
- * Calculates the next value of the filter
- *
- * @return The filtered value at this step
- */
-double LinearDigitalFilter::PIDGet() {
- double retVal = 0.0;
-
- // Rotate the inputs
- m_inputs.PushFront(PIDGetSource());
-
- // Calculate the new value
- for (size_t i = 0; i < m_inputGains.size(); i++) {
- retVal += m_inputs[i] * m_inputGains[i];
- }
- for (size_t i = 0; i < m_outputGains.size(); i++) {
- retVal -= m_outputs[i] * m_outputGains[i];
- }
-
- // Rotate the outputs
- m_outputs.PushFront(retVal);
-
- return retVal;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/GamepadBase.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/GamepadBase.cpp
deleted file mode 100644
index 4f9e89f..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/GamepadBase.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "GamepadBase.h"
-
-using namespace frc;
-
-GamepadBase::GamepadBase(int port) : GenericHID(port) {}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/GyroBase.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/GyroBase.cpp
deleted file mode 100644
index 61de319..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/GyroBase.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "GyroBase.h"
-
-#include "LiveWindow/LiveWindow.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Get the PIDOutput for the PIDSource base object. Can be set to return
- * angle or rate using SetPIDSourceType(). Defaults to angle.
- *
- * @return The PIDOutput (angle or rate, defaults to angle)
- */
-double GyroBase::PIDGet() {
- switch (GetPIDSourceType()) {
- case PIDSourceType::kRate:
- return GetRate();
- case PIDSourceType::kDisplacement:
- return GetAngle();
- default:
- return 0;
- }
-}
-
-void GyroBase::UpdateTable() {
- if (m_table != nullptr) {
- m_table->PutNumber("Value", GetAngle());
- }
-}
-
-void GyroBase::StartLiveWindowMode() {}
-
-void GyroBase::StopLiveWindowMode() {}
-
-std::string GyroBase::GetSmartDashboardType() const { return "Gyro"; }
-
-void GyroBase::InitTable(std::shared_ptr<ITable> subTable) {
- m_table = subTable;
- UpdateTable();
-}
-
-std::shared_ptr<ITable> GyroBase::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/HLUsageReporting.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/HLUsageReporting.cpp
deleted file mode 100644
index a3c82bb..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/HLUsageReporting.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HLUsageReporting.h"
-
-using namespace frc;
-
-HLUsageReportingInterface* HLUsageReporting::impl = nullptr;
-
-void HLUsageReporting::SetImplementation(HLUsageReportingInterface* i) {
- impl = i;
-}
-
-void HLUsageReporting::ReportScheduler() {
- if (impl != nullptr) {
- impl->ReportScheduler();
- }
-}
-
-void HLUsageReporting::ReportSmartDashboard() {
- if (impl != nullptr) {
- impl->ReportSmartDashboard();
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/JoystickBase.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/JoystickBase.cpp
deleted file mode 100644
index c7a5fd7..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/JoystickBase.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "JoystickBase.h"
-
-using namespace frc;
-
-JoystickBase::JoystickBase(int port) : GenericHID(port) {}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/LiveWindow/LiveWindow.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/LiveWindow/LiveWindow.cpp
deleted file mode 100644
index 1328545..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/LiveWindow/LiveWindow.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2012-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "LiveWindow/LiveWindow.h"
-
-#include <algorithm>
-#include <sstream>
-
-#include "networktables/NetworkTable.h"
-
-using namespace frc;
-
-/**
- * Get an instance of the LiveWindow main class.
- *
- * This is a singleton to guarantee that there is only a single instance
- * regardless of how many times GetInstance is called.
- */
-LiveWindow* LiveWindow::GetInstance() {
- static LiveWindow instance;
- return &instance;
-}
-
-/**
- * LiveWindow constructor.
- *
- * Allocate the necessary tables.
- */
-LiveWindow::LiveWindow() : m_scheduler(Scheduler::GetInstance()) {
- m_liveWindowTable = NetworkTable::GetTable("LiveWindow");
- m_statusTable = m_liveWindowTable->GetSubTable("~STATUS~");
-}
-
-/**
- * Change the enabled status of LiveWindow.
- *
- * If it changes to enabled, start livewindow running otherwise stop it
- */
-void LiveWindow::SetEnabled(bool enabled) {
- if (m_enabled == enabled) return;
- if (enabled) {
- if (m_firstTime) {
- InitializeLiveWindowComponents();
- m_firstTime = false;
- }
- m_scheduler->SetEnabled(false);
- m_scheduler->RemoveAll();
- for (auto& elem : m_components) {
- elem.first->StartLiveWindowMode();
- }
- } else {
- for (auto& elem : m_components) {
- elem.first->StopLiveWindowMode();
- }
- m_scheduler->SetEnabled(true);
- }
- m_enabled = enabled;
- m_statusTable->PutBoolean("LW Enabled", m_enabled);
-}
-
-/**
- * @name AddSensor(subsystem, name, component)
- *
- * Add a Sensor associated with the subsystem and call it by the given name.
- *
- * @param subsystem The subsystem this component is part of.
- * @param name The name of this component.
- * @param component A LiveWindowSendable component that represents a sensor.
- */
-//@{
-/**
- * @brief Use a STL smart pointer to share ownership of component.
- */
-void LiveWindow::AddSensor(const std::string& subsystem,
- const std::string& name,
- std::shared_ptr<LiveWindowSendable> component) {
- m_components[component].subsystem = subsystem;
- m_components[component].name = name;
- m_components[component].isSensor = true;
-}
-
-/**
- * @brief Pass a reference to LiveWindow and retain ownership of the component.
- */
-void LiveWindow::AddSensor(const std::string& subsystem,
- const std::string& name,
- LiveWindowSendable& component) {
- AddSensor(subsystem, name, std::shared_ptr<LiveWindowSendable>(
- &component, [](LiveWindowSendable*) {}));
-}
-
-/**
- * @brief Use a raw pointer to the LiveWindow.
- * @deprecated Prefer smart pointers or references.
- */
-void LiveWindow::AddSensor(const std::string& subsystem,
- const std::string& name,
- LiveWindowSendable* component) {
- AddSensor(subsystem, name, std::shared_ptr<LiveWindowSendable>(
- component, NullDeleter<LiveWindowSendable>()));
-}
-//@}
-
-/**
- * @name AddActuator(subsystem, name, component)
- *
- * Add an Actuator associated with the subsystem and call it by the given name.
- *
- * @param subsystem The subsystem this component is part of.
- * @param name The name of this component.
- * @param component A LiveWindowSendable component that represents a actuator.
- */
-//@{
-/**
- * @brief Use a STL smart pointer to share ownership of component.
- */
-void LiveWindow::AddActuator(const std::string& subsystem,
- const std::string& name,
- std::shared_ptr<LiveWindowSendable> component) {
- m_components[component].subsystem = subsystem;
- m_components[component].name = name;
- m_components[component].isSensor = false;
-}
-
-/**
- * @brief Pass a reference to LiveWindow and retain ownership of the component.
- */
-void LiveWindow::AddActuator(const std::string& subsystem,
- const std::string& name,
- LiveWindowSendable& component) {
- AddActuator(subsystem, name, std::shared_ptr<LiveWindowSendable>(
- &component, [](LiveWindowSendable*) {}));
-}
-
-/**
- * @brief Use a raw pointer to the LiveWindow.
- * @deprecated Prefer smart pointers or references.
- */
-void LiveWindow::AddActuator(const std::string& subsystem,
- const std::string& name,
- LiveWindowSendable* component) {
- AddActuator(subsystem, name,
- std::shared_ptr<LiveWindowSendable>(
- component, NullDeleter<LiveWindowSendable>()));
-}
-//@}
-
-/**
- * Meant for internal use in other WPILib classes.
- */
-void LiveWindow::AddSensor(std::string type, int channel,
- LiveWindowSendable* component) {
- std::ostringstream oss;
- oss << type << "[" << channel << "]";
- AddSensor("Ungrouped", oss.str(), component);
- std::shared_ptr<LiveWindowSendable> component_stl(
- component, NullDeleter<LiveWindowSendable>());
- if (std::find(m_sensors.begin(), m_sensors.end(), component_stl) ==
- m_sensors.end())
- m_sensors.push_back(component_stl);
-}
-
-/**
- * Meant for internal use in other WPILib classes.
- */
-void LiveWindow::AddActuator(std::string type, int channel,
- LiveWindowSendable* component) {
- std::ostringstream oss;
- oss << type << "[" << channel << "]";
- AddActuator("Ungrouped", oss.str(),
- std::shared_ptr<LiveWindowSendable>(component,
- [](LiveWindowSendable*) {}));
-}
-
-/**
- * Meant for internal use in other WPILib classes.
- */
-void LiveWindow::AddActuator(std::string type, int module, int channel,
- LiveWindowSendable* component) {
- std::ostringstream oss;
- oss << type << "[" << module << "," << channel << "]";
- AddActuator("Ungrouped", oss.str(),
- std::shared_ptr<LiveWindowSendable>(component,
- [](LiveWindowSendable*) {}));
-}
-
-/**
- * Tell all the sensors to update (send) their values.
- *
- * Actuators are handled through callbacks on their value changing from the
- * SmartDashboard widgets.
- */
-void LiveWindow::UpdateValues() {
- for (auto& elem : m_sensors) {
- elem->UpdateTable();
- }
-}
-
-/**
- * This method is called periodically to cause the sensors to send new values
- * to the SmartDashboard.
- */
-void LiveWindow::Run() {
- if (m_enabled) {
- UpdateValues();
- }
-}
-
-/**
- * Initialize all the LiveWindow elements the first time we enter LiveWindow
- * mode. By holding off creating the NetworkTable entries, it allows them to be
- * redefined before the first time in LiveWindow mode. This allows default
- * sensor and actuator values to be created that are replaced with the custom
- * names from users calling addActuator and addSensor.
- */
-void LiveWindow::InitializeLiveWindowComponents() {
- for (auto& elem : m_components) {
- std::shared_ptr<LiveWindowSendable> component = elem.first;
- LiveWindowComponent c = elem.second;
- std::string subsystem = c.subsystem;
- std::string name = c.name;
- m_liveWindowTable->GetSubTable(subsystem)->PutString("~TYPE~",
- "LW Subsystem");
- std::shared_ptr<ITable> table(
- m_liveWindowTable->GetSubTable(subsystem)->GetSubTable(name));
- table->PutString("~TYPE~", component->GetSmartDashboardType());
- table->PutString("Name", name);
- table->PutString("Subsystem", subsystem);
- component->InitTable(table);
- if (c.isSensor) {
- m_sensors.push_back(component);
- }
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/LiveWindow/LiveWindowStatusListener.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/LiveWindow/LiveWindowStatusListener.cpp
deleted file mode 100644
index b6807b7..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/LiveWindow/LiveWindowStatusListener.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2012-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "LiveWindow/LiveWindowStatusListener.h"
-
-#include "Commands/Scheduler.h"
-
-using namespace frc;
-
-void LiveWindowStatusListener::ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value,
- bool isNew) {}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/PIDSource.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/PIDSource.cpp
deleted file mode 100644
index 167a7a2..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/PIDSource.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "PIDSource.h"
-
-using namespace frc;
-
-/**
- * Set which parameter you are using as a process control variable.
- *
- * @param pidSource An enum to select the parameter.
- */
-void PIDSource::SetPIDSourceType(PIDSourceType pidSource) {
- m_pidSource = pidSource;
-}
-
-PIDSourceType PIDSource::GetPIDSourceType() const { return m_pidSource; }
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/Resource.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/Resource.cpp
deleted file mode 100644
index 725d8a4..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/Resource.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Resource.h"
-
-#include "ErrorBase.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-priority_recursive_mutex Resource::m_createLock;
-
-/**
- * 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 indicies of the resources are [0 ..
- * elements - 1].
- */
-Resource::Resource(uint32_t elements) {
- std::lock_guard<priority_recursive_mutex> sync(m_createLock);
- m_isAllocated = std::vector<bool>(elements, false);
-}
-
-/**
- * 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 Resource::CreateResourceObject(std::unique_ptr<Resource>& r,
- uint32_t elements) {
- std::lock_guard<priority_recursive_mutex> sync(m_createLock);
- if (!r) {
- r = std::make_unique<Resource>(elements);
- }
-}
-
-/**
- * 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 Resource::Allocate(const std::string& resourceDesc) {
- std::lock_guard<priority_recursive_mutex> sync(m_allocateLock);
- for (uint32_t i = 0; i < m_isAllocated.size(); i++) {
- if (!m_isAllocated[i]) {
- m_isAllocated[i] = true;
- return i;
- }
- }
- wpi_setWPIErrorWithContext(NoAvailableResources, resourceDesc);
- return std::numeric_limits<uint32_t>::max();
-}
-
-/**
- * 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 Resource::Allocate(uint32_t index, const std::string& resourceDesc) {
- std::lock_guard<priority_recursive_mutex> sync(m_allocateLock);
- if (index >= m_isAllocated.size()) {
- wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, resourceDesc);
- return std::numeric_limits<uint32_t>::max();
- }
- if (m_isAllocated[index]) {
- wpi_setWPIErrorWithContext(ResourceAlreadyAllocated, resourceDesc);
- return std::numeric_limits<uint32_t>::max();
- }
- m_isAllocated[index] = true;
- return index;
-}
-
-/**
- * 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 Resource::Free(uint32_t index) {
- std::unique_lock<priority_recursive_mutex> sync(m_allocateLock);
- if (index == std::numeric_limits<uint32_t>::max()) return;
- if (index >= m_isAllocated.size()) {
- wpi_setWPIError(NotAllocated);
- return;
- }
- if (!m_isAllocated[index]) {
- wpi_setWPIError(NotAllocated);
- return;
- }
- m_isAllocated[index] = false;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/RobotState.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/RobotState.cpp
deleted file mode 100644
index 9ee79e5..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/RobotState.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "RobotState.h"
-
-#include "Base.h"
-
-using namespace frc;
-
-std::shared_ptr<RobotStateInterface> RobotState::impl;
-
-void RobotState::SetImplementation(RobotStateInterface& i) {
- impl = std::shared_ptr<RobotStateInterface>(
- &i, NullDeleter<RobotStateInterface>());
-}
-
-void RobotState::SetImplementation(std::shared_ptr<RobotStateInterface> i) {
- impl = i;
-}
-
-bool RobotState::IsDisabled() {
- if (impl != nullptr) {
- return impl->IsDisabled();
- }
- return true;
-}
-
-bool RobotState::IsEnabled() {
- if (impl != nullptr) {
- return impl->IsEnabled();
- }
- return false;
-}
-
-bool RobotState::IsOperatorControl() {
- if (impl != nullptr) {
- return impl->IsOperatorControl();
- }
- return true;
-}
-
-bool RobotState::IsAutonomous() {
- if (impl != nullptr) {
- return impl->IsAutonomous();
- }
- return false;
-}
-
-bool RobotState::IsTest() {
- if (impl != nullptr) {
- return impl->IsTest();
- }
- return false;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/SmartDashboard/SendableChooserBase.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/SmartDashboard/SendableChooserBase.cpp
deleted file mode 100644
index 9552e9b..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/SmartDashboard/SendableChooserBase.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "SmartDashboard/SendableChooserBase.h"
-
-using namespace frc;
-
-const char* SendableChooserBase::kDefault = "default";
-const char* SendableChooserBase::kOptions = "options";
-const char* SendableChooserBase::kSelected = "selected";
-
-std::shared_ptr<ITable> SendableChooserBase::GetTable() const {
- return m_table;
-}
-
-std::string SendableChooserBase::GetSmartDashboardType() const {
- return "String Chooser";
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/SmartDashboard/SmartDashboard.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/SmartDashboard/SmartDashboard.cpp
deleted file mode 100644
index 0e5878e..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/SmartDashboard/SmartDashboard.cpp
+++ /dev/null
@@ -1,471 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "SmartDashboard/SmartDashboard.h"
-
-#include "HLUsageReporting.h"
-#include "SmartDashboard/NamedSendable.h"
-#include "WPIErrors.h"
-#include "networktables/NetworkTable.h"
-
-using namespace frc;
-
-std::shared_ptr<ITable> SmartDashboard::m_table;
-std::map<std::shared_ptr<ITable>, Sendable*> SmartDashboard::m_tablesToData;
-
-void SmartDashboard::init() {
- m_table = NetworkTable::GetTable("SmartDashboard");
-
- HLUsageReporting::ReportSmartDashboard();
-}
-
-/**
- * Determines whether the given key is in this table.
- *
- * @param key the key to search for
- * @return true if the table as a value assigned to the given key
- */
-bool SmartDashboard::ContainsKey(llvm::StringRef key) {
- return m_table->ContainsKey(key);
-}
-
-/**
- * @param types bitmask of types; 0 is treated as a "don't care".
- * @return keys currently in the table
- */
-std::vector<std::string> SmartDashboard::GetKeys(int types) {
- return m_table->GetKeys(types);
-}
-
-/**
- * Makes a key's value persistent through program restarts.
- *
- * @param key the key to make persistent
- */
-void SmartDashboard::SetPersistent(llvm::StringRef key) {
- m_table->SetPersistent(key);
-}
-
-/**
- * Stop making a key's value persistent through program restarts.
- * The key cannot be null.
- *
- * @param key the key name
- */
-void SmartDashboard::ClearPersistent(llvm::StringRef key) {
- m_table->ClearPersistent(key);
-}
-
-/**
- * Returns whether the value is persistent through program restarts.
- * The key cannot be null.
- *
- * @param key the key name
- */
-bool SmartDashboard::IsPersistent(llvm::StringRef key) {
- return m_table->IsPersistent(key);
-}
-
-/**
- * Sets flags on the specified key in this table. The key can
- * not be null.
- *
- * @param key the key name
- * @param flags the flags to set (bitmask)
- */
-void SmartDashboard::SetFlags(llvm::StringRef key, unsigned int flags) {
- m_table->SetFlags(key, flags);
-}
-
-/**
- * Clears flags on the specified key in this table. The key can
- * not be null.
- *
- * @param key the key name
- * @param flags the flags to clear (bitmask)
- */
-void SmartDashboard::ClearFlags(llvm::StringRef key, unsigned int flags) {
- m_table->ClearFlags(key, flags);
-}
-
-/**
- * Returns the flags for the specified key.
- *
- * @param key the key name
- * @return the flags, or 0 if the key is not defined
- */
-unsigned int SmartDashboard::GetFlags(llvm::StringRef key) {
- return m_table->GetFlags(key);
-}
-
-/**
- * Deletes the specified key in this table.
- *
- * @param key the key name
- */
-void SmartDashboard::Delete(llvm::StringRef key) { m_table->Delete(key); }
-
-/**
- * Maps the specified key to the specified value in this table.
- *
- * The value can be retrieved by calling the get method with a key that is equal
- * to the original key.
- *
- * @param keyName the key
- * @param value the value
- */
-void SmartDashboard::PutData(llvm::StringRef key, Sendable* data) {
- if (data == nullptr) {
- wpi_setGlobalWPIErrorWithContext(NullParameter, "value");
- return;
- }
- std::shared_ptr<ITable> dataTable(m_table->GetSubTable(key));
- dataTable->PutString("~TYPE~", data->GetSmartDashboardType());
- data->InitTable(dataTable);
- m_tablesToData[dataTable] = data;
-}
-
-/**
- * Maps the specified key (where the key is the name of the
- * {@link SmartDashboardNamedData} to the specified value in this table.
- *
- * The value can be retrieved by calling the get method with a key that is equal
- * to the original key.
- *
- * @param value the value
- */
-void SmartDashboard::PutData(NamedSendable* value) {
- if (value == nullptr) {
- wpi_setGlobalWPIErrorWithContext(NullParameter, "value");
- return;
- }
- PutData(value->GetName(), value);
-}
-
-/**
- * Returns the value at the specified key.
- *
- * @param keyName the key
- * @return the value
- */
-Sendable* SmartDashboard::GetData(llvm::StringRef key) {
- std::shared_ptr<ITable> subtable(m_table->GetSubTable(key));
- Sendable* data = m_tablesToData[subtable];
- if (data == nullptr) {
- wpi_setGlobalWPIErrorWithContext(SmartDashboardMissingKey, key);
- return nullptr;
- }
- return data;
-}
-
-/**
- * Maps the specified key to the specified complex value (such as an array) in
- * this table.
- *
- * The value can be retrieved by calling the RetrieveValue method with a key
- * that is equal to the original key.
- *
- * @param keyName the key
- * @param value the value
- * @return False if the table key already exists with a different type
- */
-bool SmartDashboard::PutValue(llvm::StringRef keyName,
- std::shared_ptr<nt::Value> value) {
- return m_table->PutValue(keyName, value);
-}
-
-/**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
-bool SmartDashboard::SetDefaultValue(llvm::StringRef key,
- std::shared_ptr<nt::Value> defaultValue) {
- return m_table->SetDefaultValue(key, defaultValue);
-}
-
-/**
- * Retrieves the complex value (such as an array) in this table into the complex
- * data object.
- *
- * @param keyName the key
- * @param value the object to retrieve the value into
- */
-std::shared_ptr<nt::Value> SmartDashboard::GetValue(llvm::StringRef keyName) {
- return m_table->GetValue(keyName);
-}
-
-/**
- * Maps the specified key to the specified value in this table.
- *
- * The value can be retrieved by calling the get method with a key that is equal
- * to the original key.
- *
- * @param keyName the key
- * @param value the value
- * @return False if the table key already exists with a different type
- */
-bool SmartDashboard::PutBoolean(llvm::StringRef keyName, bool value) {
- return m_table->PutBoolean(keyName, value);
-}
-
-/**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
-bool SmartDashboard::SetDefaultBoolean(llvm::StringRef key, bool defaultValue) {
- return m_table->SetDefaultBoolean(key, defaultValue);
-}
-
-/**
- * Returns the value at the specified key.
- *
- * If the key is not found, returns the default value.
- *
- * @param keyName the key
- * @return the value
- */
-bool SmartDashboard::GetBoolean(llvm::StringRef keyName, bool defaultValue) {
- return m_table->GetBoolean(keyName, defaultValue);
-}
-
-/**
- * Maps the specified key to the specified value in this table.
- *
- * The value can be retrieved by calling the get method with a key that is equal
- * to the original key.
- *
- * @param keyName the key
- * @param value the value
- * @return False if the table key already exists with a different type
- */
-bool SmartDashboard::PutNumber(llvm::StringRef keyName, double value) {
- return m_table->PutNumber(keyName, value);
-}
-
-/**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
-bool SmartDashboard::SetDefaultNumber(llvm::StringRef key,
- double defaultValue) {
- return m_table->SetDefaultNumber(key, defaultValue);
-}
-
-/**
- * Returns the value at the specified key.
- *
- * If the key is not found, returns the default value.
- *
- * @param keyName the key
- * @return the value
- */
-double SmartDashboard::GetNumber(llvm::StringRef keyName, double defaultValue) {
- return m_table->GetNumber(keyName, defaultValue);
-}
-
-/**
- * Maps the specified key to the specified value in this table.
- *
- * The value can be retrieved by calling the get method with a key that is equal
- * to the original key.
- *
- * @param keyName the key
- * @param value the value
- * @return False if the table key already exists with a different type
- */
-bool SmartDashboard::PutString(llvm::StringRef keyName, llvm::StringRef value) {
- return m_table->PutString(keyName, value);
-}
-
-/**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
-bool SmartDashboard::SetDefaultString(llvm::StringRef key,
- llvm::StringRef defaultValue) {
- return m_table->SetDefaultString(key, defaultValue);
-}
-
-/**
- * Returns the value at the specified key.
- *
- * If the key is not found, returns the default value.
- *
- * @param keyName the key
- * @return the value
- */
-std::string SmartDashboard::GetString(llvm::StringRef keyName,
- llvm::StringRef defaultValue) {
- return m_table->GetString(keyName, defaultValue);
-}
-
-/**
- * Put a boolean array in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- *
- * @note The array must be of int's rather than of bool's because
- * std::vector<bool> is special-cased in C++. 0 is false, any
- * non-zero value is true.
- */
-bool SmartDashboard::PutBooleanArray(llvm::StringRef key,
- llvm::ArrayRef<int> value) {
- return m_table->PutBooleanArray(key, value);
-}
-
-/**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
-bool SmartDashboard::SetDefaultBooleanArray(llvm::StringRef key,
- llvm::ArrayRef<int> defaultValue) {
- return m_table->SetDefaultBooleanArray(key, defaultValue);
-}
-
-/**
- * Returns the boolean array the key maps to. If the key does not exist or is
- * of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- *
- * @note This makes a copy of the array. If the overhead of this is a
- * concern, use GetValue() instead.
- *
- * @note The returned array is std::vector<int> instead of std::vector<bool>
- * because std::vector<bool> is special-cased in C++. 0 is false, any
- * non-zero value is true.
- */
-std::vector<int> SmartDashboard::GetBooleanArray(
- llvm::StringRef key, llvm::ArrayRef<int> defaultValue) {
- return m_table->GetBooleanArray(key, defaultValue);
-}
-
-/**
- * Put a number array in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
-bool SmartDashboard::PutNumberArray(llvm::StringRef key,
- llvm::ArrayRef<double> value) {
- return m_table->PutNumberArray(key, value);
-}
-
-/**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
-bool SmartDashboard::SetDefaultNumberArray(
- llvm::StringRef key, llvm::ArrayRef<double> defaultValue) {
- return m_table->SetDefaultNumberArray(key, defaultValue);
-}
-
-/**
- * Returns the number array the key maps to. If the key does not exist or is
- * of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- *
- * @note This makes a copy of the array. If the overhead of this is a
- * concern, use GetValue() instead.
- */
-std::vector<double> SmartDashboard::GetNumberArray(
- llvm::StringRef key, llvm::ArrayRef<double> defaultValue) {
- return m_table->GetNumberArray(key, defaultValue);
-}
-
-/**
- * Put a string array in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
-bool SmartDashboard::PutStringArray(llvm::StringRef key,
- llvm::ArrayRef<std::string> value) {
- return m_table->PutStringArray(key, value);
-}
-
-/**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
-bool SmartDashboard::SetDefaultStringArray(
- llvm::StringRef key, llvm::ArrayRef<std::string> defaultValue) {
- return m_table->SetDefaultStringArray(key, defaultValue);
-}
-
-/**
- * Returns the string array the key maps to. If the key does not exist or is
- * of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- *
- * @note This makes a copy of the array. If the overhead of this is a
- * concern, use GetValue() instead.
- */
-std::vector<std::string> SmartDashboard::GetStringArray(
- llvm::StringRef key, llvm::ArrayRef<std::string> defaultValue) {
- return m_table->GetStringArray(key, defaultValue);
-}
-
-/**
- * Put a raw value (byte array) in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
-bool SmartDashboard::PutRaw(llvm::StringRef key, llvm::StringRef value) {
- return m_table->PutRaw(key, value);
-}
-
-/**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
-bool SmartDashboard::SetDefaultRaw(llvm::StringRef key,
- llvm::StringRef defaultValue) {
- return m_table->SetDefaultRaw(key, defaultValue);
-}
-
-/**
- * Returns the raw value (byte array) the key maps to. If the key does not
- * exist or is of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- *
- * @note This makes a copy of the raw contents. If the overhead of this is a
- * concern, use GetValue() instead.
- */
-std::string SmartDashboard::GetRaw(llvm::StringRef key,
- llvm::StringRef defaultValue) {
- return m_table->GetRaw(key, defaultValue);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/shared/src/interfaces/Potentiometer.cpp b/third_party/allwpilib_2017/wpilibc/shared/src/interfaces/Potentiometer.cpp
deleted file mode 100644
index 2b9766a..0000000
--- a/third_party/allwpilib_2017/wpilibc/shared/src/interfaces/Potentiometer.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "interfaces/Potentiometer.h"
-
-#include <Utility.h>
-
-using namespace frc;
-
-void Potentiometer::SetPIDSourceType(PIDSourceType pidSource) {
- if (wpi_assert(pidSource == PIDSourceType::kDisplacement)) {
- m_pidSource = pidSource;
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/.gitignore b/third_party/allwpilib_2017/wpilibc/sim/.gitignore
deleted file mode 100644
index e83089b..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-#don't track the generate protobuf files
-include/simulation/msgs/
-src/simulation/msgs
diff --git a/third_party/allwpilib_2017/wpilibc/sim/CMakeLists.txt b/third_party/allwpilib_2017/wpilibc/sim/CMakeLists.txt
deleted file mode 100644
index e847dca..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-cmake_policy(SET CMP0015 NEW)
-project(wpilibcSim)
-
-file(GLOB_RECURSE COM_SRC_FILES ../shared/src/*.cpp
- src/*.cpp)
-
-add_definitions(-DNAMESPACED_WPILIB)
-
-set (INCLUDE_FOLDERS include
- ../shared/include
- ../../hal/include
- ${NTCORE_INCLUDE_DIR}
- ${WPIUTIL_INCLUDE_DIR}
- ${GZ_MSGS_INCLUDE_DIR}
- ${Boost_INCLUDE_DIR}
- ${GAZEBO_INCLUDE_DIRS})
-
-include_directories(${INCLUDE_FOLDERS})
-
-link_directories(${NTCORE_LIBDIR} ${WPIUTIL_LIBDIR})
-
-add_library(${PROJECT_NAME} SHARED ${SRC_FILES} ${COM_SRC_FILES})
-
-target_link_libraries(${PROJECT_NAME} ntcore wpiutil)
-
-set_target_properties(${PROJECT_NAME}
- PROPERTIES
- LIBRARY_OUTPUT_DIRECTORY ${SIMULATION_INSTALL_DIR}/lib)
diff --git a/third_party/allwpilib_2017/wpilibc/sim/README.md b/third_party/allwpilib_2017/wpilibc/sim/README.md
deleted file mode 100644
index 7abfeda..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# Building WPILib C++ Sim
-see top level building.md for details
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/AnalogGyro.h b/third_party/allwpilib_2017/wpilibc/sim/include/AnalogGyro.h
deleted file mode 100644
index 1d08d4c..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/AnalogGyro.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-
-#include "GyroBase.h"
-#include "simulation/SimGyro.h"
-
-namespace frc {
-
-class AnalogInput;
-class AnalogModule;
-
-/**
- * Use a rate gyro to return the robots heading relative to a starting position.
- *
- * The AnalogGyro class tracks the robots heading based on the starting
- * position. As the robot rotates the new heading is computed by integrating
- * the rate of rotation returned by the sensor. When the class is instantiated,
- * it does a short calibration routine where it samples the gyro while at rest
- * to determine the default offset. This is subtracted from each sample to
- * determine the heading. This gyro class must be used with a channel that is
- * assigned one of the Analog accumulators from the FPGA. See AnalogInput for
- * the current accumulator assignments.
- */
-class AnalogGyro : public GyroBase {
- public:
- static const int kOversampleBits;
- static const int kAverageBits;
- static const double kSamplesPerSecond;
- static const double kCalibrationSampleTime;
- static const double kDefaultVoltsPerDegreePerSecond;
-
- explicit AnalogGyro(int channel);
- virtual ~AnalogGyro() = default;
- double GetAngle() const;
- void Calibrate() override;
- double GetRate() const;
- void Reset();
-
- private:
- void InitAnalogGyro(int channel);
-
- SimGyro* impl;
-
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/AnalogInput.h b/third_party/allwpilib_2017/wpilibc/sim/include/AnalogInput.h
deleted file mode 100644
index 1195824..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/AnalogInput.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "LiveWindow/LiveWindowSendable.h"
-#include "PIDSource.h"
-#include "SensorBase.h"
-#include "simulation/SimFloatInput.h"
-
-namespace frc {
-
-/**
- * Analog input class.
- *
- * Connected to each analog channel is an averaging and oversampling engine.
- * This engine accumulates the specified ( by SetAverageBits() and
- * SetOversampleBits() ) number of samples before returning a new value. This
- * is not a sliding window average. The only difference between the
- * oversampled samples and the averaged samples is that the oversampled samples
- * are simply accumulated effectively increasing the resolution, while the
- * averaged samples are divided by the number of samples to retain the
- * resolution, but get more stable values.
- */
-class AnalogInput : public SensorBase,
- public PIDSource,
- public LiveWindowSendable {
- public:
- static const int kAccumulatorModuleNumber = 1;
- static const int kAccumulatorNumChannels = 2;
- static const int kAccumulatorChannels[kAccumulatorNumChannels];
-
- explicit AnalogInput(int channel);
- virtual ~AnalogInput() = default;
-
- double GetVoltage() const;
- double GetAverageVoltage() const;
-
- int GetChannel() const;
-
- double PIDGet() override;
-
- void UpdateTable() override;
- void StartLiveWindowMode() override;
- void StopLiveWindowMode() override;
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subTable) override;
- std::shared_ptr<ITable> GetTable() const override;
-
- private:
- int m_channel;
- SimFloatInput* m_impl;
- int64_t m_accumulatorOffset;
-
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/AnalogPotentiometer.h b/third_party/allwpilib_2017/wpilibc/sim/include/AnalogPotentiometer.h
deleted file mode 100644
index 1cf58be..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/AnalogPotentiometer.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <memory>
-#include <string>
-
-#include "AnalogInput.h"
-#include "LiveWindow/LiveWindowSendable.h"
-#include "interfaces/Potentiometer.h"
-
-namespace frc {
-
-/**
- * Class for reading analog potentiometers. Analog potentiometers read
- * in an analog voltage that corresponds to a position. Usually the
- * position is either degrees or meters. However, if no conversion is
- * given it remains volts.
- */
-class AnalogPotentiometer : public Potentiometer, public LiveWindowSendable {
- public:
- /**
- * AnalogPotentiometer constructor.
- *
- * Use the scaling and offset values so that the output produces meaningful
- * values. I.E: you have a 270 degree potentiometer and you want the output
- * to be degrees with the halfway point as 0 degrees. The scale value is
- * 270.0(degrees)/5.0(volts) and the offset is -135.0 since the halfway point
- * after scaling is 135 degrees.
- *
- * @param channel The analog channel this potentiometer is plugged into.
- * @param scale The scaling to multiply the voltage by to get a meaningful
- * unit.
- * @param offset The offset to add to the scaled value for controlling the
- * zero value
- */
- explicit AnalogPotentiometer(int channel, double scale = 1.0,
- double offset = 0.0);
-
- AnalogPotentiometer(AnalogInput* input, double scale = 1.0,
- double offset = 0.0);
-
- AnalogPotentiometer(AnalogInput& input, double scale = 1.0,
- double offset = 0.0);
-
- virtual ~AnalogPotentiometer();
-
- /**
- * Get the current reading of the potentiomere.
- *
- * @return The current position of the potentiometer.
- */
- virtual double Get() const;
-
- /**
- * Implement the PIDSource interface.
- *
- * @return The current reading.
- */
- double PIDGet() override;
-
- /*
- * Live Window code, only does anything if live window is activated.
- */
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subtable) override;
- void UpdateTable() override;
- std::shared_ptr<ITable> GetTable() const override;
-
- /**
- * AnalogPotentiometers don't have to do anything special when entering the
- * LiveWindow.
- */
- void StartLiveWindowMode() override {}
-
- /**
- * AnalogPotentiometers don't have to do anything special when exiting the
- * LiveWindow.
- */
- void StopLiveWindowMode() override {}
-
- private:
- double m_scale, m_offset;
- AnalogInput* m_analog_input;
- std::shared_ptr<ITable> m_table;
- bool m_init_analog_input;
-
- /**
- * Common initialization code called by all constructors.
- */
- void initPot(AnalogInput* input, double scale, double offset);
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/Counter.h b/third_party/allwpilib_2017/wpilibc/sim/include/Counter.h
deleted file mode 100644
index 3466817..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/Counter.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "CounterBase.h"
-#include "LiveWindow/LiveWindowSendable.h"
-#include "SensorBase.h"
-
-namespace frc {
-
-/**
- * Class for counting the number of ticks on a digital input channel.
- *
- * This is a general purpose class for counting repetitive events. It can return
- * the number of counts, the period of the most recent cycle, and detect when
- * the signal being counted has stopped by supplying a maximum cycle time.
- *
- * All counters will immediately start counting - Reset() them if you need them
- * to be zeroed before use.
- */
-class Counter : public SensorBase,
- public CounterBase,
- public LiveWindowSendable {
- public:
- explicit Counter(Mode mode = kTwoPulse);
- explicit Counter(int channel);
- // TODO: [Not Supported] explicit Counter(DigitalSource *source);
- // TODO: [Not Supported] explicit Counter(DigitalSource &source);
- // TODO: [Not Supported] explicit Counter(AnalogTrigger *source);
- // TODO: [Not Supported] explicit Counter(AnalogTrigger &source);
- // TODO: [Not Supported] Counter(EncodingType encodingType, DigitalSource
- // *upSource, DigitalSource *downSource, bool inverted);
- virtual ~Counter();
-
- void SetUpSource(int channel);
- // TODO: [Not Supported] void SetUpSource(AnalogTrigger *analogTrigger,
- // AnalogTriggerType triggerType);
- // TODO: [Not Supported] void SetUpSource(AnalogTrigger &analogTrigger,
- // AnalogTriggerType triggerType);
- // TODO: [Not Supported] void SetUpSource(DigitalSource *source);
- // TODO: [Not Supported] void SetUpSource(DigitalSource &source);
- void SetUpSourceEdge(bool risingEdge, bool fallingEdge);
- void ClearUpSource();
-
- void SetDownSource(int channel);
- // TODO: [Not Supported] void SetDownSource(AnalogTrigger *analogTrigger,
- // AnalogTriggerType triggerType);
- // TODO: [Not Supported] void SetDownSource(AnalogTrigger &analogTrigger,
- // AnalogTriggerType triggerType);
- // TODO: [Not Supported] void SetDownSource(DigitalSource *source);
- // TODO: [Not Supported] void SetDownSource(DigitalSource &source);
- void SetDownSourceEdge(bool risingEdge, bool fallingEdge);
- void ClearDownSource();
-
- void SetUpDownCounterMode();
- void SetExternalDirectionMode();
- void SetSemiPeriodMode(bool highSemiPeriod);
- void SetPulseLengthMode(double threshold);
-
- void SetReverseDirection(bool reverseDirection);
-
- // CounterBase interface
- int Get() const override;
- void Reset() override;
- double GetPeriod() const override;
- void SetMaxPeriod(double maxPeriod) override;
- void SetUpdateWhenEmpty(bool enabled);
- bool GetStopped() const override;
- bool GetDirection() const override;
-
- void SetSamplesToAverage(int samplesToAverage);
- int GetSamplesToAverage() const;
- int GetFPGAIndex() const { return m_index; }
-
- void UpdateTable() override;
- void StartLiveWindowMode() override;
- void StopLiveWindowMode() override;
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subTable) override;
- std::shared_ptr<ITable> GetTable() const override;
-
- protected:
- // What makes the counter count up.
- // TODO: [Not Supported] DigitalSource *m_upSource;
- // What makes the counter count down.
- // TODO: [Not Supported] DigitalSource *m_downSource;
- void* m_counter; ///< The FPGA counter object.
- private:
- bool m_allocatedUpSource; ///< Was the upSource allocated locally?
- bool m_allocatedDownSource; ///< Was the downSource allocated locally?
- int m_index; ///< The index of this counter.
-
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/CounterBase.h b/third_party/allwpilib_2017/wpilibc/sim/include/CounterBase.h
deleted file mode 100644
index 7b64ee5..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/CounterBase.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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
-
-namespace frc {
-
-/**
- * Interface for counting the number of ticks on a digital input channel.
- *
- * Encoders, Gear tooth sensors, and counters should all subclass this so it can
- * be used to build more advanced classes for control and driving.
- *
- * All counters will immediately start counting - Reset() them if you need them
- * to be zeroed before use.
- */
-class CounterBase {
- public:
- enum EncodingType { k1X, k2X, k4X };
-
- virtual ~CounterBase() = default;
- virtual int Get() const = 0;
- virtual void Reset() = 0;
- virtual double GetPeriod() const = 0;
- virtual void SetMaxPeriod(double maxPeriod) = 0;
- virtual bool GetStopped() const = 0;
- virtual bool GetDirection() const = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/DigitalInput.h b/third_party/allwpilib_2017/wpilibc/sim/include/DigitalInput.h
deleted file mode 100644
index 6366d01..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/DigitalInput.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "LiveWindow/LiveWindowSendable.h"
-#include "simulation/SimDigitalInput.h"
-
-namespace frc {
-
-/**
- * Class to read a digital input.
- *
- * This class will read digital inputs and return the current value on the
- * channel. Other devices such as encoders, gear tooth sensors, etc. that are
- * implemented elsewhere will automatically allocate digital inputs and outputs
- * as required. This class is only for devices like switches etc. that aren't
- * implemented anywhere else.
- */
-class DigitalInput : public LiveWindowSendable {
- public:
- explicit DigitalInput(int channel);
- virtual ~DigitalInput() = default;
- int Get() const;
- int GetChannel() const;
-
- void UpdateTable() override;
- void StartLiveWindowMode() override;
- void StopLiveWindowMode() override;
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subTable) override;
- std::shared_ptr<ITable> GetTable() const override;
-
- private:
- int m_channel;
- bool m_lastValue;
- SimDigitalInput* m_impl;
-
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/DoubleSolenoid.h b/third_party/allwpilib_2017/wpilibc/sim/include/DoubleSolenoid.h
deleted file mode 100644
index 924d63a..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/DoubleSolenoid.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "LiveWindow/LiveWindowSendable.h"
-#include "simulation/SimContinuousOutput.h"
-#include "tables/ITableListener.h"
-
-namespace frc {
-
-/**
- * DoubleSolenoid class for running 2 channels of high voltage Digital Output
- * (PCM).
- *
- * The DoubleSolenoid class is typically used for pneumatics solenoids that
- * have two positions controlled by two separate channels.
- */
-class DoubleSolenoid : public LiveWindowSendable, public ITableListener {
- public:
- enum Value { kOff, kForward, kReverse };
-
- explicit DoubleSolenoid(int forwardChannel, int reverseChannel);
- DoubleSolenoid(int moduleNumber, int forwardChannel, int reverseChannel);
- virtual ~DoubleSolenoid();
- virtual void Set(Value value);
- virtual Value Get() const;
-
- void ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew) override;
- void UpdateTable() override;
- void StartLiveWindowMode() override;
- void StopLiveWindowMode() override;
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subTable) override;
- std::shared_ptr<ITable> GetTable() const override;
-
- private:
- SimContinuousOutput* m_impl;
- Value m_value;
- bool m_reversed;
-
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/DriverStation.h b/third_party/allwpilib_2017/wpilibc/sim/include/DriverStation.h
deleted file mode 100644
index c9218dd..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/DriverStation.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <condition_variable>
-#include <mutex>
-#include <string>
-
-#include <gazebo/transport/transport.hh>
-
-#include "RobotState.h"
-#include "SensorBase.h"
-#include "llvm/StringRef.h"
-#include "simulation/gz_msgs/msgs.h"
-
-#ifdef _WIN32
-// Ensure that Winsock2.h is included before Windows.h, which can get
-// pulled in by anybody (e.g., Boost).
-#include <Winsock2.h>
-#endif
-
-namespace frc {
-
-struct HALCommonControlData;
-class AnalogInput;
-
-/**
- * Provide access to the network communication data to / from the Driver
- * Station.
- */
-class DriverStation : public SensorBase, public RobotStateInterface {
- public:
- enum Alliance { kRed, kBlue, kInvalid };
-
- virtual ~DriverStation() = default;
- static DriverStation& GetInstance();
- static void ReportError(llvm::StringRef error);
- static void ReportWarning(llvm::StringRef error);
- static void ReportError(bool is_error, int code, llvm::StringRef error,
- llvm::StringRef location, llvm::StringRef stack);
-
- static const int kBatteryChannel = 7;
- static const int kJoystickPorts = 4;
- static const int kJoystickAxes = 6;
-
- double GetStickAxis(int stick, int axis);
- bool GetStickButton(int stick, int button);
- int16_t GetStickButtons(int stick);
-
- double GetAnalogIn(int channel);
- bool GetDigitalIn(int channel);
- void SetDigitalOut(int channel, bool value);
- bool GetDigitalOut(int channel);
-
- bool IsEnabled() const;
- bool IsDisabled() const;
- bool IsAutonomous() const;
- bool IsOperatorControl() const;
- bool IsTest() const;
- bool IsFMSAttached() const;
-
- int GetPacketNumber() const;
- Alliance GetAlliance() const;
- int GetLocation() const;
- void WaitForData();
- bool WaitForData(double timeout);
- double GetMatchTime() const;
- double GetBatteryVoltage() const;
- uint16_t GetTeamNumber() const;
-
- void IncrementUpdateNumber() { m_updateNumber++; }
-
- /**
- * Only to be used to tell the Driver Station what code you claim to be
- * executing for diagnostic purposes only.
- *
- * @param entering If true, starting disabled code; if false, leaving
- * disabled code
- */
- void InDisabled(bool entering) { m_userInDisabled = entering; }
- /**
- * Only to be used to tell the Driver Station what code you claim to be
- * executing for diagnostic purposes only.
- *
- * @param entering If true, starting autonomous code; if false, leaving
- * autonomous code
- */
- void InAutonomous(bool entering) { m_userInAutonomous = entering; }
- /**
- * Only to be used to tell the Driver Station what code you claim to be
- * executing for diagnostic purposes only.
- *
- * @param entering If true, starting teleop code; if false, leaving teleop
- * code
- */
- void InOperatorControl(bool entering) { m_userInTeleop = entering; }
- /**
- * Only to be used to tell the Driver Station what code you claim to be
- * executing for diagnostic purposes only.
- *
- * @param entering If true, starting test code; if false, leaving test code
- */
- void InTest(bool entering) { m_userInTest = entering; }
-
- protected:
- DriverStation();
-
- private:
- static void InitTask(DriverStation* ds);
- static DriverStation* m_instance;
- static int m_updateNumber;
- ///< TODO: Get rid of this and use the semaphore signaling
- static const double kUpdatePeriod;
-
- void stateCallback(const gazebo::msgs::ConstDriverStationPtr& msg);
- void joystickCallback(const gazebo::msgs::ConstFRCJoystickPtr& msg, int i);
- void joystickCallback0(const gazebo::msgs::ConstFRCJoystickPtr& msg);
- void joystickCallback1(const gazebo::msgs::ConstFRCJoystickPtr& msg);
- void joystickCallback2(const gazebo::msgs::ConstFRCJoystickPtr& msg);
- void joystickCallback3(const gazebo::msgs::ConstFRCJoystickPtr& msg);
- void joystickCallback4(const gazebo::msgs::ConstFRCJoystickPtr& msg);
- void joystickCallback5(const gazebo::msgs::ConstFRCJoystickPtr& msg);
-
- int m_digitalOut = 0;
- std::condition_variable m_waitForDataCond;
- std::mutex m_waitForDataMutex;
- bool m_updatedControlLoopData = false;
- mutable std::recursive_mutex m_stateMutex;
- std::recursive_mutex m_joystickMutex;
- double m_approxMatchTimeOffset = 0;
- bool m_userInDisabled = false;
- bool m_userInAutonomous = false;
- bool m_userInTeleop = false;
- bool m_userInTest = false;
-
- gazebo::transport::SubscriberPtr stateSub;
- gazebo::transport::SubscriberPtr joysticksSub[6];
- gazebo::msgs::DriverStationPtr state;
- gazebo::msgs::FRCJoystickPtr joysticks[6];
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/Encoder.h b/third_party/allwpilib_2017/wpilibc/sim/include/Encoder.h
deleted file mode 100644
index 4fc57b3..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/Encoder.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <stdint.h>
-
-#include <memory>
-#include <string>
-
-#include "CounterBase.h"
-#include "LiveWindow/LiveWindowSendable.h"
-#include "PIDSource.h"
-#include "SensorBase.h"
-#include "simulation/SimEncoder.h"
-
-namespace frc {
-
-/**
- * Class to read quad encoders.
- *
- * Quadrature encoders are devices that count shaft rotation and can sense
- * direction. The output of the QuadEncoder class is an integer that can count
- * either up or down, and can go negative for reverse direction counting. When
- * creating QuadEncoders, a direction is supplied that changes the sense of the
- * output to make code more readable if the encoder is mounted such that
- * forward movement generates negative values. Quadrature encoders have two
- * digital outputs, an A Channel and a B Channel that are out of phase with
- * each other to allow the FPGA to do direction sensing.
- *
- * All encoders will immediately start counting - Reset() them if you need them
- * to be zeroed before use.
- */
-class Encoder : public SensorBase,
- public CounterBase,
- public PIDSource,
- public LiveWindowSendable {
- public:
- Encoder(int aChannel, int bChannel, bool reverseDirection = false,
- EncodingType encodingType = k4X);
- // TODO: [Not Supported] Encoder(DigitalSource *aSource, DigitalSource
- // *bSource, bool reverseDirection=false, EncodingType encodingType = k4X);
- // TODO: [Not Supported] Encoder(DigitalSource &aSource, DigitalSource
- // &bSource, bool reverseDirection=false, EncodingType encodingType = k4X);
- virtual ~Encoder() = default;
-
- // CounterBase interface
- int Get() const override;
- int GetRaw() const;
- int GetEncodingScale() const;
- void Reset() override;
- double GetPeriod() const override;
- void SetMaxPeriod(double maxPeriod) override;
- bool GetStopped() const override;
- bool GetDirection() const override;
-
- double GetDistance() const;
- double GetRate() const;
- void SetMinRate(double minRate);
- void SetDistancePerPulse(double distancePerPulse);
- void SetReverseDirection(bool reverseDirection);
- void SetSamplesToAverage(int samplesToAverage);
- int GetSamplesToAverage() const;
- void SetPIDSourceType(PIDSourceType pidSource);
- double PIDGet() override;
-
- void UpdateTable() override;
- void StartLiveWindowMode() override;
- void StopLiveWindowMode() override;
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subTable) override;
- std::shared_ptr<ITable> GetTable() const override;
-
- int FPGAEncoderIndex() const { return 0; }
-
- private:
- void InitEncoder(int channelA, int channelB, bool reverseDirection,
- EncodingType encodingType);
- double DecodingScaleFactor() const;
-
- // the A phase of the quad encoder
- // TODO: [Not Supported] DigitalSource *m_aSource;
- // the B phase of the quad encoder
- // TODO: [Not Supported] DigitalSource *m_bSource;
- // was the A source allocated locally?
- // TODO: [Not Supported] bool m_allocatedASource;
- // was the B source allocated locally?
- // TODO: [Not Supported] bool m_allocatedBSource;
- int channelA, channelB;
- double m_distancePerPulse; // distance of travel for each encoder tick
- EncodingType m_encodingType; // Encoding type
- int m_encodingScale; // 1x, 2x, or 4x, per the encodingType
- bool m_reverseDirection;
- SimEncoder* impl;
-
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/IterativeRobot.h b/third_party/allwpilib_2017/wpilibc/sim/include/IterativeRobot.h
deleted file mode 100644
index 34847d6..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/IterativeRobot.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "RobotBase.h"
-
-namespace frc {
-
-/**
- * IterativeRobot implements a specific type of Robot Program framework,
- * extending the RobotBase class.
- *
- * The IterativeRobot class is intended to be subclassed by a user creating a
- * robot program.
- *
- * This class is intended to implement the "old style" default code, by
- * providing the following functions which are called by the main loop,
- * StartCompetition(), at the appropriate times:
- *
- * RobotInit() -- provide for initialization at robot power-on
- *
- * Init() functions -- each of the following functions is called once when the
- * appropriate mode is entered:
- * - DisabledInit() -- called only when first disabled
- * - AutonomousInit() -- called each and every time autonomous is entered from
- * another mode
- * - TeleopInit() -- called each and every time teleop is entered from
- * another mode
- * - TestInit() -- called each and every time test is entered from
- * another mode
- *
- * Periodic() functions -- each of these functions is called each time a
- * new packet is received from the driver station:
- * - RobotPeriodic()
- * - DisabledPeriodic()
- * - AutonomousPeriodic()
- * - TeleopPeriodic()
- * - TestPeriodic()
- *
- */
-
-class IterativeRobot : public RobotBase {
- public:
- virtual void StartCompetition();
-
- virtual void RobotInit();
- virtual void DisabledInit();
- virtual void AutonomousInit();
- virtual void TeleopInit();
- virtual void TestInit();
-
- virtual void RobotPeriodic();
- virtual void DisabledPeriodic();
- virtual void AutonomousPeriodic();
- virtual void TeleopPeriodic();
- virtual void TestPeriodic();
-
- protected:
- virtual ~IterativeRobot() = default;
- IterativeRobot() = default;
-
- private:
- bool m_disabledInitialized = false;
- bool m_autonomousInitialized = false;
- bool m_teleopInitialized = false;
- bool m_testInitialized = false;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/Jaguar.h b/third_party/allwpilib_2017/wpilibc/sim/include/Jaguar.h
deleted file mode 100644
index 468f82c..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/Jaguar.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "PIDOutput.h"
-#include "SafePWM.h"
-#include "SpeedController.h"
-
-namespace frc {
-
-/**
- * Luminary Micro Jaguar Speed Control.
- */
-class Jaguar : public SafePWM, public SpeedController {
- public:
- explicit Jaguar(int channel);
- virtual ~Jaguar() = default;
- virtual void Set(double value);
- virtual double Get() const;
- virtual void Disable();
-
- void PIDWrite(double output) override;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/MotorSafety.h b/third_party/allwpilib_2017/wpilibc/sim/include/MotorSafety.h
deleted file mode 100644
index 27c938c..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/MotorSafety.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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
-
-#define DEFAULT_SAFETY_EXPIRATION 0.1
-
-#include <sstream>
-
-namespace frc {
-
-class MotorSafety {
- public:
- virtual void SetExpiration(double timeout) = 0;
- virtual double GetExpiration() const = 0;
- virtual bool IsAlive() const = 0;
- virtual void StopMotor() = 0;
- virtual void SetSafetyEnabled(bool enabled) = 0;
- virtual bool IsSafetyEnabled() const = 0;
- virtual void GetDescription(std::ostringstream& desc) const = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/MotorSafetyHelper.h b/third_party/allwpilib_2017/wpilibc/sim/include/MotorSafetyHelper.h
deleted file mode 100644
index b300a84..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/MotorSafetyHelper.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <set>
-
-#include "ErrorBase.h"
-#include "HAL/cpp/priority_mutex.h"
-
-namespace frc {
-
-class MotorSafety;
-
-class MotorSafetyHelper : public ErrorBase {
- public:
- explicit MotorSafetyHelper(MotorSafety* safeObject);
- ~MotorSafetyHelper();
- void Feed();
- void SetExpiration(double expirationTime);
- double GetExpiration() const;
- bool IsAlive() const;
- void Check();
- void SetSafetyEnabled(bool enabled);
- bool IsSafetyEnabled() const;
- static void CheckMotors();
-
- private:
- // the expiration time for this object
- double m_expiration;
- // true if motor safety is enabled for this motor
- bool m_enabled;
- // the FPGA clock value when this motor has expired
- double m_stopTime;
- // protect accesses to the state for this object
- mutable priority_recursive_mutex m_syncMutex;
- MotorSafety* m_safeObject; // the object that is using the helper
- // List of all existing MotorSafetyHelper objects.
- static std::set<MotorSafetyHelper*> m_helperList;
- // protect accesses to the list of helpers
- static priority_recursive_mutex m_listMutex;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/NetworkCommunication/FRCComm.h b/third_party/allwpilib_2017/wpilibc/sim/include/NetworkCommunication/FRCComm.h
deleted file mode 100644
index 588c8ca..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/NetworkCommunication/FRCComm.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*************************************************************
- * NOTICE
- *
- * These are the only externally exposed functions to the
- * NetworkCommunication library
- *
- * This is an implementation of FRC Spec for Comm Protocol
- * Revision 4.5, June 30, 2008
- *
- * Copyright (c) National Instruments 2008. All Rights Reserved.
- *
- *************************************************************/
-
-#ifndef __FRC_COMM_H__
-#define __FRC_COMM_H__
-
-#ifdef SIMULATION
-#include <vxWorks_compat.h>
-#ifdef USE_THRIFT
-#define EXPORT_FUNC
-#else
-#define EXPORT_FUNC __declspec(dllexport) __cdecl
-#endif
-#else
-#include <stdint.h>
-#include <pthread.h>
-#define EXPORT_FUNC
-#endif
-
-#define ERR_FRCSystem_NetCommNotResponding -44049
-#define ERR_FRCSystem_NoDSConnection -44018
-
-enum AllianceStationID_t {
- kAllianceStationID_red1,
- kAllianceStationID_red2,
- kAllianceStationID_red3,
- kAllianceStationID_blue1,
- kAllianceStationID_blue2,
- kAllianceStationID_blue3,
-};
-
-enum MatchType_t {
- kMatchType_none,
- kMatchType_practice,
- kMatchType_qualification,
- kMatchType_elimination,
-};
-
-struct ControlWord_t {
- uint32_t enabled : 1;
- uint32_t autonomous : 1;
- uint32_t test : 1;
- uint32_t eStop : 1;
- uint32_t fmsAttached : 1;
- uint32_t dsAttached : 1;
- uint32_t control_reserved : 26;
-};
-
-struct JoystickAxes_t {
- uint16_t count;
- int16_t axes[1];
-};
-
-struct JoystickPOV_t {
- uint16_t count;
- int16_t povs[1];
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-int EXPORT_FUNC FRC_NetworkCommunication_Reserve(void *instance);
-#ifndef SIMULATION
-void EXPORT_FUNC
-getFPGAHardwareVersion(uint16_t *fpgaVersion, uint32_t *fpgaRevision);
-#endif
-int EXPORT_FUNC setStatusData(float battery, uint8_t dsDigitalOut,
- uint8_t updateNumber, const char *userDataHigh,
- int userDataHighLength, const char *userDataLow,
- int userDataLowLength, int wait_ms);
-int EXPORT_FUNC setErrorData(const char *errors, int errorsLength, int wait_ms);
-
-#ifdef SIMULATION
-void EXPORT_FUNC setNewDataSem(HANDLE);
-#else
-void EXPORT_FUNC setNewDataSem(pthread_cond_t *);
-#endif
-
-// this uint32_t is really a LVRefNum
-int EXPORT_FUNC setNewDataOccurRef(uint32_t refnum);
-
-int EXPORT_FUNC
-FRC_NetworkCommunication_getControlWord(struct ControlWord_t *controlWord);
-int EXPORT_FUNC FRC_NetworkCommunication_getAllianceStation(
- enum AllianceStationID_t *allianceStation);
-int EXPORT_FUNC FRC_NetworkCommunication_getMatchTime(float *matchTime);
-int EXPORT_FUNC
-FRC_NetworkCommunication_getJoystickAxes(uint8_t joystickNum,
- struct JoystickAxes_t *axes,
- uint8_t maxAxes);
-int EXPORT_FUNC FRC_NetworkCommunication_getJoystickButtons(uint8_t joystickNum,
- uint32_t *buttons,
- uint8_t *count);
-int EXPORT_FUNC
-FRC_NetworkCommunication_getJoystickPOVs(uint8_t joystickNum,
- struct JoystickPOV_t *povs,
- uint8_t maxPOVs);
-int EXPORT_FUNC
-FRC_NetworkCommunication_setJoystickOutputs(uint8_t joystickNum,
- uint32_t hidOutputs,
- uint16_t leftRumble,
- uint16_t rightRumble);
-int EXPORT_FUNC
-FRC_NetworkCommunication_getJoystickDesc(uint8_t joystickNum, uint8_t *isXBox,
- uint8_t *type, char *name,
- uint8_t *axisCount, uint8_t *axisTypes,
- uint8_t *buttonCount,
- uint8_t *povCount);
-
-void EXPORT_FUNC FRC_NetworkCommunication_getVersionString(char *version);
-int EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramStarting(void);
-void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramDisabled(void);
-void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramAutonomous(void);
-void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTeleop(void);
-void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTest(void);
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/Notifier.h b/third_party/allwpilib_2017/wpilibc/sim/include/Notifier.h
deleted file mode 100644
index 2e9f88f..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/Notifier.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <functional>
-#include <list>
-#include <thread>
-#include <utility>
-
-#include "ErrorBase.h"
-#include "HAL/cpp/priority_mutex.h"
-
-namespace frc {
-
-typedef std::function<void()> TimerEventHandler;
-
-class Notifier : public ErrorBase {
- public:
- explicit Notifier(TimerEventHandler handler);
-
- template <typename Callable, typename Arg, typename... Args>
- Notifier(Callable&& f, Arg&& arg, Args&&... args)
- : Notifier(std::bind(std::forward<Callable>(f), std::forward<Arg>(arg),
- std::forward<Args>(args)...)) {}
- virtual ~Notifier();
-
- Notifier(const Notifier&) = delete;
- Notifier& operator=(const Notifier&) = delete;
-
- void StartSingle(double delay);
- void StartPeriodic(double period);
- void Stop();
-
- private:
- static std::list<Notifier*> timerQueue;
- static priority_recursive_mutex queueMutex;
- static priority_mutex halMutex;
- static void* m_notifier;
- static std::atomic<int> refcount;
-
- // Process the timer queue on a timer event
- static void ProcessQueue(int mask, void* params);
-
- // Update the FPGA alarm since the queue has changed
- static void UpdateAlarm();
-
- // Insert the Notifier in the timer queue
- void InsertInQueue(bool reschedule);
-
- // Delete this Notifier from the timer queue
- void DeleteFromQueue();
-
- // Address of the handler
- TimerEventHandler m_handler;
- // The relative time (either periodic or single)
- double m_period = 0;
- // Absolute expiration time for the current event
- double m_expirationTime = 0;
- // True if this is a periodic event
- bool m_periodic = false;
- // Indicates if this entry is queued
- bool m_queued = false;
- // Held by interrupt manager task while handler call is in progress
- priority_mutex m_handlerMutex;
- static std::thread m_task;
- static std::atomic<bool> m_stopped;
- static void Run();
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/PWM.h b/third_party/allwpilib_2017/wpilibc/sim/include/PWM.h
deleted file mode 100644
index b1b4d07..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/PWM.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "LiveWindow/LiveWindowSendable.h"
-#include "SensorBase.h"
-#include "simulation/SimContinuousOutput.h"
-#include "tables/ITableListener.h"
-
-namespace frc {
-
-/**
- * Class implements the PWM generation in the FPGA.
- *
- * The values supplied as arguments for PWM outputs range from -1.0 to 1.0. They
- * are mapped to the hardware dependent values, in this case 0-255 for the FPGA.
- * Changes are immediately sent to the FPGA, and the update occurs at the next
- * FPGA cycle. There is no delay.
- *
- * As of revision 0.1.10 of the FPGA, the FPGA interprets the 0-255 values as
- * follows:
- * - 255 = full "forward"
- * - 254 to 129 = linear scaling from "full forward" to "center"
- * - 128 = center value
- * - 127 to 2 = linear scaling from "center" to "full reverse"
- * - 1 = full "reverse"
- * - 0 = disabled (i.e. PWM output is held low)
- */
-class PWM : public SensorBase,
- public ITableListener,
- public LiveWindowSendable {
- public:
- enum PeriodMultiplier {
- kPeriodMultiplier_1X = 1,
- kPeriodMultiplier_2X = 2,
- kPeriodMultiplier_4X = 4
- };
-
- explicit PWM(int channel);
- virtual ~PWM();
- virtual void SetRaw(uint16_t value);
- void SetPeriodMultiplier(PeriodMultiplier mult);
- void EnableDeadbandElimination(bool eliminateDeadband);
- void SetBounds(int max, int deadbandMax, int center, int deadbandMin,
- int min);
- void SetBounds(double max, double deadbandMax, double center,
- double deadbandMin, double min);
- int GetChannel() const { return m_channel; }
-
- protected:
- /**
- * kDefaultPwmPeriod is in ms
- *
- * - 20ms periods (50 Hz) are the "safest" setting in that this works for all
- * devices
- * - 20ms periods seem to be desirable for Vex Motors
- * - 20ms periods are the specified period for HS-322HD servos, but work
- * reliably down to 10.0 ms; starting at about 8.5ms, the servo sometimes
- * hums and get hot; by 5.0ms the hum is nearly continuous
- * - 10ms periods work well for Victor 884
- * - 5ms periods allows higher update rates for Luminary Micro Jaguar speed
- * controllers. Due to the shipping firmware on the Jaguar, we can't run
- * the update period less than 5.05 ms.
- *
- * kDefaultPwmPeriod is the 1x period (5.05 ms). In hardware, the period
- * scaling is implemented as an output squelch to get longer periods for old
- * devices.
- */
- static const double kDefaultPwmPeriod;
- /**
- * kDefaultPwmCenter is the PWM range center in ms
- */
- static const double kDefaultPwmCenter;
- /**
- * kDefaultPWMStepsDown is the number of PWM steps below the centerpoint
- */
- static const int kDefaultPwmStepsDown;
- static const int kPwmDisabled;
-
- virtual void SetPosition(double pos);
- virtual double GetPosition() const;
- virtual void SetSpeed(double speed);
- virtual double GetSpeed() const;
-
- bool m_eliminateDeadband;
- int m_centerPwm;
-
- void ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew) override;
- void UpdateTable() override;
- void StartLiveWindowMode() override;
- void StopLiveWindowMode() override;
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subTable) override;
- std::shared_ptr<ITable> GetTable() const override;
-
- std::shared_ptr<ITable> m_table;
-
- private:
- int m_channel;
- SimContinuousOutput* impl;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/Relay.h b/third_party/allwpilib_2017/wpilibc/sim/include/Relay.h
deleted file mode 100644
index 19ddd7d..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/Relay.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "LiveWindow/LiveWindowSendable.h"
-#include "MotorSafety.h"
-#include "SensorBase.h"
-#include "simulation/SimContinuousOutput.h"
-#include "tables/ITable.h"
-#include "tables/ITableListener.h"
-
-namespace frc {
-
-class MotorSafetyHelper;
-class DigitalModule;
-
-/**
- * Class for Spike style relay outputs.
- *
- * Relays are intended to be connected to spikes or similar relays. The relay
- * channels controls a pair of pins that are either both off, one on, the other
- * on, or both on. This translates into two spike outputs at 0v, one at 12v and
- * one at 0v, one at 0v and the other at 12v, or two spike outputs at 12V. This
- * allows off, full forward, or full reverse control of motors without variable
- * speed. It also allows the two channels (forward and reverse) to be used
- * independently for something that does not care about voltage polatiry (like
- * a solenoid).
- */
-class Relay : public MotorSafety,
- public SensorBase,
- public ITableListener,
- public LiveWindowSendable {
- public:
- enum Value { kOff, kOn, kForward, kReverse };
- enum Direction { kBothDirections, kForwardOnly, kReverseOnly };
-
- explicit Relay(int channel, Direction direction = kBothDirections);
- virtual ~Relay();
-
- void Set(Value value);
- Value Get() const;
- int GetChannel() const;
-
- void SetExpiration(double timeout) override;
- double GetExpiration() const override;
- bool IsAlive() const override;
- void StopMotor() override;
- bool IsSafetyEnabled() const override;
- void SetSafetyEnabled(bool enabled) override;
- void GetDescription(std::ostringstream& desc) const override;
-
- void ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew) override;
- void UpdateTable() override;
- void StartLiveWindowMode() override;
- void StopLiveWindowMode() override;
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subTable) override;
- std::shared_ptr<ITable> GetTable() const override;
-
- std::shared_ptr<ITable> m_table;
-
- private:
- int m_channel;
- Direction m_direction;
- std::unique_ptr<MotorSafetyHelper> m_safetyHelper;
- SimContinuousOutput* impl;
- bool go_pos, go_neg;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/RobotBase.h b/third_party/allwpilib_2017/wpilibc/sim/include/RobotBase.h
deleted file mode 100644
index 5deaa14..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/RobotBase.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <cstdio>
-
-#include "Base.h"
-#include "DriverStation.h"
-#include "simulation/MainNode.h"
-#include "simulation/simTime.h"
-
-#define START_ROBOT_CLASS(_ClassName_) \
- int main() { \
- static _ClassName_ robot; \
- std::printf("\n********** Robot program starting **********\n"); \
- robot.StartCompetition(); \
- }
-
-namespace frc {
-
-/**
- * Implement a Robot Program framework.
- *
- * The RobotBase class is intended to be subclassed by a user creating a robot
- * program. Overridden Autonomous() and OperatorControl() methods are called at
- * the appropriate time as the match proceeds. In the current implementation,
- * the Autonomous code will run to completion before the OperatorControl code
- * could start. In the future the Autonomous code might be spawned as a task,
- * then killed at the end of the Autonomous period.
- */
-class RobotBase {
- public:
- bool IsEnabled() const;
- bool IsDisabled() const;
- bool IsAutonomous() const;
- bool IsOperatorControl() const;
- bool IsTest() const;
- virtual void StartCompetition() = 0;
-
- protected:
- RobotBase();
- virtual ~RobotBase() = default;
-
- RobotBase(const RobotBase&) = delete;
- RobotBase& operator=(const RobotBase&) = delete;
-
- DriverStation& m_ds;
- gazebo::transport::SubscriberPtr time_sub;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/RobotDrive.h b/third_party/allwpilib_2017/wpilibc/sim/include/RobotDrive.h
deleted file mode 100644
index de4306a..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/RobotDrive.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <stdint.h>
-
-#include <memory>
-
-#include "ErrorBase.h"
-#include "MotorSafety.h"
-#include "MotorSafetyHelper.h"
-
-namespace frc {
-
-class SpeedController;
-class GenericHID;
-
-/**
- * Utility class for handling Robot drive based on a definition of the motor
- * configuration.
- *
- * The robot drive class handles basic driving for a robot. Currently, 2 and 4
- * motor standard drive trains are supported. In the future other drive types
- * like swerve and meccanum might be implemented. Motor channel numbers are
- * passed supplied on creation of the class. Those are used for either the
- * Drive function (intended for hand created drive code, such as autonomous)
- * or with the Tank/Arcade functions intended to be used for Operator Control
- * driving.
- */
-class RobotDrive : public MotorSafety, public ErrorBase {
- public:
- enum MotorType {
- kFrontLeftMotor = 0,
- kFrontRightMotor = 1,
- kRearLeftMotor = 2,
- kRearRightMotor = 3
- };
-
- RobotDrive(int leftMotorChannel, int rightMotorChannel);
- RobotDrive(int frontLeftMotorChannel, int rearLeftMotorChannel,
- int frontRightMotorChannel, int rearRightMotorChannel);
- RobotDrive(SpeedController* leftMotor, SpeedController* rightMotor);
- RobotDrive(SpeedController& leftMotor, SpeedController& rightMotor);
- RobotDrive(std::shared_ptr<SpeedController> leftMotor,
- std::shared_ptr<SpeedController> rightMotor);
- RobotDrive(SpeedController* frontLeftMotor, SpeedController* rearLeftMotor,
- SpeedController* frontRightMotor, SpeedController* rearRightMotor);
- RobotDrive(SpeedController& frontLeftMotor, SpeedController& rearLeftMotor,
- SpeedController& frontRightMotor, SpeedController& rearRightMotor);
- RobotDrive(std::shared_ptr<SpeedController> frontLeftMotor,
- std::shared_ptr<SpeedController> rearLeftMotor,
- std::shared_ptr<SpeedController> frontRightMotor,
- std::shared_ptr<SpeedController> rearRightMotor);
- virtual ~RobotDrive() = default;
-
- RobotDrive(const RobotDrive&) = delete;
- RobotDrive& operator=(const RobotDrive&) = delete;
-
- void Drive(double outputMagnitude, double curve);
- void TankDrive(GenericHID* leftStick, GenericHID* rightStick,
- bool squaredInputs = true);
- void TankDrive(GenericHID& leftStick, GenericHID& rightStick,
- bool squaredInputs = true);
- void TankDrive(GenericHID* leftStick, int leftAxis, GenericHID* rightStick,
- int rightAxis, bool squaredInputs = true);
- void TankDrive(GenericHID& leftStick, int leftAxis, GenericHID& rightStick,
- int rightAxis, bool squaredInputs = true);
- void TankDrive(double leftValue, double rightValue,
- bool squaredInputs = true);
- void ArcadeDrive(GenericHID* stick, bool squaredInputs = true);
- void ArcadeDrive(GenericHID& stick, bool squaredInputs = true);
- void ArcadeDrive(GenericHID* moveStick, int moveChannel,
- GenericHID* rotateStick, int rotateChannel,
- bool squaredInputs = true);
- void ArcadeDrive(GenericHID& moveStick, int moveChannel,
- GenericHID& rotateStick, int rotateChannel,
- bool squaredInputs = true);
- void ArcadeDrive(double moveValue, double rotateValue,
- bool squaredInputs = true);
- void MecanumDrive_Cartesian(double x, double y, double rotation,
- double gyroAngle = 0.0);
- void MecanumDrive_Polar(double magnitude, double direction, double rotation);
- void HolonomicDrive(double magnitude, double direction, double rotation);
- virtual void SetLeftRightMotorOutputs(double leftOutput, double rightOutput);
- void SetInvertedMotor(MotorType motor, bool isInverted);
- void SetSensitivity(double sensitivity);
- void SetMaxOutput(double maxOutput);
-
- void SetExpiration(double timeout) override;
- double GetExpiration() const override;
- bool IsAlive() const override;
- void StopMotor() override;
- bool IsSafetyEnabled() const override;
- void SetSafetyEnabled(bool enabled) override;
- void GetDescription(std::ostringstream& desc) const override;
-
- protected:
- void InitRobotDrive();
- double Limit(double num);
- void Normalize(double* wheelSpeeds);
- void RotateVector(double& x, double& y, double angle);
-
- static const int kMaxNumberOfMotors = 4;
-
- int m_invertedMotors[kMaxNumberOfMotors] = {1, 1, 1, 1};
- double m_sensitivity = 0.5;
- double m_maxOutput = 1.0;
- bool m_deleteSpeedControllers;
- std::shared_ptr<SpeedController> m_frontLeftMotor;
- std::shared_ptr<SpeedController> m_frontRightMotor;
- std::shared_ptr<SpeedController> m_rearLeftMotor;
- std::shared_ptr<SpeedController> m_rearRightMotor;
- // FIXME: MotorSafetyHelper *m_safetyHelper;
-
- private:
- int GetNumMotors() {
- int motors = 0;
- if (m_frontLeftMotor) motors++;
- if (m_frontRightMotor) motors++;
- if (m_rearLeftMotor) motors++;
- if (m_rearRightMotor) motors++;
- return motors;
- }
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/SafePWM.h b/third_party/allwpilib_2017/wpilibc/sim/include/SafePWM.h
deleted file mode 100644
index 91eaa8e..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/SafePWM.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-
-#include "MotorSafety.h"
-#include "MotorSafetyHelper.h"
-#include "PWM.h"
-
-namespace frc {
-
-/**
- * A safe version of the PWM class.
- *
- * It is safe because it implements the MotorSafety interface that provides
- * timeouts in the event that the motor value is not updated before the
- * expiration time. This delegates the actual work to a MotorSafetyHelper
- * object that is used for all objects that implement MotorSafety.
- */
-class SafePWM : public PWM, public MotorSafety {
- public:
- explicit SafePWM(int channel);
- virtual ~SafePWM() = default;
-
- void SetExpiration(double timeout);
- double GetExpiration() const;
- bool IsAlive() const;
- void StopMotor();
- bool IsSafetyEnabled() const;
- void SetSafetyEnabled(bool enabled);
- void GetDescription(std::ostringstream& desc) const;
-
- virtual void SetSpeed(double speed);
-
- private:
- std::unique_ptr<MotorSafetyHelper> m_safetyHelper;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/SampleRobot.h b/third_party/allwpilib_2017/wpilibc/sim/include/SampleRobot.h
deleted file mode 100644
index 09051e5..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/SampleRobot.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "RobotBase.h"
-
-namespace frc {
-
-class SampleRobot : public RobotBase {
- public:
- SampleRobot();
- virtual ~SampleRobot() = default;
- virtual void RobotInit();
- virtual void Disabled();
- virtual void Autonomous();
- virtual void OperatorControl();
- virtual void Test();
- virtual void RobotMain();
- void StartCompetition();
-
- private:
- bool m_robotMainOverridden;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/SensorBase.h b/third_party/allwpilib_2017/wpilibc/sim/include/SensorBase.h
deleted file mode 100644
index f03f523..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/SensorBase.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <stdint.h>
-
-#include "Base.h"
-#include "ErrorBase.h"
-
-namespace frc {
-
-/**
- * Base class for all sensors.
- * Stores most recent status information as well as containing utility functions
- * for checking channels and error processing.
- */
-class SensorBase : public ErrorBase {
- public:
- SensorBase() = default;
- virtual ~SensorBase() = default;
-
- SensorBase(const SensorBase&) = delete;
- SensorBase& operator=(const SensorBase&) = delete;
-
- static int GetDefaultSolenoidModule() { return 0; }
-
- static bool CheckSolenoidModule(int moduleNumber);
- static bool CheckDigitalChannel(int channel);
- static bool CheckRelayChannel(int channel);
- static bool CheckPWMChannel(int channel);
- static bool CheckAnalogInputChannel(int channel);
- static bool CheckAnalogOutputChannel(int channel);
- static bool CheckSolenoidChannel(int channel);
- static bool CheckPDPChannel(int channel);
-
- static const int kDigitalChannels = 26;
- static const int kAnalogInputs = 8;
- static const int kAnalogOutputs = 2;
- static const int kSolenoidChannels = 8;
- static const int kSolenoidModules = 63;
- static const int kPwmChannels = 20;
- static const int kRelayChannels = 8;
- static const int kPDPChannels = 16;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/Solenoid.h b/third_party/allwpilib_2017/wpilibc/sim/include/Solenoid.h
deleted file mode 100644
index a819af1..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/Solenoid.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 <memory>
-#include <string>
-
-#include "LiveWindow/LiveWindowSendable.h"
-#include "simulation/SimContinuousOutput.h"
-#include "tables/ITableListener.h"
-
-namespace frc {
-
-/**
- * Solenoid class for running high voltage Digital Output (PCM).
- *
- * The Solenoid class is typically used for pneumatics solenoids, but could be
- * used for any device within the current spec of the PCM.
- */
-class Solenoid : public LiveWindowSendable, public ITableListener {
- public:
- explicit Solenoid(int channel);
- Solenoid(int moduleNumber, int channel);
- virtual ~Solenoid();
- virtual void Set(bool on);
- virtual bool Get() const;
-
- void ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew) override;
- void UpdateTable() override;
- void StartLiveWindowMode() override;
- void StopLiveWindowMode() override;
- std::string GetSmartDashboardType() const override;
- void InitTable(std::shared_ptr<ITable> subTable) override;
- std::shared_ptr<ITable> GetTable() const override;
-
- private:
- SimContinuousOutput* m_impl;
- bool m_on;
-
- std::shared_ptr<ITable> m_table;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/SpeedController.h b/third_party/allwpilib_2017/wpilibc/sim/include/SpeedController.h
deleted file mode 100644
index 97057c3..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/SpeedController.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "PIDOutput.h"
-
-namespace frc {
-
-/**
- * Interface for speed controlling devices.
- */
-class SpeedController : public PIDOutput {
- public:
- virtual ~SpeedController() = default;
- /**
- * Common interface for setting the speed of a speed controller.
- *
- * @param speed The speed to set. Value should be between -1.0 and 1.0.
- */
- virtual void Set(double speed) = 0;
- /**
- * Common interface for getting the current set speed of a speed controller.
- *
- * @return The current set speed. Value is between -1.0 and 1.0.
- */
- virtual double Get() const = 0;
- /**
- * Common interface for disabling a motor.
- */
- virtual void Disable() = 0;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/Talon.h b/third_party/allwpilib_2017/wpilibc/sim/include/Talon.h
deleted file mode 100644
index f54568d..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/Talon.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "PIDOutput.h"
-#include "SafePWM.h"
-#include "SpeedController.h"
-
-namespace frc {
-
-/**
- * CTRE Talon Speed Controller.
- */
-class Talon : public SafePWM, public SpeedController {
- public:
- explicit Talon(int channel);
- virtual ~Talon() = default;
- virtual void Set(double value);
- virtual double Get() const;
- virtual void Disable();
-
- void PIDWrite(double output) override;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/Victor.h b/third_party/allwpilib_2017/wpilibc/sim/include/Victor.h
deleted file mode 100644
index 7899a2e..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/Victor.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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 "PIDOutput.h"
-#include "SafePWM.h"
-#include "SpeedController.h"
-
-namespace frc {
-
-/**
- * IFI Victor Speed Controller.
- */
-class Victor : public SafePWM, public SpeedController {
- public:
- explicit Victor(int channel);
- virtual ~Victor() = default;
- virtual void Set(double value);
- virtual double Get() const;
- virtual void Disable();
-
- void PIDWrite(double output) override;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/WPILib.h b/third_party/allwpilib_2017/wpilibc/sim/include/WPILib.h
deleted file mode 100644
index 17518f5..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/WPILib.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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
-
-#define SIMULATION "gazebo"
-
-#include <cstring>
-#include <iostream>
-
-#include "AnalogGyro.h"
-#include "AnalogInput.h"
-#include "AnalogPotentiometer.h"
-#include "Buttons/Button.h"
-#include "Buttons/InternalButton.h"
-#include "Buttons/JoystickButton.h"
-#include "Buttons/NetworkButton.h"
-#include "Buttons/Trigger.h"
-#include "Commands/Command.h"
-#include "Commands/CommandGroup.h"
-#include "Commands/PIDCommand.h"
-#include "Commands/PIDSubsystem.h"
-#include "Commands/PrintCommand.h"
-#include "Commands/Scheduler.h"
-#include "Commands/StartCommand.h"
-#include "Commands/Subsystem.h"
-#include "Commands/WaitCommand.h"
-#include "Commands/WaitForChildren.h"
-#include "Commands/WaitUntilCommand.h"
-#include "Counter.h"
-#include "DigitalInput.h"
-#include "DoubleSolenoid.h"
-#include "Encoder.h"
-#include "GenericHID.h"
-#include "IterativeRobot.h"
-#include "Jaguar.h"
-#include "Joystick.h"
-#include "LiveWindow/LiveWindow.h"
-#include "PIDController.h"
-#include "RobotBase.h"
-#include "RobotDrive.h"
-#include "SampleRobot.h"
-#include "SmartDashboard/SendableChooser.h"
-#include "SmartDashboard/SmartDashboard.h"
-#include "Solenoid.h"
-#include "SpeedController.h"
-#include "Talon.h"
-#include "Victor.h"
-#include "XboxController.h"
-#include "interfaces/Potentiometer.h"
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/simulation/MainNode.h b/third_party/allwpilib_2017/wpilibc/sim/include/simulation/MainNode.h
deleted file mode 100644
index 21e9147..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/simulation/MainNode.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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 <string>
-
-#include <gazebo/gazebo_client.hh>
-#include <gazebo/transport/transport.hh>
-
-#include "simulation/gz_msgs/msgs.h"
-
-namespace frc {
-
-class MainNode {
- public:
- static MainNode* GetInstance() {
- static MainNode instance;
- return &instance;
- }
-
- template <typename M>
- static gazebo::transport::PublisherPtr Advertise(const std::string& topic,
- int queueLimit = 10,
- bool latch = false) {
- return GetInstance()->main->Advertise<M>(topic, queueLimit, latch);
- }
-
- template <typename M, typename T>
- static gazebo::transport::SubscriberPtr Subscribe(
- const std::string& topic,
- void (T::*fp)(const boost::shared_ptr<M const>&), T* obj,
- bool latching = false) {
- return GetInstance()->main->Subscribe(topic, fp, obj, latching);
- }
-
- template <typename M>
- static gazebo::transport::SubscriberPtr Subscribe(
- const std::string& topic, void (*fp)(const boost::shared_ptr<M const>&),
- bool latching = false) {
- return GetInstance()->main->Subscribe(topic, fp, latching);
- }
-
- gazebo::transport::NodePtr main;
-
- private:
- MainNode() {
- bool success = gazebo::client::setup();
-
- if (success) {
- main = gazebo::transport::NodePtr(new gazebo::transport::Node());
- main->Init("frc");
- gazebo::transport::run();
- } else {
- std::cout << "An error has occured setting up gazebo_client!"
- << std::endl;
- }
- }
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimContinuousOutput.h b/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimContinuousOutput.h
deleted file mode 100644
index 819ec64..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimContinuousOutput.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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 <string>
-
-#include <gazebo/transport/transport.hh>
-
-#include "SpeedController.h"
-
-#ifdef _WIN32
-// Ensure that Winsock2.h is included before Windows.h, which can get
-// pulled in by anybody (e.g., Boost).
-#include <Winsock2.h>
-#endif
-
-namespace frc {
-
-class SimContinuousOutput {
- private:
- gazebo::transport::PublisherPtr pub;
- double speed;
-
- public:
- explicit SimContinuousOutput(std::string topic);
-
- /**
- * Set the output value.
- *
- * The value is set using a range of -1.0 to 1.0, appropriately
- * scaling the value.
- *
- * @param value The value between -1.0 and 1.0 to set.
- */
- void Set(double value);
-
- /**
- * @return The most recently set value.
- */
- double Get();
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimDigitalInput.h b/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimDigitalInput.h
deleted file mode 100644
index cddd8e6..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimDigitalInput.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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 <string>
-
-#include <gazebo/transport/transport.hh>
-
-#include "simulation/gz_msgs/msgs.h"
-
-namespace frc {
-
-class SimDigitalInput {
- public:
- explicit SimDigitalInput(std::string topic);
-
- /**
- * @return The value of the potentiometer.
- */
- bool Get();
-
- private:
- bool value;
- gazebo::transport::SubscriberPtr sub;
- void callback(const gazebo::msgs::ConstBoolPtr& msg);
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimEncoder.h b/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimEncoder.h
deleted file mode 100644
index 1c0e9a7..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimEncoder.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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 <string>
-
-#include <gazebo/common/Time.hh>
-#include <gazebo/transport/transport.hh>
-
-#include "simulation/gz_msgs/msgs.h"
-
-namespace frc {
-
-class SimEncoder {
- public:
- explicit SimEncoder(std::string topic);
-
- void Reset();
- void Start();
- void Stop();
- double GetPosition();
- double GetVelocity();
-
- private:
- void sendCommand(std::string cmd);
-
- double position, velocity;
- gazebo::transport::SubscriberPtr posSub, velSub;
- gazebo::transport::PublisherPtr commandPub;
- void positionCallback(const gazebo::msgs::ConstFloat64Ptr& msg);
- void velocityCallback(const gazebo::msgs::ConstFloat64Ptr& msg);
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimFloatInput.h b/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimFloatInput.h
deleted file mode 100644
index c5af157..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimFloatInput.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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 <string>
-
-#include <gazebo/transport/transport.hh>
-
-#include "simulation/gz_msgs/msgs.h"
-
-namespace frc {
-
-class SimFloatInput {
- public:
- explicit SimFloatInput(std::string topic);
-
- /**
- * @return The value of the potentiometer.
- */
- double Get();
-
- private:
- double value;
- gazebo::transport::SubscriberPtr sub;
- void callback(const gazebo::msgs::ConstFloat64Ptr& msg);
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimGyro.h b/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimGyro.h
deleted file mode 100644
index 75d774d..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/simulation/SimGyro.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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 <string>
-
-#include <gazebo/transport/transport.hh>
-
-#include "simulation/gz_msgs/msgs.h"
-
-namespace frc {
-
-class SimGyro {
- public:
- explicit SimGyro(std::string topic);
-
- void Reset();
- double GetAngle();
- double GetVelocity();
-
- private:
- void sendCommand(std::string cmd);
-
- double position, velocity;
- gazebo::transport::SubscriberPtr posSub, velSub;
- gazebo::transport::PublisherPtr commandPub;
- void positionCallback(const gazebo::msgs::ConstFloat64Ptr& msg);
- void velocityCallback(const gazebo::msgs::ConstFloat64Ptr& msg);
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/include/simulation/simTime.h b/third_party/allwpilib_2017/wpilibc/sim/include/simulation/simTime.h
deleted file mode 100644
index 8f3802e..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/include/simulation/simTime.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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 <condition_variable>
-#include <mutex>
-
-#include "simulation/SimFloatInput.h"
-
-#ifdef _WIN32
-// Ensure that Winsock2.h is included before Windows.h, which can get
-// pulled in by anybody (e.g., Boost).
-#include <Winsock2.h>
-#endif
-
-namespace wpilib {
-namespace internal {
-extern double simTime;
-extern void time_callback(const gazebo::msgs::ConstFloat64Ptr& msg);
-}
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/AnalogGyro.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/AnalogGyro.cpp
deleted file mode 100644
index 77b231c..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/AnalogGyro.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "AnalogGyro.h"
-
-#include <sstream>
-
-#include "LiveWindow/LiveWindow.h"
-#include "Timer.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-const int AnalogGyro::kOversampleBits = 10;
-const int AnalogGyro::kAverageBits = 0;
-const double AnalogGyro::kSamplesPerSecond = 50.0;
-const double AnalogGyro::kCalibrationSampleTime = 5.0;
-const double AnalogGyro::kDefaultVoltsPerDegreePerSecond = 0.007;
-
-/**
- * Initialize the gyro.
- *
- * Calibrate the gyro by running for a number of samples and computing the
- * center value for this part. Then use the center value as the Accumulator
- * center value for subsequent measurements. It's important to make sure that
- * the robot is not moving while the centering calculations are in progress,
- * this is typically done when the robot is first turned on while it's sitting
- * at rest before the competition starts.
- */
-void AnalogGyro::InitAnalogGyro(int channel) {
- SetPIDSourceType(PIDSourceType::kDisplacement);
-
- std::stringstream ss;
- ss << "analog/" << channel;
- impl = new SimGyro(ss.str());
-
- LiveWindow::GetInstance()->AddSensor("AnalogGyro", channel, this);
-}
-
-/**
- * AnalogGyro constructor with only a channel.
- *
- * @param channel The analog channel the gyro is connected to.
- */
-AnalogGyro::AnalogGyro(int channel) { InitAnalogGyro(channel); }
-
-/**
- * Reset the gyro.
- *
- * Resets the gyro to a heading of zero. This can be used if there is
- * significant drift in the gyro and it needs to be recalibrated after it has
- * been running.
- */
-void AnalogGyro::Reset() { impl->Reset(); }
-
-void AnalogGyro::Calibrate() { Reset(); }
-
-/**
- * Return the actual angle in degrees that the robot is currently facing.
- *
- * The angle is based on the current accumulator value corrected by the
- * oversampling rate, the gyro type and the A/D calibration values. The angle
- * is continuous, that is can go beyond 360 degrees. This make algorithms that
- * wouldn't want to see a discontinuity in the gyro output as it sweeps past 0
- * on the second time around.
- *
- * @return the current heading of the robot in degrees. This heading is based on
- * integration of the returned rate from the gyro.
- */
-double AnalogGyro::GetAngle() const { return impl->GetAngle(); }
-
-/**
- * Return the rate of rotation of the gyro
- *
- * The rate is based on the most recent reading of the gyro analog value
- *
- * @return the current rate in degrees per second
- */
-double AnalogGyro::GetRate() const { return impl->GetVelocity(); }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/AnalogInput.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/AnalogInput.cpp
deleted file mode 100644
index 0c00b6e..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/AnalogInput.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "AnalogInput.h"
-
-#include <sstream>
-
-#include "LiveWindow/LiveWindow.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Construct an analog input.
- *
- * @param channel The channel number to represent.
- */
-AnalogInput::AnalogInput(int channel) : m_channel(channel) {
- std::stringstream ss;
- ss << "analog/" << channel;
- m_impl = new SimFloatInput(ss.str());
-
- LiveWindow::GetInstance()->AddSensor("AnalogInput", channel, this);
-}
-
-/**
- * Get a scaled sample straight from this channel.
- *
- * The value is scaled to units of Volts using the calibrated scaling data from
- * GetLSBWeight() and GetOffset().
- *
- * @return A scaled sample straight from this channel.
- */
-double AnalogInput::GetVoltage() const { return m_impl->Get(); }
-
-/**
- * Get a scaled sample from the output of the oversample and average engine for
- * this channel.
- *
- * The value is scaled to units of Volts using the calibrated scaling data from
- * GetLSBWeight() and GetOffset(). Using oversampling will cause this value to
- * be higher resolution, but it will update more slowly. Using averaging will
- * cause this value to be more stable, but it will update more slowly.
- *
- * @return A scaled sample from the output of the oversample and average engine
- * for this channel.
- */
-double AnalogInput::GetAverageVoltage() const { return m_impl->Get(); }
-
-/**
- * Get the channel number.
- *
- * @return The channel number.
- */
-int AnalogInput::GetChannel() const { return m_channel; }
-
-/**
- * Get the Average value for the PID Source base object.
- *
- * @return The average voltage.
- */
-double AnalogInput::PIDGet() { return GetAverageVoltage(); }
-
-void AnalogInput::UpdateTable() {
- if (m_table != nullptr) {
- m_table->PutNumber("Value", GetAverageVoltage());
- }
-}
-
-void AnalogInput::StartLiveWindowMode() {}
-
-void AnalogInput::StopLiveWindowMode() {}
-
-std::string AnalogInput::GetSmartDashboardType() const {
- return "Analog Input";
-}
-
-void AnalogInput::InitTable(std::shared_ptr<ITable> subTable) {
- m_table = subTable;
- UpdateTable();
-}
-
-std::shared_ptr<ITable> AnalogInput::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/AnalogPotentiometer.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/AnalogPotentiometer.cpp
deleted file mode 100644
index dcffea6..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/AnalogPotentiometer.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "AnalogPotentiometer.h"
-
-using namespace frc;
-
-/**
- * Common initialization code called by all constructors.
- */
-void AnalogPotentiometer::initPot(AnalogInput* input, double scale,
- double offset) {
- m_scale = scale;
- m_offset = offset;
- m_analog_input = input;
-}
-
-AnalogPotentiometer::AnalogPotentiometer(int channel, double scale,
- double offset) {
- m_init_analog_input = true;
- initPot(new AnalogInput(channel), scale, offset);
-}
-
-AnalogPotentiometer::AnalogPotentiometer(AnalogInput* input, double scale,
- double offset) {
- m_init_analog_input = false;
- initPot(input, scale, offset);
-}
-
-AnalogPotentiometer::AnalogPotentiometer(AnalogInput& input, double scale,
- double offset) {
- m_init_analog_input = false;
- initPot(&input, scale, offset);
-}
-
-AnalogPotentiometer::~AnalogPotentiometer() {
- if (m_init_analog_input) {
- delete m_analog_input;
- m_init_analog_input = false;
- }
-}
-
-/**
- * Get the current reading of the potentiomere.
- *
- * @return The current position of the potentiometer.
- */
-double AnalogPotentiometer::Get() const {
- return m_analog_input->GetVoltage() * m_scale + m_offset;
-}
-
-/**
- * Implement the PIDSource interface.
- *
- * @return The current reading.
- */
-double AnalogPotentiometer::PIDGet() { return Get(); }
-
-/**
- * @return the Smart Dashboard Type
- */
-std::string AnalogPotentiometer::GetSmartDashboardType() const {
- return "Analog Input";
-}
-
-/**
- * Live Window code, only does anything if live window is activated.
- */
-void AnalogPotentiometer::InitTable(std::shared_ptr<ITable> subtable) {
- m_table = subtable;
- UpdateTable();
-}
-
-void AnalogPotentiometer::UpdateTable() {
- if (m_table != nullptr) {
- m_table->PutNumber("Value", Get());
- }
-}
-
-std::shared_ptr<ITable> AnalogPotentiometer::GetTable() const {
- return m_table;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/DigitalInput.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/DigitalInput.cpp
deleted file mode 100644
index a560761..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/DigitalInput.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "DigitalInput.h"
-
-#include <sstream>
-
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Create an instance of a Digital Input class.
- * Creates a digital input given a channel and uses the default module.
- *
- * @param channel The digital channel (1..14).
- */
-DigitalInput::DigitalInput(int channel) : m_channel(channel) {
- std::stringstream ss;
- ss << "dio/" << channel;
- m_impl = new SimDigitalInput(ss.str());
-}
-
-/**
- * Get the value from a digital input channel.
- * Retrieve the value of a single digital input channel from the FPGA.
- */
-int DigitalInput::Get() const { return m_impl->Get(); }
-
-/**
- * @return The GPIO channel number that this object represents.
- */
-int DigitalInput::GetChannel() const { return m_channel; }
-
-void DigitalInput::UpdateTable() {
- if (m_table != nullptr) {
- m_table->PutBoolean("Value", Get());
- }
-}
-
-void DigitalInput::StartLiveWindowMode() {}
-
-void DigitalInput::StopLiveWindowMode() {}
-
-std::string DigitalInput::GetSmartDashboardType() const {
- return "DigitalInput";
-}
-
-void DigitalInput::InitTable(std::shared_ptr<ITable> subTable) {
- m_table = subTable;
- UpdateTable();
-}
-
-std::shared_ptr<ITable> DigitalInput::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/DoubleSolenoid.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/DoubleSolenoid.cpp
deleted file mode 100644
index 1607dc8..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/DoubleSolenoid.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "DoubleSolenoid.h"
-
-#include "LiveWindow/LiveWindow.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Constructor.
- *
- * @param forwardChannel The forward channel on the module to control.
- * @param reverseChannel The reverse channel on the module to control.
- */
-DoubleSolenoid::DoubleSolenoid(int forwardChannel, int reverseChannel)
- : DoubleSolenoid(1, forwardChannel, reverseChannel) {}
-
-/**
- * Constructor.
- *
- * @param moduleNumber The solenoid module (1 or 2).
- * @param forwardChannel The forward channel on the module to control.
- * @param reverseChannel The reverse channel on the module to control.
- */
-DoubleSolenoid::DoubleSolenoid(int moduleNumber, int forwardChannel,
- int reverseChannel) {
- m_reversed = false;
- if (reverseChannel < forwardChannel) { // Swap ports to get the right address
- int channel = reverseChannel;
- reverseChannel = forwardChannel;
- forwardChannel = channel;
- m_reversed = true;
- }
- std::stringstream ss;
- ss << "pneumatic/" << moduleNumber << "/" << forwardChannel << "/"
- << moduleNumber << "/" << reverseChannel;
- m_impl = new SimContinuousOutput(ss.str());
-
- LiveWindow::GetInstance()->AddActuator("DoubleSolenoid", moduleNumber,
- forwardChannel, this);
-}
-
-DoubleSolenoid::~DoubleSolenoid() {
- if (m_table != nullptr) m_table->RemoveTableListener(this);
-}
-
-/**
- * Set the value of a solenoid.
- *
- * @param value Move the solenoid to forward, reverse, or don't move it.
- */
-void DoubleSolenoid::Set(Value value) {
- m_value = value;
- switch (value) {
- case kOff:
- m_impl->Set(0);
- break;
- case kForward:
- m_impl->Set(m_reversed ? -1 : 1);
- break;
- case kReverse:
- m_impl->Set(m_reversed ? 1 : -1);
- break;
- }
-}
-
-/**
- * Read the current value of the solenoid.
- *
- * @return The current value of the solenoid.
- */
-DoubleSolenoid::Value DoubleSolenoid::Get() const { return m_value; }
-
-void DoubleSolenoid::ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value,
- bool isNew) {
- if (!value->IsString()) return;
- Value lvalue = kOff;
- if (value->GetString() == "Forward")
- lvalue = kForward;
- else if (value->GetString() == "Reverse")
- lvalue = kReverse;
- Set(lvalue);
-}
-
-void DoubleSolenoid::UpdateTable() {
- if (m_table != nullptr) {
- m_table->PutString(
- "Value", (Get() == kForward ? "Forward"
- : (Get() == kReverse ? "Reverse" : "Off")));
- }
-}
-
-void DoubleSolenoid::StartLiveWindowMode() {
- Set(kOff);
- if (m_table != nullptr) {
- m_table->AddTableListener("Value", this, true);
- }
-}
-
-void DoubleSolenoid::StopLiveWindowMode() {
- Set(kOff);
- if (m_table != nullptr) {
- m_table->RemoveTableListener(this);
- }
-}
-
-std::string DoubleSolenoid::GetSmartDashboardType() const {
- return "Double Solenoid";
-}
-
-void DoubleSolenoid::InitTable(std::shared_ptr<ITable> subTable) {
- m_table = subTable;
- UpdateTable();
-}
-
-std::shared_ptr<ITable> DoubleSolenoid::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/DriverStation.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/DriverStation.cpp
deleted file mode 100644
index 1e43556..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/DriverStation.cpp
+++ /dev/null
@@ -1,410 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "DriverStation.h"
-
-#include <boost/mem_fn.hpp>
-
-#include "HAL/cpp/Log.h"
-#include "Timer.h"
-#include "Utility.h"
-#include "WPIErrors.h"
-#include "simulation/MainNode.h"
-
-using namespace frc;
-
-const int DriverStation::kBatteryChannel;
-const int DriverStation::kJoystickPorts;
-const int DriverStation::kJoystickAxes;
-const double DriverStation::kUpdatePeriod = 0.02;
-int DriverStation::m_updateNumber = 0;
-
-/**
- * DriverStation contructor.
- *
- * This is only called once the first time GetInstance() is called
- */
-DriverStation::DriverStation() {
- state = gazebo::msgs::DriverStationPtr(new gazebo::msgs::DriverStation());
- stateSub =
- MainNode::Subscribe("~/ds/state", &DriverStation::stateCallback, this);
- // TODO: for loop + boost bind
- joysticks[0] = gazebo::msgs::FRCJoystickPtr(new gazebo::msgs::FRCJoystick());
- joysticksSub[0] = MainNode::Subscribe(
- "~/ds/joysticks/0", &DriverStation::joystickCallback0, this);
- joysticks[1] = gazebo::msgs::FRCJoystickPtr(new gazebo::msgs::FRCJoystick());
- joysticksSub[1] = MainNode::Subscribe(
- "~/ds/joysticks/1", &DriverStation::joystickCallback1, this);
- joysticks[2] = gazebo::msgs::FRCJoystickPtr(new gazebo::msgs::FRCJoystick());
- joysticksSub[2] = MainNode::Subscribe(
- "~/ds/joysticks/2", &DriverStation::joystickCallback2, this);
- joysticks[3] = gazebo::msgs::FRCJoystickPtr(new gazebo::msgs::FRCJoystick());
- joysticksSub[3] = MainNode::Subscribe(
- "~/ds/joysticks/5", &DriverStation::joystickCallback3, this);
- joysticks[4] = gazebo::msgs::FRCJoystickPtr(new gazebo::msgs::FRCJoystick());
- joysticksSub[4] = MainNode::Subscribe(
- "~/ds/joysticks/4", &DriverStation::joystickCallback4, this);
- joysticks[5] = gazebo::msgs::FRCJoystickPtr(new gazebo::msgs::FRCJoystick());
- joysticksSub[5] = MainNode::Subscribe(
- "~/ds/joysticks/5", &DriverStation::joystickCallback5, this);
-}
-
-/**
- * Return a pointer to the singleton DriverStation.
- */
-DriverStation& DriverStation::GetInstance() {
- static DriverStation instance;
- return instance;
-}
-
-/**
- * Read the battery voltage. Hardcoded to 12 volts for Simulation.
- *
- * @return The battery voltage.
- */
-double DriverStation::GetBatteryVoltage() const {
- return 12.0; // 12 volts all the time!
-}
-
-/**
- * Get the value of the axis on a joystick.
- * This depends on the mapping of the joystick connected to the specified port.
- *
- * @param stick The joystick to read.
- * @param axis The analog axis value to read from the joystick.
- * @return The value of the axis on the joystick.
- */
-double DriverStation::GetStickAxis(int stick, int axis) {
- if (axis < 0 || axis > (kJoystickAxes - 1)) {
- wpi_setWPIError(BadJoystickAxis);
- return 0.0;
- }
- if (stick < 0 || stick > 5) {
- wpi_setWPIError(BadJoystickIndex);
- return 0.0;
- }
-
- std::unique_lock<std::recursive_mutex> lock(m_joystickMutex);
- if (joysticks[stick] == nullptr || axis >= joysticks[stick]->axes().size()) {
- return 0.0;
- }
- return joysticks[stick]->axes(axis);
-}
-
-/**
- * The state of a specific button (1 - 12) on the joystick.
- *
- * This method only works in simulation, but is more efficient than
- * GetStickButtons.
- *
- * @param stick The joystick to read.
- * @param button The button number to check.
- * @return If the button is pressed.
- */
-bool DriverStation::GetStickButton(int stick, int button) {
- if (stick < 0 || stick >= 6) {
- wpi_setWPIErrorWithContext(ParameterOutOfRange,
- "stick must be between 0 and 5");
- return false;
- }
-
- std::unique_lock<std::recursive_mutex> lock(m_joystickMutex);
- if (joysticks[stick] == nullptr ||
- button >= joysticks[stick]->buttons().size()) {
- return false;
- }
- return joysticks[stick]->buttons(button - 1);
-}
-
-/**
- * The state of the buttons on the joystick.
- *
- * 12 buttons (4 msb are unused) from the joystick.
- *
- * @param stick The joystick to read.
- * @return The state of the buttons on the joystick.
- */
-int16_t DriverStation::GetStickButtons(int stick) {
- if (stick < 0 || stick >= 6) {
- wpi_setWPIErrorWithContext(ParameterOutOfRange,
- "stick must be between 0 and 5");
- return false;
- }
- int16_t btns = 0, btnid;
-
- std::unique_lock<std::recursive_mutex> lock(m_joystickMutex);
- gazebo::msgs::FRCJoystickPtr joy = joysticks[stick];
- for (btnid = 0; btnid < joy->buttons().size() && btnid < 12; btnid++) {
- if (joysticks[stick]->buttons(btnid)) {
- btns |= (1 << btnid);
- }
- }
- return btns;
-}
-
-// 5V divided by 10 bits
-#define kDSAnalogInScaling (5.0 / 1023.0)
-
-/**
- * Get an analog voltage from the Driver Station.
- *
- * The analog values are returned as voltage values for the Driver Station
- * analog inputs. These inputs are typically used for advanced operator
- * interfaces consisting of potentiometers or resistor networks representing
- * values on a rotary switch.
- *
- * @param channel The analog input channel on the driver station to read from.
- * Valid range is 1 - 4.
- * @return The analog voltage on the input.
- */
-double DriverStation::GetAnalogIn(int channel) {
- wpi_setWPIErrorWithContext(UnsupportedInSimulation, "GetAnalogIn");
- return 0.0;
-}
-
-/**
- * Get values from the digital inputs on the Driver Station.
- *
- * Return digital values from the Drivers Station. These values are typically
- * used for buttons and switches on advanced operator interfaces.
- *
- * @param channel The digital input to get. Valid range is 1 - 8.
- */
-bool DriverStation::GetDigitalIn(int channel) {
- wpi_setWPIErrorWithContext(UnsupportedInSimulation, "GetDigitalIn");
- return false;
-}
-
-/**
- * Set a value for the digital outputs on the Driver Station.
- *
- * Control digital outputs on the Drivers Station. These values are typically
- * used for giving feedback on a custom operator station such as LEDs.
- *
- * @param channel The digital output to set. Valid range is 1 - 8.
- * @param value The state to set the digital output.
- */
-void DriverStation::SetDigitalOut(int channel, bool value) {
- wpi_setWPIErrorWithContext(UnsupportedInSimulation, "SetDigitalOut");
-}
-
-/**
- * Get a value that was set for the digital outputs on the Driver Station.
- *
- * @param channel The digital ouput to monitor. Valid range is 1 through 8.
- * @return A digital value being output on the Drivers Station.
- */
-bool DriverStation::GetDigitalOut(int channel) {
- wpi_setWPIErrorWithContext(UnsupportedInSimulation, "GetDigitalOut");
- return false;
-}
-
-bool DriverStation::IsEnabled() const {
- std::unique_lock<std::recursive_mutex> lock(m_stateMutex);
- return state != nullptr ? state->enabled() : false;
-}
-
-bool DriverStation::IsDisabled() const { return !IsEnabled(); }
-
-bool DriverStation::IsAutonomous() const {
- std::unique_lock<std::recursive_mutex> lock(m_stateMutex);
- return state != nullptr
- ? state->state() == gazebo::msgs::DriverStation_State_AUTO
- : false;
-}
-
-bool DriverStation::IsOperatorControl() const {
- return !(IsAutonomous() || IsTest());
-}
-
-bool DriverStation::IsTest() const {
- std::unique_lock<std::recursive_mutex> lock(m_stateMutex);
- return state != nullptr
- ? state->state() == gazebo::msgs::DriverStation_State_TEST
- : false;
-}
-
-/**
- * Is the driver station attached to a Field Management System?
- * @return True if the robot is competing on a field being controlled by a Field
- * Management System
- */
-bool DriverStation::IsFMSAttached() const {
- return false; // No FMS in simulation
-}
-
-/**
- * Return the alliance that the driver station says it is on.
- * This could return kRed or kBlue.
- * @return The Alliance enum
- */
-DriverStation::Alliance DriverStation::GetAlliance() const {
- // if (m_controlData->dsID_Alliance == 'R') return kRed;
- // if (m_controlData->dsID_Alliance == 'B') return kBlue;
- // wpi_assert(false);
- return kInvalid; // TODO: Support alliance colors
-}
-
-/**
- * Return the driver station location on the field.
- * This could return 1, 2, or 3.
- * @return The location of the driver station
- */
-int DriverStation::GetLocation() const {
- return -1; // TODO: Support locations
-}
-
-/**
- * Wait until a new packet comes from the driver station.
- *
- * This blocks on a semaphore, so the waiting is efficient.
- *
- * This is a good way to delay processing until there is new driver station data
- * to act on.
- */
-void DriverStation::WaitForData() { WaitForData(0); }
-
-/**
- * Wait until a new packet comes from the driver station, or wait for a timeout.
- *
- * If the timeout is less then or equal to 0, wait indefinitely.
- *
- * Timeout is in milliseconds
- *
- * This blocks on a semaphore, so the waiting is efficient.
- *
- * This is a good way to delay processing until there is new driver station data
- * to act on.
- *
- * @param timeout Timeout time in seconds
- *
- * @return true if new data, otherwise false
- */
-bool DriverStation::WaitForData(double timeout) {
-#if defined(_MSC_VER) && _MSC_VER < 1900
- auto timeoutTime = std::chrono::steady_clock::now() +
- std::chrono::duration<int64_t, std::nano>(
- static_cast<int64_t>(timeout * 1e9));
-#else
- auto timeoutTime =
- std::chrono::steady_clock::now() + std::chrono::duration<double>(timeout);
-#endif
-
- std::unique_lock<priority_mutex> lock(m_waitForDataMutex);
- while (!m_updatedControlLoopData) {
- if (timeout > 0) {
- auto timedOut = m_waitForDataCond.wait_until(lock, timeoutTime);
- if (timedOut == std::cv_status::timeout) {
- return false;
- }
- } else {
- m_waitForDataCond.wait(lock);
- }
- }
- m_updatedControlLoopData = false;
- return true;
-}
-
-/**
- * Return the approximate match time.
- * The FMS does not currently send the official match time to the robots
- * This returns the time since the enable signal sent from the Driver Station
- * At the beginning of autonomous, the time is reset to 0.0 seconds
- * At the beginning of teleop, the time is reset to +15.0 seconds
- * If the robot is disabled, this returns 0.0 seconds
- * Warning: This is not an official time (so it cannot be used to argue with
- * referees)
- * @return Match time in seconds since the beginning of autonomous
- */
-double DriverStation::GetMatchTime() const {
- if (m_approxMatchTimeOffset < 0.0) return 0.0;
- return Timer::GetFPGATimestamp() - m_approxMatchTimeOffset;
-}
-
-/**
- * Report an error to the DriverStation messages window.
- * The error is also printed to the program console.
- */
-void DriverStation::ReportError(llvm::StringRef error) {
- std::cout << error << std::endl;
-}
-
-/**
- * Report a warning to the DriverStation messages window.
- * The warning is also printed to the program console.
- */
-void DriverStation::ReportWarning(llvm::StringRef error) {
- std::cout << error << std::endl;
-}
-
-/**
- * Report an error to the DriverStation messages window.
- * The error is also printed to the program console.
- */
-void DriverStation::ReportError(bool is_error, int code, llvm::StringRef error,
- llvm::StringRef location,
- llvm::StringRef stack) {
- if (!location.empty())
- std::cout << (is_error ? "Error" : "Warning") << " at " << location << ": ";
- std::cout << error << std::endl;
- if (!stack.empty()) std::cout << stack << std::endl;
-}
-
-/**
- * Return the team number that the Driver Station is configured for.
- * @return The team number
- */
-uint16_t DriverStation::GetTeamNumber() const { return 348; }
-
-void DriverStation::stateCallback(
- const gazebo::msgs::ConstDriverStationPtr& msg) {
- {
- std::unique_lock<std::recursive_mutex> lock(m_stateMutex);
- *state = *msg;
- }
- {
- std::lock_guard<priority_mutex> lock(m_waitForDataMutex);
- m_updatedControlLoopData = true;
- }
- m_waitForDataCond.notify_all();
-}
-
-void DriverStation::joystickCallback(
- const gazebo::msgs::ConstFRCJoystickPtr& msg, int i) {
- std::unique_lock<std::recursive_mutex> lock(m_joystickMutex);
- *(joysticks[i]) = *msg;
-}
-
-void DriverStation::joystickCallback0(
- const gazebo::msgs::ConstFRCJoystickPtr& msg) {
- joystickCallback(msg, 0);
-}
-
-void DriverStation::joystickCallback1(
- const gazebo::msgs::ConstFRCJoystickPtr& msg) {
- joystickCallback(msg, 1);
-}
-
-void DriverStation::joystickCallback2(
- const gazebo::msgs::ConstFRCJoystickPtr& msg) {
- joystickCallback(msg, 2);
-}
-
-void DriverStation::joystickCallback3(
- const gazebo::msgs::ConstFRCJoystickPtr& msg) {
- joystickCallback(msg, 3);
-}
-
-void DriverStation::joystickCallback4(
- const gazebo::msgs::ConstFRCJoystickPtr& msg) {
- joystickCallback(msg, 4);
-}
-
-void DriverStation::joystickCallback5(
- const gazebo::msgs::ConstFRCJoystickPtr& msg) {
- joystickCallback(msg, 5);
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/Encoder.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/Encoder.cpp
deleted file mode 100644
index cef4bef..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/Encoder.cpp
+++ /dev/null
@@ -1,388 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Encoder.h"
-
-#include <sstream>
-
-#include "LiveWindow/LiveWindow.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Common initialization code for Encoders.
- * This code allocates resources for Encoders and is common to all constructors.
- *
- * The counter will start counting immediately.
- *
- * @param reverseDirection If true, counts down instead of up (this is all
- * relative)
- * @param encodingType either k1X, k2X, or k4X to indicate 1X, 2X or 4X
- * decoding. If 4X is selected, then an encoder FPGA
- * object is used and the returned counts will be 4x
- * the encoder spec'd value since all rising and
- * falling edges are counted. If 1X or 2X are selected
- * then a counter object will be used and the returned
- * value will either exactly match the spec'd count or
- * be double (2x) the spec'd count.
- */
-void Encoder::InitEncoder(int channelA, int channelB, bool reverseDirection,
- EncodingType encodingType) {
- m_table = nullptr;
- this->channelA = channelA;
- this->channelB = channelB;
- m_encodingType = encodingType;
- m_encodingScale = encodingType == k4X ? 4 : encodingType == k2X ? 2 : 1;
-
- int index = 0;
- m_distancePerPulse = 1.0;
-
- LiveWindow::GetInstance()->AddSensor("Encoder", channelA, this);
-
- if (channelB < channelA) { // Swap ports
- int channel = channelB;
- channelB = channelA;
- channelA = channel;
- m_reverseDirection = !reverseDirection;
- } else {
- m_reverseDirection = reverseDirection;
- }
- std::stringstream ss;
- ss << "dio/" << channelA << "/" << channelB;
- impl = new SimEncoder(ss.str());
- impl->Start();
-}
-
-/**
- * Encoder constructor.
- *
- * Construct a Encoder given a and b channels.
- *
- * The counter will start counting immediately.
- *
- * @param aChannel The a channel digital input channel.
- * @param bChannel The b channel digital input channel.
- * @param reverseDirection If true, counts down instead of up (this is all
- * relative)
- * @param encodingType either k1X, k2X, or k4X to indicate 1X, 2X or 4X
- * decoding. If 4X is selected, then an encoder FPGA
- * object is used and the returned counts will be 4x
- * the encoder spec'd value since all rising and
- * falling edges are counted. If 1X or 2X are selected
- * then a counter object will be used and the returned
- * value will either exactly match the spec'd count or
- * be double (2x) the spec'd count.
- */
-Encoder::Encoder(int aChannel, int bChannel, bool reverseDirection,
- EncodingType encodingType) {
- InitEncoder(aChannel, bChannel, reverseDirection, encodingType);
-}
-
-/**
- * Encoder constructor.
- *
- * Construct a Encoder given a and b channels as digital inputs. This is used in
- * the case where the digital inputs are shared. The Encoder class will not
- * allocate the digital inputs and assume that they already are counted.
- *
- * The counter will start counting immediately.
- *
- * @param aSource The source that should be used for the a channel.
- * @param bSource the source that should be used for the b channel.
- * @param reverseDirection If true, counts down instead of up (this is all
- * relative)
- * @param encodingType either k1X, k2X, or k4X to indicate 1X, 2X or 4X
- * decoding. If 4X is selected, then an encoder FPGA
- * object is used and the returned counts will be 4x
- * the encoder spec'd value since all rising and
- * falling edges are counted. If 1X or 2X are selected
- * then a counter object will be used and the returned
- * value will either exactly match the spec'd count or
- * be double (2x) the spec'd count.
- */
-/* TODO: [Not Supported] Encoder::Encoder(DigitalSource *aSource, DigitalSource
-*bSource, bool reverseDirection, EncodingType encodingType) :
- m_encoder(nullptr),
- m_counter(nullptr)
-{
- m_aSource = aSource;
- m_bSource = bSource;
- m_allocatedASource = false;
- m_allocatedBSource = false;
- if (m_aSource == nullptr || m_bSource == nullptr)
- wpi_setWPIError(NullParameter);
- else
- InitEncoder(reverseDirection, encodingType);
- }*/
-
-/**
- * Encoder constructor.
- *
- * Construct a Encoder given a and b channels as digital inputs. This is used in
- * the case where the digital inputs are shared. The Encoder class will not
- * allocate the digital inputs and assume that they already are counted.
- *
- * The counter will start counting immediately.
- *
- * @param aSource The source that should be used for the a channel.
- * @param bSource the source that should be used for the b channel.
- * @param reverseDirection If true, counts down instead of up (this is all
- * relative)
- * @param encodingType either k1X, k2X, or k4X to indicate 1X, 2X or 4X
- * decoding. If 4X is selected, then an encoder FPGA
- * object is used and the returned counts will be 4x
- * the encoder spec'd value since all rising and
- * falling edges are counted. If 1X or 2X are selected
- * then a counter object will be used and the returned
- * value will either exactly match the spec'd count or
- * be double (2x) the spec'd count.
- */
-/*// TODO: [Not Supported] Encoder::Encoder(DigitalSource &aSource,
-DigitalSource &bSource, bool reverseDirection, EncodingType encodingType) :
- m_encoder(nullptr),
- m_counter(nullptr)
-{
- m_aSource = &aSource;
- m_bSource = &bSource;
- m_allocatedASource = false;
- m_allocatedBSource = false;
- InitEncoder(reverseDirection, encodingType);
- }*/
-
-/**
- * Reset the Encoder distance to zero.
- *
- * Resets the current count to zero on the encoder.
- */
-void Encoder::Reset() { impl->Reset(); }
-
-/**
- * Determine if the encoder is stopped.
- *
- * Using the MaxPeriod value, a boolean is returned that is true if the encoder
- * is considered stopped and false if it is still moving. A stopped encoder is
- * one where the most recent pulse width exceeds the MaxPeriod.
- *
- * @return True if the encoder is considered stopped.
- */
-bool Encoder::GetStopped() const {
- throw "Simulation doesn't currently support this method.";
-}
-
-/**
- * The last direction the encoder value changed.
- *
- * @return The last direction the encoder value changed.
- */
-bool Encoder::GetDirection() const {
- throw "Simulation doesn't currently support this method.";
-}
-
-/**
- * The scale needed to convert a raw counter value into a number of encoder
- * pulses.
- */
-double Encoder::DecodingScaleFactor() const {
- switch (m_encodingType) {
- case k1X:
- return 1.0;
- case k2X:
- return 0.5;
- case k4X:
- return 0.25;
- default:
- return 0.0;
- }
-}
-
-/**
- * The encoding scale factor 1x, 2x, or 4x, per the requested encodingType.
- *
- * Used to divide raw edge counts down to spec'd counts.
- */
-int Encoder::GetEncodingScale() const { return m_encodingScale; }
-
-/**
- * Gets the raw value from the encoder.
- *
- * The raw value is the actual count unscaled by the 1x, 2x, or 4x scale
- * factor.
- *
- * @return Current raw count from the encoder
- */
-int Encoder::GetRaw() const {
- throw "Simulation doesn't currently support this method.";
-}
-
-/**
- * Gets the current count.
- *
- * Returns the current count on the Encoder.
- * This method compensates for the decoding type.
- *
- * @return Current count from the Encoder adjusted for the 1x, 2x, or 4x scale
- * factor.
- */
-int Encoder::Get() const {
- throw "Simulation doesn't currently support this method.";
-}
-
-/**
- * Returns the period of the most recent pulse.
- *
- * Returns the period of the most recent Encoder pulse in seconds.
- * This method compenstates for the decoding type.
- *
- * @deprecated Use GetRate() in favor of this method. This returns unscaled
- * periods and GetRate() scales using value from
- * SetDistancePerPulse().
- *
- * @return Period in seconds of the most recent pulse.
- */
-double Encoder::GetPeriod() const {
- throw "Simulation doesn't currently support this method.";
-}
-
-/**
- * Sets the maximum period for stopped detection.
- *
- * Sets the value that represents the maximum period of the Encoder before it
- * will assume that the attached device is stopped. This timeout allows users
- * to determine if the wheels or other shaft has stopped rotating.
- * This method compensates for the decoding type.
- *
- * @deprecated Use SetMinRate() in favor of this method. This takes unscaled
- * periods and SetMinRate() scales using value from
- * SetDistancePerPulse().
- *
- * @param maxPeriod The maximum time between rising and falling edges before the
- * FPGA will report the device stopped. This is expressed in
- * seconds.
- */
-void Encoder::SetMaxPeriod(double maxPeriod) {
- throw "Simulation doesn't currently support this method.";
-}
-
-/**
- * Get the distance the robot has driven since the last reset.
- *
- * @return The distance driven since the last reset as scaled by the value from
- * SetDistancePerPulse().
- */
-double Encoder::GetDistance() const {
- return m_distancePerPulse * impl->GetPosition();
-}
-
-/**
- * Get the current rate of the encoder.
- *
- * Units are distance per second as scaled by the value from
- * SetDistancePerPulse().
- *
- * @return The current rate of the encoder.
- */
-double Encoder::GetRate() const {
- return m_distancePerPulse * impl->GetVelocity();
-}
-
-/**
- * Set the minimum rate of the device before the hardware reports it stopped.
- *
- * @param minRate The minimum rate. The units are in distance per second as
- * scaled by the value from SetDistancePerPulse().
- */
-void Encoder::SetMinRate(double minRate) {
- throw "Simulation doesn't currently support this method.";
-}
-
-/**
- * Set the distance per pulse for this encoder.
- *
- * This sets the multiplier used to determine the distance driven based on the
- * count value from the encoder. Do not include the decoding type in this scale.
- * The library already compensates for the decoding type. Set this value based
- * on the encoder's rated Pulses per Revolution and factor in gearing reductions
- * following the encoder shaft. This distance can be in any units you like,
- * linear or angular.
- *
- * @param distancePerPulse The scale factor that will be used to convert pulses
- * to useful units.
- */
-void Encoder::SetDistancePerPulse(double distancePerPulse) {
- if (m_reverseDirection) {
- m_distancePerPulse = -distancePerPulse;
- } else {
- m_distancePerPulse = distancePerPulse;
- }
-}
-
-/**
- * Set the direction sensing for this encoder.
- *
- * This sets the direction sensing on the encoder so that it could count in the
- * correct software direction regardless of the mounting.
- *
- * @param reverseDirection true if the encoder direction should be reversed
- */
-void Encoder::SetReverseDirection(bool reverseDirection) {
- throw "Simulation doesn't currently support this method.";
-}
-
-/**
- * Set which parameter of the encoder you are using as a process control
- * variable.
- *
- * @param pidSource An enum to select the parameter.
- */
-void Encoder::SetPIDSourceType(PIDSourceType pidSource) {
- m_pidSource = pidSource;
-}
-
-/**
- * Implement the PIDSource interface.
- *
- * @return The current value of the selected source parameter.
- */
-double Encoder::PIDGet() {
- switch (m_pidSource) {
- case PIDSourceType::kDisplacement:
- return GetDistance();
- case PIDSourceType::kRate:
- return GetRate();
- default:
- return 0.0;
- }
-}
-
-void Encoder::UpdateTable() {
- if (m_table != nullptr) {
- m_table->PutNumber("Speed", GetRate());
- m_table->PutNumber("Distance", GetDistance());
- m_table->PutNumber("Distance per Tick", m_reverseDirection
- ? -m_distancePerPulse
- : m_distancePerPulse);
- }
-}
-
-void Encoder::StartLiveWindowMode() {}
-
-void Encoder::StopLiveWindowMode() {}
-
-std::string Encoder::GetSmartDashboardType() const {
- if (m_encodingType == k4X)
- return "Quadrature Encoder";
- else
- return "Encoder";
-}
-
-void Encoder::InitTable(std::shared_ptr<ITable> subTable) {
- m_table = subTable;
- UpdateTable();
-}
-
-std::shared_ptr<ITable> Encoder::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/GenericHID.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/GenericHID.cpp
deleted file mode 100644
index c76e03d..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/GenericHID.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "GenericHID.h"
-
-#include "DriverStation.h"
-
-using namespace frc;
-
-GenericHID::GenericHID(int port) : m_ds(DriverStation::GetInstance()) {
- m_port = port;
-}
-
-/**
- * Get the value of the axis.
- *
- * @param axis The axis to read, starting at 0.
- * @return The value of the axis.
- */
-double GenericHID::GetRawAxis(int axis) const {
- return m_ds.GetStickAxis(m_port, axis);
-}
-
-/**
- * Get the button value (starting at button 1)
- *
- * The buttons are returned in a single 16 bit value with one bit representing
- * the state of each button. The appropriate button is returned as a boolean
- * value.
- *
- * @param button The button number to be read (starting at 1)
- * @return The state of the button.
- **/
-bool GenericHID::GetRawButton(int button) const {
- return m_ds.GetStickButton(m_port, button);
-}
-
-/**
- * Get the angle in degrees of a POV on the HID.
- *
- * The POV angles start at 0 in the up direction, and increase clockwise
- * (e.g. right is 90, upper-left is 315).
- *
- * @param pov The index of the POV to read (starting at 0)
- * @return the angle of the POV in degrees, or -1 if the POV is not pressed.
- */
-int GenericHID::GetPOV(int pov) const { return 0; }
-
-/**
- * Get the number of POVs for the HID.
- *
- * @return the number of POVs for the current HID
- */
-int GenericHID::GetPOVCount() const { return 0; }
-
-/**
- * Get the port number of the HID.
- *
- * @return The port number of the HID.
- */
-int GenericHID::GetPort() const { return m_port; }
-
-/**
- * Get the type of the HID.
- *
- * @return the type of the HID.
- */
-GenericHID::HIDType GenericHID::GetType() const { return HIDType::kUnknown; }
-
-/**
- * Get the name of the HID.
- *
- * @return the name of the HID.
- */
-std::string GenericHID::GetName() const { return ""; }
-
-/**
- * Set a single HID output value for the HID.
- *
- * @param outputNumber The index of the output to set (1-32)
- * @param value The value to set the output to
- */
-
-void GenericHID::SetOutput(int outputNumber, bool value) {
- m_outputs =
- (m_outputs & ~(1 << (outputNumber - 1))) | (value << (outputNumber - 1));
-}
-
-/**
- * Set all output values for the HID.
- *
- * @param value The 32 bit output value (1 bit for each output)
- */
-void GenericHID::SetOutputs(int value) { m_outputs = value; }
-
-/**
- * Set the rumble output for the HID.
- *
- * The DS currently supports 2 rumble values, left rumble and right rumble.
- *
- * @param type Which rumble value to set
- * @param value The normalized value (0 to 1) to set the rumble to
- */
-void GenericHID::SetRumble(RumbleType type, double value) {
- if (value < 0)
- value = 0;
- else if (value > 1)
- value = 1;
- if (type == kLeftRumble) {
- m_leftRumble = value * 65535;
- } else {
- m_rightRumble = value * 65535;
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/IterativeRobot.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/IterativeRobot.cpp
deleted file mode 100644
index 9a37c05..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/IterativeRobot.cpp
+++ /dev/null
@@ -1,223 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "IterativeRobot.h"
-
-#include "DriverStation.h"
-#include "LiveWindow/LiveWindow.h"
-#include "networktables/NetworkTable.h"
-
-// not sure what this is used for yet.
-#ifdef _UNIX
-#include <unistd.h>
-#endif
-
-using namespace frc;
-
-/**
- * Provide an alternate "main loop" via StartCompetition().
- *
- * This specific StartCompetition() implements "main loop" behavior like that of
- * the FRC control system in 2008 and earlier, with a primary (slow) loop that
- * is called periodically, and a "fast loop" (a.k.a. "spin loop") that is
- * called as fast as possible with no delay between calls.
- */
-void IterativeRobot::StartCompetition() {
- LiveWindow* lw = LiveWindow::GetInstance();
- // first and one-time initialization
- NetworkTable::GetTable("LiveWindow")
- ->GetSubTable("~STATUS~")
- ->PutBoolean("LW Enabled", false);
- RobotInit();
-
- // loop forever, calling the appropriate mode-dependent function
- lw->SetEnabled(false);
- while (true) {
- // Call the appropriate function depending upon the current robot mode
- if (IsDisabled()) {
- // call DisabledInit() if we are now just entering disabled mode from
- // either a different mode or from power-on
- if (!m_disabledInitialized) {
- lw->SetEnabled(false);
- DisabledInit();
- m_disabledInitialized = true;
- // reset the initialization flags for the other modes
- m_autonomousInitialized = false;
- m_teleopInitialized = false;
- m_testInitialized = false;
- }
- // TODO: HALNetworkCommunicationObserveUserProgramDisabled();
- DisabledPeriodic();
- } else if (IsAutonomous()) {
- // call AutonomousInit() if we are now just entering autonomous mode from
- // either a different mode or from power-on
- if (!m_autonomousInitialized) {
- lw->SetEnabled(false);
- AutonomousInit();
- m_autonomousInitialized = true;
- // reset the initialization flags for the other modes
- m_disabledInitialized = false;
- m_teleopInitialized = false;
- m_testInitialized = false;
- }
- // TODO: HALNetworkCommunicationObserveUserProgramAutonomous();
- AutonomousPeriodic();
- } else if (IsTest()) {
- // call TestInit() if we are now just entering test mode from
- // either a different mode or from power-on
- if (!m_testInitialized) {
- lw->SetEnabled(true);
- TestInit();
- m_testInitialized = true;
- // reset the initialization flags for the other modes
- m_disabledInitialized = false;
- m_autonomousInitialized = false;
- m_teleopInitialized = false;
- }
- // TODO: HALNetworkCommunicationObserveUserProgramTest();
- TestPeriodic();
- } else {
- // call TeleopInit() if we are now just entering teleop mode from
- // either a different mode or from power-on
- if (!m_teleopInitialized) {
- lw->SetEnabled(false);
- TeleopInit();
- m_teleopInitialized = true;
- // reset the initialization flags for the other modes
- m_disabledInitialized = false;
- m_autonomousInitialized = false;
- m_testInitialized = false;
- Scheduler::GetInstance()->SetEnabled(true);
- }
- // TODO: HALNetworkCommunicationObserveUserProgramTeleop();
- TeleopPeriodic();
- }
- // wait for driver station data so the loop doesn't hog the CPU
- m_ds.WaitForData();
- }
-}
-
-/**
- * Robot-wide initialization code should go here.
- *
- * Users should override this method for default Robot-wide initialization which
- * will be called when the robot is first powered on. It will be called
- * exactly 1 time.
- */
-void IterativeRobot::RobotInit() {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
-}
-
-/**
- * Initialization code for disabled mode should go here.
- *
- * Users should override this method for initialization code which will be
- * called each time the robot enters disabled mode.
- */
-void IterativeRobot::DisabledInit() {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
-}
-
-/**
- * Initialization code for autonomous mode should go here.
- *
- * Users should override this method for initialization code which will be
- * called each time the robot enters autonomous mode.
- */
-void IterativeRobot::AutonomousInit() {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
-}
-
-/**
- * Initialization code for teleop mode should go here.
- *
- * Users should override this method for initialization code which will be
- * called each time the robot enters teleop mode.
- */
-void IterativeRobot::TeleopInit() {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
-}
-
-/**
- * Initialization code for test mode should go here.
- *
- * Users should override this method for initialization code which will be
- * called each time the robot enters test mode.
- */
-void IterativeRobot::TestInit() {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
-}
-
-/**
- * Periodic code for all modes should go here.
- *
- * Users should override this method for code which will be called periodically
- * at a regular rate while the robot is in any mode.
- */
-void IterativeRobot::RobotPeriodic() {
- static bool firstRun = true;
- if (firstRun) {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
- firstRun = false;
- }
-}
-
-/**
- * Periodic code for disabled mode should go here.
- *
- * Users should override this method for code which will be called periodically
- * at a regular rate while the robot is in disabled mode.
- */
-void IterativeRobot::DisabledPeriodic() {
- static bool firstRun = true;
- if (firstRun) {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
- firstRun = false;
- }
-}
-
-/**
- * Periodic code for autonomous mode should go here.
- *
- * Users should override this method for code which will be called periodically
- * at a regular rate while the robot is in autonomous mode.
- */
-void IterativeRobot::AutonomousPeriodic() {
- static bool firstRun = true;
- if (firstRun) {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
- firstRun = false;
- }
-}
-
-/**
- * Periodic code for teleop mode should go here.
- *
- * Users should override this method for code which will be called periodically
- * at a regular rate while the robot is in teleop mode.
- */
-void IterativeRobot::TeleopPeriodic() {
- static bool firstRun = true;
- if (firstRun) {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
- firstRun = false;
- }
-}
-
-/**
- * Periodic code for test mode should go here.
- *
- * Users should override this method for code which will be called periodically
- * at a regular rate while the robot is in test mode.
- */
-void IterativeRobot::TestPeriodic() {
- static bool firstRun = true;
- if (firstRun) {
- std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
- firstRun = false;
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/Jaguar.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/Jaguar.cpp
deleted file mode 100644
index 84c3470..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/Jaguar.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Jaguar.h"
-
-#include "LiveWindow/LiveWindow.h"
-
-using namespace frc;
-
-/**
- * @param channel The PWM channel that the Jaguar is attached to.
- */
-Jaguar::Jaguar(int channel) : SafePWM(channel) {
- /*
- * Input profile defined by Luminary Micro.
- *
- * Full reverse ranges from 0.671325ms to 0.6972211ms
- * Proportional reverse ranges from 0.6972211ms to 1.4482078ms
- * Neutral ranges from 1.4482078ms to 1.5517922ms
- * Proportional forward ranges from 1.5517922ms to 2.3027789ms
- * Full forward ranges from 2.3027789ms to 2.328675ms
- */
- SetBounds(2.31, 1.55, 1.507, 1.454, .697);
- SetPeriodMultiplier(kPeriodMultiplier_1X);
- SetRaw(m_centerPwm);
-
- LiveWindow::GetInstance()->AddActuator("Jaguar", GetChannel(), this);
-}
-
-/**
- * Set the PWM value.
- *
- * The PWM value is set using a range of -1.0 to 1.0, appropriately
- * scaling the value for the FPGA.
- *
- * @param speed The speed value between -1.0 and 1.0 to set.
- */
-void Jaguar::Set(double speed) { SetSpeed(speed); }
-
-/**
- * Get the recently set value of the PWM.
- *
- * @return The most recently set value for the PWM between -1.0 and 1.0.
- */
-double Jaguar::Get() const { return GetSpeed(); }
-
-/**
- * Common interface for disabling a motor.
- */
-void Jaguar::Disable() { SetRaw(kPwmDisabled); }
-
-/**
- * Write out the PID value as seen in the PIDOutput base object.
- *
- * @param output Write out the PWM value as was found in the PIDController
- */
-void Jaguar::PIDWrite(double output) { Set(output); }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/Joystick.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/Joystick.cpp
deleted file mode 100644
index fc697b1..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/Joystick.cpp
+++ /dev/null
@@ -1,274 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Joystick.h"
-
-#include <cmath>
-
-#include "DriverStation.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-const int Joystick::kDefaultXAxis;
-const int Joystick::kDefaultYAxis;
-const int Joystick::kDefaultZAxis;
-const int Joystick::kDefaultTwistAxis;
-const int Joystick::kDefaultThrottleAxis;
-const int Joystick::kDefaultTriggerButton;
-const int Joystick::kDefaultTopButton;
-static Joystick* joysticks[DriverStation::kJoystickPorts];
-static bool joySticksInitialized = false;
-
-/**
- * Construct an instance of a joystick.
- *
- * The joystick index is the USB port on the Driver Station.
- *
- * @param port The port on the Driver Station that the joystick is plugged into
- * (0-5).
- */
-Joystick::Joystick(int port) : Joystick(port, kNumAxisTypes, kNumButtonTypes) {
- m_axes[kXAxis] = kDefaultXAxis;
- m_axes[kYAxis] = kDefaultYAxis;
- m_axes[kZAxis] = kDefaultZAxis;
- m_axes[kTwistAxis] = kDefaultTwistAxis;
- m_axes[kThrottleAxis] = kDefaultThrottleAxis;
-
- m_buttons[kTriggerButton] = kDefaultTriggerButton;
- m_buttons[kTopButton] = kDefaultTopButton;
-}
-
-/**
- * Version of the constructor to be called by sub-classes.
- *
- * This constructor allows the subclass to configure the number of constants
- * for axes and buttons.
- *
- * @param port The port on the Driver Station that the joystick is
- * plugged into.
- * @param numAxisTypes The number of axis types in the enum.
- * @param numButtonTypes The number of button types in the enum.
- */
-Joystick::Joystick(int port, int numAxisTypes, int numButtonTypes)
- : JoystickBase(port),
- m_ds(DriverStation::GetInstance()),
- m_axes(numAxisTypes),
- m_buttons(numButtonTypes) {
- if (!joySticksInitialized) {
- for (auto& joystick : joysticks) joystick = nullptr;
- joySticksInitialized = true;
- }
- if (GetPort() >= DriverStation::kJoystickPorts) {
- wpi_setWPIError(BadJoystickIndex);
- } else {
- joysticks[GetPort()] = this;
- }
-}
-
-Joystick* Joystick::GetStickForPort(int port) {
- Joystick* stick = joysticks[port];
- if (stick == nullptr) {
- stick = new Joystick(port);
- joysticks[port] = stick;
- }
- return stick;
-}
-
-/**
- * Get the X value of the joystick.
- *
- * This depends on the mapping of the joystick connected to the current port.
- *
- * @param hand This parameter is ignored for the Joystick class and is only
- * here to complete the GenericHID interface.
- */
-double Joystick::GetX(JoystickHand hand) const {
- return GetRawAxis(m_axes[kXAxis]);
-}
-
-/**
- * Get the Y value of the joystick.
- *
- * This depends on the mapping of the joystick connected to the current port.
- *
- * @param hand This parameter is ignored for the Joystick class and is only
- * here to complete the GenericHID interface.
- */
-double Joystick::GetY(JoystickHand hand) const {
- return GetRawAxis(m_axes[kYAxis]);
-}
-
-/**
- * Get the Z value of the current joystick.
- *
- * This depends on the mapping of the joystick connected to the current port.
- */
-double Joystick::GetZ(JoystickHand hand) const {
- return GetRawAxis(m_axes[kZAxis]);
-}
-
-/**
- * Get the twist value of the current joystick.
- *
- * This depends on the mapping of the joystick connected to the current port.
- */
-double Joystick::GetTwist() const { return GetRawAxis(m_axes[kTwistAxis]); }
-
-/**
- * Get the throttle value of the current joystick.
- *
- * This depends on the mapping of the joystick connected to the current port.
- */
-double Joystick::GetThrottle() const {
- return GetRawAxis(m_axes[kThrottleAxis]);
-}
-
-/**
- * For the current joystick, return the axis determined by the argument.
- *
- * This is for cases where the joystick axis is returned programatically,
- * otherwise one of the previous functions would be preferable (for example
- * GetX()).
- *
- * @param axis The axis to read.
- * @return The value of the axis.
- */
-double Joystick::GetAxis(AxisType axis) const {
- switch (axis) {
- case kXAxis:
- return this->GetX();
- case kYAxis:
- return this->GetY();
- case kZAxis:
- return this->GetZ();
- case kTwistAxis:
- return this->GetTwist();
- case kThrottleAxis:
- return this->GetThrottle();
- default:
- wpi_setWPIError(BadJoystickAxis);
- return 0.0;
- }
-}
-
-/**
- * Read the state of the trigger on the joystick.
- *
- * Look up which button has been assigned to the trigger and read its state.
- *
- * @param hand This parameter is ignored for the Joystick class and is only
- * here to complete the GenericHID interface.
- * @return The state of the trigger.
- */
-bool Joystick::GetTrigger(JoystickHand hand) const {
- return GetRawButton(m_buttons[kTriggerButton]);
-}
-
-/**
- * Read the state of the top button on the joystick.
- *
- * Look up which button has been assigned to the top and read its state.
- *
- * @param hand This parameter is ignored for the Joystick class and is only
- * here to complete the GenericHID interface.
- * @return The state of the top button.
- */
-bool Joystick::GetTop(JoystickHand hand) const {
- return GetRawButton(m_buttons[kTopButton]);
-}
-
-/**
- * Get buttons based on an enumerated type.
- *
- * The button type will be looked up in the list of buttons and then read.
- *
- * @param button The type of button to read.
- * @return The state of the button.
- */
-bool Joystick::GetButton(ButtonType button) const {
- switch (button) {
- case kTriggerButton:
- return GetTrigger();
- case kTopButton:
- return GetTop();
- default:
- return false;
- }
-}
-
-/**
- * Get the number of axis for a joystick
- *
- * @return the number of axis for the current joystick
- */
-int Joystick::GetAxisCount() const { return 0; }
-
-/**
- * Get the axis type of a joystick axis.
- *
- * @return the axis type of a joystick axis.
- */
-int Joystick::GetAxisType(int axis) const { return 0; }
-
-/**
- * Get the number of buttons for a joystick.
- *
- * @return the number of buttons on the current joystick
- */
-int Joystick::GetButtonCount() const { return 0; }
-
-/**
- * Get the channel currently associated with the specified axis.
- *
- * @param axis The axis to look up the channel for.
- * @return The channel fr the axis.
- */
-int Joystick::GetAxisChannel(AxisType axis) const { return m_axes[axis]; }
-
-/**
- * Set the channel associated with a specified axis.
- *
- * @param axis The axis to set the channel for.
- * @param channel The channel to set the axis to.
- */
-void Joystick::SetAxisChannel(AxisType axis, int channel) {
- m_axes[axis] = channel;
-}
-
-/**
- * Get the magnitude of the direction vector formed by the joystick's
- * current position relative to its origin.
- *
- * @return The magnitude of the direction vector
- */
-double Joystick::GetMagnitude() const {
- return std::sqrt(std::pow(GetX(), 2) + std::pow(GetY(), 2));
-}
-
-/**
- * Get the direction of the vector formed by the joystick and its origin
- * in radians.
- *
- * @return The direction of the vector in radians
- */
-double Joystick::GetDirectionRadians() const {
- return std::atan2(GetX(), -GetY());
-}
-
-/**
- * Get the direction of the vector formed by the joystick and its origin
- * in degrees.
- *
- * uses std::acos(-1) to represent Pi due to absence of readily accessible Pi
- * constant in C++
- *
- * @return The direction of the vector in degrees
- */
-double Joystick::GetDirectionDegrees() const {
- return (180 / std::acos(-1)) * GetDirectionRadians();
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/MotorSafetyHelper.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/MotorSafetyHelper.cpp
deleted file mode 100644
index df4ecde..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/MotorSafetyHelper.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "MotorSafetyHelper.h"
-
-#include <sstream>
-
-#include "DriverStation.h"
-#include "MotorSafety.h"
-#include "Timer.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-std::set<MotorSafetyHelper*> MotorSafetyHelper::m_helperList;
-priority_recursive_mutex MotorSafetyHelper::m_listMutex;
-
-/**
- * The constructor for a MotorSafetyHelper object.
- *
- * The helper object is constructed for every object that wants to implement the
- * Motor Safety protocol. The helper object has the code to actually do the
- * timing and call the motors Stop() method when the timeout expires. The motor
- * object is expected to call the Feed() method whenever the motors value is
- * updated.
- *
- * @param safeObject a pointer to the motor object implementing MotorSafety.
- * This is used to call the Stop() method on the motor.
- */
-MotorSafetyHelper::MotorSafetyHelper(MotorSafety* safeObject)
- : m_safeObject(safeObject) {
- m_enabled = false;
- m_expiration = DEFAULT_SAFETY_EXPIRATION;
- m_stopTime = Timer::GetFPGATimestamp();
-
- std::lock_guard<priority_recursive_mutex> sync(m_listMutex);
- m_helperList.insert(this);
-}
-
-MotorSafetyHelper::~MotorSafetyHelper() {
- std::lock_guard<priority_recursive_mutex> sync(m_listMutex);
- m_helperList.erase(this);
-}
-
-/**
- * Feed the motor safety object.
- *
- * Resets the timer on this object that is used to do the timeouts.
- */
-void MotorSafetyHelper::Feed() {
- std::lock_guard<priority_recursive_mutex> sync(m_syncMutex);
- m_stopTime = Timer::GetFPGATimestamp() + m_expiration;
-}
-
-/**
- * Set the expiration time for the corresponding motor safety object.
- *
- * @param expirationTime The timeout value in seconds.
- */
-void MotorSafetyHelper::SetExpiration(double expirationTime) {
- std::lock_guard<priority_recursive_mutex> sync(m_syncMutex);
- m_expiration = expirationTime;
-}
-
-/**
- * Retrieve the timeout value for the corresponding motor safety object.
- *
- * @return the timeout value in seconds.
- */
-double MotorSafetyHelper::GetExpiration() const {
- std::lock_guard<priority_recursive_mutex> sync(m_syncMutex);
- return m_expiration;
-}
-
-/**
- * Determine if the motor is still operating or has timed out.
- *
- * @return a true value if the motor is still operating normally and hasn't
- * timed out.
- */
-bool MotorSafetyHelper::IsAlive() const {
- std::lock_guard<priority_recursive_mutex> sync(m_syncMutex);
- return !m_enabled || m_stopTime > Timer::GetFPGATimestamp();
-}
-
-/**
- * Check if this motor has exceeded its timeout.
- *
- * This method is called periodically to determine if this motor has exceeded
- * its timeout value. If it has, the stop method is called, and the motor is
- * shut down until its value is updated again.
- */
-void MotorSafetyHelper::Check() {
- DriverStation& ds = DriverStation::GetInstance();
- if (!m_enabled || ds.IsDisabled() || ds.IsTest()) return;
-
- std::lock_guard<priority_recursive_mutex> sync(m_syncMutex);
- if (m_stopTime < Timer::GetFPGATimestamp()) {
- std::ostringstream desc;
- m_safeObject->GetDescription(desc);
- desc << "... Output not updated often enough.";
- wpi_setWPIErrorWithContext(Timeout, desc.str().c_str());
- m_safeObject->StopMotor();
- }
-}
-
-/**
- * Enable/disable motor safety for this device.
- *
- * Turn on and off the motor safety option for this PWM object.
- *
- * @param enabled True if motor safety is enforced for this object
- */
-void MotorSafetyHelper::SetSafetyEnabled(bool enabled) {
- std::lock_guard<priority_recursive_mutex> sync(m_syncMutex);
- m_enabled = enabled;
-}
-
-/**
- * Return the state of the motor safety enabled flag.
- *
- * Return if the motor safety is currently enabled for this devicce.
- *
- * @return True if motor safety is enforced for this device
- */
-bool MotorSafetyHelper::IsSafetyEnabled() const {
- std::lock_guard<priority_recursive_mutex> sync(m_syncMutex);
- return m_enabled;
-}
-
-/**
- * Check the motors to see if any have timed out.
- *
- * This static method is called periodically to poll all the motors and stop
- * any that have timed out.
- */
-void MotorSafetyHelper::CheckMotors() {
- std::lock_guard<priority_recursive_mutex> sync(m_listMutex);
- for (auto elem : m_helperList) {
- elem->Check();
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/Notifier.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/Notifier.cpp
deleted file mode 100644
index 7950dae..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/Notifier.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Notifier.h"
-
-#include "Timer.h"
-#include "Utility.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-std::list<Notifier*> Notifier::timerQueue;
-priority_recursive_mutex Notifier::queueMutex;
-std::atomic<int> Notifier::refcount{0};
-std::thread Notifier::m_task;
-std::atomic<bool> Notifier::m_stopped(false);
-
-/**
- * Create a Notifier for timer event notification.
- *
- * @param handler The handler is called at the notification time which is set
- * using StartSingle or StartPeriodic.
- */
-Notifier::Notifier(TimerEventHandler handler) {
- if (handler == nullptr)
- wpi_setWPIErrorWithContext(NullParameter, "handler must not be nullptr");
- m_handler = handler;
- m_periodic = false;
- m_expirationTime = 0;
- m_period = 0;
- m_queued = false;
- {
- std::lock_guard<priority_recursive_mutex> sync(queueMutex);
- // do the first time intialization of static variables
- if (refcount.fetch_add(1) == 0) {
- m_task = std::thread(Run);
- }
- }
-}
-
-/**
- * Free the resources for a timer event.
- *
- * All resources will be freed and the timer event will be removed from the
- * queue if necessary.
- */
-Notifier::~Notifier() {
- {
- std::lock_guard<priority_recursive_mutex> sync(queueMutex);
- DeleteFromQueue();
-
- // Delete the static variables when the last one is going away
- if (refcount.fetch_sub(1) == 1) {
- m_stopped = true;
- m_task.join();
- }
- }
-
- // Acquire the semaphore; this makes certain that the handler is
- // not being executed by the interrupt manager.
- std::lock_guard<priority_mutex> lock(m_handlerMutex);
-}
-
-/**
- * Update the alarm hardware to reflect the current first element in the queue.
- *
- * Compute the time the next alarm should occur based on the current time and
- * the period for the first element in the timer queue.
- *
- * WARNING: this method does not do synchronization! It must be called from
- * somewhere that is taking care of synchronizing access to the queue.
- */
-void Notifier::UpdateAlarm() {}
-
-/**
- * ProcessQueue is called whenever there is a timer interrupt.
- *
- * We need to wake up and process the current top item in the timer queue as
- * long as its scheduled time is after the current time. Then the item is
- * removed or rescheduled (repetitive events) in the queue.
- */
-void Notifier::ProcessQueue(int mask, void* params) {
- Notifier* current;
-
- // keep processing events until no more
- while (true) {
- {
- std::lock_guard<priority_recursive_mutex> sync(queueMutex);
- double currentTime = GetClock();
-
- if (timerQueue.empty()) {
- break;
- }
- current = timerQueue.front();
- if (current->m_expirationTime > currentTime) {
- break; // no more timer events to process
- }
- // remove next entry before processing it
- timerQueue.pop_front();
-
- current->m_queued = false;
- if (current->m_periodic) {
- // if periodic, requeue the event
- // compute when to put into queue
- current->InsertInQueue(true);
- } else {
- // not periodic; removed from queue
- current->m_queued = false;
- }
- // Take handler mutex while holding queue semaphore to make sure
- // the handler will execute to completion in case we are being deleted.
- current->m_handlerMutex.lock();
- }
-
- current->m_handler(); // call the event handler
- current->m_handlerMutex.unlock();
- }
- // reschedule the first item in the queue
- std::lock_guard<priority_recursive_mutex> sync(queueMutex);
- UpdateAlarm();
-}
-
-/**
- * Insert this Notifier into the timer queue in right place.
- *
- * WARNING: this method does not do synchronization! It must be called from
- * somewhere that is taking care of synchronizing access to the queue.
- *
- * @param reschedule If false, the scheduled alarm is based on the curent time
- * and UpdateAlarm method is called which will enable the
- * alarm if necessary. If true, update the time by adding the
- * period (no drift) when rescheduled periodic from
- * ProcessQueue.
- *
- * This ensures that the public methods only update the queue after finishing
- * inserting.
- */
-void Notifier::InsertInQueue(bool reschedule) {
- if (reschedule) {
- m_expirationTime += m_period;
- } else {
- m_expirationTime = GetClock() + m_period;
- }
-
- // Attempt to insert new entry into queue
- for (auto i = timerQueue.begin(); i != timerQueue.end(); i++) {
- if ((*i)->m_expirationTime > m_expirationTime) {
- timerQueue.insert(i, this);
- m_queued = true;
- }
- }
-
- /* If the new entry wasn't queued, either the queue was empty or the first
- * element was greater than the new entry.
- */
- if (!m_queued) {
- timerQueue.push_front(this);
-
- if (!reschedule) {
- /* Since the first element changed, update alarm, unless we already
- * plan to
- */
- UpdateAlarm();
- }
-
- m_queued = true;
- }
-}
-
-/**
- * Delete this Notifier from the timer queue.
- *
- * WARNING: this method does not do synchronization! It must be called from
- * somewhere that is taking care of synchronizing access to the queue.
- *
- * Remove this Notifier from the timer queue and adjust the next interrupt time
- * to reflect the current top of the queue.
- */
-void Notifier::DeleteFromQueue() {
- if (m_queued) {
- m_queued = false;
- wpi_assert(!timerQueue.empty());
- if (timerQueue.front() == this) {
- // remove the first item in the list - update the alarm
- timerQueue.pop_front();
- UpdateAlarm();
- } else {
- timerQueue.remove(this);
- }
- }
-}
-
-/**
- * Register for single event notification.
- *
- * A timer event is queued for a single event after the specified delay.
- *
- * @param delay Seconds to wait before the handler is called.
- */
-void Notifier::StartSingle(double delay) {
- std::lock_guard<priority_recursive_mutex> sync(queueMutex);
- m_periodic = false;
- m_period = delay;
- DeleteFromQueue();
- InsertInQueue(false);
-}
-
-/**
- * Register for periodic event notification.
- *
- * A timer event is queued for periodic event notification. Each time the
- * interrupt occurs, the event will be immediately requeued for the same time
- * interval.
- *
- * @param period Period in seconds to call the handler starting one period after
- * the call to this method.
- */
-void Notifier::StartPeriodic(double period) {
- std::lock_guard<priority_recursive_mutex> sync(queueMutex);
- m_periodic = true;
- m_period = period;
- DeleteFromQueue();
- InsertInQueue(false);
-}
-
-/**
- * Stop timer events from occuring.
- *
- * Stop any repeating timer events from occuring. This will also remove any
- * single notification events from the queue. If a timer-based call to the
- * registered handler is in progress, this function will block until the
- * handler call is complete.
- */
-void Notifier::Stop() {
- {
- std::lock_guard<priority_recursive_mutex> sync(queueMutex);
- DeleteFromQueue();
- }
- // Wait for a currently executing handler to complete before returning from
- // Stop()
- std::lock_guard<priority_mutex> sync(m_handlerMutex);
-}
-
-void Notifier::Run() {
- while (!m_stopped) {
- Notifier::ProcessQueue(0, nullptr);
- bool isEmpty;
- {
- std::lock_guard<priority_recursive_mutex> sync(queueMutex);
- isEmpty = timerQueue.empty();
- }
- if (!isEmpty) {
- double expirationTime;
- {
- std::lock_guard<priority_recursive_mutex> sync(queueMutex);
- expirationTime = timerQueue.front()->m_expirationTime;
- }
- Wait(expirationTime - GetClock());
- } else {
- Wait(0.05);
- }
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/PIDController.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/PIDController.cpp
deleted file mode 100644
index 0231eb8..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/PIDController.cpp
+++ /dev/null
@@ -1,643 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "PIDController.h"
-
-#include <cmath>
-
-#include "Notifier.h"
-#include "PIDOutput.h"
-#include "PIDSource.h"
-
-using namespace frc;
-
-static const std::string kP = "p";
-static const std::string kI = "i";
-static const std::string kD = "d";
-static const std::string kF = "f";
-static const std::string kSetpoint = "setpoint";
-static const std::string kEnabled = "enabled";
-
-/**
- * Allocate a PID object with the given constants for P, I, D.
- *
- * @param Kp the proportional coefficient
- * @param Ki the integral coefficient
- * @param Kd the derivative coefficient
- * @param source The PIDSource object that is used to get values
- * @param output The PIDOutput object that is set to the output value
- * @param period the loop time for doing calculations. This particularly effects
- * calculations of the integral and differental terms. The
- * default is 50ms.
- */
-PIDController::PIDController(double Kp, double Ki, double Kd, PIDSource* source,
- PIDOutput* output, double period)
- : PIDController(Kp, Ki, Kd, 0.0, source, output, period) {}
-
-/**
- * Allocate a PID object with the given constants for P, I, D.
- *
- * @param Kp the proportional coefficient
- * @param Ki the integral coefficient
- * @param Kd the derivative coefficient
- * @param source The PIDSource object that is used to get values
- * @param output The PIDOutput object that is set to the output value
- * @param period the loop time for doing calculations. This particularly effects
- * calculations of the integral and differental terms. The
- * default is 50ms.
- */
-PIDController::PIDController(double Kp, double Ki, double Kd, double Kf,
- PIDSource* source, PIDOutput* output,
- double period) {
- m_table = nullptr;
-
- m_P = Kp;
- m_I = Ki;
- m_D = Kd;
- m_F = Kf;
-
- m_maximumOutput = 1.0;
- m_minimumOutput = -1.0;
-
- m_maximumInput = 0;
- m_minimumInput = 0;
-
- m_continuous = false;
- m_enabled = false;
- m_setpoint = 0;
-
- m_prevError = 0;
- m_totalError = 0;
- m_tolerance = .05;
-
- m_result = 0;
-
- m_pidInput = source;
- m_pidOutput = output;
- m_period = period;
-
- m_controlLoop = std::make_unique<Notifier>(&PIDController::Calculate, this);
- m_controlLoop->StartPeriodic(m_period);
-
- static int instances = 0;
- instances++;
-
- m_toleranceType = kNoTolerance;
-}
-
-PIDController::~PIDController() {
- if (m_table != nullptr) m_table->RemoveTableListener(this);
-}
-
-/**
- * Read the input, calculate the output accordingly, and write to the output.
- *
- * This should only be called by the Notifier.
- */
-void PIDController::Calculate() {
- bool enabled;
- PIDSource* pidInput;
-
- {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- if (m_pidInput == 0) return;
- if (m_pidOutput == 0) return;
- enabled = m_enabled;
- pidInput = m_pidInput;
- }
-
- if (enabled) {
- double input = pidInput->PIDGet();
- double result;
- PIDOutput* pidOutput;
-
- {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- m_error = m_setpoint - input;
- if (m_continuous) {
- if (std::fabs(m_error) > (m_maximumInput - m_minimumInput) / 2) {
- if (m_error > 0) {
- m_error = m_error - (m_maximumInput - m_minimumInput);
- } else {
- m_error = m_error + (m_maximumInput - m_minimumInput);
- }
- }
- }
-
- if (m_pidInput->GetPIDSourceType() == PIDSourceType::kRate) {
- if (m_P != 0) {
- double potentialPGain = (m_totalError + m_error) * m_P;
- if (potentialPGain < m_maximumOutput) {
- if (potentialPGain > m_minimumOutput) {
- m_totalError += m_error;
- } else {
- m_totalError = m_minimumOutput / m_P;
- }
- } else {
- m_totalError = m_maximumOutput / m_P;
- }
- }
-
- m_result = m_D * m_error + m_P * m_totalError + CalculateFeedForward();
- } else {
- if (m_I != 0) {
- double potentialIGain = (m_totalError + m_error) * m_I;
- if (potentialIGain < m_maximumOutput) {
- if (potentialIGain > m_minimumOutput) {
- m_totalError += m_error;
- } else {
- m_totalError = m_minimumOutput / m_I;
- }
- } else {
- m_totalError = m_maximumOutput / m_I;
- }
- }
-
- m_result = m_P * m_error + m_I * m_totalError +
- m_D * (m_error - m_prevError) + CalculateFeedForward();
- }
- m_prevError = m_error;
-
- if (m_result > m_maximumOutput)
- m_result = m_maximumOutput;
- else if (m_result < m_minimumOutput)
- m_result = m_minimumOutput;
-
- pidOutput = m_pidOutput;
- result = m_result;
- }
-
- pidOutput->PIDWrite(result);
- }
-}
-
-/**
- * Calculate the feed forward term.
- *
- * Both of the provided feed forward calculations are velocity feed forwards.
- * If a different feed forward calculation is desired, the user can override
- * this function and provide his or her own. This function does no
- * synchronization because the PIDController class only calls it in synchronized
- * code, so be careful if calling it oneself.
- *
- * If a velocity PID controller is being used, the F term should be set to 1
- * over the maximum setpoint for the output. If a position PID controller is
- * being used, the F term should be set to 1 over the maximum speed for the
- * output measured in setpoint units per this controller's update period (see
- * the default period in this class's constructor).
- */
-double PIDController::CalculateFeedForward() {
- if (m_pidInput->GetPIDSourceType() == PIDSourceType::kRate) {
- return m_F * GetSetpoint();
- } else {
- double temp = m_F * GetDeltaSetpoint();
- m_prevSetpoint = m_setpoint;
- m_setpointTimer.Reset();
- return temp;
- }
-}
-
-/**
- * Set the PID Controller gain parameters.
- *
- * Set the proportional, integral, and differential coefficients.
- *
- * @param p Proportional coefficient
- * @param i Integral coefficient
- * @param d Differential coefficient
- */
-void PIDController::SetPID(double p, double i, double d) {
- {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- m_P = p;
- m_I = i;
- m_D = d;
- }
-
- if (m_table != nullptr) {
- m_table->PutNumber("p", m_P);
- m_table->PutNumber("i", m_I);
- m_table->PutNumber("d", m_D);
- }
-}
-
-/**
- * Set the PID Controller gain parameters.
- *
- * Set the proportional, integral, and differential coefficients.
- *
- * @param p Proportional coefficient
- * @param i Integral coefficient
- * @param d Differential coefficient
- * @param f Feed forward coefficient
- */
-void PIDController::SetPID(double p, double i, double d, double f) {
- {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- m_P = p;
- m_I = i;
- m_D = d;
- m_F = f;
- }
-
- if (m_table != nullptr) {
- m_table->PutNumber("p", m_P);
- m_table->PutNumber("i", m_I);
- m_table->PutNumber("d", m_D);
- m_table->PutNumber("f", m_F);
- }
-}
-
-/**
- * Get the Proportional coefficient.
- *
- * @return proportional coefficient
- */
-double PIDController::GetP() const {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- return m_P;
-}
-
-/**
- * Get the Integral coefficient.
- *
- * @return integral coefficient
- */
-double PIDController::GetI() const {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- return m_I;
-}
-
-/**
- * Get the Differential coefficient.
- *
- * @return differential coefficient
- */
-double PIDController::GetD() const {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- return m_D;
-}
-
-/**
- * Get the Feed forward coefficient.
- *
- * @return Feed forward coefficient
- */
-double PIDController::GetF() const {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- return m_F;
-}
-
-/**
- * Return the current PID result.
- *
- * This is always centered on zero and constrained the the max and min outs.
- *
- * @return the latest calculated output
- */
-double PIDController::Get() const {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- return m_result;
-}
-
-/**
- * Set the PID controller to consider the input to be continuous.
- *
- * Rather then using the max and min in as constraints, it considers them to
- * be the same point and automatically calculates the shortest route to
- * the setpoint.
- *
- * @param continuous Set to true turns on continuous, false turns off continuous
- */
-void PIDController::SetContinuous(bool continuous) {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- m_continuous = continuous;
-}
-
-/**
- * Sets the maximum and minimum values expected from the input.
- *
- * @param minimumInput the minimum value expected from the input
- * @param maximumInput the maximum value expected from the output
- */
-void PIDController::SetInputRange(double minimumInput, double maximumInput) {
- {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- m_minimumInput = minimumInput;
- m_maximumInput = maximumInput;
- }
-
- SetSetpoint(m_setpoint);
-}
-
-/**
- * Sets the minimum and maximum values to write.
- *
- * @param minimumOutput the minimum value to write to the output
- * @param maximumOutput the maximum value to write to the output
- */
-void PIDController::SetOutputRange(double minimumOutput, double maximumOutput) {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- m_minimumOutput = minimumOutput;
- m_maximumOutput = maximumOutput;
-}
-
-/**
- * Set the setpoint for the PIDController.
- *
- * @param setpoint the desired setpoint
- */
-void PIDController::SetSetpoint(double setpoint) {
- {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
-
- if (m_maximumInput > m_minimumInput) {
- if (setpoint > m_maximumInput)
- m_setpoint = m_maximumInput;
- else if (setpoint < m_minimumInput)
- m_setpoint = m_minimumInput;
- else
- m_setpoint = setpoint;
- } else {
- m_setpoint = setpoint;
- }
- }
-
- if (m_table != nullptr) {
- m_table->PutNumber("setpoint", m_setpoint);
- }
-}
-
-/**
- * Returns the current setpoint of the PIDController.
- *
- * @return the current setpoint
- */
-double PIDController::GetSetpoint() const {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- return m_setpoint;
-}
-
-/**
- * Returns the change in setpoint over time of the PIDController.
- *
- * @return the change in setpoint over time
- */
-double PIDController::GetDeltaSetpoint() const {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- return (m_setpoint - m_prevSetpoint) / m_setpointTimer.Get();
-}
-
-/**
- * Returns the current difference of the input from the setpoint.
- *
- * @return the current error
- */
-double PIDController::GetError() const {
- double setpoint = GetSetpoint();
- {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- return GetContinuousError(setpoint - m_pidInput->PIDGet());
- }
-}
-
-/**
- * Sets what type of input the PID controller will use.
- */
-void PIDController::SetPIDSourceType(PIDSourceType pidSource) {
- m_pidInput->SetPIDSourceType(pidSource);
-}
-
-/**
- * Returns the type of input the PID controller is using.
- *
- * @return the PID controller input type
- */
-PIDSourceType PIDController::GetPIDSourceType() const {
- return m_pidInput->GetPIDSourceType();
-}
-
-/**
- * Returns the current average of the error over the past few iterations.
- *
- * You can specify the number of iterations to average with SetToleranceBuffer()
- * (defaults to 1). This is the same value that is used for OnTarget().
- *
- * @return the average error
- */
-double PIDController::GetAvgError() const {
- double avgError = 0;
- {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- // Don't divide by zero.
- if (m_buf.size()) avgError = m_bufTotal / m_buf.size();
- }
- return avgError;
-}
-
-/**
- * Set the percentage error which is considered tolerable for use with
- * OnTarget.
- *
- * @param percent percentage error which is tolerable
- */
-void PIDController::SetTolerance(double percent) {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- m_toleranceType = kPercentTolerance;
- m_tolerance = percent;
-}
-
-/**
- * Set the absolute error which is considered tolerable for use with
- * OnTarget.
- *
- * @param absTolerance absolute error which is tolerable
- */
-void PIDController::SetAbsoluteTolerance(double absTolerance) {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- m_toleranceType = kAbsoluteTolerance;
- m_tolerance = absTolerance;
-}
-
-/**
- * Set the percentage error which is considered tolerable for use with
- * OnTarget.
- *
- * @param percent percentage error which is tolerable
- */
-void PIDController::SetPercentTolerance(double percent) {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- m_toleranceType = kPercentTolerance;
- m_tolerance = percent;
-}
-
-/**
- * Set the number of previous error samples to average for tolerancing.
- *
- * When determining whether a mechanism is on target, the user may want to use a
- * rolling average of previous measurements instead of a precise position or
- * velocity. This is useful for noisy sensors which return a few erroneous
- * measurements when the mechanism is on target. However, the mechanism will
- * not register as on target for at least the specified bufLength cycles.
- * @param bufLength Number of previous cycles to average. Defaults to 1.
- */
-void PIDController::SetToleranceBuffer(int bufLength) {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- m_bufLength = bufLength;
-
- // Cut the buffer down to size if needed.
- while (m_buf.size() > bufLength) {
- m_bufTotal -= m_buf.front();
- m_buf.pop();
- }
-}
-
-/**
- * Return true if the error is within the percentage of the total input range,
- * determined by SetTolerance.
- *
- * This asssumes that the maximum and minimum input were set using SetInput.
- * Currently this just reports on target as the actual value passes through the
- * setpoint. Ideally it should be based on being within the tolerance for some
- * period of time.
- */
-bool PIDController::OnTarget() const {
- std::lock_guard<priority_recursive_mutex> sync(m_mutex);
- if (m_buf.size() == 0) return false;
- double error = GetError();
- switch (m_toleranceType) {
- case kPercentTolerance:
- return std::fabs(error) <
- m_tolerance / 100 * (m_maximumInput - m_minimumInput);
- break;
- case kAbsoluteTolerance:
- return std::fabs(error) < m_tolerance;
- break;
- case kNoTolerance: // TODO: this case needs an error
- return false;
- }
- return false;
-}
-
-/**
- * Begin running the PIDController.
- */
-void PIDController::Enable() {
- {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- m_enabled = true;
- }
-
- if (m_table != nullptr) {
- m_table->PutBoolean("enabled", true);
- }
-}
-
-/**
- * Stop running the PIDController, this sets the output to zero before stopping.
- */
-void PIDController::Disable() {
- {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- m_pidOutput->PIDWrite(0);
- m_enabled = false;
- }
-
- if (m_table != nullptr) {
- m_table->PutBoolean("enabled", false);
- }
-}
-
-/**
- * Return true if PIDController is enabled.
- */
-bool PIDController::IsEnabled() const {
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- return m_enabled;
-}
-
-/**
- * Reset the previous error,, the integral term, and disable the controller.
- */
-void PIDController::Reset() {
- Disable();
-
- std::lock_guard<priority_recursive_mutex> lock(m_mutex);
- m_prevError = 0;
- m_totalError = 0;
- m_result = 0;
-}
-
-std::string PIDController::GetSmartDashboardType() const {
- return "PIDController";
-}
-
-void PIDController::InitTable(std::shared_ptr<ITable> table) {
- if (m_table != nullptr) m_table->RemoveTableListener(this);
- m_table = table;
- if (m_table != nullptr) {
- m_table->PutNumber(kP, GetP());
- m_table->PutNumber(kI, GetI());
- m_table->PutNumber(kD, GetD());
- m_table->PutNumber(kF, GetF());
- m_table->PutNumber(kSetpoint, GetSetpoint());
- m_table->PutBoolean(kEnabled, IsEnabled());
- m_table->AddTableListener(this, false);
- }
-}
-
-/**
- * Wraps error around for continuous inputs. The original error is returned if
- * continuous mode is disabled. This is an unsynchronized function.
- *
- * @param error The current error of the PID controller.
- * @return Error for continuous inputs.
- */
-double PIDController::GetContinuousError(double error) const {
- if (m_continuous) {
- if (std::fabs(error) > (m_maximumInput - m_minimumInput) / 2) {
- if (error > 0) {
- return error - (m_maximumInput - m_minimumInput);
- } else {
- return error + (m_maximumInput - m_minimumInput);
- }
- }
- }
-
- return error;
-}
-
-std::shared_ptr<ITable> PIDController::GetTable() const { return m_table; }
-
-void PIDController::ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew) {
- if (key == kP || key == kI || key == kD || key == kF) {
- if (m_P != m_table->GetNumber(kP, 0.0) ||
- m_I != m_table->GetNumber(kI, 0.0) ||
- m_D != m_table->GetNumber(kD, 0.0) ||
- m_F != m_table->GetNumber(kF, 0.0)) {
- SetPID(m_table->GetNumber(kP, 0.0), m_table->GetNumber(kI, 0.0),
- m_table->GetNumber(kD, 0.0), m_table->GetNumber(kF, 0.0));
- }
- } else if (key == kSetpoint && value->IsDouble() &&
- m_setpoint != value->GetDouble()) {
- SetSetpoint(value->GetDouble());
- } else if (key == kEnabled && value->IsBoolean() &&
- m_enabled != value->GetBoolean()) {
- if (value->GetBoolean()) {
- Enable();
- } else {
- Disable();
- }
- }
-}
-
-void PIDController::UpdateTable() {}
-
-void PIDController::StartLiveWindowMode() { Disable(); }
-
-void PIDController::StopLiveWindowMode() {}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/PWM.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/PWM.cpp
deleted file mode 100644
index efdaae7..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/PWM.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "PWM.h"
-
-#include <sstream>
-
-#include "Utility.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-const double PWM::kDefaultPwmPeriod = 5.05;
-const double PWM::kDefaultPwmCenter = 1.5;
-const int PWM::kDefaultPwmStepsDown = 1000;
-const int PWM::kPwmDisabled = 0;
-
-/**
- * Allocate a PWM given a channel number.
- *
- * Checks channel value range and allocates the appropriate channel.
- * The allocation is only done to help users ensure that they don't double
- * assign channels.
- *
- * @param channel The PWM channel number. 0-9 are on-board, 10-19 are on the MXP
- * port
- */
-PWM::PWM(int channel) {
- std::stringstream ss;
-
- if (!CheckPWMChannel(channel)) {
- ss << "PWM Channel " << channel;
- wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, ss.str());
- return;
- }
-
- ss << "pwm/" << channel;
- impl = new SimContinuousOutput(ss.str());
- m_channel = channel;
- m_eliminateDeadband = false;
-
- m_centerPwm = kPwmDisabled; // In simulation, the same thing.
-}
-
-PWM::~PWM() {
- if (m_table != nullptr) m_table->RemoveTableListener(this);
-}
-
-/**
- * Optionally eliminate the deadband from a speed controller.
- *
- * @param eliminateDeadband If true, set the motor curve on the Jaguar to
- * eliminate the deadband in the middle of the range.
- * Otherwise, keep the full range without modifying
- * any values.
- */
-void PWM::EnableDeadbandElimination(bool eliminateDeadband) {
- m_eliminateDeadband = eliminateDeadband;
-}
-
-/**
- * Set the bounds on the PWM values.
- *
- * This sets the bounds on the PWM values for a particular each type of
- * controller. The values determine the upper and lower speeds as well as the
- * deadband bracket.
- *
- * @param max The Minimum pwm value
- * @param deadbandMax The high end of the deadband range
- * @param center The center speed (off)
- * @param deadbandMin The low end of the deadband range
- * @param min The minimum pwm value
- */
-void PWM::SetBounds(int max, int deadbandMax, int center, int deadbandMin,
- int min) {
- // Nothing to do in simulation.
-}
-
-/**
- * Set the bounds on the PWM pulse widths.
- *
- * This sets the bounds on the PWM values for a particular type of controller.
- * The values determine the upper and lower speeds as well as the deadband
- * bracket.
- *
- * @param max The max PWM pulse width in ms
- * @param deadbandMax The high end of the deadband range pulse width in ms
- * @param center The center (off) pulse width in ms
- * @param deadbandMin The low end of the deadband pulse width in ms
- * @param min The minimum pulse width in ms
- */
-void PWM::SetBounds(double max, double deadbandMax, double center,
- double deadbandMin, double min) {
- // Nothing to do in simulation.
-}
-
-/**
- * Set the PWM value based on a position.
- *
- * This is intended to be used by servos.
- *
- * @pre SetMaxPositivePwm() called.
- * @pre SetMinNegativePwm() called.
- *
- * @param pos The position to set the servo between 0.0 and 1.0.
- */
-void PWM::SetPosition(double pos) {
- if (pos < 0.0) {
- pos = 0.0;
- } else if (pos > 1.0) {
- pos = 1.0;
- }
-
- impl->Set(pos);
-}
-
-/**
- * Get the PWM value in terms of a position.
- *
- * This is intended to be used by servos.
- *
- * @pre SetMaxPositivePwm() called.
- * @pre SetMinNegativePwm() called.
- *
- * @return The position the servo is set to between 0.0 and 1.0.
- */
-double PWM::GetPosition() const {
- double value = impl->Get();
- if (value < 0.0) {
- return 0.0;
- } else if (value > 1.0) {
- return 1.0;
- } else {
- return value;
- }
-}
-
-/**
- * Set the PWM value based on a speed.
- *
- * This is intended to be used by speed controllers.
- *
- * @pre SetMaxPositivePwm() called.
- * @pre SetMinPositivePwm() called.
- * @pre SetCenterPwm() called.
- * @pre SetMaxNegativePwm() called.
- * @pre SetMinNegativePwm() called.
- *
- * @param speed The speed to set the speed controller between -1.0 and 1.0.
- */
-void PWM::SetSpeed(double speed) {
- // clamp speed to be in the range 1.0 >= speed >= -1.0
- if (speed < -1.0) {
- speed = -1.0;
- } else if (speed > 1.0) {
- speed = 1.0;
- }
-
- impl->Set(speed);
-}
-
-/**
- * Get the PWM value in terms of speed.
- *
- * This is intended to be used by speed controllers.
- *
- * @pre SetMaxPositivePwm() called.
- * @pre SetMinPositivePwm() called.
- * @pre SetMaxNegativePwm() called.
- * @pre SetMinNegativePwm() called.
- *
- * @return The most recently set speed between -1.0 and 1.0.
- */
-double PWM::GetSpeed() const {
- double value = impl->Get();
- if (value > 1.0) {
- return 1.0;
- } else if (value < -1.0) {
- return -1.0;
- } else {
- return value;
- }
-}
-
-/**
- * Set the PWM value directly to the hardware.
- *
- * Write a raw value to a PWM channel.
- *
- * @param value Raw PWM value.
- */
-void PWM::SetRaw(uint16_t value) {
- wpi_assert(value == kPwmDisabled);
- impl->Set(0);
-}
-
-/**
- * Slow down the PWM signal for old devices.
- *
- * @param mult The period multiplier to apply to this channel
- */
-void PWM::SetPeriodMultiplier(PeriodMultiplier mult) {
- // Do nothing in simulation.
-}
-
-void PWM::ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew) {
- if (!value->IsDouble()) return;
- SetSpeed(value->GetDouble());
-}
-
-void PWM::UpdateTable() {
- if (m_table != nullptr) {
- m_table->PutNumber("Value", GetSpeed());
- }
-}
-
-void PWM::StartLiveWindowMode() {
- SetSpeed(0);
- if (m_table != nullptr) {
- m_table->AddTableListener("Value", this, true);
- }
-}
-
-void PWM::StopLiveWindowMode() {
- SetSpeed(0);
- if (m_table != nullptr) {
- m_table->RemoveTableListener(this);
- }
-}
-
-std::string PWM::GetSmartDashboardType() const { return "Speed Controller"; }
-
-void PWM::InitTable(std::shared_ptr<ITable> subTable) {
- m_table = subTable;
- UpdateTable();
-}
-
-std::shared_ptr<ITable> PWM::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/Relay.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/Relay.cpp
deleted file mode 100644
index 898612a..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/Relay.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Relay.h"
-
-#include <sstream>
-
-#include "LiveWindow/LiveWindow.h"
-#include "MotorSafetyHelper.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-/**
- * Relay constructor given a channel.
- *
- * This code initializes the relay and reserves all resources that need to be
- * locked. Initially the relay is set to both lines at 0v.
- *
- * @param channel The channel number (0-3).
- * @param direction The direction that the Relay object will control.
- */
-Relay::Relay(int channel, Relay::Direction direction)
- : m_channel(channel), m_direction(direction) {
- std::stringstream ss;
- if (!SensorBase::CheckRelayChannel(m_channel)) {
- ss << "Relay Channel " << m_channel;
- wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, ss.str());
- return;
- }
-
- m_safetyHelper = std::make_unique<MotorSafetyHelper>(this);
- m_safetyHelper->SetSafetyEnabled(false);
-
- ss << "relay/" << m_channel;
- impl = new SimContinuousOutput(ss.str()); // TODO: Allow two different relays
- // (targetting the different halves
- // of a relay) to be combined to
- // control one motor.
- LiveWindow::GetInstance()->AddActuator("Relay", 1, m_channel, this);
- go_pos = go_neg = false;
-}
-
-/**
- * Free the resource associated with a relay.
- *
- * The relay channels are set to free and the relay output is turned off.
- */
-Relay::~Relay() {
- impl->Set(0);
- if (m_table != nullptr) m_table->RemoveTableListener(this);
-}
-
-/**
- * Set the relay state.
- *
- * Valid values depend on which directions of the relay are controlled by the
- * object.
- *
- * When set to kBothDirections, the relay can be any of the four states:
- * 0v-0v, 0v-12v, 12v-0v, 12v-12v
- *
- * When set to kForwardOnly or kReverseOnly, you can specify the constant for
- * the direction or you can simply specify kOff and kOn. Using only kOff and
- * kOn is recommended.
- *
- * @param value The state to set the relay.
- */
-void Relay::Set(Relay::Value value) {
- switch (value) {
- case kOff:
- if (m_direction == kBothDirections || m_direction == kForwardOnly) {
- go_pos = false;
- }
- if (m_direction == kBothDirections || m_direction == kReverseOnly) {
- go_neg = false;
- }
- break;
- case kOn:
- if (m_direction == kBothDirections || m_direction == kForwardOnly) {
- go_pos = true;
- }
- if (m_direction == kBothDirections || m_direction == kReverseOnly) {
- go_neg = true;
- }
- break;
- case kForward:
- if (m_direction == kReverseOnly) {
- wpi_setWPIError(IncompatibleMode);
- break;
- }
- if (m_direction == kBothDirections || m_direction == kForwardOnly) {
- go_pos = true;
- }
- if (m_direction == kBothDirections) {
- go_neg = false;
- }
- break;
- case kReverse:
- if (m_direction == kForwardOnly) {
- wpi_setWPIError(IncompatibleMode);
- break;
- }
- if (m_direction == kBothDirections) {
- go_pos = false;
- }
- if (m_direction == kBothDirections || m_direction == kReverseOnly) {
- go_neg = true;
- }
- break;
- }
- impl->Set((go_pos ? 1 : 0) + (go_neg ? -1 : 0));
-}
-
-/**
- * Get the Relay State
- *
- * Gets the current state of the relay.
- *
- * When set to kForwardOnly or kReverseOnly, value is returned as kOn/kOff not
- * kForward/kReverse (per the recommendation in Set).
- *
- * @return The current state of the relay as a Relay::Value
- */
-Relay::Value Relay::Get() const {
- // TODO: Don't assume that the go_pos and go_neg fields are correct?
- if ((go_pos || m_direction == kReverseOnly) &&
- (go_neg || m_direction == kForwardOnly)) {
- return kOn;
- } else if (go_pos) {
- return kForward;
- } else if (go_neg) {
- return kReverse;
- } else {
- return kOff;
- }
-}
-
-int Relay::GetChannel() const { return m_channel; }
-
-/**
- * Set the expiration time for the Relay object.
- *
- * @param timeout The timeout (in seconds) for this relay object
- */
-void Relay::SetExpiration(double timeout) {
- m_safetyHelper->SetExpiration(timeout);
-}
-
-/**
- * Return the expiration time for the relay object.
- *
- * @return The expiration time value.
- */
-double Relay::GetExpiration() const { return m_safetyHelper->GetExpiration(); }
-
-/**
- * Check if the relay object is currently alive or stopped due to a timeout.
- *
- * @return a bool value that is true if the motor has NOT timed out and should
- * still be running.
- */
-bool Relay::IsAlive() const { return m_safetyHelper->IsAlive(); }
-
-/**
- * Stop the motor associated with this PWM object.
- *
- * This is called by the MotorSafetyHelper object when it has a timeout for this
- * relay and needs to stop it from running.
- */
-void Relay::StopMotor() { Set(kOff); }
-
-/**
- * Enable/disable motor safety for this device
- *
- * Turn on and off the motor safety option for this relay object.
- *
- * @param enabled True if motor safety is enforced for this object
- */
-void Relay::SetSafetyEnabled(bool enabled) {
- m_safetyHelper->SetSafetyEnabled(enabled);
-}
-
-/**
- * Check if motor safety is enabled for this object.
- *
- * @return True if motor safety is enforced for this object
- */
-bool Relay::IsSafetyEnabled() const {
- return m_safetyHelper->IsSafetyEnabled();
-}
-
-void Relay::GetDescription(std::ostringstream& desc) const {
- desc << "Relay " << GetChannel();
-}
-
-void Relay::ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew) {
- if (!value->IsString()) return;
- if (value->GetString() == "Off")
- Set(kOff);
- else if (value->GetString() == "Forward")
- Set(kForward);
- else if (value->GetString() == "Reverse")
- Set(kReverse);
-}
-
-void Relay::UpdateTable() {
- if (m_table != nullptr) {
- if (Get() == kOn) {
- m_table->PutString("Value", "On");
- } else if (Get() == kForward) {
- m_table->PutString("Value", "Forward");
- } else if (Get() == kReverse) {
- m_table->PutString("Value", "Reverse");
- } else {
- m_table->PutString("Value", "Off");
- }
- }
-}
-
-void Relay::StartLiveWindowMode() {
- if (m_table != nullptr) {
- m_table->AddTableListener("Value", this, true);
- }
-}
-
-void Relay::StopLiveWindowMode() {
- if (m_table != nullptr) {
- m_table->RemoveTableListener(this);
- }
-}
-
-std::string Relay::GetSmartDashboardType() const { return "Relay"; }
-
-void Relay::InitTable(std::shared_ptr<ITable> subTable) {
- m_table = subTable;
- UpdateTable();
-}
-
-std::shared_ptr<ITable> Relay::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/RobotBase.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/RobotBase.cpp
deleted file mode 100644
index 82a2e65..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/RobotBase.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "RobotBase.h"
-
-#include "RobotState.h"
-#include "SmartDashboard/SmartDashboard.h"
-#include "Utility.h"
-
-using namespace frc;
-
-/**
- * Constructor for a generic robot program.
- *
- * User code should be placed in the constuctor that runs before the Autonomous
- * or Operator Control period starts. The constructor will run to completion
- * before Autonomous is entered.
- *
- * This must be used to ensure that the communications code starts. In the
- * future it would be nice to put this code into it's own task that loads on
- * boot so ensure that it runs.
- */
-RobotBase::RobotBase() : m_ds(DriverStation::GetInstance()) {
- RobotState::SetImplementation(DriverStation::GetInstance());
- SmartDashboard::init();
- time_sub = MainNode::Subscribe("~/time", &wpilib::internal::time_callback);
-}
-
-/**
- * Determine if the Robot is currently enabled.
- *
- * @return True if the Robot is currently enabled by the field controls.
- */
-bool RobotBase::IsEnabled() const { return m_ds.IsEnabled(); }
-
-/**
- * Determine if the Robot is currently disabled.
- *
- * @return True if the Robot is currently disabled by the field controls.
- */
-bool RobotBase::IsDisabled() const { return m_ds.IsDisabled(); }
-
-/**
- * Determine if the robot is currently in Autnomous mode.
- *
- * @return True if the robot is currently operating Autonomously as determined
- * by the field controls.
- */
-bool RobotBase::IsAutonomous() const { return m_ds.IsAutonomous(); }
-
-/**
- * Determine if the robot is currently in Operator Control mode.
- *
- * @return True if the robot is currently operating in Tele-Op mode as
- * determined by the field controls.
- */
-bool RobotBase::IsOperatorControl() const { return m_ds.IsOperatorControl(); }
-
-/**
- * Determine if the robot is currently in Test mode.
- *
- * @return True if the robot is currently running tests as determined by the
- * field controls.
- */
-bool RobotBase::IsTest() const { return m_ds.IsTest(); }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/RobotDrive.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/RobotDrive.cpp
deleted file mode 100644
index 8974465..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/RobotDrive.cpp
+++ /dev/null
@@ -1,728 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "RobotDrive.h"
-
-#include <algorithm>
-#include <cmath>
-
-#include "GenericHID.h"
-#include "Joystick.h"
-#include "Talon.h"
-#include "Utility.h"
-#include "WPIErrors.h"
-
-using namespace frc;
-
-const int RobotDrive::kMaxNumberOfMotors;
-
-static auto make_shared_nodelete(SpeedController* ptr) {
- return std::shared_ptr<SpeedController>(ptr, NullDeleter<SpeedController>());
-}
-
-/*
- * Driving functions.
- *
- * These functions provide an interface to multiple motors that is used for C
- * programming.
- * The Drive(speed, direction) function is the main part of the set that makes
- * it easy to set speeds and direction independently in one call.
- */
-
-/**
- * Common function to initialize all the robot drive constructors.
- * Create a motor safety object (the real reason for the common code) and
- * initialize all the motor assignments. The default timeout is set for the
- * robot drive.
- */
-void RobotDrive::InitRobotDrive() {
- // FIXME: m_safetyHelper = new MotorSafetyHelper(this);
- // FIXME: m_safetyHelper->SetSafetyEnabled(true);
-}
-
-/**
- * Constructor for RobotDrive with 2 motors specified with channel numbers.
- *
- * Set up parameters for a two wheel drive system where the
- * left and right motor pwm channels are specified in the call.
- * This call assumes Talons for controlling the motors.
- *
- * @param leftMotorChannel The PWM channel number that drives the left motor.
- * @param rightMotorChannel The PWM channel number that drives the right motor.
- */
-RobotDrive::RobotDrive(int leftMotorChannel, int rightMotorChannel) {
- InitRobotDrive();
- m_rearLeftMotor = std::make_shared<Talon>(leftMotorChannel);
- m_rearRightMotor = std::make_shared<Talon>(rightMotorChannel);
- SetLeftRightMotorOutputs(0.0, 0.0);
- m_deleteSpeedControllers = true;
-}
-
-/**
- * Constructor for RobotDrive with 4 motors specified with channel numbers.
- *
- * Set up parameters for a four wheel drive system where all four motor
- * pwm channels are specified in the call.
- * This call assumes Talons for controlling the motors.
- *
- * @param frontLeftMotor Front left motor channel number
- * @param rearLeftMotor Rear Left motor channel number
- * @param frontRightMotor Front right motor channel number
- * @param rearRightMotor Rear Right motor channel number
- */
-RobotDrive::RobotDrive(int frontLeftMotor, int rearLeftMotor,
- int frontRightMotor, int rearRightMotor) {
- InitRobotDrive();
- m_rearLeftMotor = std::make_shared<Talon>(rearLeftMotor);
- m_rearRightMotor = std::make_shared<Talon>(rearRightMotor);
- m_frontLeftMotor = std::make_shared<Talon>(frontLeftMotor);
- m_frontRightMotor = std::make_shared<Talon>(frontRightMotor);
- SetLeftRightMotorOutputs(0.0, 0.0);
- m_deleteSpeedControllers = true;
-}
-
-/**
- * Constructor for RobotDrive with 2 motors specified as SpeedController
- * objects.
- *
- * The SpeedController version of the constructor enables programs to use the
- * RobotDrive classes with subclasses of the SpeedController objects, for
- * example, versions with ramping or reshaping of the curve to suit motor bias
- * or deadband elimination.
- *
- * @param leftMotor The left SpeedController object used to drive the robot.
- * @param rightMotor the right SpeedController object used to drive the robot.
- */
-RobotDrive::RobotDrive(SpeedController* leftMotor,
- SpeedController* rightMotor) {
- InitRobotDrive();
- if (leftMotor == nullptr || rightMotor == nullptr) {
- wpi_setWPIError(NullParameter);
- m_rearLeftMotor = m_rearRightMotor = nullptr;
- return;
- }
- m_rearLeftMotor = make_shared_nodelete(leftMotor);
- m_rearRightMotor = make_shared_nodelete(rightMotor);
-}
-
-// TODO: Change to rvalue references & move syntax.
-RobotDrive::RobotDrive(SpeedController& leftMotor,
- SpeedController& rightMotor) {
- InitRobotDrive();
- m_rearLeftMotor = make_shared_nodelete(&leftMotor);
- m_rearRightMotor = make_shared_nodelete(&rightMotor);
-}
-
-RobotDrive::RobotDrive(std::shared_ptr<SpeedController> leftMotor,
- std::shared_ptr<SpeedController> rightMotor) {
- InitRobotDrive();
- if (leftMotor == nullptr || rightMotor == nullptr) {
- wpi_setWPIError(NullParameter);
- m_rearLeftMotor = m_rearRightMotor = nullptr;
- return;
- }
- m_rearLeftMotor = leftMotor;
- m_rearRightMotor = rightMotor;
-}
-
-/**
- * Constructor for RobotDrive with 4 motors specified as SpeedController
- * objects.
- *
- * Speed controller input version of RobotDrive (see previous comments).
- *
- * @param rearLeftMotor The back left SpeedController object used to drive the
- * robot.
- * @param frontLeftMotor The front left SpeedController object used to drive
- * the robot
- * @param rearRightMotor The back right SpeedController object used to drive
- * the robot.
- * @param frontRightMotor The front right SpeedController object used to drive
- * the robot.
- */
-RobotDrive::RobotDrive(SpeedController* frontLeftMotor,
- SpeedController* rearLeftMotor,
- SpeedController* frontRightMotor,
- SpeedController* rearRightMotor) {
- InitRobotDrive();
- if (frontLeftMotor == nullptr || rearLeftMotor == nullptr ||
- frontRightMotor == nullptr || rearRightMotor == nullptr) {
- wpi_setWPIError(NullParameter);
- return;
- }
- m_frontLeftMotor = make_shared_nodelete(frontLeftMotor);
- m_rearLeftMotor = make_shared_nodelete(rearLeftMotor);
- m_frontRightMotor = make_shared_nodelete(frontRightMotor);
- m_rearRightMotor = make_shared_nodelete(rearRightMotor);
-}
-
-RobotDrive::RobotDrive(SpeedController& frontLeftMotor,
- SpeedController& rearLeftMotor,
- SpeedController& frontRightMotor,
- SpeedController& rearRightMotor) {
- InitRobotDrive();
- m_frontLeftMotor = make_shared_nodelete(&frontLeftMotor);
- m_rearLeftMotor = make_shared_nodelete(&rearLeftMotor);
- m_frontRightMotor = make_shared_nodelete(&frontRightMotor);
- m_rearRightMotor = make_shared_nodelete(&rearRightMotor);
-}
-
-RobotDrive::RobotDrive(std::shared_ptr<SpeedController> frontLeftMotor,
- std::shared_ptr<SpeedController> rearLeftMotor,
- std::shared_ptr<SpeedController> frontRightMotor,
- std::shared_ptr<SpeedController> rearRightMotor) {
- InitRobotDrive();
- if (frontLeftMotor == nullptr || rearLeftMotor == nullptr ||
- frontRightMotor == nullptr || rearRightMotor == nullptr) {
- wpi_setWPIError(NullParameter);
- return;
- }
- m_frontLeftMotor = frontLeftMotor;
- m_rearLeftMotor = rearLeftMotor;
- m_frontRightMotor = frontRightMotor;
- m_rearRightMotor = rearRightMotor;
-}
-
-/**
- * Drive the motors at "outputMagnitude" and "curve".
- * Both outputMagnitude and curve are -1.0 to +1.0 values, where 0.0 represents
- * stopped and not turning. curve < 0 will turn left and curve > 0 will turn
- * right.
- *
- * The algorithm for steering provides a constant turn radius for any normal
- * speed range, both forward and backward. Increasing m_sensitivity causes
- * sharper turns for fixed values of curve.
- *
- * This function will most likely be used in an autonomous routine.
- *
- * @param outputMagnitude The speed setting for the outside wheel in a turn,
- * forward or backwards, +1 to -1.
- * @param curve The rate of turn, constant for different forward
- * speeds. Set curve < 0 for left turn or curve > 0 for
- * right turn. Set curve = e^(-r/w) to get a turn radius
- * r for wheelbase w of your robot. Conversely, turn
- * radius r = -ln(curve)*w for a given value of curve and
- * wheelbase w.
- */
-void RobotDrive::Drive(double outputMagnitude, double curve) {
- double leftOutput, rightOutput;
- static bool reported = false;
- if (!reported) {
- reported = true;
- }
-
- if (curve < 0) {
- double value = std::log(-curve);
- double ratio = (value - m_sensitivity) / (value + m_sensitivity);
- if (ratio == 0) ratio = .0000000001;
- leftOutput = outputMagnitude / ratio;
- rightOutput = outputMagnitude;
- } else if (curve > 0) {
- double value = std::log(curve);
- double ratio = (value - m_sensitivity) / (value + m_sensitivity);
- if (ratio == 0) ratio = .0000000001;
- leftOutput = outputMagnitude;
- rightOutput = outputMagnitude / ratio;
- } else {
- leftOutput = outputMagnitude;
- rightOutput = outputMagnitude;
- }
- SetLeftRightMotorOutputs(leftOutput, rightOutput);
-}
-
-/**
- * Provide tank steering using the stored robot configuration.
- *
- * Drive the robot using two joystick inputs. The Y-axis will be selected from
- * each Joystick object.
- *
- * @param leftStick The joystick to control the left side of the robot.
- * @param rightStick The joystick to control the right side of the robot.
- */
-void RobotDrive::TankDrive(GenericHID* leftStick, GenericHID* rightStick,
- bool squaredInputs) {
- if (leftStick == nullptr || rightStick == nullptr) {
- wpi_setWPIError(NullParameter);
- return;
- }
- TankDrive(leftStick->GetY(), rightStick->GetY(), squaredInputs);
-}
-
-void RobotDrive::TankDrive(GenericHID& leftStick, GenericHID& rightStick,
- bool squaredInputs) {
- TankDrive(leftStick.GetY(), rightStick.GetY(), squaredInputs);
-}
-
-/**
- * Provide tank steering using the stored robot configuration.
- *
- * This function lets you pick the axis to be used on each Joystick object for
- * the left and right sides of the robot.
- *
- * @param leftStick The Joystick object to use for the left side of the robot.
- * @param leftAxis The axis to select on the left side Joystick object.
- * @param rightStick The Joystick object to use for the right side of the robot.
- * @param rightAxis The axis to select on the right side Joystick object.
- */
-void RobotDrive::TankDrive(GenericHID* leftStick, int leftAxis,
- GenericHID* rightStick, int rightAxis,
- bool squaredInputs) {
- if (leftStick == nullptr || rightStick == nullptr) {
- wpi_setWPIError(NullParameter);
- return;
- }
- TankDrive(leftStick->GetRawAxis(leftAxis), rightStick->GetRawAxis(rightAxis),
- squaredInputs);
-}
-
-void RobotDrive::TankDrive(GenericHID& leftStick, int leftAxis,
- GenericHID& rightStick, int rightAxis,
- bool squaredInputs) {
- TankDrive(leftStick.GetRawAxis(leftAxis), rightStick.GetRawAxis(rightAxis),
- squaredInputs);
-}
-
-/**
- * Provide tank steering using the stored robot configuration.
- *
- * This function lets you directly provide joystick values from any source.
- *
- * @param leftValue The value of the left stick.
- * @param rightValue The value of the right stick.
- */
-void RobotDrive::TankDrive(double leftValue, double rightValue,
- bool squaredInputs) {
- static bool reported = false;
- if (!reported) {
- reported = true;
- }
-
- // square the inputs (while preserving the sign) to increase fine control
- // while permitting full power
- leftValue = Limit(leftValue);
- rightValue = Limit(rightValue);
- if (squaredInputs) {
- if (leftValue >= 0.0) {
- leftValue = (leftValue * leftValue);
- } else {
- leftValue = -(leftValue * leftValue);
- }
- if (rightValue >= 0.0) {
- rightValue = (rightValue * rightValue);
- } else {
- rightValue = -(rightValue * rightValue);
- }
- }
-
- SetLeftRightMotorOutputs(leftValue, rightValue);
-}
-
-/**
- * Arcade drive implements single stick driving.
- *
- * Given a single Joystick, the class assumes the Y axis for the move value and
- * the X axis for the rotate value.
- * (Should add more information here regarding the way that arcade drive works.)
- *
- * @param stick The joystick to use for Arcade single-stick driving.
- * The Y-axis will be selected for forwards/backwards and
- * the X-axis will be selected for rotation rate.
- * @param squaredInputs If true, the sensitivity will be increased for small
- * values
- */
-void RobotDrive::ArcadeDrive(GenericHID* stick, bool squaredInputs) {
- // simply call the full-featured ArcadeDrive with the appropriate values
- ArcadeDrive(stick->GetY(), stick->GetX(), squaredInputs);
-}
-
-/**
- * Arcade drive implements single stick driving.
- *
- * Given a single Joystick, the class assumes the Y axis for the move value and
- * the X axis for the rotate value.
- * (Should add more information here regarding the way that arcade drive works.)
- *
- * @param stick The joystick to use for Arcade single-stick driving.
- * The Y-axis will be selected for forwards/backwards and
- * the X-axis will be selected for rotation rate.
- * @param squaredInputs If true, the sensitivity will be increased for small
- * values
- */
-void RobotDrive::ArcadeDrive(GenericHID& stick, bool squaredInputs) {
- // simply call the full-featured ArcadeDrive with the appropriate values
- ArcadeDrive(stick.GetY(), stick.GetX(), squaredInputs);
-}
-
-/**
- * Arcade drive implements single stick driving.
- *
- * Given two joystick instances and two axis, compute the values to send to
- * either two or four motors.
- *
- * @param moveStick The Joystick object that represents the forward/backward
- * direction
- * @param moveAxis The axis on the moveStick object to use for
- * forwards/backwards (typically Y_AXIS)
- * @param rotateStick The Joystick object that represents the rotation value
- * @param rotateAxis The axis on the rotation object to use for the rotate
- * right/left (typically X_AXIS)
- * @param squaredInputs Setting this parameter to true increases the sensitivity
- * at lower speeds
- */
-void RobotDrive::ArcadeDrive(GenericHID* moveStick, int moveAxis,
- GenericHID* rotateStick, int rotateAxis,
- bool squaredInputs) {
- double moveValue = moveStick->GetRawAxis(moveAxis);
- double rotateValue = rotateStick->GetRawAxis(rotateAxis);
-
- ArcadeDrive(moveValue, rotateValue, squaredInputs);
-}
-
-/**
- * Arcade drive implements single stick driving.
- *
- * Given two joystick instances and two axis, compute the values to send to
- * either two or four motors.
- *
- * @param moveStick The Joystick object that represents the forward/backward
- * direction
- * @param moveAxis The axis on the moveStick object to use for
- * forwards/backwards (typically Y_AXIS)
- * @param rotateStick The Joystick object that represents the rotation value
- * @param rotateAxis The axis on the rotation object to use for the rotate
- * right/left (typically X_AXIS)
- * @param squaredInputs Setting this parameter to true increases the sensitivity
- * at lower speeds
- */
-void RobotDrive::ArcadeDrive(GenericHID& moveStick, int moveAxis,
- GenericHID& rotateStick, int rotateAxis,
- bool squaredInputs) {
- double moveValue = moveStick.GetRawAxis(moveAxis);
- double rotateValue = rotateStick.GetRawAxis(rotateAxis);
-
- ArcadeDrive(moveValue, rotateValue, squaredInputs);
-}
-
-/**
- * Arcade drive implements single stick driving.
- *
- * This function lets you directly provide joystick values from any source.
- *
- * @param moveValue The value to use for fowards/backwards
- * @param rotateValue The value to use for the rotate right/left
- * @param squaredInputs If set, increases the sensitivity at low speeds
- */
-void RobotDrive::ArcadeDrive(double moveValue, double rotateValue,
- bool squaredInputs) {
- static bool reported = false;
- if (!reported) {
- reported = true;
- }
-
- // local variables to hold the computed PWM values for the motors
- double leftMotorOutput;
- double rightMotorOutput;
-
- moveValue = Limit(moveValue);
- rotateValue = Limit(rotateValue);
-
- if (squaredInputs) {
- // square the inputs (while preserving the sign) to increase fine control
- // while permitting full power
- if (moveValue >= 0.0) {
- moveValue = (moveValue * moveValue);
- } else {
- moveValue = -(moveValue * moveValue);
- }
- if (rotateValue >= 0.0) {
- rotateValue = (rotateValue * rotateValue);
- } else {
- rotateValue = -(rotateValue * rotateValue);
- }
- }
-
- if (moveValue > 0.0) {
- if (rotateValue > 0.0) {
- leftMotorOutput = moveValue - rotateValue;
- rightMotorOutput = std::max(moveValue, rotateValue);
- } else {
- leftMotorOutput = std::max(moveValue, -rotateValue);
- rightMotorOutput = moveValue + rotateValue;
- }
- } else {
- if (rotateValue > 0.0) {
- leftMotorOutput = -std::max(-moveValue, rotateValue);
- rightMotorOutput = moveValue + rotateValue;
- } else {
- leftMotorOutput = moveValue - rotateValue;
- rightMotorOutput = -std::max(-moveValue, -rotateValue);
- }
- }
- SetLeftRightMotorOutputs(leftMotorOutput, rightMotorOutput);
-}
-
-/**
- * Drive method for Mecanum wheeled robots.
- *
- * A method for driving with Mecanum wheeled robots. There are 4 wheels
- * on the robot, arranged so that the front and back wheels are toed in 45
- * degrees. When looking at the wheels from the top, the roller axles should
- * form an X across the robot.
- *
- * This is designed to be directly driven by joystick axes.
- *
- * @param x The speed that the robot should drive in the X direction.
- * [-1.0..1.0]
- * @param y The speed that the robot should drive in the Y direction.
- * This input is inverted to match the forward == -1.0 that
- * joysticks produce. [-1.0..1.0]
- * @param rotation The rate of rotation for the robot that is completely
- * independent of the translation. [-1.0..1.0]
- * @param gyroAngle The current angle reading from the gyro. Use this to
- * implement field-oriented controls.
- */
-void RobotDrive::MecanumDrive_Cartesian(double x, double y, double rotation,
- double gyroAngle) {
- static bool reported = false;
- if (!reported) {
- reported = true;
- }
-
- double xIn = x;
- double yIn = y;
- // Negate y for the joystick.
- yIn = -yIn;
- // Compenstate for gyro angle.
- RotateVector(xIn, yIn, gyroAngle);
-
- double wheelSpeeds[kMaxNumberOfMotors];
- wheelSpeeds[kFrontLeftMotor] = xIn + yIn + rotation;
- wheelSpeeds[kFrontRightMotor] = -xIn + yIn - rotation;
- wheelSpeeds[kRearLeftMotor] = -xIn + yIn + rotation;
- wheelSpeeds[kRearRightMotor] = xIn + yIn - rotation;
-
- Normalize(wheelSpeeds);
-
- m_frontLeftMotor->Set(wheelSpeeds[kFrontLeftMotor] *
- m_invertedMotors[kFrontLeftMotor] * m_maxOutput);
- m_frontRightMotor->Set(wheelSpeeds[kFrontRightMotor] *
- m_invertedMotors[kFrontRightMotor] * m_maxOutput);
- m_rearLeftMotor->Set(wheelSpeeds[kRearLeftMotor] *
- m_invertedMotors[kRearLeftMotor] * m_maxOutput);
- m_rearRightMotor->Set(wheelSpeeds[kRearRightMotor] *
- m_invertedMotors[kRearRightMotor] * m_maxOutput);
-
- // FIXME: m_safetyHelper->Feed();
-}
-
-/**
- * Drive method for Mecanum wheeled robots.
- *
- * A method for driving with Mecanum wheeled robots. There are 4 wheels
- * on the robot, arranged so that the front and back wheels are toed in 45
- * degrees. When looking at the wheels from the top, the roller axles should
- * form an X across the robot.
- *
- * @param magnitude The speed that the robot should drive in a given direction.
- * [-1.0..1.0]
- * @param direction The direction the robot should drive in degrees. The
- * direction and maginitute are independent of the rotation
- * rate.
- * @param rotation The rate of rotation for the robot that is completely
- * independent of the magnitute or direction. [-1.0..1.0]
- */
-void RobotDrive::MecanumDrive_Polar(double magnitude, double direction,
- double rotation) {
- static bool reported = false;
- if (!reported) {
- reported = true;
- }
-
- // Normalized for full power along the Cartesian axes.
- magnitude = Limit(magnitude) * std::sqrt(2.0);
- // The rollers are at 45 degree angles.
- double dirInRad = (direction + 45.0) * 3.14159 / 180.0;
- double cosD = std::cos(dirInRad);
- double sinD = std::sin(dirInRad);
-
- double wheelSpeeds[kMaxNumberOfMotors];
- wheelSpeeds[kFrontLeftMotor] = sinD * magnitude + rotation;
- wheelSpeeds[kFrontRightMotor] = cosD * magnitude - rotation;
- wheelSpeeds[kRearLeftMotor] = cosD * magnitude + rotation;
- wheelSpeeds[kRearRightMotor] = sinD * magnitude - rotation;
-
- Normalize(wheelSpeeds);
-
- m_frontLeftMotor->Set(wheelSpeeds[kFrontLeftMotor] *
- m_invertedMotors[kFrontLeftMotor] * m_maxOutput);
- m_frontRightMotor->Set(wheelSpeeds[kFrontRightMotor] *
- m_invertedMotors[kFrontRightMotor] * m_maxOutput);
- m_rearLeftMotor->Set(wheelSpeeds[kRearLeftMotor] *
- m_invertedMotors[kRearLeftMotor] * m_maxOutput);
- m_rearRightMotor->Set(wheelSpeeds[kRearRightMotor] *
- m_invertedMotors[kRearRightMotor] * m_maxOutput);
-
- // FIXME: m_safetyHelper->Feed();
-}
-
-/**
- * Holonomic Drive method for Mecanum wheeled robots.
- *
- * This is an alias to MecanumDrive_Polar() for backward compatability
- *
- * @param magnitude The speed that the robot should drive in a given direction.
- * [-1.0..1.0]
- * @param direction The direction the robot should drive. The direction and
- * magnitude are independent of the rotation rate.
- * @param rotation The rate of rotation for the robot that is completely
- * independent of the magnitude or direction. [-1.0..1.0]
- */
-void RobotDrive::HolonomicDrive(double magnitude, double direction,
- double rotation) {
- MecanumDrive_Polar(magnitude, direction, rotation);
-}
-
-/**
- * Set the speed of the right and left motors.
- *
- * This is used once an appropriate drive setup function is called such as
- * TwoWheelDrive(). The motors are set to "leftOutput" and "rightOutput"
- * and includes flipping the direction of one side for opposing motors.
- *
- * @param leftOutput The speed to send to the left side of the robot.
- * @param rightOutput The speed to send to the right side of the robot.
- */
-void RobotDrive::SetLeftRightMotorOutputs(double leftOutput,
- double rightOutput) {
- wpi_assert(m_rearLeftMotor != nullptr && m_rearRightMotor != nullptr);
-
- if (m_frontLeftMotor != nullptr)
- m_frontLeftMotor->Set(Limit(leftOutput) *
- m_invertedMotors[kFrontLeftMotor] * m_maxOutput);
- m_rearLeftMotor->Set(Limit(leftOutput) * m_invertedMotors[kRearLeftMotor] *
- m_maxOutput);
-
- if (m_frontRightMotor != nullptr)
- m_frontRightMotor->Set(-Limit(rightOutput) *
- m_invertedMotors[kFrontRightMotor] * m_maxOutput);
- m_rearRightMotor->Set(-Limit(rightOutput) *
- m_invertedMotors[kRearRightMotor] * m_maxOutput);
-
- // FIXME: m_safetyHelper->Feed();
-}
-
-/**
- * Limit motor values to the -1.0 to +1.0 range.
- */
-double RobotDrive::Limit(double num) {
- if (num > 1.0) {
- return 1.0;
- }
- if (num < -1.0) {
- return -1.0;
- }
- return num;
-}
-
-/**
- * Normalize all wheel speeds if the magnitude of any wheel is greater than 1.0.
- */
-void RobotDrive::Normalize(double* wheelSpeeds) {
- double maxMagnitude = std::fabs(wheelSpeeds[0]);
- int i;
- for (i = 1; i < kMaxNumberOfMotors; i++) {
- double temp = std::fabs(wheelSpeeds[i]);
- if (maxMagnitude < temp) maxMagnitude = temp;
- }
- if (maxMagnitude > 1.0) {
- for (i = 0; i < kMaxNumberOfMotors; i++) {
- wheelSpeeds[i] = wheelSpeeds[i] / maxMagnitude;
- }
- }
-}
-
-/**
- * Rotate a vector in Cartesian space.
- */
-void RobotDrive::RotateVector(double& x, double& y, double angle) {
- double cosA = std::cos(angle * (3.14159 / 180.0));
- double sinA = std::sin(angle * (3.14159 / 180.0));
- double xOut = x * cosA - y * sinA;
- double yOut = x * sinA + y * cosA;
- x = xOut;
- y = yOut;
-}
-
-/**
- * Invert a motor direction.
- *
- * This is used when a motor should run in the opposite direction as the drive
- * code would normally run it. Motors that are direct drive would be inverted,
- * the Drive code assumes that the motors are geared with one reversal.
- *
- * @param motor The motor index to invert.
- * @param isInverted True if the motor should be inverted when operated.
- */
-void RobotDrive::SetInvertedMotor(MotorType motor, bool isInverted) {
- if (motor < 0 || motor > 3) {
- wpi_setWPIError(InvalidMotorIndex);
- return;
- }
- m_invertedMotors[motor] = isInverted ? -1 : 1;
-}
-
-/**
- * Set the turning sensitivity.
- *
- * This only impacts the Drive() entry-point.
- *
- * @param sensitivity Effectively sets the turning sensitivity (or turn radius
- * for a given value)
- */
-void RobotDrive::SetSensitivity(double sensitivity) {
- m_sensitivity = sensitivity;
-}
-
-/**
- * Configure the scaling factor for using RobotDrive with motor controllers in a
- * mode other than PercentVbus.
- *
- * @param maxOutput Multiplied with the output percentage computed by the drive
- * functions.
- */
-void RobotDrive::SetMaxOutput(double maxOutput) { m_maxOutput = maxOutput; }
-
-void RobotDrive::SetExpiration(double timeout) {
- // FIXME: m_safetyHelper->SetExpiration(timeout);
-}
-
-double RobotDrive::GetExpiration() const {
- return -1; // FIXME: return m_safetyHelper->GetExpiration();
-}
-
-bool RobotDrive::IsAlive() const {
- return true; // FIXME: m_safetyHelper->IsAlive();
-}
-
-bool RobotDrive::IsSafetyEnabled() const {
- return false; // FIXME: return m_safetyHelper->IsSafetyEnabled();
-}
-
-void RobotDrive::SetSafetyEnabled(bool enabled) {
- // FIXME: m_safetyHelper->SetSafetyEnabled(enabled);
-}
-
-void RobotDrive::GetDescription(std::ostringstream& desc) const {
- desc << "RobotDrive";
-}
-
-void RobotDrive::StopMotor() {
- if (m_frontLeftMotor != nullptr) m_frontLeftMotor->Disable();
- if (m_frontRightMotor != nullptr) m_frontRightMotor->Disable();
- if (m_rearLeftMotor != nullptr) m_rearLeftMotor->Disable();
- if (m_rearRightMotor != nullptr) m_rearRightMotor->Disable();
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/SafePWM.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/SafePWM.cpp
deleted file mode 100644
index 4e42958..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/SafePWM.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "SafePWM.h"
-
-#include <memory>
-#include <sstream>
-
-using namespace frc;
-
-/**
- * Constructor for a SafePWM object taking a channel number.
- *
- * @param channel The PWM channel number (0..19).
- */
-SafePWM::SafePWM(int channel) : PWM(channel) {
- m_safetyHelper = std::make_unique<MotorSafetyHelper>(this);
- m_safetyHelper->SetSafetyEnabled(false);
-}
-
-/**
- * Set the expiration time for the PWM object.
- *
- * @param timeout The timeout (in seconds) for this motor object
- */
-void SafePWM::SetExpiration(double timeout) {
- m_safetyHelper->SetExpiration(timeout);
-}
-
-/**
- * Return the expiration time for the PWM object.
- *
- * @returns The expiration time value.
- */
-double SafePWM::GetExpiration() const {
- return m_safetyHelper->GetExpiration();
-}
-
-/**
- * Check if the PWM object is currently alive or stopped due to a timeout.
- *
- * @return a bool value that is true if the motor has NOT timed out and should
- * still be running.
- */
-bool SafePWM::IsAlive() const { return m_safetyHelper->IsAlive(); }
-
-/**
- * Stop the motor associated with this PWM object.
- *
- * This is called by the MotorSafetyHelper object when it has a timeout for this
- * PWM and needs to stop it from running.
- */
-void SafePWM::StopMotor() { SetRaw(kPwmDisabled); }
-
-/**
- * Enable/disable motor safety for this device.
- *
- * Turn on and off the motor safety option for this PWM object.
- *
- * @param enabled True if motor safety is enforced for this object
- */
-void SafePWM::SetSafetyEnabled(bool enabled) {
- m_safetyHelper->SetSafetyEnabled(enabled);
-}
-
-/**
- * Check if motor safety is enabled for this object.
- *
- * @returns True if motor safety is enforced for this object
- */
-bool SafePWM::IsSafetyEnabled() const {
- return m_safetyHelper->IsSafetyEnabled();
-}
-
-void SafePWM::GetDescription(std::ostringstream& desc) const {
- desc << "PWM " << GetChannel();
-}
-
-/**
- * Feed the MotorSafety timer when setting the speed.
- *
- * This method is called by the subclass motor whenever it updates its speed,
- * thereby reseting the timeout value.
- *
- * @param speed Value to pass to the PWM class
- */
-void SafePWM::SetSpeed(double speed) {
- PWM::SetSpeed(speed);
- m_safetyHelper->Feed();
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/SampleRobot.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/SampleRobot.cpp
deleted file mode 100644
index 7488d24..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/SampleRobot.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "SampleRobot.h"
-
-#include <cstdio>
-
-#include "LiveWindow/LiveWindow.h"
-#include "Timer.h"
-#include "networktables/NetworkTable.h"
-
-#if defined(_UNIX)
-#include <unistd.h>
-#elif defined(_WIN32)
-#include <windows.h>
-void sleep(unsigned int milliseconds) { Sleep(milliseconds); }
-#endif
-
-using namespace frc;
-
-SampleRobot::SampleRobot() : m_robotMainOverridden(true) {}
-
-/**
- * Robot-wide initialization code should go here.
- *
- * Programmers should override this method for default Robot-wide initialization
- * which will be called each time the robot enters the disabled state.
- */
-void SampleRobot::RobotInit() {
- std::printf("Default %s() method... Override me!\n", __FUNCTION__);
-}
-
-/**
- * Disabled should go here.
- *
- * Programmers should override this method to run code that should run while the
- * field is disabled.
- */
-void SampleRobot::Disabled() {
- std::printf("Default %s() method... Override me!\n", __FUNCTION__);
-}
-
-/**
- * Autonomous should go here.
- *
- * Programmers should override this method to run code that should run while the
- * field is in the autonomous period. This will be called once each time the
- * robot enters the autonomous state.
- */
-void SampleRobot::Autonomous() {
- std::printf("Default %s() method... Override me!\n", __FUNCTION__);
-}
-
-/**
- * Operator control (tele-operated) code should go here.
- *
- * Programmers should override this method to run code that should run while the
- * field is in the Operator Control (tele-operated) period. This is called once
- * each time the robot enters the teleop state.
- */
-void SampleRobot::OperatorControl() {
- std::printf("Default %s() method... Override me!\n", __FUNCTION__);
-}
-
-/**
- * Test program should go here.
- *
- * Programmers should override this method to run code that executes while the
- * robot is in test mode. This will be called once whenever the robot enters
- * test mode.
- */
-void SampleRobot::Test() {
- std::printf("Default %s() method... Override me!\n", __FUNCTION__);
-}
-
-/**
- * Robot main program for free-form programs.
- *
- * This should be overridden by user subclasses if the intent is to not use the
- * Autonomous() and OperatorControl() methods. In that case, the program is
- * responsible for sensing when to run the autonomous and operator control
- * functions in their program.
- *
- * This method will be called immediately after the constructor is called. If it
- * has not been overridden by a user subclass (i.e. the default version runs),
- * then the Autonomous() and OperatorControl() methods will be called.
- */
-void SampleRobot::RobotMain() { m_robotMainOverridden = false; }
-
-/**
- * Start a competition.
- *
- * This code needs to track the order of the field starting to ensure that
- * everything happens in the right order. Repeatedly run the correct method,
- * either Autonomous or OperatorControl or Test when the robot is enabled.
- * After running the correct method, wait for some state to change, either the
- * other mode starts or the robot is disabled. Then go back and wait for the
- * robot to be enabled again.
- */
-void SampleRobot::StartCompetition() {
- LiveWindow* lw = LiveWindow::GetInstance();
-
- NetworkTable::GetTable("LiveWindow")
- ->GetSubTable("~STATUS~")
- ->PutBoolean("LW Enabled", false);
-
- RobotMain();
-
- if (!m_robotMainOverridden) {
- // first and one-time initialization
- lw->SetEnabled(false);
- RobotInit();
-
- while (true) {
- if (IsDisabled()) {
- m_ds.InDisabled(true);
- Disabled();
- m_ds.InDisabled(false);
- while (IsDisabled()) sleep(1); // m_ds.WaitForData();
- } else if (IsAutonomous()) {
- m_ds.InAutonomous(true);
- Autonomous();
- m_ds.InAutonomous(false);
- while (IsAutonomous() && IsEnabled()) sleep(1); // m_ds.WaitForData();
- } else if (IsTest()) {
- lw->SetEnabled(true);
- m_ds.InTest(true);
- Test();
- m_ds.InTest(false);
- while (IsTest() && IsEnabled()) sleep(1); // m_ds.WaitForData();
- lw->SetEnabled(false);
- } else {
- m_ds.InOperatorControl(true);
- OperatorControl();
- m_ds.InOperatorControl(false);
- while (IsOperatorControl() && IsEnabled())
- sleep(1); // m_ds.WaitForData();
- }
- }
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/SensorBase.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/SensorBase.cpp
deleted file mode 100644
index cd708ad..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/SensorBase.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "SensorBase.h"
-
-#include "WPIErrors.h"
-
-using namespace frc;
-
-const int SensorBase::kDigitalChannels;
-const int SensorBase::kAnalogInputs;
-const int SensorBase::kSolenoidChannels;
-const int SensorBase::kSolenoidModules;
-const int SensorBase::kPwmChannels;
-const int SensorBase::kRelayChannels;
-const int SensorBase::kPDPChannels;
-
-/**
- * Check that the solenoid module number is valid.
- *
- * @return Solenoid module number is valid
- */
-bool SensorBase::CheckSolenoidModule(int moduleNumber) {
- return moduleNumber >= 0 && moduleNumber < kSolenoidModules;
-}
-
-/**
- * Check that the digital channel number is valid.
- *
- * Verify that the channel number is one of the legal channel numbers. Channel
- * numbers are 0-based.
- *
- * @return Digital channel is valid
- */
-bool SensorBase::CheckDigitalChannel(int channel) {
- if (channel >= 0 && channel < kDigitalChannels) return true;
- return false;
-}
-
-/**
- * Check that the digital channel number is valid.
- *
- * Verify that the channel number is one of the legal channel numbers. Channel
- * numbers are 0-based.
- *
- * @return Relay channel is valid
- */
-bool SensorBase::CheckRelayChannel(int channel) {
- if (channel >= 0 && channel < kRelayChannels) return true;
- return false;
-}
-
-/**
- * Check that the digital channel number is valid.
- *
- * Verify that the channel number is one of the legal channel numbers. Channel
- * numbers are 0-based.
- *
- * @return PWM channel is valid
- */
-bool SensorBase::CheckPWMChannel(int channel) {
- if (channel >= 0 && channel < kPwmChannels) return true;
- return false;
-}
-
-/**
- * Check that the analog input number is valid.
- *
- * Verify that the analog input number is one of the legal channel numbers.
- * Channel numbers are 0-based.
- *
- * @return Analog channel is valid
- */
-bool SensorBase::CheckAnalogInputChannel(int channel) {
- if (channel >= 0 && channel < kAnalogInputs) return true;
- return false;
-}
-
-/**
- * Check that the analog output number is valid.
- *
- * Verify that the analog output number is one of the legal channel numbers.
- * Channel numbers are 0-based.
- *
- * @return Analog channel is valid
- */
-bool SensorBase::CheckAnalogOutputChannel(int channel) {
- if (channel >= 0 && channel < kAnalogOutputs) return true;
- return false;
-}
-
-/**
- * Verify that the solenoid channel number is within limits.
- *
- * @return Solenoid channel is valid
- */
-bool SensorBase::CheckSolenoidChannel(int channel) {
- if (channel >= 0 && channel < kSolenoidChannels) return true;
- return false;
-}
-
-/**
- * Verify that the power distribution channel number is within limits.
- *
- * @return PDP channel is valid
- */
-bool SensorBase::CheckPDPChannel(int channel) {
- if (channel >= 0 && channel < kPDPChannels) return true;
- return false;
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/Solenoid.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/Solenoid.cpp
deleted file mode 100644
index ef19ffb..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/Solenoid.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Solenoid.h"
-
-#include <sstream>
-
-#include "LiveWindow/LiveWindow.h"
-#include "WPIErrors.h"
-#include "simulation/simTime.h"
-
-using namespace frc;
-
-/**
- * Constructor.
- *
- * @param channel The channel on the solenoid module to control (1..8).
- */
-Solenoid::Solenoid(int channel) : Solenoid(1, channel) {}
-
-/**
- * Constructor.
- *
- * @param moduleNumber The solenoid module (1 or 2).
- * @param channel The channel on the solenoid module to control (1..8).
- */
-Solenoid::Solenoid(int moduleNumber, int channel) {
- std::stringstream ss;
- ss << "pneumatic/" << moduleNumber << "/" << channel;
- m_impl = new SimContinuousOutput(ss.str());
-
- LiveWindow::GetInstance()->AddActuator("Solenoid", moduleNumber, channel,
- this);
-}
-
-Solenoid::~Solenoid() {
- if (m_table != nullptr) m_table->RemoveTableListener(this);
-}
-
-/**
- * Set the value of a solenoid.
- *
- * @param on Turn the solenoid output off or on.
- */
-void Solenoid::Set(bool on) {
- m_on = on;
- m_impl->Set(on ? 1 : -1);
-}
-
-/**
- * Read the current value of the solenoid.
- *
- * @return The current value of the solenoid.
- */
-bool Solenoid::Get() const { return m_on; }
-
-void Solenoid::ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew) {
- if (!value->IsBoolean()) return;
- Set(value->GetBoolean());
-}
-
-void Solenoid::UpdateTable() {
- if (m_table != nullptr) {
- m_table->PutBoolean("Value", Get());
- }
-}
-
-void Solenoid::StartLiveWindowMode() {
- Set(false);
- if (m_table != nullptr) {
- m_table->AddTableListener("Value", this, true);
- }
-}
-
-void Solenoid::StopLiveWindowMode() {
- Set(false);
- if (m_table != nullptr) {
- m_table->RemoveTableListener(this);
- }
-}
-
-std::string Solenoid::GetSmartDashboardType() const { return "Solenoid"; }
-
-void Solenoid::InitTable(std::shared_ptr<ITable> subTable) {
- m_table = subTable;
- UpdateTable();
-}
-
-std::shared_ptr<ITable> Solenoid::GetTable() const { return m_table; }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/Talon.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/Talon.cpp
deleted file mode 100644
index 652b2ae..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/Talon.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Talon.h"
-
-#include "LiveWindow/LiveWindow.h"
-
-using namespace frc;
-
-/**
- * @param channel The PWM channel that the Talon is attached to.
- */
-Talon::Talon(int channel) : SafePWM(channel) {
- /* Note that the Talon uses the following bounds for PWM values. These values
- * should work reasonably well for most controllers, but if users experience
- * issues such as asymmetric behavior around the deadband or inability to
- * saturate the controller in either direction, calibration is recommended.
- * The calibration procedure can be found in the Talon User Manual available
- * from CTRE.
- *
- * - 211 = full "forward"
- * - 133 = the "high end" of the deadband range
- * - 129 = center of the deadband range (off)
- * - 125 = the "low end" of the deadband range
- * - 49 = full "reverse"
- */
- SetBounds(2.037, 1.539, 1.513, 1.487, .989);
- SetPeriodMultiplier(kPeriodMultiplier_2X);
- SetRaw(m_centerPwm);
-
- LiveWindow::GetInstance()->AddActuator("Talon", GetChannel(), this);
-}
-
-/**
- * Set the PWM value.
- *
- * The PWM value is set using a range of -1.0 to 1.0, appropriately
- * scaling the value for the FPGA.
- *
- * @param speed The speed value between -1.0 and 1.0 to set.
- */
-void Talon::Set(double speed) { SetSpeed(speed); }
-
-/**
- * Get the recently set value of the PWM.
- *
- * @return The most recently set value for the PWM between -1.0 and 1.0.
- */
-double Talon::Get() const { return GetSpeed(); }
-
-/**
- * Common interface for disabling a motor.
- */
-void Talon::Disable() { SetRaw(kPwmDisabled); }
-
-/**
- * Write out the PID value as seen in the PIDOutput base object.
- *
- * @param output Write out the PWM value as was found in the PIDController
- */
-void Talon::PIDWrite(double output) { Set(output); }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/Timer.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/Timer.cpp
deleted file mode 100644
index 93e33e2..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/Timer.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Timer.h"
-
-#include "Utility.h"
-#include "simulation/simTime.h"
-
-// Internal stuff
-#include "simulation/MainNode.h"
-#include "simulation/SimFloatInput.h"
-namespace wpilib {
-namespace internal {
-double simTime = 0;
-std::condition_variable time_wait;
-std::mutex time_wait_mutex;
-
-void time_callback(const gazebo::msgs::ConstFloat64Ptr& msg) {
- simTime = msg->data();
- time_wait.notify_all();
-}
-}
-} // namespace wpilib
-
-namespace frc {
-
-/**
- * Pause the task for a specified time.
- *
- * Pause the execution of the program for a specified period of time given in
- * seconds. Motors will continue to run at their last assigned values, and
- * sensors will continue to update. Only the task containing the wait will
- * pause until the wait time is expired.
- *
- * @param seconds Length of time to pause, in seconds.
- */
-void Wait(double seconds) {
- if (seconds < 0.0) return;
-
- double start = wpilib::internal::simTime;
-
- std::unique_lock<std::mutex> lock(wpilib::internal::time_wait_mutex);
- while ((wpilib::internal::simTime - start) < seconds) {
- wpilib::internal::time_wait.wait(lock);
- }
-}
-
-/*
- * Return the FPGA system clock time in seconds.
- *
- * This is deprecated and just forwards to Timer::GetFPGATimestamp().
- *
- * @returns Robot running time in seconds.
- */
-double GetClock() { return Timer::GetFPGATimestamp(); }
-
-/**
- * @brief Gives real-time clock system time with nanosecond resolution
- * @return The time, just in case you want the robot to start autonomous at 8pm
- * on Saturday (except in simulation).
- */
-double GetTime() {
- return Timer::GetFPGATimestamp(); // The epoch starts when Gazebo starts
-}
-
-} // namespace frc
-
-using namespace frc;
-
-// for compatibility with msvc12--see C2864
-const double Timer::kRolloverTime = (1ll << 32) / 1e6;
-/**
- * Create a new timer object.
- *
- * Create a new timer object and reset the time to zero. The timer is initially
- * not running and must be started.
- */
-Timer::Timer() : m_startTime(0.0), m_accumulatedTime(0.0), m_running(false) {
- // Creates a semaphore to control access to critical regions.
- // Initially 'open'
- Reset();
-}
-
-/**
- * Get the current time from the timer.
- *
- * If the clock is running it is derived from the current system clock the
- * start time stored in the timer class. If the clock is not running, then
- * return the time when it was last stopped.
- *
- * @return Current time value for this timer in seconds
- */
-double Timer::Get() const {
- double result;
- double currentTime = GetFPGATimestamp();
-
- std::lock_guard<priority_mutex> sync(m_mutex);
- if (m_running) {
- // This math won't work if the timer rolled over (71 minutes after boot).
- // TODO: Check for it and compensate.
- result = (currentTime - m_startTime) + m_accumulatedTime;
- } else {
- result = m_accumulatedTime;
- }
-
- return result;
-}
-
-/**
- * Reset the timer by setting the time to 0.
- *
- * Make the timer startTime the current time so new requests will be relative to
- * now.
- */
-void Timer::Reset() {
- std::lock_guard<priority_mutex> sync(m_mutex);
- m_accumulatedTime = 0;
- m_startTime = GetFPGATimestamp();
-}
-
-/**
- * Start the timer running.
- *
- * Just set the running flag to true indicating that all time requests should be
- * relative to the system clock.
- */
-void Timer::Start() {
- std::lock_guard<priority_mutex> sync(m_mutex);
- if (!m_running) {
- m_startTime = GetFPGATimestamp();
- m_running = true;
- }
-}
-
-/**
- * Stop the timer.
- *
- * This computes the time as of now and clears the running flag, causing all
- * subsequent time requests to be read from the accumulated time rather than
- * looking at the system clock.
- */
-void Timer::Stop() {
- double temp = Get();
-
- std::lock_guard<priority_mutex> sync(m_mutex);
- if (m_running) {
- m_accumulatedTime = temp;
- m_running = false;
- }
-}
-
-/**
- * Check if the period specified has passed and if it has, advance the start
- * time by that period. This is useful to decide if it's time to do periodic
- * work without drifting later by the time it took to get around to checking.
- *
- * @param period The period to check for (in seconds).
- * @return If the period has passed.
- */
-bool Timer::HasPeriodPassed(double period) {
- if (Get() > period) {
- std::lock_guard<priority_mutex> sync(m_mutex);
- // Advance the start time by the period.
- // Don't set it to the current time... we want to avoid drift.
- m_startTime += period;
- return true;
- }
- return false;
-}
-
-/*
- * Return the FPGA system clock time in seconds.
- *
- * Return the time from the FPGA hardware clock in seconds since the FPGA
- * started. Rolls over after 71 minutes.
- *
- * @return Robot running time in seconds.
- */
-double Timer::GetFPGATimestamp() {
- // FPGA returns the timestamp in microseconds
- // Call the helper GetFPGATime() in Utility.cpp
- return wpilib::internal::simTime;
-}
-
-/*
- * Not in a match.
- */
-double Timer::GetMatchTime() { return Timer::GetFPGATimestamp(); }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/Utility.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/Utility.cpp
deleted file mode 100644
index 97c02de..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/Utility.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Utility.h"
-
-#ifndef _WIN32
-#include <cxxabi.h>
-#include <execinfo.h>
-#endif
-
-#include <cstdio>
-#include <cstdlib>
-#include <iostream>
-#include <sstream>
-
-#include "Timer.h"
-#include "llvm/SmallString.h"
-#include "simulation/simTime.h"
-
-using namespace frc;
-
-static bool stackTraceEnabled = false;
-static bool suspendOnAssertEnabled = false;
-
-/**
- * Enable Stack trace after asserts.
- */
-void wpi_stackTraceOnAssertEnable(bool enabled) { stackTraceEnabled = enabled; }
-
-/**
- * Enable suspend on asssert.
- *
- * If enabled, the user task will be suspended whenever an assert fails. This
- * will allow the user to attach to the task with the debugger and examine
- * variables around the failure.
- */
-void wpi_suspendOnAssertEnabled(bool enabled) {
- suspendOnAssertEnabled = enabled;
-}
-
-static void wpi_handleTracing() {
- // if (stackTraceEnabled)
- // {
- // std::printf("\n-----------<Stack Trace>----------------\n");
- // printCurrentStackTrace();
- // }
- std::printf("\n");
-}
-
-/**
- * Assert implementation.
- * This allows breakpoints to be set on an assert.
- * The users don't call this, but instead use the wpi_assert macros in
- * Utility.h.
- */
-bool wpi_assert_impl(bool conditionValue, llvm::StringRef conditionText,
- llvm::StringRef message, llvm::StringRef fileName,
- int lineNumber, llvm::StringRef funcName) {
- if (!conditionValue) {
- std::stringstream errorStream;
-
- errorStream << "Assertion \"" << conditionText << "\" ";
- errorStream << "on line " << lineNumber << " ";
-
- llvm::SmallString<128> fileTemp;
- errorStream << "of " << basename(fileName.c_str(fileTemp)) << " ";
-
- if (message[0] != '\0') {
- errorStream << "failed: " << message << std::endl;
- } else {
- errorStream << "failed." << std::endl;
- }
-
- // Print to console and send to remote dashboard
- std::cout << "\n\n>>>>" << errorStream.str();
- wpi_handleTracing();
- }
-
- return conditionValue;
-}
-
-/**
- * Common error routines for wpi_assertEqual_impl and wpi_assertNotEqual_impl
- * This should not be called directly; it should only be used by
- * wpi_assertEqual_impl and wpi_assertNotEqual_impl.
- */
-void wpi_assertEqual_common_impl(int valueA, int valueB,
- llvm::StringRef equalityType,
- llvm::StringRef message,
- llvm::StringRef fileName, int lineNumber,
- llvm::StringRef funcName) {
- // Error string buffer
- std::stringstream error;
-
- // If an error message was specified, include it
- // Build error string
- if (message.size() > 0) {
- error << "Assertion failed: \"" << message << "\", \"" << valueA << "\" "
- << equalityType << " \"" << valueB << "\" in " << funcName << "() in "
- << fileName << " at line " << lineNumber << "\n";
- } else {
- error << "Assertion failed: \"" << valueA << "\" " << equalityType << " \""
- << valueB << "\" in " << funcName << "() in " << fileName
- << " at line " << lineNumber << "\n";
- }
-
- // Print to console and send to remote dashboard
- std::cout << "\n\n>>>>" << error.str();
-
- wpi_handleTracing();
-}
-
-/**
- * Assert equal implementation.
- * This determines whether the two given integers are equal. If not,
- * the value of each is printed along with an optional message string.
- * The users don't call this, but instead use the wpi_assertEqual macros in
- * Utility.h.
- */
-bool wpi_assertEqual_impl(int valueA, int valueB, llvm::StringRef message,
- llvm::StringRef fileName, int lineNumber,
- llvm::StringRef funcName) {
- if (!(valueA == valueB)) {
- wpi_assertEqual_common_impl(valueA, valueB, "!=", message, fileName,
- lineNumber, funcName);
- }
- return valueA == valueB;
-}
-
-/**
- * Assert not equal implementation.
- * This determines whether the two given integers are equal. If so,
- * the value of each is printed along with an optional message string.
- * The users don't call this, but instead use the wpi_assertNotEqual macros in
- * Utility.h.
- */
-bool wpi_assertNotEqual_impl(int valueA, int valueB, llvm::StringRef message,
- llvm::StringRef fileName, int lineNumber,
- llvm::StringRef funcName) {
- if (!(valueA != valueB)) {
- wpi_assertEqual_common_impl(valueA, valueB, "==", message, fileName,
- lineNumber, funcName);
- }
- return valueA != valueB;
-}
-
-namespace frc {
-
-/**
- * Read the microsecond-resolution timer on the FPGA.
- *
- * @return The current time in microseconds according to the FPGA (since FPGA
- * reset).
- */
-uint64_t GetFPGATime() { return wpilib::internal::simTime * 1e6; }
-
-// TODO: implement symbol demangling and backtrace on windows
-#if not defined(_WIN32)
-
-/**
- * Demangle a C++ symbol, used for printing stack traces.
- */
-static std::string demangle(char const* mangledSymbol) {
- char buffer[256];
- size_t length;
- int32_t status;
-
- if (std::sscanf(mangledSymbol, "%*[^(]%*[^_]%255[^)+]", buffer)) {
- char* symbol = abi::__cxa_demangle(buffer, nullptr, &length, &status);
-
- if (status == 0) {
- return symbol;
- } else {
- // If the symbol couldn't be demangled, it's probably a C function,
- // so just return it as-is.
- return buffer;
- }
- }
-
- // If everything else failed, just return the mangled symbol
- return mangledSymbol;
-}
-
-/**
- * Get a stack trace, ignoring the first "offset" symbols.
- */
-std::string GetStackTrace(int offset) {
- void* stackTrace[128];
- int stackSize = backtrace(stackTrace, 128);
- char** mangledSymbols = backtrace_symbols(stackTrace, stackSize);
- std::stringstream trace;
-
- for (int i = offset; i < stackSize; i++) {
- // Only print recursive functions once in a row.
- if (i == 0 || stackTrace[i] != stackTrace[i - 1]) {
- trace << "\tat " << demangle(mangledSymbols[i]) << std::endl;
- }
- }
-
- std::free(mangledSymbols);
-
- return trace.str();
-}
-
-#else
-static std::string demangle(char const* mangledSymbol) {
- return "no demangling on windows";
-}
-std::string GetStackTrace(int offset) { return "no stack trace on windows"; }
-#endif
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/Victor.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/Victor.cpp
deleted file mode 100644
index ec61719..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/Victor.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2008-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Victor.h"
-
-#include "LiveWindow/LiveWindow.h"
-
-using namespace frc;
-
-/**
- * @param channel The PWM channel that the Victor is attached to.
- */
-Victor::Victor(int channel) : SafePWM(channel) {
- /* Note that the Victor uses the following bounds for PWM values. These values
- * were determined empirically and optimized for the Victor 888. These values
- * should work reasonably well for Victor 884 controllers as well but if users
- * experience issues such as asymmetric behavior around the deadband or
- * inability to saturate the controller in either direction, calibration is
- * recommended. The calibration procedure can be found in the Victor 884 User
- * Manual available from IFI.
- *
- * - 206 = full "forward"
- * - 131 = the "high end" of the deadband range
- * - 128 = center of the deadband range (off)
- * - 125 = the "low end" of the deadband range
- * - 56 = full "reverse"
- */
-
- SetBounds(2.027, 1.525, 1.507, 1.49, 1.026);
- SetPeriodMultiplier(kPeriodMultiplier_2X);
- SetRaw(m_centerPwm);
-
- LiveWindow::GetInstance()->AddActuator("Victor", GetChannel(), this);
-}
-
-/**
- * Set the PWM value.
- *
- * The PWM value is set using a range of -1.0 to 1.0, appropriately
- * scaling the value for the FPGA.
- *
- * @param speed The speed value between -1.0 and 1.0 to set.
- */
-void Victor::Set(double speed) { SetSpeed(speed); }
-
-/**
- * Get the recently set value of the PWM.
- *
- * @return The most recently set value for the PWM between -1.0 and 1.0.
- */
-double Victor::Get() const { return GetSpeed(); }
-
-/**
- * Common interface for disabling a motor.
- */
-void Victor::Disable() { SetRaw(kPwmDisabled); }
-
-/**
- * Write out the PID value as seen in the PIDOutput base object.
- *
- * @param output Write out the PWM value as was found in the PIDController
- */
-void Victor::PIDWrite(double output) { Set(output); }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/XboxController.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/XboxController.cpp
deleted file mode 100644
index 441ecf0..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/XboxController.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "XboxController.h"
-
-#include "DriverStation.h"
-
-using namespace frc;
-
-/**
- * Construct an instance of an Xbox controller.
- *
- * The joystick index is the USB port on the Driver Station.
- *
- * @param port The port on the Driver Station that the joystick is plugged into
- * (0-5).
- */
-XboxController::XboxController(int port)
- : GamepadBase(port), m_ds(DriverStation::GetInstance()) {}
-
-/**
- * Get the X axis value of the controller.
- *
- * @param hand Side of controller whose value should be returned.
- */
-double XboxController::GetX(JoystickHand hand) const {
- if (hand == kLeftHand) {
- return GetRawAxis(0);
- } else {
- return GetRawAxis(4);
- }
-}
-
-/**
- * Get the Y axis value of the controller.
- *
- * @param hand Side of controller whose value should be returned.
- */
-double XboxController::GetY(JoystickHand hand) const {
- if (hand == kLeftHand) {
- return GetRawAxis(1);
- } else {
- return GetRawAxis(5);
- }
-}
-
-/**
- * Read the value of the bumper button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- */
-bool XboxController::GetBumper(JoystickHand hand) const {
- if (hand == kLeftHand) {
- return GetRawButton(5);
- } else {
- return GetRawButton(6);
- }
-}
-
-/**
- * Read the value of the stick button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- * @return The state of the button.
- */
-bool XboxController::GetStickButton(JoystickHand hand) const {
- if (hand == kLeftHand) {
- return GetRawButton(9);
- } else {
- return GetRawButton(10);
- }
-}
-
-/**
- * Get the trigger axis value of the controller.
- *
- * @param hand Side of controller whose value should be returned.
- */
-double XboxController::GetTriggerAxis(JoystickHand hand) const {
- if (hand == kLeftHand) {
- return GetRawAxis(2);
- } else {
- return GetRawAxis(3);
- }
-}
-
-/**
- * Read the value of the A button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- * @return The state of the button.
- */
-bool XboxController::GetAButton() const { return GetRawButton(1); }
-
-/**
- * Read the value of the B button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- * @return The state of the button.
- */
-bool XboxController::GetBButton() const { return GetRawButton(2); }
-
-/**
- * Read the value of the X button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- * @return The state of the button.
- */
-bool XboxController::GetXButton() const { return GetRawButton(3); }
-
-/**
- * Read the value of the Y button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- * @return The state of the button.
- */
-bool XboxController::GetYButton() const { return GetRawButton(4); }
-
-/**
- * Read the value of the back button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- * @return The state of the button.
- */
-bool XboxController::GetBackButton() const { return GetRawButton(7); }
-
-/**
- * Read the value of the start button on the controller.
- *
- * @param hand Side of controller whose value should be returned.
- * @return The state of the button.
- */
-bool XboxController::GetStartButton() const { return GetRawButton(8); }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimContinuousOutput.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimContinuousOutput.cpp
deleted file mode 100644
index 9a907cf..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimContinuousOutput.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "simulation/SimContinuousOutput.h"
-
-#include "simulation/MainNode.h"
-
-using namespace frc;
-
-SimContinuousOutput::SimContinuousOutput(std::string topic) {
- pub = MainNode::Advertise<gazebo::msgs::Float64>("~/simulator/" + topic);
- std::cout << "Initialized ~/simulator/" + topic << std::endl;
-}
-
-void SimContinuousOutput::Set(double speed) {
- gazebo::msgs::Float64 msg;
- msg.set_data(speed);
- pub->Publish(msg);
-}
-
-double SimContinuousOutput::Get() { return speed; }
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimDigitalInput.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimDigitalInput.cpp
deleted file mode 100644
index c4dbde6..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimDigitalInput.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "simulation/SimDigitalInput.h"
-
-#include "simulation/MainNode.h"
-
-using namespace frc;
-
-SimDigitalInput::SimDigitalInput(std::string topic) {
- sub = MainNode::Subscribe("~/simulator/" + topic, &SimDigitalInput::callback,
- this);
- std::cout << "Initialized ~/simulator/" + topic << std::endl;
-}
-
-bool SimDigitalInput::Get() { return value; }
-
-void SimDigitalInput::callback(const gazebo::msgs::ConstBoolPtr& msg) {
- value = msg->data();
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimEncoder.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimEncoder.cpp
deleted file mode 100644
index 141a371..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimEncoder.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "simulation/SimEncoder.h"
-
-#include "simulation/MainNode.h"
-
-using namespace frc;
-
-SimEncoder::SimEncoder(std::string topic) {
- commandPub = MainNode::Advertise<gazebo::msgs::GzString>("~/simulator/" +
- topic + "/control");
-
- posSub = MainNode::Subscribe("~/simulator/" + topic + "/position",
- &SimEncoder::positionCallback, this);
- velSub = MainNode::Subscribe("~/simulator/" + topic + "/velocity",
- &SimEncoder::velocityCallback, this);
-
- if (commandPub->WaitForConnection(
- gazebo::common::Time(5.0))) { // Wait up to five seconds.
- std::cout << "Initialized ~/simulator/" + topic << std::endl;
- } else {
- std::cerr << "Failed to initialize ~/simulator/" + topic +
- ": does the encoder exist?"
- << std::endl;
- }
-}
-
-void SimEncoder::Reset() { sendCommand("reset"); }
-
-void SimEncoder::Start() { sendCommand("start"); }
-
-void SimEncoder::Stop() { sendCommand("stop"); }
-
-double SimEncoder::GetPosition() { return position; }
-
-double SimEncoder::GetVelocity() { return velocity; }
-
-void SimEncoder::sendCommand(std::string cmd) {
- gazebo::msgs::GzString msg;
- msg.set_data(cmd);
- commandPub->Publish(msg);
-}
-
-void SimEncoder::positionCallback(const gazebo::msgs::ConstFloat64Ptr& msg) {
- position = msg->data();
-}
-
-void SimEncoder::velocityCallback(const gazebo::msgs::ConstFloat64Ptr& msg) {
- velocity = msg->data();
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimFloatInput.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimFloatInput.cpp
deleted file mode 100644
index 8bf8ae3..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimFloatInput.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "simulation/SimFloatInput.h"
-
-#include "simulation/MainNode.h"
-
-using namespace frc;
-
-SimFloatInput::SimFloatInput(std::string topic) {
- sub = MainNode::Subscribe("~/simulator/" + topic, &SimFloatInput::callback,
- this);
- std::cout << "Initialized ~/simulator/" + topic << std::endl;
-}
-
-double SimFloatInput::Get() { return value; }
-
-void SimFloatInput::callback(const gazebo::msgs::ConstFloat64Ptr& msg) {
- value = msg->data();
-}
diff --git a/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimGyro.cpp b/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimGyro.cpp
deleted file mode 100644
index 33663bd..0000000
--- a/third_party/allwpilib_2017/wpilibc/sim/src/simulation/SimGyro.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "simulation/SimGyro.h"
-
-#include "simulation/MainNode.h"
-
-using namespace frc;
-
-SimGyro::SimGyro(std::string topic) {
- commandPub = MainNode::Advertise<gazebo::msgs::GzString>("~/simulator/" +
- topic + "/control");
-
- posSub = MainNode::Subscribe("~/simulator/" + topic + "/position",
- &SimGyro::positionCallback, this);
- velSub = MainNode::Subscribe("~/simulator/" + topic + "/velocity",
- &SimGyro::velocityCallback, this);
-
- if (commandPub->WaitForConnection(
- gazebo::common::Time(5.0))) { // Wait up to five seconds.
- std::cout << "Initialized ~/simulator/" + topic << std::endl;
- } else {
- std::cerr << "Failed to initialize ~/simulator/" + topic +
- ": does the gyro exist?"
- << std::endl;
- }
-}
-
-void SimGyro::Reset() { sendCommand("reset"); }
-
-double SimGyro::GetAngle() { return position; }
-
-double SimGyro::GetVelocity() { return velocity; }
-
-void SimGyro::sendCommand(std::string cmd) {
- gazebo::msgs::GzString msg;
- msg.set_data(cmd);
- commandPub->Publish(msg);
-}
-
-void SimGyro::positionCallback(const gazebo::msgs::ConstFloat64Ptr& msg) {
- position = msg->data();
-}
-
-void SimGyro::velocityCallback(const gazebo::msgs::ConstFloat64Ptr& msg) {
- velocity = msg->data();
-}
diff --git a/third_party/allwpilib_2017/wpilibc/simulation.gradle b/third_party/allwpilib_2017/wpilibc/simulation.gradle
deleted file mode 100644
index 2bc2c4f..0000000
--- a/third_party/allwpilib_2017/wpilibc/simulation.gradle
+++ /dev/null
@@ -1,108 +0,0 @@
-import org.apache.tools.ant.taskdefs.condition.Os
-
- //cmake wrapper tasks
-task setupCmake(type: Exec) {
- description = 'create build directory for cmake to use'
- group = 'WPILib Simulation'
- workingDir '..'
- commandLine 'mkdir', '-p', 'build'
-}
-
-task cmake(type: Exec, dependsOn: setupCmake) {
- description = 'run cmake in the build directory to generate makefiles'
- group = 'WPILib Simulation'
- workingDir '../build'
- if (Os.isFamily(Os.FAMILY_WINDOWS)) {
- commandLine '../configure.bat',
- "-DNTCORE_INCLUDE_DIR=$netTablesInclude",
- "-DNTCORE_LIBDIR=$netLibDesktopLocation",
- "-DWPIUTIL_INCLUDE_DIR=$wpiUtilInclude",
- "-DWPIUTIL_LIBDIR=$wpiUtilLibDesktopLocation",
- "-DSIMULATION_INSTALL_DIR=$simulationInstallDir"
- }
- else {
- commandLine 'cmake', '..',
- "-DNTCORE_INCLUDE_DIR=$netTablesInclude",
- "-DNTCORE_LIBDIR=$netLibDesktopLocation",
- "-DWPIUTIL_INCLUDE_DIR=$wpiUtilInclude",
- "-DWPIUTIL_LIBDIR=$wpiUtilLibDesktopLocation",
- "-DSIMULATION_INSTALL_DIR=$simulationInstallDir"
- }
-}
-
-task frc_gazebo_plugins(type: Exec, dependsOn: cmake) {
- description = 'build Gazebo plugins with cmake'
- group = 'WPILib Simulation'
- workingDir '../build'
- if (Os.isFamily(Os.FAMILY_WINDOWS)) {
- commandLine 'nmake', 'frc_gazebo_plugins'
- }
- else {
- commandLine 'make', 'frc_gazebo_plugins'
- }
-}
-
-task gz_msgs(type: Exec, dependsOn: cmake) {
- description = 'build gz_msgs library with cmake'
- group = 'WPILib Simulation'
- workingDir '../build'
- if (Os.isFamily(Os.FAMILY_WINDOWS)) {
- commandLine 'nmake', 'gz_msgs'
- }
- else {
- commandLine 'make', 'gz_msgs'
- }
-}
-
-task wpilibcSim(type: Exec, dependsOn: ['cmake', ':downloadNetworkTables', ':downloadWpiutil', 'generateCppVersion']) {
- description = 'build WPILib C++ for simulation with cmake'
- group = 'WPILib Simulation'
- workingDir '../build'
- if (Os.isFamily(Os.FAMILY_WINDOWS)) {
- commandLine 'nmake', 'wpilibcSim'
- }
- else {
- commandLine 'make', 'wpilibcSim'
- }
-}
-
-task allcsim(dependsOn: [wpilibcSim, gz_msgs, frc_gazebo_plugins]){
- description = 'wrapper task to build all c++ simulation tasks'
- group = 'WPILib Simulation'
-}
-
-task wpilibcSimCopy(type: Copy, dependsOn: allcsim) {
- description = 'copy headers and ntcore library to make simulation zip'
- group = 'WPILib Simulation'
- into "$simulationInstallDir"
-
- from ("$netTablesInclude"){
- into "include"
- }
-
- from ("$wpiUtilInclude"){
- into "include"
- }
-
- from ("../hal/include"){
- into "include"
- }
-
- from ("sim/include"){
- into "include"
- }
-
- from ("shared/include"){
- into "include"
- }
-
- from ("$netLibDesktopLocation/libntcore.so") {
- into "lib"
- }
-
- from ("$wpiUtilLibDesktopLocation/libwpiutil.so") {
- into "lib"
- }
-}
-
-build.dependsOn allcsim
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/build.gradle b/third_party/allwpilib_2017/wpilibcIntegrationTests/build.gradle
deleted file mode 100644
index c37bbc7..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/build.gradle
+++ /dev/null
@@ -1,51 +0,0 @@
-apply plugin: 'cpp'
-
-defineNetworkTablesProperties()
-defineWpiUtilProperties()
-defineCsCoreProperties()
-
-ext.shared = "${project(':wpilibc').projectDir.getAbsolutePath()}/shared"
-ext.athena = "${project(':wpilibc').projectDir.getAbsolutePath()}/athena"
-ext.hal = project(':hal').projectDir.getAbsolutePath()
-
-model {
- components {
- FRCUserProgram(NativeExecutableSpec) {
- targetPlatform 'roborio-arm'
- binaries.all {
- tasks.withType(CppCompile) {
- cppCompiler.args "-DNAMESPACED_WPILIB"
- addNiLibraryLinks(linker, targetPlatform)
- addNetworkTablesLibraryLinks(it, linker, targetPlatform)
- addCsCoreLibraryLinks(it, linker, targetPlatform)
- }
-
- cppCompiler.args '-pthread', '-Wno-unused-variable'
- linker.args '-pthread', '-Wno-unused-variable', '-Wl,-rpath,/opt/GenICam_v3_0_NI/bin/Linux32_ARM'
- }
- sources {
- cpp {
- def dir = 'wpilibC++IntegrationTests'
- source {
- srcDir 'src'
- include '**/*.cpp'
- }
- source {
- srcDir 'gtest/src'
- include 'gtest-all.cc', 'gtest_main.cc'
- }
- exportedHeaders {
- srcDirs = ['include', 'gtest', 'gtest/include',
- "${project.athena}/include", "${project.shared}/include",
- "${project.hal}/include/HAL", netTablesInclude, wpiUtilInclude, csCoreInclude]
- include '**/*.h'
- }
-
- lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
- lib project: ':hal', library: 'HALAthena', linkage: 'shared'
- }
- }
- }
-
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-death-test.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-death-test.h
deleted file mode 100644
index 957a69c..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-death-test.h
+++ /dev/null
@@ -1,294 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the public API for death tests. It is
-// #included by gtest.h so a user doesn't need to include this
-// directly.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
-
-#include "gtest/internal/gtest-death-test-internal.h"
-
-namespace testing {
-
-// This flag controls the style of death tests. Valid values are "threadsafe",
-// meaning that the death test child process will re-execute the test binary
-// from the start, running only a single death test, or "fast",
-// meaning that the child process will execute the test logic immediately
-// after forking.
-GTEST_DECLARE_string_(death_test_style);
-
-#if GTEST_HAS_DEATH_TEST
-
-namespace internal {
-
-// Returns a Boolean value indicating whether the caller is currently
-// executing in the context of the death test child process. Tools such as
-// Valgrind heap checkers may need this to modify their behavior in death
-// tests. IMPORTANT: This is an internal utility. Using it may break the
-// implementation of death tests. User code MUST NOT use it.
-GTEST_API_ bool InDeathTestChild();
-
-} // namespace internal
-
-// The following macros are useful for writing death tests.
-
-// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
-// executed:
-//
-// 1. It generates a warning if there is more than one active
-// thread. This is because it's safe to fork() or clone() only
-// when there is a single thread.
-//
-// 2. The parent process clone()s a sub-process and runs the death
-// test in it; the sub-process exits with code 0 at the end of the
-// death test, if it hasn't exited already.
-//
-// 3. The parent process waits for the sub-process to terminate.
-//
-// 4. The parent process checks the exit code and error message of
-// the sub-process.
-//
-// Examples:
-//
-// ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
-// for (int i = 0; i < 5; i++) {
-// EXPECT_DEATH(server.ProcessRequest(i),
-// "Invalid request .* in ProcessRequest()")
-// << "Failed to die on request " << i;
-// }
-//
-// ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
-//
-// bool KilledBySIGHUP(int exit_code) {
-// return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
-// }
-//
-// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
-//
-// On the regular expressions used in death tests:
-//
-// On POSIX-compliant systems (*nix), we use the <regex.h> library,
-// which uses the POSIX extended regex syntax.
-//
-// On other platforms (e.g. Windows), we only support a simple regex
-// syntax implemented as part of Google Test. This limited
-// implementation should be enough most of the time when writing
-// death tests; though it lacks many features you can find in PCRE
-// or POSIX extended regex syntax. For example, we don't support
-// union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
-// repetition count ("x{5,7}"), among others.
-//
-// Below is the syntax that we do support. We chose it to be a
-// subset of both PCRE and POSIX extended regex, so it's easy to
-// learn wherever you come from. In the following: 'A' denotes a
-// literal character, period (.), or a single \\ escape sequence;
-// 'x' and 'y' denote regular expressions; 'm' and 'n' are for
-// natural numbers.
-//
-// c matches any literal character c
-// \\d matches any decimal digit
-// \\D matches any character that's not a decimal digit
-// \\f matches \f
-// \\n matches \n
-// \\r matches \r
-// \\s matches any ASCII whitespace, including \n
-// \\S matches any character that's not a whitespace
-// \\t matches \t
-// \\v matches \v
-// \\w matches any letter, _, or decimal digit
-// \\W matches any character that \\w doesn't match
-// \\c matches any literal character c, which must be a punctuation
-// . matches any single character except \n
-// A? matches 0 or 1 occurrences of A
-// A* matches 0 or many occurrences of A
-// A+ matches 1 or many occurrences of A
-// ^ matches the beginning of a string (not that of each line)
-// $ matches the end of a string (not that of each line)
-// xy matches x followed by y
-//
-// If you accidentally use PCRE or POSIX extended regex features
-// not implemented by us, you will get a run-time failure. In that
-// case, please try to rewrite your regular expression within the
-// above syntax.
-//
-// This implementation is *not* meant to be as highly tuned or robust
-// as a compiled regex library, but should perform well enough for a
-// death test, which already incurs significant overhead by launching
-// a child process.
-//
-// Known caveats:
-//
-// A "threadsafe" style death test obtains the path to the test
-// program from argv[0] and re-executes it in the sub-process. For
-// simplicity, the current implementation doesn't search the PATH
-// when launching the sub-process. This means that the user must
-// invoke the test program via a path that contains at least one
-// path separator (e.g. path/to/foo_test and
-// /absolute/path/to/bar_test are fine, but foo_test is not). This
-// is rarely a problem as people usually don't put the test binary
-// directory in PATH.
-//
-// TODO(wan@google.com): make thread-safe death tests search the PATH.
-
-// Asserts that a given statement causes the program to exit, with an
-// integer exit status that satisfies predicate, and emitting error output
-// that matches regex.
-# define ASSERT_EXIT(statement, predicate, regex) \
- GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
-
-// Like ASSERT_EXIT, but continues on to successive tests in the
-// test case, if any:
-# define EXPECT_EXIT(statement, predicate, regex) \
- GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
-
-// Asserts that a given statement causes the program to exit, either by
-// explicitly exiting with a nonzero exit code or being killed by a
-// signal, and emitting error output that matches regex.
-# define ASSERT_DEATH(statement, regex) \
- ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
-
-// Like ASSERT_DEATH, but continues on to successive tests in the
-// test case, if any:
-# define EXPECT_DEATH(statement, regex) \
- EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
-
-// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
-
-// Tests that an exit code describes a normal exit with a given exit code.
-class GTEST_API_ ExitedWithCode {
- public:
- explicit ExitedWithCode(int exit_code);
- bool operator()(int exit_status) const;
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ExitedWithCode& other);
-
- const int exit_code_;
-};
-
-# if !GTEST_OS_WINDOWS
-// Tests that an exit code describes an exit due to termination by a
-// given signal.
-class GTEST_API_ KilledBySignal {
- public:
- explicit KilledBySignal(int signum);
- bool operator()(int exit_status) const;
- private:
- const int signum_;
-};
-# endif // !GTEST_OS_WINDOWS
-
-// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
-// The death testing framework causes this to have interesting semantics,
-// since the sideeffects of the call are only visible in opt mode, and not
-// in debug mode.
-//
-// In practice, this can be used to test functions that utilize the
-// LOG(DFATAL) macro using the following style:
-//
-// int DieInDebugOr12(int* sideeffect) {
-// if (sideeffect) {
-// *sideeffect = 12;
-// }
-// LOG(DFATAL) << "death";
-// return 12;
-// }
-//
-// TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {
-// int sideeffect = 0;
-// // Only asserts in dbg.
-// EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
-//
-// #ifdef NDEBUG
-// // opt-mode has sideeffect visible.
-// EXPECT_EQ(12, sideeffect);
-// #else
-// // dbg-mode no visible sideeffect.
-// EXPECT_EQ(0, sideeffect);
-// #endif
-// }
-//
-// This will assert that DieInDebugReturn12InOpt() crashes in debug
-// mode, usually due to a DCHECK or LOG(DFATAL), but returns the
-// appropriate fallback value (12 in this case) in opt mode. If you
-// need to test that a function has appropriate side-effects in opt
-// mode, include assertions against the side-effects. A general
-// pattern for this is:
-//
-// EXPECT_DEBUG_DEATH({
-// // Side-effects here will have an effect after this statement in
-// // opt mode, but none in debug mode.
-// EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
-// }, "death");
-//
-# ifdef NDEBUG
-
-# define EXPECT_DEBUG_DEATH(statement, regex) \
- GTEST_EXECUTE_STATEMENT_(statement, regex)
-
-# define ASSERT_DEBUG_DEATH(statement, regex) \
- GTEST_EXECUTE_STATEMENT_(statement, regex)
-
-# else
-
-# define EXPECT_DEBUG_DEATH(statement, regex) \
- EXPECT_DEATH(statement, regex)
-
-# define ASSERT_DEBUG_DEATH(statement, regex) \
- ASSERT_DEATH(statement, regex)
-
-# endif // NDEBUG for EXPECT_DEBUG_DEATH
-#endif // GTEST_HAS_DEATH_TEST
-
-// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
-// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
-// death tests are supported; otherwise they just issue a warning. This is
-// useful when you are combining death test assertions with normal test
-// assertions in one test.
-#if GTEST_HAS_DEATH_TEST
-# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
- EXPECT_DEATH(statement, regex)
-# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
- ASSERT_DEATH(statement, regex)
-#else
-# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
- GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
-# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
- GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
-#endif
-
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-message.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-message.h
deleted file mode 100644
index fe879bc..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-message.h
+++ /dev/null
@@ -1,250 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the Message class.
-//
-// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
-// leave some internal implementation details in this header file.
-// They are clearly marked by comments like this:
-//
-// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-//
-// Such code is NOT meant to be used by a user directly, and is subject
-// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
-// program!
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
-#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
-
-#include <limits>
-
-#include "gtest/internal/gtest-port.h"
-
-// Ensures that there is at least one operator<< in the global namespace.
-// See Message& operator<<(...) below for why.
-void operator<<(const testing::internal::Secret&, int);
-
-namespace testing {
-
-// The Message class works like an ostream repeater.
-//
-// Typical usage:
-//
-// 1. You stream a bunch of values to a Message object.
-// It will remember the text in a stringstream.
-// 2. Then you stream the Message object to an ostream.
-// This causes the text in the Message to be streamed
-// to the ostream.
-//
-// For example;
-//
-// testing::Message foo;
-// foo << 1 << " != " << 2;
-// std::cout << foo;
-//
-// will print "1 != 2".
-//
-// Message is not intended to be inherited from. In particular, its
-// destructor is not virtual.
-//
-// Note that stringstream behaves differently in gcc and in MSVC. You
-// can stream a NULL char pointer to it in the former, but not in the
-// latter (it causes an access violation if you do). The Message
-// class hides this difference by treating a NULL char pointer as
-// "(null)".
-class GTEST_API_ Message {
- private:
- // The type of basic IO manipulators (endl, ends, and flush) for
- // narrow streams.
- typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
-
- public:
- // Constructs an empty Message.
- Message();
-
- // Copy constructor.
- Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT
- *ss_ << msg.GetString();
- }
-
- // Constructs a Message from a C-string.
- explicit Message(const char* str) : ss_(new ::std::stringstream) {
- *ss_ << str;
- }
-
-#if GTEST_OS_SYMBIAN
- // Streams a value (either a pointer or not) to this object.
- template <typename T>
- inline Message& operator <<(const T& value) {
- StreamHelper(typename internal::is_pointer<T>::type(), value);
- return *this;
- }
-#else
- // Streams a non-pointer value to this object.
- template <typename T>
- inline Message& operator <<(const T& val) {
- // Some libraries overload << for STL containers. These
- // overloads are defined in the global namespace instead of ::std.
- //
- // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
- // overloads are visible in either the std namespace or the global
- // namespace, but not other namespaces, including the testing
- // namespace which Google Test's Message class is in.
- //
- // To allow STL containers (and other types that has a << operator
- // defined in the global namespace) to be used in Google Test
- // assertions, testing::Message must access the custom << operator
- // from the global namespace. With this using declaration,
- // overloads of << defined in the global namespace and those
- // visible via Koenig lookup are both exposed in this function.
- using ::operator <<;
- *ss_ << val;
- return *this;
- }
-
- // Streams a pointer value to this object.
- //
- // This function is an overload of the previous one. When you
- // stream a pointer to a Message, this definition will be used as it
- // is more specialized. (The C++ Standard, section
- // [temp.func.order].) If you stream a non-pointer, then the
- // previous definition will be used.
- //
- // The reason for this overload is that streaming a NULL pointer to
- // ostream is undefined behavior. Depending on the compiler, you
- // may get "0", "(nil)", "(null)", or an access violation. To
- // ensure consistent result across compilers, we always treat NULL
- // as "(null)".
- template <typename T>
- inline Message& operator <<(T* const& pointer) { // NOLINT
- if (pointer == NULL) {
- *ss_ << "(null)";
- } else {
- *ss_ << pointer;
- }
- return *this;
- }
-#endif // GTEST_OS_SYMBIAN
-
- // Since the basic IO manipulators are overloaded for both narrow
- // and wide streams, we have to provide this specialized definition
- // of operator <<, even though its body is the same as the
- // templatized version above. Without this definition, streaming
- // endl or other basic IO manipulators to Message will confuse the
- // compiler.
- Message& operator <<(BasicNarrowIoManip val) {
- *ss_ << val;
- return *this;
- }
-
- // Instead of 1/0, we want to see true/false for bool values.
- Message& operator <<(bool b) {
- return *this << (b ? "true" : "false");
- }
-
- // These two overloads allow streaming a wide C string to a Message
- // using the UTF-8 encoding.
- Message& operator <<(const wchar_t* wide_c_str);
- Message& operator <<(wchar_t* wide_c_str);
-
-#if GTEST_HAS_STD_WSTRING
- // Converts the given wide string to a narrow string using the UTF-8
- // encoding, and streams the result to this Message object.
- Message& operator <<(const ::std::wstring& wstr);
-#endif // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
- // Converts the given wide string to a narrow string using the UTF-8
- // encoding, and streams the result to this Message object.
- Message& operator <<(const ::wstring& wstr);
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
- // Gets the text streamed to this object so far as an std::string.
- // Each '\0' character in the buffer is replaced with "\\0".
- //
- // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
- std::string GetString() const;
-
- private:
-
-#if GTEST_OS_SYMBIAN
- // These are needed as the Nokia Symbian Compiler cannot decide between
- // const T& and const T* in a function template. The Nokia compiler _can_
- // decide between class template specializations for T and T*, so a
- // tr1::type_traits-like is_pointer works, and we can overload on that.
- template <typename T>
- inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) {
- if (pointer == NULL) {
- *ss_ << "(null)";
- } else {
- *ss_ << pointer;
- }
- }
- template <typename T>
- inline void StreamHelper(internal::false_type /*is_pointer*/,
- const T& value) {
- // See the comments in Message& operator <<(const T&) above for why
- // we need this using statement.
- using ::operator <<;
- *ss_ << value;
- }
-#endif // GTEST_OS_SYMBIAN
-
- // We'll hold the text streamed to this object here.
- const internal::scoped_ptr< ::std::stringstream> ss_;
-
- // We declare (but don't implement) this to prevent the compiler
- // from implementing the assignment operator.
- void operator=(const Message&);
-};
-
-// Streams a Message to an ostream.
-inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
- return os << sb.GetString();
-}
-
-namespace internal {
-
-// Converts a streamable value to an std::string. A NULL pointer is
-// converted to "(null)". When the input value is a ::string,
-// ::std::string, ::wstring, or ::std::wstring object, each NUL
-// character in it is replaced with "\\0".
-template <typename T>
-std::string StreamableToString(const T& streamable) {
- return (Message() << streamable).GetString();
-}
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-param-test.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-param-test.h
deleted file mode 100644
index d6702c8..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-param-test.h
+++ /dev/null
@@ -1,1421 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gtest-param-test.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: vladl@google.com (Vlad Losev)
-//
-// Macros and functions for implementing parameterized tests
-// in Google C++ Testing Framework (Google Test)
-//
-// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-
-
-// Value-parameterized tests allow you to test your code with different
-// parameters without writing multiple copies of the same test.
-//
-// Here is how you use value-parameterized tests:
-
-#if 0
-
-// To write value-parameterized tests, first you should define a fixture
-// class. It is usually derived from testing::TestWithParam<T> (see below for
-// another inheritance scheme that's sometimes useful in more complicated
-// class hierarchies), where the type of your parameter values.
-// TestWithParam<T> is itself derived from testing::Test. T can be any
-// copyable type. If it's a raw pointer, you are responsible for managing the
-// lifespan of the pointed values.
-
-class FooTest : public ::testing::TestWithParam<const char*> {
- // You can implement all the usual class fixture members here.
-};
-
-// Then, use the TEST_P macro to define as many parameterized tests
-// for this fixture as you want. The _P suffix is for "parameterized"
-// or "pattern", whichever you prefer to think.
-
-TEST_P(FooTest, DoesBlah) {
- // Inside a test, access the test parameter with the GetParam() method
- // of the TestWithParam<T> class:
- EXPECT_TRUE(foo.Blah(GetParam()));
- ...
-}
-
-TEST_P(FooTest, HasBlahBlah) {
- ...
-}
-
-// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
-// case with any set of parameters you want. Google Test defines a number
-// of functions for generating test parameters. They return what we call
-// (surprise!) parameter generators. Here is a summary of them, which
-// are all in the testing namespace:
-//
-//
-// Range(begin, end [, step]) - Yields values {begin, begin+step,
-// begin+step+step, ...}. The values do not
-// include end. step defaults to 1.
-// Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
-// ValuesIn(container) - Yields values from a C-style array, an STL
-// ValuesIn(begin,end) container, or an iterator range [begin, end).
-// Bool() - Yields sequence {false, true}.
-// Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
-// for the math savvy) of the values generated
-// by the N generators.
-//
-// For more details, see comments at the definitions of these functions below
-// in this file.
-//
-// The following statement will instantiate tests from the FooTest test case
-// each with parameter values "meeny", "miny", and "moe".
-
-INSTANTIATE_TEST_CASE_P(InstantiationName,
- FooTest,
- Values("meeny", "miny", "moe"));
-
-// To distinguish different instances of the pattern, (yes, you
-// can instantiate it more then once) the first argument to the
-// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
-// actual test case name. Remember to pick unique prefixes for different
-// instantiations. The tests from the instantiation above will have
-// these names:
-//
-// * InstantiationName/FooTest.DoesBlah/0 for "meeny"
-// * InstantiationName/FooTest.DoesBlah/1 for "miny"
-// * InstantiationName/FooTest.DoesBlah/2 for "moe"
-// * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
-// * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
-// * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
-//
-// You can use these names in --gtest_filter.
-//
-// This statement will instantiate all tests from FooTest again, each
-// with parameter values "cat" and "dog":
-
-const char* pets[] = {"cat", "dog"};
-INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
-
-// The tests from the instantiation above will have these names:
-//
-// * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
-// * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
-// * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
-// * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
-//
-// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
-// in the given test case, whether their definitions come before or
-// AFTER the INSTANTIATE_TEST_CASE_P statement.
-//
-// Please also note that generator expressions (including parameters to the
-// generators) are evaluated in InitGoogleTest(), after main() has started.
-// This allows the user on one hand, to adjust generator parameters in order
-// to dynamically determine a set of tests to run and on the other hand,
-// give the user a chance to inspect the generated tests with Google Test
-// reflection API before RUN_ALL_TESTS() is executed.
-//
-// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
-// for more examples.
-//
-// In the future, we plan to publish the API for defining new parameter
-// generators. But for now this interface remains part of the internal
-// implementation and is subject to change.
-//
-//
-// A parameterized test fixture must be derived from testing::Test and from
-// testing::WithParamInterface<T>, where T is the type of the parameter
-// values. Inheriting from TestWithParam<T> satisfies that requirement because
-// TestWithParam<T> inherits from both Test and WithParamInterface. In more
-// complicated hierarchies, however, it is occasionally useful to inherit
-// separately from Test and WithParamInterface. For example:
-
-class BaseTest : public ::testing::Test {
- // You can inherit all the usual members for a non-parameterized test
- // fixture here.
-};
-
-class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
- // The usual test fixture members go here too.
-};
-
-TEST_F(BaseTest, HasFoo) {
- // This is an ordinary non-parameterized test.
-}
-
-TEST_P(DerivedTest, DoesBlah) {
- // GetParam works just the same here as if you inherit from TestWithParam.
- EXPECT_TRUE(foo.Blah(GetParam()));
-}
-
-#endif // 0
-
-#include "gtest/internal/gtest-port.h"
-
-#if !GTEST_OS_SYMBIAN
-# include <utility>
-#endif
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-param-util.h"
-#include "gtest/internal/gtest-param-util-generated.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Functions producing parameter generators.
-//
-// Google Test uses these generators to produce parameters for value-
-// parameterized tests. When a parameterized test case is instantiated
-// with a particular generator, Google Test creates and runs tests
-// for each element in the sequence produced by the generator.
-//
-// In the following sample, tests from test case FooTest are instantiated
-// each three times with parameter values 3, 5, and 8:
-//
-// class FooTest : public TestWithParam<int> { ... };
-//
-// TEST_P(FooTest, TestThis) {
-// }
-// TEST_P(FooTest, TestThat) {
-// }
-// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
-//
-
-// Range() returns generators providing sequences of values in a range.
-//
-// Synopsis:
-// Range(start, end)
-// - returns a generator producing a sequence of values {start, start+1,
-// start+2, ..., }.
-// Range(start, end, step)
-// - returns a generator producing a sequence of values {start, start+step,
-// start+step+step, ..., }.
-// Notes:
-// * The generated sequences never include end. For example, Range(1, 5)
-// returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
-// returns a generator producing {1, 3, 5, 7}.
-// * start and end must have the same type. That type may be any integral or
-// floating-point type or a user defined type satisfying these conditions:
-// * It must be assignable (have operator=() defined).
-// * It must have operator+() (operator+(int-compatible type) for
-// two-operand version).
-// * It must have operator<() defined.
-// Elements in the resulting sequences will also have that type.
-// * Condition start < end must be satisfied in order for resulting sequences
-// to contain any elements.
-//
-template <typename T, typename IncrementT>
-internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
- return internal::ParamGenerator<T>(
- new internal::RangeGenerator<T, IncrementT>(start, end, step));
-}
-
-template <typename T>
-internal::ParamGenerator<T> Range(T start, T end) {
- return Range(start, end, 1);
-}
-
-// ValuesIn() function allows generation of tests with parameters coming from
-// a container.
-//
-// Synopsis:
-// ValuesIn(const T (&array)[N])
-// - returns a generator producing sequences with elements from
-// a C-style array.
-// ValuesIn(const Container& container)
-// - returns a generator producing sequences with elements from
-// an STL-style container.
-// ValuesIn(Iterator begin, Iterator end)
-// - returns a generator producing sequences with elements from
-// a range [begin, end) defined by a pair of STL-style iterators. These
-// iterators can also be plain C pointers.
-//
-// Please note that ValuesIn copies the values from the containers
-// passed in and keeps them to generate tests in RUN_ALL_TESTS().
-//
-// Examples:
-//
-// This instantiates tests from test case StringTest
-// each with C-string values of "foo", "bar", and "baz":
-//
-// const char* strings[] = {"foo", "bar", "baz"};
-// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
-//
-// This instantiates tests from test case StlStringTest
-// each with STL strings with values "a" and "b":
-//
-// ::std::vector< ::std::string> GetParameterStrings() {
-// ::std::vector< ::std::string> v;
-// v.push_back("a");
-// v.push_back("b");
-// return v;
-// }
-//
-// INSTANTIATE_TEST_CASE_P(CharSequence,
-// StlStringTest,
-// ValuesIn(GetParameterStrings()));
-//
-//
-// This will also instantiate tests from CharTest
-// each with parameter values 'a' and 'b':
-//
-// ::std::list<char> GetParameterChars() {
-// ::std::list<char> list;
-// list.push_back('a');
-// list.push_back('b');
-// return list;
-// }
-// ::std::list<char> l = GetParameterChars();
-// INSTANTIATE_TEST_CASE_P(CharSequence2,
-// CharTest,
-// ValuesIn(l.begin(), l.end()));
-//
-template <typename ForwardIterator>
-internal::ParamGenerator<
- typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
-ValuesIn(ForwardIterator begin, ForwardIterator end) {
- typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
- ::value_type ParamType;
- return internal::ParamGenerator<ParamType>(
- new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
-}
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
- return ValuesIn(array, array + N);
-}
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
- const Container& container) {
- return ValuesIn(container.begin(), container.end());
-}
-
-// Values() allows generating tests from explicitly specified list of
-// parameters.
-//
-// Synopsis:
-// Values(T v1, T v2, ..., T vN)
-// - returns a generator producing sequences with elements v1, v2, ..., vN.
-//
-// For example, this instantiates tests from test case BarTest each
-// with values "one", "two", and "three":
-//
-// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
-//
-// This instantiates tests from test case BazTest each with values 1, 2, 3.5.
-// The exact type of values will depend on the type of parameter in BazTest.
-//
-// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
-//
-// Currently, Values() supports from 1 to 50 parameters.
-//
-template <typename T1>
-internal::ValueArray1<T1> Values(T1 v1) {
- return internal::ValueArray1<T1>(v1);
-}
-
-template <typename T1, typename T2>
-internal::ValueArray2<T1, T2> Values(T1 v1, T2 v2) {
- return internal::ValueArray2<T1, T2>(v1, v2);
-}
-
-template <typename T1, typename T2, typename T3>
-internal::ValueArray3<T1, T2, T3> Values(T1 v1, T2 v2, T3 v3) {
- return internal::ValueArray3<T1, T2, T3>(v1, v2, v3);
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-internal::ValueArray4<T1, T2, T3, T4> Values(T1 v1, T2 v2, T3 v3, T4 v4) {
- return internal::ValueArray4<T1, T2, T3, T4>(v1, v2, v3, v4);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-internal::ValueArray5<T1, T2, T3, T4, T5> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5) {
- return internal::ValueArray5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-internal::ValueArray6<T1, T2, T3, T4, T5, T6> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6) {
- return internal::ValueArray6<T1, T2, T3, T4, T5, T6>(v1, v2, v3, v4, v5, v6);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6, T7 v7) {
- return internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7>(v1, v2, v3, v4, v5,
- v6, v7);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) {
- return internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8>(v1, v2, v3, v4,
- v5, v6, v7, v8);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) {
- return internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1, v2, v3,
- v4, v5, v6, v7, v8, v9);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Values(T1 v1,
- T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) {
- return internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1,
- v2, v3, v4, v5, v6, v7, v8, v9, v10);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
- T11> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11) {
- return internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
- T11>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12) {
- return internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13) {
- return internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) {
- return internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
- v14);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) {
- return internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
- v13, v14, v15);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16) {
- return internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
- v12, v13, v14, v15, v16);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17) {
- return internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
- v11, v12, v13, v14, v15, v16, v17);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
- T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18) {
- return internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
- v10, v11, v12, v13, v14, v15, v16, v17, v18);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
- T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
- T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) {
- return internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19>(v1, v2, v3, v4, v5, v6, v7, v8,
- v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) {
- return internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20>(v1, v2, v3, v4, v5, v6, v7,
- v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) {
- return internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(v1, v2, v3, v4, v5, v6,
- v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22) {
- return internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>(v1, v2, v3, v4,
- v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23) {
- return internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23>(v1, v2, v3,
- v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24) {
- return internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24>(v1, v2,
- v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
- v19, v20, v21, v22, v23, v24);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Values(T1 v1,
- T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
- T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
- T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) {
- return internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25>(v1,
- v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
- v18, v19, v20, v21, v22, v23, v24, v25);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26) {
- return internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
- v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27) {
- return internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
- v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28) {
- return internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
- v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
- v28);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29) {
- return internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
- v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
- v27, v28, v29);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
- T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
- T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) {
- return internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
- v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
- v26, v27, v28, v29, v30);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) {
- return internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
- v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
- v25, v26, v27, v28, v29, v30, v31);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32) {
- return internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
- v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
- T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33) {
- return internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33>(v1, v2, v3, v4, v5, v6, v7, v8,
- v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32, v33);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
- T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
- T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
- T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
- T31 v31, T32 v32, T33 v33, T34 v34) {
- return internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34>(v1, v2, v3, v4, v5, v6, v7,
- v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
- v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
- T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
- T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) {
- return internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35>(v1, v2, v3, v4, v5, v6,
- v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
- v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
- T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
- T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) {
- return internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36>(v1, v2, v3, v4,
- v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
- v34, v35, v36);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
- T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
- T37 v37) {
- return internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37>(v1, v2, v3,
- v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
- v34, v35, v36, v37);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
- T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
- T37 v37, T38 v38) {
- return internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38>(v1, v2,
- v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
- v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32,
- v33, v34, v35, v36, v37, v38);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
- T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
- T37 v37, T38 v38, T39 v39) {
- return internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39>(v1,
- v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
- v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,
- v32, v33, v34, v35, v36, v37, v38, v39);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Values(T1 v1,
- T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
- T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
- T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27,
- T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35,
- T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) {
- return internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
- v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29,
- v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) {
- return internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
- v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28,
- v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42) {
- return internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
- v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
- v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41,
- v42);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43) {
- return internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
- v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
- v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40,
- v41, v42, v43);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44) {
- return internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
- v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
- v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39,
- v40, v41, v42, v43, v44);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
- T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
- T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
- T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
- T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) {
- return internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
- v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
- v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38,
- v39, v40, v41, v42, v43, v44, v45);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
- T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) {
- return internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
- v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
- v38, v39, v40, v41, v42, v43, v44, v45, v46);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
- T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) {
- return internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47>(v1, v2, v3, v4, v5, v6, v7, v8,
- v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
- v38, v39, v40, v41, v42, v43, v44, v45, v46, v47);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
- T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
- T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47,
- T48 v48) {
- return internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47, T48>(v1, v2, v3, v4, v5, v6, v7,
- v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
- v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36,
- v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
- T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
- T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
- T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
- T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38,
- T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46,
- T47 v47, T48 v48, T49 v49) {
- return internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47, T48, T49>(v1, v2, v3, v4, v5, v6,
- v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
- v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35,
- v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49, T50> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
- T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
- T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37,
- T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45,
- T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) {
- return internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>(v1, v2, v3, v4,
- v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
- v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47,
- v48, v49, v50);
-}
-
-// Bool() allows generating tests with parameters in a set of (false, true).
-//
-// Synopsis:
-// Bool()
-// - returns a generator producing sequences with elements {false, true}.
-//
-// It is useful when testing code that depends on Boolean flags. Combinations
-// of multiple flags can be tested when several Bool()'s are combined using
-// Combine() function.
-//
-// In the following example all tests in the test case FlagDependentTest
-// will be instantiated twice with parameters false and true.
-//
-// class FlagDependentTest : public testing::TestWithParam<bool> {
-// virtual void SetUp() {
-// external_flag = GetParam();
-// }
-// }
-// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
-//
-inline internal::ParamGenerator<bool> Bool() {
- return Values(false, true);
-}
-
-# if GTEST_HAS_COMBINE
-// Combine() allows the user to combine two or more sequences to produce
-// values of a Cartesian product of those sequences' elements.
-//
-// Synopsis:
-// Combine(gen1, gen2, ..., genN)
-// - returns a generator producing sequences with elements coming from
-// the Cartesian product of elements from the sequences generated by
-// gen1, gen2, ..., genN. The sequence elements will have a type of
-// tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
-// of elements from sequences produces by gen1, gen2, ..., genN.
-//
-// Combine can have up to 10 arguments. This number is currently limited
-// by the maximum number of elements in the tuple implementation used by Google
-// Test.
-//
-// Example:
-//
-// This will instantiate tests in test case AnimalTest each one with
-// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
-// tuple("dog", BLACK), and tuple("dog", WHITE):
-//
-// enum Color { BLACK, GRAY, WHITE };
-// class AnimalTest
-// : public testing::TestWithParam<tuple<const char*, Color> > {...};
-//
-// TEST_P(AnimalTest, AnimalLooksNice) {...}
-//
-// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
-// Combine(Values("cat", "dog"),
-// Values(BLACK, WHITE)));
-//
-// This will instantiate tests in FlagDependentTest with all variations of two
-// Boolean flags:
-//
-// class FlagDependentTest
-// : public testing::TestWithParam<tuple<bool, bool> > {
-// virtual void SetUp() {
-// // Assigns external_flag_1 and external_flag_2 values from the tuple.
-// tie(external_flag_1, external_flag_2) = GetParam();
-// }
-// };
-//
-// TEST_P(FlagDependentTest, TestFeature1) {
-// // Test your code using external_flag_1 and external_flag_2 here.
-// }
-// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
-// Combine(Bool(), Bool()));
-//
-template <typename Generator1, typename Generator2>
-internal::CartesianProductHolder2<Generator1, Generator2> Combine(
- const Generator1& g1, const Generator2& g2) {
- return internal::CartesianProductHolder2<Generator1, Generator2>(
- g1, g2);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3>
-internal::CartesianProductHolder3<Generator1, Generator2, Generator3> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3) {
- return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
- g1, g2, g3);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4>
-internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
- Generator4> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4) {
- return internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
- Generator4>(
- g1, g2, g3, g4);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5>
-internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
- Generator4, Generator5> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5) {
- return internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
- Generator4, Generator5>(
- g1, g2, g3, g4, g5);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6>
-internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6) {
- return internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6>(
- g1, g2, g3, g4, g5, g6);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7>
-internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7) {
- return internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7>(
- g1, g2, g3, g4, g5, g6, g7);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7, typename Generator8>
-internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7, const Generator8& g8) {
- return internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8>(
- g1, g2, g3, g4, g5, g6, g7, g8);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7, typename Generator8, typename Generator9>
-internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8,
- Generator9> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7, const Generator8& g8, const Generator9& g9) {
- return internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>(
- g1, g2, g3, g4, g5, g6, g7, g8, g9);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7, typename Generator8, typename Generator9,
- typename Generator10>
-internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
- Generator10> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7, const Generator8& g8, const Generator9& g9,
- const Generator10& g10) {
- return internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
- Generator10>(
- g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);
-}
-# endif // GTEST_HAS_COMBINE
-
-
-
-# define TEST_P(test_case_name, test_name) \
- class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
- : public test_case_name { \
- public: \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
- virtual void TestBody(); \
- private: \
- static int AddToRegistry() { \
- ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
- GetTestCasePatternHolder<test_case_name>(\
- #test_case_name, __FILE__, __LINE__)->AddTestPattern(\
- #test_case_name, \
- #test_name, \
- new ::testing::internal::TestMetaFactory< \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
- return 0; \
- } \
- static int gtest_registering_dummy_; \
- GTEST_DISALLOW_COPY_AND_ASSIGN_(\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
- }; \
- int GTEST_TEST_CLASS_NAME_(test_case_name, \
- test_name)::gtest_registering_dummy_ = \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
- void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
-
-# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
- ::testing::internal::ParamGenerator<test_case_name::ParamType> \
- gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
- int gtest_##prefix##test_case_name##_dummy_ = \
- ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
- GetTestCasePatternHolder<test_case_name>(\
- #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\
- #prefix, \
- >est_##prefix##test_case_name##_EvalGenerator_, \
- __FILE__, __LINE__)
-
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-param-test.h.pump b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-param-test.h.pump
deleted file mode 100644
index 2dc9303..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-param-test.h.pump
+++ /dev/null
@@ -1,487 +0,0 @@
-$$ -*- mode: c++; -*-
-$var n = 50 $$ Maximum length of Values arguments we want to support.
-$var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: vladl@google.com (Vlad Losev)
-//
-// Macros and functions for implementing parameterized tests
-// in Google C++ Testing Framework (Google Test)
-//
-// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-
-
-// Value-parameterized tests allow you to test your code with different
-// parameters without writing multiple copies of the same test.
-//
-// Here is how you use value-parameterized tests:
-
-#if 0
-
-// To write value-parameterized tests, first you should define a fixture
-// class. It is usually derived from testing::TestWithParam<T> (see below for
-// another inheritance scheme that's sometimes useful in more complicated
-// class hierarchies), where the type of your parameter values.
-// TestWithParam<T> is itself derived from testing::Test. T can be any
-// copyable type. If it's a raw pointer, you are responsible for managing the
-// lifespan of the pointed values.
-
-class FooTest : public ::testing::TestWithParam<const char*> {
- // You can implement all the usual class fixture members here.
-};
-
-// Then, use the TEST_P macro to define as many parameterized tests
-// for this fixture as you want. The _P suffix is for "parameterized"
-// or "pattern", whichever you prefer to think.
-
-TEST_P(FooTest, DoesBlah) {
- // Inside a test, access the test parameter with the GetParam() method
- // of the TestWithParam<T> class:
- EXPECT_TRUE(foo.Blah(GetParam()));
- ...
-}
-
-TEST_P(FooTest, HasBlahBlah) {
- ...
-}
-
-// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
-// case with any set of parameters you want. Google Test defines a number
-// of functions for generating test parameters. They return what we call
-// (surprise!) parameter generators. Here is a summary of them, which
-// are all in the testing namespace:
-//
-//
-// Range(begin, end [, step]) - Yields values {begin, begin+step,
-// begin+step+step, ...}. The values do not
-// include end. step defaults to 1.
-// Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
-// ValuesIn(container) - Yields values from a C-style array, an STL
-// ValuesIn(begin,end) container, or an iterator range [begin, end).
-// Bool() - Yields sequence {false, true}.
-// Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
-// for the math savvy) of the values generated
-// by the N generators.
-//
-// For more details, see comments at the definitions of these functions below
-// in this file.
-//
-// The following statement will instantiate tests from the FooTest test case
-// each with parameter values "meeny", "miny", and "moe".
-
-INSTANTIATE_TEST_CASE_P(InstantiationName,
- FooTest,
- Values("meeny", "miny", "moe"));
-
-// To distinguish different instances of the pattern, (yes, you
-// can instantiate it more then once) the first argument to the
-// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
-// actual test case name. Remember to pick unique prefixes for different
-// instantiations. The tests from the instantiation above will have
-// these names:
-//
-// * InstantiationName/FooTest.DoesBlah/0 for "meeny"
-// * InstantiationName/FooTest.DoesBlah/1 for "miny"
-// * InstantiationName/FooTest.DoesBlah/2 for "moe"
-// * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
-// * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
-// * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
-//
-// You can use these names in --gtest_filter.
-//
-// This statement will instantiate all tests from FooTest again, each
-// with parameter values "cat" and "dog":
-
-const char* pets[] = {"cat", "dog"};
-INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
-
-// The tests from the instantiation above will have these names:
-//
-// * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
-// * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
-// * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
-// * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
-//
-// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
-// in the given test case, whether their definitions come before or
-// AFTER the INSTANTIATE_TEST_CASE_P statement.
-//
-// Please also note that generator expressions (including parameters to the
-// generators) are evaluated in InitGoogleTest(), after main() has started.
-// This allows the user on one hand, to adjust generator parameters in order
-// to dynamically determine a set of tests to run and on the other hand,
-// give the user a chance to inspect the generated tests with Google Test
-// reflection API before RUN_ALL_TESTS() is executed.
-//
-// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
-// for more examples.
-//
-// In the future, we plan to publish the API for defining new parameter
-// generators. But for now this interface remains part of the internal
-// implementation and is subject to change.
-//
-//
-// A parameterized test fixture must be derived from testing::Test and from
-// testing::WithParamInterface<T>, where T is the type of the parameter
-// values. Inheriting from TestWithParam<T> satisfies that requirement because
-// TestWithParam<T> inherits from both Test and WithParamInterface. In more
-// complicated hierarchies, however, it is occasionally useful to inherit
-// separately from Test and WithParamInterface. For example:
-
-class BaseTest : public ::testing::Test {
- // You can inherit all the usual members for a non-parameterized test
- // fixture here.
-};
-
-class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
- // The usual test fixture members go here too.
-};
-
-TEST_F(BaseTest, HasFoo) {
- // This is an ordinary non-parameterized test.
-}
-
-TEST_P(DerivedTest, DoesBlah) {
- // GetParam works just the same here as if you inherit from TestWithParam.
- EXPECT_TRUE(foo.Blah(GetParam()));
-}
-
-#endif // 0
-
-#include "gtest/internal/gtest-port.h"
-
-#if !GTEST_OS_SYMBIAN
-# include <utility>
-#endif
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-param-util.h"
-#include "gtest/internal/gtest-param-util-generated.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Functions producing parameter generators.
-//
-// Google Test uses these generators to produce parameters for value-
-// parameterized tests. When a parameterized test case is instantiated
-// with a particular generator, Google Test creates and runs tests
-// for each element in the sequence produced by the generator.
-//
-// In the following sample, tests from test case FooTest are instantiated
-// each three times with parameter values 3, 5, and 8:
-//
-// class FooTest : public TestWithParam<int> { ... };
-//
-// TEST_P(FooTest, TestThis) {
-// }
-// TEST_P(FooTest, TestThat) {
-// }
-// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
-//
-
-// Range() returns generators providing sequences of values in a range.
-//
-// Synopsis:
-// Range(start, end)
-// - returns a generator producing a sequence of values {start, start+1,
-// start+2, ..., }.
-// Range(start, end, step)
-// - returns a generator producing a sequence of values {start, start+step,
-// start+step+step, ..., }.
-// Notes:
-// * The generated sequences never include end. For example, Range(1, 5)
-// returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
-// returns a generator producing {1, 3, 5, 7}.
-// * start and end must have the same type. That type may be any integral or
-// floating-point type or a user defined type satisfying these conditions:
-// * It must be assignable (have operator=() defined).
-// * It must have operator+() (operator+(int-compatible type) for
-// two-operand version).
-// * It must have operator<() defined.
-// Elements in the resulting sequences will also have that type.
-// * Condition start < end must be satisfied in order for resulting sequences
-// to contain any elements.
-//
-template <typename T, typename IncrementT>
-internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
- return internal::ParamGenerator<T>(
- new internal::RangeGenerator<T, IncrementT>(start, end, step));
-}
-
-template <typename T>
-internal::ParamGenerator<T> Range(T start, T end) {
- return Range(start, end, 1);
-}
-
-// ValuesIn() function allows generation of tests with parameters coming from
-// a container.
-//
-// Synopsis:
-// ValuesIn(const T (&array)[N])
-// - returns a generator producing sequences with elements from
-// a C-style array.
-// ValuesIn(const Container& container)
-// - returns a generator producing sequences with elements from
-// an STL-style container.
-// ValuesIn(Iterator begin, Iterator end)
-// - returns a generator producing sequences with elements from
-// a range [begin, end) defined by a pair of STL-style iterators. These
-// iterators can also be plain C pointers.
-//
-// Please note that ValuesIn copies the values from the containers
-// passed in and keeps them to generate tests in RUN_ALL_TESTS().
-//
-// Examples:
-//
-// This instantiates tests from test case StringTest
-// each with C-string values of "foo", "bar", and "baz":
-//
-// const char* strings[] = {"foo", "bar", "baz"};
-// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
-//
-// This instantiates tests from test case StlStringTest
-// each with STL strings with values "a" and "b":
-//
-// ::std::vector< ::std::string> GetParameterStrings() {
-// ::std::vector< ::std::string> v;
-// v.push_back("a");
-// v.push_back("b");
-// return v;
-// }
-//
-// INSTANTIATE_TEST_CASE_P(CharSequence,
-// StlStringTest,
-// ValuesIn(GetParameterStrings()));
-//
-//
-// This will also instantiate tests from CharTest
-// each with parameter values 'a' and 'b':
-//
-// ::std::list<char> GetParameterChars() {
-// ::std::list<char> list;
-// list.push_back('a');
-// list.push_back('b');
-// return list;
-// }
-// ::std::list<char> l = GetParameterChars();
-// INSTANTIATE_TEST_CASE_P(CharSequence2,
-// CharTest,
-// ValuesIn(l.begin(), l.end()));
-//
-template <typename ForwardIterator>
-internal::ParamGenerator<
- typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
-ValuesIn(ForwardIterator begin, ForwardIterator end) {
- typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
- ::value_type ParamType;
- return internal::ParamGenerator<ParamType>(
- new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
-}
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
- return ValuesIn(array, array + N);
-}
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
- const Container& container) {
- return ValuesIn(container.begin(), container.end());
-}
-
-// Values() allows generating tests from explicitly specified list of
-// parameters.
-//
-// Synopsis:
-// Values(T v1, T v2, ..., T vN)
-// - returns a generator producing sequences with elements v1, v2, ..., vN.
-//
-// For example, this instantiates tests from test case BarTest each
-// with values "one", "two", and "three":
-//
-// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
-//
-// This instantiates tests from test case BazTest each with values 1, 2, 3.5.
-// The exact type of values will depend on the type of parameter in BazTest.
-//
-// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
-//
-// Currently, Values() supports from 1 to $n parameters.
-//
-$range i 1..n
-$for i [[
-$range j 1..i
-
-template <$for j, [[typename T$j]]>
-internal::ValueArray$i<$for j, [[T$j]]> Values($for j, [[T$j v$j]]) {
- return internal::ValueArray$i<$for j, [[T$j]]>($for j, [[v$j]]);
-}
-
-]]
-
-// Bool() allows generating tests with parameters in a set of (false, true).
-//
-// Synopsis:
-// Bool()
-// - returns a generator producing sequences with elements {false, true}.
-//
-// It is useful when testing code that depends on Boolean flags. Combinations
-// of multiple flags can be tested when several Bool()'s are combined using
-// Combine() function.
-//
-// In the following example all tests in the test case FlagDependentTest
-// will be instantiated twice with parameters false and true.
-//
-// class FlagDependentTest : public testing::TestWithParam<bool> {
-// virtual void SetUp() {
-// external_flag = GetParam();
-// }
-// }
-// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
-//
-inline internal::ParamGenerator<bool> Bool() {
- return Values(false, true);
-}
-
-# if GTEST_HAS_COMBINE
-// Combine() allows the user to combine two or more sequences to produce
-// values of a Cartesian product of those sequences' elements.
-//
-// Synopsis:
-// Combine(gen1, gen2, ..., genN)
-// - returns a generator producing sequences with elements coming from
-// the Cartesian product of elements from the sequences generated by
-// gen1, gen2, ..., genN. The sequence elements will have a type of
-// tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
-// of elements from sequences produces by gen1, gen2, ..., genN.
-//
-// Combine can have up to $maxtuple arguments. This number is currently limited
-// by the maximum number of elements in the tuple implementation used by Google
-// Test.
-//
-// Example:
-//
-// This will instantiate tests in test case AnimalTest each one with
-// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
-// tuple("dog", BLACK), and tuple("dog", WHITE):
-//
-// enum Color { BLACK, GRAY, WHITE };
-// class AnimalTest
-// : public testing::TestWithParam<tuple<const char*, Color> > {...};
-//
-// TEST_P(AnimalTest, AnimalLooksNice) {...}
-//
-// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
-// Combine(Values("cat", "dog"),
-// Values(BLACK, WHITE)));
-//
-// This will instantiate tests in FlagDependentTest with all variations of two
-// Boolean flags:
-//
-// class FlagDependentTest
-// : public testing::TestWithParam<tuple<bool, bool> > {
-// virtual void SetUp() {
-// // Assigns external_flag_1 and external_flag_2 values from the tuple.
-// tie(external_flag_1, external_flag_2) = GetParam();
-// }
-// };
-//
-// TEST_P(FlagDependentTest, TestFeature1) {
-// // Test your code using external_flag_1 and external_flag_2 here.
-// }
-// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
-// Combine(Bool(), Bool()));
-//
-$range i 2..maxtuple
-$for i [[
-$range j 1..i
-
-template <$for j, [[typename Generator$j]]>
-internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
- $for j, [[const Generator$j& g$j]]) {
- return internal::CartesianProductHolder$i<$for j, [[Generator$j]]>(
- $for j, [[g$j]]);
-}
-
-]]
-# endif // GTEST_HAS_COMBINE
-
-
-
-# define TEST_P(test_case_name, test_name) \
- class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
- : public test_case_name { \
- public: \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
- virtual void TestBody(); \
- private: \
- static int AddToRegistry() { \
- ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
- GetTestCasePatternHolder<test_case_name>(\
- #test_case_name, __FILE__, __LINE__)->AddTestPattern(\
- #test_case_name, \
- #test_name, \
- new ::testing::internal::TestMetaFactory< \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
- return 0; \
- } \
- static int gtest_registering_dummy_; \
- GTEST_DISALLOW_COPY_AND_ASSIGN_(\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
- }; \
- int GTEST_TEST_CLASS_NAME_(test_case_name, \
- test_name)::gtest_registering_dummy_ = \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
- void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
-
-# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
- ::testing::internal::ParamGenerator<test_case_name::ParamType> \
- gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
- int gtest_##prefix##test_case_name##_dummy_ = \
- ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
- GetTestCasePatternHolder<test_case_name>(\
- #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\
- #prefix, \
- >est_##prefix##test_case_name##_EvalGenerator_, \
- __FILE__, __LINE__)
-
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-printers.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-printers.h
deleted file mode 100644
index 18ee7bc..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-printers.h
+++ /dev/null
@@ -1,891 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Test - The Google C++ Testing Framework
-//
-// This file implements a universal value printer that can print a
-// value of any type T:
-//
-// void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
-//
-// A user can teach this function how to print a class type T by
-// defining either operator<<() or PrintTo() in the namespace that
-// defines T. More specifically, the FIRST defined function in the
-// following list will be used (assuming T is defined in namespace
-// foo):
-//
-// 1. foo::PrintTo(const T&, ostream*)
-// 2. operator<<(ostream&, const T&) defined in either foo or the
-// global namespace.
-//
-// If none of the above is defined, it will print the debug string of
-// the value if it is a protocol buffer, or print the raw bytes in the
-// value otherwise.
-//
-// To aid debugging: when T is a reference type, the address of the
-// value is also printed; when T is a (const) char pointer, both the
-// pointer value and the NUL-terminated string it points to are
-// printed.
-//
-// We also provide some convenient wrappers:
-//
-// // Prints a value to a string. For a (const or not) char
-// // pointer, the NUL-terminated string (but not the pointer) is
-// // printed.
-// std::string ::testing::PrintToString(const T& value);
-//
-// // Prints a value tersely: for a reference type, the referenced
-// // value (but not the address) is printed; for a (const or not) char
-// // pointer, the NUL-terminated string (but not the pointer) is
-// // printed.
-// void ::testing::internal::UniversalTersePrint(const T& value, ostream*);
-//
-// // Prints value using the type inferred by the compiler. The difference
-// // from UniversalTersePrint() is that this function prints both the
-// // pointer and the NUL-terminated string for a (const or not) char pointer.
-// void ::testing::internal::UniversalPrint(const T& value, ostream*);
-//
-// // Prints the fields of a tuple tersely to a string vector, one
-// // element for each field. Tuple support must be enabled in
-// // gtest-port.h.
-// std::vector<string> UniversalTersePrintTupleFieldsToStrings(
-// const Tuple& value);
-//
-// Known limitation:
-//
-// The print primitives print the elements of an STL-style container
-// using the compiler-inferred type of *iter where iter is a
-// const_iterator of the container. When const_iterator is an input
-// iterator but not a forward iterator, this inferred type may not
-// match value_type, and the print output may be incorrect. In
-// practice, this is rarely a problem as for most containers
-// const_iterator is a forward iterator. We'll fix this if there's an
-// actual need for it. Note that this fix cannot rely on value_type
-// being defined as many user-defined container types don't have
-// value_type.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
-
-#include <ostream> // NOLINT
-#include <sstream>
-#include <string>
-#include <utility>
-#include <vector>
-#include "gtest/internal/gtest-port.h"
-#include "gtest/internal/gtest-internal.h"
-
-#if GTEST_HAS_STD_TUPLE_
-# include <tuple>
-#endif
-
-namespace testing {
-
-// Definitions in the 'internal' and 'internal2' name spaces are
-// subject to change without notice. DO NOT USE THEM IN USER CODE!
-namespace internal2 {
-
-// Prints the given number of bytes in the given object to the given
-// ostream.
-GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
- size_t count,
- ::std::ostream* os);
-
-// For selecting which printer to use when a given type has neither <<
-// nor PrintTo().
-enum TypeKind {
- kProtobuf, // a protobuf type
- kConvertibleToInteger, // a type implicitly convertible to BiggestInt
- // (e.g. a named or unnamed enum type)
- kOtherType // anything else
-};
-
-// TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called
-// by the universal printer to print a value of type T when neither
-// operator<< nor PrintTo() is defined for T, where kTypeKind is the
-// "kind" of T as defined by enum TypeKind.
-template <typename T, TypeKind kTypeKind>
-class TypeWithoutFormatter {
- public:
- // This default version is called when kTypeKind is kOtherType.
- static void PrintValue(const T& value, ::std::ostream* os) {
- PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value),
- sizeof(value), os);
- }
-};
-
-// We print a protobuf using its ShortDebugString() when the string
-// doesn't exceed this many characters; otherwise we print it using
-// DebugString() for better readability.
-const size_t kProtobufOneLinerMaxLength = 50;
-
-template <typename T>
-class TypeWithoutFormatter<T, kProtobuf> {
- public:
- static void PrintValue(const T& value, ::std::ostream* os) {
- const ::testing::internal::string short_str = value.ShortDebugString();
- const ::testing::internal::string pretty_str =
- short_str.length() <= kProtobufOneLinerMaxLength ?
- short_str : ("\n" + value.DebugString());
- *os << ("<" + pretty_str + ">");
- }
-};
-
-template <typename T>
-class TypeWithoutFormatter<T, kConvertibleToInteger> {
- public:
- // Since T has no << operator or PrintTo() but can be implicitly
- // converted to BiggestInt, we print it as a BiggestInt.
- //
- // Most likely T is an enum type (either named or unnamed), in which
- // case printing it as an integer is the desired behavior. In case
- // T is not an enum, printing it as an integer is the best we can do
- // given that it has no user-defined printer.
- static void PrintValue(const T& value, ::std::ostream* os) {
- const internal::BiggestInt kBigInt = value;
- *os << kBigInt;
- }
-};
-
-// Prints the given value to the given ostream. If the value is a
-// protocol message, its debug string is printed; if it's an enum or
-// of a type implicitly convertible to BiggestInt, it's printed as an
-// integer; otherwise the bytes in the value are printed. This is
-// what UniversalPrinter<T>::Print() does when it knows nothing about
-// type T and T has neither << operator nor PrintTo().
-//
-// A user can override this behavior for a class type Foo by defining
-// a << operator in the namespace where Foo is defined.
-//
-// We put this operator in namespace 'internal2' instead of 'internal'
-// to simplify the implementation, as much code in 'internal' needs to
-// use << in STL, which would conflict with our own << were it defined
-// in 'internal'.
-//
-// Note that this operator<< takes a generic std::basic_ostream<Char,
-// CharTraits> type instead of the more restricted std::ostream. If
-// we define it to take an std::ostream instead, we'll get an
-// "ambiguous overloads" compiler error when trying to print a type
-// Foo that supports streaming to std::basic_ostream<Char,
-// CharTraits>, as the compiler cannot tell whether
-// operator<<(std::ostream&, const T&) or
-// operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more
-// specific.
-template <typename Char, typename CharTraits, typename T>
-::std::basic_ostream<Char, CharTraits>& operator<<(
- ::std::basic_ostream<Char, CharTraits>& os, const T& x) {
- TypeWithoutFormatter<T,
- (internal::IsAProtocolMessage<T>::value ? kProtobuf :
- internal::ImplicitlyConvertible<const T&, internal::BiggestInt>::value ?
- kConvertibleToInteger : kOtherType)>::PrintValue(x, &os);
- return os;
-}
-
-} // namespace internal2
-} // namespace testing
-
-// This namespace MUST NOT BE NESTED IN ::testing, or the name look-up
-// magic needed for implementing UniversalPrinter won't work.
-namespace testing_internal {
-
-// Used to print a value that is not an STL-style container when the
-// user doesn't define PrintTo() for it.
-template <typename T>
-void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {
- // With the following statement, during unqualified name lookup,
- // testing::internal2::operator<< appears as if it was declared in
- // the nearest enclosing namespace that contains both
- // ::testing_internal and ::testing::internal2, i.e. the global
- // namespace. For more details, refer to the C++ Standard section
- // 7.3.4-1 [namespace.udir]. This allows us to fall back onto
- // testing::internal2::operator<< in case T doesn't come with a <<
- // operator.
- //
- // We cannot write 'using ::testing::internal2::operator<<;', which
- // gcc 3.3 fails to compile due to a compiler bug.
- using namespace ::testing::internal2; // NOLINT
-
- // Assuming T is defined in namespace foo, in the next statement,
- // the compiler will consider all of:
- //
- // 1. foo::operator<< (thanks to Koenig look-up),
- // 2. ::operator<< (as the current namespace is enclosed in ::),
- // 3. testing::internal2::operator<< (thanks to the using statement above).
- //
- // The operator<< whose type matches T best will be picked.
- //
- // We deliberately allow #2 to be a candidate, as sometimes it's
- // impossible to define #1 (e.g. when foo is ::std, defining
- // anything in it is undefined behavior unless you are a compiler
- // vendor.).
- *os << value;
-}
-
-} // namespace testing_internal
-
-namespace testing {
-namespace internal {
-
-// UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
-// value to the given ostream. The caller must ensure that
-// 'ostream_ptr' is not NULL, or the behavior is undefined.
-//
-// We define UniversalPrinter as a class template (as opposed to a
-// function template), as we need to partially specialize it for
-// reference types, which cannot be done with function templates.
-template <typename T>
-class UniversalPrinter;
-
-template <typename T>
-void UniversalPrint(const T& value, ::std::ostream* os);
-
-// Used to print an STL-style container when the user doesn't define
-// a PrintTo() for it.
-template <typename C>
-void DefaultPrintTo(IsContainer /* dummy */,
- false_type /* is not a pointer */,
- const C& container, ::std::ostream* os) {
- const size_t kMaxCount = 32; // The maximum number of elements to print.
- *os << '{';
- size_t count = 0;
- for (typename C::const_iterator it = container.begin();
- it != container.end(); ++it, ++count) {
- if (count > 0) {
- *os << ',';
- if (count == kMaxCount) { // Enough has been printed.
- *os << " ...";
- break;
- }
- }
- *os << ' ';
- // We cannot call PrintTo(*it, os) here as PrintTo() doesn't
- // handle *it being a native array.
- internal::UniversalPrint(*it, os);
- }
-
- if (count > 0) {
- *os << ' ';
- }
- *os << '}';
-}
-
-// Used to print a pointer that is neither a char pointer nor a member
-// pointer, when the user doesn't define PrintTo() for it. (A member
-// variable pointer or member function pointer doesn't really point to
-// a location in the address space. Their representation is
-// implementation-defined. Therefore they will be printed as raw
-// bytes.)
-template <typename T>
-void DefaultPrintTo(IsNotContainer /* dummy */,
- true_type /* is a pointer */,
- T* p, ::std::ostream* os) {
- if (p == NULL) {
- *os << "NULL";
- } else {
- // C++ doesn't allow casting from a function pointer to any object
- // pointer.
- //
- // IsTrue() silences warnings: "Condition is always true",
- // "unreachable code".
- if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {
- // T is not a function type. We just call << to print p,
- // relying on ADL to pick up user-defined << for their pointer
- // types, if any.
- *os << p;
- } else {
- // T is a function type, so '*os << p' doesn't do what we want
- // (it just prints p as bool). We want to print p as a const
- // void*. However, we cannot cast it to const void* directly,
- // even using reinterpret_cast, as earlier versions of gcc
- // (e.g. 3.4.5) cannot compile the cast when p is a function
- // pointer. Casting to UInt64 first solves the problem.
- *os << reinterpret_cast<const void*>(
- reinterpret_cast<internal::UInt64>(p));
- }
- }
-}
-
-// Used to print a non-container, non-pointer value when the user
-// doesn't define PrintTo() for it.
-template <typename T>
-void DefaultPrintTo(IsNotContainer /* dummy */,
- false_type /* is not a pointer */,
- const T& value, ::std::ostream* os) {
- ::testing_internal::DefaultPrintNonContainerTo(value, os);
-}
-
-// Prints the given value using the << operator if it has one;
-// otherwise prints the bytes in it. This is what
-// UniversalPrinter<T>::Print() does when PrintTo() is not specialized
-// or overloaded for type T.
-//
-// A user can override this behavior for a class type Foo by defining
-// an overload of PrintTo() in the namespace where Foo is defined. We
-// give the user this option as sometimes defining a << operator for
-// Foo is not desirable (e.g. the coding style may prevent doing it,
-// or there is already a << operator but it doesn't do what the user
-// wants).
-template <typename T>
-void PrintTo(const T& value, ::std::ostream* os) {
- // DefaultPrintTo() is overloaded. The type of its first two
- // arguments determine which version will be picked. If T is an
- // STL-style container, the version for container will be called; if
- // T is a pointer, the pointer version will be called; otherwise the
- // generic version will be called.
- //
- // Note that we check for container types here, prior to we check
- // for protocol message types in our operator<<. The rationale is:
- //
- // For protocol messages, we want to give people a chance to
- // override Google Mock's format by defining a PrintTo() or
- // operator<<. For STL containers, other formats can be
- // incompatible with Google Mock's format for the container
- // elements; therefore we check for container types here to ensure
- // that our format is used.
- //
- // The second argument of DefaultPrintTo() is needed to bypass a bug
- // in Symbian's C++ compiler that prevents it from picking the right
- // overload between:
- //
- // PrintTo(const T& x, ...);
- // PrintTo(T* x, ...);
- DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os);
-}
-
-// The following list of PrintTo() overloads tells
-// UniversalPrinter<T>::Print() how to print standard types (built-in
-// types, strings, plain arrays, and pointers).
-
-// Overloads for various char types.
-GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os);
-GTEST_API_ void PrintTo(signed char c, ::std::ostream* os);
-inline void PrintTo(char c, ::std::ostream* os) {
- // When printing a plain char, we always treat it as unsigned. This
- // way, the output won't be affected by whether the compiler thinks
- // char is signed or not.
- PrintTo(static_cast<unsigned char>(c), os);
-}
-
-// Overloads for other simple built-in types.
-inline void PrintTo(bool x, ::std::ostream* os) {
- *os << (x ? "true" : "false");
-}
-
-// Overload for wchar_t type.
-// Prints a wchar_t as a symbol if it is printable or as its internal
-// code otherwise and also as its decimal code (except for L'\0').
-// The L'\0' char is printed as "L'\\0'". The decimal code is printed
-// as signed integer when wchar_t is implemented by the compiler
-// as a signed type and is printed as an unsigned integer when wchar_t
-// is implemented as an unsigned type.
-GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);
-
-// Overloads for C strings.
-GTEST_API_ void PrintTo(const char* s, ::std::ostream* os);
-inline void PrintTo(char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const char*>(s), os);
-}
-
-// signed/unsigned char is often used for representing binary data, so
-// we print pointers to it as void* to be safe.
-inline void PrintTo(const signed char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-inline void PrintTo(signed char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-inline void PrintTo(unsigned char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-
-// MSVC can be configured to define wchar_t as a typedef of unsigned
-// short. It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native
-// type. When wchar_t is a typedef, defining an overload for const
-// wchar_t* would cause unsigned short* be printed as a wide string,
-// possibly causing invalid memory accesses.
-#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
-// Overloads for wide C strings
-GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os);
-inline void PrintTo(wchar_t* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const wchar_t*>(s), os);
-}
-#endif
-
-// Overload for C arrays. Multi-dimensional arrays are printed
-// properly.
-
-// Prints the given number of elements in an array, without printing
-// the curly braces.
-template <typename T>
-void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
- UniversalPrint(a[0], os);
- for (size_t i = 1; i != count; i++) {
- *os << ", ";
- UniversalPrint(a[i], os);
- }
-}
-
-// Overloads for ::string and ::std::string.
-#if GTEST_HAS_GLOBAL_STRING
-GTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os);
-inline void PrintTo(const ::string& s, ::std::ostream* os) {
- PrintStringTo(s, os);
-}
-#endif // GTEST_HAS_GLOBAL_STRING
-
-GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);
-inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
- PrintStringTo(s, os);
-}
-
-// Overloads for ::wstring and ::std::wstring.
-#if GTEST_HAS_GLOBAL_WSTRING
-GTEST_API_ void PrintWideStringTo(const ::wstring&s, ::std::ostream* os);
-inline void PrintTo(const ::wstring& s, ::std::ostream* os) {
- PrintWideStringTo(s, os);
-}
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-#if GTEST_HAS_STD_WSTRING
-GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);
-inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
- PrintWideStringTo(s, os);
-}
-#endif // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
-// Helper function for printing a tuple. T must be instantiated with
-// a tuple type.
-template <typename T>
-void PrintTupleTo(const T& t, ::std::ostream* os);
-#endif // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
-
-#if GTEST_HAS_TR1_TUPLE
-// Overload for ::std::tr1::tuple. Needed for printing function arguments,
-// which are packed as tuples.
-
-// Overloaded PrintTo() for tuples of various arities. We support
-// tuples of up-to 10 fields. The following implementation works
-// regardless of whether tr1::tuple is implemented using the
-// non-standard variadic template feature or not.
-
-inline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1>
-void PrintTo(const ::std::tr1::tuple<T1>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2>
-void PrintTo(const ::std::tr1::tuple<T1, T2>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-void PrintTo(
- const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-#endif // GTEST_HAS_TR1_TUPLE
-
-#if GTEST_HAS_STD_TUPLE_
-template <typename... Types>
-void PrintTo(const ::std::tuple<Types...>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-#endif // GTEST_HAS_STD_TUPLE_
-
-// Overload for std::pair.
-template <typename T1, typename T2>
-void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
- *os << '(';
- // We cannot use UniversalPrint(value.first, os) here, as T1 may be
- // a reference type. The same for printing value.second.
- UniversalPrinter<T1>::Print(value.first, os);
- *os << ", ";
- UniversalPrinter<T2>::Print(value.second, os);
- *os << ')';
-}
-
-// Implements printing a non-reference type T by letting the compiler
-// pick the right overload of PrintTo() for T.
-template <typename T>
-class UniversalPrinter {
- public:
- // MSVC warns about adding const to a function type, so we want to
- // disable the warning.
- GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180)
-
- // Note: we deliberately don't call this PrintTo(), as that name
- // conflicts with ::testing::internal::PrintTo in the body of the
- // function.
- static void Print(const T& value, ::std::ostream* os) {
- // By default, ::testing::internal::PrintTo() is used for printing
- // the value.
- //
- // Thanks to Koenig look-up, if T is a class and has its own
- // PrintTo() function defined in its namespace, that function will
- // be visible here. Since it is more specific than the generic ones
- // in ::testing::internal, it will be picked by the compiler in the
- // following statement - exactly what we want.
- PrintTo(value, os);
- }
-
- GTEST_DISABLE_MSC_WARNINGS_POP_()
-};
-
-// UniversalPrintArray(begin, len, os) prints an array of 'len'
-// elements, starting at address 'begin'.
-template <typename T>
-void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
- if (len == 0) {
- *os << "{}";
- } else {
- *os << "{ ";
- const size_t kThreshold = 18;
- const size_t kChunkSize = 8;
- // If the array has more than kThreshold elements, we'll have to
- // omit some details by printing only the first and the last
- // kChunkSize elements.
- // TODO(wan@google.com): let the user control the threshold using a flag.
- if (len <= kThreshold) {
- PrintRawArrayTo(begin, len, os);
- } else {
- PrintRawArrayTo(begin, kChunkSize, os);
- *os << ", ..., ";
- PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
- }
- *os << " }";
- }
-}
-// This overload prints a (const) char array compactly.
-GTEST_API_ void UniversalPrintArray(
- const char* begin, size_t len, ::std::ostream* os);
-
-// This overload prints a (const) wchar_t array compactly.
-GTEST_API_ void UniversalPrintArray(
- const wchar_t* begin, size_t len, ::std::ostream* os);
-
-// Implements printing an array type T[N].
-template <typename T, size_t N>
-class UniversalPrinter<T[N]> {
- public:
- // Prints the given array, omitting some elements when there are too
- // many.
- static void Print(const T (&a)[N], ::std::ostream* os) {
- UniversalPrintArray(a, N, os);
- }
-};
-
-// Implements printing a reference type T&.
-template <typename T>
-class UniversalPrinter<T&> {
- public:
- // MSVC warns about adding const to a function type, so we want to
- // disable the warning.
- GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180)
-
- static void Print(const T& value, ::std::ostream* os) {
- // Prints the address of the value. We use reinterpret_cast here
- // as static_cast doesn't compile when T is a function type.
- *os << "@" << reinterpret_cast<const void*>(&value) << " ";
-
- // Then prints the value itself.
- UniversalPrint(value, os);
- }
-
- GTEST_DISABLE_MSC_WARNINGS_POP_()
-};
-
-// Prints a value tersely: for a reference type, the referenced value
-// (but not the address) is printed; for a (const) char pointer, the
-// NUL-terminated string (but not the pointer) is printed.
-
-template <typename T>
-class UniversalTersePrinter {
- public:
- static void Print(const T& value, ::std::ostream* os) {
- UniversalPrint(value, os);
- }
-};
-template <typename T>
-class UniversalTersePrinter<T&> {
- public:
- static void Print(const T& value, ::std::ostream* os) {
- UniversalPrint(value, os);
- }
-};
-template <typename T, size_t N>
-class UniversalTersePrinter<T[N]> {
- public:
- static void Print(const T (&value)[N], ::std::ostream* os) {
- UniversalPrinter<T[N]>::Print(value, os);
- }
-};
-template <>
-class UniversalTersePrinter<const char*> {
- public:
- static void Print(const char* str, ::std::ostream* os) {
- if (str == NULL) {
- *os << "NULL";
- } else {
- UniversalPrint(string(str), os);
- }
- }
-};
-template <>
-class UniversalTersePrinter<char*> {
- public:
- static void Print(char* str, ::std::ostream* os) {
- UniversalTersePrinter<const char*>::Print(str, os);
- }
-};
-
-#if GTEST_HAS_STD_WSTRING
-template <>
-class UniversalTersePrinter<const wchar_t*> {
- public:
- static void Print(const wchar_t* str, ::std::ostream* os) {
- if (str == NULL) {
- *os << "NULL";
- } else {
- UniversalPrint(::std::wstring(str), os);
- }
- }
-};
-#endif
-
-template <>
-class UniversalTersePrinter<wchar_t*> {
- public:
- static void Print(wchar_t* str, ::std::ostream* os) {
- UniversalTersePrinter<const wchar_t*>::Print(str, os);
- }
-};
-
-template <typename T>
-void UniversalTersePrint(const T& value, ::std::ostream* os) {
- UniversalTersePrinter<T>::Print(value, os);
-}
-
-// Prints a value using the type inferred by the compiler. The
-// difference between this and UniversalTersePrint() is that for a
-// (const) char pointer, this prints both the pointer and the
-// NUL-terminated string.
-template <typename T>
-void UniversalPrint(const T& value, ::std::ostream* os) {
- // A workarond for the bug in VC++ 7.1 that prevents us from instantiating
- // UniversalPrinter with T directly.
- typedef T T1;
- UniversalPrinter<T1>::Print(value, os);
-}
-
-typedef ::std::vector<string> Strings;
-
-// TuplePolicy<TupleT> must provide:
-// - tuple_size
-// size of tuple TupleT.
-// - get<size_t I>(const TupleT& t)
-// static function extracting element I of tuple TupleT.
-// - tuple_element<size_t I>::type
-// type of element I of tuple TupleT.
-template <typename TupleT>
-struct TuplePolicy;
-
-#if GTEST_HAS_TR1_TUPLE
-template <typename TupleT>
-struct TuplePolicy {
- typedef TupleT Tuple;
- static const size_t tuple_size = ::std::tr1::tuple_size<Tuple>::value;
-
- template <size_t I>
- struct tuple_element : ::std::tr1::tuple_element<I, Tuple> {};
-
- template <size_t I>
- static typename AddReference<
- const typename ::std::tr1::tuple_element<I, Tuple>::type>::type get(
- const Tuple& tuple) {
- return ::std::tr1::get<I>(tuple);
- }
-};
-template <typename TupleT>
-const size_t TuplePolicy<TupleT>::tuple_size;
-#endif // GTEST_HAS_TR1_TUPLE
-
-#if GTEST_HAS_STD_TUPLE_
-template <typename... Types>
-struct TuplePolicy< ::std::tuple<Types...> > {
- typedef ::std::tuple<Types...> Tuple;
- static const size_t tuple_size = ::std::tuple_size<Tuple>::value;
-
- template <size_t I>
- struct tuple_element : ::std::tuple_element<I, Tuple> {};
-
- template <size_t I>
- static const typename ::std::tuple_element<I, Tuple>::type& get(
- const Tuple& tuple) {
- return ::std::get<I>(tuple);
- }
-};
-template <typename... Types>
-const size_t TuplePolicy< ::std::tuple<Types...> >::tuple_size;
-#endif // GTEST_HAS_STD_TUPLE_
-
-#if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
-// This helper template allows PrintTo() for tuples and
-// UniversalTersePrintTupleFieldsToStrings() to be defined by
-// induction on the number of tuple fields. The idea is that
-// TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N
-// fields in tuple t, and can be defined in terms of
-// TuplePrefixPrinter<N - 1>.
-//
-// The inductive case.
-template <size_t N>
-struct TuplePrefixPrinter {
- // Prints the first N fields of a tuple.
- template <typename Tuple>
- static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
- TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os);
- GTEST_INTENTIONAL_CONST_COND_PUSH_()
- if (N > 1) {
- GTEST_INTENTIONAL_CONST_COND_POP_()
- *os << ", ";
- }
- UniversalPrinter<
- typename TuplePolicy<Tuple>::template tuple_element<N - 1>::type>
- ::Print(TuplePolicy<Tuple>::template get<N - 1>(t), os);
- }
-
- // Tersely prints the first N fields of a tuple to a string vector,
- // one element for each field.
- template <typename Tuple>
- static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
- TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings);
- ::std::stringstream ss;
- UniversalTersePrint(TuplePolicy<Tuple>::template get<N - 1>(t), &ss);
- strings->push_back(ss.str());
- }
-};
-
-// Base case.
-template <>
-struct TuplePrefixPrinter<0> {
- template <typename Tuple>
- static void PrintPrefixTo(const Tuple&, ::std::ostream*) {}
-
- template <typename Tuple>
- static void TersePrintPrefixToStrings(const Tuple&, Strings*) {}
-};
-
-// Helper function for printing a tuple.
-// Tuple must be either std::tr1::tuple or std::tuple type.
-template <typename Tuple>
-void PrintTupleTo(const Tuple& t, ::std::ostream* os) {
- *os << "(";
- TuplePrefixPrinter<TuplePolicy<Tuple>::tuple_size>::PrintPrefixTo(t, os);
- *os << ")";
-}
-
-// Prints the fields of a tuple tersely to a string vector, one
-// element for each field. See the comment before
-// UniversalTersePrint() for how we define "tersely".
-template <typename Tuple>
-Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
- Strings result;
- TuplePrefixPrinter<TuplePolicy<Tuple>::tuple_size>::
- TersePrintPrefixToStrings(value, &result);
- return result;
-}
-#endif // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
-
-} // namespace internal
-
-template <typename T>
-::std::string PrintToString(const T& value) {
- ::std::stringstream ss;
- internal::UniversalTersePrinter<T>::Print(value, &ss);
- return ss.str();
-}
-
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-spi.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-spi.h
deleted file mode 100644
index f63fa9a..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-spi.h
+++ /dev/null
@@ -1,232 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// Utilities for testing Google Test itself and code that uses Google Test
-// (e.g. frameworks built on top of Google Test).
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_
-#define GTEST_INCLUDE_GTEST_GTEST_SPI_H_
-
-#include "gtest/gtest.h"
-
-namespace testing {
-
-// This helper class can be used to mock out Google Test failure reporting
-// so that we can test Google Test or code that builds on Google Test.
-//
-// An object of this class appends a TestPartResult object to the
-// TestPartResultArray object given in the constructor whenever a Google Test
-// failure is reported. It can either intercept only failures that are
-// generated in the same thread that created this object or it can intercept
-// all generated failures. The scope of this mock object can be controlled with
-// the second argument to the two arguments constructor.
-class GTEST_API_ ScopedFakeTestPartResultReporter
- : public TestPartResultReporterInterface {
- public:
- // The two possible mocking modes of this object.
- enum InterceptMode {
- INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures.
- INTERCEPT_ALL_THREADS // Intercepts all failures.
- };
-
- // The c'tor sets this object as the test part result reporter used
- // by Google Test. The 'result' parameter specifies where to report the
- // results. This reporter will only catch failures generated in the current
- // thread. DEPRECATED
- explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
-
- // Same as above, but you can choose the interception scope of this object.
- ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,
- TestPartResultArray* result);
-
- // The d'tor restores the previous test part result reporter.
- virtual ~ScopedFakeTestPartResultReporter();
-
- // Appends the TestPartResult object to the TestPartResultArray
- // received in the constructor.
- //
- // This method is from the TestPartResultReporterInterface
- // interface.
- virtual void ReportTestPartResult(const TestPartResult& result);
- private:
- void Init();
-
- const InterceptMode intercept_mode_;
- TestPartResultReporterInterface* old_reporter_;
- TestPartResultArray* const result_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
-};
-
-namespace internal {
-
-// A helper class for implementing EXPECT_FATAL_FAILURE() and
-// EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given
-// TestPartResultArray contains exactly one failure that has the given
-// type and contains the given substring. If that's not the case, a
-// non-fatal failure will be generated.
-class GTEST_API_ SingleFailureChecker {
- public:
- // The constructor remembers the arguments.
- SingleFailureChecker(const TestPartResultArray* results,
- TestPartResult::Type type,
- const string& substr);
- ~SingleFailureChecker();
- private:
- const TestPartResultArray* const results_;
- const TestPartResult::Type type_;
- const string substr_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
-};
-
-} // namespace internal
-
-} // namespace testing
-
-// A set of macros for testing Google Test assertions or code that's expected
-// to generate Google Test fatal failures. It verifies that the given
-// statement will cause exactly one fatal Google Test failure with 'substr'
-// being part of the failure message.
-//
-// There are two different versions of this macro. EXPECT_FATAL_FAILURE only
-// affects and considers failures generated in the current thread and
-// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
-//
-// The verification of the assertion is done correctly even when the statement
-// throws an exception or aborts the current function.
-//
-// Known restrictions:
-// - 'statement' cannot reference local non-static variables or
-// non-static members of the current object.
-// - 'statement' cannot return a value.
-// - You cannot stream a failure message to this macro.
-//
-// Note that even though the implementations of the following two
-// macros are much alike, we cannot refactor them to use a common
-// helper macro, due to some peculiarity in how the preprocessor
-// works. The AcceptsMacroThatExpandsToUnprotectedComma test in
-// gtest_unittest.cc will fail to compile if we do that.
-#define EXPECT_FATAL_FAILURE(statement, substr) \
- do { \
- class GTestExpectFatalFailureHelper {\
- public:\
- static void Execute() { statement; }\
- };\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter:: \
- INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
- GTestExpectFatalFailureHelper::Execute();\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
- do { \
- class GTestExpectFatalFailureHelper {\
- public:\
- static void Execute() { statement; }\
- };\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter:: \
- INTERCEPT_ALL_THREADS, >est_failures);\
- GTestExpectFatalFailureHelper::Execute();\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-// A macro for testing Google Test assertions or code that's expected to
-// generate Google Test non-fatal failures. It asserts that the given
-// statement will cause exactly one non-fatal Google Test failure with 'substr'
-// being part of the failure message.
-//
-// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
-// affects and considers failures generated in the current thread and
-// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
-//
-// 'statement' is allowed to reference local variables and members of
-// the current object.
-//
-// The verification of the assertion is done correctly even when the statement
-// throws an exception or aborts the current function.
-//
-// Known restrictions:
-// - You cannot stream a failure message to this macro.
-//
-// Note that even though the implementations of the following two
-// macros are much alike, we cannot refactor them to use a common
-// helper macro, due to some peculiarity in how the preprocessor
-// works. If we do that, the code won't compile when the user gives
-// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that
-// expands to code containing an unprotected comma. The
-// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc
-// catches that.
-//
-// For the same reason, we have to write
-// if (::testing::internal::AlwaysTrue()) { statement; }
-// instead of
-// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
-// to avoid an MSVC warning on unreachable code.
-#define EXPECT_NONFATAL_FAILURE(statement, substr) \
- do {\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- >est_failures, ::testing::TestPartResult::kNonFatalFailure, \
- (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter:: \
- INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
- if (::testing::internal::AlwaysTrue()) { statement; }\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
- do {\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- >est_failures, ::testing::TestPartResult::kNonFatalFailure, \
- (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
- >est_failures);\
- if (::testing::internal::AlwaysTrue()) { statement; }\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-test-part.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-test-part.h
deleted file mode 100644
index 77eb844..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-test-part.h
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: mheule@google.com (Markus Heule)
-//
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
-#define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
-
-#include <iosfwd>
-#include <vector>
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-string.h"
-
-namespace testing {
-
-// A copyable object representing the result of a test part (i.e. an
-// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
-//
-// Don't inherit from TestPartResult as its destructor is not virtual.
-class GTEST_API_ TestPartResult {
- public:
- // The possible outcomes of a test part (i.e. an assertion or an
- // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
- enum Type {
- kSuccess, // Succeeded.
- kNonFatalFailure, // Failed but the test can continue.
- kFatalFailure // Failed and the test should be terminated.
- };
-
- // C'tor. TestPartResult does NOT have a default constructor.
- // Always use this constructor (with parameters) to create a
- // TestPartResult object.
- TestPartResult(Type a_type,
- const char* a_file_name,
- int a_line_number,
- const char* a_message)
- : type_(a_type),
- file_name_(a_file_name == NULL ? "" : a_file_name),
- line_number_(a_line_number),
- summary_(ExtractSummary(a_message)),
- message_(a_message) {
- }
-
- // Gets the outcome of the test part.
- Type type() const { return type_; }
-
- // Gets the name of the source file where the test part took place, or
- // NULL if it's unknown.
- const char* file_name() const {
- return file_name_.empty() ? NULL : file_name_.c_str();
- }
-
- // Gets the line in the source file where the test part took place,
- // or -1 if it's unknown.
- int line_number() const { return line_number_; }
-
- // Gets the summary of the failure message.
- const char* summary() const { return summary_.c_str(); }
-
- // Gets the message associated with the test part.
- const char* message() const { return message_.c_str(); }
-
- // Returns true iff the test part passed.
- bool passed() const { return type_ == kSuccess; }
-
- // Returns true iff the test part failed.
- bool failed() const { return type_ != kSuccess; }
-
- // Returns true iff the test part non-fatally failed.
- bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
-
- // Returns true iff the test part fatally failed.
- bool fatally_failed() const { return type_ == kFatalFailure; }
-
- private:
- Type type_;
-
- // Gets the summary of the failure message by omitting the stack
- // trace in it.
- static std::string ExtractSummary(const char* message);
-
- // The name of the source file where the test part took place, or
- // "" if the source file is unknown.
- std::string file_name_;
- // The line in the source file where the test part took place, or -1
- // if the line number is unknown.
- int line_number_;
- std::string summary_; // The test failure summary.
- std::string message_; // The test failure message.
-};
-
-// Prints a TestPartResult object.
-std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
-
-// An array of TestPartResult objects.
-//
-// Don't inherit from TestPartResultArray as its destructor is not
-// virtual.
-class GTEST_API_ TestPartResultArray {
- public:
- TestPartResultArray() {}
-
- // Appends the given TestPartResult to the array.
- void Append(const TestPartResult& result);
-
- // Returns the TestPartResult at the given index (0-based).
- const TestPartResult& GetTestPartResult(int index) const;
-
- // Returns the number of TestPartResult objects in the array.
- int size() const;
-
- private:
- std::vector<TestPartResult> array_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
-};
-
-// This interface knows how to report a test part result.
-class TestPartResultReporterInterface {
- public:
- virtual ~TestPartResultReporterInterface() {}
-
- virtual void ReportTestPartResult(const TestPartResult& result) = 0;
-};
-
-namespace internal {
-
-// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
-// statement generates new fatal failures. To do so it registers itself as the
-// current test part result reporter. Besides checking if fatal failures were
-// reported, it only delegates the reporting to the former result reporter.
-// The original result reporter is restored in the destructor.
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-class GTEST_API_ HasNewFatalFailureHelper
- : public TestPartResultReporterInterface {
- public:
- HasNewFatalFailureHelper();
- virtual ~HasNewFatalFailureHelper();
- virtual void ReportTestPartResult(const TestPartResult& result);
- bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
- private:
- bool has_new_fatal_failure_;
- TestPartResultReporterInterface* original_reporter_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
-};
-
-} // namespace internal
-
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-typed-test.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-typed-test.h
deleted file mode 100644
index fe1e83b..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest-typed-test.h
+++ /dev/null
@@ -1,259 +0,0 @@
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
-
-// This header implements typed tests and type-parameterized tests.
-
-// Typed (aka type-driven) tests repeat the same test for types in a
-// list. You must know which types you want to test with when writing
-// typed tests. Here's how you do it:
-
-#if 0
-
-// First, define a fixture class template. It should be parameterized
-// by a type. Remember to derive it from testing::Test.
-template <typename T>
-class FooTest : public testing::Test {
- public:
- ...
- typedef std::list<T> List;
- static T shared_;
- T value_;
-};
-
-// Next, associate a list of types with the test case, which will be
-// repeated for each type in the list. The typedef is necessary for
-// the macro to parse correctly.
-typedef testing::Types<char, int, unsigned int> MyTypes;
-TYPED_TEST_CASE(FooTest, MyTypes);
-
-// If the type list contains only one type, you can write that type
-// directly without Types<...>:
-// TYPED_TEST_CASE(FooTest, int);
-
-// Then, use TYPED_TEST() instead of TEST_F() to define as many typed
-// tests for this test case as you want.
-TYPED_TEST(FooTest, DoesBlah) {
- // Inside a test, refer to TypeParam to get the type parameter.
- // Since we are inside a derived class template, C++ requires use to
- // visit the members of FooTest via 'this'.
- TypeParam n = this->value_;
-
- // To visit static members of the fixture, add the TestFixture::
- // prefix.
- n += TestFixture::shared_;
-
- // To refer to typedefs in the fixture, add the "typename
- // TestFixture::" prefix.
- typename TestFixture::List values;
- values.push_back(n);
- ...
-}
-
-TYPED_TEST(FooTest, HasPropertyA) { ... }
-
-#endif // 0
-
-// Type-parameterized tests are abstract test patterns parameterized
-// by a type. Compared with typed tests, type-parameterized tests
-// allow you to define the test pattern without knowing what the type
-// parameters are. The defined pattern can be instantiated with
-// different types any number of times, in any number of translation
-// units.
-//
-// If you are designing an interface or concept, you can define a
-// suite of type-parameterized tests to verify properties that any
-// valid implementation of the interface/concept should have. Then,
-// each implementation can easily instantiate the test suite to verify
-// that it conforms to the requirements, without having to write
-// similar tests repeatedly. Here's an example:
-
-#if 0
-
-// First, define a fixture class template. It should be parameterized
-// by a type. Remember to derive it from testing::Test.
-template <typename T>
-class FooTest : public testing::Test {
- ...
-};
-
-// Next, declare that you will define a type-parameterized test case
-// (the _P suffix is for "parameterized" or "pattern", whichever you
-// prefer):
-TYPED_TEST_CASE_P(FooTest);
-
-// Then, use TYPED_TEST_P() to define as many type-parameterized tests
-// for this type-parameterized test case as you want.
-TYPED_TEST_P(FooTest, DoesBlah) {
- // Inside a test, refer to TypeParam to get the type parameter.
- TypeParam n = 0;
- ...
-}
-
-TYPED_TEST_P(FooTest, HasPropertyA) { ... }
-
-// Now the tricky part: you need to register all test patterns before
-// you can instantiate them. The first argument of the macro is the
-// test case name; the rest are the names of the tests in this test
-// case.
-REGISTER_TYPED_TEST_CASE_P(FooTest,
- DoesBlah, HasPropertyA);
-
-// Finally, you are free to instantiate the pattern with the types you
-// want. If you put the above code in a header file, you can #include
-// it in multiple C++ source files and instantiate it multiple times.
-//
-// To distinguish different instances of the pattern, the first
-// argument to the INSTANTIATE_* macro is a prefix that will be added
-// to the actual test case name. Remember to pick unique prefixes for
-// different instances.
-typedef testing::Types<char, int, unsigned int> MyTypes;
-INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
-
-// If the type list contains only one type, you can write that type
-// directly without Types<...>:
-// INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
-
-#endif // 0
-
-#include "gtest/internal/gtest-port.h"
-#include "gtest/internal/gtest-type-util.h"
-
-// Implements typed tests.
-
-#if GTEST_HAS_TYPED_TEST
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the name of the typedef for the type parameters of the
-// given test case.
-# define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
-
-// The 'Types' template argument below must have spaces around it
-// since some compilers may choke on '>>' when passing a template
-// instance (e.g. Types<int>)
-# define TYPED_TEST_CASE(CaseName, Types) \
- typedef ::testing::internal::TypeList< Types >::type \
- GTEST_TYPE_PARAMS_(CaseName)
-
-# define TYPED_TEST(CaseName, TestName) \
- template <typename gtest_TypeParam_> \
- class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
- : public CaseName<gtest_TypeParam_> { \
- private: \
- typedef CaseName<gtest_TypeParam_> TestFixture; \
- typedef gtest_TypeParam_ TypeParam; \
- virtual void TestBody(); \
- }; \
- bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \
- ::testing::internal::TypeParameterizedTest< \
- CaseName, \
- ::testing::internal::TemplateSel< \
- GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \
- GTEST_TYPE_PARAMS_(CaseName)>::Register(\
- "", #CaseName, #TestName, 0); \
- template <typename gtest_TypeParam_> \
- void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody()
-
-#endif // GTEST_HAS_TYPED_TEST
-
-// Implements type-parameterized tests.
-
-#if GTEST_HAS_TYPED_TEST_P
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the namespace name that the type-parameterized tests for
-// the given type-parameterized test case are defined in. The exact
-// name of the namespace is subject to change without notice.
-# define GTEST_CASE_NAMESPACE_(TestCaseName) \
- gtest_case_##TestCaseName##_
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the name of the variable used to remember the names of
-// the defined tests in the given test case.
-# define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
- gtest_typed_test_case_p_state_##TestCaseName##_
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
-//
-// Expands to the name of the variable used to remember the names of
-// the registered tests in the given test case.
-# define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
- gtest_registered_test_names_##TestCaseName##_
-
-// The variables defined in the type-parameterized test macros are
-// static as typically these macros are used in a .h file that can be
-// #included in multiple translation units linked together.
-# define TYPED_TEST_CASE_P(CaseName) \
- static ::testing::internal::TypedTestCasePState \
- GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
-
-# define TYPED_TEST_P(CaseName, TestName) \
- namespace GTEST_CASE_NAMESPACE_(CaseName) { \
- template <typename gtest_TypeParam_> \
- class TestName : public CaseName<gtest_TypeParam_> { \
- private: \
- typedef CaseName<gtest_TypeParam_> TestFixture; \
- typedef gtest_TypeParam_ TypeParam; \
- virtual void TestBody(); \
- }; \
- static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
- GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\
- __FILE__, __LINE__, #CaseName, #TestName); \
- } \
- template <typename gtest_TypeParam_> \
- void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
-
-# define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
- namespace GTEST_CASE_NAMESPACE_(CaseName) { \
- typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
- } \
- static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \
- GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
- __FILE__, __LINE__, #__VA_ARGS__)
-
-// The 'Types' template argument below must have spaces around it
-// since some compilers may choke on '>>' when passing a template
-// instance (e.g. Types<int>)
-# define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
- bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \
- ::testing::internal::TypeParameterizedTestCase<CaseName, \
- GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
- ::testing::internal::TypeList< Types >::type>::Register(\
- #Prefix, #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))
-
-#endif // GTEST_HAS_TYPED_TEST_P
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest.h
deleted file mode 100644
index a19b3db..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest.h
+++ /dev/null
@@ -1,2307 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the public API for Google Test. It should be
-// included by any test program that uses Google Test.
-//
-// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
-// leave some internal implementation details in this header file.
-// They are clearly marked by comments like this:
-//
-// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-//
-// Such code is NOT meant to be used by a user directly, and is subject
-// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
-// program!
-//
-// Acknowledgment: Google Test borrowed the idea of automatic test
-// registration from Barthelemy Dagenais' (barthelemy@prologique.com)
-// easyUnit framework.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_H_
-
-#include <limits>
-#include <ostream>
-#include <vector>
-
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-string.h"
-#include "gtest/gtest-death-test.h"
-#include "gtest/gtest-message.h"
-#include "gtest/gtest-param-test.h"
-#include "gtest/gtest-printers.h"
-#include "gtest/gtest_prod.h"
-#include "gtest/gtest-test-part.h"
-#include "gtest/gtest-typed-test.h"
-
-// Depending on the platform, different string classes are available.
-// On Linux, in addition to ::std::string, Google also makes use of
-// class ::string, which has the same interface as ::std::string, but
-// has a different implementation.
-//
-// The user can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that
-// ::string is available AND is a distinct type to ::std::string, or
-// define it to 0 to indicate otherwise.
-//
-// If the user's ::std::string and ::string are the same class due to
-// aliasing, he should define GTEST_HAS_GLOBAL_STRING to 0.
-//
-// If the user doesn't define GTEST_HAS_GLOBAL_STRING, it is defined
-// heuristically.
-
-namespace testing {
-
-// Declares the flags.
-
-// This flag temporary enables the disabled tests.
-GTEST_DECLARE_bool_(also_run_disabled_tests);
-
-// This flag brings the debugger on an assertion failure.
-GTEST_DECLARE_bool_(break_on_failure);
-
-// This flag controls whether Google Test catches all test-thrown exceptions
-// and logs them as failures.
-GTEST_DECLARE_bool_(catch_exceptions);
-
-// This flag enables using colors in terminal output. Available values are
-// "yes" to enable colors, "no" (disable colors), or "auto" (the default)
-// to let Google Test decide.
-GTEST_DECLARE_string_(color);
-
-// This flag sets up the filter to select by name using a glob pattern
-// the tests to run. If the filter is not given all tests are executed.
-GTEST_DECLARE_string_(filter);
-
-// This flag causes the Google Test to list tests. None of the tests listed
-// are actually run if the flag is provided.
-GTEST_DECLARE_bool_(list_tests);
-
-// This flag controls whether Google Test emits a detailed XML report to a file
-// in addition to its normal textual output.
-GTEST_DECLARE_string_(output);
-
-// This flags control whether Google Test prints the elapsed time for each
-// test.
-GTEST_DECLARE_bool_(print_time);
-
-// This flag specifies the random number seed.
-GTEST_DECLARE_int32_(random_seed);
-
-// This flag sets how many times the tests are repeated. The default value
-// is 1. If the value is -1 the tests are repeating forever.
-GTEST_DECLARE_int32_(repeat);
-
-// This flag controls whether Google Test includes Google Test internal
-// stack frames in failure stack traces.
-GTEST_DECLARE_bool_(show_internal_stack_frames);
-
-// When this flag is specified, tests' order is randomized on every iteration.
-GTEST_DECLARE_bool_(shuffle);
-
-// This flag specifies the maximum number of stack frames to be
-// printed in a failure message.
-GTEST_DECLARE_int32_(stack_trace_depth);
-
-// When this flag is specified, a failed assertion will throw an
-// exception if exceptions are enabled, or exit the program with a
-// non-zero code otherwise.
-GTEST_DECLARE_bool_(throw_on_failure);
-
-// When this flag is set with a "host:port" string, on supported
-// platforms test results are streamed to the specified port on
-// the specified host machine.
-GTEST_DECLARE_string_(stream_result_to);
-
-// The upper limit for valid stack trace depths.
-const int kMaxStackTraceDepth = 100;
-
-namespace internal {
-
-class AssertHelper;
-class DefaultGlobalTestPartResultReporter;
-class ExecDeathTest;
-class NoExecDeathTest;
-class FinalSuccessChecker;
-class GTestFlagSaver;
-class StreamingListenerTest;
-class TestResultAccessor;
-class TestEventListenersAccessor;
-class TestEventRepeater;
-class UnitTestRecordPropertyTestHelper;
-class WindowsDeathTest;
-class UnitTestImpl* GetUnitTestImpl();
-void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
- const std::string& message);
-
-} // namespace internal
-
-// The friend relationship of some of these classes is cyclic.
-// If we don't forward declare them the compiler might confuse the classes
-// in friendship clauses with same named classes on the scope.
-class Test;
-class TestCase;
-class TestInfo;
-class UnitTest;
-
-// A class for indicating whether an assertion was successful. When
-// the assertion wasn't successful, the AssertionResult object
-// remembers a non-empty message that describes how it failed.
-//
-// To create an instance of this class, use one of the factory functions
-// (AssertionSuccess() and AssertionFailure()).
-//
-// This class is useful for two purposes:
-// 1. Defining predicate functions to be used with Boolean test assertions
-// EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
-// 2. Defining predicate-format functions to be
-// used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
-//
-// For example, if you define IsEven predicate:
-//
-// testing::AssertionResult IsEven(int n) {
-// if ((n % 2) == 0)
-// return testing::AssertionSuccess();
-// else
-// return testing::AssertionFailure() << n << " is odd";
-// }
-//
-// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
-// will print the message
-//
-// Value of: IsEven(Fib(5))
-// Actual: false (5 is odd)
-// Expected: true
-//
-// instead of a more opaque
-//
-// Value of: IsEven(Fib(5))
-// Actual: false
-// Expected: true
-//
-// in case IsEven is a simple Boolean predicate.
-//
-// If you expect your predicate to be reused and want to support informative
-// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
-// about half as often as positive ones in our tests), supply messages for
-// both success and failure cases:
-//
-// testing::AssertionResult IsEven(int n) {
-// if ((n % 2) == 0)
-// return testing::AssertionSuccess() << n << " is even";
-// else
-// return testing::AssertionFailure() << n << " is odd";
-// }
-//
-// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
-//
-// Value of: IsEven(Fib(6))
-// Actual: true (8 is even)
-// Expected: false
-//
-// NB: Predicates that support negative Boolean assertions have reduced
-// performance in positive ones so be careful not to use them in tests
-// that have lots (tens of thousands) of positive Boolean assertions.
-//
-// To use this class with EXPECT_PRED_FORMAT assertions such as:
-//
-// // Verifies that Foo() returns an even number.
-// EXPECT_PRED_FORMAT1(IsEven, Foo());
-//
-// you need to define:
-//
-// testing::AssertionResult IsEven(const char* expr, int n) {
-// if ((n % 2) == 0)
-// return testing::AssertionSuccess();
-// else
-// return testing::AssertionFailure()
-// << "Expected: " << expr << " is even\n Actual: it's " << n;
-// }
-//
-// If Foo() returns 5, you will see the following message:
-//
-// Expected: Foo() is even
-// Actual: it's 5
-//
-class GTEST_API_ AssertionResult {
- public:
- // Copy constructor.
- // Used in EXPECT_TRUE/FALSE(assertion_result).
- AssertionResult(const AssertionResult& other);
-
- GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
-
- // Used in the EXPECT_TRUE/FALSE(bool_expression).
- //
- // T must be contextually convertible to bool.
- //
- // The second parameter prevents this overload from being considered if
- // the argument is implicitly convertible to AssertionResult. In that case
- // we want AssertionResult's copy constructor to be used.
- template <typename T>
- explicit AssertionResult(
- const T& success,
- typename internal::EnableIf<
- !internal::ImplicitlyConvertible<T, AssertionResult>::value>::type*
- /*enabler*/ = NULL)
- : success_(success) {}
-
- GTEST_DISABLE_MSC_WARNINGS_POP_()
-
- // Assignment operator.
- AssertionResult& operator=(AssertionResult other) {
- swap(other);
- return *this;
- }
-
- // Returns true iff the assertion succeeded.
- operator bool() const { return success_; } // NOLINT
-
- // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
- AssertionResult operator!() const;
-
- // Returns the text streamed into this AssertionResult. Test assertions
- // use it when they fail (i.e., the predicate's outcome doesn't match the
- // assertion's expectation). When nothing has been streamed into the
- // object, returns an empty string.
- const char* message() const {
- return message_.get() != NULL ? message_->c_str() : "";
- }
- // TODO(vladl@google.com): Remove this after making sure no clients use it.
- // Deprecated; please use message() instead.
- const char* failure_message() const { return message(); }
-
- // Streams a custom failure message into this object.
- template <typename T> AssertionResult& operator<<(const T& value) {
- AppendMessage(Message() << value);
- return *this;
- }
-
- // Allows streaming basic output manipulators such as endl or flush into
- // this object.
- AssertionResult& operator<<(
- ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
- AppendMessage(Message() << basic_manipulator);
- return *this;
- }
-
- private:
- // Appends the contents of message to message_.
- void AppendMessage(const Message& a_message) {
- if (message_.get() == NULL)
- message_.reset(new ::std::string);
- message_->append(a_message.GetString().c_str());
- }
-
- // Swap the contents of this AssertionResult with other.
- void swap(AssertionResult& other);
-
- // Stores result of the assertion predicate.
- bool success_;
- // Stores the message describing the condition in case the expectation
- // construct is not satisfied with the predicate's outcome.
- // Referenced via a pointer to avoid taking too much stack frame space
- // with test assertions.
- internal::scoped_ptr< ::std::string> message_;
-};
-
-// Makes a successful assertion result.
-GTEST_API_ AssertionResult AssertionSuccess();
-
-// Makes a failed assertion result.
-GTEST_API_ AssertionResult AssertionFailure();
-
-// Makes a failed assertion result with the given failure message.
-// Deprecated; use AssertionFailure() << msg.
-GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
-
-// The abstract class that all tests inherit from.
-//
-// In Google Test, a unit test program contains one or many TestCases, and
-// each TestCase contains one or many Tests.
-//
-// When you define a test using the TEST macro, you don't need to
-// explicitly derive from Test - the TEST macro automatically does
-// this for you.
-//
-// The only time you derive from Test is when defining a test fixture
-// to be used a TEST_F. For example:
-//
-// class FooTest : public testing::Test {
-// protected:
-// virtual void SetUp() { ... }
-// virtual void TearDown() { ... }
-// ...
-// };
-//
-// TEST_F(FooTest, Bar) { ... }
-// TEST_F(FooTest, Baz) { ... }
-//
-// Test is not copyable.
-class GTEST_API_ Test {
- public:
- friend class TestInfo;
-
- // Defines types for pointers to functions that set up and tear down
- // a test case.
- typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc;
- typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc;
-
- // The d'tor is virtual as we intend to inherit from Test.
- virtual ~Test();
-
- // Sets up the stuff shared by all tests in this test case.
- //
- // Google Test will call Foo::SetUpTestCase() before running the first
- // test in test case Foo. Hence a sub-class can define its own
- // SetUpTestCase() method to shadow the one defined in the super
- // class.
- static void SetUpTestCase() {}
-
- // Tears down the stuff shared by all tests in this test case.
- //
- // Google Test will call Foo::TearDownTestCase() after running the last
- // test in test case Foo. Hence a sub-class can define its own
- // TearDownTestCase() method to shadow the one defined in the super
- // class.
- static void TearDownTestCase() {}
-
- // Returns true iff the current test has a fatal failure.
- static bool HasFatalFailure();
-
- // Returns true iff the current test has a non-fatal failure.
- static bool HasNonfatalFailure();
-
- // Returns true iff the current test has a (either fatal or
- // non-fatal) failure.
- static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
-
- // Logs a property for the current test, test case, or for the entire
- // invocation of the test program when used outside of the context of a
- // test case. Only the last value for a given key is remembered. These
- // are public static so they can be called from utility functions that are
- // not members of the test fixture. Calls to RecordProperty made during
- // lifespan of the test (from the moment its constructor starts to the
- // moment its destructor finishes) will be output in XML as attributes of
- // the <testcase> element. Properties recorded from fixture's
- // SetUpTestCase or TearDownTestCase are logged as attributes of the
- // corresponding <testsuite> element. Calls to RecordProperty made in the
- // global context (before or after invocation of RUN_ALL_TESTS and from
- // SetUp/TearDown method of Environment objects registered with Google
- // Test) will be output as attributes of the <testsuites> element.
- static void RecordProperty(const std::string& key, const std::string& value);
- static void RecordProperty(const std::string& key, int value);
-
- protected:
- // Creates a Test object.
- Test();
-
- // Sets up the test fixture.
- virtual void SetUp();
-
- // Tears down the test fixture.
- virtual void TearDown();
-
- private:
- // Returns true iff the current test has the same fixture class as
- // the first test in the current test case.
- static bool HasSameFixtureClass();
-
- // Runs the test after the test fixture has been set up.
- //
- // A sub-class must implement this to define the test logic.
- //
- // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
- // Instead, use the TEST or TEST_F macro.
- virtual void TestBody() = 0;
-
- // Sets up, executes, and tears down the test.
- void Run();
-
- // Deletes self. We deliberately pick an unusual name for this
- // internal method to avoid clashing with names used in user TESTs.
- void DeleteSelf_() { delete this; }
-
- // Uses a GTestFlagSaver to save and restore all Google Test flags.
- const internal::GTestFlagSaver* const gtest_flag_saver_;
-
- // Often a user mis-spells SetUp() as Setup() and spends a long time
- // wondering why it is never called by Google Test. The declaration of
- // the following method is solely for catching such an error at
- // compile time:
- //
- // - The return type is deliberately chosen to be not void, so it
- // will be a conflict if a user declares void Setup() in his test
- // fixture.
- //
- // - This method is private, so it will be another compiler error
- // if a user calls it from his test fixture.
- //
- // DO NOT OVERRIDE THIS FUNCTION.
- //
- // If you see an error about overriding the following function or
- // about it being private, you have mis-spelled SetUp() as Setup().
- struct Setup_should_be_spelled_SetUp {};
- virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
-
- // We disallow copying Tests.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
-};
-
-typedef internal::TimeInMillis TimeInMillis;
-
-// A copyable object representing a user specified test property which can be
-// output as a key/value string pair.
-//
-// Don't inherit from TestProperty as its destructor is not virtual.
-class TestProperty {
- public:
- // C'tor. TestProperty does NOT have a default constructor.
- // Always use this constructor (with parameters) to create a
- // TestProperty object.
- TestProperty(const std::string& a_key, const std::string& a_value) :
- key_(a_key), value_(a_value) {
- }
-
- // Gets the user supplied key.
- const char* key() const {
- return key_.c_str();
- }
-
- // Gets the user supplied value.
- const char* value() const {
- return value_.c_str();
- }
-
- // Sets a new value, overriding the one supplied in the constructor.
- void SetValue(const std::string& new_value) {
- value_ = new_value;
- }
-
- private:
- // The key supplied by the user.
- std::string key_;
- // The value supplied by the user.
- std::string value_;
-};
-
-// The result of a single Test. This includes a list of
-// TestPartResults, a list of TestProperties, a count of how many
-// death tests there are in the Test, and how much time it took to run
-// the Test.
-//
-// TestResult is not copyable.
-class GTEST_API_ TestResult {
- public:
- // Creates an empty TestResult.
- TestResult();
-
- // D'tor. Do not inherit from TestResult.
- ~TestResult();
-
- // Gets the number of all test parts. This is the sum of the number
- // of successful test parts and the number of failed test parts.
- int total_part_count() const;
-
- // Returns the number of the test properties.
- int test_property_count() const;
-
- // Returns true iff the test passed (i.e. no test part failed).
- bool Passed() const { return !Failed(); }
-
- // Returns true iff the test failed.
- bool Failed() const;
-
- // Returns true iff the test fatally failed.
- bool HasFatalFailure() const;
-
- // Returns true iff the test has a non-fatal failure.
- bool HasNonfatalFailure() const;
-
- // Returns the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const { return elapsed_time_; }
-
- // Returns the i-th test part result among all the results. i can range
- // from 0 to test_property_count() - 1. If i is not in that range, aborts
- // the program.
- const TestPartResult& GetTestPartResult(int i) const;
-
- // Returns the i-th test property. i can range from 0 to
- // test_property_count() - 1. If i is not in that range, aborts the
- // program.
- const TestProperty& GetTestProperty(int i) const;
-
- private:
- friend class TestInfo;
- friend class TestCase;
- friend class UnitTest;
- friend class internal::DefaultGlobalTestPartResultReporter;
- friend class internal::ExecDeathTest;
- friend class internal::TestResultAccessor;
- friend class internal::UnitTestImpl;
- friend class internal::WindowsDeathTest;
-
- // Gets the vector of TestPartResults.
- const std::vector<TestPartResult>& test_part_results() const {
- return test_part_results_;
- }
-
- // Gets the vector of TestProperties.
- const std::vector<TestProperty>& test_properties() const {
- return test_properties_;
- }
-
- // Sets the elapsed time.
- void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
-
- // Adds a test property to the list. The property is validated and may add
- // a non-fatal failure if invalid (e.g., if it conflicts with reserved
- // key names). If a property is already recorded for the same key, the
- // value will be updated, rather than storing multiple values for the same
- // key. xml_element specifies the element for which the property is being
- // recorded and is used for validation.
- void RecordProperty(const std::string& xml_element,
- const TestProperty& test_property);
-
- // Adds a failure if the key is a reserved attribute of Google Test
- // testcase tags. Returns true if the property is valid.
- // TODO(russr): Validate attribute names are legal and human readable.
- static bool ValidateTestProperty(const std::string& xml_element,
- const TestProperty& test_property);
-
- // Adds a test part result to the list.
- void AddTestPartResult(const TestPartResult& test_part_result);
-
- // Returns the death test count.
- int death_test_count() const { return death_test_count_; }
-
- // Increments the death test count, returning the new count.
- int increment_death_test_count() { return ++death_test_count_; }
-
- // Clears the test part results.
- void ClearTestPartResults();
-
- // Clears the object.
- void Clear();
-
- // Protects mutable state of the property vector and of owned
- // properties, whose values may be updated.
- internal::Mutex test_properites_mutex_;
-
- // The vector of TestPartResults
- std::vector<TestPartResult> test_part_results_;
- // The vector of TestProperties
- std::vector<TestProperty> test_properties_;
- // Running count of death tests.
- int death_test_count_;
- // The elapsed time, in milliseconds.
- TimeInMillis elapsed_time_;
-
- // We disallow copying TestResult.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
-}; // class TestResult
-
-// A TestInfo object stores the following information about a test:
-//
-// Test case name
-// Test name
-// Whether the test should be run
-// A function pointer that creates the test object when invoked
-// Test result
-//
-// The constructor of TestInfo registers itself with the UnitTest
-// singleton such that the RUN_ALL_TESTS() macro knows which tests to
-// run.
-class GTEST_API_ TestInfo {
- public:
- // Destructs a TestInfo object. This function is not virtual, so
- // don't inherit from TestInfo.
- ~TestInfo();
-
- // Returns the test case name.
- const char* test_case_name() const { return test_case_name_.c_str(); }
-
- // Returns the test name.
- const char* name() const { return name_.c_str(); }
-
- // Returns the name of the parameter type, or NULL if this is not a typed
- // or a type-parameterized test.
- const char* type_param() const {
- if (type_param_.get() != NULL)
- return type_param_->c_str();
- return NULL;
- }
-
- // Returns the text representation of the value parameter, or NULL if this
- // is not a value-parameterized test.
- const char* value_param() const {
- if (value_param_.get() != NULL)
- return value_param_->c_str();
- return NULL;
- }
-
- // Returns true if this test should run, that is if the test is not
- // disabled (or it is disabled but the also_run_disabled_tests flag has
- // been specified) and its full name matches the user-specified filter.
- //
- // Google Test allows the user to filter the tests by their full names.
- // The full name of a test Bar in test case Foo is defined as
- // "Foo.Bar". Only the tests that match the filter will run.
- //
- // A filter is a colon-separated list of glob (not regex) patterns,
- // optionally followed by a '-' and a colon-separated list of
- // negative patterns (tests to exclude). A test is run if it
- // matches one of the positive patterns and does not match any of
- // the negative patterns.
- //
- // For example, *A*:Foo.* is a filter that matches any string that
- // contains the character 'A' or starts with "Foo.".
- bool should_run() const { return should_run_; }
-
- // Returns true iff this test will appear in the XML report.
- bool is_reportable() const {
- // For now, the XML report includes all tests matching the filter.
- // In the future, we may trim tests that are excluded because of
- // sharding.
- return matches_filter_;
- }
-
- // Returns the result of the test.
- const TestResult* result() const { return &result_; }
-
- private:
-#if GTEST_HAS_DEATH_TEST
- friend class internal::DefaultDeathTestFactory;
-#endif // GTEST_HAS_DEATH_TEST
- friend class Test;
- friend class TestCase;
- friend class internal::UnitTestImpl;
- friend class internal::StreamingListenerTest;
- friend TestInfo* internal::MakeAndRegisterTestInfo(
- const char* test_case_name,
- const char* name,
- const char* type_param,
- const char* value_param,
- internal::TypeId fixture_class_id,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc,
- internal::TestFactoryBase* factory);
-
- // Constructs a TestInfo object. The newly constructed instance assumes
- // ownership of the factory object.
- TestInfo(const std::string& test_case_name,
- const std::string& name,
- const char* a_type_param, // NULL if not a type-parameterized test
- const char* a_value_param, // NULL if not a value-parameterized test
- internal::TypeId fixture_class_id,
- internal::TestFactoryBase* factory);
-
- // Increments the number of death tests encountered in this test so
- // far.
- int increment_death_test_count() {
- return result_.increment_death_test_count();
- }
-
- // Creates the test object, runs it, records its result, and then
- // deletes it.
- void Run();
-
- static void ClearTestResult(TestInfo* test_info) {
- test_info->result_.Clear();
- }
-
- // These fields are immutable properties of the test.
- const std::string test_case_name_; // Test case name
- const std::string name_; // Test name
- // Name of the parameter type, or NULL if this is not a typed or a
- // type-parameterized test.
- const internal::scoped_ptr<const ::std::string> type_param_;
- // Text representation of the value parameter, or NULL if this is not a
- // value-parameterized test.
- const internal::scoped_ptr<const ::std::string> value_param_;
- const internal::TypeId fixture_class_id_; // ID of the test fixture class
- bool should_run_; // True iff this test should run
- bool is_disabled_; // True iff this test is disabled
- bool matches_filter_; // True if this test matches the
- // user-specified filter.
- internal::TestFactoryBase* const factory_; // The factory that creates
- // the test object
-
- // This field is mutable and needs to be reset before running the
- // test for the second time.
- TestResult result_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
-};
-
-// A test case, which consists of a vector of TestInfos.
-//
-// TestCase is not copyable.
-class GTEST_API_ TestCase {
- public:
- // Creates a TestCase with the given name.
- //
- // TestCase does NOT have a default constructor. Always use this
- // constructor to create a TestCase object.
- //
- // Arguments:
- //
- // name: name of the test case
- // a_type_param: the name of the test's type parameter, or NULL if
- // this is not a type-parameterized test.
- // set_up_tc: pointer to the function that sets up the test case
- // tear_down_tc: pointer to the function that tears down the test case
- TestCase(const char* name, const char* a_type_param,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc);
-
- // Destructor of TestCase.
- virtual ~TestCase();
-
- // Gets the name of the TestCase.
- const char* name() const { return name_.c_str(); }
-
- // Returns the name of the parameter type, or NULL if this is not a
- // type-parameterized test case.
- const char* type_param() const {
- if (type_param_.get() != NULL)
- return type_param_->c_str();
- return NULL;
- }
-
- // Returns true if any test in this test case should run.
- bool should_run() const { return should_run_; }
-
- // Gets the number of successful tests in this test case.
- int successful_test_count() const;
-
- // Gets the number of failed tests in this test case.
- int failed_test_count() const;
-
- // Gets the number of disabled tests that will be reported in the XML report.
- int reportable_disabled_test_count() const;
-
- // Gets the number of disabled tests in this test case.
- int disabled_test_count() const;
-
- // Gets the number of tests to be printed in the XML report.
- int reportable_test_count() const;
-
- // Get the number of tests in this test case that should run.
- int test_to_run_count() const;
-
- // Gets the number of all tests in this test case.
- int total_test_count() const;
-
- // Returns true iff the test case passed.
- bool Passed() const { return !Failed(); }
-
- // Returns true iff the test case failed.
- bool Failed() const { return failed_test_count() > 0; }
-
- // Returns the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const { return elapsed_time_; }
-
- // Returns the i-th test among all the tests. i can range from 0 to
- // total_test_count() - 1. If i is not in that range, returns NULL.
- const TestInfo* GetTestInfo(int i) const;
-
- // Returns the TestResult that holds test properties recorded during
- // execution of SetUpTestCase and TearDownTestCase.
- const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; }
-
- private:
- friend class Test;
- friend class internal::UnitTestImpl;
-
- // Gets the (mutable) vector of TestInfos in this TestCase.
- std::vector<TestInfo*>& test_info_list() { return test_info_list_; }
-
- // Gets the (immutable) vector of TestInfos in this TestCase.
- const std::vector<TestInfo*>& test_info_list() const {
- return test_info_list_;
- }
-
- // Returns the i-th test among all the tests. i can range from 0 to
- // total_test_count() - 1. If i is not in that range, returns NULL.
- TestInfo* GetMutableTestInfo(int i);
-
- // Sets the should_run member.
- void set_should_run(bool should) { should_run_ = should; }
-
- // Adds a TestInfo to this test case. Will delete the TestInfo upon
- // destruction of the TestCase object.
- void AddTestInfo(TestInfo * test_info);
-
- // Clears the results of all tests in this test case.
- void ClearResult();
-
- // Clears the results of all tests in the given test case.
- static void ClearTestCaseResult(TestCase* test_case) {
- test_case->ClearResult();
- }
-
- // Runs every test in this TestCase.
- void Run();
-
- // Runs SetUpTestCase() for this TestCase. This wrapper is needed
- // for catching exceptions thrown from SetUpTestCase().
- void RunSetUpTestCase() { (*set_up_tc_)(); }
-
- // Runs TearDownTestCase() for this TestCase. This wrapper is
- // needed for catching exceptions thrown from TearDownTestCase().
- void RunTearDownTestCase() { (*tear_down_tc_)(); }
-
- // Returns true iff test passed.
- static bool TestPassed(const TestInfo* test_info) {
- return test_info->should_run() && test_info->result()->Passed();
- }
-
- // Returns true iff test failed.
- static bool TestFailed(const TestInfo* test_info) {
- return test_info->should_run() && test_info->result()->Failed();
- }
-
- // Returns true iff the test is disabled and will be reported in the XML
- // report.
- static bool TestReportableDisabled(const TestInfo* test_info) {
- return test_info->is_reportable() && test_info->is_disabled_;
- }
-
- // Returns true iff test is disabled.
- static bool TestDisabled(const TestInfo* test_info) {
- return test_info->is_disabled_;
- }
-
- // Returns true iff this test will appear in the XML report.
- static bool TestReportable(const TestInfo* test_info) {
- return test_info->is_reportable();
- }
-
- // Returns true if the given test should run.
- static bool ShouldRunTest(const TestInfo* test_info) {
- return test_info->should_run();
- }
-
- // Shuffles the tests in this test case.
- void ShuffleTests(internal::Random* random);
-
- // Restores the test order to before the first shuffle.
- void UnshuffleTests();
-
- // Name of the test case.
- std::string name_;
- // Name of the parameter type, or NULL if this is not a typed or a
- // type-parameterized test.
- const internal::scoped_ptr<const ::std::string> type_param_;
- // The vector of TestInfos in their original order. It owns the
- // elements in the vector.
- std::vector<TestInfo*> test_info_list_;
- // Provides a level of indirection for the test list to allow easy
- // shuffling and restoring the test order. The i-th element in this
- // vector is the index of the i-th test in the shuffled test list.
- std::vector<int> test_indices_;
- // Pointer to the function that sets up the test case.
- Test::SetUpTestCaseFunc set_up_tc_;
- // Pointer to the function that tears down the test case.
- Test::TearDownTestCaseFunc tear_down_tc_;
- // True iff any test in this test case should run.
- bool should_run_;
- // Elapsed time, in milliseconds.
- TimeInMillis elapsed_time_;
- // Holds test properties recorded during execution of SetUpTestCase and
- // TearDownTestCase.
- TestResult ad_hoc_test_result_;
-
- // We disallow copying TestCases.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);
-};
-
-// An Environment object is capable of setting up and tearing down an
-// environment. The user should subclass this to define his own
-// environment(s).
-//
-// An Environment object does the set-up and tear-down in virtual
-// methods SetUp() and TearDown() instead of the constructor and the
-// destructor, as:
-//
-// 1. You cannot safely throw from a destructor. This is a problem
-// as in some cases Google Test is used where exceptions are enabled, and
-// we may want to implement ASSERT_* using exceptions where they are
-// available.
-// 2. You cannot use ASSERT_* directly in a constructor or
-// destructor.
-class Environment {
- public:
- // The d'tor is virtual as we need to subclass Environment.
- virtual ~Environment() {}
-
- // Override this to define how to set up the environment.
- virtual void SetUp() {}
-
- // Override this to define how to tear down the environment.
- virtual void TearDown() {}
- private:
- // If you see an error about overriding the following function or
- // about it being private, you have mis-spelled SetUp() as Setup().
- struct Setup_should_be_spelled_SetUp {};
- virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
-};
-
-// The interface for tracing execution of tests. The methods are organized in
-// the order the corresponding events are fired.
-class TestEventListener {
- public:
- virtual ~TestEventListener() {}
-
- // Fired before any test activity starts.
- virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
-
- // Fired before each iteration of tests starts. There may be more than
- // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
- // index, starting from 0.
- virtual void OnTestIterationStart(const UnitTest& unit_test,
- int iteration) = 0;
-
- // Fired before environment set-up for each iteration of tests starts.
- virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;
-
- // Fired after environment set-up for each iteration of tests ends.
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
-
- // Fired before the test case starts.
- virtual void OnTestCaseStart(const TestCase& test_case) = 0;
-
- // Fired before the test starts.
- virtual void OnTestStart(const TestInfo& test_info) = 0;
-
- // Fired after a failed assertion or a SUCCEED() invocation.
- virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
-
- // Fired after the test ends.
- virtual void OnTestEnd(const TestInfo& test_info) = 0;
-
- // Fired after the test case ends.
- virtual void OnTestCaseEnd(const TestCase& test_case) = 0;
-
- // Fired before environment tear-down for each iteration of tests starts.
- virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;
-
- // Fired after environment tear-down for each iteration of tests ends.
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
-
- // Fired after each iteration of tests finishes.
- virtual void OnTestIterationEnd(const UnitTest& unit_test,
- int iteration) = 0;
-
- // Fired after all test activities have ended.
- virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
-};
-
-// The convenience class for users who need to override just one or two
-// methods and are not concerned that a possible change to a signature of
-// the methods they override will not be caught during the build. For
-// comments about each method please see the definition of TestEventListener
-// above.
-class EmptyTestEventListener : public TestEventListener {
- public:
- virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
- virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
- int /*iteration*/) {}
- virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {}
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
- virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
- virtual void OnTestStart(const TestInfo& /*test_info*/) {}
- virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {}
- virtual void OnTestEnd(const TestInfo& /*test_info*/) {}
- virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
- virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {}
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
- virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
- int /*iteration*/) {}
- virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
-};
-
-// TestEventListeners lets users add listeners to track events in Google Test.
-class GTEST_API_ TestEventListeners {
- public:
- TestEventListeners();
- ~TestEventListeners();
-
- // Appends an event listener to the end of the list. Google Test assumes
- // the ownership of the listener (i.e. it will delete the listener when
- // the test program finishes).
- void Append(TestEventListener* listener);
-
- // Removes the given event listener from the list and returns it. It then
- // becomes the caller's responsibility to delete the listener. Returns
- // NULL if the listener is not found in the list.
- TestEventListener* Release(TestEventListener* listener);
-
- // Returns the standard listener responsible for the default console
- // output. Can be removed from the listeners list to shut down default
- // console output. Note that removing this object from the listener list
- // with Release transfers its ownership to the caller and makes this
- // function return NULL the next time.
- TestEventListener* default_result_printer() const {
- return default_result_printer_;
- }
-
- // Returns the standard listener responsible for the default XML output
- // controlled by the --gtest_output=xml flag. Can be removed from the
- // listeners list by users who want to shut down the default XML output
- // controlled by this flag and substitute it with custom one. Note that
- // removing this object from the listener list with Release transfers its
- // ownership to the caller and makes this function return NULL the next
- // time.
- TestEventListener* default_xml_generator() const {
- return default_xml_generator_;
- }
-
- private:
- friend class TestCase;
- friend class TestInfo;
- friend class internal::DefaultGlobalTestPartResultReporter;
- friend class internal::NoExecDeathTest;
- friend class internal::TestEventListenersAccessor;
- friend class internal::UnitTestImpl;
-
- // Returns repeater that broadcasts the TestEventListener events to all
- // subscribers.
- TestEventListener* repeater();
-
- // Sets the default_result_printer attribute to the provided listener.
- // The listener is also added to the listener list and previous
- // default_result_printer is removed from it and deleted. The listener can
- // also be NULL in which case it will not be added to the list. Does
- // nothing if the previous and the current listener objects are the same.
- void SetDefaultResultPrinter(TestEventListener* listener);
-
- // Sets the default_xml_generator attribute to the provided listener. The
- // listener is also added to the listener list and previous
- // default_xml_generator is removed from it and deleted. The listener can
- // also be NULL in which case it will not be added to the list. Does
- // nothing if the previous and the current listener objects are the same.
- void SetDefaultXmlGenerator(TestEventListener* listener);
-
- // Controls whether events will be forwarded by the repeater to the
- // listeners in the list.
- bool EventForwardingEnabled() const;
- void SuppressEventForwarding();
-
- // The actual list of listeners.
- internal::TestEventRepeater* repeater_;
- // Listener responsible for the standard result output.
- TestEventListener* default_result_printer_;
- // Listener responsible for the creation of the XML output file.
- TestEventListener* default_xml_generator_;
-
- // We disallow copying TestEventListeners.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
-};
-
-// A UnitTest consists of a vector of TestCases.
-//
-// This is a singleton class. The only instance of UnitTest is
-// created when UnitTest::GetInstance() is first called. This
-// instance is never deleted.
-//
-// UnitTest is not copyable.
-//
-// This class is thread-safe as long as the methods are called
-// according to their specification.
-class GTEST_API_ UnitTest {
- public:
- // Gets the singleton UnitTest object. The first time this method
- // is called, a UnitTest object is constructed and returned.
- // Consecutive calls will return the same object.
- static UnitTest* GetInstance();
-
- // Runs all tests in this UnitTest object and prints the result.
- // Returns 0 if successful, or 1 otherwise.
- //
- // This method can only be called from the main thread.
- //
- // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
- int Run() GTEST_MUST_USE_RESULT_;
-
- // Returns the working directory when the first TEST() or TEST_F()
- // was executed. The UnitTest object owns the string.
- const char* original_working_dir() const;
-
- // Returns the TestCase object for the test that's currently running,
- // or NULL if no test is running.
- const TestCase* current_test_case() const
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Returns the TestInfo object for the test that's currently running,
- // or NULL if no test is running.
- const TestInfo* current_test_info() const
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Returns the random seed used at the start of the current test run.
- int random_seed() const;
-
-#if GTEST_HAS_PARAM_TEST
- // Returns the ParameterizedTestCaseRegistry object used to keep track of
- // value-parameterized tests and instantiate and register them.
- //
- // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
- internal::ParameterizedTestCaseRegistry& parameterized_test_registry()
- GTEST_LOCK_EXCLUDED_(mutex_);
-#endif // GTEST_HAS_PARAM_TEST
-
- // Gets the number of successful test cases.
- int successful_test_case_count() const;
-
- // Gets the number of failed test cases.
- int failed_test_case_count() const;
-
- // Gets the number of all test cases.
- int total_test_case_count() const;
-
- // Gets the number of all test cases that contain at least one test
- // that should run.
- int test_case_to_run_count() const;
-
- // Gets the number of successful tests.
- int successful_test_count() const;
-
- // Gets the number of failed tests.
- int failed_test_count() const;
-
- // Gets the number of disabled tests that will be reported in the XML report.
- int reportable_disabled_test_count() const;
-
- // Gets the number of disabled tests.
- int disabled_test_count() const;
-
- // Gets the number of tests to be printed in the XML report.
- int reportable_test_count() const;
-
- // Gets the number of all tests.
- int total_test_count() const;
-
- // Gets the number of tests that should run.
- int test_to_run_count() const;
-
- // Gets the time of the test program start, in ms from the start of the
- // UNIX epoch.
- TimeInMillis start_timestamp() const;
-
- // Gets the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const;
-
- // Returns true iff the unit test passed (i.e. all test cases passed).
- bool Passed() const;
-
- // Returns true iff the unit test failed (i.e. some test case failed
- // or something outside of all tests failed).
- bool Failed() const;
-
- // Gets the i-th test case among all the test cases. i can range from 0 to
- // total_test_case_count() - 1. If i is not in that range, returns NULL.
- const TestCase* GetTestCase(int i) const;
-
- // Returns the TestResult containing information on test failures and
- // properties logged outside of individual test cases.
- const TestResult& ad_hoc_test_result() const;
-
- // Returns the list of event listeners that can be used to track events
- // inside Google Test.
- TestEventListeners& listeners();
-
- private:
- // Registers and returns a global test environment. When a test
- // program is run, all global test environments will be set-up in
- // the order they were registered. After all tests in the program
- // have finished, all global test environments will be torn-down in
- // the *reverse* order they were registered.
- //
- // The UnitTest object takes ownership of the given environment.
- //
- // This method can only be called from the main thread.
- Environment* AddEnvironment(Environment* env);
-
- // Adds a TestPartResult to the current TestResult object. All
- // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
- // eventually call this to report their results. The user code
- // should use the assertion macros instead of calling this directly.
- void AddTestPartResult(TestPartResult::Type result_type,
- const char* file_name,
- int line_number,
- const std::string& message,
- const std::string& os_stack_trace)
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Adds a TestProperty to the current TestResult object when invoked from
- // inside a test, to current TestCase's ad_hoc_test_result_ when invoked
- // from SetUpTestCase or TearDownTestCase, or to the global property set
- // when invoked elsewhere. If the result already contains a property with
- // the same key, the value will be updated.
- void RecordProperty(const std::string& key, const std::string& value);
-
- // Gets the i-th test case among all the test cases. i can range from 0 to
- // total_test_case_count() - 1. If i is not in that range, returns NULL.
- TestCase* GetMutableTestCase(int i);
-
- // Accessors for the implementation object.
- internal::UnitTestImpl* impl() { return impl_; }
- const internal::UnitTestImpl* impl() const { return impl_; }
-
- // These classes and funcions are friends as they need to access private
- // members of UnitTest.
- friend class Test;
- friend class internal::AssertHelper;
- friend class internal::ScopedTrace;
- friend class internal::StreamingListenerTest;
- friend class internal::UnitTestRecordPropertyTestHelper;
- friend Environment* AddGlobalTestEnvironment(Environment* env);
- friend internal::UnitTestImpl* internal::GetUnitTestImpl();
- friend void internal::ReportFailureInUnknownLocation(
- TestPartResult::Type result_type,
- const std::string& message);
-
- // Creates an empty UnitTest.
- UnitTest();
-
- // D'tor
- virtual ~UnitTest();
-
- // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
- // Google Test trace stack.
- void PushGTestTrace(const internal::TraceInfo& trace)
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Pops a trace from the per-thread Google Test trace stack.
- void PopGTestTrace()
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Protects mutable state in *impl_. This is mutable as some const
- // methods need to lock it too.
- mutable internal::Mutex mutex_;
-
- // Opaque implementation object. This field is never changed once
- // the object is constructed. We don't mark it as const here, as
- // doing so will cause a warning in the constructor of UnitTest.
- // Mutable state in *impl_ is protected by mutex_.
- internal::UnitTestImpl* impl_;
-
- // We disallow copying UnitTest.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
-};
-
-// A convenient wrapper for adding an environment for the test
-// program.
-//
-// You should call this before RUN_ALL_TESTS() is called, probably in
-// main(). If you use gtest_main, you need to call this before main()
-// starts for it to take effect. For example, you can define a global
-// variable like this:
-//
-// testing::Environment* const foo_env =
-// testing::AddGlobalTestEnvironment(new FooEnvironment);
-//
-// However, we strongly recommend you to write your own main() and
-// call AddGlobalTestEnvironment() there, as relying on initialization
-// of global variables makes the code harder to read and may cause
-// problems when you register multiple environments from different
-// translation units and the environments have dependencies among them
-// (remember that the compiler doesn't guarantee the order in which
-// global variables from different translation units are initialized).
-inline Environment* AddGlobalTestEnvironment(Environment* env) {
- return UnitTest::GetInstance()->AddEnvironment(env);
-}
-
-// Initializes Google Test. This must be called before calling
-// RUN_ALL_TESTS(). In particular, it parses a command line for the
-// flags that Google Test recognizes. Whenever a Google Test flag is
-// seen, it is removed from argv, and *argc is decremented.
-//
-// No value is returned. Instead, the Google Test flag variables are
-// updated.
-//
-// Calling the function for the second time has no user-visible effect.
-GTEST_API_ void InitGoogleTest(int* argc, char** argv);
-
-// This overloaded version can be used in Windows programs compiled in
-// UNICODE mode.
-GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
-
-namespace internal {
-
-// FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a
-// value of type ToPrint that is an operand of a comparison assertion
-// (e.g. ASSERT_EQ). OtherOperand is the type of the other operand in
-// the comparison, and is used to help determine the best way to
-// format the value. In particular, when the value is a C string
-// (char pointer) and the other operand is an STL string object, we
-// want to format the C string as a string, since we know it is
-// compared by value with the string object. If the value is a char
-// pointer but the other operand is not an STL string object, we don't
-// know whether the pointer is supposed to point to a NUL-terminated
-// string, and thus want to print it as a pointer to be safe.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-
-// The default case.
-template <typename ToPrint, typename OtherOperand>
-class FormatForComparison {
- public:
- static ::std::string Format(const ToPrint& value) {
- return ::testing::PrintToString(value);
- }
-};
-
-// Array.
-template <typename ToPrint, size_t N, typename OtherOperand>
-class FormatForComparison<ToPrint[N], OtherOperand> {
- public:
- static ::std::string Format(const ToPrint* value) {
- return FormatForComparison<const ToPrint*, OtherOperand>::Format(value);
- }
-};
-
-// By default, print C string as pointers to be safe, as we don't know
-// whether they actually point to a NUL-terminated string.
-
-#define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType) \
- template <typename OtherOperand> \
- class FormatForComparison<CharType*, OtherOperand> { \
- public: \
- static ::std::string Format(CharType* value) { \
- return ::testing::PrintToString(static_cast<const void*>(value)); \
- } \
- }
-
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
-
-#undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
-
-// If a C string is compared with an STL string object, we know it's meant
-// to point to a NUL-terminated string, and thus can print it as a string.
-
-#define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
- template <> \
- class FormatForComparison<CharType*, OtherStringType> { \
- public: \
- static ::std::string Format(CharType* value) { \
- return ::testing::PrintToString(value); \
- } \
- }
-
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);
-
-#if GTEST_HAS_GLOBAL_STRING
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string);
-#endif
-
-#if GTEST_HAS_GLOBAL_WSTRING
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring);
-#endif
-
-#if GTEST_HAS_STD_WSTRING
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);
-#endif
-
-#undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_
-
-// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
-// operand to be used in a failure message. The type (but not value)
-// of the other operand may affect the format. This allows us to
-// print a char* as a raw pointer when it is compared against another
-// char* or void*, and print it as a C string when it is compared
-// against an std::string object, for example.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-template <typename T1, typename T2>
-std::string FormatForComparisonFailureMessage(
- const T1& value, const T2& /* other_operand */) {
- return FormatForComparison<T1, T2>::Format(value);
-}
-
-// The helper function for {ASSERT|EXPECT}_EQ.
-template <typename T1, typename T2>
-AssertionResult CmpHelperEQ(const char* expected_expression,
- const char* actual_expression,
- const T1& expected,
- const T2& actual) {
-GTEST_DISABLE_MSC_WARNINGS_PUSH_(4389 /* signed/unsigned mismatch */)
- if (expected == actual) {
- return AssertionSuccess();
- }
-GTEST_DISABLE_MSC_WARNINGS_POP_()
-
- return EqFailure(expected_expression,
- actual_expression,
- FormatForComparisonFailureMessage(expected, actual),
- FormatForComparisonFailureMessage(actual, expected),
- false);
-}
-
-// With this overloaded version, we allow anonymous enums to be used
-// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
-// can be implicitly cast to BiggestInt.
-GTEST_API_ AssertionResult CmpHelperEQ(const char* expected_expression,
- const char* actual_expression,
- BiggestInt expected,
- BiggestInt actual);
-
-// The helper class for {ASSERT|EXPECT}_EQ. The template argument
-// lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
-// is a null pointer literal. The following default implementation is
-// for lhs_is_null_literal being false.
-template <bool lhs_is_null_literal>
-class EqHelper {
- public:
- // This templatized version is for the general case.
- template <typename T1, typename T2>
- static AssertionResult Compare(const char* expected_expression,
- const char* actual_expression,
- const T1& expected,
- const T2& actual) {
- return CmpHelperEQ(expected_expression, actual_expression, expected,
- actual);
- }
-
- // With this overloaded version, we allow anonymous enums to be used
- // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
- // enums can be implicitly cast to BiggestInt.
- //
- // Even though its body looks the same as the above version, we
- // cannot merge the two, as it will make anonymous enums unhappy.
- static AssertionResult Compare(const char* expected_expression,
- const char* actual_expression,
- BiggestInt expected,
- BiggestInt actual) {
- return CmpHelperEQ(expected_expression, actual_expression, expected,
- actual);
- }
-};
-
-// This specialization is used when the first argument to ASSERT_EQ()
-// is a null pointer literal, like NULL, false, or 0.
-template <>
-class EqHelper<true> {
- public:
- // We define two overloaded versions of Compare(). The first
- // version will be picked when the second argument to ASSERT_EQ() is
- // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or
- // EXPECT_EQ(false, a_bool).
- template <typename T1, typename T2>
- static AssertionResult Compare(
- const char* expected_expression,
- const char* actual_expression,
- const T1& expected,
- const T2& actual,
- // The following line prevents this overload from being considered if T2
- // is not a pointer type. We need this because ASSERT_EQ(NULL, my_ptr)
- // expands to Compare("", "", NULL, my_ptr), which requires a conversion
- // to match the Secret* in the other overload, which would otherwise make
- // this template match better.
- typename EnableIf<!is_pointer<T2>::value>::type* = 0) {
- return CmpHelperEQ(expected_expression, actual_expression, expected,
- actual);
- }
-
- // This version will be picked when the second argument to ASSERT_EQ() is a
- // pointer, e.g. ASSERT_EQ(NULL, a_pointer).
- template <typename T>
- static AssertionResult Compare(
- const char* expected_expression,
- const char* actual_expression,
- // We used to have a second template parameter instead of Secret*. That
- // template parameter would deduce to 'long', making this a better match
- // than the first overload even without the first overload's EnableIf.
- // Unfortunately, gcc with -Wconversion-null warns when "passing NULL to
- // non-pointer argument" (even a deduced integral argument), so the old
- // implementation caused warnings in user code.
- Secret* /* expected (NULL) */,
- T* actual) {
- // We already know that 'expected' is a null pointer.
- return CmpHelperEQ(expected_expression, actual_expression,
- static_cast<T*>(NULL), actual);
- }
-};
-
-// A macro for implementing the helper functions needed to implement
-// ASSERT_?? and EXPECT_??. It is here just to avoid copy-and-paste
-// of similar code.
-//
-// For each templatized helper function, we also define an overloaded
-// version for BiggestInt in order to reduce code bloat and allow
-// anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled
-// with gcc 4.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
-template <typename T1, typename T2>\
-AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
- const T1& val1, const T2& val2) {\
- if (val1 op val2) {\
- return AssertionSuccess();\
- } else {\
- return AssertionFailure() \
- << "Expected: (" << expr1 << ") " #op " (" << expr2\
- << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
- << " vs " << FormatForComparisonFailureMessage(val2, val1);\
- }\
-}\
-GTEST_API_ AssertionResult CmpHelper##op_name(\
- const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-
-// Implements the helper function for {ASSERT|EXPECT}_NE
-GTEST_IMPL_CMP_HELPER_(NE, !=);
-// Implements the helper function for {ASSERT|EXPECT}_LE
-GTEST_IMPL_CMP_HELPER_(LE, <=);
-// Implements the helper function for {ASSERT|EXPECT}_LT
-GTEST_IMPL_CMP_HELPER_(LT, <);
-// Implements the helper function for {ASSERT|EXPECT}_GE
-GTEST_IMPL_CMP_HELPER_(GE, >=);
-// Implements the helper function for {ASSERT|EXPECT}_GT
-GTEST_IMPL_CMP_HELPER_(GT, >);
-
-#undef GTEST_IMPL_CMP_HELPER_
-
-// The helper function for {ASSERT|EXPECT}_STREQ.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual);
-
-// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual);
-
-// The helper function for {ASSERT|EXPECT}_STRNE.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2);
-
-// The helper function for {ASSERT|EXPECT}_STRCASENE.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2);
-
-
-// Helper function for *_STREQ on wide strings.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const wchar_t* expected,
- const wchar_t* actual);
-
-// Helper function for *_STRNE on wide strings.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const wchar_t* s1,
- const wchar_t* s2);
-
-} // namespace internal
-
-// IsSubstring() and IsNotSubstring() are intended to be used as the
-// first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
-// themselves. They check whether needle is a substring of haystack
-// (NULL is considered a substring of itself only), and return an
-// appropriate error message when they fail.
-//
-// The {needle,haystack}_expr arguments are the stringified
-// expressions that generated the two real arguments.
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const char* needle, const char* haystack);
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const wchar_t* needle, const wchar_t* haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const char* needle, const char* haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const wchar_t* needle, const wchar_t* haystack);
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::string& needle, const ::std::string& haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::string& needle, const ::std::string& haystack);
-
-#if GTEST_HAS_STD_WSTRING
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::wstring& needle, const ::std::wstring& haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::wstring& needle, const ::std::wstring& haystack);
-#endif // GTEST_HAS_STD_WSTRING
-
-namespace internal {
-
-// Helper template function for comparing floating-points.
-//
-// Template parameter:
-//
-// RawType: the raw floating-point type (either float or double)
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-template <typename RawType>
-AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
- const char* actual_expression,
- RawType expected,
- RawType actual) {
- const FloatingPoint<RawType> lhs(expected), rhs(actual);
-
- if (lhs.AlmostEquals(rhs)) {
- return AssertionSuccess();
- }
-
- ::std::stringstream expected_ss;
- expected_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << expected;
-
- ::std::stringstream actual_ss;
- actual_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << actual;
-
- return EqFailure(expected_expression,
- actual_expression,
- StringStreamToString(&expected_ss),
- StringStreamToString(&actual_ss),
- false);
-}
-
-// Helper function for implementing ASSERT_NEAR.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
- const char* expr2,
- const char* abs_error_expr,
- double val1,
- double val2,
- double abs_error);
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-// A class that enables one to stream messages to assertion macros
-class GTEST_API_ AssertHelper {
- public:
- // Constructor.
- AssertHelper(TestPartResult::Type type,
- const char* file,
- int line,
- const char* message);
- ~AssertHelper();
-
- // Message assignment is a semantic trick to enable assertion
- // streaming; see the GTEST_MESSAGE_ macro below.
- void operator=(const Message& message) const;
-
- private:
- // We put our data in a struct so that the size of the AssertHelper class can
- // be as small as possible. This is important because gcc is incapable of
- // re-using stack space even for temporary variables, so every EXPECT_EQ
- // reserves stack space for another AssertHelper.
- struct AssertHelperData {
- AssertHelperData(TestPartResult::Type t,
- const char* srcfile,
- int line_num,
- const char* msg)
- : type(t), file(srcfile), line(line_num), message(msg) { }
-
- TestPartResult::Type const type;
- const char* const file;
- int const line;
- std::string const message;
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
- };
-
- AssertHelperData* const data_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
-};
-
-} // namespace internal
-
-#if GTEST_HAS_PARAM_TEST
-// The pure interface class that all value-parameterized tests inherit from.
-// A value-parameterized class must inherit from both ::testing::Test and
-// ::testing::WithParamInterface. In most cases that just means inheriting
-// from ::testing::TestWithParam, but more complicated test hierarchies
-// may need to inherit from Test and WithParamInterface at different levels.
-//
-// This interface has support for accessing the test parameter value via
-// the GetParam() method.
-//
-// Use it with one of the parameter generator defining functions, like Range(),
-// Values(), ValuesIn(), Bool(), and Combine().
-//
-// class FooTest : public ::testing::TestWithParam<int> {
-// protected:
-// FooTest() {
-// // Can use GetParam() here.
-// }
-// virtual ~FooTest() {
-// // Can use GetParam() here.
-// }
-// virtual void SetUp() {
-// // Can use GetParam() here.
-// }
-// virtual void TearDown {
-// // Can use GetParam() here.
-// }
-// };
-// TEST_P(FooTest, DoesBar) {
-// // Can use GetParam() method here.
-// Foo foo;
-// ASSERT_TRUE(foo.DoesBar(GetParam()));
-// }
-// INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
-
-template <typename T>
-class WithParamInterface {
- public:
- typedef T ParamType;
- virtual ~WithParamInterface() {}
-
- // The current parameter value. Is also available in the test fixture's
- // constructor. This member function is non-static, even though it only
- // references static data, to reduce the opportunity for incorrect uses
- // like writing 'WithParamInterface<bool>::GetParam()' for a test that
- // uses a fixture whose parameter type is int.
- const ParamType& GetParam() const {
- GTEST_CHECK_(parameter_ != NULL)
- << "GetParam() can only be called inside a value-parameterized test "
- << "-- did you intend to write TEST_P instead of TEST_F?";
- return *parameter_;
- }
-
- private:
- // Sets parameter value. The caller is responsible for making sure the value
- // remains alive and unchanged throughout the current test.
- static void SetParam(const ParamType* parameter) {
- parameter_ = parameter;
- }
-
- // Static value used for accessing parameter during a test lifetime.
- static const ParamType* parameter_;
-
- // TestClass must be a subclass of WithParamInterface<T> and Test.
- template <class TestClass> friend class internal::ParameterizedTestFactory;
-};
-
-template <typename T>
-const T* WithParamInterface<T>::parameter_ = NULL;
-
-// Most value-parameterized classes can ignore the existence of
-// WithParamInterface, and can just inherit from ::testing::TestWithParam.
-
-template <typename T>
-class TestWithParam : public Test, public WithParamInterface<T> {
-};
-
-#endif // GTEST_HAS_PARAM_TEST
-
-// Macros for indicating success/failure in test code.
-
-// ADD_FAILURE unconditionally adds a failure to the current test.
-// SUCCEED generates a success - it doesn't automatically make the
-// current test successful, as a test is only successful when it has
-// no failure.
-//
-// EXPECT_* verifies that a certain condition is satisfied. If not,
-// it behaves like ADD_FAILURE. In particular:
-//
-// EXPECT_TRUE verifies that a Boolean condition is true.
-// EXPECT_FALSE verifies that a Boolean condition is false.
-//
-// FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
-// that they will also abort the current function on failure. People
-// usually want the fail-fast behavior of FAIL and ASSERT_*, but those
-// writing data-driven tests often find themselves using ADD_FAILURE
-// and EXPECT_* more.
-
-// Generates a nonfatal failure with a generic message.
-#define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
-
-// Generates a nonfatal failure at the given source file location with
-// a generic message.
-#define ADD_FAILURE_AT(file, line) \
- GTEST_MESSAGE_AT_(file, line, "Failed", \
- ::testing::TestPartResult::kNonFatalFailure)
-
-// Generates a fatal failure with a generic message.
-#define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
-
-// Define this macro to 1 to omit the definition of FAIL(), which is a
-// generic name and clashes with some other libraries.
-#if !GTEST_DONT_DEFINE_FAIL
-# define FAIL() GTEST_FAIL()
-#endif
-
-// Generates a success with a generic message.
-#define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
-
-// Define this macro to 1 to omit the definition of SUCCEED(), which
-// is a generic name and clashes with some other libraries.
-#if !GTEST_DONT_DEFINE_SUCCEED
-# define SUCCEED() GTEST_SUCCEED()
-#endif
-
-// Macros for testing exceptions.
-//
-// * {ASSERT|EXPECT}_THROW(statement, expected_exception):
-// Tests that the statement throws the expected exception.
-// * {ASSERT|EXPECT}_NO_THROW(statement):
-// Tests that the statement doesn't throw any exception.
-// * {ASSERT|EXPECT}_ANY_THROW(statement):
-// Tests that the statement throws an exception.
-
-#define EXPECT_THROW(statement, expected_exception) \
- GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_NO_THROW(statement) \
- GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_ANY_THROW(statement) \
- GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_THROW(statement, expected_exception) \
- GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
-#define ASSERT_NO_THROW(statement) \
- GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
-#define ASSERT_ANY_THROW(statement) \
- GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
-
-// Boolean assertions. Condition can be either a Boolean expression or an
-// AssertionResult. For more information on how to use AssertionResult with
-// these macros see comments on that class.
-#define EXPECT_TRUE(condition) \
- GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
- GTEST_NONFATAL_FAILURE_)
-#define EXPECT_FALSE(condition) \
- GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
- GTEST_NONFATAL_FAILURE_)
-#define ASSERT_TRUE(condition) \
- GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
- GTEST_FATAL_FAILURE_)
-#define ASSERT_FALSE(condition) \
- GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
- GTEST_FATAL_FAILURE_)
-
-// Includes the auto-generated header that implements a family of
-// generic predicate assertion macros.
-#include "gtest/gtest_pred_impl.h"
-
-// Macros for testing equalities and inequalities.
-//
-// * {ASSERT|EXPECT}_EQ(expected, actual): Tests that expected == actual
-// * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2
-// * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2
-// * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2
-// * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2
-// * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2
-//
-// When they are not, Google Test prints both the tested expressions and
-// their actual values. The values must be compatible built-in types,
-// or you will get a compiler error. By "compatible" we mean that the
-// values can be compared by the respective operator.
-//
-// Note:
-//
-// 1. It is possible to make a user-defined type work with
-// {ASSERT|EXPECT}_??(), but that requires overloading the
-// comparison operators and is thus discouraged by the Google C++
-// Usage Guide. Therefore, you are advised to use the
-// {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
-// equal.
-//
-// 2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
-// pointers (in particular, C strings). Therefore, if you use it
-// with two C strings, you are testing how their locations in memory
-// are related, not how their content is related. To compare two C
-// strings by content, use {ASSERT|EXPECT}_STR*().
-//
-// 3. {ASSERT|EXPECT}_EQ(expected, actual) is preferred to
-// {ASSERT|EXPECT}_TRUE(expected == actual), as the former tells you
-// what the actual value is when it fails, and similarly for the
-// other comparisons.
-//
-// 4. Do not depend on the order in which {ASSERT|EXPECT}_??()
-// evaluate their arguments, which is undefined.
-//
-// 5. These macros evaluate their arguments exactly once.
-//
-// Examples:
-//
-// EXPECT_NE(5, Foo());
-// EXPECT_EQ(NULL, a_pointer);
-// ASSERT_LT(i, array_size);
-// ASSERT_GT(records.size(), 0) << "There is no record left.";
-
-#define EXPECT_EQ(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal:: \
- EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
- expected, actual)
-#define EXPECT_NE(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual)
-#define EXPECT_LE(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
-#define EXPECT_LT(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
-#define EXPECT_GE(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
-#define EXPECT_GT(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
-
-#define GTEST_ASSERT_EQ(expected, actual) \
- ASSERT_PRED_FORMAT2(::testing::internal:: \
- EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
- expected, actual)
-#define GTEST_ASSERT_NE(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
-#define GTEST_ASSERT_LE(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
-#define GTEST_ASSERT_LT(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
-#define GTEST_ASSERT_GE(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
-#define GTEST_ASSERT_GT(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
-
-// Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of
-// ASSERT_XY(), which clashes with some users' own code.
-
-#if !GTEST_DONT_DEFINE_ASSERT_EQ
-# define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_NE
-# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_LE
-# define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_LT
-# define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_GE
-# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_GT
-# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
-#endif
-
-// C-string Comparisons. All tests treat NULL and any non-NULL string
-// as different. Two NULLs are equal.
-//
-// * {ASSERT|EXPECT}_STREQ(s1, s2): Tests that s1 == s2
-// * {ASSERT|EXPECT}_STRNE(s1, s2): Tests that s1 != s2
-// * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
-// * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
-//
-// For wide or narrow string objects, you can use the
-// {ASSERT|EXPECT}_??() macros.
-//
-// Don't depend on the order in which the arguments are evaluated,
-// which is undefined.
-//
-// These macros evaluate their arguments exactly once.
-
-#define EXPECT_STREQ(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
-#define EXPECT_STRNE(s1, s2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
-#define EXPECT_STRCASEEQ(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
-#define EXPECT_STRCASENE(s1, s2)\
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
-
-#define ASSERT_STREQ(expected, actual) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
-#define ASSERT_STRNE(s1, s2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
-#define ASSERT_STRCASEEQ(expected, actual) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
-#define ASSERT_STRCASENE(s1, s2)\
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
-
-// Macros for comparing floating-point numbers.
-//
-// * {ASSERT|EXPECT}_FLOAT_EQ(expected, actual):
-// Tests that two float values are almost equal.
-// * {ASSERT|EXPECT}_DOUBLE_EQ(expected, actual):
-// Tests that two double values are almost equal.
-// * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
-// Tests that v1 and v2 are within the given distance to each other.
-//
-// Google Test uses ULP-based comparison to automatically pick a default
-// error bound that is appropriate for the operands. See the
-// FloatingPoint template class in gtest-internal.h if you are
-// interested in the implementation details.
-
-#define EXPECT_FLOAT_EQ(expected, actual)\
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
- expected, actual)
-
-#define EXPECT_DOUBLE_EQ(expected, actual)\
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
- expected, actual)
-
-#define ASSERT_FLOAT_EQ(expected, actual)\
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
- expected, actual)
-
-#define ASSERT_DOUBLE_EQ(expected, actual)\
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
- expected, actual)
-
-#define EXPECT_NEAR(val1, val2, abs_error)\
- EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
- val1, val2, abs_error)
-
-#define ASSERT_NEAR(val1, val2, abs_error)\
- ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
- val1, val2, abs_error)
-
-// These predicate format functions work on floating-point values, and
-// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
-//
-// EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
-
-// Asserts that val1 is less than, or almost equal to, val2. Fails
-// otherwise. In particular, it fails if either val1 or val2 is NaN.
-GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
- float val1, float val2);
-GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
- double val1, double val2);
-
-
-#if GTEST_OS_WINDOWS
-
-// Macros that test for HRESULT failure and success, these are only useful
-// on Windows, and rely on Windows SDK macros and APIs to compile.
-//
-// * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
-//
-// When expr unexpectedly fails or succeeds, Google Test prints the
-// expected result and the actual result with both a human-readable
-// string representation of the error, if available, as well as the
-// hex result code.
-# define EXPECT_HRESULT_SUCCEEDED(expr) \
- EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
-
-# define ASSERT_HRESULT_SUCCEEDED(expr) \
- ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
-
-# define EXPECT_HRESULT_FAILED(expr) \
- EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
-
-# define ASSERT_HRESULT_FAILED(expr) \
- ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
-
-#endif // GTEST_OS_WINDOWS
-
-// Macros that execute statement and check that it doesn't generate new fatal
-// failures in the current thread.
-//
-// * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
-//
-// Examples:
-//
-// EXPECT_NO_FATAL_FAILURE(Process());
-// ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
-//
-#define ASSERT_NO_FATAL_FAILURE(statement) \
- GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
-#define EXPECT_NO_FATAL_FAILURE(statement) \
- GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
-
-// Causes a trace (including the source file path, the current line
-// number, and the given message) to be included in every test failure
-// message generated by code in the current scope. The effect is
-// undone when the control leaves the current scope.
-//
-// The message argument can be anything streamable to std::ostream.
-//
-// In the implementation, we include the current line number as part
-// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
-// to appear in the same block - as long as they are on different
-// lines.
-#define SCOPED_TRACE(message) \
- ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
- __FILE__, __LINE__, ::testing::Message() << (message))
-
-// Compile-time assertion for type equality.
-// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
-// the same type. The value it returns is not interesting.
-//
-// Instead of making StaticAssertTypeEq a class template, we make it a
-// function template that invokes a helper class template. This
-// prevents a user from misusing StaticAssertTypeEq<T1, T2> by
-// defining objects of that type.
-//
-// CAVEAT:
-//
-// When used inside a method of a class template,
-// StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
-// instantiated. For example, given:
-//
-// template <typename T> class Foo {
-// public:
-// void Bar() { testing::StaticAssertTypeEq<int, T>(); }
-// };
-//
-// the code:
-//
-// void Test1() { Foo<bool> foo; }
-//
-// will NOT generate a compiler error, as Foo<bool>::Bar() is never
-// actually instantiated. Instead, you need:
-//
-// void Test2() { Foo<bool> foo; foo.Bar(); }
-//
-// to cause a compiler error.
-template <typename T1, typename T2>
-bool StaticAssertTypeEq() {
- (void)internal::StaticAssertTypeEqHelper<T1, T2>();
- return true;
-}
-
-// Defines a test.
-//
-// The first parameter is the name of the test case, and the second
-// parameter is the name of the test within the test case.
-//
-// The convention is to end the test case name with "Test". For
-// example, a test case for the Foo class can be named FooTest.
-//
-// The user should put his test code between braces after using this
-// macro. Example:
-//
-// TEST(FooTest, InitializesCorrectly) {
-// Foo foo;
-// EXPECT_TRUE(foo.StatusIsOK());
-// }
-
-// Note that we call GetTestTypeId() instead of GetTypeId<
-// ::testing::Test>() here to get the type ID of testing::Test. This
-// is to work around a suspected linker bug when using Google Test as
-// a framework on Mac OS X. The bug causes GetTypeId<
-// ::testing::Test>() to return different values depending on whether
-// the call is from the Google Test framework itself or from user test
-// code. GetTestTypeId() is guaranteed to always return the same
-// value, as it always calls GetTypeId<>() from the Google Test
-// framework.
-#define GTEST_TEST(test_case_name, test_name)\
- GTEST_TEST_(test_case_name, test_name, \
- ::testing::Test, ::testing::internal::GetTestTypeId())
-
-// Define this macro to 1 to omit the definition of TEST(), which
-// is a generic name and clashes with some other libraries.
-#if !GTEST_DONT_DEFINE_TEST
-# define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
-#endif
-
-// Defines a test that uses a test fixture.
-//
-// The first parameter is the name of the test fixture class, which
-// also doubles as the test case name. The second parameter is the
-// name of the test within the test case.
-//
-// A test fixture class must be declared earlier. The user should put
-// his test code between braces after using this macro. Example:
-//
-// class FooTest : public testing::Test {
-// protected:
-// virtual void SetUp() { b_.AddElement(3); }
-//
-// Foo a_;
-// Foo b_;
-// };
-//
-// TEST_F(FooTest, InitializesCorrectly) {
-// EXPECT_TRUE(a_.StatusIsOK());
-// }
-//
-// TEST_F(FooTest, ReturnsElementCountCorrectly) {
-// EXPECT_EQ(0, a_.size());
-// EXPECT_EQ(1, b_.size());
-// }
-
-#define TEST_F(test_fixture, test_name)\
- GTEST_TEST_(test_fixture, test_name, test_fixture, \
- ::testing::internal::GetTypeId<test_fixture>())
-
-} // namespace testing
-
-// Use this function in main() to run all tests. It returns 0 if all
-// tests are successful, or 1 otherwise.
-//
-// RUN_ALL_TESTS() should be invoked after the command line has been
-// parsed by InitGoogleTest().
-//
-// This function was formerly a macro; thus, it is in the global
-// namespace and has an all-caps name.
-int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;
-
-inline int RUN_ALL_TESTS() {
- return ::testing::UnitTest::GetInstance()->Run();
-}
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest_pred_impl.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest_pred_impl.h
deleted file mode 100644
index 30ae712..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest_pred_impl.h
+++ /dev/null
@@ -1,358 +0,0 @@
-// Copyright 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command
-// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
-//
-// Implements a family of generic predicate assertion macros.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
-
-// Makes sure this header is not included before gtest.h.
-#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
-# error Do not include gtest_pred_impl.h directly. Include gtest.h instead.
-#endif // GTEST_INCLUDE_GTEST_GTEST_H_
-
-// This header implements a family of generic predicate assertion
-// macros:
-//
-// ASSERT_PRED_FORMAT1(pred_format, v1)
-// ASSERT_PRED_FORMAT2(pred_format, v1, v2)
-// ...
-//
-// where pred_format is a function or functor that takes n (in the
-// case of ASSERT_PRED_FORMATn) values and their source expression
-// text, and returns a testing::AssertionResult. See the definition
-// of ASSERT_EQ in gtest.h for an example.
-//
-// If you don't care about formatting, you can use the more
-// restrictive version:
-//
-// ASSERT_PRED1(pred, v1)
-// ASSERT_PRED2(pred, v1, v2)
-// ...
-//
-// where pred is an n-ary function or functor that returns bool,
-// and the values v1, v2, ..., must support the << operator for
-// streaming to std::ostream.
-//
-// We also define the EXPECT_* variations.
-//
-// For now we only support predicates whose arity is at most 5.
-// Please email googletestframework@googlegroups.com if you need
-// support for higher arities.
-
-// GTEST_ASSERT_ is the basic statement to which all of the assertions
-// in this file reduce. Don't use this in your code.
-
-#define GTEST_ASSERT_(expression, on_failure) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (const ::testing::AssertionResult gtest_ar = (expression)) \
- ; \
- else \
- on_failure(gtest_ar.failure_message())
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use
-// this in your code.
-template <typename Pred,
- typename T1>
-AssertionResult AssertPred1Helper(const char* pred_text,
- const char* e1,
- Pred pred,
- const T1& v1) {
- if (pred(v1)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, v1), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use
-// this in your code.
-#define GTEST_PRED1_(pred, v1, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
- #v1, \
- pred, \
- v1), on_failure)
-
-// Unary predicate assertion macros.
-#define EXPECT_PRED_FORMAT1(pred_format, v1) \
- GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED1(pred, v1) \
- GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT1(pred_format, v1) \
- GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED1(pred, v1) \
- GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2>
-AssertionResult AssertPred2Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- Pred pred,
- const T1& v1,
- const T2& v2) {
- if (pred(v1, v2)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use
-// this in your code.
-#define GTEST_PRED2_(pred, v1, v2, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
- #v1, \
- #v2, \
- pred, \
- v1, \
- v2), on_failure)
-
-// Binary predicate assertion macros.
-#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
- GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED2(pred, v1, v2) \
- GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
- GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED2(pred, v1, v2) \
- GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2,
- typename T3>
-AssertionResult AssertPred3Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- const char* e3,
- Pred pred,
- const T1& v1,
- const T2& v2,
- const T3& v3) {
- if (pred(v1, v2, v3)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ", "
- << e3 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2
- << "\n" << e3 << " evaluates to " << v3;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use
-// this in your code.
-#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
- #v1, \
- #v2, \
- #v3, \
- pred, \
- v1, \
- v2, \
- v3), on_failure)
-
-// Ternary predicate assertion macros.
-#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
- GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED3(pred, v1, v2, v3) \
- GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
- GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED3(pred, v1, v2, v3) \
- GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2,
- typename T3,
- typename T4>
-AssertionResult AssertPred4Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- const char* e3,
- const char* e4,
- Pred pred,
- const T1& v1,
- const T2& v2,
- const T3& v3,
- const T4& v4) {
- if (pred(v1, v2, v3, v4)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ", "
- << e3 << ", "
- << e4 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2
- << "\n" << e3 << " evaluates to " << v3
- << "\n" << e4 << " evaluates to " << v4;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use
-// this in your code.
-#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
- #v1, \
- #v2, \
- #v3, \
- #v4, \
- pred, \
- v1, \
- v2, \
- v3, \
- v4), on_failure)
-
-// 4-ary predicate assertion macros.
-#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
- GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED4(pred, v1, v2, v3, v4) \
- GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
- GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED4(pred, v1, v2, v3, v4) \
- GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5>
-AssertionResult AssertPred5Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- const char* e3,
- const char* e4,
- const char* e5,
- Pred pred,
- const T1& v1,
- const T2& v2,
- const T3& v3,
- const T4& v4,
- const T5& v5) {
- if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ", "
- << e3 << ", "
- << e4 << ", "
- << e5 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2
- << "\n" << e3 << " evaluates to " << v3
- << "\n" << e4 << " evaluates to " << v4
- << "\n" << e5 << " evaluates to " << v5;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use
-// this in your code.
-#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
- #v1, \
- #v2, \
- #v3, \
- #v4, \
- #v5, \
- pred, \
- v1, \
- v2, \
- v3, \
- v4, \
- v5), on_failure)
-
-// 5-ary predicate assertion macros.
-#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
- GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
- GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
- GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
- GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
-
-
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest_prod.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest_prod.h
deleted file mode 100644
index da80ddc..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/gtest_prod.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// Google C++ Testing Framework definitions useful in production code.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
-
-// When you need to test the private or protected members of a class,
-// use the FRIEND_TEST macro to declare your tests as friends of the
-// class. For example:
-//
-// class MyClass {
-// private:
-// void MyMethod();
-// FRIEND_TEST(MyClassTest, MyMethod);
-// };
-//
-// class MyClassTest : public testing::Test {
-// // ...
-// };
-//
-// TEST_F(MyClassTest, MyMethod) {
-// // Can call MyClass::MyMethod() here.
-// }
-
-#define FRIEND_TEST(test_case_name, test_name)\
-friend class test_case_name##_##test_name##_Test
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-death-test-internal.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-death-test-internal.h
deleted file mode 100644
index 2b3a78f..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-death-test-internal.h
+++ /dev/null
@@ -1,319 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines internal utilities needed for implementing
-// death tests. They are subject to change without notice.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
-
-#include "gtest/internal/gtest-internal.h"
-
-#include <stdio.h>
-
-namespace testing {
-namespace internal {
-
-GTEST_DECLARE_string_(internal_run_death_test);
-
-// Names of the flags (needed for parsing Google Test flags).
-const char kDeathTestStyleFlag[] = "death_test_style";
-const char kDeathTestUseFork[] = "death_test_use_fork";
-const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
-
-#if GTEST_HAS_DEATH_TEST
-
-// DeathTest is a class that hides much of the complexity of the
-// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
-// returns a concrete class that depends on the prevailing death test
-// style, as defined by the --gtest_death_test_style and/or
-// --gtest_internal_run_death_test flags.
-
-// In describing the results of death tests, these terms are used with
-// the corresponding definitions:
-//
-// exit status: The integer exit information in the format specified
-// by wait(2)
-// exit code: The integer code passed to exit(3), _exit(2), or
-// returned from main()
-class GTEST_API_ DeathTest {
- public:
- // Create returns false if there was an error determining the
- // appropriate action to take for the current death test; for example,
- // if the gtest_death_test_style flag is set to an invalid value.
- // The LastMessage method will return a more detailed message in that
- // case. Otherwise, the DeathTest pointer pointed to by the "test"
- // argument is set. If the death test should be skipped, the pointer
- // is set to NULL; otherwise, it is set to the address of a new concrete
- // DeathTest object that controls the execution of the current test.
- static bool Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test);
- DeathTest();
- virtual ~DeathTest() { }
-
- // A helper class that aborts a death test when it's deleted.
- class ReturnSentinel {
- public:
- explicit ReturnSentinel(DeathTest* test) : test_(test) { }
- ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
- private:
- DeathTest* const test_;
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
- } GTEST_ATTRIBUTE_UNUSED_;
-
- // An enumeration of possible roles that may be taken when a death
- // test is encountered. EXECUTE means that the death test logic should
- // be executed immediately. OVERSEE means that the program should prepare
- // the appropriate environment for a child process to execute the death
- // test, then wait for it to complete.
- enum TestRole { OVERSEE_TEST, EXECUTE_TEST };
-
- // An enumeration of the three reasons that a test might be aborted.
- enum AbortReason {
- TEST_ENCOUNTERED_RETURN_STATEMENT,
- TEST_THREW_EXCEPTION,
- TEST_DID_NOT_DIE
- };
-
- // Assumes one of the above roles.
- virtual TestRole AssumeRole() = 0;
-
- // Waits for the death test to finish and returns its status.
- virtual int Wait() = 0;
-
- // Returns true if the death test passed; that is, the test process
- // exited during the test, its exit status matches a user-supplied
- // predicate, and its stderr output matches a user-supplied regular
- // expression.
- // The user-supplied predicate may be a macro expression rather
- // than a function pointer or functor, or else Wait and Passed could
- // be combined.
- virtual bool Passed(bool exit_status_ok) = 0;
-
- // Signals that the death test did not die as expected.
- virtual void Abort(AbortReason reason) = 0;
-
- // Returns a human-readable outcome message regarding the outcome of
- // the last death test.
- static const char* LastMessage();
-
- static void set_last_death_test_message(const std::string& message);
-
- private:
- // A string containing a description of the outcome of the last death test.
- static std::string last_death_test_message_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
-};
-
-// Factory interface for death tests. May be mocked out for testing.
-class DeathTestFactory {
- public:
- virtual ~DeathTestFactory() { }
- virtual bool Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test) = 0;
-};
-
-// A concrete DeathTestFactory implementation for normal use.
-class DefaultDeathTestFactory : public DeathTestFactory {
- public:
- virtual bool Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test);
-};
-
-// Returns true if exit_status describes a process that was terminated
-// by a signal, or exited normally with a nonzero exit code.
-GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
-
-// Traps C++ exceptions escaping statement and reports them as test
-// failures. Note that trapping SEH exceptions is not implemented here.
-# if GTEST_HAS_EXCEPTIONS
-# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } catch (const ::std::exception& gtest_exception) { \
- fprintf(\
- stderr, \
- "\n%s: Caught std::exception-derived exception escaping the " \
- "death test statement. Exception message: %s\n", \
- ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
- gtest_exception.what()); \
- fflush(stderr); \
- death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
- } catch (...) { \
- death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
- }
-
-# else
-# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
-
-# endif
-
-// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
-// ASSERT_EXIT*, and EXPECT_EXIT*.
-# define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- const ::testing::internal::RE& gtest_regex = (regex); \
- ::testing::internal::DeathTest* gtest_dt; \
- if (!::testing::internal::DeathTest::Create(#statement, >est_regex, \
- __FILE__, __LINE__, >est_dt)) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
- } \
- if (gtest_dt != NULL) { \
- ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \
- gtest_dt_ptr(gtest_dt); \
- switch (gtest_dt->AssumeRole()) { \
- case ::testing::internal::DeathTest::OVERSEE_TEST: \
- if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
- } \
- break; \
- case ::testing::internal::DeathTest::EXECUTE_TEST: { \
- ::testing::internal::DeathTest::ReturnSentinel \
- gtest_sentinel(gtest_dt); \
- GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \
- gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
- break; \
- } \
- default: \
- break; \
- } \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \
- fail(::testing::internal::DeathTest::LastMessage())
-// The symbol "fail" here expands to something into which a message
-// can be streamed.
-
-// This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
-// NDEBUG mode. In this case we need the statements to be executed, the regex is
-// ignored, and the macro must accept a streamed message even though the message
-// is never printed.
-# define GTEST_EXECUTE_STATEMENT_(statement, regex) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } else \
- ::testing::Message()
-
-// A class representing the parsed contents of the
-// --gtest_internal_run_death_test flag, as it existed when
-// RUN_ALL_TESTS was called.
-class InternalRunDeathTestFlag {
- public:
- InternalRunDeathTestFlag(const std::string& a_file,
- int a_line,
- int an_index,
- int a_write_fd)
- : file_(a_file), line_(a_line), index_(an_index),
- write_fd_(a_write_fd) {}
-
- ~InternalRunDeathTestFlag() {
- if (write_fd_ >= 0)
- posix::Close(write_fd_);
- }
-
- const std::string& file() const { return file_; }
- int line() const { return line_; }
- int index() const { return index_; }
- int write_fd() const { return write_fd_; }
-
- private:
- std::string file_;
- int line_;
- int index_;
- int write_fd_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
-};
-
-// Returns a newly created InternalRunDeathTestFlag object with fields
-// initialized from the GTEST_FLAG(internal_run_death_test) flag if
-// the flag is specified; otherwise returns NULL.
-InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
-
-#else // GTEST_HAS_DEATH_TEST
-
-// This macro is used for implementing macros such as
-// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
-// death tests are not supported. Those macros must compile on such systems
-// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
-// systems that support death tests. This allows one to write such a macro
-// on a system that does not support death tests and be sure that it will
-// compile on a death-test supporting system.
-//
-// Parameters:
-// statement - A statement that a macro such as EXPECT_DEATH would test
-// for program termination. This macro has to make sure this
-// statement is compiled but not executed, to ensure that
-// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
-// parameter iff EXPECT_DEATH compiles with it.
-// regex - A regex that a macro such as EXPECT_DEATH would use to test
-// the output of statement. This parameter has to be
-// compiled but not evaluated by this macro, to ensure that
-// this macro only accepts expressions that a macro such as
-// EXPECT_DEATH would accept.
-// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
-// and a return statement for ASSERT_DEATH_IF_SUPPORTED.
-// This ensures that ASSERT_DEATH_IF_SUPPORTED will not
-// compile inside functions where ASSERT_DEATH doesn't
-// compile.
-//
-// The branch that has an always false condition is used to ensure that
-// statement and regex are compiled (and thus syntactically correct) but
-// never executed. The unreachable code macro protects the terminator
-// statement from generating an 'unreachable code' warning in case
-// statement unconditionally returns or throws. The Message constructor at
-// the end allows the syntax of streaming additional messages into the
-// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
-# define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- GTEST_LOG_(WARNING) \
- << "Death tests are not supported on this platform.\n" \
- << "Statement '" #statement "' cannot be verified."; \
- } else if (::testing::internal::AlwaysFalse()) { \
- ::testing::internal::RE::PartialMatch(".*", (regex)); \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- terminator; \
- } else \
- ::testing::Message()
-
-#endif // GTEST_HAS_DEATH_TEST
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-filepath.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-filepath.h
deleted file mode 100644
index 7a13b4b..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-filepath.h
+++ /dev/null
@@ -1,206 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: keith.ray@gmail.com (Keith Ray)
-//
-// Google Test filepath utilities
-//
-// This header file declares classes and functions used internally by
-// Google Test. They are subject to change without notice.
-//
-// This file is #included in <gtest/internal/gtest-internal.h>.
-// Do not include this header file separately!
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
-
-#include "gtest/internal/gtest-string.h"
-
-namespace testing {
-namespace internal {
-
-// FilePath - a class for file and directory pathname manipulation which
-// handles platform-specific conventions (like the pathname separator).
-// Used for helper functions for naming files in a directory for xml output.
-// Except for Set methods, all methods are const or static, which provides an
-// "immutable value object" -- useful for peace of mind.
-// A FilePath with a value ending in a path separator ("like/this/") represents
-// a directory, otherwise it is assumed to represent a file. In either case,
-// it may or may not represent an actual file or directory in the file system.
-// Names are NOT checked for syntax correctness -- no checking for illegal
-// characters, malformed paths, etc.
-
-class GTEST_API_ FilePath {
- public:
- FilePath() : pathname_("") { }
- FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
-
- explicit FilePath(const std::string& pathname) : pathname_(pathname) {
- Normalize();
- }
-
- FilePath& operator=(const FilePath& rhs) {
- Set(rhs);
- return *this;
- }
-
- void Set(const FilePath& rhs) {
- pathname_ = rhs.pathname_;
- }
-
- const std::string& string() const { return pathname_; }
- const char* c_str() const { return pathname_.c_str(); }
-
- // Returns the current working directory, or "" if unsuccessful.
- static FilePath GetCurrentDir();
-
- // Given directory = "dir", base_name = "test", number = 0,
- // extension = "xml", returns "dir/test.xml". If number is greater
- // than zero (e.g., 12), returns "dir/test_12.xml".
- // On Windows platform, uses \ as the separator rather than /.
- static FilePath MakeFileName(const FilePath& directory,
- const FilePath& base_name,
- int number,
- const char* extension);
-
- // Given directory = "dir", relative_path = "test.xml",
- // returns "dir/test.xml".
- // On Windows, uses \ as the separator rather than /.
- static FilePath ConcatPaths(const FilePath& directory,
- const FilePath& relative_path);
-
- // Returns a pathname for a file that does not currently exist. The pathname
- // will be directory/base_name.extension or
- // directory/base_name_<number>.extension if directory/base_name.extension
- // already exists. The number will be incremented until a pathname is found
- // that does not already exist.
- // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
- // There could be a race condition if two or more processes are calling this
- // function at the same time -- they could both pick the same filename.
- static FilePath GenerateUniqueFileName(const FilePath& directory,
- const FilePath& base_name,
- const char* extension);
-
- // Returns true iff the path is "".
- bool IsEmpty() const { return pathname_.empty(); }
-
- // If input name has a trailing separator character, removes it and returns
- // the name, otherwise return the name string unmodified.
- // On Windows platform, uses \ as the separator, other platforms use /.
- FilePath RemoveTrailingPathSeparator() const;
-
- // Returns a copy of the FilePath with the directory part removed.
- // Example: FilePath("path/to/file").RemoveDirectoryName() returns
- // FilePath("file"). If there is no directory part ("just_a_file"), it returns
- // the FilePath unmodified. If there is no file part ("just_a_dir/") it
- // returns an empty FilePath ("").
- // On Windows platform, '\' is the path separator, otherwise it is '/'.
- FilePath RemoveDirectoryName() const;
-
- // RemoveFileName returns the directory path with the filename removed.
- // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
- // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
- // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
- // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
- // On Windows platform, '\' is the path separator, otherwise it is '/'.
- FilePath RemoveFileName() const;
-
- // Returns a copy of the FilePath with the case-insensitive extension removed.
- // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
- // FilePath("dir/file"). If a case-insensitive extension is not
- // found, returns a copy of the original FilePath.
- FilePath RemoveExtension(const char* extension) const;
-
- // Creates directories so that path exists. Returns true if successful or if
- // the directories already exist; returns false if unable to create
- // directories for any reason. Will also return false if the FilePath does
- // not represent a directory (that is, it doesn't end with a path separator).
- bool CreateDirectoriesRecursively() const;
-
- // Create the directory so that path exists. Returns true if successful or
- // if the directory already exists; returns false if unable to create the
- // directory for any reason, including if the parent directory does not
- // exist. Not named "CreateDirectory" because that's a macro on Windows.
- bool CreateFolder() const;
-
- // Returns true if FilePath describes something in the file-system,
- // either a file, directory, or whatever, and that something exists.
- bool FileOrDirectoryExists() const;
-
- // Returns true if pathname describes a directory in the file-system
- // that exists.
- bool DirectoryExists() const;
-
- // Returns true if FilePath ends with a path separator, which indicates that
- // it is intended to represent a directory. Returns false otherwise.
- // This does NOT check that a directory (or file) actually exists.
- bool IsDirectory() const;
-
- // Returns true if pathname describes a root directory. (Windows has one
- // root directory per disk drive.)
- bool IsRootDirectory() const;
-
- // Returns true if pathname describes an absolute path.
- bool IsAbsolutePath() const;
-
- private:
- // Replaces multiple consecutive separators with a single separator.
- // For example, "bar///foo" becomes "bar/foo". Does not eliminate other
- // redundancies that might be in a pathname involving "." or "..".
- //
- // A pathname with multiple consecutive separators may occur either through
- // user error or as a result of some scripts or APIs that generate a pathname
- // with a trailing separator. On other platforms the same API or script
- // may NOT generate a pathname with a trailing "/". Then elsewhere that
- // pathname may have another "/" and pathname components added to it,
- // without checking for the separator already being there.
- // The script language and operating system may allow paths like "foo//bar"
- // but some of the functions in FilePath will not handle that correctly. In
- // particular, RemoveTrailingPathSeparator() only removes one separator, and
- // it is called in CreateDirectoriesRecursively() assuming that it will change
- // a pathname from directory syntax (trailing separator) to filename syntax.
- //
- // On Windows this method also replaces the alternate path separator '/' with
- // the primary path separator '\\', so that for example "bar\\/\\foo" becomes
- // "bar\\foo".
-
- void Normalize();
-
- // Returns a pointer to the last occurence of a valid path separator in
- // the FilePath. On Windows, for example, both '/' and '\' are valid path
- // separators. Returns NULL if no path separator was found.
- const char* FindLastPathSeparator() const;
-
- std::string pathname_;
-}; // class FilePath
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-internal.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-internal.h
deleted file mode 100644
index ff8f629..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-internal.h
+++ /dev/null
@@ -1,1161 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file declares functions and macros used internally by
-// Google Test. They are subject to change without notice.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
-
-#include "gtest/internal/gtest-port.h"
-
-#if GTEST_OS_LINUX
-# include <stdlib.h>
-# include <sys/types.h>
-# include <sys/wait.h>
-# include <unistd.h>
-#endif // GTEST_OS_LINUX
-
-#if GTEST_HAS_EXCEPTIONS
-# include <stdexcept>
-#endif
-
-#include <ctype.h>
-#include <float.h>
-#include <string.h>
-#include <iomanip>
-#include <limits>
-#include <set>
-
-#include "gtest/gtest-message.h"
-#include "gtest/internal/gtest-string.h"
-#include "gtest/internal/gtest-filepath.h"
-#include "gtest/internal/gtest-type-util.h"
-
-// Due to C++ preprocessor weirdness, we need double indirection to
-// concatenate two tokens when one of them is __LINE__. Writing
-//
-// foo ## __LINE__
-//
-// will result in the token foo__LINE__, instead of foo followed by
-// the current line number. For more details, see
-// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
-#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
-#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
-
-class ProtocolMessage;
-namespace proto2 { class Message; }
-
-namespace testing {
-
-// Forward declarations.
-
-class AssertionResult; // Result of an assertion.
-class Message; // Represents a failure message.
-class Test; // Represents a test.
-class TestInfo; // Information about a test.
-class TestPartResult; // Result of a test part.
-class UnitTest; // A collection of test cases.
-
-template <typename T>
-::std::string PrintToString(const T& value);
-
-namespace internal {
-
-struct TraceInfo; // Information about a trace point.
-class ScopedTrace; // Implements scoped trace.
-class TestInfoImpl; // Opaque implementation of TestInfo
-class UnitTestImpl; // Opaque implementation of UnitTest
-
-// How many times InitGoogleTest() has been called.
-GTEST_API_ extern int g_init_gtest_count;
-
-// The text used in failure messages to indicate the start of the
-// stack trace.
-GTEST_API_ extern const char kStackTraceMarker[];
-
-// Two overloaded helpers for checking at compile time whether an
-// expression is a null pointer literal (i.e. NULL or any 0-valued
-// compile-time integral constant). Their return values have
-// different sizes, so we can use sizeof() to test which version is
-// picked by the compiler. These helpers have no implementations, as
-// we only need their signatures.
-//
-// Given IsNullLiteralHelper(x), the compiler will pick the first
-// version if x can be implicitly converted to Secret*, and pick the
-// second version otherwise. Since Secret is a secret and incomplete
-// type, the only expression a user can write that has type Secret* is
-// a null pointer literal. Therefore, we know that x is a null
-// pointer literal if and only if the first version is picked by the
-// compiler.
-char IsNullLiteralHelper(Secret* p);
-char (&IsNullLiteralHelper(...))[2]; // NOLINT
-
-// A compile-time bool constant that is true if and only if x is a
-// null pointer literal (i.e. NULL or any 0-valued compile-time
-// integral constant).
-#ifdef GTEST_ELLIPSIS_NEEDS_POD_
-// We lose support for NULL detection where the compiler doesn't like
-// passing non-POD classes through ellipsis (...).
-# define GTEST_IS_NULL_LITERAL_(x) false
-#else
-# define GTEST_IS_NULL_LITERAL_(x) \
- (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
-#endif // GTEST_ELLIPSIS_NEEDS_POD_
-
-// Appends the user-supplied message to the Google-Test-generated message.
-GTEST_API_ std::string AppendUserMessage(
- const std::string& gtest_msg, const Message& user_msg);
-
-#if GTEST_HAS_EXCEPTIONS
-
-// This exception is thrown by (and only by) a failed Google Test
-// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
-// are enabled). We derive it from std::runtime_error, which is for
-// errors presumably detectable only at run time. Since
-// std::runtime_error inherits from std::exception, many testing
-// frameworks know how to extract and print the message inside it.
-class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
- public:
- explicit GoogleTestFailureException(const TestPartResult& failure);
-};
-
-#endif // GTEST_HAS_EXCEPTIONS
-
-// A helper class for creating scoped traces in user programs.
-class GTEST_API_ ScopedTrace {
- public:
- // The c'tor pushes the given source file location and message onto
- // a trace stack maintained by Google Test.
- ScopedTrace(const char* file, int line, const Message& message);
-
- // The d'tor pops the info pushed by the c'tor.
- //
- // Note that the d'tor is not virtual in order to be efficient.
- // Don't inherit from ScopedTrace!
- ~ScopedTrace();
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
-} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
- // c'tor and d'tor. Therefore it doesn't
- // need to be used otherwise.
-
-// Constructs and returns the message for an equality assertion
-// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
-//
-// The first four parameters are the expressions used in the assertion
-// and their values, as strings. For example, for ASSERT_EQ(foo, bar)
-// where foo is 5 and bar is 6, we have:
-//
-// expected_expression: "foo"
-// actual_expression: "bar"
-// expected_value: "5"
-// actual_value: "6"
-//
-// The ignoring_case parameter is true iff the assertion is a
-// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
-// be inserted into the message.
-GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
- const char* actual_expression,
- const std::string& expected_value,
- const std::string& actual_value,
- bool ignoring_case);
-
-// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
-GTEST_API_ std::string GetBoolAssertionFailureMessage(
- const AssertionResult& assertion_result,
- const char* expression_text,
- const char* actual_predicate_value,
- const char* expected_predicate_value);
-
-// This template class represents an IEEE floating-point number
-// (either single-precision or double-precision, depending on the
-// template parameters).
-//
-// The purpose of this class is to do more sophisticated number
-// comparison. (Due to round-off error, etc, it's very unlikely that
-// two floating-points will be equal exactly. Hence a naive
-// comparison by the == operation often doesn't work.)
-//
-// Format of IEEE floating-point:
-//
-// The most-significant bit being the leftmost, an IEEE
-// floating-point looks like
-//
-// sign_bit exponent_bits fraction_bits
-//
-// Here, sign_bit is a single bit that designates the sign of the
-// number.
-//
-// For float, there are 8 exponent bits and 23 fraction bits.
-//
-// For double, there are 11 exponent bits and 52 fraction bits.
-//
-// More details can be found at
-// http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
-//
-// Template parameter:
-//
-// RawType: the raw floating-point type (either float or double)
-template <typename RawType>
-class FloatingPoint {
- public:
- // Defines the unsigned integer type that has the same size as the
- // floating point number.
- typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;
-
- // Constants.
-
- // # of bits in a number.
- static const size_t kBitCount = 8*sizeof(RawType);
-
- // # of fraction bits in a number.
- static const size_t kFractionBitCount =
- std::numeric_limits<RawType>::digits - 1;
-
- // # of exponent bits in a number.
- static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
-
- // The mask for the sign bit.
- static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
-
- // The mask for the fraction bits.
- static const Bits kFractionBitMask =
- ~static_cast<Bits>(0) >> (kExponentBitCount + 1);
-
- // The mask for the exponent bits.
- static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);
-
- // How many ULP's (Units in the Last Place) we want to tolerate when
- // comparing two numbers. The larger the value, the more error we
- // allow. A 0 value means that two numbers must be exactly the same
- // to be considered equal.
- //
- // The maximum error of a single floating-point operation is 0.5
- // units in the last place. On Intel CPU's, all floating-point
- // calculations are done with 80-bit precision, while double has 64
- // bits. Therefore, 4 should be enough for ordinary use.
- //
- // See the following article for more details on ULP:
- // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
- static const size_t kMaxUlps = 4;
-
- // Constructs a FloatingPoint from a raw floating-point number.
- //
- // On an Intel CPU, passing a non-normalized NAN (Not a Number)
- // around may change its bits, although the new value is guaranteed
- // to be also a NAN. Therefore, don't expect this constructor to
- // preserve the bits in x when x is a NAN.
- explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
-
- // Static methods
-
- // Reinterprets a bit pattern as a floating-point number.
- //
- // This function is needed to test the AlmostEquals() method.
- static RawType ReinterpretBits(const Bits bits) {
- FloatingPoint fp(0);
- fp.u_.bits_ = bits;
- return fp.u_.value_;
- }
-
- // Returns the floating-point number that represent positive infinity.
- static RawType Infinity() {
- return ReinterpretBits(kExponentBitMask);
- }
-
- // Returns the maximum representable finite floating-point number.
- static RawType Max();
-
- // Non-static methods
-
- // Returns the bits that represents this number.
- const Bits &bits() const { return u_.bits_; }
-
- // Returns the exponent bits of this number.
- Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
-
- // Returns the fraction bits of this number.
- Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
-
- // Returns the sign bit of this number.
- Bits sign_bit() const { return kSignBitMask & u_.bits_; }
-
- // Returns true iff this is NAN (not a number).
- bool is_nan() const {
- // It's a NAN if the exponent bits are all ones and the fraction
- // bits are not entirely zeros.
- return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
- }
-
- // Returns true iff this number is at most kMaxUlps ULP's away from
- // rhs. In particular, this function:
- //
- // - returns false if either number is (or both are) NAN.
- // - treats really large numbers as almost equal to infinity.
- // - thinks +0.0 and -0.0 are 0 DLP's apart.
- bool AlmostEquals(const FloatingPoint& rhs) const {
- // The IEEE standard says that any comparison operation involving
- // a NAN must return false.
- if (is_nan() || rhs.is_nan()) return false;
-
- return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
- <= kMaxUlps;
- }
-
- private:
- // The data type used to store the actual floating-point number.
- union FloatingPointUnion {
- RawType value_; // The raw floating-point number.
- Bits bits_; // The bits that represent the number.
- };
-
- // Converts an integer from the sign-and-magnitude representation to
- // the biased representation. More precisely, let N be 2 to the
- // power of (kBitCount - 1), an integer x is represented by the
- // unsigned number x + N.
- //
- // For instance,
- //
- // -N + 1 (the most negative number representable using
- // sign-and-magnitude) is represented by 1;
- // 0 is represented by N; and
- // N - 1 (the biggest number representable using
- // sign-and-magnitude) is represented by 2N - 1.
- //
- // Read http://en.wikipedia.org/wiki/Signed_number_representations
- // for more details on signed number representations.
- static Bits SignAndMagnitudeToBiased(const Bits &sam) {
- if (kSignBitMask & sam) {
- // sam represents a negative number.
- return ~sam + 1;
- } else {
- // sam represents a positive number.
- return kSignBitMask | sam;
- }
- }
-
- // Given two numbers in the sign-and-magnitude representation,
- // returns the distance between them as an unsigned number.
- static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
- const Bits &sam2) {
- const Bits biased1 = SignAndMagnitudeToBiased(sam1);
- const Bits biased2 = SignAndMagnitudeToBiased(sam2);
- return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
- }
-
- FloatingPointUnion u_;
-};
-
-// We cannot use std::numeric_limits<T>::max() as it clashes with the max()
-// macro defined by <windows.h>.
-template <>
-inline float FloatingPoint<float>::Max() { return FLT_MAX; }
-template <>
-inline double FloatingPoint<double>::Max() { return DBL_MAX; }
-
-// Typedefs the instances of the FloatingPoint template class that we
-// care to use.
-typedef FloatingPoint<float> Float;
-typedef FloatingPoint<double> Double;
-
-// In order to catch the mistake of putting tests that use different
-// test fixture classes in the same test case, we need to assign
-// unique IDs to fixture classes and compare them. The TypeId type is
-// used to hold such IDs. The user should treat TypeId as an opaque
-// type: the only operation allowed on TypeId values is to compare
-// them for equality using the == operator.
-typedef const void* TypeId;
-
-template <typename T>
-class TypeIdHelper {
- public:
- // dummy_ must not have a const type. Otherwise an overly eager
- // compiler (e.g. MSVC 7.1 & 8.0) may try to merge
- // TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
- static bool dummy_;
-};
-
-template <typename T>
-bool TypeIdHelper<T>::dummy_ = false;
-
-// GetTypeId<T>() returns the ID of type T. Different values will be
-// returned for different types. Calling the function twice with the
-// same type argument is guaranteed to return the same ID.
-template <typename T>
-TypeId GetTypeId() {
- // The compiler is required to allocate a different
- // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
- // the template. Therefore, the address of dummy_ is guaranteed to
- // be unique.
- return &(TypeIdHelper<T>::dummy_);
-}
-
-// Returns the type ID of ::testing::Test. Always call this instead
-// of GetTypeId< ::testing::Test>() to get the type ID of
-// ::testing::Test, as the latter may give the wrong result due to a
-// suspected linker bug when compiling Google Test as a Mac OS X
-// framework.
-GTEST_API_ TypeId GetTestTypeId();
-
-// Defines the abstract factory interface that creates instances
-// of a Test object.
-class TestFactoryBase {
- public:
- virtual ~TestFactoryBase() {}
-
- // Creates a test instance to run. The instance is both created and destroyed
- // within TestInfoImpl::Run()
- virtual Test* CreateTest() = 0;
-
- protected:
- TestFactoryBase() {}
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
-};
-
-// This class provides implementation of TeastFactoryBase interface.
-// It is used in TEST and TEST_F macros.
-template <class TestClass>
-class TestFactoryImpl : public TestFactoryBase {
- public:
- virtual Test* CreateTest() { return new TestClass; }
-};
-
-#if GTEST_OS_WINDOWS
-
-// Predicate-formatters for implementing the HRESULT checking macros
-// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
-// We pass a long instead of HRESULT to avoid causing an
-// include dependency for the HRESULT type.
-GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,
- long hr); // NOLINT
-GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
- long hr); // NOLINT
-
-#endif // GTEST_OS_WINDOWS
-
-// Types of SetUpTestCase() and TearDownTestCase() functions.
-typedef void (*SetUpTestCaseFunc)();
-typedef void (*TearDownTestCaseFunc)();
-
-// Creates a new TestInfo object and registers it with Google Test;
-// returns the created object.
-//
-// Arguments:
-//
-// test_case_name: name of the test case
-// name: name of the test
-// type_param the name of the test's type parameter, or NULL if
-// this is not a typed or a type-parameterized test.
-// value_param text representation of the test's value parameter,
-// or NULL if this is not a type-parameterized test.
-// fixture_class_id: ID of the test fixture class
-// set_up_tc: pointer to the function that sets up the test case
-// tear_down_tc: pointer to the function that tears down the test case
-// factory: pointer to the factory that creates a test object.
-// The newly created TestInfo instance will assume
-// ownership of the factory object.
-GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
- const char* test_case_name,
- const char* name,
- const char* type_param,
- const char* value_param,
- TypeId fixture_class_id,
- SetUpTestCaseFunc set_up_tc,
- TearDownTestCaseFunc tear_down_tc,
- TestFactoryBase* factory);
-
-// If *pstr starts with the given prefix, modifies *pstr to be right
-// past the prefix and returns true; otherwise leaves *pstr unchanged
-// and returns false. None of pstr, *pstr, and prefix can be NULL.
-GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
-
-#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// State of the definition of a type-parameterized test case.
-class GTEST_API_ TypedTestCasePState {
- public:
- TypedTestCasePState() : registered_(false) {}
-
- // Adds the given test name to defined_test_names_ and return true
- // if the test case hasn't been registered; otherwise aborts the
- // program.
- bool AddTestName(const char* file, int line, const char* case_name,
- const char* test_name) {
- if (registered_) {
- fprintf(stderr, "%s Test %s must be defined before "
- "REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
- FormatFileLocation(file, line).c_str(), test_name, case_name);
- fflush(stderr);
- posix::Abort();
- }
- defined_test_names_.insert(test_name);
- return true;
- }
-
- // Verifies that registered_tests match the test names in
- // defined_test_names_; returns registered_tests if successful, or
- // aborts the program otherwise.
- const char* VerifyRegisteredTestNames(
- const char* file, int line, const char* registered_tests);
-
- private:
- bool registered_;
- ::std::set<const char*> defined_test_names_;
-};
-
-// Skips to the first non-space char after the first comma in 'str';
-// returns NULL if no comma is found in 'str'.
-inline const char* SkipComma(const char* str) {
- const char* comma = strchr(str, ',');
- if (comma == NULL) {
- return NULL;
- }
- while (IsSpace(*(++comma))) {}
- return comma;
-}
-
-// Returns the prefix of 'str' before the first comma in it; returns
-// the entire string if it contains no comma.
-inline std::string GetPrefixUntilComma(const char* str) {
- const char* comma = strchr(str, ',');
- return comma == NULL ? str : std::string(str, comma);
-}
-
-// TypeParameterizedTest<Fixture, TestSel, Types>::Register()
-// registers a list of type-parameterized tests with Google Test. The
-// return value is insignificant - we just need to return something
-// such that we can call this function in a namespace scope.
-//
-// Implementation note: The GTEST_TEMPLATE_ macro declares a template
-// template parameter. It's defined in gtest-type-util.h.
-template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
-class TypeParameterizedTest {
- public:
- // 'index' is the index of the test in the type list 'Types'
- // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,
- // Types). Valid values for 'index' are [0, N - 1] where N is the
- // length of Types.
- static bool Register(const char* prefix, const char* case_name,
- const char* test_names, int index) {
- typedef typename Types::Head Type;
- typedef Fixture<Type> FixtureClass;
- typedef typename GTEST_BIND_(TestSel, Type) TestClass;
-
- // First, registers the first type-parameterized test in the type
- // list.
- MakeAndRegisterTestInfo(
- (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + "/"
- + StreamableToString(index)).c_str(),
- GetPrefixUntilComma(test_names).c_str(),
- GetTypeName<Type>().c_str(),
- NULL, // No value parameter.
- GetTypeId<FixtureClass>(),
- TestClass::SetUpTestCase,
- TestClass::TearDownTestCase,
- new TestFactoryImpl<TestClass>);
-
- // Next, recurses (at compile time) with the tail of the type list.
- return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>
- ::Register(prefix, case_name, test_names, index + 1);
- }
-};
-
-// The base case for the compile time recursion.
-template <GTEST_TEMPLATE_ Fixture, class TestSel>
-class TypeParameterizedTest<Fixture, TestSel, Types0> {
- public:
- static bool Register(const char* /*prefix*/, const char* /*case_name*/,
- const char* /*test_names*/, int /*index*/) {
- return true;
- }
-};
-
-// TypeParameterizedTestCase<Fixture, Tests, Types>::Register()
-// registers *all combinations* of 'Tests' and 'Types' with Google
-// Test. The return value is insignificant - we just need to return
-// something such that we can call this function in a namespace scope.
-template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
-class TypeParameterizedTestCase {
- public:
- static bool Register(const char* prefix, const char* case_name,
- const char* test_names) {
- typedef typename Tests::Head Head;
-
- // First, register the first test in 'Test' for each type in 'Types'.
- TypeParameterizedTest<Fixture, Head, Types>::Register(
- prefix, case_name, test_names, 0);
-
- // Next, recurses (at compile time) with the tail of the test list.
- return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types>
- ::Register(prefix, case_name, SkipComma(test_names));
- }
-};
-
-// The base case for the compile time recursion.
-template <GTEST_TEMPLATE_ Fixture, typename Types>
-class TypeParameterizedTestCase<Fixture, Templates0, Types> {
- public:
- static bool Register(const char* /*prefix*/, const char* /*case_name*/,
- const char* /*test_names*/) {
- return true;
- }
-};
-
-#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// Returns the current OS stack trace as an std::string.
-//
-// The maximum number of stack frames to be included is specified by
-// the gtest_stack_trace_depth flag. The skip_count parameter
-// specifies the number of top frames to be skipped, which doesn't
-// count against the number of frames to be included.
-//
-// For example, if Foo() calls Bar(), which in turn calls
-// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
-// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
-GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(
- UnitTest* unit_test, int skip_count);
-
-// Helpers for suppressing warnings on unreachable code or constant
-// condition.
-
-// Always returns true.
-GTEST_API_ bool AlwaysTrue();
-
-// Always returns false.
-inline bool AlwaysFalse() { return !AlwaysTrue(); }
-
-// Helper for suppressing false warning from Clang on a const char*
-// variable declared in a conditional expression always being NULL in
-// the else branch.
-struct GTEST_API_ ConstCharPtr {
- ConstCharPtr(const char* str) : value(str) {}
- operator bool() const { return true; }
- const char* value;
-};
-
-// A simple Linear Congruential Generator for generating random
-// numbers with a uniform distribution. Unlike rand() and srand(), it
-// doesn't use global state (and therefore can't interfere with user
-// code). Unlike rand_r(), it's portable. An LCG isn't very random,
-// but it's good enough for our purposes.
-class GTEST_API_ Random {
- public:
- static const UInt32 kMaxRange = 1u << 31;
-
- explicit Random(UInt32 seed) : state_(seed) {}
-
- void Reseed(UInt32 seed) { state_ = seed; }
-
- // Generates a random number from [0, range). Crashes if 'range' is
- // 0 or greater than kMaxRange.
- UInt32 Generate(UInt32 range);
-
- private:
- UInt32 state_;
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);
-};
-
-// Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a
-// compiler error iff T1 and T2 are different types.
-template <typename T1, typename T2>
-struct CompileAssertTypesEqual;
-
-template <typename T>
-struct CompileAssertTypesEqual<T, T> {
-};
-
-// Removes the reference from a type if it is a reference type,
-// otherwise leaves it unchanged. This is the same as
-// tr1::remove_reference, which is not widely available yet.
-template <typename T>
-struct RemoveReference { typedef T type; }; // NOLINT
-template <typename T>
-struct RemoveReference<T&> { typedef T type; }; // NOLINT
-
-// A handy wrapper around RemoveReference that works when the argument
-// T depends on template parameters.
-#define GTEST_REMOVE_REFERENCE_(T) \
- typename ::testing::internal::RemoveReference<T>::type
-
-// Removes const from a type if it is a const type, otherwise leaves
-// it unchanged. This is the same as tr1::remove_const, which is not
-// widely available yet.
-template <typename T>
-struct RemoveConst { typedef T type; }; // NOLINT
-template <typename T>
-struct RemoveConst<const T> { typedef T type; }; // NOLINT
-
-// MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above
-// definition to fail to remove the const in 'const int[3]' and 'const
-// char[3][4]'. The following specialization works around the bug.
-template <typename T, size_t N>
-struct RemoveConst<const T[N]> {
- typedef typename RemoveConst<T>::type type[N];
-};
-
-#if defined(_MSC_VER) && _MSC_VER < 1400
-// This is the only specialization that allows VC++ 7.1 to remove const in
-// 'const int[3] and 'const int[3][4]'. However, it causes trouble with GCC
-// and thus needs to be conditionally compiled.
-template <typename T, size_t N>
-struct RemoveConst<T[N]> {
- typedef typename RemoveConst<T>::type type[N];
-};
-#endif
-
-// A handy wrapper around RemoveConst that works when the argument
-// T depends on template parameters.
-#define GTEST_REMOVE_CONST_(T) \
- typename ::testing::internal::RemoveConst<T>::type
-
-// Turns const U&, U&, const U, and U all into U.
-#define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
- GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))
-
-// Adds reference to a type if it is not a reference type,
-// otherwise leaves it unchanged. This is the same as
-// tr1::add_reference, which is not widely available yet.
-template <typename T>
-struct AddReference { typedef T& type; }; // NOLINT
-template <typename T>
-struct AddReference<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper around AddReference that works when the argument T
-// depends on template parameters.
-#define GTEST_ADD_REFERENCE_(T) \
- typename ::testing::internal::AddReference<T>::type
-
-// Adds a reference to const on top of T as necessary. For example,
-// it transforms
-//
-// char ==> const char&
-// const char ==> const char&
-// char& ==> const char&
-// const char& ==> const char&
-//
-// The argument T must depend on some template parameters.
-#define GTEST_REFERENCE_TO_CONST_(T) \
- GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T))
-
-// ImplicitlyConvertible<From, To>::value is a compile-time bool
-// constant that's true iff type From can be implicitly converted to
-// type To.
-template <typename From, typename To>
-class ImplicitlyConvertible {
- private:
- // We need the following helper functions only for their types.
- // They have no implementations.
-
- // MakeFrom() is an expression whose type is From. We cannot simply
- // use From(), as the type From may not have a public default
- // constructor.
- static typename AddReference<From>::type MakeFrom();
-
- // These two functions are overloaded. Given an expression
- // Helper(x), the compiler will pick the first version if x can be
- // implicitly converted to type To; otherwise it will pick the
- // second version.
- //
- // The first version returns a value of size 1, and the second
- // version returns a value of size 2. Therefore, by checking the
- // size of Helper(x), which can be done at compile time, we can tell
- // which version of Helper() is used, and hence whether x can be
- // implicitly converted to type To.
- static char Helper(To);
- static char (&Helper(...))[2]; // NOLINT
-
- // We have to put the 'public' section after the 'private' section,
- // or MSVC refuses to compile the code.
- public:
-#if defined(__BORLANDC__)
- // C++Builder cannot use member overload resolution during template
- // instantiation. The simplest workaround is to use its C++0x type traits
- // functions (C++Builder 2009 and above only).
- static const bool value = __is_convertible(From, To);
-#else
- // MSVC warns about implicitly converting from double to int for
- // possible loss of data, so we need to temporarily disable the
- // warning.
- GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244)
- static const bool value =
- sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
- GTEST_DISABLE_MSC_WARNINGS_POP_()
-#endif // __BORLANDC__
-};
-template <typename From, typename To>
-const bool ImplicitlyConvertible<From, To>::value;
-
-// IsAProtocolMessage<T>::value is a compile-time bool constant that's
-// true iff T is type ProtocolMessage, proto2::Message, or a subclass
-// of those.
-template <typename T>
-struct IsAProtocolMessage
- : public bool_constant<
- ImplicitlyConvertible<const T*, const ::ProtocolMessage*>::value ||
- ImplicitlyConvertible<const T*, const ::proto2::Message*>::value> {
-};
-
-// When the compiler sees expression IsContainerTest<C>(0), if C is an
-// STL-style container class, the first overload of IsContainerTest
-// will be viable (since both C::iterator* and C::const_iterator* are
-// valid types and NULL can be implicitly converted to them). It will
-// be picked over the second overload as 'int' is a perfect match for
-// the type of argument 0. If C::iterator or C::const_iterator is not
-// a valid type, the first overload is not viable, and the second
-// overload will be picked. Therefore, we can determine whether C is
-// a container class by checking the type of IsContainerTest<C>(0).
-// The value of the expression is insignificant.
-//
-// Note that we look for both C::iterator and C::const_iterator. The
-// reason is that C++ injects the name of a class as a member of the
-// class itself (e.g. you can refer to class iterator as either
-// 'iterator' or 'iterator::iterator'). If we look for C::iterator
-// only, for example, we would mistakenly think that a class named
-// iterator is an STL container.
-//
-// Also note that the simpler approach of overloading
-// IsContainerTest(typename C::const_iterator*) and
-// IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
-typedef int IsContainer;
-template <class C>
-IsContainer IsContainerTest(int /* dummy */,
- typename C::iterator* /* it */ = NULL,
- typename C::const_iterator* /* const_it */ = NULL) {
- return 0;
-}
-
-typedef char IsNotContainer;
-template <class C>
-IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
-
-// EnableIf<condition>::type is void when 'Cond' is true, and
-// undefined when 'Cond' is false. To use SFINAE to make a function
-// overload only apply when a particular expression is true, add
-// "typename EnableIf<expression>::type* = 0" as the last parameter.
-template<bool> struct EnableIf;
-template<> struct EnableIf<true> { typedef void type; }; // NOLINT
-
-// Utilities for native arrays.
-
-// ArrayEq() compares two k-dimensional native arrays using the
-// elements' operator==, where k can be any integer >= 0. When k is
-// 0, ArrayEq() degenerates into comparing a single pair of values.
-
-template <typename T, typename U>
-bool ArrayEq(const T* lhs, size_t size, const U* rhs);
-
-// This generic version is used when k is 0.
-template <typename T, typename U>
-inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }
-
-// This overload is used when k >= 1.
-template <typename T, typename U, size_t N>
-inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
- return internal::ArrayEq(lhs, N, rhs);
-}
-
-// This helper reduces code bloat. If we instead put its logic inside
-// the previous ArrayEq() function, arrays with different sizes would
-// lead to different copies of the template code.
-template <typename T, typename U>
-bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
- for (size_t i = 0; i != size; i++) {
- if (!internal::ArrayEq(lhs[i], rhs[i]))
- return false;
- }
- return true;
-}
-
-// Finds the first element in the iterator range [begin, end) that
-// equals elem. Element may be a native array type itself.
-template <typename Iter, typename Element>
-Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {
- for (Iter it = begin; it != end; ++it) {
- if (internal::ArrayEq(*it, elem))
- return it;
- }
- return end;
-}
-
-// CopyArray() copies a k-dimensional native array using the elements'
-// operator=, where k can be any integer >= 0. When k is 0,
-// CopyArray() degenerates into copying a single value.
-
-template <typename T, typename U>
-void CopyArray(const T* from, size_t size, U* to);
-
-// This generic version is used when k is 0.
-template <typename T, typename U>
-inline void CopyArray(const T& from, U* to) { *to = from; }
-
-// This overload is used when k >= 1.
-template <typename T, typename U, size_t N>
-inline void CopyArray(const T(&from)[N], U(*to)[N]) {
- internal::CopyArray(from, N, *to);
-}
-
-// This helper reduces code bloat. If we instead put its logic inside
-// the previous CopyArray() function, arrays with different sizes
-// would lead to different copies of the template code.
-template <typename T, typename U>
-void CopyArray(const T* from, size_t size, U* to) {
- for (size_t i = 0; i != size; i++) {
- internal::CopyArray(from[i], to + i);
- }
-}
-
-// The relation between an NativeArray object (see below) and the
-// native array it represents.
-// We use 2 different structs to allow non-copyable types to be used, as long
-// as RelationToSourceReference() is passed.
-struct RelationToSourceReference {};
-struct RelationToSourceCopy {};
-
-// Adapts a native array to a read-only STL-style container. Instead
-// of the complete STL container concept, this adaptor only implements
-// members useful for Google Mock's container matchers. New members
-// should be added as needed. To simplify the implementation, we only
-// support Element being a raw type (i.e. having no top-level const or
-// reference modifier). It's the client's responsibility to satisfy
-// this requirement. Element can be an array type itself (hence
-// multi-dimensional arrays are supported).
-template <typename Element>
-class NativeArray {
- public:
- // STL-style container typedefs.
- typedef Element value_type;
- typedef Element* iterator;
- typedef const Element* const_iterator;
-
- // Constructs from a native array. References the source.
- NativeArray(const Element* array, size_t count, RelationToSourceReference) {
- InitRef(array, count);
- }
-
- // Constructs from a native array. Copies the source.
- NativeArray(const Element* array, size_t count, RelationToSourceCopy) {
- InitCopy(array, count);
- }
-
- // Copy constructor.
- NativeArray(const NativeArray& rhs) {
- (this->*rhs.clone_)(rhs.array_, rhs.size_);
- }
-
- ~NativeArray() {
- if (clone_ != &NativeArray::InitRef)
- delete[] array_;
- }
-
- // STL-style container methods.
- size_t size() const { return size_; }
- const_iterator begin() const { return array_; }
- const_iterator end() const { return array_ + size_; }
- bool operator==(const NativeArray& rhs) const {
- return size() == rhs.size() &&
- ArrayEq(begin(), size(), rhs.begin());
- }
-
- private:
- enum {
- kCheckTypeIsNotConstOrAReference = StaticAssertTypeEqHelper<
- Element, GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>::value,
- };
-
- // Initializes this object with a copy of the input.
- void InitCopy(const Element* array, size_t a_size) {
- Element* const copy = new Element[a_size];
- CopyArray(array, a_size, copy);
- array_ = copy;
- size_ = a_size;
- clone_ = &NativeArray::InitCopy;
- }
-
- // Initializes this object with a reference of the input.
- void InitRef(const Element* array, size_t a_size) {
- array_ = array;
- size_ = a_size;
- clone_ = &NativeArray::InitRef;
- }
-
- const Element* array_;
- size_t size_;
- void (NativeArray::*clone_)(const Element*, size_t);
-
- GTEST_DISALLOW_ASSIGN_(NativeArray);
-};
-
-} // namespace internal
-} // namespace testing
-
-#define GTEST_MESSAGE_AT_(file, line, message, result_type) \
- ::testing::internal::AssertHelper(result_type, file, line, message) \
- = ::testing::Message()
-
-#define GTEST_MESSAGE_(message, result_type) \
- GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
-
-#define GTEST_FATAL_FAILURE_(message) \
- return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
-
-#define GTEST_NONFATAL_FAILURE_(message) \
- GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
-
-#define GTEST_SUCCESS_(message) \
- GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
-
-// Suppresses MSVC warnings 4072 (unreachable code) for the code following
-// statement if it returns or throws (or doesn't return or throw in some
-// situations).
-#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
- if (::testing::internal::AlwaysTrue()) { statement; }
-
-#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::ConstCharPtr gtest_msg = "") { \
- bool gtest_caught_expected = false; \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } \
- catch (expected_exception const&) { \
- gtest_caught_expected = true; \
- } \
- catch (...) { \
- gtest_msg.value = \
- "Expected: " #statement " throws an exception of type " \
- #expected_exception ".\n Actual: it throws a different type."; \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
- } \
- if (!gtest_caught_expected) { \
- gtest_msg.value = \
- "Expected: " #statement " throws an exception of type " \
- #expected_exception ".\n Actual: it throws nothing."; \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
- fail(gtest_msg.value)
-
-#define GTEST_TEST_NO_THROW_(statement, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } \
- catch (...) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
- fail("Expected: " #statement " doesn't throw an exception.\n" \
- " Actual: it throws.")
-
-#define GTEST_TEST_ANY_THROW_(statement, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- bool gtest_caught_any = false; \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } \
- catch (...) { \
- gtest_caught_any = true; \
- } \
- if (!gtest_caught_any) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
- fail("Expected: " #statement " throws an exception.\n" \
- " Actual: it doesn't.")
-
-
-// Implements Boolean test assertions such as EXPECT_TRUE. expression can be
-// either a boolean expression or an AssertionResult. text is a textual
-// represenation of expression as it was passed into the EXPECT_TRUE.
-#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (const ::testing::AssertionResult gtest_ar_ = \
- ::testing::AssertionResult(expression)) \
- ; \
- else \
- fail(::testing::internal::GetBoolAssertionFailureMessage(\
- gtest_ar_, text, #actual, #expected).c_str())
-
-#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
- fail("Expected: " #statement " doesn't generate new fatal " \
- "failures in the current thread.\n" \
- " Actual: it does.")
-
-// Expands to the name of the class that implements the given test.
-#define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
- test_case_name##_##test_name##_Test
-
-// Helper macro for defining tests.
-#define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\
-class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
- public:\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
- private:\
- virtual void TestBody();\
- static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
- GTEST_DISALLOW_COPY_AND_ASSIGN_(\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
-};\
-\
-::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
- ::test_info_ =\
- ::testing::internal::MakeAndRegisterTestInfo(\
- #test_case_name, #test_name, NULL, NULL, \
- (parent_id), \
- parent_class::SetUpTestCase, \
- parent_class::TearDownTestCase, \
- new ::testing::internal::TestFactoryImpl<\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
-void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
-
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-linked_ptr.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-linked_ptr.h
deleted file mode 100644
index b1362cd..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-linked_ptr.h
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright 2003 Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: Dan Egnor (egnor@google.com)
-//
-// A "smart" pointer type with reference tracking. Every pointer to a
-// particular object is kept on a circular linked list. When the last pointer
-// to an object is destroyed or reassigned, the object is deleted.
-//
-// Used properly, this deletes the object when the last reference goes away.
-// There are several caveats:
-// - Like all reference counting schemes, cycles lead to leaks.
-// - Each smart pointer is actually two pointers (8 bytes instead of 4).
-// - Every time a pointer is assigned, the entire list of pointers to that
-// object is traversed. This class is therefore NOT SUITABLE when there
-// will often be more than two or three pointers to a particular object.
-// - References are only tracked as long as linked_ptr<> objects are copied.
-// If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS
-// will happen (double deletion).
-//
-// A good use of this class is storing object references in STL containers.
-// You can safely put linked_ptr<> in a vector<>.
-// Other uses may not be as good.
-//
-// Note: If you use an incomplete type with linked_ptr<>, the class
-// *containing* linked_ptr<> must have a constructor and destructor (even
-// if they do nothing!).
-//
-// Bill Gibbons suggested we use something like this.
-//
-// Thread Safety:
-// Unlike other linked_ptr implementations, in this implementation
-// a linked_ptr object is thread-safe in the sense that:
-// - it's safe to copy linked_ptr objects concurrently,
-// - it's safe to copy *from* a linked_ptr and read its underlying
-// raw pointer (e.g. via get()) concurrently, and
-// - it's safe to write to two linked_ptrs that point to the same
-// shared object concurrently.
-// TODO(wan@google.com): rename this to safe_linked_ptr to avoid
-// confusion with normal linked_ptr.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
-
-#include <stdlib.h>
-#include <assert.h>
-
-#include "gtest/internal/gtest-port.h"
-
-namespace testing {
-namespace internal {
-
-// Protects copying of all linked_ptr objects.
-GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex);
-
-// This is used internally by all instances of linked_ptr<>. It needs to be
-// a non-template class because different types of linked_ptr<> can refer to
-// the same object (linked_ptr<Superclass>(obj) vs linked_ptr<Subclass>(obj)).
-// So, it needs to be possible for different types of linked_ptr to participate
-// in the same circular linked list, so we need a single class type here.
-//
-// DO NOT USE THIS CLASS DIRECTLY YOURSELF. Use linked_ptr<T>.
-class linked_ptr_internal {
- public:
- // Create a new circle that includes only this instance.
- void join_new() {
- next_ = this;
- }
-
- // Many linked_ptr operations may change p.link_ for some linked_ptr
- // variable p in the same circle as this object. Therefore we need
- // to prevent two such operations from occurring concurrently.
- //
- // Note that different types of linked_ptr objects can coexist in a
- // circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and
- // linked_ptr<Derived2>). Therefore we must use a single mutex to
- // protect all linked_ptr objects. This can create serious
- // contention in production code, but is acceptable in a testing
- // framework.
-
- // Join an existing circle.
- void join(linked_ptr_internal const* ptr)
- GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
- MutexLock lock(&g_linked_ptr_mutex);
-
- linked_ptr_internal const* p = ptr;
- while (p->next_ != ptr) p = p->next_;
- p->next_ = this;
- next_ = ptr;
- }
-
- // Leave whatever circle we're part of. Returns true if we were the
- // last member of the circle. Once this is done, you can join() another.
- bool depart()
- GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
- MutexLock lock(&g_linked_ptr_mutex);
-
- if (next_ == this) return true;
- linked_ptr_internal const* p = next_;
- while (p->next_ != this) p = p->next_;
- p->next_ = next_;
- return false;
- }
-
- private:
- mutable linked_ptr_internal const* next_;
-};
-
-template <typename T>
-class linked_ptr {
- public:
- typedef T element_type;
-
- // Take over ownership of a raw pointer. This should happen as soon as
- // possible after the object is created.
- explicit linked_ptr(T* ptr = NULL) { capture(ptr); }
- ~linked_ptr() { depart(); }
-
- // Copy an existing linked_ptr<>, adding ourselves to the list of references.
- template <typename U> linked_ptr(linked_ptr<U> const& ptr) { copy(&ptr); }
- linked_ptr(linked_ptr const& ptr) { // NOLINT
- assert(&ptr != this);
- copy(&ptr);
- }
-
- // Assignment releases the old value and acquires the new.
- template <typename U> linked_ptr& operator=(linked_ptr<U> const& ptr) {
- depart();
- copy(&ptr);
- return *this;
- }
-
- linked_ptr& operator=(linked_ptr const& ptr) {
- if (&ptr != this) {
- depart();
- copy(&ptr);
- }
- return *this;
- }
-
- // Smart pointer members.
- void reset(T* ptr = NULL) {
- depart();
- capture(ptr);
- }
- T* get() const { return value_; }
- T* operator->() const { return value_; }
- T& operator*() const { return *value_; }
-
- bool operator==(T* p) const { return value_ == p; }
- bool operator!=(T* p) const { return value_ != p; }
- template <typename U>
- bool operator==(linked_ptr<U> const& ptr) const {
- return value_ == ptr.get();
- }
- template <typename U>
- bool operator!=(linked_ptr<U> const& ptr) const {
- return value_ != ptr.get();
- }
-
- private:
- template <typename U>
- friend class linked_ptr;
-
- T* value_;
- linked_ptr_internal link_;
-
- void depart() {
- if (link_.depart()) delete value_;
- }
-
- void capture(T* ptr) {
- value_ = ptr;
- link_.join_new();
- }
-
- template <typename U> void copy(linked_ptr<U> const* ptr) {
- value_ = ptr->get();
- if (value_)
- link_.join(&ptr->link_);
- else
- link_.join_new();
- }
-};
-
-template<typename T> inline
-bool operator==(T* ptr, const linked_ptr<T>& x) {
- return ptr == x.get();
-}
-
-template<typename T> inline
-bool operator!=(T* ptr, const linked_ptr<T>& x) {
- return ptr != x.get();
-}
-
-// A function to convert T* into linked_ptr<T>
-// Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation
-// for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
-template <typename T>
-linked_ptr<T> make_linked_ptr(T* ptr) {
- return linked_ptr<T>(ptr);
-}
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-param-util-generated.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-param-util-generated.h
deleted file mode 100644
index 6dbaf4b..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-param-util-generated.h
+++ /dev/null
@@ -1,5143 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gtest-param-util-generated.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: vladl@google.com (Vlad Losev)
-
-// Type and function utilities for implementing parameterized tests.
-// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-// Currently Google Test supports at most 50 arguments in Values,
-// and at most 10 arguments in Combine. Please contact
-// googletestframework@googlegroups.com if you need more.
-// Please note that the number of arguments to Combine is limited
-// by the maximum arity of the implementation of tuple which is
-// currently set at 10.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-param-util.h"
-#include "gtest/internal/gtest-port.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Forward declarations of ValuesIn(), which is implemented in
-// include/gtest/gtest-param-test.h.
-template <typename ForwardIterator>
-internal::ParamGenerator<
- typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
-ValuesIn(ForwardIterator begin, ForwardIterator end);
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]);
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
- const Container& container);
-
-namespace internal {
-
-// Used in the Values() function to provide polymorphic capabilities.
-template <typename T1>
-class ValueArray1 {
- public:
- explicit ValueArray1(T1 v1) : v1_(v1) {}
-
- template <typename T>
- operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray1& other);
-
- const T1 v1_;
-};
-
-template <typename T1, typename T2>
-class ValueArray2 {
- public:
- ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray2& other);
-
- const T1 v1_;
- const T2 v2_;
-};
-
-template <typename T1, typename T2, typename T3>
-class ValueArray3 {
- public:
- ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray3& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4>
-class ValueArray4 {
- public:
- ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray4& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-class ValueArray5 {
- public:
- ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray5& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-class ValueArray6 {
- public:
- ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray6& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-class ValueArray7 {
- public:
- ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray7& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-class ValueArray8 {
- public:
- ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray8& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-class ValueArray9 {
- public:
- ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray9& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-class ValueArray10 {
- public:
- ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray10& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-class ValueArray11 {
- public:
- ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray11& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-class ValueArray12 {
- public:
- ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray12& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-class ValueArray13 {
- public:
- ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray13& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-class ValueArray14 {
- public:
- ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray14& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-class ValueArray15 {
- public:
- ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray15& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-class ValueArray16 {
- public:
- ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray16& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-class ValueArray17 {
- public:
- ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
- T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray17& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-class ValueArray18 {
- public:
- ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray18& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-class ValueArray19 {
- public:
- ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray19& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-class ValueArray20 {
- public:
- ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray20& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-class ValueArray21 {
- public:
- ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray21& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-class ValueArray22 {
- public:
- ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray22& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-class ValueArray23 {
- public:
- ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray23& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-class ValueArray24 {
- public:
- ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray24& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-class ValueArray25 {
- public:
- ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
- T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray25& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-class ValueArray26 {
- public:
- ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray26& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-class ValueArray27 {
- public:
- ValueArray27(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
- v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
- v26_(v26), v27_(v27) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray27& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-class ValueArray28 {
- public:
- ValueArray28(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
- v25_(v25), v26_(v26), v27_(v27), v28_(v28) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray28& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-class ValueArray29 {
- public:
- ValueArray29(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
- v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray29& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-class ValueArray30 {
- public:
- ValueArray30(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray30& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-class ValueArray31 {
- public:
- ValueArray31(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray31& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-class ValueArray32 {
- public:
- ValueArray32(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
- v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray32& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-class ValueArray33 {
- public:
- ValueArray33(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
- T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray33& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-class ValueArray34 {
- public:
- ValueArray34(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray34& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-class ValueArray35 {
- public:
- ValueArray35(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
- v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
- v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
- v32_(v32), v33_(v33), v34_(v34), v35_(v35) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray35& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-class ValueArray36 {
- public:
- ValueArray36(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
- v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
- v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray36& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-class ValueArray37 {
- public:
- ValueArray37(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
- v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
- v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
- v36_(v36), v37_(v37) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray37& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-class ValueArray38 {
- public:
- ValueArray38(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray38& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-class ValueArray39 {
- public:
- ValueArray39(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray39& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-class ValueArray40 {
- public:
- ValueArray40(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
- v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
- v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
- v40_(v40) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray40& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-class ValueArray41 {
- public:
- ValueArray41(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
- T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray41& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-class ValueArray42 {
- public:
- ValueArray42(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41), v42_(v42) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray42& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-class ValueArray43 {
- public:
- ValueArray43(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
- v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
- v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
- v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37),
- v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray43& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-class ValueArray44 {
- public:
- ValueArray44(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
- v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
- v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36),
- v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42),
- v43_(v43), v44_(v44) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray44& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-class ValueArray45 {
- public:
- ValueArray45(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
- v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
- v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
- v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41),
- v42_(v42), v43_(v43), v44_(v44), v45_(v45) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray45& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-class ValueArray46 {
- public:
- ValueArray46(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
- v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray46& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-class ValueArray47 {
- public:
- ValueArray47(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
- v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46),
- v47_(v47) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray47& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-class ValueArray48 {
- public:
- ValueArray48(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
- v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
- v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
- v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45),
- v46_(v46), v47_(v47), v48_(v48) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
- static_cast<T>(v48_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray48& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
- const T48 v48_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-class ValueArray49 {
- public:
- ValueArray49(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48,
- T49 v49) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
- v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
- static_cast<T>(v48_), static_cast<T>(v49_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray49& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
- const T48 v48_;
- const T49 v49_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-class ValueArray50 {
- public:
- ValueArray50(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49,
- T50 v50) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
- v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
- static_cast<T>(v48_), static_cast<T>(v49_), static_cast<T>(v50_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray50& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
- const T48 v48_;
- const T49 v49_;
- const T50 v50_;
-};
-
-# if GTEST_HAS_COMBINE
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Generates values from the Cartesian product of values produced
-// by the argument generators.
-//
-template <typename T1, typename T2>
-class CartesianProductGenerator2
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2> > {
- public:
- typedef ::testing::tuple<T1, T2> ParamType;
-
- CartesianProductGenerator2(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2)
- : g1_(g1), g2_(g2) {}
- virtual ~CartesianProductGenerator2() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current2_;
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- ParamType current_value_;
- }; // class CartesianProductGenerator2::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator2& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
-}; // class CartesianProductGenerator2
-
-
-template <typename T1, typename T2, typename T3>
-class CartesianProductGenerator3
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3> > {
- public:
- typedef ::testing::tuple<T1, T2, T3> ParamType;
-
- CartesianProductGenerator3(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3)
- : g1_(g1), g2_(g2), g3_(g3) {}
- virtual ~CartesianProductGenerator3() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current3_;
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- ParamType current_value_;
- }; // class CartesianProductGenerator3::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator3& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
-}; // class CartesianProductGenerator3
-
-
-template <typename T1, typename T2, typename T3, typename T4>
-class CartesianProductGenerator4
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4> > {
- public:
- typedef ::testing::tuple<T1, T2, T3, T4> ParamType;
-
- CartesianProductGenerator4(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
- virtual ~CartesianProductGenerator4() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current4_;
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- ParamType current_value_;
- }; // class CartesianProductGenerator4::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator4& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
-}; // class CartesianProductGenerator4
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-class CartesianProductGenerator5
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5> > {
- public:
- typedef ::testing::tuple<T1, T2, T3, T4, T5> ParamType;
-
- CartesianProductGenerator5(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
- virtual ~CartesianProductGenerator5() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current5_;
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- ParamType current_value_;
- }; // class CartesianProductGenerator5::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator5& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
-}; // class CartesianProductGenerator5
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-class CartesianProductGenerator6
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5,
- T6> > {
- public:
- typedef ::testing::tuple<T1, T2, T3, T4, T5, T6> ParamType;
-
- CartesianProductGenerator6(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
- virtual ~CartesianProductGenerator6() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current6_;
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- ParamType current_value_;
- }; // class CartesianProductGenerator6::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator6& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
-}; // class CartesianProductGenerator6
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-class CartesianProductGenerator7
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
- T7> > {
- public:
- typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;
-
- CartesianProductGenerator7(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
- virtual ~CartesianProductGenerator7() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current7_;
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- ParamType current_value_;
- }; // class CartesianProductGenerator7::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator7& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
-}; // class CartesianProductGenerator7
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-class CartesianProductGenerator8
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
- T7, T8> > {
- public:
- typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;
-
- CartesianProductGenerator8(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
- const ParamGenerator<T8>& g8)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
- g8_(g8) {}
- virtual ~CartesianProductGenerator8() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin(), g8_, g8_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
- g8_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7,
- const ParamGenerator<T8>& g8,
- const typename ParamGenerator<T8>::iterator& current8)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
- begin8_(g8.begin()), end8_(g8.end()), current8_(current8) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current8_;
- if (current8_ == end8_) {
- current8_ = begin8_;
- ++current7_;
- }
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_ &&
- current8_ == typed_other->current8_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_),
- begin8_(other.begin8_),
- end8_(other.end8_),
- current8_(other.current8_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_, *current8_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_ ||
- current8_ == end8_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- const typename ParamGenerator<T8>::iterator begin8_;
- const typename ParamGenerator<T8>::iterator end8_;
- typename ParamGenerator<T8>::iterator current8_;
- ParamType current_value_;
- }; // class CartesianProductGenerator8::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator8& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
- const ParamGenerator<T8> g8_;
-}; // class CartesianProductGenerator8
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-class CartesianProductGenerator9
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
- T7, T8, T9> > {
- public:
- typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;
-
- CartesianProductGenerator9(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
- const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9) {}
- virtual ~CartesianProductGenerator9() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
- g8_.end(), g9_, g9_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7,
- const ParamGenerator<T8>& g8,
- const typename ParamGenerator<T8>::iterator& current8,
- const ParamGenerator<T9>& g9,
- const typename ParamGenerator<T9>::iterator& current9)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
- begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
- begin9_(g9.begin()), end9_(g9.end()), current9_(current9) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current9_;
- if (current9_ == end9_) {
- current9_ = begin9_;
- ++current8_;
- }
- if (current8_ == end8_) {
- current8_ = begin8_;
- ++current7_;
- }
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_ &&
- current8_ == typed_other->current8_ &&
- current9_ == typed_other->current9_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_),
- begin8_(other.begin8_),
- end8_(other.end8_),
- current8_(other.current8_),
- begin9_(other.begin9_),
- end9_(other.end9_),
- current9_(other.current9_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_, *current8_,
- *current9_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_ ||
- current8_ == end8_ ||
- current9_ == end9_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- const typename ParamGenerator<T8>::iterator begin8_;
- const typename ParamGenerator<T8>::iterator end8_;
- typename ParamGenerator<T8>::iterator current8_;
- const typename ParamGenerator<T9>::iterator begin9_;
- const typename ParamGenerator<T9>::iterator end9_;
- typename ParamGenerator<T9>::iterator current9_;
- ParamType current_value_;
- }; // class CartesianProductGenerator9::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator9& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
- const ParamGenerator<T8> g8_;
- const ParamGenerator<T9> g9_;
-}; // class CartesianProductGenerator9
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-class CartesianProductGenerator10
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
- T7, T8, T9, T10> > {
- public:
- typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;
-
- CartesianProductGenerator10(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
- const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9,
- const ParamGenerator<T10>& g10)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9), g10_(g10) {}
- virtual ~CartesianProductGenerator10() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
- g8_.end(), g9_, g9_.end(), g10_, g10_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7,
- const ParamGenerator<T8>& g8,
- const typename ParamGenerator<T8>::iterator& current8,
- const ParamGenerator<T9>& g9,
- const typename ParamGenerator<T9>::iterator& current9,
- const ParamGenerator<T10>& g10,
- const typename ParamGenerator<T10>::iterator& current10)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
- begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
- begin9_(g9.begin()), end9_(g9.end()), current9_(current9),
- begin10_(g10.begin()), end10_(g10.end()), current10_(current10) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current10_;
- if (current10_ == end10_) {
- current10_ = begin10_;
- ++current9_;
- }
- if (current9_ == end9_) {
- current9_ = begin9_;
- ++current8_;
- }
- if (current8_ == end8_) {
- current8_ = begin8_;
- ++current7_;
- }
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_ &&
- current8_ == typed_other->current8_ &&
- current9_ == typed_other->current9_ &&
- current10_ == typed_other->current10_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_),
- begin8_(other.begin8_),
- end8_(other.end8_),
- current8_(other.current8_),
- begin9_(other.begin9_),
- end9_(other.end9_),
- current9_(other.current9_),
- begin10_(other.begin10_),
- end10_(other.end10_),
- current10_(other.current10_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_, *current8_,
- *current9_, *current10_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_ ||
- current8_ == end8_ ||
- current9_ == end9_ ||
- current10_ == end10_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- const typename ParamGenerator<T8>::iterator begin8_;
- const typename ParamGenerator<T8>::iterator end8_;
- typename ParamGenerator<T8>::iterator current8_;
- const typename ParamGenerator<T9>::iterator begin9_;
- const typename ParamGenerator<T9>::iterator end9_;
- typename ParamGenerator<T9>::iterator current9_;
- const typename ParamGenerator<T10>::iterator begin10_;
- const typename ParamGenerator<T10>::iterator end10_;
- typename ParamGenerator<T10>::iterator current10_;
- ParamType current_value_;
- }; // class CartesianProductGenerator10::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator10& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
- const ParamGenerator<T8> g8_;
- const ParamGenerator<T9> g9_;
- const ParamGenerator<T10> g10_;
-}; // class CartesianProductGenerator10
-
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Helper classes providing Combine() with polymorphic features. They allow
-// casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
-// convertible to U.
-//
-template <class Generator1, class Generator2>
-class CartesianProductHolder2 {
- public:
-CartesianProductHolder2(const Generator1& g1, const Generator2& g2)
- : g1_(g1), g2_(g2) {}
- template <typename T1, typename T2>
- operator ParamGenerator< ::testing::tuple<T1, T2> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2> >(
- new CartesianProductGenerator2<T1, T2>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder2& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
-}; // class CartesianProductHolder2
-
-template <class Generator1, class Generator2, class Generator3>
-class CartesianProductHolder3 {
- public:
-CartesianProductHolder3(const Generator1& g1, const Generator2& g2,
- const Generator3& g3)
- : g1_(g1), g2_(g2), g3_(g3) {}
- template <typename T1, typename T2, typename T3>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3> >(
- new CartesianProductGenerator3<T1, T2, T3>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder3& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
-}; // class CartesianProductHolder3
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4>
-class CartesianProductHolder4 {
- public:
-CartesianProductHolder4(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
- template <typename T1, typename T2, typename T3, typename T4>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3, T4> >(
- new CartesianProductGenerator4<T1, T2, T3, T4>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder4& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
-}; // class CartesianProductHolder4
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5>
-class CartesianProductHolder5 {
- public:
-CartesianProductHolder5(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5> >(
- new CartesianProductGenerator5<T1, T2, T3, T4, T5>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder5& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
-}; // class CartesianProductHolder5
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6>
-class CartesianProductHolder6 {
- public:
-CartesianProductHolder6(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6> >(
- new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder6& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
-}; // class CartesianProductHolder6
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7>
-class CartesianProductHolder7 {
- public:
-CartesianProductHolder7(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6,
- T7> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7> >(
- new CartesianProductGenerator7<T1, T2, T3, T4, T5, T6, T7>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder7& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
-}; // class CartesianProductHolder7
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7,
- class Generator8>
-class CartesianProductHolder8 {
- public:
-CartesianProductHolder8(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7, const Generator8& g8)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
- g8_(g8) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7,
- T8> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >(
- new CartesianProductGenerator8<T1, T2, T3, T4, T5, T6, T7, T8>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_),
- static_cast<ParamGenerator<T8> >(g8_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder8& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
- const Generator8 g8_;
-}; // class CartesianProductHolder8
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7,
- class Generator8, class Generator9>
-class CartesianProductHolder9 {
- public:
-CartesianProductHolder9(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7, const Generator8& g8,
- const Generator9& g9)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
- T9> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
- T9> >(
- new CartesianProductGenerator9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_),
- static_cast<ParamGenerator<T8> >(g8_),
- static_cast<ParamGenerator<T9> >(g9_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder9& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
- const Generator8 g8_;
- const Generator9 g9_;
-}; // class CartesianProductHolder9
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7,
- class Generator8, class Generator9, class Generator10>
-class CartesianProductHolder10 {
- public:
-CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7, const Generator8& g8,
- const Generator9& g9, const Generator10& g10)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9), g10_(g10) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9,
- T10> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9,
- T10> >(
- new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
- T10>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_),
- static_cast<ParamGenerator<T8> >(g8_),
- static_cast<ParamGenerator<T9> >(g9_),
- static_cast<ParamGenerator<T10> >(g10_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder10& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
- const Generator8 g8_;
- const Generator9 g9_;
- const Generator10 g10_;
-}; // class CartesianProductHolder10
-
-# endif // GTEST_HAS_COMBINE
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-param-util-generated.h.pump b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-param-util-generated.h.pump
deleted file mode 100644
index 801a2fc..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-param-util-generated.h.pump
+++ /dev/null
@@ -1,301 +0,0 @@
-$$ -*- mode: c++; -*-
-$var n = 50 $$ Maximum length of Values arguments we want to support.
-$var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: vladl@google.com (Vlad Losev)
-
-// Type and function utilities for implementing parameterized tests.
-// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-// Currently Google Test supports at most $n arguments in Values,
-// and at most $maxtuple arguments in Combine. Please contact
-// googletestframework@googlegroups.com if you need more.
-// Please note that the number of arguments to Combine is limited
-// by the maximum arity of the implementation of tuple which is
-// currently set at $maxtuple.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-param-util.h"
-#include "gtest/internal/gtest-port.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Forward declarations of ValuesIn(), which is implemented in
-// include/gtest/gtest-param-test.h.
-template <typename ForwardIterator>
-internal::ParamGenerator<
- typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
-ValuesIn(ForwardIterator begin, ForwardIterator end);
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]);
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
- const Container& container);
-
-namespace internal {
-
-// Used in the Values() function to provide polymorphic capabilities.
-template <typename T1>
-class ValueArray1 {
- public:
- explicit ValueArray1(T1 v1) : v1_(v1) {}
-
- template <typename T>
- operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray1& other);
-
- const T1 v1_;
-};
-
-$range i 2..n
-$for i [[
-$range j 1..i
-
-template <$for j, [[typename T$j]]>
-class ValueArray$i {
- public:
- ValueArray$i($for j, [[T$j v$j]]) : $for j, [[v$(j)_(v$j)]] {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {$for j, [[static_cast<T>(v$(j)_)]]};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray$i& other);
-
-$for j [[
-
- const T$j v$(j)_;
-]]
-
-};
-
-]]
-
-# if GTEST_HAS_COMBINE
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Generates values from the Cartesian product of values produced
-// by the argument generators.
-//
-$range i 2..maxtuple
-$for i [[
-$range j 1..i
-$range k 2..i
-
-template <$for j, [[typename T$j]]>
-class CartesianProductGenerator$i
- : public ParamGeneratorInterface< ::testing::tuple<$for j, [[T$j]]> > {
- public:
- typedef ::testing::tuple<$for j, [[T$j]]> ParamType;
-
- CartesianProductGenerator$i($for j, [[const ParamGenerator<T$j>& g$j]])
- : $for j, [[g$(j)_(g$j)]] {}
- virtual ~CartesianProductGenerator$i() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, $for j, [[g$(j)_, g$(j)_.begin()]]);
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, $for j, [[g$(j)_, g$(j)_.end()]]);
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base, $for j, [[
-
- const ParamGenerator<T$j>& g$j,
- const typename ParamGenerator<T$j>::iterator& current$(j)]])
- : base_(base),
-$for j, [[
-
- begin$(j)_(g$j.begin()), end$(j)_(g$j.end()), current$(j)_(current$j)
-]] {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current$(i)_;
-
-$for k [[
- if (current$(i+2-k)_ == end$(i+2-k)_) {
- current$(i+2-k)_ = begin$(i+2-k)_;
- ++current$(i+2-k-1)_;
- }
-
-]]
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- ($for j && [[
-
- current$(j)_ == typed_other->current$(j)_
-]]);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_), $for j, [[
-
- begin$(j)_(other.begin$(j)_),
- end$(j)_(other.end$(j)_),
- current$(j)_(other.current$(j)_)
-]] {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType($for j, [[*current$(j)_]]);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
-$for j || [[
-
- current$(j)_ == end$(j)_
-]];
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
-$for j [[
-
- const typename ParamGenerator<T$j>::iterator begin$(j)_;
- const typename ParamGenerator<T$j>::iterator end$(j)_;
- typename ParamGenerator<T$j>::iterator current$(j)_;
-]]
-
- ParamType current_value_;
- }; // class CartesianProductGenerator$i::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator$i& other);
-
-
-$for j [[
- const ParamGenerator<T$j> g$(j)_;
-
-]]
-}; // class CartesianProductGenerator$i
-
-
-]]
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Helper classes providing Combine() with polymorphic features. They allow
-// casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
-// convertible to U.
-//
-$range i 2..maxtuple
-$for i [[
-$range j 1..i
-
-template <$for j, [[class Generator$j]]>
-class CartesianProductHolder$i {
- public:
-CartesianProductHolder$i($for j, [[const Generator$j& g$j]])
- : $for j, [[g$(j)_(g$j)]] {}
- template <$for j, [[typename T$j]]>
- operator ParamGenerator< ::testing::tuple<$for j, [[T$j]]> >() const {
- return ParamGenerator< ::testing::tuple<$for j, [[T$j]]> >(
- new CartesianProductGenerator$i<$for j, [[T$j]]>(
-$for j,[[
-
- static_cast<ParamGenerator<T$j> >(g$(j)_)
-]]));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder$i& other);
-
-
-$for j [[
- const Generator$j g$(j)_;
-
-]]
-}; // class CartesianProductHolder$i
-
-]]
-
-# endif // GTEST_HAS_COMBINE
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-param-util.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-param-util.h
deleted file mode 100644
index d5e1028..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-param-util.h
+++ /dev/null
@@ -1,619 +0,0 @@
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: vladl@google.com (Vlad Losev)
-
-// Type and function utilities for implementing parameterized tests.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
-
-#include <iterator>
-#include <utility>
-#include <vector>
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-linked_ptr.h"
-#include "gtest/internal/gtest-port.h"
-#include "gtest/gtest-printers.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-namespace internal {
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Outputs a message explaining invalid registration of different
-// fixture class for the same test case. This may happen when
-// TEST_P macro is used to define two tests with the same name
-// but in different namespaces.
-GTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name,
- const char* file, int line);
-
-template <typename> class ParamGeneratorInterface;
-template <typename> class ParamGenerator;
-
-// Interface for iterating over elements provided by an implementation
-// of ParamGeneratorInterface<T>.
-template <typename T>
-class ParamIteratorInterface {
- public:
- virtual ~ParamIteratorInterface() {}
- // A pointer to the base generator instance.
- // Used only for the purposes of iterator comparison
- // to make sure that two iterators belong to the same generator.
- virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;
- // Advances iterator to point to the next element
- // provided by the generator. The caller is responsible
- // for not calling Advance() on an iterator equal to
- // BaseGenerator()->End().
- virtual void Advance() = 0;
- // Clones the iterator object. Used for implementing copy semantics
- // of ParamIterator<T>.
- virtual ParamIteratorInterface* Clone() const = 0;
- // Dereferences the current iterator and provides (read-only) access
- // to the pointed value. It is the caller's responsibility not to call
- // Current() on an iterator equal to BaseGenerator()->End().
- // Used for implementing ParamGenerator<T>::operator*().
- virtual const T* Current() const = 0;
- // Determines whether the given iterator and other point to the same
- // element in the sequence generated by the generator.
- // Used for implementing ParamGenerator<T>::operator==().
- virtual bool Equals(const ParamIteratorInterface& other) const = 0;
-};
-
-// Class iterating over elements provided by an implementation of
-// ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>
-// and implements the const forward iterator concept.
-template <typename T>
-class ParamIterator {
- public:
- typedef T value_type;
- typedef const T& reference;
- typedef ptrdiff_t difference_type;
-
- // ParamIterator assumes ownership of the impl_ pointer.
- ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
- ParamIterator& operator=(const ParamIterator& other) {
- if (this != &other)
- impl_.reset(other.impl_->Clone());
- return *this;
- }
-
- const T& operator*() const { return *impl_->Current(); }
- const T* operator->() const { return impl_->Current(); }
- // Prefix version of operator++.
- ParamIterator& operator++() {
- impl_->Advance();
- return *this;
- }
- // Postfix version of operator++.
- ParamIterator operator++(int /*unused*/) {
- ParamIteratorInterface<T>* clone = impl_->Clone();
- impl_->Advance();
- return ParamIterator(clone);
- }
- bool operator==(const ParamIterator& other) const {
- return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);
- }
- bool operator!=(const ParamIterator& other) const {
- return !(*this == other);
- }
-
- private:
- friend class ParamGenerator<T>;
- explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
- scoped_ptr<ParamIteratorInterface<T> > impl_;
-};
-
-// ParamGeneratorInterface<T> is the binary interface to access generators
-// defined in other translation units.
-template <typename T>
-class ParamGeneratorInterface {
- public:
- typedef T ParamType;
-
- virtual ~ParamGeneratorInterface() {}
-
- // Generator interface definition
- virtual ParamIteratorInterface<T>* Begin() const = 0;
- virtual ParamIteratorInterface<T>* End() const = 0;
-};
-
-// Wraps ParamGeneratorInterface<T> and provides general generator syntax
-// compatible with the STL Container concept.
-// This class implements copy initialization semantics and the contained
-// ParamGeneratorInterface<T> instance is shared among all copies
-// of the original object. This is possible because that instance is immutable.
-template<typename T>
-class ParamGenerator {
- public:
- typedef ParamIterator<T> iterator;
-
- explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}
- ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}
-
- ParamGenerator& operator=(const ParamGenerator& other) {
- impl_ = other.impl_;
- return *this;
- }
-
- iterator begin() const { return iterator(impl_->Begin()); }
- iterator end() const { return iterator(impl_->End()); }
-
- private:
- linked_ptr<const ParamGeneratorInterface<T> > impl_;
-};
-
-// Generates values from a range of two comparable values. Can be used to
-// generate sequences of user-defined types that implement operator+() and
-// operator<().
-// This class is used in the Range() function.
-template <typename T, typename IncrementT>
-class RangeGenerator : public ParamGeneratorInterface<T> {
- public:
- RangeGenerator(T begin, T end, IncrementT step)
- : begin_(begin), end_(end),
- step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}
- virtual ~RangeGenerator() {}
-
- virtual ParamIteratorInterface<T>* Begin() const {
- return new Iterator(this, begin_, 0, step_);
- }
- virtual ParamIteratorInterface<T>* End() const {
- return new Iterator(this, end_, end_index_, step_);
- }
-
- private:
- class Iterator : public ParamIteratorInterface<T> {
- public:
- Iterator(const ParamGeneratorInterface<T>* base, T value, int index,
- IncrementT step)
- : base_(base), value_(value), index_(index), step_(step) {}
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
- return base_;
- }
- virtual void Advance() {
- value_ = value_ + step_;
- index_++;
- }
- virtual ParamIteratorInterface<T>* Clone() const {
- return new Iterator(*this);
- }
- virtual const T* Current() const { return &value_; }
- virtual bool Equals(const ParamIteratorInterface<T>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const int other_index =
- CheckedDowncastToActualType<const Iterator>(&other)->index_;
- return index_ == other_index;
- }
-
- private:
- Iterator(const Iterator& other)
- : ParamIteratorInterface<T>(),
- base_(other.base_), value_(other.value_), index_(other.index_),
- step_(other.step_) {}
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<T>* const base_;
- T value_;
- int index_;
- const IncrementT step_;
- }; // class RangeGenerator::Iterator
-
- static int CalculateEndIndex(const T& begin,
- const T& end,
- const IncrementT& step) {
- int end_index = 0;
- for (T i = begin; i < end; i = i + step)
- end_index++;
- return end_index;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const RangeGenerator& other);
-
- const T begin_;
- const T end_;
- const IncrementT step_;
- // The index for the end() iterator. All the elements in the generated
- // sequence are indexed (0-based) to aid iterator comparison.
- const int end_index_;
-}; // class RangeGenerator
-
-
-// Generates values from a pair of STL-style iterators. Used in the
-// ValuesIn() function. The elements are copied from the source range
-// since the source can be located on the stack, and the generator
-// is likely to persist beyond that stack frame.
-template <typename T>
-class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
- public:
- template <typename ForwardIterator>
- ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
- : container_(begin, end) {}
- virtual ~ValuesInIteratorRangeGenerator() {}
-
- virtual ParamIteratorInterface<T>* Begin() const {
- return new Iterator(this, container_.begin());
- }
- virtual ParamIteratorInterface<T>* End() const {
- return new Iterator(this, container_.end());
- }
-
- private:
- typedef typename ::std::vector<T> ContainerType;
-
- class Iterator : public ParamIteratorInterface<T> {
- public:
- Iterator(const ParamGeneratorInterface<T>* base,
- typename ContainerType::const_iterator iterator)
- : base_(base), iterator_(iterator) {}
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
- return base_;
- }
- virtual void Advance() {
- ++iterator_;
- value_.reset();
- }
- virtual ParamIteratorInterface<T>* Clone() const {
- return new Iterator(*this);
- }
- // We need to use cached value referenced by iterator_ because *iterator_
- // can return a temporary object (and of type other then T), so just
- // having "return &*iterator_;" doesn't work.
- // value_ is updated here and not in Advance() because Advance()
- // can advance iterator_ beyond the end of the range, and we cannot
- // detect that fact. The client code, on the other hand, is
- // responsible for not calling Current() on an out-of-range iterator.
- virtual const T* Current() const {
- if (value_.get() == NULL)
- value_.reset(new T(*iterator_));
- return value_.get();
- }
- virtual bool Equals(const ParamIteratorInterface<T>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- return iterator_ ==
- CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
- }
-
- private:
- Iterator(const Iterator& other)
- // The explicit constructor call suppresses a false warning
- // emitted by gcc when supplied with the -Wextra option.
- : ParamIteratorInterface<T>(),
- base_(other.base_),
- iterator_(other.iterator_) {}
-
- const ParamGeneratorInterface<T>* const base_;
- typename ContainerType::const_iterator iterator_;
- // A cached value of *iterator_. We keep it here to allow access by
- // pointer in the wrapping iterator's operator->().
- // value_ needs to be mutable to be accessed in Current().
- // Use of scoped_ptr helps manage cached value's lifetime,
- // which is bound by the lifespan of the iterator itself.
- mutable scoped_ptr<const T> value_;
- }; // class ValuesInIteratorRangeGenerator::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const ValuesInIteratorRangeGenerator& other);
-
- const ContainerType container_;
-}; // class ValuesInIteratorRangeGenerator
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Stores a parameter value and later creates tests parameterized with that
-// value.
-template <class TestClass>
-class ParameterizedTestFactory : public TestFactoryBase {
- public:
- typedef typename TestClass::ParamType ParamType;
- explicit ParameterizedTestFactory(ParamType parameter) :
- parameter_(parameter) {}
- virtual Test* CreateTest() {
- TestClass::SetParam(¶meter_);
- return new TestClass();
- }
-
- private:
- const ParamType parameter_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// TestMetaFactoryBase is a base class for meta-factories that create
-// test factories for passing into MakeAndRegisterTestInfo function.
-template <class ParamType>
-class TestMetaFactoryBase {
- public:
- virtual ~TestMetaFactoryBase() {}
-
- virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// TestMetaFactory creates test factories for passing into
-// MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives
-// ownership of test factory pointer, same factory object cannot be passed
-// into that method twice. But ParameterizedTestCaseInfo is going to call
-// it for each Test/Parameter value combination. Thus it needs meta factory
-// creator class.
-template <class TestCase>
-class TestMetaFactory
- : public TestMetaFactoryBase<typename TestCase::ParamType> {
- public:
- typedef typename TestCase::ParamType ParamType;
-
- TestMetaFactory() {}
-
- virtual TestFactoryBase* CreateTestFactory(ParamType parameter) {
- return new ParameterizedTestFactory<TestCase>(parameter);
- }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseInfoBase is a generic interface
-// to ParameterizedTestCaseInfo classes. ParameterizedTestCaseInfoBase
-// accumulates test information provided by TEST_P macro invocations
-// and generators provided by INSTANTIATE_TEST_CASE_P macro invocations
-// and uses that information to register all resulting test instances
-// in RegisterTests method. The ParameterizeTestCaseRegistry class holds
-// a collection of pointers to the ParameterizedTestCaseInfo objects
-// and calls RegisterTests() on each of them when asked.
-class ParameterizedTestCaseInfoBase {
- public:
- virtual ~ParameterizedTestCaseInfoBase() {}
-
- // Base part of test case name for display purposes.
- virtual const string& GetTestCaseName() const = 0;
- // Test case id to verify identity.
- virtual TypeId GetTestCaseTypeId() const = 0;
- // UnitTest class invokes this method to register tests in this
- // test case right before running them in RUN_ALL_TESTS macro.
- // This method should not be called more then once on any single
- // instance of a ParameterizedTestCaseInfoBase derived class.
- virtual void RegisterTests() = 0;
-
- protected:
- ParameterizedTestCaseInfoBase() {}
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfoBase);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseInfo accumulates tests obtained from TEST_P
-// macro invocations for a particular test case and generators
-// obtained from INSTANTIATE_TEST_CASE_P macro invocations for that
-// test case. It registers tests with all values generated by all
-// generators when asked.
-template <class TestCase>
-class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
- public:
- // ParamType and GeneratorCreationFunc are private types but are required
- // for declarations of public methods AddTestPattern() and
- // AddTestCaseInstantiation().
- typedef typename TestCase::ParamType ParamType;
- // A function that returns an instance of appropriate generator type.
- typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();
-
- explicit ParameterizedTestCaseInfo(const char* name)
- : test_case_name_(name) {}
-
- // Test case base name for display purposes.
- virtual const string& GetTestCaseName() const { return test_case_name_; }
- // Test case id to verify identity.
- virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }
- // TEST_P macro uses AddTestPattern() to record information
- // about a single test in a LocalTestInfo structure.
- // test_case_name is the base name of the test case (without invocation
- // prefix). test_base_name is the name of an individual test without
- // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is
- // test case base name and DoBar is test base name.
- void AddTestPattern(const char* test_case_name,
- const char* test_base_name,
- TestMetaFactoryBase<ParamType>* meta_factory) {
- tests_.push_back(linked_ptr<TestInfo>(new TestInfo(test_case_name,
- test_base_name,
- meta_factory)));
- }
- // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information
- // about a generator.
- int AddTestCaseInstantiation(const string& instantiation_name,
- GeneratorCreationFunc* func,
- const char* /* file */,
- int /* line */) {
- instantiations_.push_back(::std::make_pair(instantiation_name, func));
- return 0; // Return value used only to run this method in namespace scope.
- }
- // UnitTest class invokes this method to register tests in this test case
- // test cases right before running tests in RUN_ALL_TESTS macro.
- // This method should not be called more then once on any single
- // instance of a ParameterizedTestCaseInfoBase derived class.
- // UnitTest has a guard to prevent from calling this method more then once.
- virtual void RegisterTests() {
- for (typename TestInfoContainer::iterator test_it = tests_.begin();
- test_it != tests_.end(); ++test_it) {
- linked_ptr<TestInfo> test_info = *test_it;
- for (typename InstantiationContainer::iterator gen_it =
- instantiations_.begin(); gen_it != instantiations_.end();
- ++gen_it) {
- const string& instantiation_name = gen_it->first;
- ParamGenerator<ParamType> generator((*gen_it->second)());
-
- string test_case_name;
- if ( !instantiation_name.empty() )
- test_case_name = instantiation_name + "/";
- test_case_name += test_info->test_case_base_name;
-
- int i = 0;
- for (typename ParamGenerator<ParamType>::iterator param_it =
- generator.begin();
- param_it != generator.end(); ++param_it, ++i) {
- Message test_name_stream;
- test_name_stream << test_info->test_base_name << "/" << i;
- MakeAndRegisterTestInfo(
- test_case_name.c_str(),
- test_name_stream.GetString().c_str(),
- NULL, // No type parameter.
- PrintToString(*param_it).c_str(),
- GetTestCaseTypeId(),
- TestCase::SetUpTestCase,
- TestCase::TearDownTestCase,
- test_info->test_meta_factory->CreateTestFactory(*param_it));
- } // for param_it
- } // for gen_it
- } // for test_it
- } // RegisterTests
-
- private:
- // LocalTestInfo structure keeps information about a single test registered
- // with TEST_P macro.
- struct TestInfo {
- TestInfo(const char* a_test_case_base_name,
- const char* a_test_base_name,
- TestMetaFactoryBase<ParamType>* a_test_meta_factory) :
- test_case_base_name(a_test_case_base_name),
- test_base_name(a_test_base_name),
- test_meta_factory(a_test_meta_factory) {}
-
- const string test_case_base_name;
- const string test_base_name;
- const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
- };
- typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;
- // Keeps pairs of <Instantiation name, Sequence generator creation function>
- // received from INSTANTIATE_TEST_CASE_P macros.
- typedef ::std::vector<std::pair<string, GeneratorCreationFunc*> >
- InstantiationContainer;
-
- const string test_case_name_;
- TestInfoContainer tests_;
- InstantiationContainer instantiations_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfo);
-}; // class ParameterizedTestCaseInfo
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseRegistry contains a map of ParameterizedTestCaseInfoBase
-// classes accessed by test case names. TEST_P and INSTANTIATE_TEST_CASE_P
-// macros use it to locate their corresponding ParameterizedTestCaseInfo
-// descriptors.
-class ParameterizedTestCaseRegistry {
- public:
- ParameterizedTestCaseRegistry() {}
- ~ParameterizedTestCaseRegistry() {
- for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
- it != test_case_infos_.end(); ++it) {
- delete *it;
- }
- }
-
- // Looks up or creates and returns a structure containing information about
- // tests and instantiations of a particular test case.
- template <class TestCase>
- ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder(
- const char* test_case_name,
- const char* file,
- int line) {
- ParameterizedTestCaseInfo<TestCase>* typed_test_info = NULL;
- for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
- it != test_case_infos_.end(); ++it) {
- if ((*it)->GetTestCaseName() == test_case_name) {
- if ((*it)->GetTestCaseTypeId() != GetTypeId<TestCase>()) {
- // Complain about incorrect usage of Google Test facilities
- // and terminate the program since we cannot guaranty correct
- // test case setup and tear-down in this case.
- ReportInvalidTestCaseType(test_case_name, file, line);
- posix::Abort();
- } else {
- // At this point we are sure that the object we found is of the same
- // type we are looking for, so we downcast it to that type
- // without further checks.
- typed_test_info = CheckedDowncastToActualType<
- ParameterizedTestCaseInfo<TestCase> >(*it);
- }
- break;
- }
- }
- if (typed_test_info == NULL) {
- typed_test_info = new ParameterizedTestCaseInfo<TestCase>(test_case_name);
- test_case_infos_.push_back(typed_test_info);
- }
- return typed_test_info;
- }
- void RegisterTests() {
- for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
- it != test_case_infos_.end(); ++it) {
- (*it)->RegisterTests();
- }
- }
-
- private:
- typedef ::std::vector<ParameterizedTestCaseInfoBase*> TestCaseInfoContainer;
-
- TestCaseInfoContainer test_case_infos_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseRegistry);
-};
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-port.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-port.h
deleted file mode 100644
index efb479d..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-port.h
+++ /dev/null
@@ -1,2430 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan)
-//
-// Low-level types and utilities for porting Google Test to various
-// platforms. All macros ending with _ and symbols defined in an
-// internal namespace are subject to change without notice. Code
-// outside Google Test MUST NOT USE THEM DIRECTLY. Macros that don't
-// end with _ are part of Google Test's public API and can be used by
-// code outside Google Test.
-//
-// This file is fundamental to Google Test. All other Google Test source
-// files are expected to #include this. Therefore, it cannot #include
-// any other Google Test header.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
-
-// Environment-describing macros
-// -----------------------------
-//
-// Google Test can be used in many different environments. Macros in
-// this section tell Google Test what kind of environment it is being
-// used in, such that Google Test can provide environment-specific
-// features and implementations.
-//
-// Google Test tries to automatically detect the properties of its
-// environment, so users usually don't need to worry about these
-// macros. However, the automatic detection is not perfect.
-// Sometimes it's necessary for a user to define some of the following
-// macros in the build script to override Google Test's decisions.
-//
-// If the user doesn't define a macro in the list, Google Test will
-// provide a default definition. After this header is #included, all
-// macros in this list will be defined to either 1 or 0.
-//
-// Notes to maintainers:
-// - Each macro here is a user-tweakable knob; do not grow the list
-// lightly.
-// - Use #if to key off these macros. Don't use #ifdef or "#if
-// defined(...)", which will not work as these macros are ALWAYS
-// defined.
-//
-// GTEST_HAS_CLONE - Define it to 1/0 to indicate that clone(2)
-// is/isn't available.
-// GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions
-// are enabled.
-// GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string
-// is/isn't available (some systems define
-// ::string, which is different to std::string).
-// GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
-// is/isn't available (some systems define
-// ::wstring, which is different to std::wstring).
-// GTEST_HAS_POSIX_RE - Define it to 1/0 to indicate that POSIX regular
-// expressions are/aren't available.
-// GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h>
-// is/isn't available.
-// GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't
-// enabled.
-// GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that
-// std::wstring does/doesn't work (Google Test can
-// be used where std::wstring is unavailable).
-// GTEST_HAS_TR1_TUPLE - Define it to 1/0 to indicate tr1::tuple
-// is/isn't available.
-// GTEST_HAS_SEH - Define it to 1/0 to indicate whether the
-// compiler supports Microsoft's "Structured
-// Exception Handling".
-// GTEST_HAS_STREAM_REDIRECTION
-// - Define it to 1/0 to indicate whether the
-// platform supports I/O stream redirection using
-// dup() and dup2().
-// GTEST_USE_OWN_TR1_TUPLE - Define it to 1/0 to indicate whether Google
-// Test's own tr1 tuple implementation should be
-// used. Unused when the user sets
-// GTEST_HAS_TR1_TUPLE to 0.
-// GTEST_LANG_CXX11 - Define it to 1/0 to indicate that Google Test
-// is building in C++11/C++98 mode.
-// GTEST_LINKED_AS_SHARED_LIBRARY
-// - Define to 1 when compiling tests that use
-// Google Test as a shared library (known as
-// DLL on Windows).
-// GTEST_CREATE_SHARED_LIBRARY
-// - Define to 1 when compiling Google Test itself
-// as a shared library.
-
-// Platform-indicating macros
-// --------------------------
-//
-// Macros indicating the platform on which Google Test is being used
-// (a macro is defined to 1 if compiled on the given platform;
-// otherwise UNDEFINED -- it's never defined to 0.). Google Test
-// defines these macros automatically. Code outside Google Test MUST
-// NOT define them.
-//
-// GTEST_OS_AIX - IBM AIX
-// GTEST_OS_CYGWIN - Cygwin
-// GTEST_OS_HPUX - HP-UX
-// GTEST_OS_LINUX - Linux
-// GTEST_OS_LINUX_ANDROID - Google Android
-// GTEST_OS_MAC - Mac OS X
-// GTEST_OS_IOS - iOS
-// GTEST_OS_IOS_SIMULATOR - iOS simulator
-// GTEST_OS_NACL - Google Native Client (NaCl)
-// GTEST_OS_OPENBSD - OpenBSD
-// GTEST_OS_QNX - QNX
-// GTEST_OS_SOLARIS - Sun Solaris
-// GTEST_OS_SYMBIAN - Symbian
-// GTEST_OS_WINDOWS - Windows (Desktop, MinGW, or Mobile)
-// GTEST_OS_WINDOWS_DESKTOP - Windows Desktop
-// GTEST_OS_WINDOWS_MINGW - MinGW
-// GTEST_OS_WINDOWS_MOBILE - Windows Mobile
-// GTEST_OS_WINDOWS_PHONE - Windows Phone
-// GTEST_OS_WINDOWS_RT - Windows Store App/WinRT
-// GTEST_OS_ZOS - z/OS
-//
-// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
-// most stable support. Since core members of the Google Test project
-// don't have access to other platforms, support for them may be less
-// stable. If you notice any problems on your platform, please notify
-// googletestframework@googlegroups.com (patches for fixing them are
-// even more welcome!).
-//
-// It is possible that none of the GTEST_OS_* macros are defined.
-
-// Feature-indicating macros
-// -------------------------
-//
-// Macros indicating which Google Test features are available (a macro
-// is defined to 1 if the corresponding feature is supported;
-// otherwise UNDEFINED -- it's never defined to 0.). Google Test
-// defines these macros automatically. Code outside Google Test MUST
-// NOT define them.
-//
-// These macros are public so that portable tests can be written.
-// Such tests typically surround code using a feature with an #if
-// which controls that code. For example:
-//
-// #if GTEST_HAS_DEATH_TEST
-// EXPECT_DEATH(DoSomethingDeadly());
-// #endif
-//
-// GTEST_HAS_COMBINE - the Combine() function (for value-parameterized
-// tests)
-// GTEST_HAS_DEATH_TEST - death tests
-// GTEST_HAS_PARAM_TEST - value-parameterized tests
-// GTEST_HAS_TYPED_TEST - typed tests
-// GTEST_HAS_TYPED_TEST_P - type-parameterized tests
-// GTEST_IS_THREADSAFE - Google Test is thread-safe.
-// GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse with
-// GTEST_HAS_POSIX_RE (see above) which users can
-// define themselves.
-// GTEST_USES_SIMPLE_RE - our own simple regex is used;
-// the above two are mutually exclusive.
-// GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
-
-// Misc public macros
-// ------------------
-//
-// GTEST_FLAG(flag_name) - references the variable corresponding to
-// the given Google Test flag.
-
-// Internal utilities
-// ------------------
-//
-// The following macros and utilities are for Google Test's INTERNAL
-// use only. Code outside Google Test MUST NOT USE THEM DIRECTLY.
-//
-// Macros for basic C++ coding:
-// GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
-// GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a
-// variable don't have to be used.
-// GTEST_DISALLOW_ASSIGN_ - disables operator=.
-// GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
-// GTEST_MUST_USE_RESULT_ - declares that a function's result must be used.
-// GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is
-// suppressed (constant conditional).
-// GTEST_INTENTIONAL_CONST_COND_POP_ - finish code section where MSVC C4127
-// is suppressed.
-//
-// C++11 feature wrappers:
-//
-// GTEST_MOVE_ - portability wrapper for std::move.
-//
-// Synchronization:
-// Mutex, MutexLock, ThreadLocal, GetThreadCount()
-// - synchronization primitives.
-//
-// Template meta programming:
-// is_pointer - as in TR1; needed on Symbian and IBM XL C/C++ only.
-// IteratorTraits - partial implementation of std::iterator_traits, which
-// is not available in libCstd when compiled with Sun C++.
-//
-// Smart pointers:
-// scoped_ptr - as in TR2.
-//
-// Regular expressions:
-// RE - a simple regular expression class using the POSIX
-// Extended Regular Expression syntax on UNIX-like
-// platforms, or a reduced regular exception syntax on
-// other platforms, including Windows.
-//
-// Logging:
-// GTEST_LOG_() - logs messages at the specified severity level.
-// LogToStderr() - directs all log messages to stderr.
-// FlushInfoLog() - flushes informational log messages.
-//
-// Stdout and stderr capturing:
-// CaptureStdout() - starts capturing stdout.
-// GetCapturedStdout() - stops capturing stdout and returns the captured
-// string.
-// CaptureStderr() - starts capturing stderr.
-// GetCapturedStderr() - stops capturing stderr and returns the captured
-// string.
-//
-// Integer types:
-// TypeWithSize - maps an integer to a int type.
-// Int32, UInt32, Int64, UInt64, TimeInMillis
-// - integers of known sizes.
-// BiggestInt - the biggest signed integer type.
-//
-// Command-line utilities:
-// GTEST_DECLARE_*() - declares a flag.
-// GTEST_DEFINE_*() - defines a flag.
-// GetInjectableArgvs() - returns the command line as a vector of strings.
-//
-// Environment variable utilities:
-// GetEnv() - gets the value of an environment variable.
-// BoolFromGTestEnv() - parses a bool environment variable.
-// Int32FromGTestEnv() - parses an Int32 environment variable.
-// StringFromGTestEnv() - parses a string environment variable.
-
-#include <ctype.h> // for isspace, etc
-#include <stddef.h> // for ptrdiff_t
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#ifndef _WIN32_WCE
-# include <sys/types.h>
-# include <sys/stat.h>
-#endif // !_WIN32_WCE
-
-#if defined __APPLE__
-# include <AvailabilityMacros.h>
-# include <TargetConditionals.h>
-#endif
-
-#include <algorithm> // NOLINT
-#include <iostream> // NOLINT
-#include <sstream> // NOLINT
-#include <string> // NOLINT
-#include <utility>
-
-#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
-#define GTEST_FLAG_PREFIX_ "gtest_"
-#define GTEST_FLAG_PREFIX_DASH_ "gtest-"
-#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
-#define GTEST_NAME_ "Google Test"
-#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
-
-// Determines the version of gcc that is used to compile this.
-#ifdef __GNUC__
-// 40302 means version 4.3.2.
-# define GTEST_GCC_VER_ \
- (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
-#endif // __GNUC__
-
-// Determines the platform on which Google Test is compiled.
-#ifdef __CYGWIN__
-# define GTEST_OS_CYGWIN 1
-#elif defined __SYMBIAN32__
-# define GTEST_OS_SYMBIAN 1
-#elif defined _WIN32
-# define GTEST_OS_WINDOWS 1
-# ifdef _WIN32_WCE
-# define GTEST_OS_WINDOWS_MOBILE 1
-# elif defined(__MINGW__) || defined(__MINGW32__)
-# define GTEST_OS_WINDOWS_MINGW 1
-# elif defined(WINAPI_FAMILY)
-# include <winapifamily.h>
-# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-# define GTEST_OS_WINDOWS_DESKTOP 1
-# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-# define GTEST_OS_WINDOWS_PHONE 1
-# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
-# define GTEST_OS_WINDOWS_RT 1
-# else
- // WINAPI_FAMILY defined but no known partition matched.
- // Default to desktop.
-# define GTEST_OS_WINDOWS_DESKTOP 1
-# endif
-# else
-# define GTEST_OS_WINDOWS_DESKTOP 1
-# endif // _WIN32_WCE
-#elif defined __APPLE__
-# define GTEST_OS_MAC 1
-# if TARGET_OS_IPHONE
-# define GTEST_OS_IOS 1
-# if TARGET_IPHONE_SIMULATOR
-# define GTEST_OS_IOS_SIMULATOR 1
-# endif
-# endif
-#elif defined __linux__
-# define GTEST_OS_LINUX 1
-# if defined __ANDROID__
-# define GTEST_OS_LINUX_ANDROID 1
-# endif
-#elif defined __MVS__
-# define GTEST_OS_ZOS 1
-#elif defined(__sun) && defined(__SVR4)
-# define GTEST_OS_SOLARIS 1
-#elif defined(_AIX)
-# define GTEST_OS_AIX 1
-#elif defined(__hpux)
-# define GTEST_OS_HPUX 1
-#elif defined __native_client__
-# define GTEST_OS_NACL 1
-#elif defined __OpenBSD__
-# define GTEST_OS_OPENBSD 1
-#elif defined __QNX__
-# define GTEST_OS_QNX 1
-#endif // __CYGWIN__
-
-// Macros for disabling Microsoft Visual C++ warnings.
-//
-// GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385)
-// /* code that triggers warnings C4800 and C4385 */
-// GTEST_DISABLE_MSC_WARNINGS_POP_()
-#if _MSC_VER >= 1500
-# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \
- __pragma(warning(push)) \
- __pragma(warning(disable: warnings))
-# define GTEST_DISABLE_MSC_WARNINGS_POP_() \
- __pragma(warning(pop))
-#else
-// Older versions of MSVC don't have __pragma.
-# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
-# define GTEST_DISABLE_MSC_WARNINGS_POP_()
-#endif
-
-#ifndef GTEST_LANG_CXX11
-// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
-// -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a
-// value for __cplusplus, and recent versions of clang, gcc, and
-// probably other compilers set that too in C++11 mode.
-# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
-// Compiling in at least C++11 mode.
-# define GTEST_LANG_CXX11 1
-# else
-# define GTEST_LANG_CXX11 0
-# endif
-#endif
-
-// C++11 specifies that <initializer_list> provides std::initializer_list. Use
-// that if gtest is used in C++11 mode and libstdc++ isn't very old (binaries
-// targeting OS X 10.6 can build with clang but need to use gcc4.2's
-// libstdc++).
-#if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
-# define GTEST_HAS_STD_INITIALIZER_LIST_ 1
-#endif
-
-// C++11 specifies that <tuple> provides std::tuple.
-// Some platforms still might not have it, however.
-#if GTEST_LANG_CXX11
-# define GTEST_HAS_STD_TUPLE_ 1
-# if defined(__clang__)
-// Inspired by http://clang.llvm.org/docs/LanguageExtensions.html#__has_include
-# if defined(__has_include) && !__has_include(<tuple>)
-# undef GTEST_HAS_STD_TUPLE_
-# endif
-# elif defined(_MSC_VER)
-// Inspired by boost/config/stdlib/dinkumware.hpp
-# if defined(_CPPLIB_VER) && _CPPLIB_VER < 520
-# undef GTEST_HAS_STD_TUPLE_
-# endif
-# elif defined(__GLIBCXX__)
-// Inspired by boost/config/stdlib/libstdcpp3.hpp,
-// http://gcc.gnu.org/gcc-4.2/changes.html and
-// http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt01ch01.html#manual.intro.status.standard.200x
-# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
-# undef GTEST_HAS_STD_TUPLE_
-# endif
-# endif
-#endif
-
-// Brings in definitions for functions used in the testing::internal::posix
-// namespace (read, write, close, chdir, isatty, stat). We do not currently
-// use them on Windows Mobile.
-#if GTEST_OS_WINDOWS
-# if !GTEST_OS_WINDOWS_MOBILE
-# include <direct.h>
-# include <io.h>
-# endif
-// In order to avoid having to include <windows.h>, use forward declaration
-// assuming CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
-// This assumption is verified by
-// WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
-struct _RTL_CRITICAL_SECTION;
-#else
-// This assumes that non-Windows OSes provide unistd.h. For OSes where this
-// is not the case, we need to include headers that provide the functions
-// mentioned above.
-# include <unistd.h>
-# include <strings.h>
-#endif // GTEST_OS_WINDOWS
-
-#if GTEST_OS_LINUX_ANDROID
-// Used to define __ANDROID_API__ matching the target NDK API level.
-# include <android/api-level.h> // NOLINT
-#endif
-
-// Defines this to true iff Google Test can use POSIX regular expressions.
-#ifndef GTEST_HAS_POSIX_RE
-# if GTEST_OS_LINUX_ANDROID
-// On Android, <regex.h> is only available starting with Gingerbread.
-# define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
-# else
-# define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
-# endif
-#endif
-
-#if GTEST_HAS_POSIX_RE
-
-// On some platforms, <regex.h> needs someone to define size_t, and
-// won't compile otherwise. We can #include it here as we already
-// included <stdlib.h>, which is guaranteed to define size_t through
-// <stddef.h>.
-# include <regex.h> // NOLINT
-
-# define GTEST_USES_POSIX_RE 1
-
-#elif GTEST_OS_WINDOWS
-
-// <regex.h> is not available on Windows. Use our own simple regex
-// implementation instead.
-# define GTEST_USES_SIMPLE_RE 1
-
-#else
-
-// <regex.h> may not be available on this platform. Use our own
-// simple regex implementation instead.
-# define GTEST_USES_SIMPLE_RE 1
-
-#endif // GTEST_HAS_POSIX_RE
-
-#ifndef GTEST_HAS_EXCEPTIONS
-// The user didn't tell us whether exceptions are enabled, so we need
-// to figure it out.
-# if defined(_MSC_VER) || defined(__BORLANDC__)
-// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
-// macro to enable exceptions, so we'll do the same.
-// Assumes that exceptions are enabled by default.
-# ifndef _HAS_EXCEPTIONS
-# define _HAS_EXCEPTIONS 1
-# endif // _HAS_EXCEPTIONS
-# define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
-# elif defined(__GNUC__) && __EXCEPTIONS
-// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
-# define GTEST_HAS_EXCEPTIONS 1
-# elif defined(__SUNPRO_CC)
-// Sun Pro CC supports exceptions. However, there is no compile-time way of
-// detecting whether they are enabled or not. Therefore, we assume that
-// they are enabled unless the user tells us otherwise.
-# define GTEST_HAS_EXCEPTIONS 1
-# elif defined(__IBMCPP__) && __EXCEPTIONS
-// xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
-# define GTEST_HAS_EXCEPTIONS 1
-# elif defined(__HP_aCC)
-// Exception handling is in effect by default in HP aCC compiler. It has to
-// be turned of by +noeh compiler option if desired.
-# define GTEST_HAS_EXCEPTIONS 1
-# else
-// For other compilers, we assume exceptions are disabled to be
-// conservative.
-# define GTEST_HAS_EXCEPTIONS 0
-# endif // defined(_MSC_VER) || defined(__BORLANDC__)
-#endif // GTEST_HAS_EXCEPTIONS
-
-#if !defined(GTEST_HAS_STD_STRING)
-// Even though we don't use this macro any longer, we keep it in case
-// some clients still depend on it.
-# define GTEST_HAS_STD_STRING 1
-#elif !GTEST_HAS_STD_STRING
-// The user told us that ::std::string isn't available.
-# error "Google Test cannot be used where ::std::string isn't available."
-#endif // !defined(GTEST_HAS_STD_STRING)
-
-#ifndef GTEST_HAS_GLOBAL_STRING
-// The user didn't tell us whether ::string is available, so we need
-// to figure it out.
-
-# define GTEST_HAS_GLOBAL_STRING 0
-
-#endif // GTEST_HAS_GLOBAL_STRING
-
-#ifndef GTEST_HAS_STD_WSTRING
-// The user didn't tell us whether ::std::wstring is available, so we need
-// to figure it out.
-// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
-// is available.
-
-// Cygwin 1.7 and below doesn't support ::std::wstring.
-// Solaris' libc++ doesn't support it either. Android has
-// no support for it at least as recent as Froyo (2.2).
-# define GTEST_HAS_STD_WSTRING \
- (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
-
-#endif // GTEST_HAS_STD_WSTRING
-
-#ifndef GTEST_HAS_GLOBAL_WSTRING
-// The user didn't tell us whether ::wstring is available, so we need
-// to figure it out.
-# define GTEST_HAS_GLOBAL_WSTRING \
- (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-// Determines whether RTTI is available.
-#ifndef GTEST_HAS_RTTI
-// The user didn't tell us whether RTTI is enabled, so we need to
-// figure it out.
-
-# ifdef _MSC_VER
-
-# ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled.
-# define GTEST_HAS_RTTI 1
-# else
-# define GTEST_HAS_RTTI 0
-# endif
-
-// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
-# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
-
-# ifdef __GXX_RTTI
-// When building against STLport with the Android NDK and with
-// -frtti -fno-exceptions, the build fails at link time with undefined
-// references to __cxa_bad_typeid. Note sure if STL or toolchain bug,
-// so disable RTTI when detected.
-# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \
- !defined(__EXCEPTIONS)
-# define GTEST_HAS_RTTI 0
-# else
-# define GTEST_HAS_RTTI 1
-# endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS
-# else
-# define GTEST_HAS_RTTI 0
-# endif // __GXX_RTTI
-
-// Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
-// using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
-// first version with C++ support.
-# elif defined(__clang__)
-
-# define GTEST_HAS_RTTI __has_feature(cxx_rtti)
-
-// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
-// both the typeid and dynamic_cast features are present.
-# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
-
-# ifdef __RTTI_ALL__
-# define GTEST_HAS_RTTI 1
-# else
-# define GTEST_HAS_RTTI 0
-# endif
-
-# else
-
-// For all other compilers, we assume RTTI is enabled.
-# define GTEST_HAS_RTTI 1
-
-# endif // _MSC_VER
-
-#endif // GTEST_HAS_RTTI
-
-// It's this header's responsibility to #include <typeinfo> when RTTI
-// is enabled.
-#if GTEST_HAS_RTTI
-# include <typeinfo>
-#endif
-
-// Determines whether Google Test can use the pthreads library.
-#ifndef GTEST_HAS_PTHREAD
-// The user didn't tell us explicitly, so we assume pthreads support is
-// available on Linux and Mac.
-//
-// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
-// to your compiler flags.
-# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \
- || GTEST_OS_QNX)
-#endif // GTEST_HAS_PTHREAD
-
-#if GTEST_HAS_PTHREAD
-// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
-// true.
-# include <pthread.h> // NOLINT
-
-// For timespec and nanosleep, used below.
-# include <time.h> // NOLINT
-#endif
-
-// Determines whether Google Test can use tr1/tuple. You can define
-// this macro to 0 to prevent Google Test from using tuple (any
-// feature depending on tuple with be disabled in this mode).
-#ifndef GTEST_HAS_TR1_TUPLE
-# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR)
-// STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>.
-# define GTEST_HAS_TR1_TUPLE 0
-# else
-// The user didn't tell us not to do it, so we assume it's OK.
-# define GTEST_HAS_TR1_TUPLE 1
-# endif
-#endif // GTEST_HAS_TR1_TUPLE
-
-// Determines whether Google Test's own tr1 tuple implementation
-// should be used.
-#ifndef GTEST_USE_OWN_TR1_TUPLE
-// The user didn't tell us, so we need to figure it out.
-
-// We use our own TR1 tuple if we aren't sure the user has an
-// implementation of it already. At this time, libstdc++ 4.0.0+ and
-// MSVC 2010 are the only mainstream standard libraries that come
-// with a TR1 tuple implementation. NVIDIA's CUDA NVCC compiler
-// pretends to be GCC by defining __GNUC__ and friends, but cannot
-// compile GCC's tuple implementation. MSVC 2008 (9.0) provides TR1
-// tuple in a 323 MB Feature Pack download, which we cannot assume the
-// user has. QNX's QCC compiler is a modified GCC but it doesn't
-// support TR1 tuple. libc++ only provides std::tuple, in C++11 mode,
-// and it can be used with some compilers that define __GNUC__.
-# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
- && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600
-# define GTEST_ENV_HAS_TR1_TUPLE_ 1
-# endif
-
-// C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used
-// in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6
-// can build with clang but need to use gcc4.2's libstdc++).
-# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
-# define GTEST_ENV_HAS_STD_TUPLE_ 1
-# endif
-
-# if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_
-# define GTEST_USE_OWN_TR1_TUPLE 0
-# else
-# define GTEST_USE_OWN_TR1_TUPLE 1
-# endif
-
-#endif // GTEST_USE_OWN_TR1_TUPLE
-
-// To avoid conditional compilation everywhere, we make it
-// gtest-port.h's responsibility to #include the header implementing
-// tuple.
-#if GTEST_HAS_STD_TUPLE_
-# include <tuple> // IWYU pragma: export
-# define GTEST_TUPLE_NAMESPACE_ ::std
-#endif // GTEST_HAS_STD_TUPLE_
-
-// We include tr1::tuple even if std::tuple is available to define printers for
-// them.
-#if GTEST_HAS_TR1_TUPLE
-# ifndef GTEST_TUPLE_NAMESPACE_
-# define GTEST_TUPLE_NAMESPACE_ ::std::tr1
-# endif // GTEST_TUPLE_NAMESPACE_
-
-# if GTEST_USE_OWN_TR1_TUPLE
-# include "gtest/internal/gtest-tuple.h" // IWYU pragma: export // NOLINT
-# elif GTEST_ENV_HAS_STD_TUPLE_
-# include <tuple>
-// C++11 puts its tuple into the ::std namespace rather than
-// ::std::tr1. gtest expects tuple to live in ::std::tr1, so put it there.
-// This causes undefined behavior, but supported compilers react in
-// the way we intend.
-namespace std {
-namespace tr1 {
-using ::std::get;
-using ::std::make_tuple;
-using ::std::tuple;
-using ::std::tuple_element;
-using ::std::tuple_size;
-}
-}
-
-# elif GTEST_OS_SYMBIAN
-
-// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
-// use STLport's tuple implementation, which unfortunately doesn't
-// work as the copy of STLport distributed with Symbian is incomplete.
-// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
-// use its own tuple implementation.
-# ifdef BOOST_HAS_TR1_TUPLE
-# undef BOOST_HAS_TR1_TUPLE
-# endif // BOOST_HAS_TR1_TUPLE
-
-// This prevents <boost/tr1/detail/config.hpp>, which defines
-// BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
-# define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
-# include <tuple> // IWYU pragma: export // NOLINT
-
-# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
-// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header. This does
-// not conform to the TR1 spec, which requires the header to be <tuple>.
-
-# if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
-// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
-// which is #included by <tr1/tuple>, to not compile when RTTI is
-// disabled. _TR1_FUNCTIONAL is the header guard for
-// <tr1/functional>. Hence the following #define is a hack to prevent
-// <tr1/functional> from being included.
-# define _TR1_FUNCTIONAL 1
-# include <tr1/tuple>
-# undef _TR1_FUNCTIONAL // Allows the user to #include
- // <tr1/functional> if he chooses to.
-# else
-# include <tr1/tuple> // NOLINT
-# endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
-
-# else
-// If the compiler is not GCC 4.0+, we assume the user is using a
-// spec-conforming TR1 implementation.
-# include <tuple> // IWYU pragma: export // NOLINT
-# endif // GTEST_USE_OWN_TR1_TUPLE
-
-#endif // GTEST_HAS_TR1_TUPLE
-
-// Determines whether clone(2) is supported.
-// Usually it will only be available on Linux, excluding
-// Linux on the Itanium architecture.
-// Also see http://linux.die.net/man/2/clone.
-#ifndef GTEST_HAS_CLONE
-// The user didn't tell us, so we need to figure it out.
-
-# if GTEST_OS_LINUX && !defined(__ia64__)
-# if GTEST_OS_LINUX_ANDROID
-// On Android, clone() is only available on ARM starting with Gingerbread.
-# if defined(__arm__) && __ANDROID_API__ >= 9
-# define GTEST_HAS_CLONE 1
-# else
-# define GTEST_HAS_CLONE 0
-# endif
-# else
-# define GTEST_HAS_CLONE 1
-# endif
-# else
-# define GTEST_HAS_CLONE 0
-# endif // GTEST_OS_LINUX && !defined(__ia64__)
-
-#endif // GTEST_HAS_CLONE
-
-// Determines whether to support stream redirection. This is used to test
-// output correctness and to implement death tests.
-#ifndef GTEST_HAS_STREAM_REDIRECTION
-// By default, we assume that stream redirection is supported on all
-// platforms except known mobile ones.
-# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || \
- GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT
-# define GTEST_HAS_STREAM_REDIRECTION 0
-# else
-# define GTEST_HAS_STREAM_REDIRECTION 1
-# endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN
-#endif // GTEST_HAS_STREAM_REDIRECTION
-
-// Determines whether to support death tests.
-// Google Test does not support death tests for VC 7.1 and earlier as
-// abort() in a VC 7.1 application compiled as GUI in debug config
-// pops up a dialog window that cannot be suppressed programmatically.
-#if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
- (GTEST_OS_MAC && !GTEST_OS_IOS) || GTEST_OS_IOS_SIMULATOR || \
- (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
- GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
- GTEST_OS_OPENBSD || GTEST_OS_QNX)
-# define GTEST_HAS_DEATH_TEST 1
-# include <vector> // NOLINT
-#endif
-
-// We don't support MSVC 7.1 with exceptions disabled now. Therefore
-// all the compilers we care about are adequate for supporting
-// value-parameterized tests.
-#define GTEST_HAS_PARAM_TEST 1
-
-// Determines whether to support type-driven tests.
-
-// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
-// Sun Pro CC, IBM Visual Age, and HP aCC support.
-#if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \
- defined(__IBMCPP__) || defined(__HP_aCC)
-# define GTEST_HAS_TYPED_TEST 1
-# define GTEST_HAS_TYPED_TEST_P 1
-#endif
-
-// Determines whether to support Combine(). This only makes sense when
-// value-parameterized tests are enabled. The implementation doesn't
-// work on Sun Studio since it doesn't understand templated conversion
-// operators.
-#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
-# define GTEST_HAS_COMBINE 1
-#endif
-
-// Determines whether the system compiler uses UTF-16 for encoding wide strings.
-#define GTEST_WIDE_STRING_USES_UTF16_ \
- (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX)
-
-// Determines whether test results can be streamed to a socket.
-#if GTEST_OS_LINUX
-# define GTEST_CAN_STREAM_RESULTS_ 1
-#endif
-
-// Defines some utility macros.
-
-// The GNU compiler emits a warning if nested "if" statements are followed by
-// an "else" statement and braces are not used to explicitly disambiguate the
-// "else" binding. This leads to problems with code like:
-//
-// if (gate)
-// ASSERT_*(condition) << "Some message";
-//
-// The "switch (0) case 0:" idiom is used to suppress this.
-#ifdef __INTEL_COMPILER
-# define GTEST_AMBIGUOUS_ELSE_BLOCKER_
-#else
-# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT
-#endif
-
-// Use this annotation at the end of a struct/class definition to
-// prevent the compiler from optimizing away instances that are never
-// used. This is useful when all interesting logic happens inside the
-// c'tor and / or d'tor. Example:
-//
-// struct Foo {
-// Foo() { ... }
-// } GTEST_ATTRIBUTE_UNUSED_;
-//
-// Also use it after a variable or parameter declaration to tell the
-// compiler the variable/parameter does not have to be used.
-#if defined(__GNUC__) && !defined(COMPILER_ICC)
-# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
-#else
-# define GTEST_ATTRIBUTE_UNUSED_
-#endif
-
-// A macro to disallow operator=
-// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_ASSIGN_(type)\
- void operator=(type const &)
-
-// A macro to disallow copy constructor and operator=
-// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
- type(type const &);\
- GTEST_DISALLOW_ASSIGN_(type)
-
-// Tell the compiler to warn about unused return values for functions declared
-// with this macro. The macro should be used on function declarations
-// following the argument list:
-//
-// Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
-#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
-# define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
-#else
-# define GTEST_MUST_USE_RESULT_
-#endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
-
-#if GTEST_LANG_CXX11
-# define GTEST_MOVE_(x) ::std::move(x) // NOLINT
-#else
-# define GTEST_MOVE_(x) x
-#endif
-
-// MS C++ compiler emits warning when a conditional expression is compile time
-// constant. In some contexts this warning is false positive and needs to be
-// suppressed. Use the following two macros in such cases:
-//
-// GTEST_INTENTIONAL_CONST_COND_PUSH_()
-// while (true) {
-// GTEST_INTENTIONAL_CONST_COND_POP_()
-// }
-# define GTEST_INTENTIONAL_CONST_COND_PUSH_() \
- GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127)
-# define GTEST_INTENTIONAL_CONST_COND_POP_() \
- GTEST_DISABLE_MSC_WARNINGS_POP_()
-
-// Determine whether the compiler supports Microsoft's Structured Exception
-// Handling. This is supported by several Windows compilers but generally
-// does not exist on any other system.
-#ifndef GTEST_HAS_SEH
-// The user didn't tell us, so we need to figure it out.
-
-# if defined(_MSC_VER) || defined(__BORLANDC__)
-// These two compilers are known to support SEH.
-# define GTEST_HAS_SEH 1
-# else
-// Assume no SEH.
-# define GTEST_HAS_SEH 0
-# endif
-
-#define GTEST_IS_THREADSAFE \
- (GTEST_OS_WINDOWS || GTEST_HAS_PTHREAD)
-
-#endif // GTEST_HAS_SEH
-
-#ifdef _MSC_VER
-
-# if GTEST_LINKED_AS_SHARED_LIBRARY
-# define GTEST_API_ __declspec(dllimport)
-# elif GTEST_CREATE_SHARED_LIBRARY
-# define GTEST_API_ __declspec(dllexport)
-# endif
-
-#endif // _MSC_VER
-
-#ifndef GTEST_API_
-# define GTEST_API_
-#endif
-
-#ifdef __GNUC__
-// Ask the compiler to never inline a given function.
-# define GTEST_NO_INLINE_ __attribute__((noinline))
-#else
-# define GTEST_NO_INLINE_
-#endif
-
-// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
-#if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)
-# define GTEST_HAS_CXXABI_H_ 1
-#else
-# define GTEST_HAS_CXXABI_H_ 0
-#endif
-
-// A function level attribute to disable checking for use of uninitialized
-// memory when built with MemorySanitizer.
-#if defined(__clang__)
-# if __has_feature(memory_sanitizer)
-# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ \
- __attribute__((no_sanitize_memory))
-# else
-# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
-# endif // __has_feature(memory_sanitizer)
-#else
-# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
-#endif // __clang__
-
-// A function level attribute to disable AddressSanitizer instrumentation.
-#if defined(__clang__)
-# if __has_feature(address_sanitizer)
-# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \
- __attribute__((no_sanitize_address))
-# else
-# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
-# endif // __has_feature(address_sanitizer)
-#else
-# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
-#endif // __clang__
-
-// A function level attribute to disable ThreadSanitizer instrumentation.
-#if defined(__clang__)
-# if __has_feature(thread_sanitizer)
-# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ \
- __attribute__((no_sanitize_thread))
-# else
-# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
-# endif // __has_feature(thread_sanitizer)
-#else
-# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
-#endif // __clang__
-
-namespace testing {
-
-class Message;
-
-#if defined(GTEST_TUPLE_NAMESPACE_)
-// Import tuple and friends into the ::testing namespace.
-// It is part of our interface, having them in ::testing allows us to change
-// their types as needed.
-using GTEST_TUPLE_NAMESPACE_::get;
-using GTEST_TUPLE_NAMESPACE_::make_tuple;
-using GTEST_TUPLE_NAMESPACE_::tuple;
-using GTEST_TUPLE_NAMESPACE_::tuple_size;
-using GTEST_TUPLE_NAMESPACE_::tuple_element;
-#endif // defined(GTEST_TUPLE_NAMESPACE_)
-
-namespace internal {
-
-// A secret type that Google Test users don't know about. It has no
-// definition on purpose. Therefore it's impossible to create a
-// Secret object, which is what we want.
-class Secret;
-
-// The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile time
-// expression is true. For example, you could use it to verify the
-// size of a static array:
-//
-// GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES,
-// names_incorrect_size);
-//
-// or to make sure a struct is smaller than a certain size:
-//
-// GTEST_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large);
-//
-// The second argument to the macro is the name of the variable. If
-// the expression is false, most compilers will issue a warning/error
-// containing the name of the variable.
-
-template <bool>
-struct CompileAssert {
-};
-
-#define GTEST_COMPILE_ASSERT_(expr, msg) \
- typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
- msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
-
-// Implementation details of GTEST_COMPILE_ASSERT_:
-//
-// - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1
-// elements (and thus is invalid) when the expression is false.
-//
-// - The simpler definition
-//
-// #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]
-//
-// does not work, as gcc supports variable-length arrays whose sizes
-// are determined at run-time (this is gcc's extension and not part
-// of the C++ standard). As a result, gcc fails to reject the
-// following code with the simple definition:
-//
-// int foo;
-// GTEST_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is
-// // not a compile-time constant.
-//
-// - By using the type CompileAssert<(bool(expr))>, we ensures that
-// expr is a compile-time constant. (Template arguments must be
-// determined at compile-time.)
-//
-// - The outter parentheses in CompileAssert<(bool(expr))> are necessary
-// to work around a bug in gcc 3.4.4 and 4.0.1. If we had written
-//
-// CompileAssert<bool(expr)>
-//
-// instead, these compilers will refuse to compile
-//
-// GTEST_COMPILE_ASSERT_(5 > 0, some_message);
-//
-// (They seem to think the ">" in "5 > 0" marks the end of the
-// template argument list.)
-//
-// - The array size is (bool(expr) ? 1 : -1), instead of simply
-//
-// ((expr) ? 1 : -1).
-//
-// This is to avoid running into a bug in MS VC 7.1, which
-// causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
-
-// StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h.
-//
-// This template is declared, but intentionally undefined.
-template <typename T1, typename T2>
-struct StaticAssertTypeEqHelper;
-
-template <typename T>
-struct StaticAssertTypeEqHelper<T, T> {
- enum { value = true };
-};
-
-// Evaluates to the number of elements in 'array'.
-#define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0]))
-
-#if GTEST_HAS_GLOBAL_STRING
-typedef ::string string;
-#else
-typedef ::std::string string;
-#endif // GTEST_HAS_GLOBAL_STRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
-typedef ::wstring wstring;
-#elif GTEST_HAS_STD_WSTRING
-typedef ::std::wstring wstring;
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-// A helper for suppressing warnings on constant condition. It just
-// returns 'condition'.
-GTEST_API_ bool IsTrue(bool condition);
-
-// Defines scoped_ptr.
-
-// This implementation of scoped_ptr is PARTIAL - it only contains
-// enough stuff to satisfy Google Test's need.
-template <typename T>
-class scoped_ptr {
- public:
- typedef T element_type;
-
- explicit scoped_ptr(T* p = NULL) : ptr_(p) {}
- ~scoped_ptr() { reset(); }
-
- T& operator*() const { return *ptr_; }
- T* operator->() const { return ptr_; }
- T* get() const { return ptr_; }
-
- T* release() {
- T* const ptr = ptr_;
- ptr_ = NULL;
- return ptr;
- }
-
- void reset(T* p = NULL) {
- if (p != ptr_) {
- if (IsTrue(sizeof(T) > 0)) { // Makes sure T is a complete type.
- delete ptr_;
- }
- ptr_ = p;
- }
- }
-
- friend void swap(scoped_ptr& a, scoped_ptr& b) {
- using std::swap;
- swap(a.ptr_, b.ptr_);
- }
-
- private:
- T* ptr_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
-};
-
-// Defines RE.
-
-// A simple C++ wrapper for <regex.h>. It uses the POSIX Extended
-// Regular Expression syntax.
-class GTEST_API_ RE {
- public:
- // A copy constructor is required by the Standard to initialize object
- // references from r-values.
- RE(const RE& other) { Init(other.pattern()); }
-
- // Constructs an RE from a string.
- RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT
-
-#if GTEST_HAS_GLOBAL_STRING
-
- RE(const ::string& regex) { Init(regex.c_str()); } // NOLINT
-
-#endif // GTEST_HAS_GLOBAL_STRING
-
- RE(const char* regex) { Init(regex); } // NOLINT
- ~RE();
-
- // Returns the string representation of the regex.
- const char* pattern() const { return pattern_; }
-
- // FullMatch(str, re) returns true iff regular expression re matches
- // the entire str.
- // PartialMatch(str, re) returns true iff regular expression re
- // matches a substring of str (including str itself).
- //
- // TODO(wan@google.com): make FullMatch() and PartialMatch() work
- // when str contains NUL characters.
- static bool FullMatch(const ::std::string& str, const RE& re) {
- return FullMatch(str.c_str(), re);
- }
- static bool PartialMatch(const ::std::string& str, const RE& re) {
- return PartialMatch(str.c_str(), re);
- }
-
-#if GTEST_HAS_GLOBAL_STRING
-
- static bool FullMatch(const ::string& str, const RE& re) {
- return FullMatch(str.c_str(), re);
- }
- static bool PartialMatch(const ::string& str, const RE& re) {
- return PartialMatch(str.c_str(), re);
- }
-
-#endif // GTEST_HAS_GLOBAL_STRING
-
- static bool FullMatch(const char* str, const RE& re);
- static bool PartialMatch(const char* str, const RE& re);
-
- private:
- void Init(const char* regex);
-
- // We use a const char* instead of an std::string, as Google Test used to be
- // used where std::string is not available. TODO(wan@google.com): change to
- // std::string.
- const char* pattern_;
- bool is_valid_;
-
-#if GTEST_USES_POSIX_RE
-
- regex_t full_regex_; // For FullMatch().
- regex_t partial_regex_; // For PartialMatch().
-
-#else // GTEST_USES_SIMPLE_RE
-
- const char* full_pattern_; // For FullMatch();
-
-#endif
-
- GTEST_DISALLOW_ASSIGN_(RE);
-};
-
-// Formats a source file path and a line number as they would appear
-// in an error message from the compiler used to compile this code.
-GTEST_API_ ::std::string FormatFileLocation(const char* file, int line);
-
-// Formats a file location for compiler-independent XML output.
-// Although this function is not platform dependent, we put it next to
-// FormatFileLocation in order to contrast the two functions.
-GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,
- int line);
-
-// Defines logging utilities:
-// GTEST_LOG_(severity) - logs messages at the specified severity level. The
-// message itself is streamed into the macro.
-// LogToStderr() - directs all log messages to stderr.
-// FlushInfoLog() - flushes informational log messages.
-
-enum GTestLogSeverity {
- GTEST_INFO,
- GTEST_WARNING,
- GTEST_ERROR,
- GTEST_FATAL
-};
-
-// Formats log entry severity, provides a stream object for streaming the
-// log message, and terminates the message with a newline when going out of
-// scope.
-class GTEST_API_ GTestLog {
- public:
- GTestLog(GTestLogSeverity severity, const char* file, int line);
-
- // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
- ~GTestLog();
-
- ::std::ostream& GetStream() { return ::std::cerr; }
-
- private:
- const GTestLogSeverity severity_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);
-};
-
-#define GTEST_LOG_(severity) \
- ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
- __FILE__, __LINE__).GetStream()
-
-inline void LogToStderr() {}
-inline void FlushInfoLog() { fflush(NULL); }
-
-// INTERNAL IMPLEMENTATION - DO NOT USE.
-//
-// GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
-// is not satisfied.
-// Synopsys:
-// GTEST_CHECK_(boolean_condition);
-// or
-// GTEST_CHECK_(boolean_condition) << "Additional message";
-//
-// This checks the condition and if the condition is not satisfied
-// it prints message about the condition violation, including the
-// condition itself, plus additional message streamed into it, if any,
-// and then it aborts the program. It aborts the program irrespective of
-// whether it is built in the debug mode or not.
-#define GTEST_CHECK_(condition) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::IsTrue(condition)) \
- ; \
- else \
- GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
-
-// An all-mode assert to verify that the given POSIX-style function
-// call returns 0 (indicating success). Known limitation: this
-// doesn't expand to a balanced 'if' statement, so enclose the macro
-// in {} if you need to use it as the only statement in an 'if'
-// branch.
-#define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \
- if (const int gtest_error = (posix_call)) \
- GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
- << gtest_error
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Use ImplicitCast_ as a safe version of static_cast for upcasting in
-// the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a
-// const Foo*). When you use ImplicitCast_, the compiler checks that
-// the cast is safe. Such explicit ImplicitCast_s are necessary in
-// surprisingly many situations where C++ demands an exact type match
-// instead of an argument type convertable to a target type.
-//
-// The syntax for using ImplicitCast_ is the same as for static_cast:
-//
-// ImplicitCast_<ToType>(expr)
-//
-// ImplicitCast_ would have been part of the C++ standard library,
-// but the proposal was submitted too late. It will probably make
-// its way into the language in the future.
-//
-// This relatively ugly name is intentional. It prevents clashes with
-// similar functions users may have (e.g., implicit_cast). The internal
-// namespace alone is not enough because the function can be found by ADL.
-template<typename To>
-inline To ImplicitCast_(To x) { return x; }
-
-// When you upcast (that is, cast a pointer from type Foo to type
-// SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts
-// always succeed. When you downcast (that is, cast a pointer from
-// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
-// how do you know the pointer is really of type SubclassOfFoo? It
-// could be a bare Foo, or of type DifferentSubclassOfFoo. Thus,
-// when you downcast, you should use this macro. In debug mode, we
-// use dynamic_cast<> to double-check the downcast is legal (we die
-// if it's not). In normal mode, we do the efficient static_cast<>
-// instead. Thus, it's important to test in debug mode to make sure
-// the cast is legal!
-// This is the only place in the code we should use dynamic_cast<>.
-// In particular, you SHOULDN'T be using dynamic_cast<> in order to
-// do RTTI (eg code like this:
-// if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
-// if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
-// You should design the code some other way not to need this.
-//
-// This relatively ugly name is intentional. It prevents clashes with
-// similar functions users may have (e.g., down_cast). The internal
-// namespace alone is not enough because the function can be found by ADL.
-template<typename To, typename From> // use like this: DownCast_<T*>(foo);
-inline To DownCast_(From* f) { // so we only accept pointers
- // Ensures that To is a sub-type of From *. This test is here only
- // for compile-time type checking, and has no overhead in an
- // optimized build at run-time, as it will be optimized away
- // completely.
- GTEST_INTENTIONAL_CONST_COND_PUSH_()
- if (false) {
- GTEST_INTENTIONAL_CONST_COND_POP_()
- const To to = NULL;
- ::testing::internal::ImplicitCast_<From*>(to);
- }
-
-#if GTEST_HAS_RTTI
- // RTTI: debug mode only!
- GTEST_CHECK_(f == NULL || dynamic_cast<To>(f) != NULL);
-#endif
- return static_cast<To>(f);
-}
-
-// Downcasts the pointer of type Base to Derived.
-// Derived must be a subclass of Base. The parameter MUST
-// point to a class of type Derived, not any subclass of it.
-// When RTTI is available, the function performs a runtime
-// check to enforce this.
-template <class Derived, class Base>
-Derived* CheckedDowncastToActualType(Base* base) {
-#if GTEST_HAS_RTTI
- GTEST_CHECK_(typeid(*base) == typeid(Derived));
- return dynamic_cast<Derived*>(base); // NOLINT
-#else
- return static_cast<Derived*>(base); // Poor man's downcast.
-#endif
-}
-
-#if GTEST_HAS_STREAM_REDIRECTION
-
-// Defines the stderr capturer:
-// CaptureStdout - starts capturing stdout.
-// GetCapturedStdout - stops capturing stdout and returns the captured string.
-// CaptureStderr - starts capturing stderr.
-// GetCapturedStderr - stops capturing stderr and returns the captured string.
-//
-GTEST_API_ void CaptureStdout();
-GTEST_API_ std::string GetCapturedStdout();
-GTEST_API_ void CaptureStderr();
-GTEST_API_ std::string GetCapturedStderr();
-
-#endif // GTEST_HAS_STREAM_REDIRECTION
-
-
-#if GTEST_HAS_DEATH_TEST
-
-const ::std::vector<testing::internal::string>& GetInjectableArgvs();
-void SetInjectableArgvs(const ::std::vector<testing::internal::string>*
- new_argvs);
-
-// A copy of all command line arguments. Set by InitGoogleTest().
-extern ::std::vector<testing::internal::string> g_argvs;
-
-#endif // GTEST_HAS_DEATH_TEST
-
-// Defines synchronization primitives.
-#if GTEST_IS_THREADSAFE
-# if GTEST_HAS_PTHREAD
-// Sleeps for (roughly) n milliseconds. This function is only for testing
-// Google Test's own constructs. Don't use it in user tests, either
-// directly or indirectly.
-inline void SleepMilliseconds(int n) {
- const timespec time = {
- 0, // 0 seconds.
- n * 1000L * 1000L, // And n ms.
- };
- nanosleep(&time, NULL);
-}
-# endif // GTEST_HAS_PTHREAD
-
-# if 0 // OS detection
-# elif GTEST_HAS_PTHREAD
-// Allows a controller thread to pause execution of newly created
-// threads until notified. Instances of this class must be created
-// and destroyed in the controller thread.
-//
-// This class is only for testing Google Test's own constructs. Do not
-// use it in user tests, either directly or indirectly.
-class Notification {
- public:
- Notification() : notified_(false) {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
- }
- ~Notification() {
- pthread_mutex_destroy(&mutex_);
- }
-
- // Notifies all threads created with this notification to start. Must
- // be called from the controller thread.
- void Notify() {
- pthread_mutex_lock(&mutex_);
- notified_ = true;
- pthread_mutex_unlock(&mutex_);
- }
-
- // Blocks until the controller thread notifies. Must be called from a test
- // thread.
- void WaitForNotification() {
- for (;;) {
- pthread_mutex_lock(&mutex_);
- const bool notified = notified_;
- pthread_mutex_unlock(&mutex_);
- if (notified)
- break;
- SleepMilliseconds(10);
- }
- }
-
- private:
- pthread_mutex_t mutex_;
- bool notified_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
-};
-
-# elif GTEST_OS_WINDOWS
-
-GTEST_API_ void SleepMilliseconds(int n);
-
-// Provides leak-safe Windows kernel handle ownership.
-// Used in death tests and in threading support.
-class GTEST_API_ AutoHandle {
- public:
- // Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to
- // avoid including <windows.h> in this header file. Including <windows.h> is
- // undesirable because it defines a lot of symbols and macros that tend to
- // conflict with client code. This assumption is verified by
- // WindowsTypesTest.HANDLEIsVoidStar.
- typedef void* Handle;
- AutoHandle();
- explicit AutoHandle(Handle handle);
-
- ~AutoHandle();
-
- Handle Get() const;
- void Reset();
- void Reset(Handle handle);
-
- private:
- // Returns true iff the handle is a valid handle object that can be closed.
- bool IsCloseable() const;
-
- Handle handle_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
-};
-
-// Allows a controller thread to pause execution of newly created
-// threads until notified. Instances of this class must be created
-// and destroyed in the controller thread.
-//
-// This class is only for testing Google Test's own constructs. Do not
-// use it in user tests, either directly or indirectly.
-class GTEST_API_ Notification {
- public:
- Notification();
- void Notify();
- void WaitForNotification();
-
- private:
- AutoHandle event_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
-};
-# endif // OS detection
-
-// On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD
-// defined, but we don't want to use MinGW's pthreads implementation, which
-// has conformance problems with some versions of the POSIX standard.
-# if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW
-
-// As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
-// Consequently, it cannot select a correct instantiation of ThreadWithParam
-// in order to call its Run(). Introducing ThreadWithParamBase as a
-// non-templated base class for ThreadWithParam allows us to bypass this
-// problem.
-class ThreadWithParamBase {
- public:
- virtual ~ThreadWithParamBase() {}
- virtual void Run() = 0;
-};
-
-// pthread_create() accepts a pointer to a function type with the C linkage.
-// According to the Standard (7.5/1), function types with different linkages
-// are different even if they are otherwise identical. Some compilers (for
-// example, SunStudio) treat them as different types. Since class methods
-// cannot be defined with C-linkage we need to define a free C-function to
-// pass into pthread_create().
-extern "C" inline void* ThreadFuncWithCLinkage(void* thread) {
- static_cast<ThreadWithParamBase*>(thread)->Run();
- return NULL;
-}
-
-// Helper class for testing Google Test's multi-threading constructs.
-// To use it, write:
-//
-// void ThreadFunc(int param) { /* Do things with param */ }
-// Notification thread_can_start;
-// ...
-// // The thread_can_start parameter is optional; you can supply NULL.
-// ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start);
-// thread_can_start.Notify();
-//
-// These classes are only for testing Google Test's own constructs. Do
-// not use them in user tests, either directly or indirectly.
-template <typename T>
-class ThreadWithParam : public ThreadWithParamBase {
- public:
- typedef void UserThreadFunc(T);
-
- ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
- : func_(func),
- param_(param),
- thread_can_start_(thread_can_start),
- finished_(false) {
- ThreadWithParamBase* const base = this;
- // The thread can be created only after all fields except thread_
- // have been initialized.
- GTEST_CHECK_POSIX_SUCCESS_(
- pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base));
- }
- ~ThreadWithParam() { Join(); }
-
- void Join() {
- if (!finished_) {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, 0));
- finished_ = true;
- }
- }
-
- virtual void Run() {
- if (thread_can_start_ != NULL)
- thread_can_start_->WaitForNotification();
- func_(param_);
- }
-
- private:
- UserThreadFunc* const func_; // User-supplied thread function.
- const T param_; // User-supplied parameter to the thread function.
- // When non-NULL, used to block execution until the controller thread
- // notifies.
- Notification* const thread_can_start_;
- bool finished_; // true iff we know that the thread function has finished.
- pthread_t thread_; // The native thread object.
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
-};
-# endif // GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW
-
-# if 0 // OS detection
-# elif GTEST_OS_WINDOWS
-
-// Mutex implements mutex on Windows platforms. It is used in conjunction
-// with class MutexLock:
-//
-// Mutex mutex;
-// ...
-// MutexLock lock(&mutex); // Acquires the mutex and releases it at the
-// // end of the current scope.
-//
-// A static Mutex *must* be defined or declared using one of the following
-// macros:
-// GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);
-// GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
-//
-// (A non-static Mutex is defined/declared in the usual way).
-class GTEST_API_ Mutex {
- public:
- enum MutexType { kStatic = 0, kDynamic = 1 };
- // We rely on kStaticMutex being 0 as it is to what the linker initializes
- // type_ in static mutexes. critical_section_ will be initialized lazily
- // in ThreadSafeLazyInit().
- enum StaticConstructorSelector { kStaticMutex = 0 };
-
- // This constructor intentionally does nothing. It relies on type_ being
- // statically initialized to 0 (effectively setting it to kStatic) and on
- // ThreadSafeLazyInit() to lazily initialize the rest of the members.
- explicit Mutex(StaticConstructorSelector /*dummy*/) {}
-
- Mutex();
- ~Mutex();
-
- void Lock();
-
- void Unlock();
-
- // Does nothing if the current thread holds the mutex. Otherwise, crashes
- // with high probability.
- void AssertHeld();
-
- private:
- // Initializes owner_thread_id_ and critical_section_ in static mutexes.
- void ThreadSafeLazyInit();
-
- // Per http://blogs.msdn.com/b/oldnewthing/archive/2004/02/23/78395.aspx,
- // we assume that 0 is an invalid value for thread IDs.
- unsigned int owner_thread_id_;
-
- // For static mutexes, we rely on these members being initialized to zeros
- // by the linker.
- MutexType type_;
- long critical_section_init_phase_; // NOLINT
- _RTL_CRITICAL_SECTION* critical_section_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
-};
-
-# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
- extern ::testing::internal::Mutex mutex
-
-# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
- ::testing::internal::Mutex mutex(::testing::internal::Mutex::kStaticMutex)
-
-// We cannot name this class MutexLock because the ctor declaration would
-// conflict with a macro named MutexLock, which is defined on some
-// platforms. That macro is used as a defensive measure to prevent against
-// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
-// "MutexLock l(&mu)". Hence the typedef trick below.
-class GTestMutexLock {
- public:
- explicit GTestMutexLock(Mutex* mutex)
- : mutex_(mutex) { mutex_->Lock(); }
-
- ~GTestMutexLock() { mutex_->Unlock(); }
-
- private:
- Mutex* const mutex_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
-};
-
-typedef GTestMutexLock MutexLock;
-
-// Base class for ValueHolder<T>. Allows a caller to hold and delete a value
-// without knowing its type.
-class ThreadLocalValueHolderBase {
- public:
- virtual ~ThreadLocalValueHolderBase() {}
-};
-
-// Provides a way for a thread to send notifications to a ThreadLocal
-// regardless of its parameter type.
-class ThreadLocalBase {
- public:
- // Creates a new ValueHolder<T> object holding a default value passed to
- // this ThreadLocal<T>'s constructor and returns it. It is the caller's
- // responsibility not to call this when the ThreadLocal<T> instance already
- // has a value on the current thread.
- virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0;
-
- protected:
- ThreadLocalBase() {}
- virtual ~ThreadLocalBase() {}
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocalBase);
-};
-
-// Maps a thread to a set of ThreadLocals that have values instantiated on that
-// thread and notifies them when the thread exits. A ThreadLocal instance is
-// expected to persist until all threads it has values on have terminated.
-class GTEST_API_ ThreadLocalRegistry {
- public:
- // Registers thread_local_instance as having value on the current thread.
- // Returns a value that can be used to identify the thread from other threads.
- static ThreadLocalValueHolderBase* GetValueOnCurrentThread(
- const ThreadLocalBase* thread_local_instance);
-
- // Invoked when a ThreadLocal instance is destroyed.
- static void OnThreadLocalDestroyed(
- const ThreadLocalBase* thread_local_instance);
-};
-
-class GTEST_API_ ThreadWithParamBase {
- public:
- void Join();
-
- protected:
- class Runnable {
- public:
- virtual ~Runnable() {}
- virtual void Run() = 0;
- };
-
- ThreadWithParamBase(Runnable *runnable, Notification* thread_can_start);
- virtual ~ThreadWithParamBase();
-
- private:
- AutoHandle thread_;
-};
-
-// Helper class for testing Google Test's multi-threading constructs.
-template <typename T>
-class ThreadWithParam : public ThreadWithParamBase {
- public:
- typedef void UserThreadFunc(T);
-
- ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
- : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {
- }
- virtual ~ThreadWithParam() {}
-
- private:
- class RunnableImpl : public Runnable {
- public:
- RunnableImpl(UserThreadFunc* func, T param)
- : func_(func),
- param_(param) {
- }
- virtual ~RunnableImpl() {}
- virtual void Run() {
- func_(param_);
- }
-
- private:
- UserThreadFunc* const func_;
- const T param_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(RunnableImpl);
- };
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
-};
-
-// Implements thread-local storage on Windows systems.
-//
-// // Thread 1
-// ThreadLocal<int> tl(100); // 100 is the default value for each thread.
-//
-// // Thread 2
-// tl.set(150); // Changes the value for thread 2 only.
-// EXPECT_EQ(150, tl.get());
-//
-// // Thread 1
-// EXPECT_EQ(100, tl.get()); // In thread 1, tl has the original value.
-// tl.set(200);
-// EXPECT_EQ(200, tl.get());
-//
-// The template type argument T must have a public copy constructor.
-// In addition, the default ThreadLocal constructor requires T to have
-// a public default constructor.
-//
-// The users of a TheadLocal instance have to make sure that all but one
-// threads (including the main one) using that instance have exited before
-// destroying it. Otherwise, the per-thread objects managed for them by the
-// ThreadLocal instance are not guaranteed to be destroyed on all platforms.
-//
-// Google Test only uses global ThreadLocal objects. That means they
-// will die after main() has returned. Therefore, no per-thread
-// object managed by Google Test will be leaked as long as all threads
-// using Google Test have exited when main() returns.
-template <typename T>
-class ThreadLocal : public ThreadLocalBase {
- public:
- ThreadLocal() : default_() {}
- explicit ThreadLocal(const T& value) : default_(value) {}
-
- ~ThreadLocal() { ThreadLocalRegistry::OnThreadLocalDestroyed(this); }
-
- T* pointer() { return GetOrCreateValue(); }
- const T* pointer() const { return GetOrCreateValue(); }
- const T& get() const { return *pointer(); }
- void set(const T& value) { *pointer() = value; }
-
- private:
- // Holds a value of T. Can be deleted via its base class without the caller
- // knowing the type of T.
- class ValueHolder : public ThreadLocalValueHolderBase {
- public:
- explicit ValueHolder(const T& value) : value_(value) {}
-
- T* pointer() { return &value_; }
-
- private:
- T value_;
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
- };
-
-
- T* GetOrCreateValue() const {
- return static_cast<ValueHolder*>(
- ThreadLocalRegistry::GetValueOnCurrentThread(this))->pointer();
- }
-
- virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const {
- return new ValueHolder(default_);
- }
-
- const T default_; // The default value for each thread.
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
-};
-
-# elif GTEST_HAS_PTHREAD
-
-// MutexBase and Mutex implement mutex on pthreads-based platforms.
-class MutexBase {
- public:
- // Acquires this mutex.
- void Lock() {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
- owner_ = pthread_self();
- has_owner_ = true;
- }
-
- // Releases this mutex.
- void Unlock() {
- // Since the lock is being released the owner_ field should no longer be
- // considered valid. We don't protect writing to has_owner_ here, as it's
- // the caller's responsibility to ensure that the current thread holds the
- // mutex when this is called.
- has_owner_ = false;
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
- }
-
- // Does nothing if the current thread holds the mutex. Otherwise, crashes
- // with high probability.
- void AssertHeld() const {
- GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
- << "The current thread is not holding the mutex @" << this;
- }
-
- // A static mutex may be used before main() is entered. It may even
- // be used before the dynamic initialization stage. Therefore we
- // must be able to initialize a static mutex object at link time.
- // This means MutexBase has to be a POD and its member variables
- // have to be public.
- public:
- pthread_mutex_t mutex_; // The underlying pthread mutex.
- // has_owner_ indicates whether the owner_ field below contains a valid thread
- // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All
- // accesses to the owner_ field should be protected by a check of this field.
- // An alternative might be to memset() owner_ to all zeros, but there's no
- // guarantee that a zero'd pthread_t is necessarily invalid or even different
- // from pthread_self().
- bool has_owner_;
- pthread_t owner_; // The thread holding the mutex.
-};
-
-// Forward-declares a static mutex.
-# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
- extern ::testing::internal::MutexBase mutex
-
-// Defines and statically (i.e. at link time) initializes a static mutex.
-// The initialization list here does not explicitly initialize each field,
-// instead relying on default initialization for the unspecified fields. In
-// particular, the owner_ field (a pthread_t) is not explicitly initialized.
-// This allows initialization to work whether pthread_t is a scalar or struct.
-// The flag -Wmissing-field-initializers must not be specified for this to work.
-# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
- ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false }
-
-// The Mutex class can only be used for mutexes created at runtime. It
-// shares its API with MutexBase otherwise.
-class Mutex : public MutexBase {
- public:
- Mutex() {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
- has_owner_ = false;
- }
- ~Mutex() {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
- }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
-};
-
-// We cannot name this class MutexLock because the ctor declaration would
-// conflict with a macro named MutexLock, which is defined on some
-// platforms. That macro is used as a defensive measure to prevent against
-// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
-// "MutexLock l(&mu)". Hence the typedef trick below.
-class GTestMutexLock {
- public:
- explicit GTestMutexLock(MutexBase* mutex)
- : mutex_(mutex) { mutex_->Lock(); }
-
- ~GTestMutexLock() { mutex_->Unlock(); }
-
- private:
- MutexBase* const mutex_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
-};
-
-typedef GTestMutexLock MutexLock;
-
-// Helpers for ThreadLocal.
-
-// pthread_key_create() requires DeleteThreadLocalValue() to have
-// C-linkage. Therefore it cannot be templatized to access
-// ThreadLocal<T>. Hence the need for class
-// ThreadLocalValueHolderBase.
-class ThreadLocalValueHolderBase {
- public:
- virtual ~ThreadLocalValueHolderBase() {}
-};
-
-// Called by pthread to delete thread-local data stored by
-// pthread_setspecific().
-extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
- delete static_cast<ThreadLocalValueHolderBase*>(value_holder);
-}
-
-// Implements thread-local storage on pthreads-based systems.
-template <typename T>
-class ThreadLocal {
- public:
- ThreadLocal() : key_(CreateKey()),
- default_() {}
- explicit ThreadLocal(const T& value) : key_(CreateKey()),
- default_(value) {}
-
- ~ThreadLocal() {
- // Destroys the managed object for the current thread, if any.
- DeleteThreadLocalValue(pthread_getspecific(key_));
-
- // Releases resources associated with the key. This will *not*
- // delete managed objects for other threads.
- GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));
- }
-
- T* pointer() { return GetOrCreateValue(); }
- const T* pointer() const { return GetOrCreateValue(); }
- const T& get() const { return *pointer(); }
- void set(const T& value) { *pointer() = value; }
-
- private:
- // Holds a value of type T.
- class ValueHolder : public ThreadLocalValueHolderBase {
- public:
- explicit ValueHolder(const T& value) : value_(value) {}
-
- T* pointer() { return &value_; }
-
- private:
- T value_;
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
- };
-
- static pthread_key_t CreateKey() {
- pthread_key_t key;
- // When a thread exits, DeleteThreadLocalValue() will be called on
- // the object managed for that thread.
- GTEST_CHECK_POSIX_SUCCESS_(
- pthread_key_create(&key, &DeleteThreadLocalValue));
- return key;
- }
-
- T* GetOrCreateValue() const {
- ThreadLocalValueHolderBase* const holder =
- static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));
- if (holder != NULL) {
- return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
- }
-
- ValueHolder* const new_holder = new ValueHolder(default_);
- ThreadLocalValueHolderBase* const holder_base = new_holder;
- GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));
- return new_holder->pointer();
- }
-
- // A key pthreads uses for looking up per-thread values.
- const pthread_key_t key_;
- const T default_; // The default value for each thread.
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
-};
-
-# endif // OS detection
-
-#else // GTEST_IS_THREADSAFE
-
-// A dummy implementation of synchronization primitives (mutex, lock,
-// and thread-local variable). Necessary for compiling Google Test where
-// mutex is not supported - using Google Test in multiple threads is not
-// supported on such platforms.
-
-class Mutex {
- public:
- Mutex() {}
- void Lock() {}
- void Unlock() {}
- void AssertHeld() const {}
-};
-
-# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
- extern ::testing::internal::Mutex mutex
-
-# define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
-
-// We cannot name this class MutexLock because the ctor declaration would
-// conflict with a macro named MutexLock, which is defined on some
-// platforms. That macro is used as a defensive measure to prevent against
-// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
-// "MutexLock l(&mu)". Hence the typedef trick below.
-class GTestMutexLock {
- public:
- explicit GTestMutexLock(Mutex*) {} // NOLINT
-};
-
-typedef GTestMutexLock MutexLock;
-
-template <typename T>
-class ThreadLocal {
- public:
- ThreadLocal() : value_() {}
- explicit ThreadLocal(const T& value) : value_(value) {}
- T* pointer() { return &value_; }
- const T* pointer() const { return &value_; }
- const T& get() const { return value_; }
- void set(const T& value) { value_ = value; }
- private:
- T value_;
-};
-
-#endif // GTEST_IS_THREADSAFE
-
-// Returns the number of threads running in the process, or 0 to indicate that
-// we cannot detect it.
-GTEST_API_ size_t GetThreadCount();
-
-// Passing non-POD classes through ellipsis (...) crashes the ARM
-// compiler and generates a warning in Sun Studio. The Nokia Symbian
-// and the IBM XL C/C++ compiler try to instantiate a copy constructor
-// for objects passed through ellipsis (...), failing for uncopyable
-// objects. We define this to ensure that only POD is passed through
-// ellipsis on these systems.
-#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
-// We lose support for NULL detection where the compiler doesn't like
-// passing non-POD classes through ellipsis (...).
-# define GTEST_ELLIPSIS_NEEDS_POD_ 1
-#else
-# define GTEST_CAN_COMPARE_NULL 1
-#endif
-
-// The Nokia Symbian and IBM XL C/C++ compilers cannot decide between
-// const T& and const T* in a function template. These compilers
-// _can_ decide between class template specializations for T and T*,
-// so a tr1::type_traits-like is_pointer works.
-#if defined(__SYMBIAN32__) || defined(__IBMCPP__)
-# define GTEST_NEEDS_IS_POINTER_ 1
-#endif
-
-template <bool bool_value>
-struct bool_constant {
- typedef bool_constant<bool_value> type;
- static const bool value = bool_value;
-};
-template <bool bool_value> const bool bool_constant<bool_value>::value;
-
-typedef bool_constant<false> false_type;
-typedef bool_constant<true> true_type;
-
-template <typename T>
-struct is_pointer : public false_type {};
-
-template <typename T>
-struct is_pointer<T*> : public true_type {};
-
-template <typename Iterator>
-struct IteratorTraits {
- typedef typename Iterator::value_type value_type;
-};
-
-template <typename T>
-struct IteratorTraits<T*> {
- typedef T value_type;
-};
-
-template <typename T>
-struct IteratorTraits<const T*> {
- typedef T value_type;
-};
-
-#if GTEST_OS_WINDOWS
-# define GTEST_PATH_SEP_ "\\"
-# define GTEST_HAS_ALT_PATH_SEP_ 1
-// The biggest signed integer type the compiler supports.
-typedef __int64 BiggestInt;
-#else
-# define GTEST_PATH_SEP_ "/"
-# define GTEST_HAS_ALT_PATH_SEP_ 0
-typedef long long BiggestInt; // NOLINT
-#endif // GTEST_OS_WINDOWS
-
-// Utilities for char.
-
-// isspace(int ch) and friends accept an unsigned char or EOF. char
-// may be signed, depending on the compiler (or compiler flags).
-// Therefore we need to cast a char to unsigned char before calling
-// isspace(), etc.
-
-inline bool IsAlpha(char ch) {
- return isalpha(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsAlNum(char ch) {
- return isalnum(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsDigit(char ch) {
- return isdigit(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsLower(char ch) {
- return islower(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsSpace(char ch) {
- return isspace(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsUpper(char ch) {
- return isupper(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsXDigit(char ch) {
- return isxdigit(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsXDigit(wchar_t ch) {
- const unsigned char low_byte = static_cast<unsigned char>(ch);
- return ch == low_byte && isxdigit(low_byte) != 0;
-}
-
-inline char ToLower(char ch) {
- return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
-}
-inline char ToUpper(char ch) {
- return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
-}
-
-// The testing::internal::posix namespace holds wrappers for common
-// POSIX functions. These wrappers hide the differences between
-// Windows/MSVC and POSIX systems. Since some compilers define these
-// standard functions as macros, the wrapper cannot have the same name
-// as the wrapped function.
-
-namespace posix {
-
-// Functions with a different name on Windows.
-
-#if GTEST_OS_WINDOWS
-
-typedef struct _stat StatStruct;
-
-# ifdef __BORLANDC__
-inline int IsATTY(int fd) { return isatty(fd); }
-inline int StrCaseCmp(const char* s1, const char* s2) {
- return stricmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return strdup(src); }
-# else // !__BORLANDC__
-# if GTEST_OS_WINDOWS_MOBILE
-inline int IsATTY(int /* fd */) { return 0; }
-# else
-inline int IsATTY(int fd) { return _isatty(fd); }
-# endif // GTEST_OS_WINDOWS_MOBILE
-inline int StrCaseCmp(const char* s1, const char* s2) {
- return _stricmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return _strdup(src); }
-# endif // __BORLANDC__
-
-# if GTEST_OS_WINDOWS_MOBILE
-inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
-// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
-// time and thus not defined there.
-# else
-inline int FileNo(FILE* file) { return _fileno(file); }
-inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
-inline int RmDir(const char* dir) { return _rmdir(dir); }
-inline bool IsDir(const StatStruct& st) {
- return (_S_IFDIR & st.st_mode) != 0;
-}
-# endif // GTEST_OS_WINDOWS_MOBILE
-
-#else
-
-typedef struct stat StatStruct;
-
-inline int FileNo(FILE* file) { return fileno(file); }
-inline int IsATTY(int fd) { return isatty(fd); }
-inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }
-inline int StrCaseCmp(const char* s1, const char* s2) {
- return strcasecmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return strdup(src); }
-inline int RmDir(const char* dir) { return rmdir(dir); }
-inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
-
-#endif // GTEST_OS_WINDOWS
-
-// Functions deprecated by MSVC 8.0.
-
-GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996 /* deprecated function */)
-
-inline const char* StrNCpy(char* dest, const char* src, size_t n) {
- return strncpy(dest, src, n);
-}
-
-// ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
-// StrError() aren't needed on Windows CE at this time and thus not
-// defined there.
-
-#if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
-inline int ChDir(const char* dir) { return chdir(dir); }
-#endif
-inline FILE* FOpen(const char* path, const char* mode) {
- return fopen(path, mode);
-}
-#if !GTEST_OS_WINDOWS_MOBILE
-inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
- return freopen(path, mode, stream);
-}
-inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
-#endif
-inline int FClose(FILE* fp) { return fclose(fp); }
-#if !GTEST_OS_WINDOWS_MOBILE
-inline int Read(int fd, void* buf, unsigned int count) {
- return static_cast<int>(read(fd, buf, count));
-}
-inline int Write(int fd, const void* buf, unsigned int count) {
- return static_cast<int>(write(fd, buf, count));
-}
-inline int Close(int fd) { return close(fd); }
-inline const char* StrError(int errnum) { return strerror(errnum); }
-#endif
-inline const char* GetEnv(const char* name) {
-#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE | GTEST_OS_WINDOWS_RT
- // We are on Windows CE, which has no environment variables.
- return NULL;
-#elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
- // Environment variables which we programmatically clear will be set to the
- // empty string rather than unset (NULL). Handle that case.
- const char* const env = getenv(name);
- return (env != NULL && env[0] != '\0') ? env : NULL;
-#else
- return getenv(name);
-#endif
-}
-
-GTEST_DISABLE_MSC_WARNINGS_POP_()
-
-#if GTEST_OS_WINDOWS_MOBILE
-// Windows CE has no C library. The abort() function is used in
-// several places in Google Test. This implementation provides a reasonable
-// imitation of standard behaviour.
-void Abort();
-#else
-inline void Abort() { abort(); }
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-} // namespace posix
-
-// MSVC "deprecates" snprintf and issues warnings wherever it is used. In
-// order to avoid these warnings, we need to use _snprintf or _snprintf_s on
-// MSVC-based platforms. We map the GTEST_SNPRINTF_ macro to the appropriate
-// function in order to achieve that. We use macro definition here because
-// snprintf is a variadic function.
-#if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
-// MSVC 2005 and above support variadic macros.
-# define GTEST_SNPRINTF_(buffer, size, format, ...) \
- _snprintf_s(buffer, size, size, format, __VA_ARGS__)
-#elif defined(_MSC_VER)
-// Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't
-// complain about _snprintf.
-# define GTEST_SNPRINTF_ _snprintf
-#else
-# define GTEST_SNPRINTF_ snprintf
-#endif
-
-// The maximum number a BiggestInt can represent. This definition
-// works no matter BiggestInt is represented in one's complement or
-// two's complement.
-//
-// We cannot rely on numeric_limits in STL, as __int64 and long long
-// are not part of standard C++ and numeric_limits doesn't need to be
-// defined for them.
-const BiggestInt kMaxBiggestInt =
- ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));
-
-// This template class serves as a compile-time function from size to
-// type. It maps a size in bytes to a primitive type with that
-// size. e.g.
-//
-// TypeWithSize<4>::UInt
-//
-// is typedef-ed to be unsigned int (unsigned integer made up of 4
-// bytes).
-//
-// Such functionality should belong to STL, but I cannot find it
-// there.
-//
-// Google Test uses this class in the implementation of floating-point
-// comparison.
-//
-// For now it only handles UInt (unsigned int) as that's all Google Test
-// needs. Other types can be easily added in the future if need
-// arises.
-template <size_t size>
-class TypeWithSize {
- public:
- // This prevents the user from using TypeWithSize<N> with incorrect
- // values of N.
- typedef void UInt;
-};
-
-// The specialization for size 4.
-template <>
-class TypeWithSize<4> {
- public:
- // unsigned int has size 4 in both gcc and MSVC.
- //
- // As base/basictypes.h doesn't compile on Windows, we cannot use
- // uint32, uint64, and etc here.
- typedef int Int;
- typedef unsigned int UInt;
-};
-
-// The specialization for size 8.
-template <>
-class TypeWithSize<8> {
- public:
-#if GTEST_OS_WINDOWS
- typedef __int64 Int;
- typedef unsigned __int64 UInt;
-#else
- typedef long long Int; // NOLINT
- typedef unsigned long long UInt; // NOLINT
-#endif // GTEST_OS_WINDOWS
-};
-
-// Integer types of known sizes.
-typedef TypeWithSize<4>::Int Int32;
-typedef TypeWithSize<4>::UInt UInt32;
-typedef TypeWithSize<8>::Int Int64;
-typedef TypeWithSize<8>::UInt UInt64;
-typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
-
-// Utilities for command line flags and environment variables.
-
-// Macro for referencing flags.
-#define GTEST_FLAG(name) FLAGS_gtest_##name
-
-// Macros for declaring flags.
-#define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
-#define GTEST_DECLARE_int32_(name) \
- GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
-#define GTEST_DECLARE_string_(name) \
- GTEST_API_ extern ::std::string GTEST_FLAG(name)
-
-// Macros for defining flags.
-#define GTEST_DEFINE_bool_(name, default_val, doc) \
- GTEST_API_ bool GTEST_FLAG(name) = (default_val)
-#define GTEST_DEFINE_int32_(name, default_val, doc) \
- GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
-#define GTEST_DEFINE_string_(name, default_val, doc) \
- GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
-
-// Thread annotations
-#define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
-#define GTEST_LOCK_EXCLUDED_(locks)
-
-// Parses 'str' for a 32-bit signed integer. If successful, writes the result
-// to *value and returns true; otherwise leaves *value unchanged and returns
-// false.
-// TODO(chandlerc): Find a better way to refactor flag and environment parsing
-// out of both gtest-port.cc and gtest.cc to avoid exporting this utility
-// function.
-bool ParseInt32(const Message& src_text, const char* str, Int32* value);
-
-// Parses a bool/Int32/string from the environment variable
-// corresponding to the given Google Test flag.
-bool BoolFromGTestEnv(const char* flag, bool default_val);
-GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
-const char* StringFromGTestEnv(const char* flag, const char* default_val);
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
-
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-string.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-string.h
deleted file mode 100644
index 97f1a7f..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-string.h
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file declares the String class and functions used internally by
-// Google Test. They are subject to change without notice. They should not used
-// by code external to Google Test.
-//
-// This header file is #included by <gtest/internal/gtest-internal.h>.
-// It should not be #included by other files.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
-
-#ifdef __BORLANDC__
-// string.h is not guaranteed to provide strcpy on C++ Builder.
-# include <mem.h>
-#endif
-
-#include <string.h>
-#include <string>
-
-#include "gtest/internal/gtest-port.h"
-
-namespace testing {
-namespace internal {
-
-// String - an abstract class holding static string utilities.
-class GTEST_API_ String {
- public:
- // Static utility methods
-
- // Clones a 0-terminated C string, allocating memory using new. The
- // caller is responsible for deleting the return value using
- // delete[]. Returns the cloned string, or NULL if the input is
- // NULL.
- //
- // This is different from strdup() in string.h, which allocates
- // memory using malloc().
- static const char* CloneCString(const char* c_str);
-
-#if GTEST_OS_WINDOWS_MOBILE
- // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
- // able to pass strings to Win32 APIs on CE we need to convert them
- // to 'Unicode', UTF-16.
-
- // Creates a UTF-16 wide string from the given ANSI string, allocating
- // memory using new. The caller is responsible for deleting the return
- // value using delete[]. Returns the wide string, or NULL if the
- // input is NULL.
- //
- // The wide string is created using the ANSI codepage (CP_ACP) to
- // match the behaviour of the ANSI versions of Win32 calls and the
- // C runtime.
- static LPCWSTR AnsiToUtf16(const char* c_str);
-
- // Creates an ANSI string from the given wide string, allocating
- // memory using new. The caller is responsible for deleting the return
- // value using delete[]. Returns the ANSI string, or NULL if the
- // input is NULL.
- //
- // The returned string is created using the ANSI codepage (CP_ACP) to
- // match the behaviour of the ANSI versions of Win32 calls and the
- // C runtime.
- static const char* Utf16ToAnsi(LPCWSTR utf16_str);
-#endif
-
- // Compares two C strings. Returns true iff they have the same content.
- //
- // Unlike strcmp(), this function can handle NULL argument(s). A
- // NULL C string is considered different to any non-NULL C string,
- // including the empty string.
- static bool CStringEquals(const char* lhs, const char* rhs);
-
- // Converts a wide C string to a String using the UTF-8 encoding.
- // NULL will be converted to "(null)". If an error occurred during
- // the conversion, "(failed to convert from wide string)" is
- // returned.
- static std::string ShowWideCString(const wchar_t* wide_c_str);
-
- // Compares two wide C strings. Returns true iff they have the same
- // content.
- //
- // Unlike wcscmp(), this function can handle NULL argument(s). A
- // NULL C string is considered different to any non-NULL C string,
- // including the empty string.
- static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
-
- // Compares two C strings, ignoring case. Returns true iff they
- // have the same content.
- //
- // Unlike strcasecmp(), this function can handle NULL argument(s).
- // A NULL C string is considered different to any non-NULL C string,
- // including the empty string.
- static bool CaseInsensitiveCStringEquals(const char* lhs,
- const char* rhs);
-
- // Compares two wide C strings, ignoring case. Returns true iff they
- // have the same content.
- //
- // Unlike wcscasecmp(), this function can handle NULL argument(s).
- // A NULL C string is considered different to any non-NULL wide C string,
- // including the empty string.
- // NB: The implementations on different platforms slightly differ.
- // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
- // environment variable. On GNU platform this method uses wcscasecmp
- // which compares according to LC_CTYPE category of the current locale.
- // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
- // current locale.
- static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
- const wchar_t* rhs);
-
- // Returns true iff the given string ends with the given suffix, ignoring
- // case. Any string is considered to end with an empty suffix.
- static bool EndsWithCaseInsensitive(
- const std::string& str, const std::string& suffix);
-
- // Formats an int value as "%02d".
- static std::string FormatIntWidth2(int value); // "%02d" for width == 2
-
- // Formats an int value as "%X".
- static std::string FormatHexInt(int value);
-
- // Formats a byte as "%02X".
- static std::string FormatByte(unsigned char value);
-
- private:
- String(); // Not meant to be instantiated.
-}; // class String
-
-// Gets the content of the stringstream's buffer as an std::string. Each '\0'
-// character in the buffer is replaced with "\\0".
-GTEST_API_ std::string StringStreamToString(::std::stringstream* stream);
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-tuple.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-tuple.h
deleted file mode 100644
index e9b4053..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-tuple.h
+++ /dev/null
@@ -1,1020 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gtest-tuple.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2009 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-
-#include <utility> // For ::std::pair.
-
-// The compiler used in Symbian has a bug that prevents us from declaring the
-// tuple template as a friend (it complains that tuple is redefined). This
-// hack bypasses the bug by declaring the members that should otherwise be
-// private as public.
-// Sun Studio versions < 12 also have the above bug.
-#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
-# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
-#else
-# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
- template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
- private:
-#endif
-
-// Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that conflict
-// with our own definitions. Therefore using our own tuple does not work on
-// those compilers.
-#if defined(_MSC_VER) && _MSC_VER >= 1600 /* 1600 is Visual Studio 2010 */
-# error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \
-GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers."
-#endif
-
-// GTEST_n_TUPLE_(T) is the type of an n-tuple.
-#define GTEST_0_TUPLE_(T) tuple<>
-#define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
- void, void, void>
-#define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
- void, void, void>
-#define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
- void, void, void>
-#define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
- void, void, void>
-#define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
- void, void, void>
-#define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
- void, void, void>
-#define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- void, void, void>
-#define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- T##7, void, void>
-#define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- T##7, T##8, void>
-#define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- T##7, T##8, T##9>
-
-// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
-#define GTEST_0_TYPENAMES_(T)
-#define GTEST_1_TYPENAMES_(T) typename T##0
-#define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
-#define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
-#define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3
-#define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4
-#define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5
-#define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6
-#define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
-#define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6, \
- typename T##7, typename T##8
-#define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6, \
- typename T##7, typename T##8, typename T##9
-
-// In theory, defining stuff in the ::std namespace is undefined
-// behavior. We can do this as we are playing the role of a standard
-// library vendor.
-namespace std {
-namespace tr1 {
-
-template <typename T0 = void, typename T1 = void, typename T2 = void,
- typename T3 = void, typename T4 = void, typename T5 = void,
- typename T6 = void, typename T7 = void, typename T8 = void,
- typename T9 = void>
-class tuple;
-
-// Anything in namespace gtest_internal is Google Test's INTERNAL
-// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
-namespace gtest_internal {
-
-// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
-template <typename T>
-struct ByRef { typedef const T& type; }; // NOLINT
-template <typename T>
-struct ByRef<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper for ByRef.
-#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
-
-// AddRef<T>::type is T if T is a reference; otherwise it's T&. This
-// is the same as tr1::add_reference<T>::type.
-template <typename T>
-struct AddRef { typedef T& type; }; // NOLINT
-template <typename T>
-struct AddRef<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper for AddRef.
-#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
-
-// A helper for implementing get<k>().
-template <int k> class Get;
-
-// A helper for implementing tuple_element<k, T>. kIndexValid is true
-// iff k < the number of fields in tuple type T.
-template <bool kIndexValid, int kIndex, class Tuple>
-struct TupleElement;
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 0, GTEST_10_TUPLE_(T) > {
- typedef T0 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 1, GTEST_10_TUPLE_(T) > {
- typedef T1 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 2, GTEST_10_TUPLE_(T) > {
- typedef T2 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 3, GTEST_10_TUPLE_(T) > {
- typedef T3 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 4, GTEST_10_TUPLE_(T) > {
- typedef T4 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 5, GTEST_10_TUPLE_(T) > {
- typedef T5 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 6, GTEST_10_TUPLE_(T) > {
- typedef T6 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 7, GTEST_10_TUPLE_(T) > {
- typedef T7 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 8, GTEST_10_TUPLE_(T) > {
- typedef T8 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 9, GTEST_10_TUPLE_(T) > {
- typedef T9 type;
-};
-
-} // namespace gtest_internal
-
-template <>
-class tuple<> {
- public:
- tuple() {}
- tuple(const tuple& /* t */) {}
- tuple& operator=(const tuple& /* t */) { return *this; }
-};
-
-template <GTEST_1_TYPENAMES_(T)>
-class GTEST_1_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
-
- tuple(const tuple& t) : f0_(t.f0_) {}
-
- template <GTEST_1_TYPENAMES_(U)>
- tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_1_TYPENAMES_(U)>
- tuple& operator=(const GTEST_1_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_1_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {
- f0_ = t.f0_;
- return *this;
- }
-
- T0 f0_;
-};
-
-template <GTEST_2_TYPENAMES_(T)>
-class GTEST_2_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
- f1_(f1) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}
-
- template <GTEST_2_TYPENAMES_(U)>
- tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}
- template <typename U0, typename U1>
- tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_2_TYPENAMES_(U)>
- tuple& operator=(const GTEST_2_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
- template <typename U0, typename U1>
- tuple& operator=(const ::std::pair<U0, U1>& p) {
- f0_ = p.first;
- f1_ = p.second;
- return *this;
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_2_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
-};
-
-template <GTEST_3_TYPENAMES_(T)>
-class GTEST_3_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
-
- template <GTEST_3_TYPENAMES_(U)>
- tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_3_TYPENAMES_(U)>
- tuple& operator=(const GTEST_3_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_3_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
-};
-
-template <GTEST_4_TYPENAMES_(T)>
-class GTEST_4_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
- f3_(f3) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}
-
- template <GTEST_4_TYPENAMES_(U)>
- tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_4_TYPENAMES_(U)>
- tuple& operator=(const GTEST_4_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_4_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
-};
-
-template <GTEST_5_TYPENAMES_(T)>
-class GTEST_5_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
- GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_) {}
-
- template <GTEST_5_TYPENAMES_(U)>
- tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_5_TYPENAMES_(U)>
- tuple& operator=(const GTEST_5_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_5_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
-};
-
-template <GTEST_6_TYPENAMES_(T)>
-class GTEST_6_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
- f5_(f5) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_) {}
-
- template <GTEST_6_TYPENAMES_(U)>
- tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_6_TYPENAMES_(U)>
- tuple& operator=(const GTEST_6_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_6_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
-};
-
-template <GTEST_7_TYPENAMES_(T)>
-class GTEST_7_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),
- f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
-
- template <GTEST_7_TYPENAMES_(U)>
- tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_7_TYPENAMES_(U)>
- tuple& operator=(const GTEST_7_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_7_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
-};
-
-template <GTEST_8_TYPENAMES_(T)>
-class GTEST_8_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,
- GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
- f5_(f5), f6_(f6), f7_(f7) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
-
- template <GTEST_8_TYPENAMES_(U)>
- tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_8_TYPENAMES_(U)>
- tuple& operator=(const GTEST_8_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_8_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- f7_ = t.f7_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
- T7 f7_;
-};
-
-template <GTEST_9_TYPENAMES_(T)>
-class GTEST_9_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
- GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
- f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
-
- template <GTEST_9_TYPENAMES_(U)>
- tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_9_TYPENAMES_(U)>
- tuple& operator=(const GTEST_9_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_9_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- f7_ = t.f7_;
- f8_ = t.f8_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
- T7 f7_;
- T8 f8_;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-class tuple {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
- f9_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
- GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),
- f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}
-
- template <GTEST_10_TYPENAMES_(U)>
- tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),
- f9_(t.f9_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_10_TYPENAMES_(U)>
- tuple& operator=(const GTEST_10_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_10_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- f7_ = t.f7_;
- f8_ = t.f8_;
- f9_ = t.f9_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
- T7 f7_;
- T8 f8_;
- T9 f9_;
-};
-
-// 6.1.3.2 Tuple creation functions.
-
-// Known limitations: we don't support passing an
-// std::tr1::reference_wrapper<T> to make_tuple(). And we don't
-// implement tie().
-
-inline tuple<> make_tuple() { return tuple<>(); }
-
-template <GTEST_1_TYPENAMES_(T)>
-inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {
- return GTEST_1_TUPLE_(T)(f0);
-}
-
-template <GTEST_2_TYPENAMES_(T)>
-inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {
- return GTEST_2_TUPLE_(T)(f0, f1);
-}
-
-template <GTEST_3_TYPENAMES_(T)>
-inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {
- return GTEST_3_TUPLE_(T)(f0, f1, f2);
-}
-
-template <GTEST_4_TYPENAMES_(T)>
-inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3) {
- return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);
-}
-
-template <GTEST_5_TYPENAMES_(T)>
-inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4) {
- return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);
-}
-
-template <GTEST_6_TYPENAMES_(T)>
-inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5) {
- return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);
-}
-
-template <GTEST_7_TYPENAMES_(T)>
-inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6) {
- return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);
-}
-
-template <GTEST_8_TYPENAMES_(T)>
-inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {
- return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);
-}
-
-template <GTEST_9_TYPENAMES_(T)>
-inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
- const T8& f8) {
- return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);
-}
-
-template <GTEST_10_TYPENAMES_(T)>
-inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
- const T8& f8, const T9& f9) {
- return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
-}
-
-// 6.1.3.3 Tuple helper classes.
-
-template <typename Tuple> struct tuple_size;
-
-template <GTEST_0_TYPENAMES_(T)>
-struct tuple_size<GTEST_0_TUPLE_(T) > {
- static const int value = 0;
-};
-
-template <GTEST_1_TYPENAMES_(T)>
-struct tuple_size<GTEST_1_TUPLE_(T) > {
- static const int value = 1;
-};
-
-template <GTEST_2_TYPENAMES_(T)>
-struct tuple_size<GTEST_2_TUPLE_(T) > {
- static const int value = 2;
-};
-
-template <GTEST_3_TYPENAMES_(T)>
-struct tuple_size<GTEST_3_TUPLE_(T) > {
- static const int value = 3;
-};
-
-template <GTEST_4_TYPENAMES_(T)>
-struct tuple_size<GTEST_4_TUPLE_(T) > {
- static const int value = 4;
-};
-
-template <GTEST_5_TYPENAMES_(T)>
-struct tuple_size<GTEST_5_TUPLE_(T) > {
- static const int value = 5;
-};
-
-template <GTEST_6_TYPENAMES_(T)>
-struct tuple_size<GTEST_6_TUPLE_(T) > {
- static const int value = 6;
-};
-
-template <GTEST_7_TYPENAMES_(T)>
-struct tuple_size<GTEST_7_TUPLE_(T) > {
- static const int value = 7;
-};
-
-template <GTEST_8_TYPENAMES_(T)>
-struct tuple_size<GTEST_8_TUPLE_(T) > {
- static const int value = 8;
-};
-
-template <GTEST_9_TYPENAMES_(T)>
-struct tuple_size<GTEST_9_TUPLE_(T) > {
- static const int value = 9;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct tuple_size<GTEST_10_TUPLE_(T) > {
- static const int value = 10;
-};
-
-template <int k, class Tuple>
-struct tuple_element {
- typedef typename gtest_internal::TupleElement<
- k < (tuple_size<Tuple>::value), k, Tuple>::type type;
-};
-
-#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
-
-// 6.1.3.4 Element access.
-
-namespace gtest_internal {
-
-template <>
-class Get<0> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
- Field(Tuple& t) { return t.f0_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
- ConstField(const Tuple& t) { return t.f0_; }
-};
-
-template <>
-class Get<1> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
- Field(Tuple& t) { return t.f1_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
- ConstField(const Tuple& t) { return t.f1_; }
-};
-
-template <>
-class Get<2> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
- Field(Tuple& t) { return t.f2_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
- ConstField(const Tuple& t) { return t.f2_; }
-};
-
-template <>
-class Get<3> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
- Field(Tuple& t) { return t.f3_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
- ConstField(const Tuple& t) { return t.f3_; }
-};
-
-template <>
-class Get<4> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
- Field(Tuple& t) { return t.f4_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
- ConstField(const Tuple& t) { return t.f4_; }
-};
-
-template <>
-class Get<5> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
- Field(Tuple& t) { return t.f5_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
- ConstField(const Tuple& t) { return t.f5_; }
-};
-
-template <>
-class Get<6> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
- Field(Tuple& t) { return t.f6_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
- ConstField(const Tuple& t) { return t.f6_; }
-};
-
-template <>
-class Get<7> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
- Field(Tuple& t) { return t.f7_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
- ConstField(const Tuple& t) { return t.f7_; }
-};
-
-template <>
-class Get<8> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
- Field(Tuple& t) { return t.f8_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
- ConstField(const Tuple& t) { return t.f8_; }
-};
-
-template <>
-class Get<9> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
- Field(Tuple& t) { return t.f9_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
- ConstField(const Tuple& t) { return t.f9_; }
-};
-
-} // namespace gtest_internal
-
-template <int k, GTEST_10_TYPENAMES_(T)>
-GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
-get(GTEST_10_TUPLE_(T)& t) {
- return gtest_internal::Get<k>::Field(t);
-}
-
-template <int k, GTEST_10_TYPENAMES_(T)>
-GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
-get(const GTEST_10_TUPLE_(T)& t) {
- return gtest_internal::Get<k>::ConstField(t);
-}
-
-// 6.1.3.5 Relational operators
-
-// We only implement == and !=, as we don't have a need for the rest yet.
-
-namespace gtest_internal {
-
-// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
-// first k fields of t1 equals the first k fields of t2.
-// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
-// k1 != k2.
-template <int kSize1, int kSize2>
-struct SameSizeTuplePrefixComparator;
-
-template <>
-struct SameSizeTuplePrefixComparator<0, 0> {
- template <class Tuple1, class Tuple2>
- static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
- return true;
- }
-};
-
-template <int k>
-struct SameSizeTuplePrefixComparator<k, k> {
- template <class Tuple1, class Tuple2>
- static bool Eq(const Tuple1& t1, const Tuple2& t2) {
- return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
- ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
- }
-};
-
-} // namespace gtest_internal
-
-template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
-inline bool operator==(const GTEST_10_TUPLE_(T)& t,
- const GTEST_10_TUPLE_(U)& u) {
- return gtest_internal::SameSizeTuplePrefixComparator<
- tuple_size<GTEST_10_TUPLE_(T) >::value,
- tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u);
-}
-
-template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
-inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
- const GTEST_10_TUPLE_(U)& u) { return !(t == u); }
-
-// 6.1.4 Pairs.
-// Unimplemented.
-
-} // namespace tr1
-} // namespace std
-
-#undef GTEST_0_TUPLE_
-#undef GTEST_1_TUPLE_
-#undef GTEST_2_TUPLE_
-#undef GTEST_3_TUPLE_
-#undef GTEST_4_TUPLE_
-#undef GTEST_5_TUPLE_
-#undef GTEST_6_TUPLE_
-#undef GTEST_7_TUPLE_
-#undef GTEST_8_TUPLE_
-#undef GTEST_9_TUPLE_
-#undef GTEST_10_TUPLE_
-
-#undef GTEST_0_TYPENAMES_
-#undef GTEST_1_TYPENAMES_
-#undef GTEST_2_TYPENAMES_
-#undef GTEST_3_TYPENAMES_
-#undef GTEST_4_TYPENAMES_
-#undef GTEST_5_TYPENAMES_
-#undef GTEST_6_TYPENAMES_
-#undef GTEST_7_TYPENAMES_
-#undef GTEST_8_TYPENAMES_
-#undef GTEST_9_TYPENAMES_
-#undef GTEST_10_TYPENAMES_
-
-#undef GTEST_DECLARE_TUPLE_AS_FRIEND_
-#undef GTEST_BY_REF_
-#undef GTEST_ADD_REF_
-#undef GTEST_TUPLE_ELEMENT_
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-tuple.h.pump b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-tuple.h.pump
deleted file mode 100644
index 429ddfe..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-tuple.h.pump
+++ /dev/null
@@ -1,347 +0,0 @@
-$$ -*- mode: c++; -*-
-$var n = 10 $$ Maximum number of tuple fields we want to support.
-$$ This meta comment fixes auto-indentation in Emacs. }}
-// Copyright 2009 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-
-#include <utility> // For ::std::pair.
-
-// The compiler used in Symbian has a bug that prevents us from declaring the
-// tuple template as a friend (it complains that tuple is redefined). This
-// hack bypasses the bug by declaring the members that should otherwise be
-// private as public.
-// Sun Studio versions < 12 also have the above bug.
-#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
-# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
-#else
-# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
- template <GTEST_$(n)_TYPENAMES_(U)> friend class tuple; \
- private:
-#endif
-
-// Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that conflict
-// with our own definitions. Therefore using our own tuple does not work on
-// those compilers.
-#if defined(_MSC_VER) && _MSC_VER >= 1600 /* 1600 is Visual Studio 2010 */
-# error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \
-GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers."
-#endif
-
-
-$range i 0..n-1
-$range j 0..n
-$range k 1..n
-// GTEST_n_TUPLE_(T) is the type of an n-tuple.
-#define GTEST_0_TUPLE_(T) tuple<>
-
-$for k [[
-$range m 0..k-1
-$range m2 k..n-1
-#define GTEST_$(k)_TUPLE_(T) tuple<$for m, [[T##$m]]$for m2 [[, void]]>
-
-]]
-
-// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
-
-$for j [[
-$range m 0..j-1
-#define GTEST_$(j)_TYPENAMES_(T) $for m, [[typename T##$m]]
-
-
-]]
-
-// In theory, defining stuff in the ::std namespace is undefined
-// behavior. We can do this as we are playing the role of a standard
-// library vendor.
-namespace std {
-namespace tr1 {
-
-template <$for i, [[typename T$i = void]]>
-class tuple;
-
-// Anything in namespace gtest_internal is Google Test's INTERNAL
-// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
-namespace gtest_internal {
-
-// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
-template <typename T>
-struct ByRef { typedef const T& type; }; // NOLINT
-template <typename T>
-struct ByRef<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper for ByRef.
-#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
-
-// AddRef<T>::type is T if T is a reference; otherwise it's T&. This
-// is the same as tr1::add_reference<T>::type.
-template <typename T>
-struct AddRef { typedef T& type; }; // NOLINT
-template <typename T>
-struct AddRef<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper for AddRef.
-#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
-
-// A helper for implementing get<k>().
-template <int k> class Get;
-
-// A helper for implementing tuple_element<k, T>. kIndexValid is true
-// iff k < the number of fields in tuple type T.
-template <bool kIndexValid, int kIndex, class Tuple>
-struct TupleElement;
-
-
-$for i [[
-template <GTEST_$(n)_TYPENAMES_(T)>
-struct TupleElement<true, $i, GTEST_$(n)_TUPLE_(T) > {
- typedef T$i type;
-};
-
-
-]]
-} // namespace gtest_internal
-
-template <>
-class tuple<> {
- public:
- tuple() {}
- tuple(const tuple& /* t */) {}
- tuple& operator=(const tuple& /* t */) { return *this; }
-};
-
-
-$for k [[
-$range m 0..k-1
-template <GTEST_$(k)_TYPENAMES_(T)>
-class $if k < n [[GTEST_$(k)_TUPLE_(T)]] $else [[tuple]] {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : $for m, [[f$(m)_()]] {}
-
- explicit tuple($for m, [[GTEST_BY_REF_(T$m) f$m]]) : [[]]
-$for m, [[f$(m)_(f$m)]] {}
-
- tuple(const tuple& t) : $for m, [[f$(m)_(t.f$(m)_)]] {}
-
- template <GTEST_$(k)_TYPENAMES_(U)>
- tuple(const GTEST_$(k)_TUPLE_(U)& t) : $for m, [[f$(m)_(t.f$(m)_)]] {}
-
-$if k == 2 [[
- template <typename U0, typename U1>
- tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
-
-]]
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_$(k)_TYPENAMES_(U)>
- tuple& operator=(const GTEST_$(k)_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
-$if k == 2 [[
- template <typename U0, typename U1>
- tuple& operator=(const ::std::pair<U0, U1>& p) {
- f0_ = p.first;
- f1_ = p.second;
- return *this;
- }
-
-]]
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_$(k)_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_$(k)_TUPLE_(U)& t) {
-
-$for m [[
- f$(m)_ = t.f$(m)_;
-
-]]
- return *this;
- }
-
-
-$for m [[
- T$m f$(m)_;
-
-]]
-};
-
-
-]]
-// 6.1.3.2 Tuple creation functions.
-
-// Known limitations: we don't support passing an
-// std::tr1::reference_wrapper<T> to make_tuple(). And we don't
-// implement tie().
-
-inline tuple<> make_tuple() { return tuple<>(); }
-
-$for k [[
-$range m 0..k-1
-
-template <GTEST_$(k)_TYPENAMES_(T)>
-inline GTEST_$(k)_TUPLE_(T) make_tuple($for m, [[const T$m& f$m]]) {
- return GTEST_$(k)_TUPLE_(T)($for m, [[f$m]]);
-}
-
-]]
-
-// 6.1.3.3 Tuple helper classes.
-
-template <typename Tuple> struct tuple_size;
-
-
-$for j [[
-template <GTEST_$(j)_TYPENAMES_(T)>
-struct tuple_size<GTEST_$(j)_TUPLE_(T) > {
- static const int value = $j;
-};
-
-
-]]
-template <int k, class Tuple>
-struct tuple_element {
- typedef typename gtest_internal::TupleElement<
- k < (tuple_size<Tuple>::value), k, Tuple>::type type;
-};
-
-#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
-
-// 6.1.3.4 Element access.
-
-namespace gtest_internal {
-
-
-$for i [[
-template <>
-class Get<$i> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple))
- Field(Tuple& t) { return t.f$(i)_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple))
- ConstField(const Tuple& t) { return t.f$(i)_; }
-};
-
-
-]]
-} // namespace gtest_internal
-
-template <int k, GTEST_$(n)_TYPENAMES_(T)>
-GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T)))
-get(GTEST_$(n)_TUPLE_(T)& t) {
- return gtest_internal::Get<k>::Field(t);
-}
-
-template <int k, GTEST_$(n)_TYPENAMES_(T)>
-GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T)))
-get(const GTEST_$(n)_TUPLE_(T)& t) {
- return gtest_internal::Get<k>::ConstField(t);
-}
-
-// 6.1.3.5 Relational operators
-
-// We only implement == and !=, as we don't have a need for the rest yet.
-
-namespace gtest_internal {
-
-// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
-// first k fields of t1 equals the first k fields of t2.
-// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
-// k1 != k2.
-template <int kSize1, int kSize2>
-struct SameSizeTuplePrefixComparator;
-
-template <>
-struct SameSizeTuplePrefixComparator<0, 0> {
- template <class Tuple1, class Tuple2>
- static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
- return true;
- }
-};
-
-template <int k>
-struct SameSizeTuplePrefixComparator<k, k> {
- template <class Tuple1, class Tuple2>
- static bool Eq(const Tuple1& t1, const Tuple2& t2) {
- return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
- ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
- }
-};
-
-} // namespace gtest_internal
-
-template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>
-inline bool operator==(const GTEST_$(n)_TUPLE_(T)& t,
- const GTEST_$(n)_TUPLE_(U)& u) {
- return gtest_internal::SameSizeTuplePrefixComparator<
- tuple_size<GTEST_$(n)_TUPLE_(T) >::value,
- tuple_size<GTEST_$(n)_TUPLE_(U) >::value>::Eq(t, u);
-}
-
-template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>
-inline bool operator!=(const GTEST_$(n)_TUPLE_(T)& t,
- const GTEST_$(n)_TUPLE_(U)& u) { return !(t == u); }
-
-// 6.1.4 Pairs.
-// Unimplemented.
-
-} // namespace tr1
-} // namespace std
-
-
-$for j [[
-#undef GTEST_$(j)_TUPLE_
-
-]]
-
-
-$for j [[
-#undef GTEST_$(j)_TYPENAMES_
-
-]]
-
-#undef GTEST_DECLARE_TUPLE_AS_FRIEND_
-#undef GTEST_BY_REF_
-#undef GTEST_ADD_REF_
-#undef GTEST_TUPLE_ELEMENT_
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-type-util.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-type-util.h
deleted file mode 100644
index e46f7cf..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-type-util.h
+++ /dev/null
@@ -1,3331 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gtest-type-util.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Type utilities needed for implementing typed and type-parameterized
-// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-// Currently we support at most 50 types in a list, and at most 50
-// type-parameterized tests in one type-parameterized test case.
-// Please contact googletestframework@googlegroups.com if you need
-// more.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-
-#include "gtest/internal/gtest-port.h"
-
-// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
-// libstdc++ (which is where cxxabi.h comes from).
-# if GTEST_HAS_CXXABI_H_
-# include <cxxabi.h>
-# elif defined(__HP_aCC)
-# include <acxx_demangle.h>
-# endif // GTEST_HASH_CXXABI_H_
-
-namespace testing {
-namespace internal {
-
-// GetTypeName<T>() returns a human-readable name of type T.
-// NB: This function is also used in Google Mock, so don't move it inside of
-// the typed-test-only section below.
-template <typename T>
-std::string GetTypeName() {
-# if GTEST_HAS_RTTI
-
- const char* const name = typeid(T).name();
-# if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
- int status = 0;
- // gcc's implementation of typeid(T).name() mangles the type name,
- // so we have to demangle it.
-# if GTEST_HAS_CXXABI_H_
- using abi::__cxa_demangle;
-# endif // GTEST_HAS_CXXABI_H_
- char* const readable_name = __cxa_demangle(name, 0, 0, &status);
- const std::string name_str(status == 0 ? readable_name : name);
- free(readable_name);
- return name_str;
-# else
- return name;
-# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
-
-# else
-
- return "<type>";
-
-# endif // GTEST_HAS_RTTI
-}
-
-#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
-// type. This can be used as a compile-time assertion to ensure that
-// two types are equal.
-
-template <typename T1, typename T2>
-struct AssertTypeEq;
-
-template <typename T>
-struct AssertTypeEq<T, T> {
- typedef bool type;
-};
-
-// A unique type used as the default value for the arguments of class
-// template Types. This allows us to simulate variadic templates
-// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
-// support directly.
-struct None {};
-
-// The following family of struct and struct templates are used to
-// represent type lists. In particular, TypesN<T1, T2, ..., TN>
-// represents a type list with N types (T1, T2, ..., and TN) in it.
-// Except for Types0, every struct in the family has two member types:
-// Head for the first type in the list, and Tail for the rest of the
-// list.
-
-// The empty type list.
-struct Types0 {};
-
-// Type lists of length 1, 2, 3, and so on.
-
-template <typename T1>
-struct Types1 {
- typedef T1 Head;
- typedef Types0 Tail;
-};
-template <typename T1, typename T2>
-struct Types2 {
- typedef T1 Head;
- typedef Types1<T2> Tail;
-};
-
-template <typename T1, typename T2, typename T3>
-struct Types3 {
- typedef T1 Head;
- typedef Types2<T2, T3> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4>
-struct Types4 {
- typedef T1 Head;
- typedef Types3<T2, T3, T4> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-struct Types5 {
- typedef T1 Head;
- typedef Types4<T2, T3, T4, T5> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-struct Types6 {
- typedef T1 Head;
- typedef Types5<T2, T3, T4, T5, T6> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-struct Types7 {
- typedef T1 Head;
- typedef Types6<T2, T3, T4, T5, T6, T7> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-struct Types8 {
- typedef T1 Head;
- typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-struct Types9 {
- typedef T1 Head;
- typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-struct Types10 {
- typedef T1 Head;
- typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-struct Types11 {
- typedef T1 Head;
- typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-struct Types12 {
- typedef T1 Head;
- typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-struct Types13 {
- typedef T1 Head;
- typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-struct Types14 {
- typedef T1 Head;
- typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-struct Types15 {
- typedef T1 Head;
- typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-struct Types16 {
- typedef T1 Head;
- typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-struct Types17 {
- typedef T1 Head;
- typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-struct Types18 {
- typedef T1 Head;
- typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-struct Types19 {
- typedef T1 Head;
- typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-struct Types20 {
- typedef T1 Head;
- typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-struct Types21 {
- typedef T1 Head;
- typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-struct Types22 {
- typedef T1 Head;
- typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-struct Types23 {
- typedef T1 Head;
- typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-struct Types24 {
- typedef T1 Head;
- typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-struct Types25 {
- typedef T1 Head;
- typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-struct Types26 {
- typedef T1 Head;
- typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-struct Types27 {
- typedef T1 Head;
- typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-struct Types28 {
- typedef T1 Head;
- typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-struct Types29 {
- typedef T1 Head;
- typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-struct Types30 {
- typedef T1 Head;
- typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-struct Types31 {
- typedef T1 Head;
- typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-struct Types32 {
- typedef T1 Head;
- typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-struct Types33 {
- typedef T1 Head;
- typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-struct Types34 {
- typedef T1 Head;
- typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-struct Types35 {
- typedef T1 Head;
- typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-struct Types36 {
- typedef T1 Head;
- typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-struct Types37 {
- typedef T1 Head;
- typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-struct Types38 {
- typedef T1 Head;
- typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-struct Types39 {
- typedef T1 Head;
- typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-struct Types40 {
- typedef T1 Head;
- typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-struct Types41 {
- typedef T1 Head;
- typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-struct Types42 {
- typedef T1 Head;
- typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-struct Types43 {
- typedef T1 Head;
- typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-struct Types44 {
- typedef T1 Head;
- typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-struct Types45 {
- typedef T1 Head;
- typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-struct Types46 {
- typedef T1 Head;
- typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-struct Types47 {
- typedef T1 Head;
- typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-struct Types48 {
- typedef T1 Head;
- typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-struct Types49 {
- typedef T1 Head;
- typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-struct Types50 {
- typedef T1 Head;
- typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49, T50> Tail;
-};
-
-
-} // namespace internal
-
-// We don't want to require the users to write TypesN<...> directly,
-// as that would require them to count the length. Types<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Types<int>
-// will appear as Types<int, None, None, ..., None> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Types<T1, ..., TN>, and Google Test will translate
-// that to TypesN<T1, ..., TN> internally to make error messages
-// readable. The translation is done by the 'type' member of the
-// Types template.
-template <typename T1 = internal::None, typename T2 = internal::None,
- typename T3 = internal::None, typename T4 = internal::None,
- typename T5 = internal::None, typename T6 = internal::None,
- typename T7 = internal::None, typename T8 = internal::None,
- typename T9 = internal::None, typename T10 = internal::None,
- typename T11 = internal::None, typename T12 = internal::None,
- typename T13 = internal::None, typename T14 = internal::None,
- typename T15 = internal::None, typename T16 = internal::None,
- typename T17 = internal::None, typename T18 = internal::None,
- typename T19 = internal::None, typename T20 = internal::None,
- typename T21 = internal::None, typename T22 = internal::None,
- typename T23 = internal::None, typename T24 = internal::None,
- typename T25 = internal::None, typename T26 = internal::None,
- typename T27 = internal::None, typename T28 = internal::None,
- typename T29 = internal::None, typename T30 = internal::None,
- typename T31 = internal::None, typename T32 = internal::None,
- typename T33 = internal::None, typename T34 = internal::None,
- typename T35 = internal::None, typename T36 = internal::None,
- typename T37 = internal::None, typename T38 = internal::None,
- typename T39 = internal::None, typename T40 = internal::None,
- typename T41 = internal::None, typename T42 = internal::None,
- typename T43 = internal::None, typename T44 = internal::None,
- typename T45 = internal::None, typename T46 = internal::None,
- typename T47 = internal::None, typename T48 = internal::None,
- typename T49 = internal::None, typename T50 = internal::None>
-struct Types {
- typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
-};
-
-template <>
-struct Types<internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types0 type;
-};
-template <typename T1>
-struct Types<T1, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types1<T1> type;
-};
-template <typename T1, typename T2>
-struct Types<T1, T2, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types2<T1, T2> type;
-};
-template <typename T1, typename T2, typename T3>
-struct Types<T1, T2, T3, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types3<T1, T2, T3> type;
-};
-template <typename T1, typename T2, typename T3, typename T4>
-struct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types4<T1, T2, T3, T4> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-struct Types<T1, T2, T3, T4, T5, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types5<T1, T2, T3, T4, T5> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-struct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types6<T1, T2, T3, T4, T5, T6> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-struct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, T47, internal::None, internal::None, internal::None> {
- typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, T47, T48, internal::None, internal::None> {
- typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, T47, T48, T49, internal::None> {
- typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48, T49> type;
-};
-
-namespace internal {
-
-# define GTEST_TEMPLATE_ template <typename T> class
-
-// The template "selector" struct TemplateSel<Tmpl> is used to
-// represent Tmpl, which must be a class template with one type
-// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined
-// as the type Tmpl<T>. This allows us to actually instantiate the
-// template "selected" by TemplateSel<Tmpl>.
-//
-// This trick is necessary for simulating typedef for class templates,
-// which C++ doesn't support directly.
-template <GTEST_TEMPLATE_ Tmpl>
-struct TemplateSel {
- template <typename T>
- struct Bind {
- typedef Tmpl<T> type;
- };
-};
-
-# define GTEST_BIND_(TmplSel, T) \
- TmplSel::template Bind<T>::type
-
-// A unique struct template used as the default value for the
-// arguments of class template Templates. This allows us to simulate
-// variadic templates (e.g. Templates<int>, Templates<int, double>,
-// and etc), which C++ doesn't support directly.
-template <typename T>
-struct NoneT {};
-
-// The following family of struct and struct templates are used to
-// represent template lists. In particular, TemplatesN<T1, T2, ...,
-// TN> represents a list of N templates (T1, T2, ..., and TN). Except
-// for Templates0, every struct in the family has two member types:
-// Head for the selector of the first template in the list, and Tail
-// for the rest of the list.
-
-// The empty template list.
-struct Templates0 {};
-
-// Template lists of length 1, 2, 3, and so on.
-
-template <GTEST_TEMPLATE_ T1>
-struct Templates1 {
- typedef TemplateSel<T1> Head;
- typedef Templates0 Tail;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
-struct Templates2 {
- typedef TemplateSel<T1> Head;
- typedef Templates1<T2> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
-struct Templates3 {
- typedef TemplateSel<T1> Head;
- typedef Templates2<T2, T3> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4>
-struct Templates4 {
- typedef TemplateSel<T1> Head;
- typedef Templates3<T2, T3, T4> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
-struct Templates5 {
- typedef TemplateSel<T1> Head;
- typedef Templates4<T2, T3, T4, T5> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
-struct Templates6 {
- typedef TemplateSel<T1> Head;
- typedef Templates5<T2, T3, T4, T5, T6> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7>
-struct Templates7 {
- typedef TemplateSel<T1> Head;
- typedef Templates6<T2, T3, T4, T5, T6, T7> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
-struct Templates8 {
- typedef TemplateSel<T1> Head;
- typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
-struct Templates9 {
- typedef TemplateSel<T1> Head;
- typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10>
-struct Templates10 {
- typedef TemplateSel<T1> Head;
- typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
-struct Templates11 {
- typedef TemplateSel<T1> Head;
- typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
-struct Templates12 {
- typedef TemplateSel<T1> Head;
- typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13>
-struct Templates13 {
- typedef TemplateSel<T1> Head;
- typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
-struct Templates14 {
- typedef TemplateSel<T1> Head;
- typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
-struct Templates15 {
- typedef TemplateSel<T1> Head;
- typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16>
-struct Templates16 {
- typedef TemplateSel<T1> Head;
- typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
-struct Templates17 {
- typedef TemplateSel<T1> Head;
- typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
-struct Templates18 {
- typedef TemplateSel<T1> Head;
- typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19>
-struct Templates19 {
- typedef TemplateSel<T1> Head;
- typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
-struct Templates20 {
- typedef TemplateSel<T1> Head;
- typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
-struct Templates21 {
- typedef TemplateSel<T1> Head;
- typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22>
-struct Templates22 {
- typedef TemplateSel<T1> Head;
- typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
-struct Templates23 {
- typedef TemplateSel<T1> Head;
- typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
-struct Templates24 {
- typedef TemplateSel<T1> Head;
- typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25>
-struct Templates25 {
- typedef TemplateSel<T1> Head;
- typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
-struct Templates26 {
- typedef TemplateSel<T1> Head;
- typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
-struct Templates27 {
- typedef TemplateSel<T1> Head;
- typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28>
-struct Templates28 {
- typedef TemplateSel<T1> Head;
- typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
-struct Templates29 {
- typedef TemplateSel<T1> Head;
- typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
-struct Templates30 {
- typedef TemplateSel<T1> Head;
- typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31>
-struct Templates31 {
- typedef TemplateSel<T1> Head;
- typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
-struct Templates32 {
- typedef TemplateSel<T1> Head;
- typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
-struct Templates33 {
- typedef TemplateSel<T1> Head;
- typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34>
-struct Templates34 {
- typedef TemplateSel<T1> Head;
- typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
-struct Templates35 {
- typedef TemplateSel<T1> Head;
- typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
-struct Templates36 {
- typedef TemplateSel<T1> Head;
- typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37>
-struct Templates37 {
- typedef TemplateSel<T1> Head;
- typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
-struct Templates38 {
- typedef TemplateSel<T1> Head;
- typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
-struct Templates39 {
- typedef TemplateSel<T1> Head;
- typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40>
-struct Templates40 {
- typedef TemplateSel<T1> Head;
- typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
-struct Templates41 {
- typedef TemplateSel<T1> Head;
- typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
-struct Templates42 {
- typedef TemplateSel<T1> Head;
- typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43>
-struct Templates43 {
- typedef TemplateSel<T1> Head;
- typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
-struct Templates44 {
- typedef TemplateSel<T1> Head;
- typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
-struct Templates45 {
- typedef TemplateSel<T1> Head;
- typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46>
-struct Templates46 {
- typedef TemplateSel<T1> Head;
- typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
-struct Templates47 {
- typedef TemplateSel<T1> Head;
- typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
-struct Templates48 {
- typedef TemplateSel<T1> Head;
- typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47, T48> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
- GTEST_TEMPLATE_ T49>
-struct Templates49 {
- typedef TemplateSel<T1> Head;
- typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47, T48, T49> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
- GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50>
-struct Templates50 {
- typedef TemplateSel<T1> Head;
- typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47, T48, T49, T50> Tail;
-};
-
-
-// We don't want to require the users to write TemplatesN<...> directly,
-// as that would require them to count the length. Templates<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Templates<list>
-// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Templates<T1, ..., TN>, and Google Test will translate
-// that to TemplatesN<T1, ..., TN> internally to make error messages
-// readable. The translation is done by the 'type' member of the
-// Templates template.
-template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT,
- GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT,
- GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT,
- GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT,
- GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT,
- GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT,
- GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT,
- GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT,
- GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT,
- GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT,
- GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT,
- GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT,
- GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT,
- GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT,
- GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT,
- GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT,
- GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT,
- GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT,
- GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT,
- GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT,
- GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT,
- GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT,
- GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT,
- GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT,
- GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT>
-struct Templates {
- typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
-};
-
-template <>
-struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates0 type;
-};
-template <GTEST_TEMPLATE_ T1>
-struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates1<T1> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
-struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates2<T1, T2> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
-struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates3<T1, T2, T3> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4>
-struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates4<T1, T2, T3, T4> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
-struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates5<T1, T2, T3, T4, T5> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
-struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates6<T1, T2, T3, T4, T5, T6> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT> {
- typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT> {
- typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT> {
- typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, T47, NoneT, NoneT, NoneT> {
- typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, T47, T48, NoneT, NoneT> {
- typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47, T48> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
- GTEST_TEMPLATE_ T49>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, T47, T48, T49, NoneT> {
- typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47, T48, T49> type;
-};
-
-// The TypeList template makes it possible to use either a single type
-// or a Types<...> list in TYPED_TEST_CASE() and
-// INSTANTIATE_TYPED_TEST_CASE_P().
-
-template <typename T>
-struct TypeList {
- typedef Types1<T> type;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49, T50> > {
- typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;
-};
-
-#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-type-util.h.pump b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-type-util.h.pump
deleted file mode 100644
index 251fdf0..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/include/gtest/internal/gtest-type-util.h.pump
+++ /dev/null
@@ -1,297 +0,0 @@
-$$ -*- mode: c++; -*-
-$var n = 50 $$ Maximum length of type lists we want to support.
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Type utilities needed for implementing typed and type-parameterized
-// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-// Currently we support at most $n types in a list, and at most $n
-// type-parameterized tests in one type-parameterized test case.
-// Please contact googletestframework@googlegroups.com if you need
-// more.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-
-#include "gtest/internal/gtest-port.h"
-
-// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
-// libstdc++ (which is where cxxabi.h comes from).
-# if GTEST_HAS_CXXABI_H_
-# include <cxxabi.h>
-# elif defined(__HP_aCC)
-# include <acxx_demangle.h>
-# endif // GTEST_HASH_CXXABI_H_
-
-namespace testing {
-namespace internal {
-
-// GetTypeName<T>() returns a human-readable name of type T.
-// NB: This function is also used in Google Mock, so don't move it inside of
-// the typed-test-only section below.
-template <typename T>
-std::string GetTypeName() {
-# if GTEST_HAS_RTTI
-
- const char* const name = typeid(T).name();
-# if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
- int status = 0;
- // gcc's implementation of typeid(T).name() mangles the type name,
- // so we have to demangle it.
-# if GTEST_HAS_CXXABI_H_
- using abi::__cxa_demangle;
-# endif // GTEST_HAS_CXXABI_H_
- char* const readable_name = __cxa_demangle(name, 0, 0, &status);
- const std::string name_str(status == 0 ? readable_name : name);
- free(readable_name);
- return name_str;
-# else
- return name;
-# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
-
-# else
-
- return "<type>";
-
-# endif // GTEST_HAS_RTTI
-}
-
-#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
-// type. This can be used as a compile-time assertion to ensure that
-// two types are equal.
-
-template <typename T1, typename T2>
-struct AssertTypeEq;
-
-template <typename T>
-struct AssertTypeEq<T, T> {
- typedef bool type;
-};
-
-// A unique type used as the default value for the arguments of class
-// template Types. This allows us to simulate variadic templates
-// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
-// support directly.
-struct None {};
-
-// The following family of struct and struct templates are used to
-// represent type lists. In particular, TypesN<T1, T2, ..., TN>
-// represents a type list with N types (T1, T2, ..., and TN) in it.
-// Except for Types0, every struct in the family has two member types:
-// Head for the first type in the list, and Tail for the rest of the
-// list.
-
-// The empty type list.
-struct Types0 {};
-
-// Type lists of length 1, 2, 3, and so on.
-
-template <typename T1>
-struct Types1 {
- typedef T1 Head;
- typedef Types0 Tail;
-};
-
-$range i 2..n
-
-$for i [[
-$range j 1..i
-$range k 2..i
-template <$for j, [[typename T$j]]>
-struct Types$i {
- typedef T1 Head;
- typedef Types$(i-1)<$for k, [[T$k]]> Tail;
-};
-
-
-]]
-
-} // namespace internal
-
-// We don't want to require the users to write TypesN<...> directly,
-// as that would require them to count the length. Types<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Types<int>
-// will appear as Types<int, None, None, ..., None> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Types<T1, ..., TN>, and Google Test will translate
-// that to TypesN<T1, ..., TN> internally to make error messages
-// readable. The translation is done by the 'type' member of the
-// Types template.
-
-$range i 1..n
-template <$for i, [[typename T$i = internal::None]]>
-struct Types {
- typedef internal::Types$n<$for i, [[T$i]]> type;
-};
-
-template <>
-struct Types<$for i, [[internal::None]]> {
- typedef internal::Types0 type;
-};
-
-$range i 1..n-1
-$for i [[
-$range j 1..i
-$range k i+1..n
-template <$for j, [[typename T$j]]>
-struct Types<$for j, [[T$j]]$for k[[, internal::None]]> {
- typedef internal::Types$i<$for j, [[T$j]]> type;
-};
-
-]]
-
-namespace internal {
-
-# define GTEST_TEMPLATE_ template <typename T> class
-
-// The template "selector" struct TemplateSel<Tmpl> is used to
-// represent Tmpl, which must be a class template with one type
-// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined
-// as the type Tmpl<T>. This allows us to actually instantiate the
-// template "selected" by TemplateSel<Tmpl>.
-//
-// This trick is necessary for simulating typedef for class templates,
-// which C++ doesn't support directly.
-template <GTEST_TEMPLATE_ Tmpl>
-struct TemplateSel {
- template <typename T>
- struct Bind {
- typedef Tmpl<T> type;
- };
-};
-
-# define GTEST_BIND_(TmplSel, T) \
- TmplSel::template Bind<T>::type
-
-// A unique struct template used as the default value for the
-// arguments of class template Templates. This allows us to simulate
-// variadic templates (e.g. Templates<int>, Templates<int, double>,
-// and etc), which C++ doesn't support directly.
-template <typename T>
-struct NoneT {};
-
-// The following family of struct and struct templates are used to
-// represent template lists. In particular, TemplatesN<T1, T2, ...,
-// TN> represents a list of N templates (T1, T2, ..., and TN). Except
-// for Templates0, every struct in the family has two member types:
-// Head for the selector of the first template in the list, and Tail
-// for the rest of the list.
-
-// The empty template list.
-struct Templates0 {};
-
-// Template lists of length 1, 2, 3, and so on.
-
-template <GTEST_TEMPLATE_ T1>
-struct Templates1 {
- typedef TemplateSel<T1> Head;
- typedef Templates0 Tail;
-};
-
-$range i 2..n
-
-$for i [[
-$range j 1..i
-$range k 2..i
-template <$for j, [[GTEST_TEMPLATE_ T$j]]>
-struct Templates$i {
- typedef TemplateSel<T1> Head;
- typedef Templates$(i-1)<$for k, [[T$k]]> Tail;
-};
-
-
-]]
-
-// We don't want to require the users to write TemplatesN<...> directly,
-// as that would require them to count the length. Templates<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Templates<list>
-// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Templates<T1, ..., TN>, and Google Test will translate
-// that to TemplatesN<T1, ..., TN> internally to make error messages
-// readable. The translation is done by the 'type' member of the
-// Templates template.
-
-$range i 1..n
-template <$for i, [[GTEST_TEMPLATE_ T$i = NoneT]]>
-struct Templates {
- typedef Templates$n<$for i, [[T$i]]> type;
-};
-
-template <>
-struct Templates<$for i, [[NoneT]]> {
- typedef Templates0 type;
-};
-
-$range i 1..n-1
-$for i [[
-$range j 1..i
-$range k i+1..n
-template <$for j, [[GTEST_TEMPLATE_ T$j]]>
-struct Templates<$for j, [[T$j]]$for k[[, NoneT]]> {
- typedef Templates$i<$for j, [[T$j]]> type;
-};
-
-]]
-
-// The TypeList template makes it possible to use either a single type
-// or a Types<...> list in TYPED_TEST_CASE() and
-// INSTANTIATE_TYPED_TEST_CASE_P().
-
-template <typename T>
-struct TypeList {
- typedef Types1<T> type;
-};
-
-
-$range i 1..n
-template <$for i, [[typename T$i]]>
-struct TypeList<Types<$for i, [[T$i]]> > {
- typedef typename Types<$for i, [[T$i]]>::type type;
-};
-
-#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-all.cc b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-all.cc
deleted file mode 100644
index 0a9cee5..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-all.cc
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: mheule@google.com (Markus Heule)
-//
-// Google C++ Testing Framework (Google Test)
-//
-// Sometimes it's desirable to build Google Test by compiling a single file.
-// This file serves this purpose.
-
-// This line ensures that gtest.h can be compiled on its own, even
-// when it's fused.
-#include "gtest/gtest.h"
-
-// The following lines pull in the real gtest *.cc files.
-#include "src/gtest.cc"
-#include "src/gtest-death-test.cc"
-#include "src/gtest-filepath.cc"
-#include "src/gtest-port.cc"
-#include "src/gtest-printers.cc"
-#include "src/gtest-test-part.cc"
-#include "src/gtest-typed-test.cc"
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-death-test.cc b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-death-test.cc
deleted file mode 100644
index a6023fc..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-death-test.cc
+++ /dev/null
@@ -1,1344 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev)
-//
-// This file implements death tests.
-
-#include "gtest/gtest-death-test.h"
-#include "gtest/internal/gtest-port.h"
-
-#if GTEST_HAS_DEATH_TEST
-
-# if GTEST_OS_MAC
-# include <crt_externs.h>
-# endif // GTEST_OS_MAC
-
-# include <errno.h>
-# include <fcntl.h>
-# include <limits.h>
-
-# if GTEST_OS_LINUX
-# include <signal.h>
-# endif // GTEST_OS_LINUX
-
-# include <stdarg.h>
-
-# if GTEST_OS_WINDOWS
-# include <windows.h>
-# else
-# include <sys/mman.h>
-# include <sys/wait.h>
-# endif // GTEST_OS_WINDOWS
-
-# if GTEST_OS_QNX
-# include <spawn.h>
-# endif // GTEST_OS_QNX
-
-#endif // GTEST_HAS_DEATH_TEST
-
-#include "gtest/gtest-message.h"
-#include "gtest/internal/gtest-string.h"
-
-// Indicates that this translation unit is part of Google Test's
-// implementation. It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error. This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION_
-
-namespace testing {
-
-// Constants.
-
-// The default death test style.
-static const char kDefaultDeathTestStyle[] = "fast";
-
-GTEST_DEFINE_string_(
- death_test_style,
- internal::StringFromGTestEnv("death_test_style", kDefaultDeathTestStyle),
- "Indicates how to run a death test in a forked child process: "
- "\"threadsafe\" (child process re-executes the test binary "
- "from the beginning, running only the specific death test) or "
- "\"fast\" (child process runs the death test immediately "
- "after forking).");
-
-GTEST_DEFINE_bool_(
- death_test_use_fork,
- internal::BoolFromGTestEnv("death_test_use_fork", false),
- "Instructs to use fork()/_exit() instead of clone() in death tests. "
- "Ignored and always uses fork() on POSIX systems where clone() is not "
- "implemented. Useful when running under valgrind or similar tools if "
- "those do not support clone(). Valgrind 3.3.1 will just fail if "
- "it sees an unsupported combination of clone() flags. "
- "It is not recommended to use this flag w/o valgrind though it will "
- "work in 99% of the cases. Once valgrind is fixed, this flag will "
- "most likely be removed.");
-
-namespace internal {
-GTEST_DEFINE_string_(
- internal_run_death_test, "",
- "Indicates the file, line number, temporal index of "
- "the single death test to run, and a file descriptor to "
- "which a success code may be sent, all separated by "
- "the '|' characters. This flag is specified if and only if the current "
- "process is a sub-process launched for running a thread-safe "
- "death test. FOR INTERNAL USE ONLY.");
-} // namespace internal
-
-#if GTEST_HAS_DEATH_TEST
-
-namespace internal {
-
-// Valid only for fast death tests. Indicates the code is running in the
-// child process of a fast style death test.
-static bool g_in_fast_death_test_child = false;
-
-// Returns a Boolean value indicating whether the caller is currently
-// executing in the context of the death test child process. Tools such as
-// Valgrind heap checkers may need this to modify their behavior in death
-// tests. IMPORTANT: This is an internal utility. Using it may break the
-// implementation of death tests. User code MUST NOT use it.
-bool InDeathTestChild() {
-# if GTEST_OS_WINDOWS
-
- // On Windows, death tests are thread-safe regardless of the value of the
- // death_test_style flag.
- return !GTEST_FLAG(internal_run_death_test).empty();
-
-# else
-
- if (GTEST_FLAG(death_test_style) == "threadsafe")
- return !GTEST_FLAG(internal_run_death_test).empty();
- else
- return g_in_fast_death_test_child;
-#endif
-}
-
-} // namespace internal
-
-// ExitedWithCode constructor.
-ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {
-}
-
-// ExitedWithCode function-call operator.
-bool ExitedWithCode::operator()(int exit_status) const {
-# if GTEST_OS_WINDOWS
-
- return exit_status == exit_code_;
-
-# else
-
- return WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == exit_code_;
-
-# endif // GTEST_OS_WINDOWS
-}
-
-# if !GTEST_OS_WINDOWS
-// KilledBySignal constructor.
-KilledBySignal::KilledBySignal(int signum) : signum_(signum) {
-}
-
-// KilledBySignal function-call operator.
-bool KilledBySignal::operator()(int exit_status) const {
- return WIFSIGNALED(exit_status) && WTERMSIG(exit_status) == signum_;
-}
-# endif // !GTEST_OS_WINDOWS
-
-namespace internal {
-
-// Utilities needed for death tests.
-
-// Generates a textual description of a given exit code, in the format
-// specified by wait(2).
-static std::string ExitSummary(int exit_code) {
- Message m;
-
-# if GTEST_OS_WINDOWS
-
- m << "Exited with exit status " << exit_code;
-
-# else
-
- if (WIFEXITED(exit_code)) {
- m << "Exited with exit status " << WEXITSTATUS(exit_code);
- } else if (WIFSIGNALED(exit_code)) {
- m << "Terminated by signal " << WTERMSIG(exit_code);
- }
-# ifdef WCOREDUMP
- if (WCOREDUMP(exit_code)) {
- m << " (core dumped)";
- }
-# endif
-# endif // GTEST_OS_WINDOWS
-
- return m.GetString();
-}
-
-// Returns true if exit_status describes a process that was terminated
-// by a signal, or exited normally with a nonzero exit code.
-bool ExitedUnsuccessfully(int exit_status) {
- return !ExitedWithCode(0)(exit_status);
-}
-
-# if !GTEST_OS_WINDOWS
-// Generates a textual failure message when a death test finds more than
-// one thread running, or cannot determine the number of threads, prior
-// to executing the given statement. It is the responsibility of the
-// caller not to pass a thread_count of 1.
-static std::string DeathTestThreadWarning(size_t thread_count) {
- Message msg;
- msg << "Death tests use fork(), which is unsafe particularly"
- << " in a threaded context. For this test, " << GTEST_NAME_ << " ";
- if (thread_count == 0)
- msg << "couldn't detect the number of threads.";
- else
- msg << "detected " << thread_count << " threads.";
- return msg.GetString();
-}
-# endif // !GTEST_OS_WINDOWS
-
-// Flag characters for reporting a death test that did not die.
-static const char kDeathTestLived = 'L';
-static const char kDeathTestReturned = 'R';
-static const char kDeathTestThrew = 'T';
-static const char kDeathTestInternalError = 'I';
-
-// An enumeration describing all of the possible ways that a death test can
-// conclude. DIED means that the process died while executing the test
-// code; LIVED means that process lived beyond the end of the test code;
-// RETURNED means that the test statement attempted to execute a return
-// statement, which is not allowed; THREW means that the test statement
-// returned control by throwing an exception. IN_PROGRESS means the test
-// has not yet concluded.
-// TODO(vladl@google.com): Unify names and possibly values for
-// AbortReason, DeathTestOutcome, and flag characters above.
-enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
-
-// Routine for aborting the program which is safe to call from an
-// exec-style death test child process, in which case the error
-// message is propagated back to the parent process. Otherwise, the
-// message is simply printed to stderr. In either case, the program
-// then exits with status 1.
-void DeathTestAbort(const std::string& message) {
- // On a POSIX system, this function may be called from a threadsafe-style
- // death test child process, which operates on a very small stack. Use
- // the heap for any additional non-minuscule memory requirements.
- const InternalRunDeathTestFlag* const flag =
- GetUnitTestImpl()->internal_run_death_test_flag();
- if (flag != NULL) {
- FILE* parent = posix::FDOpen(flag->write_fd(), "w");
- fputc(kDeathTestInternalError, parent);
- fprintf(parent, "%s", message.c_str());
- fflush(parent);
- _exit(1);
- } else {
- fprintf(stderr, "%s", message.c_str());
- fflush(stderr);
- posix::Abort();
- }
-}
-
-// A replacement for CHECK that calls DeathTestAbort if the assertion
-// fails.
-# define GTEST_DEATH_TEST_CHECK_(expression) \
- do { \
- if (!::testing::internal::IsTrue(expression)) { \
- DeathTestAbort( \
- ::std::string("CHECK failed: File ") + __FILE__ + ", line " \
- + ::testing::internal::StreamableToString(__LINE__) + ": " \
- + #expression); \
- } \
- } while (::testing::internal::AlwaysFalse())
-
-// This macro is similar to GTEST_DEATH_TEST_CHECK_, but it is meant for
-// evaluating any system call that fulfills two conditions: it must return
-// -1 on failure, and set errno to EINTR when it is interrupted and
-// should be tried again. The macro expands to a loop that repeatedly
-// evaluates the expression as long as it evaluates to -1 and sets
-// errno to EINTR. If the expression evaluates to -1 but errno is
-// something other than EINTR, DeathTestAbort is called.
-# define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \
- do { \
- int gtest_retval; \
- do { \
- gtest_retval = (expression); \
- } while (gtest_retval == -1 && errno == EINTR); \
- if (gtest_retval == -1) { \
- DeathTestAbort( \
- ::std::string("CHECK failed: File ") + __FILE__ + ", line " \
- + ::testing::internal::StreamableToString(__LINE__) + ": " \
- + #expression + " != -1"); \
- } \
- } while (::testing::internal::AlwaysFalse())
-
-// Returns the message describing the last system error in errno.
-std::string GetLastErrnoDescription() {
- return errno == 0 ? "" : posix::StrError(errno);
-}
-
-// This is called from a death test parent process to read a failure
-// message from the death test child process and log it with the FATAL
-// severity. On Windows, the message is read from a pipe handle. On other
-// platforms, it is read from a file descriptor.
-static void FailFromInternalError(int fd) {
- Message error;
- char buffer[256];
- int num_read;
-
- do {
- while ((num_read = posix::Read(fd, buffer, 255)) > 0) {
- buffer[num_read] = '\0';
- error << buffer;
- }
- } while (num_read == -1 && errno == EINTR);
-
- if (num_read == 0) {
- GTEST_LOG_(FATAL) << error.GetString();
- } else {
- const int last_error = errno;
- GTEST_LOG_(FATAL) << "Error while reading death test internal: "
- << GetLastErrnoDescription() << " [" << last_error << "]";
- }
-}
-
-// Death test constructor. Increments the running death test count
-// for the current test.
-DeathTest::DeathTest() {
- TestInfo* const info = GetUnitTestImpl()->current_test_info();
- if (info == NULL) {
- DeathTestAbort("Cannot run a death test outside of a TEST or "
- "TEST_F construct");
- }
-}
-
-// Creates and returns a death test by dispatching to the current
-// death test factory.
-bool DeathTest::Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test) {
- return GetUnitTestImpl()->death_test_factory()->Create(
- statement, regex, file, line, test);
-}
-
-const char* DeathTest::LastMessage() {
- return last_death_test_message_.c_str();
-}
-
-void DeathTest::set_last_death_test_message(const std::string& message) {
- last_death_test_message_ = message;
-}
-
-std::string DeathTest::last_death_test_message_;
-
-// Provides cross platform implementation for some death functionality.
-class DeathTestImpl : public DeathTest {
- protected:
- DeathTestImpl(const char* a_statement, const RE* a_regex)
- : statement_(a_statement),
- regex_(a_regex),
- spawned_(false),
- status_(-1),
- outcome_(IN_PROGRESS),
- read_fd_(-1),
- write_fd_(-1) {}
-
- // read_fd_ is expected to be closed and cleared by a derived class.
- ~DeathTestImpl() { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); }
-
- void Abort(AbortReason reason);
- virtual bool Passed(bool status_ok);
-
- const char* statement() const { return statement_; }
- const RE* regex() const { return regex_; }
- bool spawned() const { return spawned_; }
- void set_spawned(bool is_spawned) { spawned_ = is_spawned; }
- int status() const { return status_; }
- void set_status(int a_status) { status_ = a_status; }
- DeathTestOutcome outcome() const { return outcome_; }
- void set_outcome(DeathTestOutcome an_outcome) { outcome_ = an_outcome; }
- int read_fd() const { return read_fd_; }
- void set_read_fd(int fd) { read_fd_ = fd; }
- int write_fd() const { return write_fd_; }
- void set_write_fd(int fd) { write_fd_ = fd; }
-
- // Called in the parent process only. Reads the result code of the death
- // test child process via a pipe, interprets it to set the outcome_
- // member, and closes read_fd_. Outputs diagnostics and terminates in
- // case of unexpected codes.
- void ReadAndInterpretStatusByte();
-
- private:
- // The textual content of the code this object is testing. This class
- // doesn't own this string and should not attempt to delete it.
- const char* const statement_;
- // The regular expression which test output must match. DeathTestImpl
- // doesn't own this object and should not attempt to delete it.
- const RE* const regex_;
- // True if the death test child process has been successfully spawned.
- bool spawned_;
- // The exit status of the child process.
- int status_;
- // How the death test concluded.
- DeathTestOutcome outcome_;
- // Descriptor to the read end of the pipe to the child process. It is
- // always -1 in the child process. The child keeps its write end of the
- // pipe in write_fd_.
- int read_fd_;
- // Descriptor to the child's write end of the pipe to the parent process.
- // It is always -1 in the parent process. The parent keeps its end of the
- // pipe in read_fd_.
- int write_fd_;
-};
-
-// Called in the parent process only. Reads the result code of the death
-// test child process via a pipe, interprets it to set the outcome_
-// member, and closes read_fd_. Outputs diagnostics and terminates in
-// case of unexpected codes.
-void DeathTestImpl::ReadAndInterpretStatusByte() {
- char flag;
- int bytes_read;
-
- // The read() here blocks until data is available (signifying the
- // failure of the death test) or until the pipe is closed (signifying
- // its success), so it's okay to call this in the parent before
- // the child process has exited.
- do {
- bytes_read = posix::Read(read_fd(), &flag, 1);
- } while (bytes_read == -1 && errno == EINTR);
-
- if (bytes_read == 0) {
- set_outcome(DIED);
- } else if (bytes_read == 1) {
- switch (flag) {
- case kDeathTestReturned:
- set_outcome(RETURNED);
- break;
- case kDeathTestThrew:
- set_outcome(THREW);
- break;
- case kDeathTestLived:
- set_outcome(LIVED);
- break;
- case kDeathTestInternalError:
- FailFromInternalError(read_fd()); // Does not return.
- break;
- default:
- GTEST_LOG_(FATAL) << "Death test child process reported "
- << "unexpected status byte ("
- << static_cast<unsigned int>(flag) << ")";
- }
- } else {
- GTEST_LOG_(FATAL) << "Read from death test child process failed: "
- << GetLastErrnoDescription();
- }
- GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Close(read_fd()));
- set_read_fd(-1);
-}
-
-// Signals that the death test code which should have exited, didn't.
-// Should be called only in a death test child process.
-// Writes a status byte to the child's status file descriptor, then
-// calls _exit(1).
-void DeathTestImpl::Abort(AbortReason reason) {
- // The parent process considers the death test to be a failure if
- // it finds any data in our pipe. So, here we write a single flag byte
- // to the pipe, then exit.
- const char status_ch =
- reason == TEST_DID_NOT_DIE ? kDeathTestLived :
- reason == TEST_THREW_EXCEPTION ? kDeathTestThrew : kDeathTestReturned;
-
- GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Write(write_fd(), &status_ch, 1));
- // We are leaking the descriptor here because on some platforms (i.e.,
- // when built as Windows DLL), destructors of global objects will still
- // run after calling _exit(). On such systems, write_fd_ will be
- // indirectly closed from the destructor of UnitTestImpl, causing double
- // close if it is also closed here. On debug configurations, double close
- // may assert. As there are no in-process buffers to flush here, we are
- // relying on the OS to close the descriptor after the process terminates
- // when the destructors are not run.
- _exit(1); // Exits w/o any normal exit hooks (we were supposed to crash)
-}
-
-// Returns an indented copy of stderr output for a death test.
-// This makes distinguishing death test output lines from regular log lines
-// much easier.
-static ::std::string FormatDeathTestOutput(const ::std::string& output) {
- ::std::string ret;
- for (size_t at = 0; ; ) {
- const size_t line_end = output.find('\n', at);
- ret += "[ DEATH ] ";
- if (line_end == ::std::string::npos) {
- ret += output.substr(at);
- break;
- }
- ret += output.substr(at, line_end + 1 - at);
- at = line_end + 1;
- }
- return ret;
-}
-
-// Assesses the success or failure of a death test, using both private
-// members which have previously been set, and one argument:
-//
-// Private data members:
-// outcome: An enumeration describing how the death test
-// concluded: DIED, LIVED, THREW, or RETURNED. The death test
-// fails in the latter three cases.
-// status: The exit status of the child process. On *nix, it is in the
-// in the format specified by wait(2). On Windows, this is the
-// value supplied to the ExitProcess() API or a numeric code
-// of the exception that terminated the program.
-// regex: A regular expression object to be applied to
-// the test's captured standard error output; the death test
-// fails if it does not match.
-//
-// Argument:
-// status_ok: true if exit_status is acceptable in the context of
-// this particular death test, which fails if it is false
-//
-// Returns true iff all of the above conditions are met. Otherwise, the
-// first failing condition, in the order given above, is the one that is
-// reported. Also sets the last death test message string.
-bool DeathTestImpl::Passed(bool status_ok) {
- if (!spawned())
- return false;
-
- const std::string error_message = GetCapturedStderr();
-
- bool success = false;
- Message buffer;
-
- buffer << "Death test: " << statement() << "\n";
- switch (outcome()) {
- case LIVED:
- buffer << " Result: failed to die.\n"
- << " Error msg:\n" << FormatDeathTestOutput(error_message);
- break;
- case THREW:
- buffer << " Result: threw an exception.\n"
- << " Error msg:\n" << FormatDeathTestOutput(error_message);
- break;
- case RETURNED:
- buffer << " Result: illegal return in test statement.\n"
- << " Error msg:\n" << FormatDeathTestOutput(error_message);
- break;
- case DIED:
- if (status_ok) {
- const bool matched = RE::PartialMatch(error_message.c_str(), *regex());
- if (matched) {
- success = true;
- } else {
- buffer << " Result: died but not with expected error.\n"
- << " Expected: " << regex()->pattern() << "\n"
- << "Actual msg:\n" << FormatDeathTestOutput(error_message);
- }
- } else {
- buffer << " Result: died but not with expected exit code:\n"
- << " " << ExitSummary(status()) << "\n"
- << "Actual msg:\n" << FormatDeathTestOutput(error_message);
- }
- break;
- case IN_PROGRESS:
- default:
- GTEST_LOG_(FATAL)
- << "DeathTest::Passed somehow called before conclusion of test";
- }
-
- DeathTest::set_last_death_test_message(buffer.GetString());
- return success;
-}
-
-# if GTEST_OS_WINDOWS
-// WindowsDeathTest implements death tests on Windows. Due to the
-// specifics of starting new processes on Windows, death tests there are
-// always threadsafe, and Google Test considers the
-// --gtest_death_test_style=fast setting to be equivalent to
-// --gtest_death_test_style=threadsafe there.
-//
-// A few implementation notes: Like the Linux version, the Windows
-// implementation uses pipes for child-to-parent communication. But due to
-// the specifics of pipes on Windows, some extra steps are required:
-//
-// 1. The parent creates a communication pipe and stores handles to both
-// ends of it.
-// 2. The parent starts the child and provides it with the information
-// necessary to acquire the handle to the write end of the pipe.
-// 3. The child acquires the write end of the pipe and signals the parent
-// using a Windows event.
-// 4. Now the parent can release the write end of the pipe on its side. If
-// this is done before step 3, the object's reference count goes down to
-// 0 and it is destroyed, preventing the child from acquiring it. The
-// parent now has to release it, or read operations on the read end of
-// the pipe will not return when the child terminates.
-// 5. The parent reads child's output through the pipe (outcome code and
-// any possible error messages) from the pipe, and its stderr and then
-// determines whether to fail the test.
-//
-// Note: to distinguish Win32 API calls from the local method and function
-// calls, the former are explicitly resolved in the global namespace.
-//
-class WindowsDeathTest : public DeathTestImpl {
- public:
- WindowsDeathTest(const char* a_statement,
- const RE* a_regex,
- const char* file,
- int line)
- : DeathTestImpl(a_statement, a_regex), file_(file), line_(line) {}
-
- // All of these virtual functions are inherited from DeathTest.
- virtual int Wait();
- virtual TestRole AssumeRole();
-
- private:
- // The name of the file in which the death test is located.
- const char* const file_;
- // The line number on which the death test is located.
- const int line_;
- // Handle to the write end of the pipe to the child process.
- AutoHandle write_handle_;
- // Child process handle.
- AutoHandle child_handle_;
- // Event the child process uses to signal the parent that it has
- // acquired the handle to the write end of the pipe. After seeing this
- // event the parent can release its own handles to make sure its
- // ReadFile() calls return when the child terminates.
- AutoHandle event_handle_;
-};
-
-// Waits for the child in a death test to exit, returning its exit
-// status, or 0 if no child process exists. As a side effect, sets the
-// outcome data member.
-int WindowsDeathTest::Wait() {
- if (!spawned())
- return 0;
-
- // Wait until the child either signals that it has acquired the write end
- // of the pipe or it dies.
- const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() };
- switch (::WaitForMultipleObjects(2,
- wait_handles,
- FALSE, // Waits for any of the handles.
- INFINITE)) {
- case WAIT_OBJECT_0:
- case WAIT_OBJECT_0 + 1:
- break;
- default:
- GTEST_DEATH_TEST_CHECK_(false); // Should not get here.
- }
-
- // The child has acquired the write end of the pipe or exited.
- // We release the handle on our side and continue.
- write_handle_.Reset();
- event_handle_.Reset();
-
- ReadAndInterpretStatusByte();
-
- // Waits for the child process to exit if it haven't already. This
- // returns immediately if the child has already exited, regardless of
- // whether previous calls to WaitForMultipleObjects synchronized on this
- // handle or not.
- GTEST_DEATH_TEST_CHECK_(
- WAIT_OBJECT_0 == ::WaitForSingleObject(child_handle_.Get(),
- INFINITE));
- DWORD status_code;
- GTEST_DEATH_TEST_CHECK_(
- ::GetExitCodeProcess(child_handle_.Get(), &status_code) != FALSE);
- child_handle_.Reset();
- set_status(static_cast<int>(status_code));
- return status();
-}
-
-// The AssumeRole process for a Windows death test. It creates a child
-// process with the same executable as the current process to run the
-// death test. The child process is given the --gtest_filter and
-// --gtest_internal_run_death_test flags such that it knows to run the
-// current death test only.
-DeathTest::TestRole WindowsDeathTest::AssumeRole() {
- const UnitTestImpl* const impl = GetUnitTestImpl();
- const InternalRunDeathTestFlag* const flag =
- impl->internal_run_death_test_flag();
- const TestInfo* const info = impl->current_test_info();
- const int death_test_index = info->result()->death_test_count();
-
- if (flag != NULL) {
- // ParseInternalRunDeathTestFlag() has performed all the necessary
- // processing.
- set_write_fd(flag->write_fd());
- return EXECUTE_TEST;
- }
-
- // WindowsDeathTest uses an anonymous pipe to communicate results of
- // a death test.
- SECURITY_ATTRIBUTES handles_are_inheritable = {
- sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };
- HANDLE read_handle, write_handle;
- GTEST_DEATH_TEST_CHECK_(
- ::CreatePipe(&read_handle, &write_handle, &handles_are_inheritable,
- 0) // Default buffer size.
- != FALSE);
- set_read_fd(::_open_osfhandle(reinterpret_cast<intptr_t>(read_handle),
- O_RDONLY));
- write_handle_.Reset(write_handle);
- event_handle_.Reset(::CreateEvent(
- &handles_are_inheritable,
- TRUE, // The event will automatically reset to non-signaled state.
- FALSE, // The initial state is non-signalled.
- NULL)); // The even is unnamed.
- GTEST_DEATH_TEST_CHECK_(event_handle_.Get() != NULL);
- const std::string filter_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kFilterFlag + "=" +
- info->test_case_name() + "." + info->name();
- const std::string internal_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag +
- "=" + file_ + "|" + StreamableToString(line_) + "|" +
- StreamableToString(death_test_index) + "|" +
- StreamableToString(static_cast<unsigned int>(::GetCurrentProcessId())) +
- // size_t has the same width as pointers on both 32-bit and 64-bit
- // Windows platforms.
- // See http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx.
- "|" + StreamableToString(reinterpret_cast<size_t>(write_handle)) +
- "|" + StreamableToString(reinterpret_cast<size_t>(event_handle_.Get()));
-
- char executable_path[_MAX_PATH + 1]; // NOLINT
- GTEST_DEATH_TEST_CHECK_(
- _MAX_PATH + 1 != ::GetModuleFileNameA(NULL,
- executable_path,
- _MAX_PATH));
-
- std::string command_line =
- std::string(::GetCommandLineA()) + " " + filter_flag + " \"" +
- internal_flag + "\"";
-
- DeathTest::set_last_death_test_message("");
-
- CaptureStderr();
- // Flush the log buffers since the log streams are shared with the child.
- FlushInfoLog();
-
- // The child process will share the standard handles with the parent.
- STARTUPINFOA startup_info;
- memset(&startup_info, 0, sizeof(STARTUPINFO));
- startup_info.dwFlags = STARTF_USESTDHANDLES;
- startup_info.hStdInput = ::GetStdHandle(STD_INPUT_HANDLE);
- startup_info.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE);
- startup_info.hStdError = ::GetStdHandle(STD_ERROR_HANDLE);
-
- PROCESS_INFORMATION process_info;
- GTEST_DEATH_TEST_CHECK_(::CreateProcessA(
- executable_path,
- const_cast<char*>(command_line.c_str()),
- NULL, // Retuned process handle is not inheritable.
- NULL, // Retuned thread handle is not inheritable.
- TRUE, // Child inherits all inheritable handles (for write_handle_).
- 0x0, // Default creation flags.
- NULL, // Inherit the parent's environment.
- UnitTest::GetInstance()->original_working_dir(),
- &startup_info,
- &process_info) != FALSE);
- child_handle_.Reset(process_info.hProcess);
- ::CloseHandle(process_info.hThread);
- set_spawned(true);
- return OVERSEE_TEST;
-}
-# else // We are not on Windows.
-
-// ForkingDeathTest provides implementations for most of the abstract
-// methods of the DeathTest interface. Only the AssumeRole method is
-// left undefined.
-class ForkingDeathTest : public DeathTestImpl {
- public:
- ForkingDeathTest(const char* statement, const RE* regex);
-
- // All of these virtual functions are inherited from DeathTest.
- virtual int Wait();
-
- protected:
- void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; }
-
- private:
- // PID of child process during death test; 0 in the child process itself.
- pid_t child_pid_;
-};
-
-// Constructs a ForkingDeathTest.
-ForkingDeathTest::ForkingDeathTest(const char* a_statement, const RE* a_regex)
- : DeathTestImpl(a_statement, a_regex),
- child_pid_(-1) {}
-
-// Waits for the child in a death test to exit, returning its exit
-// status, or 0 if no child process exists. As a side effect, sets the
-// outcome data member.
-int ForkingDeathTest::Wait() {
- if (!spawned())
- return 0;
-
- ReadAndInterpretStatusByte();
-
- int status_value;
- GTEST_DEATH_TEST_CHECK_SYSCALL_(waitpid(child_pid_, &status_value, 0));
- set_status(status_value);
- return status_value;
-}
-
-// A concrete death test class that forks, then immediately runs the test
-// in the child process.
-class NoExecDeathTest : public ForkingDeathTest {
- public:
- NoExecDeathTest(const char* a_statement, const RE* a_regex) :
- ForkingDeathTest(a_statement, a_regex) { }
- virtual TestRole AssumeRole();
-};
-
-// The AssumeRole process for a fork-and-run death test. It implements a
-// straightforward fork, with a simple pipe to transmit the status byte.
-DeathTest::TestRole NoExecDeathTest::AssumeRole() {
- const size_t thread_count = GetThreadCount();
- if (thread_count != 1) {
- GTEST_LOG_(WARNING) << DeathTestThreadWarning(thread_count);
- }
-
- int pipe_fd[2];
- GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);
-
- DeathTest::set_last_death_test_message("");
- CaptureStderr();
- // When we fork the process below, the log file buffers are copied, but the
- // file descriptors are shared. We flush all log files here so that closing
- // the file descriptors in the child process doesn't throw off the
- // synchronization between descriptors and buffers in the parent process.
- // This is as close to the fork as possible to avoid a race condition in case
- // there are multiple threads running before the death test, and another
- // thread writes to the log file.
- FlushInfoLog();
-
- const pid_t child_pid = fork();
- GTEST_DEATH_TEST_CHECK_(child_pid != -1);
- set_child_pid(child_pid);
- if (child_pid == 0) {
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0]));
- set_write_fd(pipe_fd[1]);
- // Redirects all logging to stderr in the child process to prevent
- // concurrent writes to the log files. We capture stderr in the parent
- // process and append the child process' output to a log.
- LogToStderr();
- // Event forwarding to the listeners of event listener API mush be shut
- // down in death test subprocesses.
- GetUnitTestImpl()->listeners()->SuppressEventForwarding();
- g_in_fast_death_test_child = true;
- return EXECUTE_TEST;
- } else {
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
- set_read_fd(pipe_fd[0]);
- set_spawned(true);
- return OVERSEE_TEST;
- }
-}
-
-// A concrete death test class that forks and re-executes the main
-// program from the beginning, with command-line flags set that cause
-// only this specific death test to be run.
-class ExecDeathTest : public ForkingDeathTest {
- public:
- ExecDeathTest(const char* a_statement, const RE* a_regex,
- const char* file, int line) :
- ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { }
- virtual TestRole AssumeRole();
- private:
- static ::std::vector<testing::internal::string>
- GetArgvsForDeathTestChildProcess() {
- ::std::vector<testing::internal::string> args = GetInjectableArgvs();
- return args;
- }
- // The name of the file in which the death test is located.
- const char* const file_;
- // The line number on which the death test is located.
- const int line_;
-};
-
-// Utility class for accumulating command-line arguments.
-class Arguments {
- public:
- Arguments() {
- args_.push_back(NULL);
- }
-
- ~Arguments() {
- for (std::vector<char*>::iterator i = args_.begin(); i != args_.end();
- ++i) {
- free(*i);
- }
- }
- void AddArgument(const char* argument) {
- args_.insert(args_.end() - 1, posix::StrDup(argument));
- }
-
- template <typename Str>
- void AddArguments(const ::std::vector<Str>& arguments) {
- for (typename ::std::vector<Str>::const_iterator i = arguments.begin();
- i != arguments.end();
- ++i) {
- args_.insert(args_.end() - 1, posix::StrDup(i->c_str()));
- }
- }
- char* const* Argv() {
- return &args_[0];
- }
-
- private:
- std::vector<char*> args_;
-};
-
-// A struct that encompasses the arguments to the child process of a
-// threadsafe-style death test process.
-struct ExecDeathTestArgs {
- char* const* argv; // Command-line arguments for the child's call to exec
- int close_fd; // File descriptor to close; the read end of a pipe
-};
-
-# if GTEST_OS_MAC
-inline char** GetEnviron() {
- // When Google Test is built as a framework on MacOS X, the environ variable
- // is unavailable. Apple's documentation (man environ) recommends using
- // _NSGetEnviron() instead.
- return *_NSGetEnviron();
-}
-# else
-// Some POSIX platforms expect you to declare environ. extern "C" makes
-// it reside in the global namespace.
-extern "C" char** environ;
-inline char** GetEnviron() { return environ; }
-# endif // GTEST_OS_MAC
-
-# if !GTEST_OS_QNX
-// The main function for a threadsafe-style death test child process.
-// This function is called in a clone()-ed process and thus must avoid
-// any potentially unsafe operations like malloc or libc functions.
-static int ExecDeathTestChildMain(void* child_arg) {
- ExecDeathTestArgs* const args = static_cast<ExecDeathTestArgs*>(child_arg);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(args->close_fd));
-
- // We need to execute the test program in the same environment where
- // it was originally invoked. Therefore we change to the original
- // working directory first.
- const char* const original_dir =
- UnitTest::GetInstance()->original_working_dir();
- // We can safely call chdir() as it's a direct system call.
- if (chdir(original_dir) != 0) {
- DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " +
- GetLastErrnoDescription());
- return EXIT_FAILURE;
- }
-
- // We can safely call execve() as it's a direct system call. We
- // cannot use execvp() as it's a libc function and thus potentially
- // unsafe. Since execve() doesn't search the PATH, the user must
- // invoke the test program via a valid path that contains at least
- // one path separator.
- execve(args->argv[0], args->argv, GetEnviron());
- DeathTestAbort(std::string("execve(") + args->argv[0] + ", ...) in " +
- original_dir + " failed: " +
- GetLastErrnoDescription());
- return EXIT_FAILURE;
-}
-# endif // !GTEST_OS_QNX
-
-// Two utility routines that together determine the direction the stack
-// grows.
-// This could be accomplished more elegantly by a single recursive
-// function, but we want to guard against the unlikely possibility of
-// a smart compiler optimizing the recursion away.
-//
-// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining
-// StackLowerThanAddress into StackGrowsDown, which then doesn't give
-// correct answer.
-void StackLowerThanAddress(const void* ptr, bool* result) GTEST_NO_INLINE_;
-void StackLowerThanAddress(const void* ptr, bool* result) {
- int dummy;
- *result = (&dummy < ptr);
-}
-
-bool StackGrowsDown() {
- int dummy;
- bool result;
- StackLowerThanAddress(&dummy, &result);
- return result;
-}
-
-// Spawns a child process with the same executable as the current process in
-// a thread-safe manner and instructs it to run the death test. The
-// implementation uses fork(2) + exec. On systems where clone(2) is
-// available, it is used instead, being slightly more thread-safe. On QNX,
-// fork supports only single-threaded environments, so this function uses
-// spawn(2) there instead. The function dies with an error message if
-// anything goes wrong.
-static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
- ExecDeathTestArgs args = { argv, close_fd };
- pid_t child_pid = -1;
-
-# if GTEST_OS_QNX
- // Obtains the current directory and sets it to be closed in the child
- // process.
- const int cwd_fd = open(".", O_RDONLY);
- GTEST_DEATH_TEST_CHECK_(cwd_fd != -1);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(cwd_fd, F_SETFD, FD_CLOEXEC));
- // We need to execute the test program in the same environment where
- // it was originally invoked. Therefore we change to the original
- // working directory first.
- const char* const original_dir =
- UnitTest::GetInstance()->original_working_dir();
- // We can safely call chdir() as it's a direct system call.
- if (chdir(original_dir) != 0) {
- DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " +
- GetLastErrnoDescription());
- return EXIT_FAILURE;
- }
-
- int fd_flags;
- // Set close_fd to be closed after spawn.
- GTEST_DEATH_TEST_CHECK_SYSCALL_(fd_flags = fcntl(close_fd, F_GETFD));
- GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(close_fd, F_SETFD,
- fd_flags | FD_CLOEXEC));
- struct inheritance inherit = {0};
- // spawn is a system call.
- child_pid = spawn(args.argv[0], 0, NULL, &inherit, args.argv, GetEnviron());
- // Restores the current working directory.
- GTEST_DEATH_TEST_CHECK_(fchdir(cwd_fd) != -1);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(cwd_fd));
-
-# else // GTEST_OS_QNX
-# if GTEST_OS_LINUX
- // When a SIGPROF signal is received while fork() or clone() are executing,
- // the process may hang. To avoid this, we ignore SIGPROF here and re-enable
- // it after the call to fork()/clone() is complete.
- struct sigaction saved_sigprof_action;
- struct sigaction ignore_sigprof_action;
- memset(&ignore_sigprof_action, 0, sizeof(ignore_sigprof_action));
- sigemptyset(&ignore_sigprof_action.sa_mask);
- ignore_sigprof_action.sa_handler = SIG_IGN;
- GTEST_DEATH_TEST_CHECK_SYSCALL_(sigaction(
- SIGPROF, &ignore_sigprof_action, &saved_sigprof_action));
-# endif // GTEST_OS_LINUX
-
-# if GTEST_HAS_CLONE
- const bool use_fork = GTEST_FLAG(death_test_use_fork);
-
- if (!use_fork) {
- static const bool stack_grows_down = StackGrowsDown();
- const size_t stack_size = getpagesize();
- // MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead.
- void* const stack = mmap(NULL, stack_size, PROT_READ | PROT_WRITE,
- MAP_ANON | MAP_PRIVATE, -1, 0);
- GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED);
-
- // Maximum stack alignment in bytes: For a downward-growing stack, this
- // amount is subtracted from size of the stack space to get an address
- // that is within the stack space and is aligned on all systems we care
- // about. As far as I know there is no ABI with stack alignment greater
- // than 64. We assume stack and stack_size already have alignment of
- // kMaxStackAlignment.
- const size_t kMaxStackAlignment = 64;
- void* const stack_top =
- static_cast<char*>(stack) +
- (stack_grows_down ? stack_size - kMaxStackAlignment : 0);
- GTEST_DEATH_TEST_CHECK_(stack_size > kMaxStackAlignment &&
- reinterpret_cast<intptr_t>(stack_top) % kMaxStackAlignment == 0);
-
- child_pid = clone(&ExecDeathTestChildMain, stack_top, SIGCHLD, &args);
-
- GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1);
- }
-# else
- const bool use_fork = true;
-# endif // GTEST_HAS_CLONE
-
- if (use_fork && (child_pid = fork()) == 0) {
- ExecDeathTestChildMain(&args);
- _exit(0);
- }
-# endif // GTEST_OS_QNX
-# if GTEST_OS_LINUX
- GTEST_DEATH_TEST_CHECK_SYSCALL_(
- sigaction(SIGPROF, &saved_sigprof_action, NULL));
-# endif // GTEST_OS_LINUX
-
- GTEST_DEATH_TEST_CHECK_(child_pid != -1);
- return child_pid;
-}
-
-// The AssumeRole process for a fork-and-exec death test. It re-executes the
-// main program from the beginning, setting the --gtest_filter
-// and --gtest_internal_run_death_test flags to cause only the current
-// death test to be re-run.
-DeathTest::TestRole ExecDeathTest::AssumeRole() {
- const UnitTestImpl* const impl = GetUnitTestImpl();
- const InternalRunDeathTestFlag* const flag =
- impl->internal_run_death_test_flag();
- const TestInfo* const info = impl->current_test_info();
- const int death_test_index = info->result()->death_test_count();
-
- if (flag != NULL) {
- set_write_fd(flag->write_fd());
- return EXECUTE_TEST;
- }
-
- int pipe_fd[2];
- GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);
- // Clear the close-on-exec flag on the write end of the pipe, lest
- // it be closed when the child process does an exec:
- GTEST_DEATH_TEST_CHECK_(fcntl(pipe_fd[1], F_SETFD, 0) != -1);
-
- const std::string filter_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kFilterFlag + "="
- + info->test_case_name() + "." + info->name();
- const std::string internal_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + "="
- + file_ + "|" + StreamableToString(line_) + "|"
- + StreamableToString(death_test_index) + "|"
- + StreamableToString(pipe_fd[1]);
- Arguments args;
- args.AddArguments(GetArgvsForDeathTestChildProcess());
- args.AddArgument(filter_flag.c_str());
- args.AddArgument(internal_flag.c_str());
-
- DeathTest::set_last_death_test_message("");
-
- CaptureStderr();
- // See the comment in NoExecDeathTest::AssumeRole for why the next line
- // is necessary.
- FlushInfoLog();
-
- const pid_t child_pid = ExecDeathTestSpawnChild(args.Argv(), pipe_fd[0]);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
- set_child_pid(child_pid);
- set_read_fd(pipe_fd[0]);
- set_spawned(true);
- return OVERSEE_TEST;
-}
-
-# endif // !GTEST_OS_WINDOWS
-
-// Creates a concrete DeathTest-derived class that depends on the
-// --gtest_death_test_style flag, and sets the pointer pointed to
-// by the "test" argument to its address. If the test should be
-// skipped, sets that pointer to NULL. Returns true, unless the
-// flag is set to an invalid value.
-bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,
- const char* file, int line,
- DeathTest** test) {
- UnitTestImpl* const impl = GetUnitTestImpl();
- const InternalRunDeathTestFlag* const flag =
- impl->internal_run_death_test_flag();
- const int death_test_index = impl->current_test_info()
- ->increment_death_test_count();
-
- if (flag != NULL) {
- if (death_test_index > flag->index()) {
- DeathTest::set_last_death_test_message(
- "Death test count (" + StreamableToString(death_test_index)
- + ") somehow exceeded expected maximum ("
- + StreamableToString(flag->index()) + ")");
- return false;
- }
-
- if (!(flag->file() == file && flag->line() == line &&
- flag->index() == death_test_index)) {
- *test = NULL;
- return true;
- }
- }
-
-# if GTEST_OS_WINDOWS
-
- if (GTEST_FLAG(death_test_style) == "threadsafe" ||
- GTEST_FLAG(death_test_style) == "fast") {
- *test = new WindowsDeathTest(statement, regex, file, line);
- }
-
-# else
-
- if (GTEST_FLAG(death_test_style) == "threadsafe") {
- *test = new ExecDeathTest(statement, regex, file, line);
- } else if (GTEST_FLAG(death_test_style) == "fast") {
- *test = new NoExecDeathTest(statement, regex);
- }
-
-# endif // GTEST_OS_WINDOWS
-
- else { // NOLINT - this is more readable than unbalanced brackets inside #if.
- DeathTest::set_last_death_test_message(
- "Unknown death test style \"" + GTEST_FLAG(death_test_style)
- + "\" encountered");
- return false;
- }
-
- return true;
-}
-
-// Splits a given string on a given delimiter, populating a given
-// vector with the fields. GTEST_HAS_DEATH_TEST implies that we have
-// ::std::string, so we can use it here.
-static void SplitString(const ::std::string& str, char delimiter,
- ::std::vector< ::std::string>* dest) {
- ::std::vector< ::std::string> parsed;
- ::std::string::size_type pos = 0;
- while (::testing::internal::AlwaysTrue()) {
- const ::std::string::size_type colon = str.find(delimiter, pos);
- if (colon == ::std::string::npos) {
- parsed.push_back(str.substr(pos));
- break;
- } else {
- parsed.push_back(str.substr(pos, colon - pos));
- pos = colon + 1;
- }
- }
- dest->swap(parsed);
-}
-
-# if GTEST_OS_WINDOWS
-// Recreates the pipe and event handles from the provided parameters,
-// signals the event, and returns a file descriptor wrapped around the pipe
-// handle. This function is called in the child process only.
-int GetStatusFileDescriptor(unsigned int parent_process_id,
- size_t write_handle_as_size_t,
- size_t event_handle_as_size_t) {
- AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE,
- FALSE, // Non-inheritable.
- parent_process_id));
- if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) {
- DeathTestAbort("Unable to open parent process " +
- StreamableToString(parent_process_id));
- }
-
- // TODO(vladl@google.com): Replace the following check with a
- // compile-time assertion when available.
- GTEST_CHECK_(sizeof(HANDLE) <= sizeof(size_t));
-
- const HANDLE write_handle =
- reinterpret_cast<HANDLE>(write_handle_as_size_t);
- HANDLE dup_write_handle;
-
- // The newly initialized handle is accessible only in in the parent
- // process. To obtain one accessible within the child, we need to use
- // DuplicateHandle.
- if (!::DuplicateHandle(parent_process_handle.Get(), write_handle,
- ::GetCurrentProcess(), &dup_write_handle,
- 0x0, // Requested privileges ignored since
- // DUPLICATE_SAME_ACCESS is used.
- FALSE, // Request non-inheritable handler.
- DUPLICATE_SAME_ACCESS)) {
- DeathTestAbort("Unable to duplicate the pipe handle " +
- StreamableToString(write_handle_as_size_t) +
- " from the parent process " +
- StreamableToString(parent_process_id));
- }
-
- const HANDLE event_handle = reinterpret_cast<HANDLE>(event_handle_as_size_t);
- HANDLE dup_event_handle;
-
- if (!::DuplicateHandle(parent_process_handle.Get(), event_handle,
- ::GetCurrentProcess(), &dup_event_handle,
- 0x0,
- FALSE,
- DUPLICATE_SAME_ACCESS)) {
- DeathTestAbort("Unable to duplicate the event handle " +
- StreamableToString(event_handle_as_size_t) +
- " from the parent process " +
- StreamableToString(parent_process_id));
- }
-
- const int write_fd =
- ::_open_osfhandle(reinterpret_cast<intptr_t>(dup_write_handle), O_APPEND);
- if (write_fd == -1) {
- DeathTestAbort("Unable to convert pipe handle " +
- StreamableToString(write_handle_as_size_t) +
- " to a file descriptor");
- }
-
- // Signals the parent that the write end of the pipe has been acquired
- // so the parent can release its own write end.
- ::SetEvent(dup_event_handle);
-
- return write_fd;
-}
-# endif // GTEST_OS_WINDOWS
-
-// Returns a newly created InternalRunDeathTestFlag object with fields
-// initialized from the GTEST_FLAG(internal_run_death_test) flag if
-// the flag is specified; otherwise returns NULL.
-InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
- if (GTEST_FLAG(internal_run_death_test) == "") return NULL;
-
- // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we
- // can use it here.
- int line = -1;
- int index = -1;
- ::std::vector< ::std::string> fields;
- SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields);
- int write_fd = -1;
-
-# if GTEST_OS_WINDOWS
-
- unsigned int parent_process_id = 0;
- size_t write_handle_as_size_t = 0;
- size_t event_handle_as_size_t = 0;
-
- if (fields.size() != 6
- || !ParseNaturalNumber(fields[1], &line)
- || !ParseNaturalNumber(fields[2], &index)
- || !ParseNaturalNumber(fields[3], &parent_process_id)
- || !ParseNaturalNumber(fields[4], &write_handle_as_size_t)
- || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) {
- DeathTestAbort("Bad --gtest_internal_run_death_test flag: " +
- GTEST_FLAG(internal_run_death_test));
- }
- write_fd = GetStatusFileDescriptor(parent_process_id,
- write_handle_as_size_t,
- event_handle_as_size_t);
-# else
-
- if (fields.size() != 4
- || !ParseNaturalNumber(fields[1], &line)
- || !ParseNaturalNumber(fields[2], &index)
- || !ParseNaturalNumber(fields[3], &write_fd)) {
- DeathTestAbort("Bad --gtest_internal_run_death_test flag: "
- + GTEST_FLAG(internal_run_death_test));
- }
-
-# endif // GTEST_OS_WINDOWS
-
- return new InternalRunDeathTestFlag(fields[0], line, index, write_fd);
-}
-
-} // namespace internal
-
-#endif // GTEST_HAS_DEATH_TEST
-
-} // namespace testing
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-filepath.cc b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-filepath.cc
deleted file mode 100644
index 219875c..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-filepath.cc
+++ /dev/null
@@ -1,380 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: keith.ray@gmail.com (Keith Ray)
-
-#include "gtest/gtest-message.h"
-#include "gtest/internal/gtest-filepath.h"
-#include "gtest/internal/gtest-port.h"
-
-#include <stdlib.h>
-
-#if GTEST_OS_WINDOWS_MOBILE
-# include <windows.h>
-#elif GTEST_OS_WINDOWS
-# include <direct.h>
-# include <io.h>
-#elif GTEST_OS_SYMBIAN
-// Symbian OpenC has PATH_MAX in sys/syslimits.h
-# include <sys/syslimits.h>
-#else
-# include <limits.h>
-# include <climits> // Some Linux distributions define PATH_MAX here.
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-#if GTEST_OS_WINDOWS
-# define GTEST_PATH_MAX_ _MAX_PATH
-#elif defined(PATH_MAX)
-# define GTEST_PATH_MAX_ PATH_MAX
-#elif defined(_XOPEN_PATH_MAX)
-# define GTEST_PATH_MAX_ _XOPEN_PATH_MAX
-#else
-# define GTEST_PATH_MAX_ _POSIX_PATH_MAX
-#endif // GTEST_OS_WINDOWS
-
-#include "gtest/internal/gtest-string.h"
-
-namespace testing {
-namespace internal {
-
-#if GTEST_OS_WINDOWS
-// On Windows, '\\' is the standard path separator, but many tools and the
-// Windows API also accept '/' as an alternate path separator. Unless otherwise
-// noted, a file path can contain either kind of path separators, or a mixture
-// of them.
-const char kPathSeparator = '\\';
-const char kAlternatePathSeparator = '/';
-const char kAlternatePathSeparatorString[] = "/";
-# if GTEST_OS_WINDOWS_MOBILE
-// Windows CE doesn't have a current directory. You should not use
-// the current directory in tests on Windows CE, but this at least
-// provides a reasonable fallback.
-const char kCurrentDirectoryString[] = "\\";
-// Windows CE doesn't define INVALID_FILE_ATTRIBUTES
-const DWORD kInvalidFileAttributes = 0xffffffff;
-# else
-const char kCurrentDirectoryString[] = ".\\";
-# endif // GTEST_OS_WINDOWS_MOBILE
-#else
-const char kPathSeparator = '/';
-const char kCurrentDirectoryString[] = "./";
-#endif // GTEST_OS_WINDOWS
-
-// Returns whether the given character is a valid path separator.
-static bool IsPathSeparator(char c) {
-#if GTEST_HAS_ALT_PATH_SEP_
- return (c == kPathSeparator) || (c == kAlternatePathSeparator);
-#else
- return c == kPathSeparator;
-#endif
-}
-
-// Returns the current working directory, or "" if unsuccessful.
-FilePath FilePath::GetCurrentDir() {
-#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT
- // Windows CE doesn't have a current directory, so we just return
- // something reasonable.
- return FilePath(kCurrentDirectoryString);
-#elif GTEST_OS_WINDOWS
- char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
- return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
-#else
- char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
- return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
-#endif // GTEST_OS_WINDOWS_MOBILE
-}
-
-// Returns a copy of the FilePath with the case-insensitive extension removed.
-// Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
-// FilePath("dir/file"). If a case-insensitive extension is not
-// found, returns a copy of the original FilePath.
-FilePath FilePath::RemoveExtension(const char* extension) const {
- const std::string dot_extension = std::string(".") + extension;
- if (String::EndsWithCaseInsensitive(pathname_, dot_extension)) {
- return FilePath(pathname_.substr(
- 0, pathname_.length() - dot_extension.length()));
- }
- return *this;
-}
-
-// Returns a pointer to the last occurence of a valid path separator in
-// the FilePath. On Windows, for example, both '/' and '\' are valid path
-// separators. Returns NULL if no path separator was found.
-const char* FilePath::FindLastPathSeparator() const {
- const char* const last_sep = strrchr(c_str(), kPathSeparator);
-#if GTEST_HAS_ALT_PATH_SEP_
- const char* const last_alt_sep = strrchr(c_str(), kAlternatePathSeparator);
- // Comparing two pointers of which only one is NULL is undefined.
- if (last_alt_sep != NULL &&
- (last_sep == NULL || last_alt_sep > last_sep)) {
- return last_alt_sep;
- }
-#endif
- return last_sep;
-}
-
-// Returns a copy of the FilePath with the directory part removed.
-// Example: FilePath("path/to/file").RemoveDirectoryName() returns
-// FilePath("file"). If there is no directory part ("just_a_file"), it returns
-// the FilePath unmodified. If there is no file part ("just_a_dir/") it
-// returns an empty FilePath ("").
-// On Windows platform, '\' is the path separator, otherwise it is '/'.
-FilePath FilePath::RemoveDirectoryName() const {
- const char* const last_sep = FindLastPathSeparator();
- return last_sep ? FilePath(last_sep + 1) : *this;
-}
-
-// RemoveFileName returns the directory path with the filename removed.
-// Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
-// If the FilePath is "a_file" or "/a_file", RemoveFileName returns
-// FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
-// not have a file, like "just/a/dir/", it returns the FilePath unmodified.
-// On Windows platform, '\' is the path separator, otherwise it is '/'.
-FilePath FilePath::RemoveFileName() const {
- const char* const last_sep = FindLastPathSeparator();
- std::string dir;
- if (last_sep) {
- dir = std::string(c_str(), last_sep + 1 - c_str());
- } else {
- dir = kCurrentDirectoryString;
- }
- return FilePath(dir);
-}
-
-// Helper functions for naming files in a directory for xml output.
-
-// Given directory = "dir", base_name = "test", number = 0,
-// extension = "xml", returns "dir/test.xml". If number is greater
-// than zero (e.g., 12), returns "dir/test_12.xml".
-// On Windows platform, uses \ as the separator rather than /.
-FilePath FilePath::MakeFileName(const FilePath& directory,
- const FilePath& base_name,
- int number,
- const char* extension) {
- std::string file;
- if (number == 0) {
- file = base_name.string() + "." + extension;
- } else {
- file = base_name.string() + "_" + StreamableToString(number)
- + "." + extension;
- }
- return ConcatPaths(directory, FilePath(file));
-}
-
-// Given directory = "dir", relative_path = "test.xml", returns "dir/test.xml".
-// On Windows, uses \ as the separator rather than /.
-FilePath FilePath::ConcatPaths(const FilePath& directory,
- const FilePath& relative_path) {
- if (directory.IsEmpty())
- return relative_path;
- const FilePath dir(directory.RemoveTrailingPathSeparator());
- return FilePath(dir.string() + kPathSeparator + relative_path.string());
-}
-
-// Returns true if pathname describes something findable in the file-system,
-// either a file, directory, or whatever.
-bool FilePath::FileOrDirectoryExists() const {
-#if GTEST_OS_WINDOWS_MOBILE
- LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str());
- const DWORD attributes = GetFileAttributes(unicode);
- delete [] unicode;
- return attributes != kInvalidFileAttributes;
-#else
- posix::StatStruct file_stat;
- return posix::Stat(pathname_.c_str(), &file_stat) == 0;
-#endif // GTEST_OS_WINDOWS_MOBILE
-}
-
-// Returns true if pathname describes a directory in the file-system
-// that exists.
-bool FilePath::DirectoryExists() const {
- bool result = false;
-#if GTEST_OS_WINDOWS
- // Don't strip off trailing separator if path is a root directory on
- // Windows (like "C:\\").
- const FilePath& path(IsRootDirectory() ? *this :
- RemoveTrailingPathSeparator());
-#else
- const FilePath& path(*this);
-#endif
-
-#if GTEST_OS_WINDOWS_MOBILE
- LPCWSTR unicode = String::AnsiToUtf16(path.c_str());
- const DWORD attributes = GetFileAttributes(unicode);
- delete [] unicode;
- if ((attributes != kInvalidFileAttributes) &&
- (attributes & FILE_ATTRIBUTE_DIRECTORY)) {
- result = true;
- }
-#else
- posix::StatStruct file_stat;
- result = posix::Stat(path.c_str(), &file_stat) == 0 &&
- posix::IsDir(file_stat);
-#endif // GTEST_OS_WINDOWS_MOBILE
-
- return result;
-}
-
-// Returns true if pathname describes a root directory. (Windows has one
-// root directory per disk drive.)
-bool FilePath::IsRootDirectory() const {
-#if GTEST_OS_WINDOWS
- // TODO(wan@google.com): on Windows a network share like
- // \\server\share can be a root directory, although it cannot be the
- // current directory. Handle this properly.
- return pathname_.length() == 3 && IsAbsolutePath();
-#else
- return pathname_.length() == 1 && IsPathSeparator(pathname_.c_str()[0]);
-#endif
-}
-
-// Returns true if pathname describes an absolute path.
-bool FilePath::IsAbsolutePath() const {
- const char* const name = pathname_.c_str();
-#if GTEST_OS_WINDOWS
- return pathname_.length() >= 3 &&
- ((name[0] >= 'a' && name[0] <= 'z') ||
- (name[0] >= 'A' && name[0] <= 'Z')) &&
- name[1] == ':' &&
- IsPathSeparator(name[2]);
-#else
- return IsPathSeparator(name[0]);
-#endif
-}
-
-// Returns a pathname for a file that does not currently exist. The pathname
-// will be directory/base_name.extension or
-// directory/base_name_<number>.extension if directory/base_name.extension
-// already exists. The number will be incremented until a pathname is found
-// that does not already exist.
-// Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
-// There could be a race condition if two or more processes are calling this
-// function at the same time -- they could both pick the same filename.
-FilePath FilePath::GenerateUniqueFileName(const FilePath& directory,
- const FilePath& base_name,
- const char* extension) {
- FilePath full_pathname;
- int number = 0;
- do {
- full_pathname.Set(MakeFileName(directory, base_name, number++, extension));
- } while (full_pathname.FileOrDirectoryExists());
- return full_pathname;
-}
-
-// Returns true if FilePath ends with a path separator, which indicates that
-// it is intended to represent a directory. Returns false otherwise.
-// This does NOT check that a directory (or file) actually exists.
-bool FilePath::IsDirectory() const {
- return !pathname_.empty() &&
- IsPathSeparator(pathname_.c_str()[pathname_.length() - 1]);
-}
-
-// Create directories so that path exists. Returns true if successful or if
-// the directories already exist; returns false if unable to create directories
-// for any reason.
-bool FilePath::CreateDirectoriesRecursively() const {
- if (!this->IsDirectory()) {
- return false;
- }
-
- if (pathname_.length() == 0 || this->DirectoryExists()) {
- return true;
- }
-
- const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName());
- return parent.CreateDirectoriesRecursively() && this->CreateFolder();
-}
-
-// Create the directory so that path exists. Returns true if successful or
-// if the directory already exists; returns false if unable to create the
-// directory for any reason, including if the parent directory does not
-// exist. Not named "CreateDirectory" because that's a macro on Windows.
-bool FilePath::CreateFolder() const {
-#if GTEST_OS_WINDOWS_MOBILE
- FilePath removed_sep(this->RemoveTrailingPathSeparator());
- LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());
- int result = CreateDirectory(unicode, NULL) ? 0 : -1;
- delete [] unicode;
-#elif GTEST_OS_WINDOWS
- int result = _mkdir(pathname_.c_str());
-#else
- int result = mkdir(pathname_.c_str(), 0777);
-#endif // GTEST_OS_WINDOWS_MOBILE
-
- if (result == -1) {
- return this->DirectoryExists(); // An error is OK if the directory exists.
- }
- return true; // No error.
-}
-
-// If input name has a trailing separator character, remove it and return the
-// name, otherwise return the name string unmodified.
-// On Windows platform, uses \ as the separator, other platforms use /.
-FilePath FilePath::RemoveTrailingPathSeparator() const {
- return IsDirectory()
- ? FilePath(pathname_.substr(0, pathname_.length() - 1))
- : *this;
-}
-
-// Removes any redundant separators that might be in the pathname.
-// For example, "bar///foo" becomes "bar/foo". Does not eliminate other
-// redundancies that might be in a pathname involving "." or "..".
-// TODO(wan@google.com): handle Windows network shares (e.g. \\server\share).
-void FilePath::Normalize() {
- if (pathname_.c_str() == NULL) {
- pathname_ = "";
- return;
- }
- const char* src = pathname_.c_str();
- char* const dest = new char[pathname_.length() + 1];
- char* dest_ptr = dest;
- memset(dest_ptr, 0, pathname_.length() + 1);
-
- while (*src != '\0') {
- *dest_ptr = *src;
- if (!IsPathSeparator(*src)) {
- src++;
- } else {
-#if GTEST_HAS_ALT_PATH_SEP_
- if (*dest_ptr == kAlternatePathSeparator) {
- *dest_ptr = kPathSeparator;
- }
-#endif
- while (IsPathSeparator(*src))
- src++;
- }
- dest_ptr++;
- }
- *dest_ptr = '\0';
- pathname_ = dest;
- delete[] dest;
-}
-
-} // namespace internal
-} // namespace testing
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-internal-inl.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-internal-inl.h
deleted file mode 100644
index 41fadb1..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-internal-inl.h
+++ /dev/null
@@ -1,1192 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Utility functions and classes used by the Google C++ testing framework.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// This file contains purely Google Test's internal implementation. Please
-// DO NOT #INCLUDE IT IN A USER PROGRAM.
-
-#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
-#define GTEST_SRC_GTEST_INTERNAL_INL_H_
-
-// GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is
-// part of Google Test's implementation; otherwise it's undefined.
-#if !GTEST_IMPLEMENTATION_
-// A user is trying to include this from his code - just say no.
-# error "gtest-internal-inl.h is part of Google Test's internal implementation."
-# error "It must not be included except by Google Test itself."
-#endif // GTEST_IMPLEMENTATION_
-
-#ifndef _WIN32_WCE
-# include <errno.h>
-#endif // !_WIN32_WCE
-#include <stddef.h>
-#include <stdlib.h> // For strtoll/_strtoul64/malloc/free.
-#include <string.h> // For memmove.
-
-#include <algorithm>
-#include <string>
-#include <vector>
-
-#include "gtest/internal/gtest-port.h"
-
-#if GTEST_CAN_STREAM_RESULTS_
-# include <arpa/inet.h> // NOLINT
-# include <netdb.h> // NOLINT
-#endif
-
-#if GTEST_OS_WINDOWS
-# include <windows.h> // NOLINT
-#endif // GTEST_OS_WINDOWS
-
-#include "gtest/gtest.h" // NOLINT
-#include "gtest/gtest-spi.h"
-
-namespace testing {
-
-// Declares the flags.
-//
-// We don't want the users to modify this flag in the code, but want
-// Google Test's own unit tests to be able to access it. Therefore we
-// declare it here as opposed to in gtest.h.
-GTEST_DECLARE_bool_(death_test_use_fork);
-
-namespace internal {
-
-// The value of GetTestTypeId() as seen from within the Google Test
-// library. This is solely for testing GetTestTypeId().
-GTEST_API_ extern const TypeId kTestTypeIdInGoogleTest;
-
-// Names of the flags (needed for parsing Google Test flags).
-const char kAlsoRunDisabledTestsFlag[] = "also_run_disabled_tests";
-const char kBreakOnFailureFlag[] = "break_on_failure";
-const char kCatchExceptionsFlag[] = "catch_exceptions";
-const char kColorFlag[] = "color";
-const char kFilterFlag[] = "filter";
-const char kListTestsFlag[] = "list_tests";
-const char kOutputFlag[] = "output";
-const char kPrintTimeFlag[] = "print_time";
-const char kRandomSeedFlag[] = "random_seed";
-const char kRepeatFlag[] = "repeat";
-const char kShuffleFlag[] = "shuffle";
-const char kStackTraceDepthFlag[] = "stack_trace_depth";
-const char kStreamResultToFlag[] = "stream_result_to";
-const char kThrowOnFailureFlag[] = "throw_on_failure";
-
-// A valid random seed must be in [1, kMaxRandomSeed].
-const int kMaxRandomSeed = 99999;
-
-// g_help_flag is true iff the --help flag or an equivalent form is
-// specified on the command line.
-GTEST_API_ extern bool g_help_flag;
-
-// Returns the current time in milliseconds.
-GTEST_API_ TimeInMillis GetTimeInMillis();
-
-// Returns true iff Google Test should use colors in the output.
-GTEST_API_ bool ShouldUseColor(bool stdout_is_tty);
-
-// Formats the given time in milliseconds as seconds.
-GTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms);
-
-// Converts the given time in milliseconds to a date string in the ISO 8601
-// format, without the timezone information. N.B.: due to the use the
-// non-reentrant localtime() function, this function is not thread safe. Do
-// not use it in any code that can be called from multiple threads.
-GTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms);
-
-// Parses a string for an Int32 flag, in the form of "--flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true. On failure, returns false without changing *value.
-GTEST_API_ bool ParseInt32Flag(
- const char* str, const char* flag, Int32* value);
-
-// Returns a random seed in range [1, kMaxRandomSeed] based on the
-// given --gtest_random_seed flag value.
-inline int GetRandomSeedFromFlag(Int32 random_seed_flag) {
- const unsigned int raw_seed = (random_seed_flag == 0) ?
- static_cast<unsigned int>(GetTimeInMillis()) :
- static_cast<unsigned int>(random_seed_flag);
-
- // Normalizes the actual seed to range [1, kMaxRandomSeed] such that
- // it's easy to type.
- const int normalized_seed =
- static_cast<int>((raw_seed - 1U) %
- static_cast<unsigned int>(kMaxRandomSeed)) + 1;
- return normalized_seed;
-}
-
-// Returns the first valid random seed after 'seed'. The behavior is
-// undefined if 'seed' is invalid. The seed after kMaxRandomSeed is
-// considered to be 1.
-inline int GetNextRandomSeed(int seed) {
- GTEST_CHECK_(1 <= seed && seed <= kMaxRandomSeed)
- << "Invalid random seed " << seed << " - must be in [1, "
- << kMaxRandomSeed << "].";
- const int next_seed = seed + 1;
- return (next_seed > kMaxRandomSeed) ? 1 : next_seed;
-}
-
-// This class saves the values of all Google Test flags in its c'tor, and
-// restores them in its d'tor.
-class GTestFlagSaver {
- public:
- // The c'tor.
- GTestFlagSaver() {
- also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests);
- break_on_failure_ = GTEST_FLAG(break_on_failure);
- catch_exceptions_ = GTEST_FLAG(catch_exceptions);
- color_ = GTEST_FLAG(color);
- death_test_style_ = GTEST_FLAG(death_test_style);
- death_test_use_fork_ = GTEST_FLAG(death_test_use_fork);
- filter_ = GTEST_FLAG(filter);
- internal_run_death_test_ = GTEST_FLAG(internal_run_death_test);
- list_tests_ = GTEST_FLAG(list_tests);
- output_ = GTEST_FLAG(output);
- print_time_ = GTEST_FLAG(print_time);
- random_seed_ = GTEST_FLAG(random_seed);
- repeat_ = GTEST_FLAG(repeat);
- shuffle_ = GTEST_FLAG(shuffle);
- stack_trace_depth_ = GTEST_FLAG(stack_trace_depth);
- stream_result_to_ = GTEST_FLAG(stream_result_to);
- throw_on_failure_ = GTEST_FLAG(throw_on_failure);
- }
-
- // The d'tor is not virtual. DO NOT INHERIT FROM THIS CLASS.
- ~GTestFlagSaver() {
- GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_;
- GTEST_FLAG(break_on_failure) = break_on_failure_;
- GTEST_FLAG(catch_exceptions) = catch_exceptions_;
- GTEST_FLAG(color) = color_;
- GTEST_FLAG(death_test_style) = death_test_style_;
- GTEST_FLAG(death_test_use_fork) = death_test_use_fork_;
- GTEST_FLAG(filter) = filter_;
- GTEST_FLAG(internal_run_death_test) = internal_run_death_test_;
- GTEST_FLAG(list_tests) = list_tests_;
- GTEST_FLAG(output) = output_;
- GTEST_FLAG(print_time) = print_time_;
- GTEST_FLAG(random_seed) = random_seed_;
- GTEST_FLAG(repeat) = repeat_;
- GTEST_FLAG(shuffle) = shuffle_;
- GTEST_FLAG(stack_trace_depth) = stack_trace_depth_;
- GTEST_FLAG(stream_result_to) = stream_result_to_;
- GTEST_FLAG(throw_on_failure) = throw_on_failure_;
- }
-
- private:
- // Fields for saving the original values of flags.
- bool also_run_disabled_tests_;
- bool break_on_failure_;
- bool catch_exceptions_;
- std::string color_;
- std::string death_test_style_;
- bool death_test_use_fork_;
- std::string filter_;
- std::string internal_run_death_test_;
- bool list_tests_;
- std::string output_;
- bool print_time_;
- internal::Int32 random_seed_;
- internal::Int32 repeat_;
- bool shuffle_;
- internal::Int32 stack_trace_depth_;
- std::string stream_result_to_;
- bool throw_on_failure_;
-} GTEST_ATTRIBUTE_UNUSED_;
-
-// Converts a Unicode code point to a narrow string in UTF-8 encoding.
-// code_point parameter is of type UInt32 because wchar_t may not be
-// wide enough to contain a code point.
-// If the code_point is not a valid Unicode code point
-// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted
-// to "(Invalid Unicode 0xXXXXXXXX)".
-GTEST_API_ std::string CodePointToUtf8(UInt32 code_point);
-
-// Converts a wide string to a narrow string in UTF-8 encoding.
-// The wide string is assumed to have the following encoding:
-// UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)
-// UTF-32 if sizeof(wchar_t) == 4 (on Linux)
-// Parameter str points to a null-terminated wide string.
-// Parameter num_chars may additionally limit the number
-// of wchar_t characters processed. -1 is used when the entire string
-// should be processed.
-// If the string contains code points that are not valid Unicode code points
-// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output
-// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
-// and contains invalid UTF-16 surrogate pairs, values in those pairs
-// will be encoded as individual Unicode characters from Basic Normal Plane.
-GTEST_API_ std::string WideStringToUtf8(const wchar_t* str, int num_chars);
-
-// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
-// if the variable is present. If a file already exists at this location, this
-// function will write over it. If the variable is present, but the file cannot
-// be created, prints an error and exits.
-void WriteToShardStatusFileIfNeeded();
-
-// Checks whether sharding is enabled by examining the relevant
-// environment variable values. If the variables are present,
-// but inconsistent (e.g., shard_index >= total_shards), prints
-// an error and exits. If in_subprocess_for_death_test, sharding is
-// disabled because it must only be applied to the original test
-// process. Otherwise, we could filter out death tests we intended to execute.
-GTEST_API_ bool ShouldShard(const char* total_shards_str,
- const char* shard_index_str,
- bool in_subprocess_for_death_test);
-
-// Parses the environment variable var as an Int32. If it is unset,
-// returns default_val. If it is not an Int32, prints an error and
-// and aborts.
-GTEST_API_ Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val);
-
-// Given the total number of shards, the shard index, and the test id,
-// returns true iff the test should be run on this shard. The test id is
-// some arbitrary but unique non-negative integer assigned to each test
-// method. Assumes that 0 <= shard_index < total_shards.
-GTEST_API_ bool ShouldRunTestOnShard(
- int total_shards, int shard_index, int test_id);
-
-// STL container utilities.
-
-// Returns the number of elements in the given container that satisfy
-// the given predicate.
-template <class Container, typename Predicate>
-inline int CountIf(const Container& c, Predicate predicate) {
- // Implemented as an explicit loop since std::count_if() in libCstd on
- // Solaris has a non-standard signature.
- int count = 0;
- for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) {
- if (predicate(*it))
- ++count;
- }
- return count;
-}
-
-// Applies a function/functor to each element in the container.
-template <class Container, typename Functor>
-void ForEach(const Container& c, Functor functor) {
- std::for_each(c.begin(), c.end(), functor);
-}
-
-// Returns the i-th element of the vector, or default_value if i is not
-// in range [0, v.size()).
-template <typename E>
-inline E GetElementOr(const std::vector<E>& v, int i, E default_value) {
- return (i < 0 || i >= static_cast<int>(v.size())) ? default_value : v[i];
-}
-
-// Performs an in-place shuffle of a range of the vector's elements.
-// 'begin' and 'end' are element indices as an STL-style range;
-// i.e. [begin, end) are shuffled, where 'end' == size() means to
-// shuffle to the end of the vector.
-template <typename E>
-void ShuffleRange(internal::Random* random, int begin, int end,
- std::vector<E>* v) {
- const int size = static_cast<int>(v->size());
- GTEST_CHECK_(0 <= begin && begin <= size)
- << "Invalid shuffle range start " << begin << ": must be in range [0, "
- << size << "].";
- GTEST_CHECK_(begin <= end && end <= size)
- << "Invalid shuffle range finish " << end << ": must be in range ["
- << begin << ", " << size << "].";
-
- // Fisher-Yates shuffle, from
- // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
- for (int range_width = end - begin; range_width >= 2; range_width--) {
- const int last_in_range = begin + range_width - 1;
- const int selected = begin + random->Generate(range_width);
- std::swap((*v)[selected], (*v)[last_in_range]);
- }
-}
-
-// Performs an in-place shuffle of the vector's elements.
-template <typename E>
-inline void Shuffle(internal::Random* random, std::vector<E>* v) {
- ShuffleRange(random, 0, static_cast<int>(v->size()), v);
-}
-
-// A function for deleting an object. Handy for being used as a
-// functor.
-template <typename T>
-static void Delete(T* x) {
- delete x;
-}
-
-// A predicate that checks the key of a TestProperty against a known key.
-//
-// TestPropertyKeyIs is copyable.
-class TestPropertyKeyIs {
- public:
- // Constructor.
- //
- // TestPropertyKeyIs has NO default constructor.
- explicit TestPropertyKeyIs(const std::string& key) : key_(key) {}
-
- // Returns true iff the test name of test property matches on key_.
- bool operator()(const TestProperty& test_property) const {
- return test_property.key() == key_;
- }
-
- private:
- std::string key_;
-};
-
-// Class UnitTestOptions.
-//
-// This class contains functions for processing options the user
-// specifies when running the tests. It has only static members.
-//
-// In most cases, the user can specify an option using either an
-// environment variable or a command line flag. E.g. you can set the
-// test filter using either GTEST_FILTER or --gtest_filter. If both
-// the variable and the flag are present, the latter overrides the
-// former.
-class GTEST_API_ UnitTestOptions {
- public:
- // Functions for processing the gtest_output flag.
-
- // Returns the output format, or "" for normal printed output.
- static std::string GetOutputFormat();
-
- // Returns the absolute path of the requested output file, or the
- // default (test_detail.xml in the original working directory) if
- // none was explicitly specified.
- static std::string GetAbsolutePathToOutputFile();
-
- // Functions for processing the gtest_filter flag.
-
- // Returns true iff the wildcard pattern matches the string. The
- // first ':' or '\0' character in pattern marks the end of it.
- //
- // This recursive algorithm isn't very efficient, but is clear and
- // works well enough for matching test names, which are short.
- static bool PatternMatchesString(const char *pattern, const char *str);
-
- // Returns true iff the user-specified filter matches the test case
- // name and the test name.
- static bool FilterMatchesTest(const std::string &test_case_name,
- const std::string &test_name);
-
-#if GTEST_OS_WINDOWS
- // Function for supporting the gtest_catch_exception flag.
-
- // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
- // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
- // This function is useful as an __except condition.
- static int GTestShouldProcessSEH(DWORD exception_code);
-#endif // GTEST_OS_WINDOWS
-
- // Returns true if "name" matches the ':' separated list of glob-style
- // filters in "filter".
- static bool MatchesFilter(const std::string& name, const char* filter);
-};
-
-// Returns the current application's name, removing directory path if that
-// is present. Used by UnitTestOptions::GetOutputFile.
-GTEST_API_ FilePath GetCurrentExecutableName();
-
-// The role interface for getting the OS stack trace as a string.
-class OsStackTraceGetterInterface {
- public:
- OsStackTraceGetterInterface() {}
- virtual ~OsStackTraceGetterInterface() {}
-
- // Returns the current OS stack trace as an std::string. Parameters:
- //
- // max_depth - the maximum number of stack frames to be included
- // in the trace.
- // skip_count - the number of top frames to be skipped; doesn't count
- // against max_depth.
- virtual string CurrentStackTrace(int max_depth, int skip_count) = 0;
-
- // UponLeavingGTest() should be called immediately before Google Test calls
- // user code. It saves some information about the current stack that
- // CurrentStackTrace() will use to find and hide Google Test stack frames.
- virtual void UponLeavingGTest() = 0;
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface);
-};
-
-// A working implementation of the OsStackTraceGetterInterface interface.
-class OsStackTraceGetter : public OsStackTraceGetterInterface {
- public:
- OsStackTraceGetter() : caller_frame_(NULL) {}
-
- virtual string CurrentStackTrace(int max_depth, int skip_count)
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- virtual void UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_);
-
- // This string is inserted in place of stack frames that are part of
- // Google Test's implementation.
- static const char* const kElidedFramesMarker;
-
- private:
- Mutex mutex_; // protects all internal state
-
- // We save the stack frame below the frame that calls user code.
- // We do this because the address of the frame immediately below
- // the user code changes between the call to UponLeavingGTest()
- // and any calls to CurrentStackTrace() from within the user code.
- void* caller_frame_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter);
-};
-
-// Information about a Google Test trace point.
-struct TraceInfo {
- const char* file;
- int line;
- std::string message;
-};
-
-// This is the default global test part result reporter used in UnitTestImpl.
-// This class should only be used by UnitTestImpl.
-class DefaultGlobalTestPartResultReporter
- : public TestPartResultReporterInterface {
- public:
- explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test);
- // Implements the TestPartResultReporterInterface. Reports the test part
- // result in the current test.
- virtual void ReportTestPartResult(const TestPartResult& result);
-
- private:
- UnitTestImpl* const unit_test_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter);
-};
-
-// This is the default per thread test part result reporter used in
-// UnitTestImpl. This class should only be used by UnitTestImpl.
-class DefaultPerThreadTestPartResultReporter
- : public TestPartResultReporterInterface {
- public:
- explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test);
- // Implements the TestPartResultReporterInterface. The implementation just
- // delegates to the current global test part result reporter of *unit_test_.
- virtual void ReportTestPartResult(const TestPartResult& result);
-
- private:
- UnitTestImpl* const unit_test_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter);
-};
-
-// The private implementation of the UnitTest class. We don't protect
-// the methods under a mutex, as this class is not accessible by a
-// user and the UnitTest class that delegates work to this class does
-// proper locking.
-class GTEST_API_ UnitTestImpl {
- public:
- explicit UnitTestImpl(UnitTest* parent);
- virtual ~UnitTestImpl();
-
- // There are two different ways to register your own TestPartResultReporter.
- // You can register your own repoter to listen either only for test results
- // from the current thread or for results from all threads.
- // By default, each per-thread test result repoter just passes a new
- // TestPartResult to the global test result reporter, which registers the
- // test part result for the currently running test.
-
- // Returns the global test part result reporter.
- TestPartResultReporterInterface* GetGlobalTestPartResultReporter();
-
- // Sets the global test part result reporter.
- void SetGlobalTestPartResultReporter(
- TestPartResultReporterInterface* reporter);
-
- // Returns the test part result reporter for the current thread.
- TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread();
-
- // Sets the test part result reporter for the current thread.
- void SetTestPartResultReporterForCurrentThread(
- TestPartResultReporterInterface* reporter);
-
- // Gets the number of successful test cases.
- int successful_test_case_count() const;
-
- // Gets the number of failed test cases.
- int failed_test_case_count() const;
-
- // Gets the number of all test cases.
- int total_test_case_count() const;
-
- // Gets the number of all test cases that contain at least one test
- // that should run.
- int test_case_to_run_count() const;
-
- // Gets the number of successful tests.
- int successful_test_count() const;
-
- // Gets the number of failed tests.
- int failed_test_count() const;
-
- // Gets the number of disabled tests that will be reported in the XML report.
- int reportable_disabled_test_count() const;
-
- // Gets the number of disabled tests.
- int disabled_test_count() const;
-
- // Gets the number of tests to be printed in the XML report.
- int reportable_test_count() const;
-
- // Gets the number of all tests.
- int total_test_count() const;
-
- // Gets the number of tests that should run.
- int test_to_run_count() const;
-
- // Gets the time of the test program start, in ms from the start of the
- // UNIX epoch.
- TimeInMillis start_timestamp() const { return start_timestamp_; }
-
- // Gets the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const { return elapsed_time_; }
-
- // Returns true iff the unit test passed (i.e. all test cases passed).
- bool Passed() const { return !Failed(); }
-
- // Returns true iff the unit test failed (i.e. some test case failed
- // or something outside of all tests failed).
- bool Failed() const {
- return failed_test_case_count() > 0 || ad_hoc_test_result()->Failed();
- }
-
- // Gets the i-th test case among all the test cases. i can range from 0 to
- // total_test_case_count() - 1. If i is not in that range, returns NULL.
- const TestCase* GetTestCase(int i) const {
- const int index = GetElementOr(test_case_indices_, i, -1);
- return index < 0 ? NULL : test_cases_[i];
- }
-
- // Gets the i-th test case among all the test cases. i can range from 0 to
- // total_test_case_count() - 1. If i is not in that range, returns NULL.
- TestCase* GetMutableTestCase(int i) {
- const int index = GetElementOr(test_case_indices_, i, -1);
- return index < 0 ? NULL : test_cases_[index];
- }
-
- // Provides access to the event listener list.
- TestEventListeners* listeners() { return &listeners_; }
-
- // Returns the TestResult for the test that's currently running, or
- // the TestResult for the ad hoc test if no test is running.
- TestResult* current_test_result();
-
- // Returns the TestResult for the ad hoc test.
- const TestResult* ad_hoc_test_result() const { return &ad_hoc_test_result_; }
-
- // Sets the OS stack trace getter.
- //
- // Does nothing if the input and the current OS stack trace getter
- // are the same; otherwise, deletes the old getter and makes the
- // input the current getter.
- void set_os_stack_trace_getter(OsStackTraceGetterInterface* getter);
-
- // Returns the current OS stack trace getter if it is not NULL;
- // otherwise, creates an OsStackTraceGetter, makes it the current
- // getter, and returns it.
- OsStackTraceGetterInterface* os_stack_trace_getter();
-
- // Returns the current OS stack trace as an std::string.
- //
- // The maximum number of stack frames to be included is specified by
- // the gtest_stack_trace_depth flag. The skip_count parameter
- // specifies the number of top frames to be skipped, which doesn't
- // count against the number of frames to be included.
- //
- // For example, if Foo() calls Bar(), which in turn calls
- // CurrentOsStackTraceExceptTop(1), Foo() will be included in the
- // trace but Bar() and CurrentOsStackTraceExceptTop() won't.
- std::string CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_;
-
- // Finds and returns a TestCase with the given name. If one doesn't
- // exist, creates one and returns it.
- //
- // Arguments:
- //
- // test_case_name: name of the test case
- // type_param: the name of the test's type parameter, or NULL if
- // this is not a typed or a type-parameterized test.
- // set_up_tc: pointer to the function that sets up the test case
- // tear_down_tc: pointer to the function that tears down the test case
- TestCase* GetTestCase(const char* test_case_name,
- const char* type_param,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc);
-
- // Adds a TestInfo to the unit test.
- //
- // Arguments:
- //
- // set_up_tc: pointer to the function that sets up the test case
- // tear_down_tc: pointer to the function that tears down the test case
- // test_info: the TestInfo object
- void AddTestInfo(Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc,
- TestInfo* test_info) {
- // In order to support thread-safe death tests, we need to
- // remember the original working directory when the test program
- // was first invoked. We cannot do this in RUN_ALL_TESTS(), as
- // the user may have changed the current directory before calling
- // RUN_ALL_TESTS(). Therefore we capture the current directory in
- // AddTestInfo(), which is called to register a TEST or TEST_F
- // before main() is reached.
- if (original_working_dir_.IsEmpty()) {
- original_working_dir_.Set(FilePath::GetCurrentDir());
- GTEST_CHECK_(!original_working_dir_.IsEmpty())
- << "Failed to get the current working directory.";
- }
-
- GetTestCase(test_info->test_case_name(),
- test_info->type_param(),
- set_up_tc,
- tear_down_tc)->AddTestInfo(test_info);
- }
-
-#if GTEST_HAS_PARAM_TEST
- // Returns ParameterizedTestCaseRegistry object used to keep track of
- // value-parameterized tests and instantiate and register them.
- internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {
- return parameterized_test_registry_;
- }
-#endif // GTEST_HAS_PARAM_TEST
-
- // Sets the TestCase object for the test that's currently running.
- void set_current_test_case(TestCase* a_current_test_case) {
- current_test_case_ = a_current_test_case;
- }
-
- // Sets the TestInfo object for the test that's currently running. If
- // current_test_info is NULL, the assertion results will be stored in
- // ad_hoc_test_result_.
- void set_current_test_info(TestInfo* a_current_test_info) {
- current_test_info_ = a_current_test_info;
- }
-
- // Registers all parameterized tests defined using TEST_P and
- // INSTANTIATE_TEST_CASE_P, creating regular tests for each test/parameter
- // combination. This method can be called more then once; it has guards
- // protecting from registering the tests more then once. If
- // value-parameterized tests are disabled, RegisterParameterizedTests is
- // present but does nothing.
- void RegisterParameterizedTests();
-
- // Runs all tests in this UnitTest object, prints the result, and
- // returns true if all tests are successful. If any exception is
- // thrown during a test, this test is considered to be failed, but
- // the rest of the tests will still be run.
- bool RunAllTests();
-
- // Clears the results of all tests, except the ad hoc tests.
- void ClearNonAdHocTestResult() {
- ForEach(test_cases_, TestCase::ClearTestCaseResult);
- }
-
- // Clears the results of ad-hoc test assertions.
- void ClearAdHocTestResult() {
- ad_hoc_test_result_.Clear();
- }
-
- // Adds a TestProperty to the current TestResult object when invoked in a
- // context of a test or a test case, or to the global property set. If the
- // result already contains a property with the same key, the value will be
- // updated.
- void RecordProperty(const TestProperty& test_property);
-
- enum ReactionToSharding {
- HONOR_SHARDING_PROTOCOL,
- IGNORE_SHARDING_PROTOCOL
- };
-
- // Matches the full name of each test against the user-specified
- // filter to decide whether the test should run, then records the
- // result in each TestCase and TestInfo object.
- // If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests
- // based on sharding variables in the environment.
- // Returns the number of tests that should run.
- int FilterTests(ReactionToSharding shard_tests);
-
- // Prints the names of the tests matching the user-specified filter flag.
- void ListTestsMatchingFilter();
-
- const TestCase* current_test_case() const { return current_test_case_; }
- TestInfo* current_test_info() { return current_test_info_; }
- const TestInfo* current_test_info() const { return current_test_info_; }
-
- // Returns the vector of environments that need to be set-up/torn-down
- // before/after the tests are run.
- std::vector<Environment*>& environments() { return environments_; }
-
- // Getters for the per-thread Google Test trace stack.
- std::vector<TraceInfo>& gtest_trace_stack() {
- return *(gtest_trace_stack_.pointer());
- }
- const std::vector<TraceInfo>& gtest_trace_stack() const {
- return gtest_trace_stack_.get();
- }
-
-#if GTEST_HAS_DEATH_TEST
- void InitDeathTestSubprocessControlInfo() {
- internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag());
- }
- // Returns a pointer to the parsed --gtest_internal_run_death_test
- // flag, or NULL if that flag was not specified.
- // This information is useful only in a death test child process.
- // Must not be called before a call to InitGoogleTest.
- const InternalRunDeathTestFlag* internal_run_death_test_flag() const {
- return internal_run_death_test_flag_.get();
- }
-
- // Returns a pointer to the current death test factory.
- internal::DeathTestFactory* death_test_factory() {
- return death_test_factory_.get();
- }
-
- void SuppressTestEventsIfInSubprocess();
-
- friend class ReplaceDeathTestFactory;
-#endif // GTEST_HAS_DEATH_TEST
-
- // Initializes the event listener performing XML output as specified by
- // UnitTestOptions. Must not be called before InitGoogleTest.
- void ConfigureXmlOutput();
-
-#if GTEST_CAN_STREAM_RESULTS_
- // Initializes the event listener for streaming test results to a socket.
- // Must not be called before InitGoogleTest.
- void ConfigureStreamingOutput();
-#endif
-
- // Performs initialization dependent upon flag values obtained in
- // ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to
- // ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest
- // this function is also called from RunAllTests. Since this function can be
- // called more than once, it has to be idempotent.
- void PostFlagParsingInit();
-
- // Gets the random seed used at the start of the current test iteration.
- int random_seed() const { return random_seed_; }
-
- // Gets the random number generator.
- internal::Random* random() { return &random_; }
-
- // Shuffles all test cases, and the tests within each test case,
- // making sure that death tests are still run first.
- void ShuffleTests();
-
- // Restores the test cases and tests to their order before the first shuffle.
- void UnshuffleTests();
-
- // Returns the value of GTEST_FLAG(catch_exceptions) at the moment
- // UnitTest::Run() starts.
- bool catch_exceptions() const { return catch_exceptions_; }
-
- private:
- friend class ::testing::UnitTest;
-
- // Used by UnitTest::Run() to capture the state of
- // GTEST_FLAG(catch_exceptions) at the moment it starts.
- void set_catch_exceptions(bool value) { catch_exceptions_ = value; }
-
- // The UnitTest object that owns this implementation object.
- UnitTest* const parent_;
-
- // The working directory when the first TEST() or TEST_F() was
- // executed.
- internal::FilePath original_working_dir_;
-
- // The default test part result reporters.
- DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_;
- DefaultPerThreadTestPartResultReporter
- default_per_thread_test_part_result_reporter_;
-
- // Points to (but doesn't own) the global test part result reporter.
- TestPartResultReporterInterface* global_test_part_result_repoter_;
-
- // Protects read and write access to global_test_part_result_reporter_.
- internal::Mutex global_test_part_result_reporter_mutex_;
-
- // Points to (but doesn't own) the per-thread test part result reporter.
- internal::ThreadLocal<TestPartResultReporterInterface*>
- per_thread_test_part_result_reporter_;
-
- // The vector of environments that need to be set-up/torn-down
- // before/after the tests are run.
- std::vector<Environment*> environments_;
-
- // The vector of TestCases in their original order. It owns the
- // elements in the vector.
- std::vector<TestCase*> test_cases_;
-
- // Provides a level of indirection for the test case list to allow
- // easy shuffling and restoring the test case order. The i-th
- // element of this vector is the index of the i-th test case in the
- // shuffled order.
- std::vector<int> test_case_indices_;
-
-#if GTEST_HAS_PARAM_TEST
- // ParameterizedTestRegistry object used to register value-parameterized
- // tests.
- internal::ParameterizedTestCaseRegistry parameterized_test_registry_;
-
- // Indicates whether RegisterParameterizedTests() has been called already.
- bool parameterized_tests_registered_;
-#endif // GTEST_HAS_PARAM_TEST
-
- // Index of the last death test case registered. Initially -1.
- int last_death_test_case_;
-
- // This points to the TestCase for the currently running test. It
- // changes as Google Test goes through one test case after another.
- // When no test is running, this is set to NULL and Google Test
- // stores assertion results in ad_hoc_test_result_. Initially NULL.
- TestCase* current_test_case_;
-
- // This points to the TestInfo for the currently running test. It
- // changes as Google Test goes through one test after another. When
- // no test is running, this is set to NULL and Google Test stores
- // assertion results in ad_hoc_test_result_. Initially NULL.
- TestInfo* current_test_info_;
-
- // Normally, a user only writes assertions inside a TEST or TEST_F,
- // or inside a function called by a TEST or TEST_F. Since Google
- // Test keeps track of which test is current running, it can
- // associate such an assertion with the test it belongs to.
- //
- // If an assertion is encountered when no TEST or TEST_F is running,
- // Google Test attributes the assertion result to an imaginary "ad hoc"
- // test, and records the result in ad_hoc_test_result_.
- TestResult ad_hoc_test_result_;
-
- // The list of event listeners that can be used to track events inside
- // Google Test.
- TestEventListeners listeners_;
-
- // The OS stack trace getter. Will be deleted when the UnitTest
- // object is destructed. By default, an OsStackTraceGetter is used,
- // but the user can set this field to use a custom getter if that is
- // desired.
- OsStackTraceGetterInterface* os_stack_trace_getter_;
-
- // True iff PostFlagParsingInit() has been called.
- bool post_flag_parse_init_performed_;
-
- // The random number seed used at the beginning of the test run.
- int random_seed_;
-
- // Our random number generator.
- internal::Random random_;
-
- // The time of the test program start, in ms from the start of the
- // UNIX epoch.
- TimeInMillis start_timestamp_;
-
- // How long the test took to run, in milliseconds.
- TimeInMillis elapsed_time_;
-
-#if GTEST_HAS_DEATH_TEST
- // The decomposed components of the gtest_internal_run_death_test flag,
- // parsed when RUN_ALL_TESTS is called.
- internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
- internal::scoped_ptr<internal::DeathTestFactory> death_test_factory_;
-#endif // GTEST_HAS_DEATH_TEST
-
- // A per-thread stack of traces created by the SCOPED_TRACE() macro.
- internal::ThreadLocal<std::vector<TraceInfo> > gtest_trace_stack_;
-
- // The value of GTEST_FLAG(catch_exceptions) at the moment RunAllTests()
- // starts.
- bool catch_exceptions_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl);
-}; // class UnitTestImpl
-
-// Convenience function for accessing the global UnitTest
-// implementation object.
-inline UnitTestImpl* GetUnitTestImpl() {
- return UnitTest::GetInstance()->impl();
-}
-
-#if GTEST_USES_SIMPLE_RE
-
-// Internal helper functions for implementing the simple regular
-// expression matcher.
-GTEST_API_ bool IsInSet(char ch, const char* str);
-GTEST_API_ bool IsAsciiDigit(char ch);
-GTEST_API_ bool IsAsciiPunct(char ch);
-GTEST_API_ bool IsRepeat(char ch);
-GTEST_API_ bool IsAsciiWhiteSpace(char ch);
-GTEST_API_ bool IsAsciiWordChar(char ch);
-GTEST_API_ bool IsValidEscape(char ch);
-GTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch);
-GTEST_API_ bool ValidateRegex(const char* regex);
-GTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str);
-GTEST_API_ bool MatchRepetitionAndRegexAtHead(
- bool escaped, char ch, char repeat, const char* regex, const char* str);
-GTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str);
-
-#endif // GTEST_USES_SIMPLE_RE
-
-// Parses the command line for Google Test flags, without initializing
-// other parts of Google Test.
-GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, char** argv);
-GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
-
-#if GTEST_HAS_DEATH_TEST
-
-// Returns the message describing the last system error, regardless of the
-// platform.
-GTEST_API_ std::string GetLastErrnoDescription();
-
-// Attempts to parse a string into a positive integer pointed to by the
-// number parameter. Returns true if that is possible.
-// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use
-// it here.
-template <typename Integer>
-bool ParseNaturalNumber(const ::std::string& str, Integer* number) {
- // Fail fast if the given string does not begin with a digit;
- // this bypasses strtoXXX's "optional leading whitespace and plus
- // or minus sign" semantics, which are undesirable here.
- if (str.empty() || !IsDigit(str[0])) {
- return false;
- }
- errno = 0;
-
- char* end;
- // BiggestConvertible is the largest integer type that system-provided
- // string-to-number conversion routines can return.
-
-# if GTEST_OS_WINDOWS && !defined(__GNUC__)
-
- // MSVC and C++ Builder define __int64 instead of the standard long long.
- typedef unsigned __int64 BiggestConvertible;
- const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10);
-
-# else
-
- typedef unsigned long long BiggestConvertible; // NOLINT
- const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10);
-
-# endif // GTEST_OS_WINDOWS && !defined(__GNUC__)
-
- const bool parse_success = *end == '\0' && errno == 0;
-
- // TODO(vladl@google.com): Convert this to compile time assertion when it is
- // available.
- GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed));
-
- const Integer result = static_cast<Integer>(parsed);
- if (parse_success && static_cast<BiggestConvertible>(result) == parsed) {
- *number = result;
- return true;
- }
- return false;
-}
-#endif // GTEST_HAS_DEATH_TEST
-
-// TestResult contains some private methods that should be hidden from
-// Google Test user but are required for testing. This class allow our tests
-// to access them.
-//
-// This class is supplied only for the purpose of testing Google Test's own
-// constructs. Do not use it in user tests, either directly or indirectly.
-class TestResultAccessor {
- public:
- static void RecordProperty(TestResult* test_result,
- const std::string& xml_element,
- const TestProperty& property) {
- test_result->RecordProperty(xml_element, property);
- }
-
- static void ClearTestPartResults(TestResult* test_result) {
- test_result->ClearTestPartResults();
- }
-
- static const std::vector<testing::TestPartResult>& test_part_results(
- const TestResult& test_result) {
- return test_result.test_part_results();
- }
-};
-
-#if GTEST_CAN_STREAM_RESULTS_
-
-// Streams test results to the given port on the given host machine.
-class StreamingListener : public EmptyTestEventListener {
- public:
- // Abstract base class for writing strings to a socket.
- class AbstractSocketWriter {
- public:
- virtual ~AbstractSocketWriter() {}
-
- // Sends a string to the socket.
- virtual void Send(const string& message) = 0;
-
- // Closes the socket.
- virtual void CloseConnection() {}
-
- // Sends a string and a newline to the socket.
- void SendLn(const string& message) {
- Send(message + "\n");
- }
- };
-
- // Concrete class for actually writing strings to a socket.
- class SocketWriter : public AbstractSocketWriter {
- public:
- SocketWriter(const string& host, const string& port)
- : sockfd_(-1), host_name_(host), port_num_(port) {
- MakeConnection();
- }
-
- virtual ~SocketWriter() {
- if (sockfd_ != -1)
- CloseConnection();
- }
-
- // Sends a string to the socket.
- virtual void Send(const string& message) {
- GTEST_CHECK_(sockfd_ != -1)
- << "Send() can be called only when there is a connection.";
-
- const int len = static_cast<int>(message.length());
- if (write(sockfd_, message.c_str(), len) != len) {
- GTEST_LOG_(WARNING)
- << "stream_result_to: failed to stream to "
- << host_name_ << ":" << port_num_;
- }
- }
-
- private:
- // Creates a client socket and connects to the server.
- void MakeConnection();
-
- // Closes the socket.
- void CloseConnection() {
- GTEST_CHECK_(sockfd_ != -1)
- << "CloseConnection() can be called only when there is a connection.";
-
- close(sockfd_);
- sockfd_ = -1;
- }
-
- int sockfd_; // socket file descriptor
- const string host_name_;
- const string port_num_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter);
- }; // class SocketWriter
-
- // Escapes '=', '&', '%', and '\n' characters in str as "%xx".
- static string UrlEncode(const char* str);
-
- StreamingListener(const string& host, const string& port)
- : socket_writer_(new SocketWriter(host, port)) { Start(); }
-
- explicit StreamingListener(AbstractSocketWriter* socket_writer)
- : socket_writer_(socket_writer) { Start(); }
-
- void OnTestProgramStart(const UnitTest& /* unit_test */) {
- SendLn("event=TestProgramStart");
- }
-
- void OnTestProgramEnd(const UnitTest& unit_test) {
- // Note that Google Test current only report elapsed time for each
- // test iteration, not for the entire test program.
- SendLn("event=TestProgramEnd&passed=" + FormatBool(unit_test.Passed()));
-
- // Notify the streaming server to stop.
- socket_writer_->CloseConnection();
- }
-
- void OnTestIterationStart(const UnitTest& /* unit_test */, int iteration) {
- SendLn("event=TestIterationStart&iteration=" +
- StreamableToString(iteration));
- }
-
- void OnTestIterationEnd(const UnitTest& unit_test, int /* iteration */) {
- SendLn("event=TestIterationEnd&passed=" +
- FormatBool(unit_test.Passed()) + "&elapsed_time=" +
- StreamableToString(unit_test.elapsed_time()) + "ms");
- }
-
- void OnTestCaseStart(const TestCase& test_case) {
- SendLn(std::string("event=TestCaseStart&name=") + test_case.name());
- }
-
- void OnTestCaseEnd(const TestCase& test_case) {
- SendLn("event=TestCaseEnd&passed=" + FormatBool(test_case.Passed())
- + "&elapsed_time=" + StreamableToString(test_case.elapsed_time())
- + "ms");
- }
-
- void OnTestStart(const TestInfo& test_info) {
- SendLn(std::string("event=TestStart&name=") + test_info.name());
- }
-
- void OnTestEnd(const TestInfo& test_info) {
- SendLn("event=TestEnd&passed=" +
- FormatBool((test_info.result())->Passed()) +
- "&elapsed_time=" +
- StreamableToString((test_info.result())->elapsed_time()) + "ms");
- }
-
- void OnTestPartResult(const TestPartResult& test_part_result) {
- const char* file_name = test_part_result.file_name();
- if (file_name == NULL)
- file_name = "";
- SendLn("event=TestPartResult&file=" + UrlEncode(file_name) +
- "&line=" + StreamableToString(test_part_result.line_number()) +
- "&message=" + UrlEncode(test_part_result.message()));
- }
-
- private:
- // Sends the given message and a newline to the socket.
- void SendLn(const string& message) { socket_writer_->SendLn(message); }
-
- // Called at the start of streaming to notify the receiver what
- // protocol we are using.
- void Start() { SendLn("gtest_streaming_protocol_version=1.0"); }
-
- string FormatBool(bool value) { return value ? "1" : "0"; }
-
- const scoped_ptr<AbstractSocketWriter> socket_writer_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamingListener);
-}; // class StreamingListener
-
-#endif // GTEST_CAN_STREAM_RESULTS_
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_SRC_GTEST_INTERNAL_INL_H_
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-port.cc b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-port.cc
deleted file mode 100644
index 39e70bb..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-port.cc
+++ /dev/null
@@ -1,1184 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#include "gtest/internal/gtest-port.h"
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#if GTEST_OS_WINDOWS
-# include <windows.h>
-# include <io.h>
-# include <sys/stat.h>
-# include <map> // Used in ThreadLocal.
-#else
-# include <unistd.h>
-#endif // GTEST_OS_WINDOWS
-
-#if GTEST_OS_MAC
-# include <mach/mach_init.h>
-# include <mach/task.h>
-# include <mach/vm_map.h>
-#endif // GTEST_OS_MAC
-
-#if GTEST_OS_QNX
-# include <devctl.h>
-# include <fcntl.h>
-# include <sys/procfs.h>
-#endif // GTEST_OS_QNX
-
-#include "gtest/gtest-spi.h"
-#include "gtest/gtest-message.h"
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-string.h"
-
-// Indicates that this translation unit is part of Google Test's
-// implementation. It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error. This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION_
-
-namespace testing {
-namespace internal {
-
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
-const int kStdOutFileno = 1;
-const int kStdErrFileno = 2;
-#else
-const int kStdOutFileno = STDOUT_FILENO;
-const int kStdErrFileno = STDERR_FILENO;
-#endif // _MSC_VER
-
-#if GTEST_OS_MAC
-
-// Returns the number of threads running in the process, or 0 to indicate that
-// we cannot detect it.
-size_t GetThreadCount() {
- const task_t task = mach_task_self();
- mach_msg_type_number_t thread_count;
- thread_act_array_t thread_list;
- const kern_return_t status = task_threads(task, &thread_list, &thread_count);
- if (status == KERN_SUCCESS) {
- // task_threads allocates resources in thread_list and we need to free them
- // to avoid leaks.
- vm_deallocate(task,
- reinterpret_cast<vm_address_t>(thread_list),
- sizeof(thread_t) * thread_count);
- return static_cast<size_t>(thread_count);
- } else {
- return 0;
- }
-}
-
-#elif GTEST_OS_QNX
-
-// Returns the number of threads running in the process, or 0 to indicate that
-// we cannot detect it.
-size_t GetThreadCount() {
- const int fd = open("/proc/self/as", O_RDONLY);
- if (fd < 0) {
- return 0;
- }
- procfs_info process_info;
- const int status =
- devctl(fd, DCMD_PROC_INFO, &process_info, sizeof(process_info), NULL);
- close(fd);
- if (status == EOK) {
- return static_cast<size_t>(process_info.num_threads);
- } else {
- return 0;
- }
-}
-
-#else
-
-size_t GetThreadCount() {
- // There's no portable way to detect the number of threads, so we just
- // return 0 to indicate that we cannot detect it.
- return 0;
-}
-
-#endif // GTEST_OS_MAC
-
-#if GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS
-
-void SleepMilliseconds(int n) {
- ::Sleep(n);
-}
-
-AutoHandle::AutoHandle()
- : handle_(INVALID_HANDLE_VALUE) {}
-
-AutoHandle::AutoHandle(Handle handle)
- : handle_(handle) {}
-
-AutoHandle::~AutoHandle() {
- Reset();
-}
-
-AutoHandle::Handle AutoHandle::Get() const {
- return handle_;
-}
-
-void AutoHandle::Reset() {
- Reset(INVALID_HANDLE_VALUE);
-}
-
-void AutoHandle::Reset(HANDLE handle) {
- // Resetting with the same handle we already own is invalid.
- if (handle_ != handle) {
- if (IsCloseable()) {
- ::CloseHandle(handle_);
- }
- handle_ = handle;
- } else {
- GTEST_CHECK_(!IsCloseable())
- << "Resetting a valid handle to itself is likely a programmer error "
- "and thus not allowed.";
- }
-}
-
-bool AutoHandle::IsCloseable() const {
- // Different Windows APIs may use either of these values to represent an
- // invalid handle.
- return handle_ != NULL && handle_ != INVALID_HANDLE_VALUE;
-}
-
-Notification::Notification()
- : event_(::CreateEvent(NULL, // Default security attributes.
- TRUE, // Do not reset automatically.
- FALSE, // Initially unset.
- NULL)) { // Anonymous event.
- GTEST_CHECK_(event_.Get() != NULL);
-}
-
-void Notification::Notify() {
- GTEST_CHECK_(::SetEvent(event_.Get()) != FALSE);
-}
-
-void Notification::WaitForNotification() {
- GTEST_CHECK_(
- ::WaitForSingleObject(event_.Get(), INFINITE) == WAIT_OBJECT_0);
-}
-
-Mutex::Mutex()
- : type_(kDynamic),
- owner_thread_id_(0),
- critical_section_init_phase_(0),
- critical_section_(new CRITICAL_SECTION) {
- ::InitializeCriticalSection(critical_section_);
-}
-
-Mutex::~Mutex() {
- // Static mutexes are leaked intentionally. It is not thread-safe to try
- // to clean them up.
- // TODO(yukawa): Switch to Slim Reader/Writer (SRW) Locks, which requires
- // nothing to clean it up but is available only on Vista and later.
- // http://msdn.microsoft.com/en-us/library/windows/desktop/aa904937.aspx
- if (type_ == kDynamic) {
- ::DeleteCriticalSection(critical_section_);
- delete critical_section_;
- critical_section_ = NULL;
- }
-}
-
-void Mutex::Lock() {
- ThreadSafeLazyInit();
- ::EnterCriticalSection(critical_section_);
- owner_thread_id_ = ::GetCurrentThreadId();
-}
-
-void Mutex::Unlock() {
- ThreadSafeLazyInit();
- // We don't protect writing to owner_thread_id_ here, as it's the
- // caller's responsibility to ensure that the current thread holds the
- // mutex when this is called.
- owner_thread_id_ = 0;
- ::LeaveCriticalSection(critical_section_);
-}
-
-// Does nothing if the current thread holds the mutex. Otherwise, crashes
-// with high probability.
-void Mutex::AssertHeld() {
- ThreadSafeLazyInit();
- GTEST_CHECK_(owner_thread_id_ == ::GetCurrentThreadId())
- << "The current thread is not holding the mutex @" << this;
-}
-
-// Initializes owner_thread_id_ and critical_section_ in static mutexes.
-void Mutex::ThreadSafeLazyInit() {
- // Dynamic mutexes are initialized in the constructor.
- if (type_ == kStatic) {
- switch (
- ::InterlockedCompareExchange(&critical_section_init_phase_, 1L, 0L)) {
- case 0:
- // If critical_section_init_phase_ was 0 before the exchange, we
- // are the first to test it and need to perform the initialization.
- owner_thread_id_ = 0;
- critical_section_ = new CRITICAL_SECTION;
- ::InitializeCriticalSection(critical_section_);
- // Updates the critical_section_init_phase_ to 2 to signal
- // initialization complete.
- GTEST_CHECK_(::InterlockedCompareExchange(
- &critical_section_init_phase_, 2L, 1L) ==
- 1L);
- break;
- case 1:
- // Somebody else is already initializing the mutex; spin until they
- // are done.
- while (::InterlockedCompareExchange(&critical_section_init_phase_,
- 2L,
- 2L) != 2L) {
- // Possibly yields the rest of the thread's time slice to other
- // threads.
- ::Sleep(0);
- }
- break;
-
- case 2:
- break; // The mutex is already initialized and ready for use.
-
- default:
- GTEST_CHECK_(false)
- << "Unexpected value of critical_section_init_phase_ "
- << "while initializing a static mutex.";
- }
- }
-}
-
-namespace {
-
-class ThreadWithParamSupport : public ThreadWithParamBase {
- public:
- static HANDLE CreateThread(Runnable* runnable,
- Notification* thread_can_start) {
- ThreadMainParam* param = new ThreadMainParam(runnable, thread_can_start);
- DWORD thread_id;
- // TODO(yukawa): Consider to use _beginthreadex instead.
- HANDLE thread_handle = ::CreateThread(
- NULL, // Default security.
- 0, // Default stack size.
- &ThreadWithParamSupport::ThreadMain,
- param, // Parameter to ThreadMainStatic
- 0x0, // Default creation flags.
- &thread_id); // Need a valid pointer for the call to work under Win98.
- GTEST_CHECK_(thread_handle != NULL) << "CreateThread failed with error "
- << ::GetLastError() << ".";
- if (thread_handle == NULL) {
- delete param;
- }
- return thread_handle;
- }
-
- private:
- struct ThreadMainParam {
- ThreadMainParam(Runnable* runnable, Notification* thread_can_start)
- : runnable_(runnable),
- thread_can_start_(thread_can_start) {
- }
- scoped_ptr<Runnable> runnable_;
- // Does not own.
- Notification* thread_can_start_;
- };
-
- static DWORD WINAPI ThreadMain(void* ptr) {
- // Transfers ownership.
- scoped_ptr<ThreadMainParam> param(static_cast<ThreadMainParam*>(ptr));
- if (param->thread_can_start_ != NULL)
- param->thread_can_start_->WaitForNotification();
- param->runnable_->Run();
- return 0;
- }
-
- // Prohibit instantiation.
- ThreadWithParamSupport();
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParamSupport);
-};
-
-} // namespace
-
-ThreadWithParamBase::ThreadWithParamBase(Runnable *runnable,
- Notification* thread_can_start)
- : thread_(ThreadWithParamSupport::CreateThread(runnable,
- thread_can_start)) {
-}
-
-ThreadWithParamBase::~ThreadWithParamBase() {
- Join();
-}
-
-void ThreadWithParamBase::Join() {
- GTEST_CHECK_(::WaitForSingleObject(thread_.Get(), INFINITE) == WAIT_OBJECT_0)
- << "Failed to join the thread with error " << ::GetLastError() << ".";
-}
-
-// Maps a thread to a set of ThreadIdToThreadLocals that have values
-// instantiated on that thread and notifies them when the thread exits. A
-// ThreadLocal instance is expected to persist until all threads it has
-// values on have terminated.
-class ThreadLocalRegistryImpl {
- public:
- // Registers thread_local_instance as having value on the current thread.
- // Returns a value that can be used to identify the thread from other threads.
- static ThreadLocalValueHolderBase* GetValueOnCurrentThread(
- const ThreadLocalBase* thread_local_instance) {
- DWORD current_thread = ::GetCurrentThreadId();
- MutexLock lock(&mutex_);
- ThreadIdToThreadLocals* const thread_to_thread_locals =
- GetThreadLocalsMapLocked();
- ThreadIdToThreadLocals::iterator thread_local_pos =
- thread_to_thread_locals->find(current_thread);
- if (thread_local_pos == thread_to_thread_locals->end()) {
- thread_local_pos = thread_to_thread_locals->insert(
- std::make_pair(current_thread, ThreadLocalValues())).first;
- StartWatcherThreadFor(current_thread);
- }
- ThreadLocalValues& thread_local_values = thread_local_pos->second;
- ThreadLocalValues::iterator value_pos =
- thread_local_values.find(thread_local_instance);
- if (value_pos == thread_local_values.end()) {
- value_pos =
- thread_local_values
- .insert(std::make_pair(
- thread_local_instance,
- linked_ptr<ThreadLocalValueHolderBase>(
- thread_local_instance->NewValueForCurrentThread())))
- .first;
- }
- return value_pos->second.get();
- }
-
- static void OnThreadLocalDestroyed(
- const ThreadLocalBase* thread_local_instance) {
- std::vector<linked_ptr<ThreadLocalValueHolderBase> > value_holders;
- // Clean up the ThreadLocalValues data structure while holding the lock, but
- // defer the destruction of the ThreadLocalValueHolderBases.
- {
- MutexLock lock(&mutex_);
- ThreadIdToThreadLocals* const thread_to_thread_locals =
- GetThreadLocalsMapLocked();
- for (ThreadIdToThreadLocals::iterator it =
- thread_to_thread_locals->begin();
- it != thread_to_thread_locals->end();
- ++it) {
- ThreadLocalValues& thread_local_values = it->second;
- ThreadLocalValues::iterator value_pos =
- thread_local_values.find(thread_local_instance);
- if (value_pos != thread_local_values.end()) {
- value_holders.push_back(value_pos->second);
- thread_local_values.erase(value_pos);
- // This 'if' can only be successful at most once, so theoretically we
- // could break out of the loop here, but we don't bother doing so.
- }
- }
- }
- // Outside the lock, let the destructor for 'value_holders' deallocate the
- // ThreadLocalValueHolderBases.
- }
-
- static void OnThreadExit(DWORD thread_id) {
- GTEST_CHECK_(thread_id != 0) << ::GetLastError();
- std::vector<linked_ptr<ThreadLocalValueHolderBase> > value_holders;
- // Clean up the ThreadIdToThreadLocals data structure while holding the
- // lock, but defer the destruction of the ThreadLocalValueHolderBases.
- {
- MutexLock lock(&mutex_);
- ThreadIdToThreadLocals* const thread_to_thread_locals =
- GetThreadLocalsMapLocked();
- ThreadIdToThreadLocals::iterator thread_local_pos =
- thread_to_thread_locals->find(thread_id);
- if (thread_local_pos != thread_to_thread_locals->end()) {
- ThreadLocalValues& thread_local_values = thread_local_pos->second;
- for (ThreadLocalValues::iterator value_pos =
- thread_local_values.begin();
- value_pos != thread_local_values.end();
- ++value_pos) {
- value_holders.push_back(value_pos->second);
- }
- thread_to_thread_locals->erase(thread_local_pos);
- }
- }
- // Outside the lock, let the destructor for 'value_holders' deallocate the
- // ThreadLocalValueHolderBases.
- }
-
- private:
- // In a particular thread, maps a ThreadLocal object to its value.
- typedef std::map<const ThreadLocalBase*,
- linked_ptr<ThreadLocalValueHolderBase> > ThreadLocalValues;
- // Stores all ThreadIdToThreadLocals having values in a thread, indexed by
- // thread's ID.
- typedef std::map<DWORD, ThreadLocalValues> ThreadIdToThreadLocals;
-
- // Holds the thread id and thread handle that we pass from
- // StartWatcherThreadFor to WatcherThreadFunc.
- typedef std::pair<DWORD, HANDLE> ThreadIdAndHandle;
-
- static void StartWatcherThreadFor(DWORD thread_id) {
- // The returned handle will be kept in thread_map and closed by
- // watcher_thread in WatcherThreadFunc.
- HANDLE thread = ::OpenThread(SYNCHRONIZE | THREAD_QUERY_INFORMATION,
- FALSE,
- thread_id);
- GTEST_CHECK_(thread != NULL);
- // We need to to pass a valid thread ID pointer into CreateThread for it
- // to work correctly under Win98.
- DWORD watcher_thread_id;
- HANDLE watcher_thread = ::CreateThread(
- NULL, // Default security.
- 0, // Default stack size
- &ThreadLocalRegistryImpl::WatcherThreadFunc,
- reinterpret_cast<LPVOID>(new ThreadIdAndHandle(thread_id, thread)),
- CREATE_SUSPENDED,
- &watcher_thread_id);
- GTEST_CHECK_(watcher_thread != NULL);
- // Give the watcher thread the same priority as ours to avoid being
- // blocked by it.
- ::SetThreadPriority(watcher_thread,
- ::GetThreadPriority(::GetCurrentThread()));
- ::ResumeThread(watcher_thread);
- ::CloseHandle(watcher_thread);
- }
-
- // Monitors exit from a given thread and notifies those
- // ThreadIdToThreadLocals about thread termination.
- static DWORD WINAPI WatcherThreadFunc(LPVOID param) {
- const ThreadIdAndHandle* tah =
- reinterpret_cast<const ThreadIdAndHandle*>(param);
- GTEST_CHECK_(
- ::WaitForSingleObject(tah->second, INFINITE) == WAIT_OBJECT_0);
- OnThreadExit(tah->first);
- ::CloseHandle(tah->second);
- delete tah;
- return 0;
- }
-
- // Returns map of thread local instances.
- static ThreadIdToThreadLocals* GetThreadLocalsMapLocked() {
- mutex_.AssertHeld();
- static ThreadIdToThreadLocals* map = new ThreadIdToThreadLocals;
- return map;
- }
-
- // Protects access to GetThreadLocalsMapLocked() and its return value.
- static Mutex mutex_;
- // Protects access to GetThreadMapLocked() and its return value.
- static Mutex thread_map_mutex_;
-};
-
-Mutex ThreadLocalRegistryImpl::mutex_(Mutex::kStaticMutex);
-Mutex ThreadLocalRegistryImpl::thread_map_mutex_(Mutex::kStaticMutex);
-
-ThreadLocalValueHolderBase* ThreadLocalRegistry::GetValueOnCurrentThread(
- const ThreadLocalBase* thread_local_instance) {
- return ThreadLocalRegistryImpl::GetValueOnCurrentThread(
- thread_local_instance);
-}
-
-void ThreadLocalRegistry::OnThreadLocalDestroyed(
- const ThreadLocalBase* thread_local_instance) {
- ThreadLocalRegistryImpl::OnThreadLocalDestroyed(thread_local_instance);
-}
-
-#endif // GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS
-
-#if GTEST_USES_POSIX_RE
-
-// Implements RE. Currently only needed for death tests.
-
-RE::~RE() {
- if (is_valid_) {
- // regfree'ing an invalid regex might crash because the content
- // of the regex is undefined. Since the regex's are essentially
- // the same, one cannot be valid (or invalid) without the other
- // being so too.
- regfree(&partial_regex_);
- regfree(&full_regex_);
- }
- free(const_cast<char*>(pattern_));
-}
-
-// Returns true iff regular expression re matches the entire str.
-bool RE::FullMatch(const char* str, const RE& re) {
- if (!re.is_valid_) return false;
-
- regmatch_t match;
- return regexec(&re.full_regex_, str, 1, &match, 0) == 0;
-}
-
-// Returns true iff regular expression re matches a substring of str
-// (including str itself).
-bool RE::PartialMatch(const char* str, const RE& re) {
- if (!re.is_valid_) return false;
-
- regmatch_t match;
- return regexec(&re.partial_regex_, str, 1, &match, 0) == 0;
-}
-
-// Initializes an RE from its string representation.
-void RE::Init(const char* regex) {
- pattern_ = posix::StrDup(regex);
-
- // Reserves enough bytes to hold the regular expression used for a
- // full match.
- const size_t full_regex_len = strlen(regex) + 10;
- char* const full_pattern = new char[full_regex_len];
-
- snprintf(full_pattern, full_regex_len, "^(%s)$", regex);
- is_valid_ = regcomp(&full_regex_, full_pattern, REG_EXTENDED) == 0;
- // We want to call regcomp(&partial_regex_, ...) even if the
- // previous expression returns false. Otherwise partial_regex_ may
- // not be properly initialized can may cause trouble when it's
- // freed.
- //
- // Some implementation of POSIX regex (e.g. on at least some
- // versions of Cygwin) doesn't accept the empty string as a valid
- // regex. We change it to an equivalent form "()" to be safe.
- if (is_valid_) {
- const char* const partial_regex = (*regex == '\0') ? "()" : regex;
- is_valid_ = regcomp(&partial_regex_, partial_regex, REG_EXTENDED) == 0;
- }
- EXPECT_TRUE(is_valid_)
- << "Regular expression \"" << regex
- << "\" is not a valid POSIX Extended regular expression.";
-
- delete[] full_pattern;
-}
-
-#elif GTEST_USES_SIMPLE_RE
-
-// Returns true iff ch appears anywhere in str (excluding the
-// terminating '\0' character).
-bool IsInSet(char ch, const char* str) {
- return ch != '\0' && strchr(str, ch) != NULL;
-}
-
-// Returns true iff ch belongs to the given classification. Unlike
-// similar functions in <ctype.h>, these aren't affected by the
-// current locale.
-bool IsAsciiDigit(char ch) { return '0' <= ch && ch <= '9'; }
-bool IsAsciiPunct(char ch) {
- return IsInSet(ch, "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~");
-}
-bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); }
-bool IsAsciiWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); }
-bool IsAsciiWordChar(char ch) {
- return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||
- ('0' <= ch && ch <= '9') || ch == '_';
-}
-
-// Returns true iff "\\c" is a supported escape sequence.
-bool IsValidEscape(char c) {
- return (IsAsciiPunct(c) || IsInSet(c, "dDfnrsStvwW"));
-}
-
-// Returns true iff the given atom (specified by escaped and pattern)
-// matches ch. The result is undefined if the atom is invalid.
-bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
- if (escaped) { // "\\p" where p is pattern_char.
- switch (pattern_char) {
- case 'd': return IsAsciiDigit(ch);
- case 'D': return !IsAsciiDigit(ch);
- case 'f': return ch == '\f';
- case 'n': return ch == '\n';
- case 'r': return ch == '\r';
- case 's': return IsAsciiWhiteSpace(ch);
- case 'S': return !IsAsciiWhiteSpace(ch);
- case 't': return ch == '\t';
- case 'v': return ch == '\v';
- case 'w': return IsAsciiWordChar(ch);
- case 'W': return !IsAsciiWordChar(ch);
- }
- return IsAsciiPunct(pattern_char) && pattern_char == ch;
- }
-
- return (pattern_char == '.' && ch != '\n') || pattern_char == ch;
-}
-
-// Helper function used by ValidateRegex() to format error messages.
-std::string FormatRegexSyntaxError(const char* regex, int index) {
- return (Message() << "Syntax error at index " << index
- << " in simple regular expression \"" << regex << "\": ").GetString();
-}
-
-// Generates non-fatal failures and returns false if regex is invalid;
-// otherwise returns true.
-bool ValidateRegex(const char* regex) {
- if (regex == NULL) {
- // TODO(wan@google.com): fix the source file location in the
- // assertion failures to match where the regex is used in user
- // code.
- ADD_FAILURE() << "NULL is not a valid simple regular expression.";
- return false;
- }
-
- bool is_valid = true;
-
- // True iff ?, *, or + can follow the previous atom.
- bool prev_repeatable = false;
- for (int i = 0; regex[i]; i++) {
- if (regex[i] == '\\') { // An escape sequence
- i++;
- if (regex[i] == '\0') {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
- << "'\\' cannot appear at the end.";
- return false;
- }
-
- if (!IsValidEscape(regex[i])) {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
- << "invalid escape sequence \"\\" << regex[i] << "\".";
- is_valid = false;
- }
- prev_repeatable = true;
- } else { // Not an escape sequence.
- const char ch = regex[i];
-
- if (ch == '^' && i > 0) {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
- << "'^' can only appear at the beginning.";
- is_valid = false;
- } else if (ch == '$' && regex[i + 1] != '\0') {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
- << "'$' can only appear at the end.";
- is_valid = false;
- } else if (IsInSet(ch, "()[]{}|")) {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
- << "'" << ch << "' is unsupported.";
- is_valid = false;
- } else if (IsRepeat(ch) && !prev_repeatable) {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
- << "'" << ch << "' can only follow a repeatable token.";
- is_valid = false;
- }
-
- prev_repeatable = !IsInSet(ch, "^$?*+");
- }
- }
-
- return is_valid;
-}
-
-// Matches a repeated regex atom followed by a valid simple regular
-// expression. The regex atom is defined as c if escaped is false,
-// or \c otherwise. repeat is the repetition meta character (?, *,
-// or +). The behavior is undefined if str contains too many
-// characters to be indexable by size_t, in which case the test will
-// probably time out anyway. We are fine with this limitation as
-// std::string has it too.
-bool MatchRepetitionAndRegexAtHead(
- bool escaped, char c, char repeat, const char* regex,
- const char* str) {
- const size_t min_count = (repeat == '+') ? 1 : 0;
- const size_t max_count = (repeat == '?') ? 1 :
- static_cast<size_t>(-1) - 1;
- // We cannot call numeric_limits::max() as it conflicts with the
- // max() macro on Windows.
-
- for (size_t i = 0; i <= max_count; ++i) {
- // We know that the atom matches each of the first i characters in str.
- if (i >= min_count && MatchRegexAtHead(regex, str + i)) {
- // We have enough matches at the head, and the tail matches too.
- // Since we only care about *whether* the pattern matches str
- // (as opposed to *how* it matches), there is no need to find a
- // greedy match.
- return true;
- }
- if (str[i] == '\0' || !AtomMatchesChar(escaped, c, str[i]))
- return false;
- }
- return false;
-}
-
-// Returns true iff regex matches a prefix of str. regex must be a
-// valid simple regular expression and not start with "^", or the
-// result is undefined.
-bool MatchRegexAtHead(const char* regex, const char* str) {
- if (*regex == '\0') // An empty regex matches a prefix of anything.
- return true;
-
- // "$" only matches the end of a string. Note that regex being
- // valid guarantees that there's nothing after "$" in it.
- if (*regex == '$')
- return *str == '\0';
-
- // Is the first thing in regex an escape sequence?
- const bool escaped = *regex == '\\';
- if (escaped)
- ++regex;
- if (IsRepeat(regex[1])) {
- // MatchRepetitionAndRegexAtHead() calls MatchRegexAtHead(), so
- // here's an indirect recursion. It terminates as the regex gets
- // shorter in each recursion.
- return MatchRepetitionAndRegexAtHead(
- escaped, regex[0], regex[1], regex + 2, str);
- } else {
- // regex isn't empty, isn't "$", and doesn't start with a
- // repetition. We match the first atom of regex with the first
- // character of str and recurse.
- return (*str != '\0') && AtomMatchesChar(escaped, *regex, *str) &&
- MatchRegexAtHead(regex + 1, str + 1);
- }
-}
-
-// Returns true iff regex matches any substring of str. regex must be
-// a valid simple regular expression, or the result is undefined.
-//
-// The algorithm is recursive, but the recursion depth doesn't exceed
-// the regex length, so we won't need to worry about running out of
-// stack space normally. In rare cases the time complexity can be
-// exponential with respect to the regex length + the string length,
-// but usually it's must faster (often close to linear).
-bool MatchRegexAnywhere(const char* regex, const char* str) {
- if (regex == NULL || str == NULL)
- return false;
-
- if (*regex == '^')
- return MatchRegexAtHead(regex + 1, str);
-
- // A successful match can be anywhere in str.
- do {
- if (MatchRegexAtHead(regex, str))
- return true;
- } while (*str++ != '\0');
- return false;
-}
-
-// Implements the RE class.
-
-RE::~RE() {
- free(const_cast<char*>(pattern_));
- free(const_cast<char*>(full_pattern_));
-}
-
-// Returns true iff regular expression re matches the entire str.
-bool RE::FullMatch(const char* str, const RE& re) {
- return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_, str);
-}
-
-// Returns true iff regular expression re matches a substring of str
-// (including str itself).
-bool RE::PartialMatch(const char* str, const RE& re) {
- return re.is_valid_ && MatchRegexAnywhere(re.pattern_, str);
-}
-
-// Initializes an RE from its string representation.
-void RE::Init(const char* regex) {
- pattern_ = full_pattern_ = NULL;
- if (regex != NULL) {
- pattern_ = posix::StrDup(regex);
- }
-
- is_valid_ = ValidateRegex(regex);
- if (!is_valid_) {
- // No need to calculate the full pattern when the regex is invalid.
- return;
- }
-
- const size_t len = strlen(regex);
- // Reserves enough bytes to hold the regular expression used for a
- // full match: we need space to prepend a '^', append a '$', and
- // terminate the string with '\0'.
- char* buffer = static_cast<char*>(malloc(len + 3));
- full_pattern_ = buffer;
-
- if (*regex != '^')
- *buffer++ = '^'; // Makes sure full_pattern_ starts with '^'.
-
- // We don't use snprintf or strncpy, as they trigger a warning when
- // compiled with VC++ 8.0.
- memcpy(buffer, regex, len);
- buffer += len;
-
- if (len == 0 || regex[len - 1] != '$')
- *buffer++ = '$'; // Makes sure full_pattern_ ends with '$'.
-
- *buffer = '\0';
-}
-
-#endif // GTEST_USES_POSIX_RE
-
-const char kUnknownFile[] = "unknown file";
-
-// Formats a source file path and a line number as they would appear
-// in an error message from the compiler used to compile this code.
-GTEST_API_ ::std::string FormatFileLocation(const char* file, int line) {
- const std::string file_name(file == NULL ? kUnknownFile : file);
-
- if (line < 0) {
- return file_name + ":";
- }
-#ifdef _MSC_VER
- return file_name + "(" + StreamableToString(line) + "):";
-#else
- return file_name + ":" + StreamableToString(line) + ":";
-#endif // _MSC_VER
-}
-
-// Formats a file location for compiler-independent XML output.
-// Although this function is not platform dependent, we put it next to
-// FormatFileLocation in order to contrast the two functions.
-// Note that FormatCompilerIndependentFileLocation() does NOT append colon
-// to the file location it produces, unlike FormatFileLocation().
-GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(
- const char* file, int line) {
- const std::string file_name(file == NULL ? kUnknownFile : file);
-
- if (line < 0)
- return file_name;
- else
- return file_name + ":" + StreamableToString(line);
-}
-
-
-GTestLog::GTestLog(GTestLogSeverity severity, const char* file, int line)
- : severity_(severity) {
- const char* const marker =
- severity == GTEST_INFO ? "[ INFO ]" :
- severity == GTEST_WARNING ? "[WARNING]" :
- severity == GTEST_ERROR ? "[ ERROR ]" : "[ FATAL ]";
- GetStream() << ::std::endl << marker << " "
- << FormatFileLocation(file, line).c_str() << ": ";
-}
-
-// Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
-GTestLog::~GTestLog() {
- GetStream() << ::std::endl;
- if (severity_ == GTEST_FATAL) {
- fflush(stderr);
- posix::Abort();
- }
-}
-// Disable Microsoft deprecation warnings for POSIX functions called from
-// this class (creat, dup, dup2, and close)
-GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
-
-#if GTEST_HAS_STREAM_REDIRECTION
-
-// Object that captures an output stream (stdout/stderr).
-class CapturedStream {
- public:
- // The ctor redirects the stream to a temporary file.
- explicit CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
-# if GTEST_OS_WINDOWS
- char temp_dir_path[MAX_PATH + 1] = { '\0' }; // NOLINT
- char temp_file_path[MAX_PATH + 1] = { '\0' }; // NOLINT
-
- ::GetTempPathA(sizeof(temp_dir_path), temp_dir_path);
- const UINT success = ::GetTempFileNameA(temp_dir_path,
- "gtest_redir",
- 0, // Generate unique file name.
- temp_file_path);
- GTEST_CHECK_(success != 0)
- << "Unable to create a temporary file in " << temp_dir_path;
- const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE);
- GTEST_CHECK_(captured_fd != -1) << "Unable to open temporary file "
- << temp_file_path;
- filename_ = temp_file_path;
-# else
- // There's no guarantee that a test has write access to the current
- // directory, so we create the temporary file in the /tmp directory
- // instead. We use /tmp on most systems, and /sdcard on Android.
- // That's because Android doesn't have /tmp.
-# if GTEST_OS_LINUX_ANDROID
- // Note: Android applications are expected to call the framework's
- // Context.getExternalStorageDirectory() method through JNI to get
- // the location of the world-writable SD Card directory. However,
- // this requires a Context handle, which cannot be retrieved
- // globally from native code. Doing so also precludes running the
- // code as part of a regular standalone executable, which doesn't
- // run in a Dalvik process (e.g. when running it through 'adb shell').
- //
- // The location /sdcard is directly accessible from native code
- // and is the only location (unofficially) supported by the Android
- // team. It's generally a symlink to the real SD Card mount point
- // which can be /mnt/sdcard, /mnt/sdcard0, /system/media/sdcard, or
- // other OEM-customized locations. Never rely on these, and always
- // use /sdcard.
- char name_template[] = "/sdcard/gtest_captured_stream.XXXXXX";
-# else
- char name_template[] = "/tmp/captured_stream.XXXXXX";
-# endif // GTEST_OS_LINUX_ANDROID
- const int captured_fd = mkstemp(name_template);
- filename_ = name_template;
-# endif // GTEST_OS_WINDOWS
- fflush(NULL);
- dup2(captured_fd, fd_);
- close(captured_fd);
- }
-
- ~CapturedStream() {
- remove(filename_.c_str());
- }
-
- std::string GetCapturedString() {
- if (uncaptured_fd_ != -1) {
- // Restores the original stream.
- fflush(NULL);
- dup2(uncaptured_fd_, fd_);
- close(uncaptured_fd_);
- uncaptured_fd_ = -1;
- }
-
- FILE* const file = posix::FOpen(filename_.c_str(), "r");
- const std::string content = ReadEntireFile(file);
- posix::FClose(file);
- return content;
- }
-
- private:
- // Reads the entire content of a file as an std::string.
- static std::string ReadEntireFile(FILE* file);
-
- // Returns the size (in bytes) of a file.
- static size_t GetFileSize(FILE* file);
-
- const int fd_; // A stream to capture.
- int uncaptured_fd_;
- // Name of the temporary file holding the stderr output.
- ::std::string filename_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream);
-};
-
-// Returns the size (in bytes) of a file.
-size_t CapturedStream::GetFileSize(FILE* file) {
- fseek(file, 0, SEEK_END);
- return static_cast<size_t>(ftell(file));
-}
-
-// Reads the entire content of a file as a string.
-std::string CapturedStream::ReadEntireFile(FILE* file) {
- const size_t file_size = GetFileSize(file);
- char* const buffer = new char[file_size];
-
- size_t bytes_last_read = 0; // # of bytes read in the last fread()
- size_t bytes_read = 0; // # of bytes read so far
-
- fseek(file, 0, SEEK_SET);
-
- // Keeps reading the file until we cannot read further or the
- // pre-determined file size is reached.
- do {
- bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file);
- bytes_read += bytes_last_read;
- } while (bytes_last_read > 0 && bytes_read < file_size);
-
- const std::string content(buffer, bytes_read);
- delete[] buffer;
-
- return content;
-}
-
-GTEST_DISABLE_MSC_WARNINGS_POP_()
-
-static CapturedStream* g_captured_stderr = NULL;
-static CapturedStream* g_captured_stdout = NULL;
-
-// Starts capturing an output stream (stdout/stderr).
-void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
- if (*stream != NULL) {
- GTEST_LOG_(FATAL) << "Only one " << stream_name
- << " capturer can exist at a time.";
- }
- *stream = new CapturedStream(fd);
-}
-
-// Stops capturing the output stream and returns the captured string.
-std::string GetCapturedStream(CapturedStream** captured_stream) {
- const std::string content = (*captured_stream)->GetCapturedString();
-
- delete *captured_stream;
- *captured_stream = NULL;
-
- return content;
-}
-
-// Starts capturing stdout.
-void CaptureStdout() {
- CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout);
-}
-
-// Starts capturing stderr.
-void CaptureStderr() {
- CaptureStream(kStdErrFileno, "stderr", &g_captured_stderr);
-}
-
-// Stops capturing stdout and returns the captured string.
-std::string GetCapturedStdout() {
- return GetCapturedStream(&g_captured_stdout);
-}
-
-// Stops capturing stderr and returns the captured string.
-std::string GetCapturedStderr() {
- return GetCapturedStream(&g_captured_stderr);
-}
-
-#endif // GTEST_HAS_STREAM_REDIRECTION
-
-#if GTEST_HAS_DEATH_TEST
-
-// A copy of all command line arguments. Set by InitGoogleTest().
-::std::vector<testing::internal::string> g_argvs;
-
-static const ::std::vector<testing::internal::string>* g_injected_test_argvs =
- NULL; // Owned.
-
-void SetInjectableArgvs(const ::std::vector<testing::internal::string>* argvs) {
- if (g_injected_test_argvs != argvs)
- delete g_injected_test_argvs;
- g_injected_test_argvs = argvs;
-}
-
-const ::std::vector<testing::internal::string>& GetInjectableArgvs() {
- if (g_injected_test_argvs != NULL) {
- return *g_injected_test_argvs;
- }
- return g_argvs;
-}
-#endif // GTEST_HAS_DEATH_TEST
-
-#if GTEST_OS_WINDOWS_MOBILE
-namespace posix {
-void Abort() {
- DebugBreak();
- TerminateProcess(GetCurrentProcess(), 1);
-}
-} // namespace posix
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-// Returns the name of the environment variable corresponding to the
-// given flag. For example, FlagToEnvVar("foo") will return
-// "GTEST_FOO" in the open-source version.
-static std::string FlagToEnvVar(const char* flag) {
- const std::string full_flag =
- (Message() << GTEST_FLAG_PREFIX_ << flag).GetString();
-
- Message env_var;
- for (size_t i = 0; i != full_flag.length(); i++) {
- env_var << ToUpper(full_flag.c_str()[i]);
- }
-
- return env_var.GetString();
-}
-
-// Parses 'str' for a 32-bit signed integer. If successful, writes
-// the result to *value and returns true; otherwise leaves *value
-// unchanged and returns false.
-bool ParseInt32(const Message& src_text, const char* str, Int32* value) {
- // Parses the environment variable as a decimal integer.
- char* end = NULL;
- const long long_value = strtol(str, &end, 10); // NOLINT
-
- // Has strtol() consumed all characters in the string?
- if (*end != '\0') {
- // No - an invalid character was encountered.
- Message msg;
- msg << "WARNING: " << src_text
- << " is expected to be a 32-bit integer, but actually"
- << " has value \"" << str << "\".\n";
- printf("%s", msg.GetString().c_str());
- fflush(stdout);
- return false;
- }
-
- // Is the parsed value in the range of an Int32?
- const Int32 result = static_cast<Int32>(long_value);
- if (long_value == LONG_MAX || long_value == LONG_MIN ||
- // The parsed value overflows as a long. (strtol() returns
- // LONG_MAX or LONG_MIN when the input overflows.)
- result != long_value
- // The parsed value overflows as an Int32.
- ) {
- Message msg;
- msg << "WARNING: " << src_text
- << " is expected to be a 32-bit integer, but actually"
- << " has value " << str << ", which overflows.\n";
- printf("%s", msg.GetString().c_str());
- fflush(stdout);
- return false;
- }
-
- *value = result;
- return true;
-}
-
-// Reads and returns the Boolean environment variable corresponding to
-// the given flag; if it's not set, returns default_value.
-//
-// The value is considered true iff it's not "0".
-bool BoolFromGTestEnv(const char* flag, bool default_value) {
- const std::string env_var = FlagToEnvVar(flag);
- const char* const string_value = posix::GetEnv(env_var.c_str());
- return string_value == NULL ?
- default_value : strcmp(string_value, "0") != 0;
-}
-
-// Reads and returns a 32-bit integer stored in the environment
-// variable corresponding to the given flag; if it isn't set or
-// doesn't represent a valid 32-bit integer, returns default_value.
-Int32 Int32FromGTestEnv(const char* flag, Int32 default_value) {
- const std::string env_var = FlagToEnvVar(flag);
- const char* const string_value = posix::GetEnv(env_var.c_str());
- if (string_value == NULL) {
- // The environment variable is not set.
- return default_value;
- }
-
- Int32 result = default_value;
- if (!ParseInt32(Message() << "Environment variable " << env_var,
- string_value, &result)) {
- printf("The default value %s is used.\n",
- (Message() << default_value).GetString().c_str());
- fflush(stdout);
- return default_value;
- }
-
- return result;
-}
-
-// Reads and returns the string environment variable corresponding to
-// the given flag; if it's not set, returns default_value.
-const char* StringFromGTestEnv(const char* flag, const char* default_value) {
- const std::string env_var = FlagToEnvVar(flag);
- const char* const value = posix::GetEnv(env_var.c_str());
- return value == NULL ? default_value : value;
-}
-
-} // namespace internal
-} // namespace testing
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-printers.cc b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-printers.cc
deleted file mode 100644
index a2df412..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-printers.cc
+++ /dev/null
@@ -1,373 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Test - The Google C++ Testing Framework
-//
-// This file implements a universal value printer that can print a
-// value of any type T:
-//
-// void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
-//
-// It uses the << operator when possible, and prints the bytes in the
-// object otherwise. A user can override its behavior for a class
-// type Foo by defining either operator<<(::std::ostream&, const Foo&)
-// or void PrintTo(const Foo&, ::std::ostream*) in the namespace that
-// defines Foo.
-
-#include "gtest/gtest-printers.h"
-#include <ctype.h>
-#include <stdio.h>
-#include <cwchar>
-#include <ostream> // NOLINT
-#include <string>
-#include "gtest/internal/gtest-port.h"
-
-namespace testing {
-
-namespace {
-
-using ::std::ostream;
-
-// Prints a segment of bytes in the given object.
-GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
-GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
-GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
-void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start,
- size_t count, ostream* os) {
- char text[5] = "";
- for (size_t i = 0; i != count; i++) {
- const size_t j = start + i;
- if (i != 0) {
- // Organizes the bytes into groups of 2 for easy parsing by
- // human.
- if ((j % 2) == 0)
- *os << ' ';
- else
- *os << '-';
- }
- GTEST_SNPRINTF_(text, sizeof(text), "%02X", obj_bytes[j]);
- *os << text;
- }
-}
-
-// Prints the bytes in the given value to the given ostream.
-void PrintBytesInObjectToImpl(const unsigned char* obj_bytes, size_t count,
- ostream* os) {
- // Tells the user how big the object is.
- *os << count << "-byte object <";
-
- const size_t kThreshold = 132;
- const size_t kChunkSize = 64;
- // If the object size is bigger than kThreshold, we'll have to omit
- // some details by printing only the first and the last kChunkSize
- // bytes.
- // TODO(wan): let the user control the threshold using a flag.
- if (count < kThreshold) {
- PrintByteSegmentInObjectTo(obj_bytes, 0, count, os);
- } else {
- PrintByteSegmentInObjectTo(obj_bytes, 0, kChunkSize, os);
- *os << " ... ";
- // Rounds up to 2-byte boundary.
- const size_t resume_pos = (count - kChunkSize + 1)/2*2;
- PrintByteSegmentInObjectTo(obj_bytes, resume_pos, count - resume_pos, os);
- }
- *os << ">";
-}
-
-} // namespace
-
-namespace internal2 {
-
-// Delegates to PrintBytesInObjectToImpl() to print the bytes in the
-// given object. The delegation simplifies the implementation, which
-// uses the << operator and thus is easier done outside of the
-// ::testing::internal namespace, which contains a << operator that
-// sometimes conflicts with the one in STL.
-void PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count,
- ostream* os) {
- PrintBytesInObjectToImpl(obj_bytes, count, os);
-}
-
-} // namespace internal2
-
-namespace internal {
-
-// Depending on the value of a char (or wchar_t), we print it in one
-// of three formats:
-// - as is if it's a printable ASCII (e.g. 'a', '2', ' '),
-// - as a hexidecimal escape sequence (e.g. '\x7F'), or
-// - as a special escape sequence (e.g. '\r', '\n').
-enum CharFormat {
- kAsIs,
- kHexEscape,
- kSpecialEscape
-};
-
-// Returns true if c is a printable ASCII character. We test the
-// value of c directly instead of calling isprint(), which is buggy on
-// Windows Mobile.
-inline bool IsPrintableAscii(wchar_t c) {
- return 0x20 <= c && c <= 0x7E;
-}
-
-// Prints a wide or narrow char c as a character literal without the
-// quotes, escaping it when necessary; returns how c was formatted.
-// The template argument UnsignedChar is the unsigned version of Char,
-// which is the type of c.
-template <typename UnsignedChar, typename Char>
-static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {
- switch (static_cast<wchar_t>(c)) {
- case L'\0':
- *os << "\\0";
- break;
- case L'\'':
- *os << "\\'";
- break;
- case L'\\':
- *os << "\\\\";
- break;
- case L'\a':
- *os << "\\a";
- break;
- case L'\b':
- *os << "\\b";
- break;
- case L'\f':
- *os << "\\f";
- break;
- case L'\n':
- *os << "\\n";
- break;
- case L'\r':
- *os << "\\r";
- break;
- case L'\t':
- *os << "\\t";
- break;
- case L'\v':
- *os << "\\v";
- break;
- default:
- if (IsPrintableAscii(c)) {
- *os << static_cast<char>(c);
- return kAsIs;
- } else {
- *os << "\\x" + String::FormatHexInt(static_cast<UnsignedChar>(c));
- return kHexEscape;
- }
- }
- return kSpecialEscape;
-}
-
-// Prints a wchar_t c as if it's part of a string literal, escaping it when
-// necessary; returns how c was formatted.
-static CharFormat PrintAsStringLiteralTo(wchar_t c, ostream* os) {
- switch (c) {
- case L'\'':
- *os << "'";
- return kAsIs;
- case L'"':
- *os << "\\\"";
- return kSpecialEscape;
- default:
- return PrintAsCharLiteralTo<wchar_t>(c, os);
- }
-}
-
-// Prints a char c as if it's part of a string literal, escaping it when
-// necessary; returns how c was formatted.
-static CharFormat PrintAsStringLiteralTo(char c, ostream* os) {
- return PrintAsStringLiteralTo(
- static_cast<wchar_t>(static_cast<unsigned char>(c)), os);
-}
-
-// Prints a wide or narrow character c and its code. '\0' is printed
-// as "'\\0'", other unprintable characters are also properly escaped
-// using the standard C++ escape sequence. The template argument
-// UnsignedChar is the unsigned version of Char, which is the type of c.
-template <typename UnsignedChar, typename Char>
-void PrintCharAndCodeTo(Char c, ostream* os) {
- // First, print c as a literal in the most readable form we can find.
- *os << ((sizeof(c) > 1) ? "L'" : "'");
- const CharFormat format = PrintAsCharLiteralTo<UnsignedChar>(c, os);
- *os << "'";
-
- // To aid user debugging, we also print c's code in decimal, unless
- // it's 0 (in which case c was printed as '\\0', making the code
- // obvious).
- if (c == 0)
- return;
- *os << " (" << static_cast<int>(c);
-
- // For more convenience, we print c's code again in hexidecimal,
- // unless c was already printed in the form '\x##' or the code is in
- // [1, 9].
- if (format == kHexEscape || (1 <= c && c <= 9)) {
- // Do nothing.
- } else {
- *os << ", 0x" << String::FormatHexInt(static_cast<UnsignedChar>(c));
- }
- *os << ")";
-}
-
-void PrintTo(unsigned char c, ::std::ostream* os) {
- PrintCharAndCodeTo<unsigned char>(c, os);
-}
-void PrintTo(signed char c, ::std::ostream* os) {
- PrintCharAndCodeTo<unsigned char>(c, os);
-}
-
-// Prints a wchar_t as a symbol if it is printable or as its internal
-// code otherwise and also as its code. L'\0' is printed as "L'\\0'".
-void PrintTo(wchar_t wc, ostream* os) {
- PrintCharAndCodeTo<wchar_t>(wc, os);
-}
-
-// Prints the given array of characters to the ostream. CharType must be either
-// char or wchar_t.
-// The array starts at begin, the length is len, it may include '\0' characters
-// and may not be NUL-terminated.
-template <typename CharType>
-GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
-GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
-GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
-static void PrintCharsAsStringTo(
- const CharType* begin, size_t len, ostream* os) {
- const char* const kQuoteBegin = sizeof(CharType) == 1 ? "\"" : "L\"";
- *os << kQuoteBegin;
- bool is_previous_hex = false;
- for (size_t index = 0; index < len; ++index) {
- const CharType cur = begin[index];
- if (is_previous_hex && IsXDigit(cur)) {
- // Previous character is of '\x..' form and this character can be
- // interpreted as another hexadecimal digit in its number. Break string to
- // disambiguate.
- *os << "\" " << kQuoteBegin;
- }
- is_previous_hex = PrintAsStringLiteralTo(cur, os) == kHexEscape;
- }
- *os << "\"";
-}
-
-// Prints a (const) char/wchar_t array of 'len' elements, starting at address
-// 'begin'. CharType must be either char or wchar_t.
-template <typename CharType>
-GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
-GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
-GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
-static void UniversalPrintCharArray(
- const CharType* begin, size_t len, ostream* os) {
- // The code
- // const char kFoo[] = "foo";
- // generates an array of 4, not 3, elements, with the last one being '\0'.
- //
- // Therefore when printing a char array, we don't print the last element if
- // it's '\0', such that the output matches the string literal as it's
- // written in the source code.
- if (len > 0 && begin[len - 1] == '\0') {
- PrintCharsAsStringTo(begin, len - 1, os);
- return;
- }
-
- // If, however, the last element in the array is not '\0', e.g.
- // const char kFoo[] = { 'f', 'o', 'o' };
- // we must print the entire array. We also print a message to indicate
- // that the array is not NUL-terminated.
- PrintCharsAsStringTo(begin, len, os);
- *os << " (no terminating NUL)";
-}
-
-// Prints a (const) char array of 'len' elements, starting at address 'begin'.
-void UniversalPrintArray(const char* begin, size_t len, ostream* os) {
- UniversalPrintCharArray(begin, len, os);
-}
-
-// Prints a (const) wchar_t array of 'len' elements, starting at address
-// 'begin'.
-void UniversalPrintArray(const wchar_t* begin, size_t len, ostream* os) {
- UniversalPrintCharArray(begin, len, os);
-}
-
-// Prints the given C string to the ostream.
-void PrintTo(const char* s, ostream* os) {
- if (s == NULL) {
- *os << "NULL";
- } else {
- *os << ImplicitCast_<const void*>(s) << " pointing to ";
- PrintCharsAsStringTo(s, strlen(s), os);
- }
-}
-
-// MSVC compiler can be configured to define whar_t as a typedef
-// of unsigned short. Defining an overload for const wchar_t* in that case
-// would cause pointers to unsigned shorts be printed as wide strings,
-// possibly accessing more memory than intended and causing invalid
-// memory accesses. MSVC defines _NATIVE_WCHAR_T_DEFINED symbol when
-// wchar_t is implemented as a native type.
-#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
-// Prints the given wide C string to the ostream.
-void PrintTo(const wchar_t* s, ostream* os) {
- if (s == NULL) {
- *os << "NULL";
- } else {
- *os << ImplicitCast_<const void*>(s) << " pointing to ";
- PrintCharsAsStringTo(s, std::wcslen(s), os);
- }
-}
-#endif // wchar_t is native
-
-// Prints a ::string object.
-#if GTEST_HAS_GLOBAL_STRING
-void PrintStringTo(const ::string& s, ostream* os) {
- PrintCharsAsStringTo(s.data(), s.size(), os);
-}
-#endif // GTEST_HAS_GLOBAL_STRING
-
-void PrintStringTo(const ::std::string& s, ostream* os) {
- PrintCharsAsStringTo(s.data(), s.size(), os);
-}
-
-// Prints a ::wstring object.
-#if GTEST_HAS_GLOBAL_WSTRING
-void PrintWideStringTo(const ::wstring& s, ostream* os) {
- PrintCharsAsStringTo(s.data(), s.size(), os);
-}
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-#if GTEST_HAS_STD_WSTRING
-void PrintWideStringTo(const ::std::wstring& s, ostream* os) {
- PrintCharsAsStringTo(s.data(), s.size(), os);
-}
-#endif // GTEST_HAS_STD_WSTRING
-
-} // namespace internal
-
-} // namespace testing
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-test-part.cc b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-test-part.cc
deleted file mode 100644
index c60eef3..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-test-part.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: mheule@google.com (Markus Heule)
-//
-// The Google C++ Testing Framework (Google Test)
-
-#include "gtest/gtest-test-part.h"
-
-// Indicates that this translation unit is part of Google Test's
-// implementation. It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error. This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION_
-
-namespace testing {
-
-using internal::GetUnitTestImpl;
-
-// Gets the summary of the failure message by omitting the stack trace
-// in it.
-std::string TestPartResult::ExtractSummary(const char* message) {
- const char* const stack_trace = strstr(message, internal::kStackTraceMarker);
- return stack_trace == NULL ? message :
- std::string(message, stack_trace);
-}
-
-// Prints a TestPartResult object.
-std::ostream& operator<<(std::ostream& os, const TestPartResult& result) {
- return os
- << result.file_name() << ":" << result.line_number() << ": "
- << (result.type() == TestPartResult::kSuccess ? "Success" :
- result.type() == TestPartResult::kFatalFailure ? "Fatal failure" :
- "Non-fatal failure") << ":\n"
- << result.message() << std::endl;
-}
-
-// Appends a TestPartResult to the array.
-void TestPartResultArray::Append(const TestPartResult& result) {
- array_.push_back(result);
-}
-
-// Returns the TestPartResult at the given index (0-based).
-const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const {
- if (index < 0 || index >= size()) {
- printf("\nInvalid index (%d) into TestPartResultArray.\n", index);
- internal::posix::Abort();
- }
-
- return array_[index];
-}
-
-// Returns the number of TestPartResult objects in the array.
-int TestPartResultArray::size() const {
- return static_cast<int>(array_.size());
-}
-
-namespace internal {
-
-HasNewFatalFailureHelper::HasNewFatalFailureHelper()
- : has_new_fatal_failure_(false),
- original_reporter_(GetUnitTestImpl()->
- GetTestPartResultReporterForCurrentThread()) {
- GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(this);
-}
-
-HasNewFatalFailureHelper::~HasNewFatalFailureHelper() {
- GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(
- original_reporter_);
-}
-
-void HasNewFatalFailureHelper::ReportTestPartResult(
- const TestPartResult& result) {
- if (result.fatally_failed())
- has_new_fatal_failure_ = true;
- original_reporter_->ReportTestPartResult(result);
-}
-
-} // namespace internal
-
-} // namespace testing
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-typed-test.cc b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-typed-test.cc
deleted file mode 100644
index f0079f4..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest-typed-test.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#include "gtest/gtest-typed-test.h"
-#include "gtest/gtest.h"
-
-namespace testing {
-namespace internal {
-
-#if GTEST_HAS_TYPED_TEST_P
-
-// Skips to the first non-space char in str. Returns an empty string if str
-// contains only whitespace characters.
-static const char* SkipSpaces(const char* str) {
- while (IsSpace(*str))
- str++;
- return str;
-}
-
-// Verifies that registered_tests match the test names in
-// defined_test_names_; returns registered_tests if successful, or
-// aborts the program otherwise.
-const char* TypedTestCasePState::VerifyRegisteredTestNames(
- const char* file, int line, const char* registered_tests) {
- typedef ::std::set<const char*>::const_iterator DefinedTestIter;
- registered_ = true;
-
- // Skip initial whitespace in registered_tests since some
- // preprocessors prefix stringizied literals with whitespace.
- registered_tests = SkipSpaces(registered_tests);
-
- Message errors;
- ::std::set<std::string> tests;
- for (const char* names = registered_tests; names != NULL;
- names = SkipComma(names)) {
- const std::string name = GetPrefixUntilComma(names);
- if (tests.count(name) != 0) {
- errors << "Test " << name << " is listed more than once.\n";
- continue;
- }
-
- bool found = false;
- for (DefinedTestIter it = defined_test_names_.begin();
- it != defined_test_names_.end();
- ++it) {
- if (name == *it) {
- found = true;
- break;
- }
- }
-
- if (found) {
- tests.insert(name);
- } else {
- errors << "No test named " << name
- << " can be found in this test case.\n";
- }
- }
-
- for (DefinedTestIter it = defined_test_names_.begin();
- it != defined_test_names_.end();
- ++it) {
- if (tests.count(*it) == 0) {
- errors << "You forgot to list test " << *it << ".\n";
- }
- }
-
- const std::string& errors_str = errors.GetString();
- if (errors_str != "") {
- fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
- errors_str.c_str());
- fflush(stderr);
- posix::Abort();
- }
-
- return registered_tests;
-}
-
-#endif // GTEST_HAS_TYPED_TEST_P
-
-} // namespace internal
-} // namespace testing
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest.cc b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest.cc
deleted file mode 100644
index 24c573c..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest.cc
+++ /dev/null
@@ -1,5008 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-
-#include "gtest/gtest.h"
-#include "gtest/gtest-spi.h"
-
-#include <ctype.h>
-#include <math.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include <algorithm>
-#include <iomanip>
-#include <limits>
-#include <ostream> // NOLINT
-#include <sstream>
-#include <vector>
-
-#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
-
-#if GTEST_OS_LINUX
-
-// TODO(kenton@google.com): Use autoconf to detect availability of
-// gettimeofday().
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-
-# include <fcntl.h> // NOLINT
-# include <limits.h> // NOLINT
-# include <sched.h> // NOLINT
-// Declares vsnprintf(). This header is not available on Windows.
-# include <strings.h> // NOLINT
-# include <sys/mman.h> // NOLINT
-# include <sys/time.h> // NOLINT
-# include <unistd.h> // NOLINT
-# include <string>
-
-#elif GTEST_OS_SYMBIAN
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-# include <sys/time.h> // NOLINT
-
-#elif GTEST_OS_ZOS
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-# include <sys/time.h> // NOLINT
-
-// On z/OS we additionally need strings.h for strcasecmp.
-# include <strings.h> // NOLINT
-
-#elif GTEST_OS_WINDOWS_MOBILE // We are on Windows CE.
-
-# include <windows.h> // NOLINT
-
-#elif GTEST_OS_WINDOWS // We are on Windows proper.
-
-# include <io.h> // NOLINT
-# include <sys/timeb.h> // NOLINT
-# include <sys/types.h> // NOLINT
-# include <sys/stat.h> // NOLINT
-
-# if GTEST_OS_WINDOWS_MINGW
-// MinGW has gettimeofday() but not _ftime64().
-// TODO(kenton@google.com): Use autoconf to detect availability of
-// gettimeofday().
-// TODO(kenton@google.com): There are other ways to get the time on
-// Windows, like GetTickCount() or GetSystemTimeAsFileTime(). MinGW
-// supports these. consider using them instead.
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-# include <sys/time.h> // NOLINT
-# endif // GTEST_OS_WINDOWS_MINGW
-
-// cpplint thinks that the header is already included, so we want to
-// silence it.
-# include <windows.h> // NOLINT
-
-#else
-
-// Assume other platforms have gettimeofday().
-// TODO(kenton@google.com): Use autoconf to detect availability of
-// gettimeofday().
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-
-// cpplint thinks that the header is already included, so we want to
-// silence it.
-# include <sys/time.h> // NOLINT
-# include <unistd.h> // NOLINT
-
-#endif // GTEST_OS_LINUX
-
-#if GTEST_HAS_EXCEPTIONS
-# include <stdexcept>
-#endif
-
-#if GTEST_CAN_STREAM_RESULTS_
-# include <arpa/inet.h> // NOLINT
-# include <netdb.h> // NOLINT
-#endif
-
-// Indicates that this translation unit is part of Google Test's
-// implementation. It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error. This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION_
-
-#if GTEST_OS_WINDOWS
-# define vsnprintf _vsnprintf
-#endif // GTEST_OS_WINDOWS
-
-namespace testing {
-
-using internal::CountIf;
-using internal::ForEach;
-using internal::GetElementOr;
-using internal::Shuffle;
-
-// Constants.
-
-// A test whose test case name or test name matches this filter is
-// disabled and not run.
-static const char kDisableTestFilter[] = "DISABLED_*:*/DISABLED_*";
-
-// A test case whose name matches this filter is considered a death
-// test case and will be run before test cases whose name doesn't
-// match this filter.
-static const char kDeathTestCaseFilter[] = "*DeathTest:*DeathTest/*";
-
-// A test filter that matches everything.
-static const char kUniversalFilter[] = "*";
-
-// The default output file for XML output.
-static const char kDefaultOutputFile[] = "test_detail.xml";
-
-// The environment variable name for the test shard index.
-static const char kTestShardIndex[] = "GTEST_SHARD_INDEX";
-// The environment variable name for the total number of test shards.
-static const char kTestTotalShards[] = "GTEST_TOTAL_SHARDS";
-// The environment variable name for the test shard status file.
-static const char kTestShardStatusFile[] = "GTEST_SHARD_STATUS_FILE";
-
-namespace internal {
-
-// The text used in failure messages to indicate the start of the
-// stack trace.
-const char kStackTraceMarker[] = "\nStack trace:\n";
-
-// g_help_flag is true iff the --help flag or an equivalent form is
-// specified on the command line.
-bool g_help_flag = false;
-
-} // namespace internal
-
-static const char* GetDefaultFilter() {
- return kUniversalFilter;
-}
-
-GTEST_DEFINE_bool_(
- also_run_disabled_tests,
- internal::BoolFromGTestEnv("also_run_disabled_tests", false),
- "Run disabled tests too, in addition to the tests normally being run.");
-
-GTEST_DEFINE_bool_(
- break_on_failure,
- internal::BoolFromGTestEnv("break_on_failure", false),
- "True iff a failed assertion should be a debugger break-point.");
-
-GTEST_DEFINE_bool_(
- catch_exceptions,
- internal::BoolFromGTestEnv("catch_exceptions", true),
- "True iff " GTEST_NAME_
- " should catch exceptions and treat them as test failures.");
-
-GTEST_DEFINE_string_(
- color,
- internal::StringFromGTestEnv("color", "auto"),
- "Whether to use colors in the output. Valid values: yes, no, "
- "and auto. 'auto' means to use colors if the output is "
- "being sent to a terminal and the TERM environment variable "
- "is set to a terminal type that supports colors.");
-
-GTEST_DEFINE_string_(
- filter,
- internal::StringFromGTestEnv("filter", GetDefaultFilter()),
- "A colon-separated list of glob (not regex) patterns "
- "for filtering the tests to run, optionally followed by a "
- "'-' and a : separated list of negative patterns (tests to "
- "exclude). A test is run if it matches one of the positive "
- "patterns and does not match any of the negative patterns.");
-
-GTEST_DEFINE_bool_(list_tests, false,
- "List all tests without running them.");
-
-GTEST_DEFINE_string_(
- output,
- internal::StringFromGTestEnv("output", ""),
- "A format (currently must be \"xml\"), optionally followed "
- "by a colon and an output file name or directory. A directory "
- "is indicated by a trailing pathname separator. "
- "Examples: \"xml:filename.xml\", \"xml::directoryname/\". "
- "If a directory is specified, output files will be created "
- "within that directory, with file-names based on the test "
- "executable's name and, if necessary, made unique by adding "
- "digits.");
-
-GTEST_DEFINE_bool_(
- print_time,
- internal::BoolFromGTestEnv("print_time", true),
- "True iff " GTEST_NAME_
- " should display elapsed time in text output.");
-
-GTEST_DEFINE_int32_(
- random_seed,
- internal::Int32FromGTestEnv("random_seed", 0),
- "Random number seed to use when shuffling test orders. Must be in range "
- "[1, 99999], or 0 to use a seed based on the current time.");
-
-GTEST_DEFINE_int32_(
- repeat,
- internal::Int32FromGTestEnv("repeat", 1),
- "How many times to repeat each test. Specify a negative number "
- "for repeating forever. Useful for shaking out flaky tests.");
-
-GTEST_DEFINE_bool_(
- show_internal_stack_frames, false,
- "True iff " GTEST_NAME_ " should include internal stack frames when "
- "printing test failure stack traces.");
-
-GTEST_DEFINE_bool_(
- shuffle,
- internal::BoolFromGTestEnv("shuffle", false),
- "True iff " GTEST_NAME_
- " should randomize tests' order on every run.");
-
-GTEST_DEFINE_int32_(
- stack_trace_depth,
- internal::Int32FromGTestEnv("stack_trace_depth", kMaxStackTraceDepth),
- "The maximum number of stack frames to print when an "
- "assertion fails. The valid range is 0 through 100, inclusive.");
-
-GTEST_DEFINE_string_(
- stream_result_to,
- internal::StringFromGTestEnv("stream_result_to", ""),
- "This flag specifies the host name and the port number on which to stream "
- "test results. Example: \"localhost:555\". The flag is effective only on "
- "Linux.");
-
-GTEST_DEFINE_bool_(
- throw_on_failure,
- internal::BoolFromGTestEnv("throw_on_failure", false),
- "When this flag is specified, a failed assertion will throw an exception "
- "if exceptions are enabled or exit the program with a non-zero code "
- "otherwise.");
-
-namespace internal {
-
-// Generates a random number from [0, range), using a Linear
-// Congruential Generator (LCG). Crashes if 'range' is 0 or greater
-// than kMaxRange.
-UInt32 Random::Generate(UInt32 range) {
- // These constants are the same as are used in glibc's rand(3).
- state_ = (1103515245U*state_ + 12345U) % kMaxRange;
-
- GTEST_CHECK_(range > 0)
- << "Cannot generate a number in the range [0, 0).";
- GTEST_CHECK_(range <= kMaxRange)
- << "Generation of a number in [0, " << range << ") was requested, "
- << "but this can only generate numbers in [0, " << kMaxRange << ").";
-
- // Converting via modulus introduces a bit of downward bias, but
- // it's simple, and a linear congruential generator isn't too good
- // to begin with.
- return state_ % range;
-}
-
-// GTestIsInitialized() returns true iff the user has initialized
-// Google Test. Useful for catching the user mistake of not initializing
-// Google Test before calling RUN_ALL_TESTS().
-//
-// A user must call testing::InitGoogleTest() to initialize Google
-// Test. g_init_gtest_count is set to the number of times
-// InitGoogleTest() has been called. We don't protect this variable
-// under a mutex as it is only accessed in the main thread.
-GTEST_API_ int g_init_gtest_count = 0;
-static bool GTestIsInitialized() { return g_init_gtest_count != 0; }
-
-// Iterates over a vector of TestCases, keeping a running sum of the
-// results of calling a given int-returning method on each.
-// Returns the sum.
-static int SumOverTestCaseList(const std::vector<TestCase*>& case_list,
- int (TestCase::*method)() const) {
- int sum = 0;
- for (size_t i = 0; i < case_list.size(); i++) {
- sum += (case_list[i]->*method)();
- }
- return sum;
-}
-
-// Returns true iff the test case passed.
-static bool TestCasePassed(const TestCase* test_case) {
- return test_case->should_run() && test_case->Passed();
-}
-
-// Returns true iff the test case failed.
-static bool TestCaseFailed(const TestCase* test_case) {
- return test_case->should_run() && test_case->Failed();
-}
-
-// Returns true iff test_case contains at least one test that should
-// run.
-static bool ShouldRunTestCase(const TestCase* test_case) {
- return test_case->should_run();
-}
-
-// AssertHelper constructor.
-AssertHelper::AssertHelper(TestPartResult::Type type,
- const char* file,
- int line,
- const char* message)
- : data_(new AssertHelperData(type, file, line, message)) {
-}
-
-AssertHelper::~AssertHelper() {
- delete data_;
-}
-
-// Message assignment, for assertion streaming support.
-void AssertHelper::operator=(const Message& message) const {
- UnitTest::GetInstance()->
- AddTestPartResult(data_->type, data_->file, data_->line,
- AppendUserMessage(data_->message, message),
- UnitTest::GetInstance()->impl()
- ->CurrentOsStackTraceExceptTop(1)
- // Skips the stack frame for this function itself.
- ); // NOLINT
-}
-
-// Mutex for linked pointers.
-GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);
-
-// Application pathname gotten in InitGoogleTest.
-std::string g_executable_path;
-
-// Returns the current application's name, removing directory path if that
-// is present.
-FilePath GetCurrentExecutableName() {
- FilePath result;
-
-#if GTEST_OS_WINDOWS
- result.Set(FilePath(g_executable_path).RemoveExtension("exe"));
-#else
- result.Set(FilePath(g_executable_path));
-#endif // GTEST_OS_WINDOWS
-
- return result.RemoveDirectoryName();
-}
-
-// Functions for processing the gtest_output flag.
-
-// Returns the output format, or "" for normal printed output.
-std::string UnitTestOptions::GetOutputFormat() {
- const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
- if (gtest_output_flag == NULL) return std::string("");
-
- const char* const colon = strchr(gtest_output_flag, ':');
- return (colon == NULL) ?
- std::string(gtest_output_flag) :
- std::string(gtest_output_flag, colon - gtest_output_flag);
-}
-
-// Returns the name of the requested output file, or the default if none
-// was explicitly specified.
-std::string UnitTestOptions::GetAbsolutePathToOutputFile() {
- const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
- if (gtest_output_flag == NULL)
- return "";
-
- const char* const colon = strchr(gtest_output_flag, ':');
- if (colon == NULL)
- return internal::FilePath::ConcatPaths(
- internal::FilePath(
- UnitTest::GetInstance()->original_working_dir()),
- internal::FilePath(kDefaultOutputFile)).string();
-
- internal::FilePath output_name(colon + 1);
- if (!output_name.IsAbsolutePath())
- // TODO(wan@google.com): on Windows \some\path is not an absolute
- // path (as its meaning depends on the current drive), yet the
- // following logic for turning it into an absolute path is wrong.
- // Fix it.
- output_name = internal::FilePath::ConcatPaths(
- internal::FilePath(UnitTest::GetInstance()->original_working_dir()),
- internal::FilePath(colon + 1));
-
- if (!output_name.IsDirectory())
- return output_name.string();
-
- internal::FilePath result(internal::FilePath::GenerateUniqueFileName(
- output_name, internal::GetCurrentExecutableName(),
- GetOutputFormat().c_str()));
- return result.string();
-}
-
-// Returns true iff the wildcard pattern matches the string. The
-// first ':' or '\0' character in pattern marks the end of it.
-//
-// This recursive algorithm isn't very efficient, but is clear and
-// works well enough for matching test names, which are short.
-bool UnitTestOptions::PatternMatchesString(const char *pattern,
- const char *str) {
- switch (*pattern) {
- case '\0':
- case ':': // Either ':' or '\0' marks the end of the pattern.
- return *str == '\0';
- case '?': // Matches any single character.
- return *str != '\0' && PatternMatchesString(pattern + 1, str + 1);
- case '*': // Matches any string (possibly empty) of characters.
- return (*str != '\0' && PatternMatchesString(pattern, str + 1)) ||
- PatternMatchesString(pattern + 1, str);
- default: // Non-special character. Matches itself.
- return *pattern == *str &&
- PatternMatchesString(pattern + 1, str + 1);
- }
-}
-
-bool UnitTestOptions::MatchesFilter(
- const std::string& name, const char* filter) {
- const char *cur_pattern = filter;
- for (;;) {
- if (PatternMatchesString(cur_pattern, name.c_str())) {
- return true;
- }
-
- // Finds the next pattern in the filter.
- cur_pattern = strchr(cur_pattern, ':');
-
- // Returns if no more pattern can be found.
- if (cur_pattern == NULL) {
- return false;
- }
-
- // Skips the pattern separater (the ':' character).
- cur_pattern++;
- }
-}
-
-// Returns true iff the user-specified filter matches the test case
-// name and the test name.
-bool UnitTestOptions::FilterMatchesTest(const std::string &test_case_name,
- const std::string &test_name) {
- const std::string& full_name = test_case_name + "." + test_name.c_str();
-
- // Split --gtest_filter at '-', if there is one, to separate into
- // positive filter and negative filter portions
- const char* const p = GTEST_FLAG(filter).c_str();
- const char* const dash = strchr(p, '-');
- std::string positive;
- std::string negative;
- if (dash == NULL) {
- positive = GTEST_FLAG(filter).c_str(); // Whole string is a positive filter
- negative = "";
- } else {
- positive = std::string(p, dash); // Everything up to the dash
- negative = std::string(dash + 1); // Everything after the dash
- if (positive.empty()) {
- // Treat '-test1' as the same as '*-test1'
- positive = kUniversalFilter;
- }
- }
-
- // A filter is a colon-separated list of patterns. It matches a
- // test if any pattern in it matches the test.
- return (MatchesFilter(full_name, positive.c_str()) &&
- !MatchesFilter(full_name, negative.c_str()));
-}
-
-#if GTEST_HAS_SEH
-// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
-// given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
-// This function is useful as an __except condition.
-int UnitTestOptions::GTestShouldProcessSEH(DWORD exception_code) {
- // Google Test should handle a SEH exception if:
- // 1. the user wants it to, AND
- // 2. this is not a breakpoint exception, AND
- // 3. this is not a C++ exception (VC++ implements them via SEH,
- // apparently).
- //
- // SEH exception code for C++ exceptions.
- // (see http://support.microsoft.com/kb/185294 for more information).
- const DWORD kCxxExceptionCode = 0xe06d7363;
-
- bool should_handle = true;
-
- if (!GTEST_FLAG(catch_exceptions))
- should_handle = false;
- else if (exception_code == EXCEPTION_BREAKPOINT)
- should_handle = false;
- else if (exception_code == kCxxExceptionCode)
- should_handle = false;
-
- return should_handle ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
-}
-#endif // GTEST_HAS_SEH
-
-} // namespace internal
-
-// The c'tor sets this object as the test part result reporter used by
-// Google Test. The 'result' parameter specifies where to report the
-// results. Intercepts only failures from the current thread.
-ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
- TestPartResultArray* result)
- : intercept_mode_(INTERCEPT_ONLY_CURRENT_THREAD),
- result_(result) {
- Init();
-}
-
-// The c'tor sets this object as the test part result reporter used by
-// Google Test. The 'result' parameter specifies where to report the
-// results.
-ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
- InterceptMode intercept_mode, TestPartResultArray* result)
- : intercept_mode_(intercept_mode),
- result_(result) {
- Init();
-}
-
-void ScopedFakeTestPartResultReporter::Init() {
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
- old_reporter_ = impl->GetGlobalTestPartResultReporter();
- impl->SetGlobalTestPartResultReporter(this);
- } else {
- old_reporter_ = impl->GetTestPartResultReporterForCurrentThread();
- impl->SetTestPartResultReporterForCurrentThread(this);
- }
-}
-
-// The d'tor restores the test part result reporter used by Google Test
-// before.
-ScopedFakeTestPartResultReporter::~ScopedFakeTestPartResultReporter() {
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
- impl->SetGlobalTestPartResultReporter(old_reporter_);
- } else {
- impl->SetTestPartResultReporterForCurrentThread(old_reporter_);
- }
-}
-
-// Increments the test part result count and remembers the result.
-// This method is from the TestPartResultReporterInterface interface.
-void ScopedFakeTestPartResultReporter::ReportTestPartResult(
- const TestPartResult& result) {
- result_->Append(result);
-}
-
-namespace internal {
-
-// Returns the type ID of ::testing::Test. We should always call this
-// instead of GetTypeId< ::testing::Test>() to get the type ID of
-// testing::Test. This is to work around a suspected linker bug when
-// using Google Test as a framework on Mac OS X. The bug causes
-// GetTypeId< ::testing::Test>() to return different values depending
-// on whether the call is from the Google Test framework itself or
-// from user test code. GetTestTypeId() is guaranteed to always
-// return the same value, as it always calls GetTypeId<>() from the
-// gtest.cc, which is within the Google Test framework.
-TypeId GetTestTypeId() {
- return GetTypeId<Test>();
-}
-
-// The value of GetTestTypeId() as seen from within the Google Test
-// library. This is solely for testing GetTestTypeId().
-extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId();
-
-// This predicate-formatter checks that 'results' contains a test part
-// failure of the given type and that the failure message contains the
-// given substring.
-AssertionResult HasOneFailure(const char* /* results_expr */,
- const char* /* type_expr */,
- const char* /* substr_expr */,
- const TestPartResultArray& results,
- TestPartResult::Type type,
- const string& substr) {
- const std::string expected(type == TestPartResult::kFatalFailure ?
- "1 fatal failure" :
- "1 non-fatal failure");
- Message msg;
- if (results.size() != 1) {
- msg << "Expected: " << expected << "\n"
- << " Actual: " << results.size() << " failures";
- for (int i = 0; i < results.size(); i++) {
- msg << "\n" << results.GetTestPartResult(i);
- }
- return AssertionFailure() << msg;
- }
-
- const TestPartResult& r = results.GetTestPartResult(0);
- if (r.type() != type) {
- return AssertionFailure() << "Expected: " << expected << "\n"
- << " Actual:\n"
- << r;
- }
-
- if (strstr(r.message(), substr.c_str()) == NULL) {
- return AssertionFailure() << "Expected: " << expected << " containing \""
- << substr << "\"\n"
- << " Actual:\n"
- << r;
- }
-
- return AssertionSuccess();
-}
-
-// The constructor of SingleFailureChecker remembers where to look up
-// test part results, what type of failure we expect, and what
-// substring the failure message should contain.
-SingleFailureChecker:: SingleFailureChecker(
- const TestPartResultArray* results,
- TestPartResult::Type type,
- const string& substr)
- : results_(results),
- type_(type),
- substr_(substr) {}
-
-// The destructor of SingleFailureChecker verifies that the given
-// TestPartResultArray contains exactly one failure that has the given
-// type and contains the given substring. If that's not the case, a
-// non-fatal failure will be generated.
-SingleFailureChecker::~SingleFailureChecker() {
- EXPECT_PRED_FORMAT3(HasOneFailure, *results_, type_, substr_);
-}
-
-DefaultGlobalTestPartResultReporter::DefaultGlobalTestPartResultReporter(
- UnitTestImpl* unit_test) : unit_test_(unit_test) {}
-
-void DefaultGlobalTestPartResultReporter::ReportTestPartResult(
- const TestPartResult& result) {
- unit_test_->current_test_result()->AddTestPartResult(result);
- unit_test_->listeners()->repeater()->OnTestPartResult(result);
-}
-
-DefaultPerThreadTestPartResultReporter::DefaultPerThreadTestPartResultReporter(
- UnitTestImpl* unit_test) : unit_test_(unit_test) {}
-
-void DefaultPerThreadTestPartResultReporter::ReportTestPartResult(
- const TestPartResult& result) {
- unit_test_->GetGlobalTestPartResultReporter()->ReportTestPartResult(result);
-}
-
-// Returns the global test part result reporter.
-TestPartResultReporterInterface*
-UnitTestImpl::GetGlobalTestPartResultReporter() {
- internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
- return global_test_part_result_repoter_;
-}
-
-// Sets the global test part result reporter.
-void UnitTestImpl::SetGlobalTestPartResultReporter(
- TestPartResultReporterInterface* reporter) {
- internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
- global_test_part_result_repoter_ = reporter;
-}
-
-// Returns the test part result reporter for the current thread.
-TestPartResultReporterInterface*
-UnitTestImpl::GetTestPartResultReporterForCurrentThread() {
- return per_thread_test_part_result_reporter_.get();
-}
-
-// Sets the test part result reporter for the current thread.
-void UnitTestImpl::SetTestPartResultReporterForCurrentThread(
- TestPartResultReporterInterface* reporter) {
- per_thread_test_part_result_reporter_.set(reporter);
-}
-
-// Gets the number of successful test cases.
-int UnitTestImpl::successful_test_case_count() const {
- return CountIf(test_cases_, TestCasePassed);
-}
-
-// Gets the number of failed test cases.
-int UnitTestImpl::failed_test_case_count() const {
- return CountIf(test_cases_, TestCaseFailed);
-}
-
-// Gets the number of all test cases.
-int UnitTestImpl::total_test_case_count() const {
- return static_cast<int>(test_cases_.size());
-}
-
-// Gets the number of all test cases that contain at least one test
-// that should run.
-int UnitTestImpl::test_case_to_run_count() const {
- return CountIf(test_cases_, ShouldRunTestCase);
-}
-
-// Gets the number of successful tests.
-int UnitTestImpl::successful_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::successful_test_count);
-}
-
-// Gets the number of failed tests.
-int UnitTestImpl::failed_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::failed_test_count);
-}
-
-// Gets the number of disabled tests that will be reported in the XML report.
-int UnitTestImpl::reportable_disabled_test_count() const {
- return SumOverTestCaseList(test_cases_,
- &TestCase::reportable_disabled_test_count);
-}
-
-// Gets the number of disabled tests.
-int UnitTestImpl::disabled_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::disabled_test_count);
-}
-
-// Gets the number of tests to be printed in the XML report.
-int UnitTestImpl::reportable_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::reportable_test_count);
-}
-
-// Gets the number of all tests.
-int UnitTestImpl::total_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::total_test_count);
-}
-
-// Gets the number of tests that should run.
-int UnitTestImpl::test_to_run_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::test_to_run_count);
-}
-
-// Returns the current OS stack trace as an std::string.
-//
-// The maximum number of stack frames to be included is specified by
-// the gtest_stack_trace_depth flag. The skip_count parameter
-// specifies the number of top frames to be skipped, which doesn't
-// count against the number of frames to be included.
-//
-// For example, if Foo() calls Bar(), which in turn calls
-// CurrentOsStackTraceExceptTop(1), Foo() will be included in the
-// trace but Bar() and CurrentOsStackTraceExceptTop() won't.
-std::string UnitTestImpl::CurrentOsStackTraceExceptTop(int skip_count) {
- (void)skip_count;
- return "";
-}
-
-// Returns the current time in milliseconds.
-TimeInMillis GetTimeInMillis() {
-#if GTEST_OS_WINDOWS_MOBILE || defined(__BORLANDC__)
- // Difference between 1970-01-01 and 1601-01-01 in milliseconds.
- // http://analogous.blogspot.com/2005/04/epoch.html
- const TimeInMillis kJavaEpochToWinFileTimeDelta =
- static_cast<TimeInMillis>(116444736UL) * 100000UL;
- const DWORD kTenthMicrosInMilliSecond = 10000;
-
- SYSTEMTIME now_systime;
- FILETIME now_filetime;
- ULARGE_INTEGER now_int64;
- // TODO(kenton@google.com): Shouldn't this just use
- // GetSystemTimeAsFileTime()?
- GetSystemTime(&now_systime);
- if (SystemTimeToFileTime(&now_systime, &now_filetime)) {
- now_int64.LowPart = now_filetime.dwLowDateTime;
- now_int64.HighPart = now_filetime.dwHighDateTime;
- now_int64.QuadPart = (now_int64.QuadPart / kTenthMicrosInMilliSecond) -
- kJavaEpochToWinFileTimeDelta;
- return now_int64.QuadPart;
- }
- return 0;
-#elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_
- __timeb64 now;
-
- // MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996
- // (deprecated function) there.
- // TODO(kenton@google.com): Use GetTickCount()? Or use
- // SystemTimeToFileTime()
- GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
- _ftime64(&now);
- GTEST_DISABLE_MSC_WARNINGS_POP_()
-
- return static_cast<TimeInMillis>(now.time) * 1000 + now.millitm;
-#elif GTEST_HAS_GETTIMEOFDAY_
- struct timeval now;
- gettimeofday(&now, NULL);
- return static_cast<TimeInMillis>(now.tv_sec) * 1000 + now.tv_usec / 1000;
-#else
-# error "Don't know how to get the current time on your system."
-#endif
-}
-
-// Utilities
-
-// class String.
-
-#if GTEST_OS_WINDOWS_MOBILE
-// Creates a UTF-16 wide string from the given ANSI string, allocating
-// memory using new. The caller is responsible for deleting the return
-// value using delete[]. Returns the wide string, or NULL if the
-// input is NULL.
-LPCWSTR String::AnsiToUtf16(const char* ansi) {
- if (!ansi) return NULL;
- const int length = strlen(ansi);
- const int unicode_length =
- MultiByteToWideChar(CP_ACP, 0, ansi, length,
- NULL, 0);
- WCHAR* unicode = new WCHAR[unicode_length + 1];
- MultiByteToWideChar(CP_ACP, 0, ansi, length,
- unicode, unicode_length);
- unicode[unicode_length] = 0;
- return unicode;
-}
-
-// Creates an ANSI string from the given wide string, allocating
-// memory using new. The caller is responsible for deleting the return
-// value using delete[]. Returns the ANSI string, or NULL if the
-// input is NULL.
-const char* String::Utf16ToAnsi(LPCWSTR utf16_str) {
- if (!utf16_str) return NULL;
- const int ansi_length =
- WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,
- NULL, 0, NULL, NULL);
- char* ansi = new char[ansi_length + 1];
- WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,
- ansi, ansi_length, NULL, NULL);
- ansi[ansi_length] = 0;
- return ansi;
-}
-
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-// Compares two C strings. Returns true iff they have the same content.
-//
-// Unlike strcmp(), this function can handle NULL argument(s). A NULL
-// C string is considered different to any non-NULL C string,
-// including the empty string.
-bool String::CStringEquals(const char * lhs, const char * rhs) {
- if ( lhs == NULL ) return rhs == NULL;
-
- if ( rhs == NULL ) return false;
-
- return strcmp(lhs, rhs) == 0;
-}
-
-#if GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
-
-// Converts an array of wide chars to a narrow string using the UTF-8
-// encoding, and streams the result to the given Message object.
-static void StreamWideCharsToMessage(const wchar_t* wstr, size_t length,
- Message* msg) {
- for (size_t i = 0; i != length; ) { // NOLINT
- if (wstr[i] != L'\0') {
- *msg << WideStringToUtf8(wstr + i, static_cast<int>(length - i));
- while (i != length && wstr[i] != L'\0')
- i++;
- } else {
- *msg << '\0';
- i++;
- }
- }
-}
-
-#endif // GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
-
-} // namespace internal
-
-// Constructs an empty Message.
-// We allocate the stringstream separately because otherwise each use of
-// ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's
-// stack frame leading to huge stack frames in some cases; gcc does not reuse
-// the stack space.
-Message::Message() : ss_(new ::std::stringstream) {
- // By default, we want there to be enough precision when printing
- // a double to a Message.
- *ss_ << std::setprecision(std::numeric_limits<double>::digits10 + 2);
-}
-
-// These two overloads allow streaming a wide C string to a Message
-// using the UTF-8 encoding.
-Message& Message::operator <<(const wchar_t* wide_c_str) {
- return *this << internal::String::ShowWideCString(wide_c_str);
-}
-Message& Message::operator <<(wchar_t* wide_c_str) {
- return *this << internal::String::ShowWideCString(wide_c_str);
-}
-
-#if GTEST_HAS_STD_WSTRING
-// Converts the given wide string to a narrow string using the UTF-8
-// encoding, and streams the result to this Message object.
-Message& Message::operator <<(const ::std::wstring& wstr) {
- internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);
- return *this;
-}
-#endif // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
-// Converts the given wide string to a narrow string using the UTF-8
-// encoding, and streams the result to this Message object.
-Message& Message::operator <<(const ::wstring& wstr) {
- internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);
- return *this;
-}
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-// Gets the text streamed to this object so far as an std::string.
-// Each '\0' character in the buffer is replaced with "\\0".
-std::string Message::GetString() const {
- return internal::StringStreamToString(ss_.get());
-}
-
-// AssertionResult constructors.
-// Used in EXPECT_TRUE/FALSE(assertion_result).
-AssertionResult::AssertionResult(const AssertionResult& other)
- : success_(other.success_),
- message_(other.message_.get() != NULL ?
- new ::std::string(*other.message_) :
- static_cast< ::std::string*>(NULL)) {
-}
-
-// Swaps two AssertionResults.
-void AssertionResult::swap(AssertionResult& other) {
- using std::swap;
- swap(success_, other.success_);
- swap(message_, other.message_);
-}
-
-// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
-AssertionResult AssertionResult::operator!() const {
- AssertionResult negation(!success_);
- if (message_.get() != NULL)
- negation << *message_;
- return negation;
-}
-
-// Makes a successful assertion result.
-AssertionResult AssertionSuccess() {
- return AssertionResult(true);
-}
-
-// Makes a failed assertion result.
-AssertionResult AssertionFailure() {
- return AssertionResult(false);
-}
-
-// Makes a failed assertion result with the given failure message.
-// Deprecated; use AssertionFailure() << message.
-AssertionResult AssertionFailure(const Message& message) {
- return AssertionFailure() << message;
-}
-
-namespace internal {
-
-// Constructs and returns the message for an equality assertion
-// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
-//
-// The first four parameters are the expressions used in the assertion
-// and their values, as strings. For example, for ASSERT_EQ(foo, bar)
-// where foo is 5 and bar is 6, we have:
-//
-// expected_expression: "foo"
-// actual_expression: "bar"
-// expected_value: "5"
-// actual_value: "6"
-//
-// The ignoring_case parameter is true iff the assertion is a
-// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
-// be inserted into the message.
-AssertionResult EqFailure(const char* expected_expression,
- const char* actual_expression,
- const std::string& expected_value,
- const std::string& actual_value,
- bool ignoring_case) {
- Message msg;
- msg << "Value of: " << actual_expression;
- if (actual_value != actual_expression) {
- msg << "\n Actual: " << actual_value;
- }
-
- msg << "\nExpected: " << expected_expression;
- if (ignoring_case) {
- msg << " (ignoring case)";
- }
- if (expected_value != expected_expression) {
- msg << "\nWhich is: " << expected_value;
- }
-
- return AssertionFailure() << msg;
-}
-
-// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
-std::string GetBoolAssertionFailureMessage(
- const AssertionResult& assertion_result,
- const char* expression_text,
- const char* actual_predicate_value,
- const char* expected_predicate_value) {
- const char* actual_message = assertion_result.message();
- Message msg;
- msg << "Value of: " << expression_text
- << "\n Actual: " << actual_predicate_value;
- if (actual_message[0] != '\0')
- msg << " (" << actual_message << ")";
- msg << "\nExpected: " << expected_predicate_value;
- return msg.GetString();
-}
-
-// Helper function for implementing ASSERT_NEAR.
-AssertionResult DoubleNearPredFormat(const char* expr1,
- const char* expr2,
- const char* abs_error_expr,
- double val1,
- double val2,
- double abs_error) {
- const double diff = fabs(val1 - val2);
- if (diff <= abs_error) return AssertionSuccess();
-
- // TODO(wan): do not print the value of an expression if it's
- // already a literal.
- return AssertionFailure()
- << "The difference between " << expr1 << " and " << expr2
- << " is " << diff << ", which exceeds " << abs_error_expr << ", where\n"
- << expr1 << " evaluates to " << val1 << ",\n"
- << expr2 << " evaluates to " << val2 << ", and\n"
- << abs_error_expr << " evaluates to " << abs_error << ".";
-}
-
-
-// Helper template for implementing FloatLE() and DoubleLE().
-template <typename RawType>
-AssertionResult FloatingPointLE(const char* expr1,
- const char* expr2,
- RawType val1,
- RawType val2) {
- // Returns success if val1 is less than val2,
- if (val1 < val2) {
- return AssertionSuccess();
- }
-
- // or if val1 is almost equal to val2.
- const FloatingPoint<RawType> lhs(val1), rhs(val2);
- if (lhs.AlmostEquals(rhs)) {
- return AssertionSuccess();
- }
-
- // Note that the above two checks will both fail if either val1 or
- // val2 is NaN, as the IEEE floating-point standard requires that
- // any predicate involving a NaN must return false.
-
- ::std::stringstream val1_ss;
- val1_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << val1;
-
- ::std::stringstream val2_ss;
- val2_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << val2;
-
- return AssertionFailure()
- << "Expected: (" << expr1 << ") <= (" << expr2 << ")\n"
- << " Actual: " << StringStreamToString(&val1_ss) << " vs "
- << StringStreamToString(&val2_ss);
-}
-
-} // namespace internal
-
-// Asserts that val1 is less than, or almost equal to, val2. Fails
-// otherwise. In particular, it fails if either val1 or val2 is NaN.
-AssertionResult FloatLE(const char* expr1, const char* expr2,
- float val1, float val2) {
- return internal::FloatingPointLE<float>(expr1, expr2, val1, val2);
-}
-
-// Asserts that val1 is less than, or almost equal to, val2. Fails
-// otherwise. In particular, it fails if either val1 or val2 is NaN.
-AssertionResult DoubleLE(const char* expr1, const char* expr2,
- double val1, double val2) {
- return internal::FloatingPointLE<double>(expr1, expr2, val1, val2);
-}
-
-namespace internal {
-
-// The helper function for {ASSERT|EXPECT}_EQ with int or enum
-// arguments.
-AssertionResult CmpHelperEQ(const char* expected_expression,
- const char* actual_expression,
- BiggestInt expected,
- BiggestInt actual) {
- if (expected == actual) {
- return AssertionSuccess();
- }
-
- return EqFailure(expected_expression,
- actual_expression,
- FormatForComparisonFailureMessage(expected, actual),
- FormatForComparisonFailureMessage(actual, expected),
- false);
-}
-
-// A macro for implementing the helper functions needed to implement
-// ASSERT_?? and EXPECT_?? with integer or enum arguments. It is here
-// just to avoid copy-and-paste of similar code.
-#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
-AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
- BiggestInt val1, BiggestInt val2) {\
- if (val1 op val2) {\
- return AssertionSuccess();\
- } else {\
- return AssertionFailure() \
- << "Expected: (" << expr1 << ") " #op " (" << expr2\
- << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
- << " vs " << FormatForComparisonFailureMessage(val2, val1);\
- }\
-}
-
-// Implements the helper function for {ASSERT|EXPECT}_NE with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(NE, !=)
-// Implements the helper function for {ASSERT|EXPECT}_LE with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(LE, <=)
-// Implements the helper function for {ASSERT|EXPECT}_LT with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(LT, < )
-// Implements the helper function for {ASSERT|EXPECT}_GE with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(GE, >=)
-// Implements the helper function for {ASSERT|EXPECT}_GT with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(GT, > )
-
-#undef GTEST_IMPL_CMP_HELPER_
-
-// The helper function for {ASSERT|EXPECT}_STREQ.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual) {
- if (String::CStringEquals(expected, actual)) {
- return AssertionSuccess();
- }
-
- return EqFailure(expected_expression,
- actual_expression,
- PrintToString(expected),
- PrintToString(actual),
- false);
-}
-
-// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
-AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual) {
- if (String::CaseInsensitiveCStringEquals(expected, actual)) {
- return AssertionSuccess();
- }
-
- return EqFailure(expected_expression,
- actual_expression,
- PrintToString(expected),
- PrintToString(actual),
- true);
-}
-
-// The helper function for {ASSERT|EXPECT}_STRNE.
-AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2) {
- if (!String::CStringEquals(s1, s2)) {
- return AssertionSuccess();
- } else {
- return AssertionFailure() << "Expected: (" << s1_expression << ") != ("
- << s2_expression << "), actual: \""
- << s1 << "\" vs \"" << s2 << "\"";
- }
-}
-
-// The helper function for {ASSERT|EXPECT}_STRCASENE.
-AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2) {
- if (!String::CaseInsensitiveCStringEquals(s1, s2)) {
- return AssertionSuccess();
- } else {
- return AssertionFailure()
- << "Expected: (" << s1_expression << ") != ("
- << s2_expression << ") (ignoring case), actual: \""
- << s1 << "\" vs \"" << s2 << "\"";
- }
-}
-
-} // namespace internal
-
-namespace {
-
-// Helper functions for implementing IsSubString() and IsNotSubstring().
-
-// This group of overloaded functions return true iff needle is a
-// substring of haystack. NULL is considered a substring of itself
-// only.
-
-bool IsSubstringPred(const char* needle, const char* haystack) {
- if (needle == NULL || haystack == NULL)
- return needle == haystack;
-
- return strstr(haystack, needle) != NULL;
-}
-
-bool IsSubstringPred(const wchar_t* needle, const wchar_t* haystack) {
- if (needle == NULL || haystack == NULL)
- return needle == haystack;
-
- return wcsstr(haystack, needle) != NULL;
-}
-
-// StringType here can be either ::std::string or ::std::wstring.
-template <typename StringType>
-bool IsSubstringPred(const StringType& needle,
- const StringType& haystack) {
- return haystack.find(needle) != StringType::npos;
-}
-
-// This function implements either IsSubstring() or IsNotSubstring(),
-// depending on the value of the expected_to_be_substring parameter.
-// StringType here can be const char*, const wchar_t*, ::std::string,
-// or ::std::wstring.
-template <typename StringType>
-AssertionResult IsSubstringImpl(
- bool expected_to_be_substring,
- const char* needle_expr, const char* haystack_expr,
- const StringType& needle, const StringType& haystack) {
- if (IsSubstringPred(needle, haystack) == expected_to_be_substring)
- return AssertionSuccess();
-
- const bool is_wide_string = sizeof(needle[0]) > 1;
- const char* const begin_string_quote = is_wide_string ? "L\"" : "\"";
- return AssertionFailure()
- << "Value of: " << needle_expr << "\n"
- << " Actual: " << begin_string_quote << needle << "\"\n"
- << "Expected: " << (expected_to_be_substring ? "" : "not ")
- << "a substring of " << haystack_expr << "\n"
- << "Which is: " << begin_string_quote << haystack << "\"";
-}
-
-} // namespace
-
-// IsSubstring() and IsNotSubstring() check whether needle is a
-// substring of haystack (NULL is considered a substring of itself
-// only), and return an appropriate error message when they fail.
-
-AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const char* needle, const char* haystack) {
- return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const wchar_t* needle, const wchar_t* haystack) {
- return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const char* needle, const char* haystack) {
- return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const wchar_t* needle, const wchar_t* haystack) {
- return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::string& needle, const ::std::string& haystack) {
- return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::string& needle, const ::std::string& haystack) {
- return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-
-#if GTEST_HAS_STD_WSTRING
-AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::wstring& needle, const ::std::wstring& haystack) {
- return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::wstring& needle, const ::std::wstring& haystack) {
- return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-#endif // GTEST_HAS_STD_WSTRING
-
-namespace internal {
-
-#if GTEST_OS_WINDOWS
-
-namespace {
-
-// Helper function for IsHRESULT{SuccessFailure} predicates
-AssertionResult HRESULTFailureHelper(const char* expr,
- const char* expected,
- long hr) { // NOLINT
-# if GTEST_OS_WINDOWS_MOBILE
-
- // Windows CE doesn't support FormatMessage.
- const char error_text[] = "";
-
-# else
-
- // Looks up the human-readable system message for the HRESULT code
- // and since we're not passing any params to FormatMessage, we don't
- // want inserts expanded.
- const DWORD kFlags = FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS;
- const DWORD kBufSize = 4096;
- // Gets the system's human readable message string for this HRESULT.
- char error_text[kBufSize] = { '\0' };
- DWORD message_length = ::FormatMessageA(kFlags,
- 0, // no source, we're asking system
- hr, // the error
- 0, // no line width restrictions
- error_text, // output buffer
- kBufSize, // buf size
- NULL); // no arguments for inserts
- // Trims tailing white space (FormatMessage leaves a trailing CR-LF)
- for (; message_length && IsSpace(error_text[message_length - 1]);
- --message_length) {
- error_text[message_length - 1] = '\0';
- }
-
-# endif // GTEST_OS_WINDOWS_MOBILE
-
- const std::string error_hex("0x" + String::FormatHexInt(hr));
- return ::testing::AssertionFailure()
- << "Expected: " << expr << " " << expected << ".\n"
- << " Actual: " << error_hex << " " << error_text << "\n";
-}
-
-} // namespace
-
-AssertionResult IsHRESULTSuccess(const char* expr, long hr) { // NOLINT
- if (SUCCEEDED(hr)) {
- return AssertionSuccess();
- }
- return HRESULTFailureHelper(expr, "succeeds", hr);
-}
-
-AssertionResult IsHRESULTFailure(const char* expr, long hr) { // NOLINT
- if (FAILED(hr)) {
- return AssertionSuccess();
- }
- return HRESULTFailureHelper(expr, "fails", hr);
-}
-
-#endif // GTEST_OS_WINDOWS
-
-// Utility functions for encoding Unicode text (wide strings) in
-// UTF-8.
-
-// A Unicode code-point can have upto 21 bits, and is encoded in UTF-8
-// like this:
-//
-// Code-point length Encoding
-// 0 - 7 bits 0xxxxxxx
-// 8 - 11 bits 110xxxxx 10xxxxxx
-// 12 - 16 bits 1110xxxx 10xxxxxx 10xxxxxx
-// 17 - 21 bits 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
-
-// The maximum code-point a one-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint1 = (static_cast<UInt32>(1) << 7) - 1;
-
-// The maximum code-point a two-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint2 = (static_cast<UInt32>(1) << (5 + 6)) - 1;
-
-// The maximum code-point a three-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint3 = (static_cast<UInt32>(1) << (4 + 2*6)) - 1;
-
-// The maximum code-point a four-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint4 = (static_cast<UInt32>(1) << (3 + 3*6)) - 1;
-
-// Chops off the n lowest bits from a bit pattern. Returns the n
-// lowest bits. As a side effect, the original bit pattern will be
-// shifted to the right by n bits.
-inline UInt32 ChopLowBits(UInt32* bits, int n) {
- const UInt32 low_bits = *bits & ((static_cast<UInt32>(1) << n) - 1);
- *bits >>= n;
- return low_bits;
-}
-
-// Converts a Unicode code point to a narrow string in UTF-8 encoding.
-// code_point parameter is of type UInt32 because wchar_t may not be
-// wide enough to contain a code point.
-// If the code_point is not a valid Unicode code point
-// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted
-// to "(Invalid Unicode 0xXXXXXXXX)".
-std::string CodePointToUtf8(UInt32 code_point) {
- if (code_point > kMaxCodePoint4) {
- return "(Invalid Unicode 0x" + String::FormatHexInt(code_point) + ")";
- }
-
- char str[5]; // Big enough for the largest valid code point.
- if (code_point <= kMaxCodePoint1) {
- str[1] = '\0';
- str[0] = static_cast<char>(code_point); // 0xxxxxxx
- } else if (code_point <= kMaxCodePoint2) {
- str[2] = '\0';
- str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[0] = static_cast<char>(0xC0 | code_point); // 110xxxxx
- } else if (code_point <= kMaxCodePoint3) {
- str[3] = '\0';
- str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[0] = static_cast<char>(0xE0 | code_point); // 1110xxxx
- } else { // code_point <= kMaxCodePoint4
- str[4] = '\0';
- str[3] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[0] = static_cast<char>(0xF0 | code_point); // 11110xxx
- }
- return str;
-}
-
-// The following two functions only make sense if the the system
-// uses UTF-16 for wide string encoding. All supported systems
-// with 16 bit wchar_t (Windows, Cygwin, Symbian OS) do use UTF-16.
-
-// Determines if the arguments constitute UTF-16 surrogate pair
-// and thus should be combined into a single Unicode code point
-// using CreateCodePointFromUtf16SurrogatePair.
-inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {
- return sizeof(wchar_t) == 2 &&
- (first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00;
-}
-
-// Creates a Unicode code point from UTF16 surrogate pair.
-inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
- wchar_t second) {
- const UInt32 mask = (1 << 10) - 1;
- return (sizeof(wchar_t) == 2) ?
- (((first & mask) << 10) | (second & mask)) + 0x10000 :
- // This function should not be called when the condition is
- // false, but we provide a sensible default in case it is.
- static_cast<UInt32>(first);
-}
-
-// Converts a wide string to a narrow string in UTF-8 encoding.
-// The wide string is assumed to have the following encoding:
-// UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)
-// UTF-32 if sizeof(wchar_t) == 4 (on Linux)
-// Parameter str points to a null-terminated wide string.
-// Parameter num_chars may additionally limit the number
-// of wchar_t characters processed. -1 is used when the entire string
-// should be processed.
-// If the string contains code points that are not valid Unicode code points
-// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output
-// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
-// and contains invalid UTF-16 surrogate pairs, values in those pairs
-// will be encoded as individual Unicode characters from Basic Normal Plane.
-std::string WideStringToUtf8(const wchar_t* str, int num_chars) {
- if (num_chars == -1)
- num_chars = static_cast<int>(wcslen(str));
-
- ::std::stringstream stream;
- for (int i = 0; i < num_chars; ++i) {
- UInt32 unicode_code_point;
-
- if (str[i] == L'\0') {
- break;
- } else if (i + 1 < num_chars && IsUtf16SurrogatePair(str[i], str[i + 1])) {
- unicode_code_point = CreateCodePointFromUtf16SurrogatePair(str[i],
- str[i + 1]);
- i++;
- } else {
- unicode_code_point = static_cast<UInt32>(str[i]);
- }
-
- stream << CodePointToUtf8(unicode_code_point);
- }
- return StringStreamToString(&stream);
-}
-
-// Converts a wide C string to an std::string using the UTF-8 encoding.
-// NULL will be converted to "(null)".
-std::string String::ShowWideCString(const wchar_t * wide_c_str) {
- if (wide_c_str == NULL) return "(null)";
-
- return internal::WideStringToUtf8(wide_c_str, -1);
-}
-
-// Compares two wide C strings. Returns true iff they have the same
-// content.
-//
-// Unlike wcscmp(), this function can handle NULL argument(s). A NULL
-// C string is considered different to any non-NULL C string,
-// including the empty string.
-bool String::WideCStringEquals(const wchar_t * lhs, const wchar_t * rhs) {
- if (lhs == NULL) return rhs == NULL;
-
- if (rhs == NULL) return false;
-
- return wcscmp(lhs, rhs) == 0;
-}
-
-// Helper function for *_STREQ on wide strings.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const wchar_t* expected,
- const wchar_t* actual) {
- if (String::WideCStringEquals(expected, actual)) {
- return AssertionSuccess();
- }
-
- return EqFailure(expected_expression,
- actual_expression,
- PrintToString(expected),
- PrintToString(actual),
- false);
-}
-
-// Helper function for *_STRNE on wide strings.
-AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const wchar_t* s1,
- const wchar_t* s2) {
- if (!String::WideCStringEquals(s1, s2)) {
- return AssertionSuccess();
- }
-
- return AssertionFailure() << "Expected: (" << s1_expression << ") != ("
- << s2_expression << "), actual: "
- << PrintToString(s1)
- << " vs " << PrintToString(s2);
-}
-
-// Compares two C strings, ignoring case. Returns true iff they have
-// the same content.
-//
-// Unlike strcasecmp(), this function can handle NULL argument(s). A
-// NULL C string is considered different to any non-NULL C string,
-// including the empty string.
-bool String::CaseInsensitiveCStringEquals(const char * lhs, const char * rhs) {
- if (lhs == NULL)
- return rhs == NULL;
- if (rhs == NULL)
- return false;
- return posix::StrCaseCmp(lhs, rhs) == 0;
-}
-
- // Compares two wide C strings, ignoring case. Returns true iff they
- // have the same content.
- //
- // Unlike wcscasecmp(), this function can handle NULL argument(s).
- // A NULL C string is considered different to any non-NULL wide C string,
- // including the empty string.
- // NB: The implementations on different platforms slightly differ.
- // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
- // environment variable. On GNU platform this method uses wcscasecmp
- // which compares according to LC_CTYPE category of the current locale.
- // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
- // current locale.
-bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
- const wchar_t* rhs) {
- if (lhs == NULL) return rhs == NULL;
-
- if (rhs == NULL) return false;
-
-#if GTEST_OS_WINDOWS
- return _wcsicmp(lhs, rhs) == 0;
-#elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID
- return wcscasecmp(lhs, rhs) == 0;
-#else
- // Android, Mac OS X and Cygwin don't define wcscasecmp.
- // Other unknown OSes may not define it either.
- wint_t left, right;
- do {
- left = towlower(*lhs++);
- right = towlower(*rhs++);
- } while (left && left == right);
- return left == right;
-#endif // OS selector
-}
-
-// Returns true iff str ends with the given suffix, ignoring case.
-// Any string is considered to end with an empty suffix.
-bool String::EndsWithCaseInsensitive(
- const std::string& str, const std::string& suffix) {
- const size_t str_len = str.length();
- const size_t suffix_len = suffix.length();
- return (str_len >= suffix_len) &&
- CaseInsensitiveCStringEquals(str.c_str() + str_len - suffix_len,
- suffix.c_str());
-}
-
-// Formats an int value as "%02d".
-std::string String::FormatIntWidth2(int value) {
- std::stringstream ss;
- ss << std::setfill('0') << std::setw(2) << value;
- return ss.str();
-}
-
-// Formats an int value as "%X".
-std::string String::FormatHexInt(int value) {
- std::stringstream ss;
- ss << std::hex << std::uppercase << value;
- return ss.str();
-}
-
-// Formats a byte as "%02X".
-std::string String::FormatByte(unsigned char value) {
- std::stringstream ss;
- ss << std::setfill('0') << std::setw(2) << std::hex << std::uppercase
- << static_cast<unsigned int>(value);
- return ss.str();
-}
-
-// Converts the buffer in a stringstream to an std::string, converting NUL
-// bytes to "\\0" along the way.
-std::string StringStreamToString(::std::stringstream* ss) {
- const ::std::string& str = ss->str();
- const char* const start = str.c_str();
- const char* const end = start + str.length();
-
- std::string result;
- result.reserve(2 * (end - start));
- for (const char* ch = start; ch != end; ++ch) {
- if (*ch == '\0') {
- result += "\\0"; // Replaces NUL with "\\0";
- } else {
- result += *ch;
- }
- }
-
- return result;
-}
-
-// Appends the user-supplied message to the Google-Test-generated message.
-std::string AppendUserMessage(const std::string& gtest_msg,
- const Message& user_msg) {
- // Appends the user message if it's non-empty.
- const std::string user_msg_string = user_msg.GetString();
- if (user_msg_string.empty()) {
- return gtest_msg;
- }
-
- return gtest_msg + "\n" + user_msg_string;
-}
-
-} // namespace internal
-
-// class TestResult
-
-// Creates an empty TestResult.
-TestResult::TestResult()
- : death_test_count_(0),
- elapsed_time_(0) {
-}
-
-// D'tor.
-TestResult::~TestResult() {
-}
-
-// Returns the i-th test part result among all the results. i can
-// range from 0 to total_part_count() - 1. If i is not in that range,
-// aborts the program.
-const TestPartResult& TestResult::GetTestPartResult(int i) const {
- if (i < 0 || i >= total_part_count())
- internal::posix::Abort();
- return test_part_results_.at(i);
-}
-
-// Returns the i-th test property. i can range from 0 to
-// test_property_count() - 1. If i is not in that range, aborts the
-// program.
-const TestProperty& TestResult::GetTestProperty(int i) const {
- if (i < 0 || i >= test_property_count())
- internal::posix::Abort();
- return test_properties_.at(i);
-}
-
-// Clears the test part results.
-void TestResult::ClearTestPartResults() {
- test_part_results_.clear();
-}
-
-// Adds a test part result to the list.
-void TestResult::AddTestPartResult(const TestPartResult& test_part_result) {
- test_part_results_.push_back(test_part_result);
-}
-
-// Adds a test property to the list. If a property with the same key as the
-// supplied property is already represented, the value of this test_property
-// replaces the old value for that key.
-void TestResult::RecordProperty(const std::string& xml_element,
- const TestProperty& test_property) {
- if (!ValidateTestProperty(xml_element, test_property)) {
- return;
- }
- internal::MutexLock lock(&test_properites_mutex_);
- const std::vector<TestProperty>::iterator property_with_matching_key =
- std::find_if(test_properties_.begin(), test_properties_.end(),
- internal::TestPropertyKeyIs(test_property.key()));
- if (property_with_matching_key == test_properties_.end()) {
- test_properties_.push_back(test_property);
- return;
- }
- property_with_matching_key->SetValue(test_property.value());
-}
-
-// The list of reserved attributes used in the <testsuites> element of XML
-// output.
-static const char* const kReservedTestSuitesAttributes[] = {
- "disabled",
- "errors",
- "failures",
- "name",
- "random_seed",
- "tests",
- "time",
- "timestamp"
-};
-
-// The list of reserved attributes used in the <testsuite> element of XML
-// output.
-static const char* const kReservedTestSuiteAttributes[] = {
- "disabled",
- "errors",
- "failures",
- "name",
- "tests",
- "time"
-};
-
-// The list of reserved attributes used in the <testcase> element of XML output.
-static const char* const kReservedTestCaseAttributes[] = {
- "classname",
- "name",
- "status",
- "time",
- "type_param",
- "value_param"
-};
-
-template <int kSize>
-std::vector<std::string> ArrayAsVector(const char* const (&array)[kSize]) {
- return std::vector<std::string>(array, array + kSize);
-}
-
-static std::vector<std::string> GetReservedAttributesForElement(
- const std::string& xml_element) {
- if (xml_element == "testsuites") {
- return ArrayAsVector(kReservedTestSuitesAttributes);
- } else if (xml_element == "testsuite") {
- return ArrayAsVector(kReservedTestSuiteAttributes);
- } else if (xml_element == "testcase") {
- return ArrayAsVector(kReservedTestCaseAttributes);
- } else {
- GTEST_CHECK_(false) << "Unrecognized xml_element provided: " << xml_element;
- }
- // This code is unreachable but some compilers may not realizes that.
- return std::vector<std::string>();
-}
-
-static std::string FormatWordList(const std::vector<std::string>& words) {
- Message word_list;
- for (size_t i = 0; i < words.size(); ++i) {
- if (i > 0 && words.size() > 2) {
- word_list << ", ";
- }
- if (i == words.size() - 1) {
- word_list << "and ";
- }
- word_list << "'" << words[i] << "'";
- }
- return word_list.GetString();
-}
-
-bool ValidateTestPropertyName(const std::string& property_name,
- const std::vector<std::string>& reserved_names) {
- if (std::find(reserved_names.begin(), reserved_names.end(), property_name) !=
- reserved_names.end()) {
- ADD_FAILURE() << "Reserved key used in RecordProperty(): " << property_name
- << " (" << FormatWordList(reserved_names)
- << " are reserved by " << GTEST_NAME_ << ")";
- return false;
- }
- return true;
-}
-
-// Adds a failure if the key is a reserved attribute of the element named
-// xml_element. Returns true if the property is valid.
-bool TestResult::ValidateTestProperty(const std::string& xml_element,
- const TestProperty& test_property) {
- return ValidateTestPropertyName(test_property.key(),
- GetReservedAttributesForElement(xml_element));
-}
-
-// Clears the object.
-void TestResult::Clear() {
- test_part_results_.clear();
- test_properties_.clear();
- death_test_count_ = 0;
- elapsed_time_ = 0;
-}
-
-// Returns true iff the test failed.
-bool TestResult::Failed() const {
- for (int i = 0; i < total_part_count(); ++i) {
- if (GetTestPartResult(i).failed())
- return true;
- }
- return false;
-}
-
-// Returns true iff the test part fatally failed.
-static bool TestPartFatallyFailed(const TestPartResult& result) {
- return result.fatally_failed();
-}
-
-// Returns true iff the test fatally failed.
-bool TestResult::HasFatalFailure() const {
- return CountIf(test_part_results_, TestPartFatallyFailed) > 0;
-}
-
-// Returns true iff the test part non-fatally failed.
-static bool TestPartNonfatallyFailed(const TestPartResult& result) {
- return result.nonfatally_failed();
-}
-
-// Returns true iff the test has a non-fatal failure.
-bool TestResult::HasNonfatalFailure() const {
- return CountIf(test_part_results_, TestPartNonfatallyFailed) > 0;
-}
-
-// Gets the number of all test parts. This is the sum of the number
-// of successful test parts and the number of failed test parts.
-int TestResult::total_part_count() const {
- return static_cast<int>(test_part_results_.size());
-}
-
-// Returns the number of the test properties.
-int TestResult::test_property_count() const {
- return static_cast<int>(test_properties_.size());
-}
-
-// class Test
-
-// Creates a Test object.
-
-// The c'tor saves the values of all Google Test flags.
-Test::Test()
- : gtest_flag_saver_(new internal::GTestFlagSaver) {
-}
-
-// The d'tor restores the values of all Google Test flags.
-Test::~Test() {
- delete gtest_flag_saver_;
-}
-
-// Sets up the test fixture.
-//
-// A sub-class may override this.
-void Test::SetUp() {
-}
-
-// Tears down the test fixture.
-//
-// A sub-class may override this.
-void Test::TearDown() {
-}
-
-// Allows user supplied key value pairs to be recorded for later output.
-void Test::RecordProperty(const std::string& key, const std::string& value) {
- UnitTest::GetInstance()->RecordProperty(key, value);
-}
-
-// Allows user supplied key value pairs to be recorded for later output.
-void Test::RecordProperty(const std::string& key, int value) {
- Message value_message;
- value_message << value;
- RecordProperty(key, value_message.GetString().c_str());
-}
-
-namespace internal {
-
-void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
- const std::string& message) {
- // This function is a friend of UnitTest and as such has access to
- // AddTestPartResult.
- UnitTest::GetInstance()->AddTestPartResult(
- result_type,
- NULL, // No info about the source file where the exception occurred.
- -1, // We have no info on which line caused the exception.
- message,
- ""); // No stack trace, either.
-}
-
-} // namespace internal
-
-// Google Test requires all tests in the same test case to use the same test
-// fixture class. This function checks if the current test has the
-// same fixture class as the first test in the current test case. If
-// yes, it returns true; otherwise it generates a Google Test failure and
-// returns false.
-bool Test::HasSameFixtureClass() {
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- const TestCase* const test_case = impl->current_test_case();
-
- // Info about the first test in the current test case.
- const TestInfo* const first_test_info = test_case->test_info_list()[0];
- const internal::TypeId first_fixture_id = first_test_info->fixture_class_id_;
- const char* const first_test_name = first_test_info->name();
-
- // Info about the current test.
- const TestInfo* const this_test_info = impl->current_test_info();
- const internal::TypeId this_fixture_id = this_test_info->fixture_class_id_;
- const char* const this_test_name = this_test_info->name();
-
- if (this_fixture_id != first_fixture_id) {
- // Is the first test defined using TEST?
- const bool first_is_TEST = first_fixture_id == internal::GetTestTypeId();
- // Is this test defined using TEST?
- const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId();
-
- if (first_is_TEST || this_is_TEST) {
- // The user mixed TEST and TEST_F in this test case - we'll tell
- // him/her how to fix it.
-
- // Gets the name of the TEST and the name of the TEST_F. Note
- // that first_is_TEST and this_is_TEST cannot both be true, as
- // the fixture IDs are different for the two tests.
- const char* const TEST_name =
- first_is_TEST ? first_test_name : this_test_name;
- const char* const TEST_F_name =
- first_is_TEST ? this_test_name : first_test_name;
-
- ADD_FAILURE()
- << "All tests in the same test case must use the same test fixture\n"
- << "class, so mixing TEST_F and TEST in the same test case is\n"
- << "illegal. In test case " << this_test_info->test_case_name()
- << ",\n"
- << "test " << TEST_F_name << " is defined using TEST_F but\n"
- << "test " << TEST_name << " is defined using TEST. You probably\n"
- << "want to change the TEST to TEST_F or move it to another test\n"
- << "case.";
- } else {
- // The user defined two fixture classes with the same name in
- // two namespaces - we'll tell him/her how to fix it.
- ADD_FAILURE()
- << "All tests in the same test case must use the same test fixture\n"
- << "class. However, in test case "
- << this_test_info->test_case_name() << ",\n"
- << "you defined test " << first_test_name
- << " and test " << this_test_name << "\n"
- << "using two different test fixture classes. This can happen if\n"
- << "the two classes are from different namespaces or translation\n"
- << "units and have the same name. You should probably rename one\n"
- << "of the classes to put the tests into different test cases.";
- }
- return false;
- }
-
- return true;
-}
-
-#if GTEST_HAS_SEH
-
-// Adds an "exception thrown" fatal failure to the current test. This
-// function returns its result via an output parameter pointer because VC++
-// prohibits creation of objects with destructors on stack in functions
-// using __try (see error C2712).
-static std::string* FormatSehExceptionMessage(DWORD exception_code,
- const char* location) {
- Message message;
- message << "SEH exception with code 0x" << std::setbase(16) <<
- exception_code << std::setbase(10) << " thrown in " << location << ".";
-
- return new std::string(message.GetString());
-}
-
-#endif // GTEST_HAS_SEH
-
-namespace internal {
-
-#if GTEST_HAS_EXCEPTIONS
-
-// Adds an "exception thrown" fatal failure to the current test.
-static std::string FormatCxxExceptionMessage(const char* description,
- const char* location) {
- Message message;
- if (description != NULL) {
- message << "C++ exception with description \"" << description << "\"";
- } else {
- message << "Unknown C++ exception";
- }
- message << " thrown in " << location << ".";
-
- return message.GetString();
-}
-
-static std::string PrintTestPartResultToString(
- const TestPartResult& test_part_result);
-
-GoogleTestFailureException::GoogleTestFailureException(
- const TestPartResult& failure)
- : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {}
-
-#endif // GTEST_HAS_EXCEPTIONS
-
-// We put these helper functions in the internal namespace as IBM's xlC
-// compiler rejects the code if they were declared static.
-
-// Runs the given method and handles SEH exceptions it throws, when
-// SEH is supported; returns the 0-value for type Result in case of an
-// SEH exception. (Microsoft compilers cannot handle SEH and C++
-// exceptions in the same function. Therefore, we provide a separate
-// wrapper function for handling SEH exceptions.)
-template <class T, typename Result>
-Result HandleSehExceptionsInMethodIfSupported(
- T* object, Result (T::*method)(), const char* location) {
-#if GTEST_HAS_SEH
- __try {
- return (object->*method)();
- } __except (internal::UnitTestOptions::GTestShouldProcessSEH( // NOLINT
- GetExceptionCode())) {
- // We create the exception message on the heap because VC++ prohibits
- // creation of objects with destructors on stack in functions using __try
- // (see error C2712).
- std::string* exception_message = FormatSehExceptionMessage(
- GetExceptionCode(), location);
- internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure,
- *exception_message);
- delete exception_message;
- return static_cast<Result>(0);
- }
-#else
- (void)location;
- return (object->*method)();
-#endif // GTEST_HAS_SEH
-}
-
-// Runs the given method and catches and reports C++ and/or SEH-style
-// exceptions, if they are supported; returns the 0-value for type
-// Result in case of an SEH exception.
-template <class T, typename Result>
-Result HandleExceptionsInMethodIfSupported(
- T* object, Result (T::*method)(), const char* location) {
- // NOTE: The user code can affect the way in which Google Test handles
- // exceptions by setting GTEST_FLAG(catch_exceptions), but only before
- // RUN_ALL_TESTS() starts. It is technically possible to check the flag
- // after the exception is caught and either report or re-throw the
- // exception based on the flag's value:
- //
- // try {
- // // Perform the test method.
- // } catch (...) {
- // if (GTEST_FLAG(catch_exceptions))
- // // Report the exception as failure.
- // else
- // throw; // Re-throws the original exception.
- // }
- //
- // However, the purpose of this flag is to allow the program to drop into
- // the debugger when the exception is thrown. On most platforms, once the
- // control enters the catch block, the exception origin information is
- // lost and the debugger will stop the program at the point of the
- // re-throw in this function -- instead of at the point of the original
- // throw statement in the code under test. For this reason, we perform
- // the check early, sacrificing the ability to affect Google Test's
- // exception handling in the method where the exception is thrown.
- if (internal::GetUnitTestImpl()->catch_exceptions()) {
-#if GTEST_HAS_EXCEPTIONS
- try {
- return HandleSehExceptionsInMethodIfSupported(object, method, location);
- } catch (const internal::GoogleTestFailureException&) { // NOLINT
- // This exception type can only be thrown by a failed Google
- // Test assertion with the intention of letting another testing
- // framework catch it. Therefore we just re-throw it.
- throw;
- } catch (const std::exception& e) { // NOLINT
- internal::ReportFailureInUnknownLocation(
- TestPartResult::kFatalFailure,
- FormatCxxExceptionMessage(e.what(), location));
- } catch (...) { // NOLINT
- internal::ReportFailureInUnknownLocation(
- TestPartResult::kFatalFailure,
- FormatCxxExceptionMessage(NULL, location));
- }
- return static_cast<Result>(0);
-#else
- return HandleSehExceptionsInMethodIfSupported(object, method, location);
-#endif // GTEST_HAS_EXCEPTIONS
- } else {
- return (object->*method)();
- }
-}
-
-} // namespace internal
-
-// Runs the test and updates the test result.
-void Test::Run() {
- if (!HasSameFixtureClass()) return;
-
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, "SetUp()");
- // We will run the test only if SetUp() was successful.
- if (!HasFatalFailure()) {
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- this, &Test::TestBody, "the test body");
- }
-
- // However, we want to clean up as much as possible. Hence we will
- // always call TearDown(), even if SetUp() or the test body has
- // failed.
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- this, &Test::TearDown, "TearDown()");
-}
-
-// Returns true iff the current test has a fatal failure.
-bool Test::HasFatalFailure() {
- return internal::GetUnitTestImpl()->current_test_result()->HasFatalFailure();
-}
-
-// Returns true iff the current test has a non-fatal failure.
-bool Test::HasNonfatalFailure() {
- return internal::GetUnitTestImpl()->current_test_result()->
- HasNonfatalFailure();
-}
-
-// class TestInfo
-
-// Constructs a TestInfo object. It assumes ownership of the test factory
-// object.
-TestInfo::TestInfo(const std::string& a_test_case_name,
- const std::string& a_name,
- const char* a_type_param,
- const char* a_value_param,
- internal::TypeId fixture_class_id,
- internal::TestFactoryBase* factory)
- : test_case_name_(a_test_case_name),
- name_(a_name),
- type_param_(a_type_param ? new std::string(a_type_param) : NULL),
- value_param_(a_value_param ? new std::string(a_value_param) : NULL),
- fixture_class_id_(fixture_class_id),
- should_run_(false),
- is_disabled_(false),
- matches_filter_(false),
- factory_(factory),
- result_() {}
-
-// Destructs a TestInfo object.
-TestInfo::~TestInfo() { delete factory_; }
-
-namespace internal {
-
-// Creates a new TestInfo object and registers it with Google Test;
-// returns the created object.
-//
-// Arguments:
-//
-// test_case_name: name of the test case
-// name: name of the test
-// type_param: the name of the test's type parameter, or NULL if
-// this is not a typed or a type-parameterized test.
-// value_param: text representation of the test's value parameter,
-// or NULL if this is not a value-parameterized test.
-// fixture_class_id: ID of the test fixture class
-// set_up_tc: pointer to the function that sets up the test case
-// tear_down_tc: pointer to the function that tears down the test case
-// factory: pointer to the factory that creates a test object.
-// The newly created TestInfo instance will assume
-// ownership of the factory object.
-TestInfo* MakeAndRegisterTestInfo(
- const char* test_case_name,
- const char* name,
- const char* type_param,
- const char* value_param,
- TypeId fixture_class_id,
- SetUpTestCaseFunc set_up_tc,
- TearDownTestCaseFunc tear_down_tc,
- TestFactoryBase* factory) {
- TestInfo* const test_info =
- new TestInfo(test_case_name, name, type_param, value_param,
- fixture_class_id, factory);
- GetUnitTestImpl()->AddTestInfo(set_up_tc, tear_down_tc, test_info);
- return test_info;
-}
-
-#if GTEST_HAS_PARAM_TEST
-void ReportInvalidTestCaseType(const char* test_case_name,
- const char* file, int line) {
- Message errors;
- errors
- << "Attempted redefinition of test case " << test_case_name << ".\n"
- << "All tests in the same test case must use the same test fixture\n"
- << "class. However, in test case " << test_case_name << ", you tried\n"
- << "to define a test using a fixture class different from the one\n"
- << "used earlier. This can happen if the two fixture classes are\n"
- << "from different namespaces and have the same name. You should\n"
- << "probably rename one of the classes to put the tests into different\n"
- << "test cases.";
-
- fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
- errors.GetString().c_str());
-}
-#endif // GTEST_HAS_PARAM_TEST
-
-} // namespace internal
-
-namespace {
-
-// A predicate that checks the test name of a TestInfo against a known
-// value.
-//
-// This is used for implementation of the TestCase class only. We put
-// it in the anonymous namespace to prevent polluting the outer
-// namespace.
-//
-// TestNameIs is copyable.
-class TestNameIs {
- public:
- // Constructor.
- //
- // TestNameIs has NO default constructor.
- explicit TestNameIs(const char* name)
- : name_(name) {}
-
- // Returns true iff the test name of test_info matches name_.
- bool operator()(const TestInfo * test_info) const {
- return test_info && test_info->name() == name_;
- }
-
- private:
- std::string name_;
-};
-
-} // namespace
-
-namespace internal {
-
-// This method expands all parameterized tests registered with macros TEST_P
-// and INSTANTIATE_TEST_CASE_P into regular tests and registers those.
-// This will be done just once during the program runtime.
-void UnitTestImpl::RegisterParameterizedTests() {
-#if GTEST_HAS_PARAM_TEST
- if (!parameterized_tests_registered_) {
- parameterized_test_registry_.RegisterTests();
- parameterized_tests_registered_ = true;
- }
-#endif
-}
-
-} // namespace internal
-
-// Creates the test object, runs it, records its result, and then
-// deletes it.
-void TestInfo::Run() {
- if (!should_run_) return;
-
- // Tells UnitTest where to store test result.
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- impl->set_current_test_info(this);
-
- TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
-
- // Notifies the unit test event listeners that a test is about to start.
- repeater->OnTestStart(*this);
-
- const TimeInMillis start = internal::GetTimeInMillis();
-
- impl->os_stack_trace_getter()->UponLeavingGTest();
-
- // Creates the test object.
- Test* const test = internal::HandleExceptionsInMethodIfSupported(
- factory_, &internal::TestFactoryBase::CreateTest,
- "the test fixture's constructor");
-
- // Runs the test only if the test object was created and its
- // constructor didn't generate a fatal failure.
- if ((test != NULL) && !Test::HasFatalFailure()) {
- // This doesn't throw as all user code that can throw are wrapped into
- // exception handling code.
- test->Run();
- }
-
- // Deletes the test object.
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- test, &Test::DeleteSelf_, "the test fixture's destructor");
-
- result_.set_elapsed_time(internal::GetTimeInMillis() - start);
-
- // Notifies the unit test event listener that a test has just finished.
- repeater->OnTestEnd(*this);
-
- // Tells UnitTest to stop associating assertion results to this
- // test.
- impl->set_current_test_info(NULL);
-}
-
-// class TestCase
-
-// Gets the number of successful tests in this test case.
-int TestCase::successful_test_count() const {
- return CountIf(test_info_list_, TestPassed);
-}
-
-// Gets the number of failed tests in this test case.
-int TestCase::failed_test_count() const {
- return CountIf(test_info_list_, TestFailed);
-}
-
-// Gets the number of disabled tests that will be reported in the XML report.
-int TestCase::reportable_disabled_test_count() const {
- return CountIf(test_info_list_, TestReportableDisabled);
-}
-
-// Gets the number of disabled tests in this test case.
-int TestCase::disabled_test_count() const {
- return CountIf(test_info_list_, TestDisabled);
-}
-
-// Gets the number of tests to be printed in the XML report.
-int TestCase::reportable_test_count() const {
- return CountIf(test_info_list_, TestReportable);
-}
-
-// Get the number of tests in this test case that should run.
-int TestCase::test_to_run_count() const {
- return CountIf(test_info_list_, ShouldRunTest);
-}
-
-// Gets the number of all tests.
-int TestCase::total_test_count() const {
- return static_cast<int>(test_info_list_.size());
-}
-
-// Creates a TestCase with the given name.
-//
-// Arguments:
-//
-// name: name of the test case
-// a_type_param: the name of the test case's type parameter, or NULL if
-// this is not a typed or a type-parameterized test case.
-// set_up_tc: pointer to the function that sets up the test case
-// tear_down_tc: pointer to the function that tears down the test case
-TestCase::TestCase(const char* a_name, const char* a_type_param,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc)
- : name_(a_name),
- type_param_(a_type_param ? new std::string(a_type_param) : NULL),
- set_up_tc_(set_up_tc),
- tear_down_tc_(tear_down_tc),
- should_run_(false),
- elapsed_time_(0) {
-}
-
-// Destructor of TestCase.
-TestCase::~TestCase() {
- // Deletes every Test in the collection.
- ForEach(test_info_list_, internal::Delete<TestInfo>);
-}
-
-// Returns the i-th test among all the tests. i can range from 0 to
-// total_test_count() - 1. If i is not in that range, returns NULL.
-const TestInfo* TestCase::GetTestInfo(int i) const {
- const int index = GetElementOr(test_indices_, i, -1);
- return index < 0 ? NULL : test_info_list_[index];
-}
-
-// Returns the i-th test among all the tests. i can range from 0 to
-// total_test_count() - 1. If i is not in that range, returns NULL.
-TestInfo* TestCase::GetMutableTestInfo(int i) {
- const int index = GetElementOr(test_indices_, i, -1);
- return index < 0 ? NULL : test_info_list_[index];
-}
-
-// Adds a test to this test case. Will delete the test upon
-// destruction of the TestCase object.
-void TestCase::AddTestInfo(TestInfo * test_info) {
- test_info_list_.push_back(test_info);
- test_indices_.push_back(static_cast<int>(test_indices_.size()));
-}
-
-// Runs every test in this TestCase.
-void TestCase::Run() {
- if (!should_run_) return;
-
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- impl->set_current_test_case(this);
-
- TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
-
- repeater->OnTestCaseStart(*this);
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- this, &TestCase::RunSetUpTestCase, "SetUpTestCase()");
-
- const internal::TimeInMillis start = internal::GetTimeInMillis();
- for (int i = 0; i < total_test_count(); i++) {
- GetMutableTestInfo(i)->Run();
- }
- elapsed_time_ = internal::GetTimeInMillis() - start;
-
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- this, &TestCase::RunTearDownTestCase, "TearDownTestCase()");
-
- repeater->OnTestCaseEnd(*this);
- impl->set_current_test_case(NULL);
-}
-
-// Clears the results of all tests in this test case.
-void TestCase::ClearResult() {
- ad_hoc_test_result_.Clear();
- ForEach(test_info_list_, TestInfo::ClearTestResult);
-}
-
-// Shuffles the tests in this test case.
-void TestCase::ShuffleTests(internal::Random* random) {
- Shuffle(random, &test_indices_);
-}
-
-// Restores the test order to before the first shuffle.
-void TestCase::UnshuffleTests() {
- for (size_t i = 0; i < test_indices_.size(); i++) {
- test_indices_[i] = static_cast<int>(i);
- }
-}
-
-// Formats a countable noun. Depending on its quantity, either the
-// singular form or the plural form is used. e.g.
-//
-// FormatCountableNoun(1, "formula", "formuli") returns "1 formula".
-// FormatCountableNoun(5, "book", "books") returns "5 books".
-static std::string FormatCountableNoun(int count,
- const char * singular_form,
- const char * plural_form) {
- return internal::StreamableToString(count) + " " +
- (count == 1 ? singular_form : plural_form);
-}
-
-// Formats the count of tests.
-static std::string FormatTestCount(int test_count) {
- return FormatCountableNoun(test_count, "test", "tests");
-}
-
-// Formats the count of test cases.
-static std::string FormatTestCaseCount(int test_case_count) {
- return FormatCountableNoun(test_case_count, "test case", "test cases");
-}
-
-// Converts a TestPartResult::Type enum to human-friendly string
-// representation. Both kNonFatalFailure and kFatalFailure are translated
-// to "Failure", as the user usually doesn't care about the difference
-// between the two when viewing the test result.
-static const char * TestPartResultTypeToString(TestPartResult::Type type) {
- switch (type) {
- case TestPartResult::kSuccess:
- return "Success";
-
- case TestPartResult::kNonFatalFailure:
- case TestPartResult::kFatalFailure:
-#ifdef _MSC_VER
- return "error: ";
-#else
- return "Failure\n";
-#endif
- default:
- return "Unknown result type";
- }
-}
-
-namespace internal {
-
-// Prints a TestPartResult to an std::string.
-static std::string PrintTestPartResultToString(
- const TestPartResult& test_part_result) {
- return (Message()
- << internal::FormatFileLocation(test_part_result.file_name(),
- test_part_result.line_number())
- << " " << TestPartResultTypeToString(test_part_result.type())
- << test_part_result.message()).GetString();
-}
-
-// Prints a TestPartResult.
-static void PrintTestPartResult(const TestPartResult& test_part_result) {
- const std::string& result =
- PrintTestPartResultToString(test_part_result);
- printf("%s\n", result.c_str());
- fflush(stdout);
- // If the test program runs in Visual Studio or a debugger, the
- // following statements add the test part result message to the Output
- // window such that the user can double-click on it to jump to the
- // corresponding source code location; otherwise they do nothing.
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
- // We don't call OutputDebugString*() on Windows Mobile, as printing
- // to stdout is done by OutputDebugString() there already - we don't
- // want the same message printed twice.
- ::OutputDebugStringA(result.c_str());
- ::OutputDebugStringA("\n");
-#endif
-}
-
-// class PrettyUnitTestResultPrinter
-
-enum GTestColor {
- COLOR_DEFAULT,
- COLOR_RED,
- COLOR_GREEN,
- COLOR_YELLOW
-};
-
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE && \
- !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
-
-// Returns the character attribute for the given color.
-WORD GetColorAttribute(GTestColor color) {
- switch (color) {
- case COLOR_RED: return FOREGROUND_RED;
- case COLOR_GREEN: return FOREGROUND_GREEN;
- case COLOR_YELLOW: return FOREGROUND_RED | FOREGROUND_GREEN;
- default: return 0;
- }
-}
-
-#else
-
-// Returns the ANSI color code for the given color. COLOR_DEFAULT is
-// an invalid input.
-const char* GetAnsiColorCode(GTestColor color) {
- switch (color) {
- case COLOR_RED: return "1";
- case COLOR_GREEN: return "2";
- case COLOR_YELLOW: return "3";
- default: return NULL;
- };
-}
-
-#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
-
-// Returns true iff Google Test should use colors in the output.
-bool ShouldUseColor(bool stdout_is_tty) {
- const char* const gtest_color = GTEST_FLAG(color).c_str();
-
- if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) {
-#if GTEST_OS_WINDOWS
- // On Windows the TERM variable is usually not set, but the
- // console there does support colors.
- return stdout_is_tty;
-#else
- // On non-Windows platforms, we rely on the TERM variable.
- const char* const term = posix::GetEnv("TERM");
- const bool term_supports_color =
- String::CStringEquals(term, "xterm") ||
- String::CStringEquals(term, "xterm-color") ||
- String::CStringEquals(term, "xterm-256color") ||
- String::CStringEquals(term, "screen") ||
- String::CStringEquals(term, "screen-256color") ||
- String::CStringEquals(term, "linux") ||
- String::CStringEquals(term, "cygwin");
- return stdout_is_tty && term_supports_color;
-#endif // GTEST_OS_WINDOWS
- }
-
- return String::CaseInsensitiveCStringEquals(gtest_color, "yes") ||
- String::CaseInsensitiveCStringEquals(gtest_color, "true") ||
- String::CaseInsensitiveCStringEquals(gtest_color, "t") ||
- String::CStringEquals(gtest_color, "1");
- // We take "yes", "true", "t", and "1" as meaning "yes". If the
- // value is neither one of these nor "auto", we treat it as "no" to
- // be conservative.
-}
-
-// Helpers for printing colored strings to stdout. Note that on Windows, we
-// cannot simply emit special characters and have the terminal change colors.
-// This routine must actually emit the characters rather than return a string
-// that would be colored when printed, as can be done on Linux.
-void ColoredPrintf(GTestColor color, const char* fmt, ...) {
- va_list args;
- va_start(args, fmt);
-
-#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS || \
- GTEST_OS_IOS || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT
- const bool use_color = false;
-#else
- static const bool in_color_mode =
- ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0);
- const bool use_color = in_color_mode && (color != COLOR_DEFAULT);
-#endif // GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS
- // The '!= 0' comparison is necessary to satisfy MSVC 7.1.
-
- if (!use_color) {
- vprintf(fmt, args);
- va_end(args);
- return;
- }
-
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE && \
- !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
- const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
-
- // Gets the current text color.
- CONSOLE_SCREEN_BUFFER_INFO buffer_info;
- GetConsoleScreenBufferInfo(stdout_handle, &buffer_info);
- const WORD old_color_attrs = buffer_info.wAttributes;
-
- // We need to flush the stream buffers into the console before each
- // SetConsoleTextAttribute call lest it affect the text that is already
- // printed but has not yet reached the console.
- fflush(stdout);
- SetConsoleTextAttribute(stdout_handle,
- GetColorAttribute(color) | FOREGROUND_INTENSITY);
- vprintf(fmt, args);
-
- fflush(stdout);
- // Restores the text color.
- SetConsoleTextAttribute(stdout_handle, old_color_attrs);
-#else
- printf("\033[0;3%sm", GetAnsiColorCode(color));
- vprintf(fmt, args);
- printf("\033[m"); // Resets the terminal to default.
-#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
- va_end(args);
-}
-
-// Text printed in Google Test's text output and --gunit_list_tests
-// output to label the type parameter and value parameter for a test.
-static const char kTypeParamLabel[] = "TypeParam";
-static const char kValueParamLabel[] = "GetParam()";
-
-void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
- const char* const type_param = test_info.type_param();
- const char* const value_param = test_info.value_param();
-
- if (type_param != NULL || value_param != NULL) {
- printf(", where ");
- if (type_param != NULL) {
- printf("%s = %s", kTypeParamLabel, type_param);
- if (value_param != NULL)
- printf(" and ");
- }
- if (value_param != NULL) {
- printf("%s = %s", kValueParamLabel, value_param);
- }
- }
-}
-
-// This class implements the TestEventListener interface.
-//
-// Class PrettyUnitTestResultPrinter is copyable.
-class PrettyUnitTestResultPrinter : public TestEventListener {
- public:
- PrettyUnitTestResultPrinter() {}
- static void PrintTestName(const char * test_case, const char * test) {
- printf("%s.%s", test_case, test);
- }
-
- // The following methods override what's in the TestEventListener class.
- virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
- virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);
- virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
- virtual void OnTestCaseStart(const TestCase& test_case);
- virtual void OnTestStart(const TestInfo& test_info);
- virtual void OnTestPartResult(const TestPartResult& result);
- virtual void OnTestEnd(const TestInfo& test_info);
- virtual void OnTestCaseEnd(const TestCase& test_case);
- virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
- virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
- virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
-
- private:
- static void PrintFailedTests(const UnitTest& unit_test);
-};
-
- // Fired before each iteration of tests starts.
-void PrettyUnitTestResultPrinter::OnTestIterationStart(
- const UnitTest& unit_test, int iteration) {
- if (GTEST_FLAG(repeat) != 1)
- printf("\nRepeating all tests (iteration %d) . . .\n\n", iteration + 1);
-
- const char* const filter = GTEST_FLAG(filter).c_str();
-
- // Prints the filter if it's not *. This reminds the user that some
- // tests may be skipped.
- if (!String::CStringEquals(filter, kUniversalFilter)) {
- ColoredPrintf(COLOR_YELLOW,
- "Note: %s filter = %s\n", GTEST_NAME_, filter);
- }
-
- if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) {
- const Int32 shard_index = Int32FromEnvOrDie(kTestShardIndex, -1);
- ColoredPrintf(COLOR_YELLOW,
- "Note: This is test shard %d of %s.\n",
- static_cast<int>(shard_index) + 1,
- internal::posix::GetEnv(kTestTotalShards));
- }
-
- if (GTEST_FLAG(shuffle)) {
- ColoredPrintf(COLOR_YELLOW,
- "Note: Randomizing tests' orders with a seed of %d .\n",
- unit_test.random_seed());
- }
-
- ColoredPrintf(COLOR_GREEN, "[==========] ");
- printf("Running %s from %s.\n",
- FormatTestCount(unit_test.test_to_run_count()).c_str(),
- FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart(
- const UnitTest& /*unit_test*/) {
- ColoredPrintf(COLOR_GREEN, "[----------] ");
- printf("Global test environment set-up.\n");
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {
- const std::string counts =
- FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
- ColoredPrintf(COLOR_GREEN, "[----------] ");
- printf("%s from %s", counts.c_str(), test_case.name());
- if (test_case.type_param() == NULL) {
- printf("\n");
- } else {
- printf(", where %s = %s\n", kTypeParamLabel, test_case.type_param());
- }
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) {
- ColoredPrintf(COLOR_GREEN, "[ RUN ] ");
- PrintTestName(test_info.test_case_name(), test_info.name());
- printf("\n");
- fflush(stdout);
-}
-
-// Called after an assertion failure.
-void PrettyUnitTestResultPrinter::OnTestPartResult(
- const TestPartResult& result) {
- // If the test part succeeded, we don't need to do anything.
- if (result.type() == TestPartResult::kSuccess)
- return;
-
- // Print failure message from the assertion (e.g. expected this and got that).
- PrintTestPartResult(result);
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
- if (test_info.result()->Passed()) {
- ColoredPrintf(COLOR_GREEN, "[ OK ] ");
- } else {
- ColoredPrintf(COLOR_RED, "[ FAILED ] ");
- }
- PrintTestName(test_info.test_case_name(), test_info.name());
- if (test_info.result()->Failed())
- PrintFullTestCommentIfPresent(test_info);
-
- if (GTEST_FLAG(print_time)) {
- printf(" (%s ms)\n", internal::StreamableToString(
- test_info.result()->elapsed_time()).c_str());
- } else {
- printf("\n");
- }
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) {
- if (!GTEST_FLAG(print_time)) return;
-
- const std::string counts =
- FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
- ColoredPrintf(COLOR_GREEN, "[----------] ");
- printf("%s from %s (%s ms total)\n\n",
- counts.c_str(), test_case.name(),
- internal::StreamableToString(test_case.elapsed_time()).c_str());
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnEnvironmentsTearDownStart(
- const UnitTest& /*unit_test*/) {
- ColoredPrintf(COLOR_GREEN, "[----------] ");
- printf("Global test environment tear-down\n");
- fflush(stdout);
-}
-
-// Internal helper for printing the list of failed tests.
-void PrettyUnitTestResultPrinter::PrintFailedTests(const UnitTest& unit_test) {
- const int failed_test_count = unit_test.failed_test_count();
- if (failed_test_count == 0) {
- return;
- }
-
- for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
- const TestCase& test_case = *unit_test.GetTestCase(i);
- if (!test_case.should_run() || (test_case.failed_test_count() == 0)) {
- continue;
- }
- for (int j = 0; j < test_case.total_test_count(); ++j) {
- const TestInfo& test_info = *test_case.GetTestInfo(j);
- if (!test_info.should_run() || test_info.result()->Passed()) {
- continue;
- }
- ColoredPrintf(COLOR_RED, "[ FAILED ] ");
- printf("%s.%s", test_case.name(), test_info.name());
- PrintFullTestCommentIfPresent(test_info);
- printf("\n");
- }
- }
-}
-
-void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
- int /*iteration*/) {
- ColoredPrintf(COLOR_GREEN, "[==========] ");
- printf("%s from %s ran.",
- FormatTestCount(unit_test.test_to_run_count()).c_str(),
- FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());
- if (GTEST_FLAG(print_time)) {
- printf(" (%s ms total)",
- internal::StreamableToString(unit_test.elapsed_time()).c_str());
- }
- printf("\n");
- ColoredPrintf(COLOR_GREEN, "[ PASSED ] ");
- printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str());
-
- int num_failures = unit_test.failed_test_count();
- if (!unit_test.Passed()) {
- const int failed_test_count = unit_test.failed_test_count();
- ColoredPrintf(COLOR_RED, "[ FAILED ] ");
- printf("%s, listed below:\n", FormatTestCount(failed_test_count).c_str());
- PrintFailedTests(unit_test);
- printf("\n%2d FAILED %s\n", num_failures,
- num_failures == 1 ? "TEST" : "TESTS");
- }
-
- int num_disabled = unit_test.reportable_disabled_test_count();
- if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) {
- if (!num_failures) {
- printf("\n"); // Add a spacer if no FAILURE banner is displayed.
- }
- ColoredPrintf(COLOR_YELLOW,
- " YOU HAVE %d DISABLED %s\n\n",
- num_disabled,
- num_disabled == 1 ? "TEST" : "TESTS");
- }
- // Ensure that Google Test output is printed before, e.g., heapchecker output.
- fflush(stdout);
-}
-
-// End PrettyUnitTestResultPrinter
-
-// class TestEventRepeater
-//
-// This class forwards events to other event listeners.
-class TestEventRepeater : public TestEventListener {
- public:
- TestEventRepeater() : forwarding_enabled_(true) {}
- virtual ~TestEventRepeater();
- void Append(TestEventListener *listener);
- TestEventListener* Release(TestEventListener* listener);
-
- // Controls whether events will be forwarded to listeners_. Set to false
- // in death test child processes.
- bool forwarding_enabled() const { return forwarding_enabled_; }
- void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; }
-
- virtual void OnTestProgramStart(const UnitTest& unit_test);
- virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);
- virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test);
- virtual void OnTestCaseStart(const TestCase& test_case);
- virtual void OnTestStart(const TestInfo& test_info);
- virtual void OnTestPartResult(const TestPartResult& result);
- virtual void OnTestEnd(const TestInfo& test_info);
- virtual void OnTestCaseEnd(const TestCase& test_case);
- virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test);
- virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
- virtual void OnTestProgramEnd(const UnitTest& unit_test);
-
- private:
- // Controls whether events will be forwarded to listeners_. Set to false
- // in death test child processes.
- bool forwarding_enabled_;
- // The list of listeners that receive events.
- std::vector<TestEventListener*> listeners_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventRepeater);
-};
-
-TestEventRepeater::~TestEventRepeater() {
- ForEach(listeners_, Delete<TestEventListener>);
-}
-
-void TestEventRepeater::Append(TestEventListener *listener) {
- listeners_.push_back(listener);
-}
-
-// TODO(vladl@google.com): Factor the search functionality into Vector::Find.
-TestEventListener* TestEventRepeater::Release(TestEventListener *listener) {
- for (size_t i = 0; i < listeners_.size(); ++i) {
- if (listeners_[i] == listener) {
- listeners_.erase(listeners_.begin() + i);
- return listener;
- }
- }
-
- return NULL;
-}
-
-// Since most methods are very similar, use macros to reduce boilerplate.
-// This defines a member that forwards the call to all listeners.
-#define GTEST_REPEATER_METHOD_(Name, Type) \
-void TestEventRepeater::Name(const Type& parameter) { \
- if (forwarding_enabled_) { \
- for (size_t i = 0; i < listeners_.size(); i++) { \
- listeners_[i]->Name(parameter); \
- } \
- } \
-}
-// This defines a member that forwards the call to all listeners in reverse
-// order.
-#define GTEST_REVERSE_REPEATER_METHOD_(Name, Type) \
-void TestEventRepeater::Name(const Type& parameter) { \
- if (forwarding_enabled_) { \
- for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) { \
- listeners_[i]->Name(parameter); \
- } \
- } \
-}
-
-GTEST_REPEATER_METHOD_(OnTestProgramStart, UnitTest)
-GTEST_REPEATER_METHOD_(OnEnvironmentsSetUpStart, UnitTest)
-GTEST_REPEATER_METHOD_(OnTestCaseStart, TestCase)
-GTEST_REPEATER_METHOD_(OnTestStart, TestInfo)
-GTEST_REPEATER_METHOD_(OnTestPartResult, TestPartResult)
-GTEST_REPEATER_METHOD_(OnEnvironmentsTearDownStart, UnitTest)
-GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsSetUpEnd, UnitTest)
-GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsTearDownEnd, UnitTest)
-GTEST_REVERSE_REPEATER_METHOD_(OnTestEnd, TestInfo)
-GTEST_REVERSE_REPEATER_METHOD_(OnTestCaseEnd, TestCase)
-GTEST_REVERSE_REPEATER_METHOD_(OnTestProgramEnd, UnitTest)
-
-#undef GTEST_REPEATER_METHOD_
-#undef GTEST_REVERSE_REPEATER_METHOD_
-
-void TestEventRepeater::OnTestIterationStart(const UnitTest& unit_test,
- int iteration) {
- if (forwarding_enabled_) {
- for (size_t i = 0; i < listeners_.size(); i++) {
- listeners_[i]->OnTestIterationStart(unit_test, iteration);
- }
- }
-}
-
-void TestEventRepeater::OnTestIterationEnd(const UnitTest& unit_test,
- int iteration) {
- if (forwarding_enabled_) {
- for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) {
- listeners_[i]->OnTestIterationEnd(unit_test, iteration);
- }
- }
-}
-
-// End TestEventRepeater
-
-// This class generates an XML output file.
-class XmlUnitTestResultPrinter : public EmptyTestEventListener {
- public:
- explicit XmlUnitTestResultPrinter(const char* output_file);
-
- virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
-
- private:
- // Is c a whitespace character that is normalized to a space character
- // when it appears in an XML attribute value?
- static bool IsNormalizableWhitespace(char c) {
- return c == 0x9 || c == 0xA || c == 0xD;
- }
-
- // May c appear in a well-formed XML document?
- static bool IsValidXmlCharacter(char c) {
- return IsNormalizableWhitespace(c) || c >= 0x20;
- }
-
- // Returns an XML-escaped copy of the input string str. If
- // is_attribute is true, the text is meant to appear as an attribute
- // value, and normalizable whitespace is preserved by replacing it
- // with character references.
- static std::string EscapeXml(const std::string& str, bool is_attribute);
-
- // Returns the given string with all characters invalid in XML removed.
- static std::string RemoveInvalidXmlCharacters(const std::string& str);
-
- // Convenience wrapper around EscapeXml when str is an attribute value.
- static std::string EscapeXmlAttribute(const std::string& str) {
- return EscapeXml(str, true);
- }
-
- // Convenience wrapper around EscapeXml when str is not an attribute value.
- static std::string EscapeXmlText(const char* str) {
- return EscapeXml(str, false);
- }
-
- // Verifies that the given attribute belongs to the given element and
- // streams the attribute as XML.
- static void OutputXmlAttribute(std::ostream* stream,
- const std::string& element_name,
- const std::string& name,
- const std::string& value);
-
- // Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
- static void OutputXmlCDataSection(::std::ostream* stream, const char* data);
-
- // Streams an XML representation of a TestInfo object.
- static void OutputXmlTestInfo(::std::ostream* stream,
- const char* test_case_name,
- const TestInfo& test_info);
-
- // Prints an XML representation of a TestCase object
- static void PrintXmlTestCase(::std::ostream* stream,
- const TestCase& test_case);
-
- // Prints an XML summary of unit_test to output stream out.
- static void PrintXmlUnitTest(::std::ostream* stream,
- const UnitTest& unit_test);
-
- // Produces a string representing the test properties in a result as space
- // delimited XML attributes based on the property key="value" pairs.
- // When the std::string is not empty, it includes a space at the beginning,
- // to delimit this attribute from prior attributes.
- static std::string TestPropertiesAsXmlAttributes(const TestResult& result);
-
- // The output file.
- const std::string output_file_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter);
-};
-
-// Creates a new XmlUnitTestResultPrinter.
-XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)
- : output_file_(output_file) {
- if (output_file_.c_str() == NULL || output_file_.empty()) {
- fprintf(stderr, "XML output file may not be null\n");
- fflush(stderr);
- exit(EXIT_FAILURE);
- }
-}
-
-// Called after the unit test ends.
-void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
- int /*iteration*/) {
- FILE* xmlout = NULL;
- FilePath output_file(output_file_);
- FilePath output_dir(output_file.RemoveFileName());
-
- if (output_dir.CreateDirectoriesRecursively()) {
- xmlout = posix::FOpen(output_file_.c_str(), "w");
- }
- if (xmlout == NULL) {
- // TODO(wan): report the reason of the failure.
- //
- // We don't do it for now as:
- //
- // 1. There is no urgent need for it.
- // 2. It's a bit involved to make the errno variable thread-safe on
- // all three operating systems (Linux, Windows, and Mac OS).
- // 3. To interpret the meaning of errno in a thread-safe way,
- // we need the strerror_r() function, which is not available on
- // Windows.
- fprintf(stderr,
- "Unable to open file \"%s\"\n",
- output_file_.c_str());
- fflush(stderr);
- exit(EXIT_FAILURE);
- }
- std::stringstream stream;
- PrintXmlUnitTest(&stream, unit_test);
- fprintf(xmlout, "%s", StringStreamToString(&stream).c_str());
- fclose(xmlout);
-}
-
-// Returns an XML-escaped copy of the input string str. If is_attribute
-// is true, the text is meant to appear as an attribute value, and
-// normalizable whitespace is preserved by replacing it with character
-// references.
-//
-// Invalid XML characters in str, if any, are stripped from the output.
-// It is expected that most, if not all, of the text processed by this
-// module will consist of ordinary English text.
-// If this module is ever modified to produce version 1.1 XML output,
-// most invalid characters can be retained using character references.
-// TODO(wan): It might be nice to have a minimally invasive, human-readable
-// escaping scheme for invalid characters, rather than dropping them.
-std::string XmlUnitTestResultPrinter::EscapeXml(
- const std::string& str, bool is_attribute) {
- Message m;
-
- for (size_t i = 0; i < str.size(); ++i) {
- const char ch = str[i];
- switch (ch) {
- case '<':
- m << "<";
- break;
- case '>':
- m << ">";
- break;
- case '&':
- m << "&";
- break;
- case '\'':
- if (is_attribute)
- m << "'";
- else
- m << '\'';
- break;
- case '"':
- if (is_attribute)
- m << """;
- else
- m << '"';
- break;
- default:
- if (IsValidXmlCharacter(ch)) {
- if (is_attribute && IsNormalizableWhitespace(ch))
- m << "&#x" << String::FormatByte(static_cast<unsigned char>(ch))
- << ";";
- else
- m << ch;
- }
- break;
- }
- }
-
- return m.GetString();
-}
-
-// Returns the given string with all characters invalid in XML removed.
-// Currently invalid characters are dropped from the string. An
-// alternative is to replace them with certain characters such as . or ?.
-std::string XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(
- const std::string& str) {
- std::string output;
- output.reserve(str.size());
- for (std::string::const_iterator it = str.begin(); it != str.end(); ++it)
- if (IsValidXmlCharacter(*it))
- output.push_back(*it);
-
- return output;
-}
-
-// The following routines generate an XML representation of a UnitTest
-// object.
-//
-// This is how Google Test concepts map to the DTD:
-//
-// <testsuites name="AllTests"> <-- corresponds to a UnitTest object
-// <testsuite name="testcase-name"> <-- corresponds to a TestCase object
-// <testcase name="test-name"> <-- corresponds to a TestInfo object
-// <failure message="...">...</failure>
-// <failure message="...">...</failure>
-// <failure message="...">...</failure>
-// <-- individual assertion failures
-// </testcase>
-// </testsuite>
-// </testsuites>
-
-// Formats the given time in milliseconds as seconds.
-std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {
- ::std::stringstream ss;
- ss << ms/1000.0;
- return ss.str();
-}
-
-// Converts the given epoch time in milliseconds to a date string in the ISO
-// 8601 format, without the timezone information.
-std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {
- time_t seconds = static_cast<time_t>(ms / 1000);
- struct tm time_struct;
-#ifdef _MSC_VER
- if (localtime_s(&time_struct, &seconds) != 0)
- return ""; // Invalid ms value
-#else
- if (localtime_r(&seconds, &time_struct) == NULL)
- return ""; // Invalid ms value
-#endif
-
- // YYYY-MM-DDThh:mm:ss
- return StreamableToString(time_struct.tm_year + 1900) + "-" +
- String::FormatIntWidth2(time_struct.tm_mon + 1) + "-" +
- String::FormatIntWidth2(time_struct.tm_mday) + "T" +
- String::FormatIntWidth2(time_struct.tm_hour) + ":" +
- String::FormatIntWidth2(time_struct.tm_min) + ":" +
- String::FormatIntWidth2(time_struct.tm_sec);
-}
-
-// Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
-void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream,
- const char* data) {
- const char* segment = data;
- *stream << "<![CDATA[";
- for (;;) {
- const char* const next_segment = strstr(segment, "]]>");
- if (next_segment != NULL) {
- stream->write(
- segment, static_cast<std::streamsize>(next_segment - segment));
- *stream << "]]>]]><![CDATA[";
- segment = next_segment + strlen("]]>");
- } else {
- *stream << segment;
- break;
- }
- }
- *stream << "]]>";
-}
-
-void XmlUnitTestResultPrinter::OutputXmlAttribute(
- std::ostream* stream,
- const std::string& element_name,
- const std::string& name,
- const std::string& value) {
- const std::vector<std::string>& allowed_names =
- GetReservedAttributesForElement(element_name);
-
- GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) !=
- allowed_names.end())
- << "Attribute " << name << " is not allowed for element <" << element_name
- << ">.";
-
- *stream << " " << name << "=\"" << EscapeXmlAttribute(value) << "\"";
-}
-
-// Prints an XML representation of a TestInfo object.
-// TODO(wan): There is also value in printing properties with the plain printer.
-void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
- const char* test_case_name,
- const TestInfo& test_info) {
- const TestResult& result = *test_info.result();
- const std::string kTestcase = "testcase";
-
- *stream << " <testcase";
- OutputXmlAttribute(stream, kTestcase, "name", test_info.name());
-
- if (test_info.value_param() != NULL) {
- OutputXmlAttribute(stream, kTestcase, "value_param",
- test_info.value_param());
- }
- if (test_info.type_param() != NULL) {
- OutputXmlAttribute(stream, kTestcase, "type_param", test_info.type_param());
- }
-
- OutputXmlAttribute(stream, kTestcase, "status",
- test_info.should_run() ? "run" : "notrun");
- OutputXmlAttribute(stream, kTestcase, "time",
- FormatTimeInMillisAsSeconds(result.elapsed_time()));
- OutputXmlAttribute(stream, kTestcase, "classname", test_case_name);
- *stream << TestPropertiesAsXmlAttributes(result);
-
- int failures = 0;
- for (int i = 0; i < result.total_part_count(); ++i) {
- const TestPartResult& part = result.GetTestPartResult(i);
- if (part.failed()) {
- if (++failures == 1) {
- *stream << ">\n";
- }
- const string location = internal::FormatCompilerIndependentFileLocation(
- part.file_name(), part.line_number());
- const string summary = location + "\n" + part.summary();
- *stream << " <failure message=\""
- << EscapeXmlAttribute(summary.c_str())
- << "\" type=\"\">";
- const string detail = location + "\n" + part.message();
- OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
- *stream << "</failure>\n";
- }
- }
-
- if (failures == 0)
- *stream << " />\n";
- else
- *stream << " </testcase>\n";
-}
-
-// Prints an XML representation of a TestCase object
-void XmlUnitTestResultPrinter::PrintXmlTestCase(std::ostream* stream,
- const TestCase& test_case) {
- const std::string kTestsuite = "testsuite";
- *stream << " <" << kTestsuite;
- OutputXmlAttribute(stream, kTestsuite, "name", test_case.name());
- OutputXmlAttribute(stream, kTestsuite, "tests",
- StreamableToString(test_case.reportable_test_count()));
- OutputXmlAttribute(stream, kTestsuite, "failures",
- StreamableToString(test_case.failed_test_count()));
- OutputXmlAttribute(
- stream, kTestsuite, "disabled",
- StreamableToString(test_case.reportable_disabled_test_count()));
- OutputXmlAttribute(stream, kTestsuite, "errors", "0");
- OutputXmlAttribute(stream, kTestsuite, "time",
- FormatTimeInMillisAsSeconds(test_case.elapsed_time()));
- *stream << TestPropertiesAsXmlAttributes(test_case.ad_hoc_test_result())
- << ">\n";
-
- for (int i = 0; i < test_case.total_test_count(); ++i) {
- if (test_case.GetTestInfo(i)->is_reportable())
- OutputXmlTestInfo(stream, test_case.name(), *test_case.GetTestInfo(i));
- }
- *stream << " </" << kTestsuite << ">\n";
-}
-
-// Prints an XML summary of unit_test to output stream out.
-void XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream* stream,
- const UnitTest& unit_test) {
- const std::string kTestsuites = "testsuites";
-
- *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
- *stream << "<" << kTestsuites;
-
- OutputXmlAttribute(stream, kTestsuites, "tests",
- StreamableToString(unit_test.reportable_test_count()));
- OutputXmlAttribute(stream, kTestsuites, "failures",
- StreamableToString(unit_test.failed_test_count()));
- OutputXmlAttribute(
- stream, kTestsuites, "disabled",
- StreamableToString(unit_test.reportable_disabled_test_count()));
- OutputXmlAttribute(stream, kTestsuites, "errors", "0");
- OutputXmlAttribute(
- stream, kTestsuites, "timestamp",
- FormatEpochTimeInMillisAsIso8601(unit_test.start_timestamp()));
- OutputXmlAttribute(stream, kTestsuites, "time",
- FormatTimeInMillisAsSeconds(unit_test.elapsed_time()));
-
- if (GTEST_FLAG(shuffle)) {
- OutputXmlAttribute(stream, kTestsuites, "random_seed",
- StreamableToString(unit_test.random_seed()));
- }
-
- *stream << TestPropertiesAsXmlAttributes(unit_test.ad_hoc_test_result());
-
- OutputXmlAttribute(stream, kTestsuites, "name", "AllTests");
- *stream << ">\n";
-
- for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
- if (unit_test.GetTestCase(i)->reportable_test_count() > 0)
- PrintXmlTestCase(stream, *unit_test.GetTestCase(i));
- }
- *stream << "</" << kTestsuites << ">\n";
-}
-
-// Produces a string representing the test properties in a result as space
-// delimited XML attributes based on the property key="value" pairs.
-std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(
- const TestResult& result) {
- Message attributes;
- for (int i = 0; i < result.test_property_count(); ++i) {
- const TestProperty& property = result.GetTestProperty(i);
- attributes << " " << property.key() << "="
- << "\"" << EscapeXmlAttribute(property.value()) << "\"";
- }
- return attributes.GetString();
-}
-
-// End XmlUnitTestResultPrinter
-
-#if GTEST_CAN_STREAM_RESULTS_
-
-// Checks if str contains '=', '&', '%' or '\n' characters. If yes,
-// replaces them by "%xx" where xx is their hexadecimal value. For
-// example, replaces "=" with "%3D". This algorithm is O(strlen(str))
-// in both time and space -- important as the input str may contain an
-// arbitrarily long test failure message and stack trace.
-string StreamingListener::UrlEncode(const char* str) {
- string result;
- result.reserve(strlen(str) + 1);
- for (char ch = *str; ch != '\0'; ch = *++str) {
- switch (ch) {
- case '%':
- case '=':
- case '&':
- case '\n':
- result.append("%" + String::FormatByte(static_cast<unsigned char>(ch)));
- break;
- default:
- result.push_back(ch);
- break;
- }
- }
- return result;
-}
-
-void StreamingListener::SocketWriter::MakeConnection() {
- GTEST_CHECK_(sockfd_ == -1)
- << "MakeConnection() can't be called when there is already a connection.";
-
- addrinfo hints;
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = AF_UNSPEC; // To allow both IPv4 and IPv6 addresses.
- hints.ai_socktype = SOCK_STREAM;
- addrinfo* servinfo = NULL;
-
- // Use the getaddrinfo() to get a linked list of IP addresses for
- // the given host name.
- const int error_num = getaddrinfo(
- host_name_.c_str(), port_num_.c_str(), &hints, &servinfo);
- if (error_num != 0) {
- GTEST_LOG_(WARNING) << "stream_result_to: getaddrinfo() failed: "
- << gai_strerror(error_num);
- }
-
- // Loop through all the results and connect to the first we can.
- for (addrinfo* cur_addr = servinfo; sockfd_ == -1 && cur_addr != NULL;
- cur_addr = cur_addr->ai_next) {
- sockfd_ = socket(
- cur_addr->ai_family, cur_addr->ai_socktype, cur_addr->ai_protocol);
- if (sockfd_ != -1) {
- // Connect the client socket to the server socket.
- if (connect(sockfd_, cur_addr->ai_addr, cur_addr->ai_addrlen) == -1) {
- close(sockfd_);
- sockfd_ = -1;
- }
- }
- }
-
- freeaddrinfo(servinfo); // all done with this structure
-
- if (sockfd_ == -1) {
- GTEST_LOG_(WARNING) << "stream_result_to: failed to connect to "
- << host_name_ << ":" << port_num_;
- }
-}
-
-// End of class Streaming Listener
-#endif // GTEST_CAN_STREAM_RESULTS__
-
-// Class ScopedTrace
-
-// Pushes the given source file location and message onto a per-thread
-// trace stack maintained by Google Test.
-ScopedTrace::ScopedTrace(const char* file, int line, const Message& message)
- GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
- TraceInfo trace;
- trace.file = file;
- trace.line = line;
- trace.message = message.GetString();
-
- UnitTest::GetInstance()->PushGTestTrace(trace);
-}
-
-// Pops the info pushed by the c'tor.
-ScopedTrace::~ScopedTrace()
- GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
- UnitTest::GetInstance()->PopGTestTrace();
-}
-
-
-// class OsStackTraceGetter
-
-// Returns the current OS stack trace as an std::string. Parameters:
-//
-// max_depth - the maximum number of stack frames to be included
-// in the trace.
-// skip_count - the number of top frames to be skipped; doesn't count
-// against max_depth.
-//
-string OsStackTraceGetter::CurrentStackTrace(int /* max_depth */,
- int /* skip_count */)
- GTEST_LOCK_EXCLUDED_(mutex_) {
- return "";
-}
-
-void OsStackTraceGetter::UponLeavingGTest()
- GTEST_LOCK_EXCLUDED_(mutex_) {
-}
-
-const char* const
-OsStackTraceGetter::kElidedFramesMarker =
- "... " GTEST_NAME_ " internal frames ...";
-
-// A helper class that creates the premature-exit file in its
-// constructor and deletes the file in its destructor.
-class ScopedPrematureExitFile {
- public:
- explicit ScopedPrematureExitFile(const char* premature_exit_filepath)
- : premature_exit_filepath_(premature_exit_filepath) {
- // If a path to the premature-exit file is specified...
- if (premature_exit_filepath != NULL && *premature_exit_filepath != '\0') {
- // create the file with a single "0" character in it. I/O
- // errors are ignored as there's nothing better we can do and we
- // don't want to fail the test because of this.
- FILE* pfile = posix::FOpen(premature_exit_filepath, "w");
- fwrite("0", 1, 1, pfile);
- fclose(pfile);
- }
- }
-
- ~ScopedPrematureExitFile() {
- if (premature_exit_filepath_ != NULL && *premature_exit_filepath_ != '\0') {
- remove(premature_exit_filepath_);
- }
- }
-
- private:
- const char* const premature_exit_filepath_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedPrematureExitFile);
-};
-
-} // namespace internal
-
-// class TestEventListeners
-
-TestEventListeners::TestEventListeners()
- : repeater_(new internal::TestEventRepeater()),
- default_result_printer_(NULL),
- default_xml_generator_(NULL) {
-}
-
-TestEventListeners::~TestEventListeners() { delete repeater_; }
-
-// Returns the standard listener responsible for the default console
-// output. Can be removed from the listeners list to shut down default
-// console output. Note that removing this object from the listener list
-// with Release transfers its ownership to the user.
-void TestEventListeners::Append(TestEventListener* listener) {
- repeater_->Append(listener);
-}
-
-// Removes the given event listener from the list and returns it. It then
-// becomes the caller's responsibility to delete the listener. Returns
-// NULL if the listener is not found in the list.
-TestEventListener* TestEventListeners::Release(TestEventListener* listener) {
- if (listener == default_result_printer_)
- default_result_printer_ = NULL;
- else if (listener == default_xml_generator_)
- default_xml_generator_ = NULL;
- return repeater_->Release(listener);
-}
-
-// Returns repeater that broadcasts the TestEventListener events to all
-// subscribers.
-TestEventListener* TestEventListeners::repeater() { return repeater_; }
-
-// Sets the default_result_printer attribute to the provided listener.
-// The listener is also added to the listener list and previous
-// default_result_printer is removed from it and deleted. The listener can
-// also be NULL in which case it will not be added to the list. Does
-// nothing if the previous and the current listener objects are the same.
-void TestEventListeners::SetDefaultResultPrinter(TestEventListener* listener) {
- if (default_result_printer_ != listener) {
- // It is an error to pass this method a listener that is already in the
- // list.
- delete Release(default_result_printer_);
- default_result_printer_ = listener;
- if (listener != NULL)
- Append(listener);
- }
-}
-
-// Sets the default_xml_generator attribute to the provided listener. The
-// listener is also added to the listener list and previous
-// default_xml_generator is removed from it and deleted. The listener can
-// also be NULL in which case it will not be added to the list. Does
-// nothing if the previous and the current listener objects are the same.
-void TestEventListeners::SetDefaultXmlGenerator(TestEventListener* listener) {
- if (default_xml_generator_ != listener) {
- // It is an error to pass this method a listener that is already in the
- // list.
- delete Release(default_xml_generator_);
- default_xml_generator_ = listener;
- if (listener != NULL)
- Append(listener);
- }
-}
-
-// Controls whether events will be forwarded by the repeater to the
-// listeners in the list.
-bool TestEventListeners::EventForwardingEnabled() const {
- return repeater_->forwarding_enabled();
-}
-
-void TestEventListeners::SuppressEventForwarding() {
- repeater_->set_forwarding_enabled(false);
-}
-
-// class UnitTest
-
-// Gets the singleton UnitTest object. The first time this method is
-// called, a UnitTest object is constructed and returned. Consecutive
-// calls will return the same object.
-//
-// We don't protect this under mutex_ as a user is not supposed to
-// call this before main() starts, from which point on the return
-// value will never change.
-UnitTest* UnitTest::GetInstance() {
- // When compiled with MSVC 7.1 in optimized mode, destroying the
- // UnitTest object upon exiting the program messes up the exit code,
- // causing successful tests to appear failed. We have to use a
- // different implementation in this case to bypass the compiler bug.
- // This implementation makes the compiler happy, at the cost of
- // leaking the UnitTest object.
-
- // CodeGear C++Builder insists on a public destructor for the
- // default implementation. Use this implementation to keep good OO
- // design with private destructor.
-
-#if (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)
- static UnitTest* const instance = new UnitTest;
- return instance;
-#else
- static UnitTest instance;
- return &instance;
-#endif // (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)
-}
-
-// Gets the number of successful test cases.
-int UnitTest::successful_test_case_count() const {
- return impl()->successful_test_case_count();
-}
-
-// Gets the number of failed test cases.
-int UnitTest::failed_test_case_count() const {
- return impl()->failed_test_case_count();
-}
-
-// Gets the number of all test cases.
-int UnitTest::total_test_case_count() const {
- return impl()->total_test_case_count();
-}
-
-// Gets the number of all test cases that contain at least one test
-// that should run.
-int UnitTest::test_case_to_run_count() const {
- return impl()->test_case_to_run_count();
-}
-
-// Gets the number of successful tests.
-int UnitTest::successful_test_count() const {
- return impl()->successful_test_count();
-}
-
-// Gets the number of failed tests.
-int UnitTest::failed_test_count() const { return impl()->failed_test_count(); }
-
-// Gets the number of disabled tests that will be reported in the XML report.
-int UnitTest::reportable_disabled_test_count() const {
- return impl()->reportable_disabled_test_count();
-}
-
-// Gets the number of disabled tests.
-int UnitTest::disabled_test_count() const {
- return impl()->disabled_test_count();
-}
-
-// Gets the number of tests to be printed in the XML report.
-int UnitTest::reportable_test_count() const {
- return impl()->reportable_test_count();
-}
-
-// Gets the number of all tests.
-int UnitTest::total_test_count() const { return impl()->total_test_count(); }
-
-// Gets the number of tests that should run.
-int UnitTest::test_to_run_count() const { return impl()->test_to_run_count(); }
-
-// Gets the time of the test program start, in ms from the start of the
-// UNIX epoch.
-internal::TimeInMillis UnitTest::start_timestamp() const {
- return impl()->start_timestamp();
-}
-
-// Gets the elapsed time, in milliseconds.
-internal::TimeInMillis UnitTest::elapsed_time() const {
- return impl()->elapsed_time();
-}
-
-// Returns true iff the unit test passed (i.e. all test cases passed).
-bool UnitTest::Passed() const { return impl()->Passed(); }
-
-// Returns true iff the unit test failed (i.e. some test case failed
-// or something outside of all tests failed).
-bool UnitTest::Failed() const { return impl()->Failed(); }
-
-// Gets the i-th test case among all the test cases. i can range from 0 to
-// total_test_case_count() - 1. If i is not in that range, returns NULL.
-const TestCase* UnitTest::GetTestCase(int i) const {
- return impl()->GetTestCase(i);
-}
-
-// Returns the TestResult containing information on test failures and
-// properties logged outside of individual test cases.
-const TestResult& UnitTest::ad_hoc_test_result() const {
- return *impl()->ad_hoc_test_result();
-}
-
-// Gets the i-th test case among all the test cases. i can range from 0 to
-// total_test_case_count() - 1. If i is not in that range, returns NULL.
-TestCase* UnitTest::GetMutableTestCase(int i) {
- return impl()->GetMutableTestCase(i);
-}
-
-// Returns the list of event listeners that can be used to track events
-// inside Google Test.
-TestEventListeners& UnitTest::listeners() {
- return *impl()->listeners();
-}
-
-// Registers and returns a global test environment. When a test
-// program is run, all global test environments will be set-up in the
-// order they were registered. After all tests in the program have
-// finished, all global test environments will be torn-down in the
-// *reverse* order they were registered.
-//
-// The UnitTest object takes ownership of the given environment.
-//
-// We don't protect this under mutex_, as we only support calling it
-// from the main thread.
-Environment* UnitTest::AddEnvironment(Environment* env) {
- if (env == NULL) {
- return NULL;
- }
-
- impl_->environments().push_back(env);
- return env;
-}
-
-// Adds a TestPartResult to the current TestResult object. All Google Test
-// assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call
-// this to report their results. The user code should use the
-// assertion macros instead of calling this directly.
-void UnitTest::AddTestPartResult(
- TestPartResult::Type result_type,
- const char* file_name,
- int line_number,
- const std::string& message,
- const std::string& os_stack_trace) GTEST_LOCK_EXCLUDED_(mutex_) {
- Message msg;
- msg << message;
-
- internal::MutexLock lock(&mutex_);
- if (impl_->gtest_trace_stack().size() > 0) {
- msg << "\n" << GTEST_NAME_ << " trace:";
-
- for (int i = static_cast<int>(impl_->gtest_trace_stack().size());
- i > 0; --i) {
- const internal::TraceInfo& trace = impl_->gtest_trace_stack()[i - 1];
- msg << "\n" << internal::FormatFileLocation(trace.file, trace.line)
- << " " << trace.message;
- }
- }
-
- if (os_stack_trace.c_str() != NULL && !os_stack_trace.empty()) {
- msg << internal::kStackTraceMarker << os_stack_trace;
- }
-
- const TestPartResult result =
- TestPartResult(result_type, file_name, line_number,
- msg.GetString().c_str());
- impl_->GetTestPartResultReporterForCurrentThread()->
- ReportTestPartResult(result);
-
- if (result_type != TestPartResult::kSuccess) {
- // gtest_break_on_failure takes precedence over
- // gtest_throw_on_failure. This allows a user to set the latter
- // in the code (perhaps in order to use Google Test assertions
- // with another testing framework) and specify the former on the
- // command line for debugging.
- if (GTEST_FLAG(break_on_failure)) {
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
- // Using DebugBreak on Windows allows gtest to still break into a debugger
- // when a failure happens and both the --gtest_break_on_failure and
- // the --gtest_catch_exceptions flags are specified.
- DebugBreak();
-#else
- // Dereference NULL through a volatile pointer to prevent the compiler
- // from removing. We use this rather than abort() or __builtin_trap() for
- // portability: Symbian doesn't implement abort() well, and some debuggers
- // don't correctly trap abort().
- *static_cast<volatile int*>(NULL) = 1;
-#endif // GTEST_OS_WINDOWS
- } else if (GTEST_FLAG(throw_on_failure)) {
-#if GTEST_HAS_EXCEPTIONS
- throw internal::GoogleTestFailureException(result);
-#else
- // We cannot call abort() as it generates a pop-up in debug mode
- // that cannot be suppressed in VC 7.1 or below.
- exit(1);
-#endif
- }
- }
-}
-
-// Adds a TestProperty to the current TestResult object when invoked from
-// inside a test, to current TestCase's ad_hoc_test_result_ when invoked
-// from SetUpTestCase or TearDownTestCase, or to the global property set
-// when invoked elsewhere. If the result already contains a property with
-// the same key, the value will be updated.
-void UnitTest::RecordProperty(const std::string& key,
- const std::string& value) {
- impl_->RecordProperty(TestProperty(key, value));
-}
-
-// Runs all tests in this UnitTest object and prints the result.
-// Returns 0 if successful, or 1 otherwise.
-//
-// We don't protect this under mutex_, as we only support calling it
-// from the main thread.
-int UnitTest::Run() {
- const bool in_death_test_child_process =
- internal::GTEST_FLAG(internal_run_death_test).length() > 0;
-
- // Google Test implements this protocol for catching that a test
- // program exits before returning control to Google Test:
- //
- // 1. Upon start, Google Test creates a file whose absolute path
- // is specified by the environment variable
- // TEST_PREMATURE_EXIT_FILE.
- // 2. When Google Test has finished its work, it deletes the file.
- //
- // This allows a test runner to set TEST_PREMATURE_EXIT_FILE before
- // running a Google-Test-based test program and check the existence
- // of the file at the end of the test execution to see if it has
- // exited prematurely.
-
- // If we are in the child process of a death test, don't
- // create/delete the premature exit file, as doing so is unnecessary
- // and will confuse the parent process. Otherwise, create/delete
- // the file upon entering/leaving this function. If the program
- // somehow exits before this function has a chance to return, the
- // premature-exit file will be left undeleted, causing a test runner
- // that understands the premature-exit-file protocol to report the
- // test as having failed.
- const internal::ScopedPrematureExitFile premature_exit_file(
- in_death_test_child_process ?
- NULL : internal::posix::GetEnv("TEST_PREMATURE_EXIT_FILE"));
-
- // Captures the value of GTEST_FLAG(catch_exceptions). This value will be
- // used for the duration of the program.
- impl()->set_catch_exceptions(GTEST_FLAG(catch_exceptions));
-
-#if GTEST_HAS_SEH
- // Either the user wants Google Test to catch exceptions thrown by the
- // tests or this is executing in the context of death test child
- // process. In either case the user does not want to see pop-up dialogs
- // about crashes - they are expected.
- if (impl()->catch_exceptions() || in_death_test_child_process) {
-# if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
- // SetErrorMode doesn't exist on CE.
- SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
- SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
-# endif // !GTEST_OS_WINDOWS_MOBILE
-
-# if (defined(_MSC_VER) || GTEST_OS_WINDOWS_MINGW) && !GTEST_OS_WINDOWS_MOBILE
- // Death test children can be terminated with _abort(). On Windows,
- // _abort() can show a dialog with a warning message. This forces the
- // abort message to go to stderr instead.
- _set_error_mode(_OUT_TO_STDERR);
-# endif
-
-# if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
- // In the debug version, Visual Studio pops up a separate dialog
- // offering a choice to debug the aborted program. We need to suppress
- // this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement
- // executed. Google Test will notify the user of any unexpected
- // failure via stderr.
- //
- // VC++ doesn't define _set_abort_behavior() prior to the version 8.0.
- // Users of prior VC versions shall suffer the agony and pain of
- // clicking through the countless debug dialogs.
- // TODO(vladl@google.com): find a way to suppress the abort dialog() in the
- // debug mode when compiled with VC 7.1 or lower.
- if (!GTEST_FLAG(break_on_failure))
- _set_abort_behavior(
- 0x0, // Clear the following flags:
- _WRITE_ABORT_MSG | _CALL_REPORTFAULT); // pop-up window, core dump.
-# endif
- }
-#endif // GTEST_HAS_SEH
-
- return internal::HandleExceptionsInMethodIfSupported(
- impl(),
- &internal::UnitTestImpl::RunAllTests,
- "auxiliary test code (environments or event listeners)") ? 0 : 1;
-}
-
-// Returns the working directory when the first TEST() or TEST_F() was
-// executed.
-const char* UnitTest::original_working_dir() const {
- return impl_->original_working_dir_.c_str();
-}
-
-// Returns the TestCase object for the test that's currently running,
-// or NULL if no test is running.
-const TestCase* UnitTest::current_test_case() const
- GTEST_LOCK_EXCLUDED_(mutex_) {
- internal::MutexLock lock(&mutex_);
- return impl_->current_test_case();
-}
-
-// Returns the TestInfo object for the test that's currently running,
-// or NULL if no test is running.
-const TestInfo* UnitTest::current_test_info() const
- GTEST_LOCK_EXCLUDED_(mutex_) {
- internal::MutexLock lock(&mutex_);
- return impl_->current_test_info();
-}
-
-// Returns the random seed used at the start of the current test run.
-int UnitTest::random_seed() const { return impl_->random_seed(); }
-
-#if GTEST_HAS_PARAM_TEST
-// Returns ParameterizedTestCaseRegistry object used to keep track of
-// value-parameterized tests and instantiate and register them.
-internal::ParameterizedTestCaseRegistry&
- UnitTest::parameterized_test_registry()
- GTEST_LOCK_EXCLUDED_(mutex_) {
- return impl_->parameterized_test_registry();
-}
-#endif // GTEST_HAS_PARAM_TEST
-
-// Creates an empty UnitTest.
-UnitTest::UnitTest() {
- impl_ = new internal::UnitTestImpl(this);
-}
-
-// Destructor of UnitTest.
-UnitTest::~UnitTest() {
- delete impl_;
-}
-
-// Pushes a trace defined by SCOPED_TRACE() on to the per-thread
-// Google Test trace stack.
-void UnitTest::PushGTestTrace(const internal::TraceInfo& trace)
- GTEST_LOCK_EXCLUDED_(mutex_) {
- internal::MutexLock lock(&mutex_);
- impl_->gtest_trace_stack().push_back(trace);
-}
-
-// Pops a trace from the per-thread Google Test trace stack.
-void UnitTest::PopGTestTrace()
- GTEST_LOCK_EXCLUDED_(mutex_) {
- internal::MutexLock lock(&mutex_);
- impl_->gtest_trace_stack().pop_back();
-}
-
-namespace internal {
-
-UnitTestImpl::UnitTestImpl(UnitTest* parent)
- : parent_(parent),
- GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355 /* using this in initializer */)
- default_global_test_part_result_reporter_(this),
- default_per_thread_test_part_result_reporter_(this),
- GTEST_DISABLE_MSC_WARNINGS_POP_()
- global_test_part_result_repoter_(
- &default_global_test_part_result_reporter_),
- per_thread_test_part_result_reporter_(
- &default_per_thread_test_part_result_reporter_),
-#if GTEST_HAS_PARAM_TEST
- parameterized_test_registry_(),
- parameterized_tests_registered_(false),
-#endif // GTEST_HAS_PARAM_TEST
- last_death_test_case_(-1),
- current_test_case_(NULL),
- current_test_info_(NULL),
- ad_hoc_test_result_(),
- os_stack_trace_getter_(NULL),
- post_flag_parse_init_performed_(false),
- random_seed_(0), // Will be overridden by the flag before first use.
- random_(0), // Will be reseeded before first use.
- start_timestamp_(0),
- elapsed_time_(0),
-#if GTEST_HAS_DEATH_TEST
- death_test_factory_(new DefaultDeathTestFactory),
-#endif
- // Will be overridden by the flag before first use.
- catch_exceptions_(false) {
- listeners()->SetDefaultResultPrinter(new PrettyUnitTestResultPrinter);
-}
-
-UnitTestImpl::~UnitTestImpl() {
- // Deletes every TestCase.
- ForEach(test_cases_, internal::Delete<TestCase>);
-
- // Deletes every Environment.
- ForEach(environments_, internal::Delete<Environment>);
-
- delete os_stack_trace_getter_;
-}
-
-// Adds a TestProperty to the current TestResult object when invoked in a
-// context of a test, to current test case's ad_hoc_test_result when invoke
-// from SetUpTestCase/TearDownTestCase, or to the global property set
-// otherwise. If the result already contains a property with the same key,
-// the value will be updated.
-void UnitTestImpl::RecordProperty(const TestProperty& test_property) {
- std::string xml_element;
- TestResult* test_result; // TestResult appropriate for property recording.
-
- if (current_test_info_ != NULL) {
- xml_element = "testcase";
- test_result = &(current_test_info_->result_);
- } else if (current_test_case_ != NULL) {
- xml_element = "testsuite";
- test_result = &(current_test_case_->ad_hoc_test_result_);
- } else {
- xml_element = "testsuites";
- test_result = &ad_hoc_test_result_;
- }
- test_result->RecordProperty(xml_element, test_property);
-}
-
-#if GTEST_HAS_DEATH_TEST
-// Disables event forwarding if the control is currently in a death test
-// subprocess. Must not be called before InitGoogleTest.
-void UnitTestImpl::SuppressTestEventsIfInSubprocess() {
- if (internal_run_death_test_flag_.get() != NULL)
- listeners()->SuppressEventForwarding();
-}
-#endif // GTEST_HAS_DEATH_TEST
-
-// Initializes event listeners performing XML output as specified by
-// UnitTestOptions. Must not be called before InitGoogleTest.
-void UnitTestImpl::ConfigureXmlOutput() {
- const std::string& output_format = UnitTestOptions::GetOutputFormat();
- if (output_format == "xml") {
- listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter(
- UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));
- } else if (output_format != "") {
- printf("WARNING: unrecognized output format \"%s\" ignored.\n",
- output_format.c_str());
- fflush(stdout);
- }
-}
-
-#if GTEST_CAN_STREAM_RESULTS_
-// Initializes event listeners for streaming test results in string form.
-// Must not be called before InitGoogleTest.
-void UnitTestImpl::ConfigureStreamingOutput() {
- const std::string& target = GTEST_FLAG(stream_result_to);
- if (!target.empty()) {
- const size_t pos = target.find(':');
- if (pos != std::string::npos) {
- listeners()->Append(new StreamingListener(target.substr(0, pos),
- target.substr(pos+1)));
- } else {
- printf("WARNING: unrecognized streaming target \"%s\" ignored.\n",
- target.c_str());
- fflush(stdout);
- }
- }
-}
-#endif // GTEST_CAN_STREAM_RESULTS_
-
-// Performs initialization dependent upon flag values obtained in
-// ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to
-// ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest
-// this function is also called from RunAllTests. Since this function can be
-// called more than once, it has to be idempotent.
-void UnitTestImpl::PostFlagParsingInit() {
- // Ensures that this function does not execute more than once.
- if (!post_flag_parse_init_performed_) {
- post_flag_parse_init_performed_ = true;
-
-#if GTEST_HAS_DEATH_TEST
- InitDeathTestSubprocessControlInfo();
- SuppressTestEventsIfInSubprocess();
-#endif // GTEST_HAS_DEATH_TEST
-
- // Registers parameterized tests. This makes parameterized tests
- // available to the UnitTest reflection API without running
- // RUN_ALL_TESTS.
- RegisterParameterizedTests();
-
- // Configures listeners for XML output. This makes it possible for users
- // to shut down the default XML output before invoking RUN_ALL_TESTS.
- ConfigureXmlOutput();
-
-#if GTEST_CAN_STREAM_RESULTS_
- // Configures listeners for streaming test results to the specified server.
- ConfigureStreamingOutput();
-#endif // GTEST_CAN_STREAM_RESULTS_
- }
-}
-
-// A predicate that checks the name of a TestCase against a known
-// value.
-//
-// This is used for implementation of the UnitTest class only. We put
-// it in the anonymous namespace to prevent polluting the outer
-// namespace.
-//
-// TestCaseNameIs is copyable.
-class TestCaseNameIs {
- public:
- // Constructor.
- explicit TestCaseNameIs(const std::string& name)
- : name_(name) {}
-
- // Returns true iff the name of test_case matches name_.
- bool operator()(const TestCase* test_case) const {
- return test_case != NULL && strcmp(test_case->name(), name_.c_str()) == 0;
- }
-
- private:
- std::string name_;
-};
-
-// Finds and returns a TestCase with the given name. If one doesn't
-// exist, creates one and returns it. It's the CALLER'S
-// RESPONSIBILITY to ensure that this function is only called WHEN THE
-// TESTS ARE NOT SHUFFLED.
-//
-// Arguments:
-//
-// test_case_name: name of the test case
-// type_param: the name of the test case's type parameter, or NULL if
-// this is not a typed or a type-parameterized test case.
-// set_up_tc: pointer to the function that sets up the test case
-// tear_down_tc: pointer to the function that tears down the test case
-TestCase* UnitTestImpl::GetTestCase(const char* test_case_name,
- const char* type_param,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc) {
- // Can we find a TestCase with the given name?
- const std::vector<TestCase*>::const_iterator test_case =
- std::find_if(test_cases_.begin(), test_cases_.end(),
- TestCaseNameIs(test_case_name));
-
- if (test_case != test_cases_.end())
- return *test_case;
-
- // No. Let's create one.
- TestCase* const new_test_case =
- new TestCase(test_case_name, type_param, set_up_tc, tear_down_tc);
-
- // Is this a death test case?
- if (internal::UnitTestOptions::MatchesFilter(test_case_name,
- kDeathTestCaseFilter)) {
- // Yes. Inserts the test case after the last death test case
- // defined so far. This only works when the test cases haven't
- // been shuffled. Otherwise we may end up running a death test
- // after a non-death test.
- ++last_death_test_case_;
- test_cases_.insert(test_cases_.begin() + last_death_test_case_,
- new_test_case);
- } else {
- // No. Appends to the end of the list.
- test_cases_.push_back(new_test_case);
- }
-
- test_case_indices_.push_back(static_cast<int>(test_case_indices_.size()));
- return new_test_case;
-}
-
-// Helpers for setting up / tearing down the given environment. They
-// are for use in the ForEach() function.
-static void SetUpEnvironment(Environment* env) { env->SetUp(); }
-static void TearDownEnvironment(Environment* env) { env->TearDown(); }
-
-// Runs all tests in this UnitTest object, prints the result, and
-// returns true if all tests are successful. If any exception is
-// thrown during a test, the test is considered to be failed, but the
-// rest of the tests will still be run.
-//
-// When parameterized tests are enabled, it expands and registers
-// parameterized tests first in RegisterParameterizedTests().
-// All other functions called from RunAllTests() may safely assume that
-// parameterized tests are ready to be counted and run.
-bool UnitTestImpl::RunAllTests() {
- // Makes sure InitGoogleTest() was called.
- if (!GTestIsInitialized()) {
- printf("%s",
- "\nThis test program did NOT call ::testing::InitGoogleTest "
- "before calling RUN_ALL_TESTS(). Please fix it.\n");
- return false;
- }
-
- // Do not run any test if the --help flag was specified.
- if (g_help_flag)
- return true;
-
- // Repeats the call to the post-flag parsing initialization in case the
- // user didn't call InitGoogleTest.
- PostFlagParsingInit();
-
- // Even if sharding is not on, test runners may want to use the
- // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding
- // protocol.
- internal::WriteToShardStatusFileIfNeeded();
-
- // True iff we are in a subprocess for running a thread-safe-style
- // death test.
- bool in_subprocess_for_death_test = false;
-
-#if GTEST_HAS_DEATH_TEST
- in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL);
-#endif // GTEST_HAS_DEATH_TEST
-
- const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex,
- in_subprocess_for_death_test);
-
- // Compares the full test names with the filter to decide which
- // tests to run.
- const bool has_tests_to_run = FilterTests(should_shard
- ? HONOR_SHARDING_PROTOCOL
- : IGNORE_SHARDING_PROTOCOL) > 0;
-
- // Lists the tests and exits if the --gtest_list_tests flag was specified.
- if (GTEST_FLAG(list_tests)) {
- // This must be called *after* FilterTests() has been called.
- ListTestsMatchingFilter();
- return true;
- }
-
- random_seed_ = GTEST_FLAG(shuffle) ?
- GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0;
-
- // True iff at least one test has failed.
- bool failed = false;
-
- TestEventListener* repeater = listeners()->repeater();
-
- start_timestamp_ = GetTimeInMillis();
- repeater->OnTestProgramStart(*parent_);
-
- // How many times to repeat the tests? We don't want to repeat them
- // when we are inside the subprocess of a death test.
- const int repeat = in_subprocess_for_death_test ? 1 : GTEST_FLAG(repeat);
- // Repeats forever if the repeat count is negative.
- const bool forever = repeat < 0;
- for (int i = 0; forever || i != repeat; i++) {
- // We want to preserve failures generated by ad-hoc test
- // assertions executed before RUN_ALL_TESTS().
- ClearNonAdHocTestResult();
-
- const TimeInMillis start = GetTimeInMillis();
-
- // Shuffles test cases and tests if requested.
- if (has_tests_to_run && GTEST_FLAG(shuffle)) {
- random()->Reseed(random_seed_);
- // This should be done before calling OnTestIterationStart(),
- // such that a test event listener can see the actual test order
- // in the event.
- ShuffleTests();
- }
-
- // Tells the unit test event listeners that the tests are about to start.
- repeater->OnTestIterationStart(*parent_, i);
-
- // Runs each test case if there is at least one test to run.
- if (has_tests_to_run) {
- // Sets up all environments beforehand.
- repeater->OnEnvironmentsSetUpStart(*parent_);
- ForEach(environments_, SetUpEnvironment);
- repeater->OnEnvironmentsSetUpEnd(*parent_);
-
- // Runs the tests only if there was no fatal failure during global
- // set-up.
- if (!Test::HasFatalFailure()) {
- for (int test_index = 0; test_index < total_test_case_count();
- test_index++) {
- GetMutableTestCase(test_index)->Run();
- }
- }
-
- // Tears down all environments in reverse order afterwards.
- repeater->OnEnvironmentsTearDownStart(*parent_);
- std::for_each(environments_.rbegin(), environments_.rend(),
- TearDownEnvironment);
- repeater->OnEnvironmentsTearDownEnd(*parent_);
- }
-
- elapsed_time_ = GetTimeInMillis() - start;
-
- // Tells the unit test event listener that the tests have just finished.
- repeater->OnTestIterationEnd(*parent_, i);
-
- // Gets the result and clears it.
- if (!Passed()) {
- failed = true;
- }
-
- // Restores the original test order after the iteration. This
- // allows the user to quickly repro a failure that happens in the
- // N-th iteration without repeating the first (N - 1) iterations.
- // This is not enclosed in "if (GTEST_FLAG(shuffle)) { ... }", in
- // case the user somehow changes the value of the flag somewhere
- // (it's always safe to unshuffle the tests).
- UnshuffleTests();
-
- if (GTEST_FLAG(shuffle)) {
- // Picks a new random seed for each iteration.
- random_seed_ = GetNextRandomSeed(random_seed_);
- }
- }
-
- repeater->OnTestProgramEnd(*parent_);
-
- return !failed;
-}
-
-// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
-// if the variable is present. If a file already exists at this location, this
-// function will write over it. If the variable is present, but the file cannot
-// be created, prints an error and exits.
-void WriteToShardStatusFileIfNeeded() {
- const char* const test_shard_file = posix::GetEnv(kTestShardStatusFile);
- if (test_shard_file != NULL) {
- FILE* const file = posix::FOpen(test_shard_file, "w");
- if (file == NULL) {
- ColoredPrintf(COLOR_RED,
- "Could not write to the test shard status file \"%s\" "
- "specified by the %s environment variable.\n",
- test_shard_file, kTestShardStatusFile);
- fflush(stdout);
- exit(EXIT_FAILURE);
- }
- fclose(file);
- }
-}
-
-// Checks whether sharding is enabled by examining the relevant
-// environment variable values. If the variables are present,
-// but inconsistent (i.e., shard_index >= total_shards), prints
-// an error and exits. If in_subprocess_for_death_test, sharding is
-// disabled because it must only be applied to the original test
-// process. Otherwise, we could filter out death tests we intended to execute.
-bool ShouldShard(const char* total_shards_env,
- const char* shard_index_env,
- bool in_subprocess_for_death_test) {
- if (in_subprocess_for_death_test) {
- return false;
- }
-
- const Int32 total_shards = Int32FromEnvOrDie(total_shards_env, -1);
- const Int32 shard_index = Int32FromEnvOrDie(shard_index_env, -1);
-
- if (total_shards == -1 && shard_index == -1) {
- return false;
- } else if (total_shards == -1 && shard_index != -1) {
- const Message msg = Message()
- << "Invalid environment variables: you have "
- << kTestShardIndex << " = " << shard_index
- << ", but have left " << kTestTotalShards << " unset.\n";
- ColoredPrintf(COLOR_RED, msg.GetString().c_str());
- fflush(stdout);
- exit(EXIT_FAILURE);
- } else if (total_shards != -1 && shard_index == -1) {
- const Message msg = Message()
- << "Invalid environment variables: you have "
- << kTestTotalShards << " = " << total_shards
- << ", but have left " << kTestShardIndex << " unset.\n";
- ColoredPrintf(COLOR_RED, msg.GetString().c_str());
- fflush(stdout);
- exit(EXIT_FAILURE);
- } else if (shard_index < 0 || shard_index >= total_shards) {
- const Message msg = Message()
- << "Invalid environment variables: we require 0 <= "
- << kTestShardIndex << " < " << kTestTotalShards
- << ", but you have " << kTestShardIndex << "=" << shard_index
- << ", " << kTestTotalShards << "=" << total_shards << ".\n";
- ColoredPrintf(COLOR_RED, msg.GetString().c_str());
- fflush(stdout);
- exit(EXIT_FAILURE);
- }
-
- return total_shards > 1;
-}
-
-// Parses the environment variable var as an Int32. If it is unset,
-// returns default_val. If it is not an Int32, prints an error
-// and aborts.
-Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) {
- const char* str_val = posix::GetEnv(var);
- if (str_val == NULL) {
- return default_val;
- }
-
- Int32 result;
- if (!ParseInt32(Message() << "The value of environment variable " << var,
- str_val, &result)) {
- exit(EXIT_FAILURE);
- }
- return result;
-}
-
-// Given the total number of shards, the shard index, and the test id,
-// returns true iff the test should be run on this shard. The test id is
-// some arbitrary but unique non-negative integer assigned to each test
-// method. Assumes that 0 <= shard_index < total_shards.
-bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {
- return (test_id % total_shards) == shard_index;
-}
-
-// Compares the name of each test with the user-specified filter to
-// decide whether the test should be run, then records the result in
-// each TestCase and TestInfo object.
-// If shard_tests == true, further filters tests based on sharding
-// variables in the environment - see
-// http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide.
-// Returns the number of tests that should run.
-int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
- const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ?
- Int32FromEnvOrDie(kTestTotalShards, -1) : -1;
- const Int32 shard_index = shard_tests == HONOR_SHARDING_PROTOCOL ?
- Int32FromEnvOrDie(kTestShardIndex, -1) : -1;
-
- // num_runnable_tests are the number of tests that will
- // run across all shards (i.e., match filter and are not disabled).
- // num_selected_tests are the number of tests to be run on
- // this shard.
- int num_runnable_tests = 0;
- int num_selected_tests = 0;
- for (size_t i = 0; i < test_cases_.size(); i++) {
- TestCase* const test_case = test_cases_[i];
- const std::string &test_case_name = test_case->name();
- test_case->set_should_run(false);
-
- for (size_t j = 0; j < test_case->test_info_list().size(); j++) {
- TestInfo* const test_info = test_case->test_info_list()[j];
- const std::string test_name(test_info->name());
- // A test is disabled if test case name or test name matches
- // kDisableTestFilter.
- const bool is_disabled =
- internal::UnitTestOptions::MatchesFilter(test_case_name,
- kDisableTestFilter) ||
- internal::UnitTestOptions::MatchesFilter(test_name,
- kDisableTestFilter);
- test_info->is_disabled_ = is_disabled;
-
- const bool matches_filter =
- internal::UnitTestOptions::FilterMatchesTest(test_case_name,
- test_name);
- test_info->matches_filter_ = matches_filter;
-
- const bool is_runnable =
- (GTEST_FLAG(also_run_disabled_tests) || !is_disabled) &&
- matches_filter;
-
- const bool is_selected = is_runnable &&
- (shard_tests == IGNORE_SHARDING_PROTOCOL ||
- ShouldRunTestOnShard(total_shards, shard_index,
- num_runnable_tests));
-
- num_runnable_tests += is_runnable;
- num_selected_tests += is_selected;
-
- test_info->should_run_ = is_selected;
- test_case->set_should_run(test_case->should_run() || is_selected);
- }
- }
- return num_selected_tests;
-}
-
-// Prints the given C-string on a single line by replacing all '\n'
-// characters with string "\\n". If the output takes more than
-// max_length characters, only prints the first max_length characters
-// and "...".
-static void PrintOnOneLine(const char* str, int max_length) {
- if (str != NULL) {
- for (int i = 0; *str != '\0'; ++str) {
- if (i >= max_length) {
- printf("...");
- break;
- }
- if (*str == '\n') {
- printf("\\n");
- i += 2;
- } else {
- printf("%c", *str);
- ++i;
- }
- }
- }
-}
-
-// Prints the names of the tests matching the user-specified filter flag.
-void UnitTestImpl::ListTestsMatchingFilter() {
- // Print at most this many characters for each type/value parameter.
- const int kMaxParamLength = 250;
-
- for (size_t i = 0; i < test_cases_.size(); i++) {
- const TestCase* const test_case = test_cases_[i];
- bool printed_test_case_name = false;
-
- for (size_t j = 0; j < test_case->test_info_list().size(); j++) {
- const TestInfo* const test_info =
- test_case->test_info_list()[j];
- if (test_info->matches_filter_) {
- if (!printed_test_case_name) {
- printed_test_case_name = true;
- printf("%s.", test_case->name());
- if (test_case->type_param() != NULL) {
- printf(" # %s = ", kTypeParamLabel);
- // We print the type parameter on a single line to make
- // the output easy to parse by a program.
- PrintOnOneLine(test_case->type_param(), kMaxParamLength);
- }
- printf("\n");
- }
- printf(" %s", test_info->name());
- if (test_info->value_param() != NULL) {
- printf(" # %s = ", kValueParamLabel);
- // We print the value parameter on a single line to make the
- // output easy to parse by a program.
- PrintOnOneLine(test_info->value_param(), kMaxParamLength);
- }
- printf("\n");
- }
- }
- }
- fflush(stdout);
-}
-
-// Sets the OS stack trace getter.
-//
-// Does nothing if the input and the current OS stack trace getter are
-// the same; otherwise, deletes the old getter and makes the input the
-// current getter.
-void UnitTestImpl::set_os_stack_trace_getter(
- OsStackTraceGetterInterface* getter) {
- if (os_stack_trace_getter_ != getter) {
- delete os_stack_trace_getter_;
- os_stack_trace_getter_ = getter;
- }
-}
-
-// Returns the current OS stack trace getter if it is not NULL;
-// otherwise, creates an OsStackTraceGetter, makes it the current
-// getter, and returns it.
-OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
- if (os_stack_trace_getter_ == NULL) {
- os_stack_trace_getter_ = new OsStackTraceGetter;
- }
-
- return os_stack_trace_getter_;
-}
-
-// Returns the TestResult for the test that's currently running, or
-// the TestResult for the ad hoc test if no test is running.
-TestResult* UnitTestImpl::current_test_result() {
- return current_test_info_ ?
- &(current_test_info_->result_) : &ad_hoc_test_result_;
-}
-
-// Shuffles all test cases, and the tests within each test case,
-// making sure that death tests are still run first.
-void UnitTestImpl::ShuffleTests() {
- // Shuffles the death test cases.
- ShuffleRange(random(), 0, last_death_test_case_ + 1, &test_case_indices_);
-
- // Shuffles the non-death test cases.
- ShuffleRange(random(), last_death_test_case_ + 1,
- static_cast<int>(test_cases_.size()), &test_case_indices_);
-
- // Shuffles the tests inside each test case.
- for (size_t i = 0; i < test_cases_.size(); i++) {
- test_cases_[i]->ShuffleTests(random());
- }
-}
-
-// Restores the test cases and tests to their order before the first shuffle.
-void UnitTestImpl::UnshuffleTests() {
- for (size_t i = 0; i < test_cases_.size(); i++) {
- // Unshuffles the tests in each test case.
- test_cases_[i]->UnshuffleTests();
- // Resets the index of each test case.
- test_case_indices_[i] = static_cast<int>(i);
- }
-}
-
-// Returns the current OS stack trace as an std::string.
-//
-// The maximum number of stack frames to be included is specified by
-// the gtest_stack_trace_depth flag. The skip_count parameter
-// specifies the number of top frames to be skipped, which doesn't
-// count against the number of frames to be included.
-//
-// For example, if Foo() calls Bar(), which in turn calls
-// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
-// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
-std::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,
- int skip_count) {
- // We pass skip_count + 1 to skip this wrapper function in addition
- // to what the user really wants to skip.
- return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1);
-}
-
-// Used by the GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_ macro to
-// suppress unreachable code warnings.
-namespace {
-class ClassUniqueToAlwaysTrue {};
-}
-
-bool IsTrue(bool condition) { return condition; }
-
-bool AlwaysTrue() {
-#if GTEST_HAS_EXCEPTIONS
- // This condition is always false so AlwaysTrue() never actually throws,
- // but it makes the compiler think that it may throw.
- if (IsTrue(false))
- throw ClassUniqueToAlwaysTrue();
-#endif // GTEST_HAS_EXCEPTIONS
- return true;
-}
-
-// If *pstr starts with the given prefix, modifies *pstr to be right
-// past the prefix and returns true; otherwise leaves *pstr unchanged
-// and returns false. None of pstr, *pstr, and prefix can be NULL.
-bool SkipPrefix(const char* prefix, const char** pstr) {
- const size_t prefix_len = strlen(prefix);
- if (strncmp(*pstr, prefix, prefix_len) == 0) {
- *pstr += prefix_len;
- return true;
- }
- return false;
-}
-
-// Parses a string as a command line flag. The string should have
-// the format "--flag=value". When def_optional is true, the "=value"
-// part can be omitted.
-//
-// Returns the value of the flag, or NULL if the parsing failed.
-const char* ParseFlagValue(const char* str,
- const char* flag,
- bool def_optional) {
- // str and flag must not be NULL.
- if (str == NULL || flag == NULL) return NULL;
-
- // The flag must start with "--" followed by GTEST_FLAG_PREFIX_.
- const std::string flag_str = std::string("--") + GTEST_FLAG_PREFIX_ + flag;
- const size_t flag_len = flag_str.length();
- if (strncmp(str, flag_str.c_str(), flag_len) != 0) return NULL;
-
- // Skips the flag name.
- const char* flag_end = str + flag_len;
-
- // When def_optional is true, it's OK to not have a "=value" part.
- if (def_optional && (flag_end[0] == '\0')) {
- return flag_end;
- }
-
- // If def_optional is true and there are more characters after the
- // flag name, or if def_optional is false, there must be a '=' after
- // the flag name.
- if (flag_end[0] != '=') return NULL;
-
- // Returns the string after "=".
- return flag_end + 1;
-}
-
-// Parses a string for a bool flag, in the form of either
-// "--flag=value" or "--flag".
-//
-// In the former case, the value is taken as true as long as it does
-// not start with '0', 'f', or 'F'.
-//
-// In the latter case, the value is taken as true.
-//
-// On success, stores the value of the flag in *value, and returns
-// true. On failure, returns false without changing *value.
-bool ParseBoolFlag(const char* str, const char* flag, bool* value) {
- // Gets the value of the flag as a string.
- const char* const value_str = ParseFlagValue(str, flag, true);
-
- // Aborts if the parsing failed.
- if (value_str == NULL) return false;
-
- // Converts the string value to a bool.
- *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F');
- return true;
-}
-
-// Parses a string for an Int32 flag, in the form of
-// "--flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true. On failure, returns false without changing *value.
-bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
- // Gets the value of the flag as a string.
- const char* const value_str = ParseFlagValue(str, flag, false);
-
- // Aborts if the parsing failed.
- if (value_str == NULL) return false;
-
- // Sets *value to the value of the flag.
- return ParseInt32(Message() << "The value of flag --" << flag,
- value_str, value);
-}
-
-// Parses a string for a string flag, in the form of
-// "--flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true. On failure, returns false without changing *value.
-bool ParseStringFlag(const char* str, const char* flag, std::string* value) {
- // Gets the value of the flag as a string.
- const char* const value_str = ParseFlagValue(str, flag, false);
-
- // Aborts if the parsing failed.
- if (value_str == NULL) return false;
-
- // Sets *value to the value of the flag.
- *value = value_str;
- return true;
-}
-
-// Determines whether a string has a prefix that Google Test uses for its
-// flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_.
-// If Google Test detects that a command line flag has its prefix but is not
-// recognized, it will print its help message. Flags starting with
-// GTEST_INTERNAL_PREFIX_ followed by "internal_" are considered Google Test
-// internal flags and do not trigger the help message.
-static bool HasGoogleTestFlagPrefix(const char* str) {
- return (SkipPrefix("--", &str) ||
- SkipPrefix("-", &str) ||
- SkipPrefix("/", &str)) &&
- !SkipPrefix(GTEST_FLAG_PREFIX_ "internal_", &str) &&
- (SkipPrefix(GTEST_FLAG_PREFIX_, &str) ||
- SkipPrefix(GTEST_FLAG_PREFIX_DASH_, &str));
-}
-
-// Prints a string containing code-encoded text. The following escape
-// sequences can be used in the string to control the text color:
-//
-// @@ prints a single '@' character.
-// @R changes the color to red.
-// @G changes the color to green.
-// @Y changes the color to yellow.
-// @D changes to the default terminal text color.
-//
-// TODO(wan@google.com): Write tests for this once we add stdout
-// capturing to Google Test.
-static void PrintColorEncoded(const char* str) {
- GTestColor color = COLOR_DEFAULT; // The current color.
-
- // Conceptually, we split the string into segments divided by escape
- // sequences. Then we print one segment at a time. At the end of
- // each iteration, the str pointer advances to the beginning of the
- // next segment.
- for (;;) {
- const char* p = strchr(str, '@');
- if (p == NULL) {
- ColoredPrintf(color, "%s", str);
- return;
- }
-
- ColoredPrintf(color, "%s", std::string(str, p).c_str());
-
- const char ch = p[1];
- str = p + 2;
- if (ch == '@') {
- ColoredPrintf(color, "@");
- } else if (ch == 'D') {
- color = COLOR_DEFAULT;
- } else if (ch == 'R') {
- color = COLOR_RED;
- } else if (ch == 'G') {
- color = COLOR_GREEN;
- } else if (ch == 'Y') {
- color = COLOR_YELLOW;
- } else {
- --str;
- }
- }
-}
-
-static const char kColorEncodedHelpMessage[] =
-"This program contains tests written using " GTEST_NAME_ ". You can use the\n"
-"following command line flags to control its behavior:\n"
-"\n"
-"Test Selection:\n"
-" @G--" GTEST_FLAG_PREFIX_ "list_tests@D\n"
-" List the names of all tests instead of running them. The name of\n"
-" TEST(Foo, Bar) is \"Foo.Bar\".\n"
-" @G--" GTEST_FLAG_PREFIX_ "filter=@YPOSTIVE_PATTERNS"
- "[@G-@YNEGATIVE_PATTERNS]@D\n"
-" Run only the tests whose name matches one of the positive patterns but\n"
-" none of the negative patterns. '?' matches any single character; '*'\n"
-" matches any substring; ':' separates two patterns.\n"
-" @G--" GTEST_FLAG_PREFIX_ "also_run_disabled_tests@D\n"
-" Run all disabled tests too.\n"
-"\n"
-"Test Execution:\n"
-" @G--" GTEST_FLAG_PREFIX_ "repeat=@Y[COUNT]@D\n"
-" Run the tests repeatedly; use a negative count to repeat forever.\n"
-" @G--" GTEST_FLAG_PREFIX_ "shuffle@D\n"
-" Randomize tests' orders on every iteration.\n"
-" @G--" GTEST_FLAG_PREFIX_ "random_seed=@Y[NUMBER]@D\n"
-" Random number seed to use for shuffling test orders (between 1 and\n"
-" 99999, or 0 to use a seed based on the current time).\n"
-"\n"
-"Test Output:\n"
-" @G--" GTEST_FLAG_PREFIX_ "color=@Y(@Gyes@Y|@Gno@Y|@Gauto@Y)@D\n"
-" Enable/disable colored output. The default is @Gauto@D.\n"
-" -@G-" GTEST_FLAG_PREFIX_ "print_time=0@D\n"
-" Don't print the elapsed time of each test.\n"
-" @G--" GTEST_FLAG_PREFIX_ "output=xml@Y[@G:@YDIRECTORY_PATH@G"
- GTEST_PATH_SEP_ "@Y|@G:@YFILE_PATH]@D\n"
-" Generate an XML report in the given directory or with the given file\n"
-" name. @YFILE_PATH@D defaults to @Gtest_details.xml@D.\n"
-#if GTEST_CAN_STREAM_RESULTS_
-" @G--" GTEST_FLAG_PREFIX_ "stream_result_to=@YHOST@G:@YPORT@D\n"
-" Stream test results to the given server.\n"
-#endif // GTEST_CAN_STREAM_RESULTS_
-"\n"
-"Assertion Behavior:\n"
-#if GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
-" @G--" GTEST_FLAG_PREFIX_ "death_test_style=@Y(@Gfast@Y|@Gthreadsafe@Y)@D\n"
-" Set the default death test style.\n"
-#endif // GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
-" @G--" GTEST_FLAG_PREFIX_ "break_on_failure@D\n"
-" Turn assertion failures into debugger break-points.\n"
-" @G--" GTEST_FLAG_PREFIX_ "throw_on_failure@D\n"
-" Turn assertion failures into C++ exceptions.\n"
-" @G--" GTEST_FLAG_PREFIX_ "catch_exceptions=0@D\n"
-" Do not report exceptions as test failures. Instead, allow them\n"
-" to crash the program or throw a pop-up (on Windows).\n"
-"\n"
-"Except for @G--" GTEST_FLAG_PREFIX_ "list_tests@D, you can alternatively set "
- "the corresponding\n"
-"environment variable of a flag (all letters in upper-case). For example, to\n"
-"disable colored text output, you can either specify @G--" GTEST_FLAG_PREFIX_
- "color=no@D or set\n"
-"the @G" GTEST_FLAG_PREFIX_UPPER_ "COLOR@D environment variable to @Gno@D.\n"
-"\n"
-"For more information, please read the " GTEST_NAME_ " documentation at\n"
-"@G" GTEST_PROJECT_URL_ "@D. If you find a bug in " GTEST_NAME_ "\n"
-"(not one in your own code or tests), please report it to\n"
-"@G<" GTEST_DEV_EMAIL_ ">@D.\n";
-
-// Parses the command line for Google Test flags, without initializing
-// other parts of Google Test. The type parameter CharType can be
-// instantiated to either char or wchar_t.
-template <typename CharType>
-void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
- for (int i = 1; i < *argc; i++) {
- const std::string arg_string = StreamableToString(argv[i]);
- const char* const arg = arg_string.c_str();
-
- using internal::ParseBoolFlag;
- using internal::ParseInt32Flag;
- using internal::ParseStringFlag;
-
- // Do we see a Google Test flag?
- if (ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag,
- >EST_FLAG(also_run_disabled_tests)) ||
- ParseBoolFlag(arg, kBreakOnFailureFlag,
- >EST_FLAG(break_on_failure)) ||
- ParseBoolFlag(arg, kCatchExceptionsFlag,
- >EST_FLAG(catch_exceptions)) ||
- ParseStringFlag(arg, kColorFlag, >EST_FLAG(color)) ||
- ParseStringFlag(arg, kDeathTestStyleFlag,
- >EST_FLAG(death_test_style)) ||
- ParseBoolFlag(arg, kDeathTestUseFork,
- >EST_FLAG(death_test_use_fork)) ||
- ParseStringFlag(arg, kFilterFlag, >EST_FLAG(filter)) ||
- ParseStringFlag(arg, kInternalRunDeathTestFlag,
- >EST_FLAG(internal_run_death_test)) ||
- ParseBoolFlag(arg, kListTestsFlag, >EST_FLAG(list_tests)) ||
- ParseStringFlag(arg, kOutputFlag, >EST_FLAG(output)) ||
- ParseBoolFlag(arg, kPrintTimeFlag, >EST_FLAG(print_time)) ||
- ParseInt32Flag(arg, kRandomSeedFlag, >EST_FLAG(random_seed)) ||
- ParseInt32Flag(arg, kRepeatFlag, >EST_FLAG(repeat)) ||
- ParseBoolFlag(arg, kShuffleFlag, >EST_FLAG(shuffle)) ||
- ParseInt32Flag(arg, kStackTraceDepthFlag,
- >EST_FLAG(stack_trace_depth)) ||
- ParseStringFlag(arg, kStreamResultToFlag,
- >EST_FLAG(stream_result_to)) ||
- ParseBoolFlag(arg, kThrowOnFailureFlag,
- >EST_FLAG(throw_on_failure))
- ) {
- // Yes. Shift the remainder of the argv list left by one. Note
- // that argv has (*argc + 1) elements, the last one always being
- // NULL. The following loop moves the trailing NULL element as
- // well.
- for (int j = i; j != *argc; j++) {
- argv[j] = argv[j + 1];
- }
-
- // Decrements the argument count.
- (*argc)--;
-
- // We also need to decrement the iterator as we just removed
- // an element.
- i--;
- } else if (arg_string == "--help" || arg_string == "-h" ||
- arg_string == "-?" || arg_string == "/?" ||
- HasGoogleTestFlagPrefix(arg)) {
- // Both help flag and unrecognized Google Test flags (excluding
- // internal ones) trigger help display.
- g_help_flag = true;
- }
- }
-
- if (g_help_flag) {
- // We print the help here instead of in RUN_ALL_TESTS(), as the
- // latter may not be called at all if the user is using Google
- // Test with another testing framework.
- PrintColorEncoded(kColorEncodedHelpMessage);
- }
-}
-
-// Parses the command line for Google Test flags, without initializing
-// other parts of Google Test.
-void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
- ParseGoogleTestFlagsOnlyImpl(argc, argv);
-}
-void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {
- ParseGoogleTestFlagsOnlyImpl(argc, argv);
-}
-
-// The internal implementation of InitGoogleTest().
-//
-// The type parameter CharType can be instantiated to either char or
-// wchar_t.
-template <typename CharType>
-void InitGoogleTestImpl(int* argc, CharType** argv) {
- g_init_gtest_count++;
-
- // We don't want to run the initialization code twice.
- if (g_init_gtest_count != 1) return;
-
- if (*argc <= 0) return;
-
- internal::g_executable_path = internal::StreamableToString(argv[0]);
-
-#if GTEST_HAS_DEATH_TEST
-
- g_argvs.clear();
- for (int i = 0; i != *argc; i++) {
- g_argvs.push_back(StreamableToString(argv[i]));
- }
-
-#endif // GTEST_HAS_DEATH_TEST
-
- ParseGoogleTestFlagsOnly(argc, argv);
- GetUnitTestImpl()->PostFlagParsingInit();
-}
-
-} // namespace internal
-
-// Initializes Google Test. This must be called before calling
-// RUN_ALL_TESTS(). In particular, it parses a command line for the
-// flags that Google Test recognizes. Whenever a Google Test flag is
-// seen, it is removed from argv, and *argc is decremented.
-//
-// No value is returned. Instead, the Google Test flag variables are
-// updated.
-//
-// Calling the function for the second time has no user-visible effect.
-void InitGoogleTest(int* argc, char** argv) {
- internal::InitGoogleTestImpl(argc, argv);
-}
-
-// This overloaded version can be used in Windows programs compiled in
-// UNICODE mode.
-void InitGoogleTest(int* argc, wchar_t** argv) {
- internal::InitGoogleTestImpl(argc, argv);
-}
-
-} // namespace testing
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest_main.cc b/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest_main.cc
deleted file mode 100644
index f302822..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/gtest/src/gtest_main.cc
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include <stdio.h>
-
-#include "gtest/gtest.h"
-
-GTEST_API_ int main(int argc, char **argv) {
- printf("Running main() from gtest_main.cc\n");
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/include/TestBench.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/include/TestBench.h
deleted file mode 100644
index c760ebc..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/include/TestBench.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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 <stdint.h>
-
-class TestBench {
- public:
- /* Analog input channels */
- static const uint32_t kCameraGyroChannel = 0;
- static const uint32_t kFakeCompressorChannel = 1;
- static const uint32_t kFakeAnalogOutputChannel = 2;
-
- /* Analog output channels */
- static const uint32_t kAnalogOutputChannel = 0;
-
- /* DIO channels */
- static const uint32_t kTalonEncoderChannelA = 0;
- static const uint32_t kTalonEncoderChannelB = 1;
- static const uint32_t kVictorEncoderChannelA = 2;
- static const uint32_t kVictorEncoderChannelB = 3;
- static const uint32_t kJaguarEncoderChannelA = 4;
- static const uint32_t kJaguarEncoderChannelB = 5;
- static const uint32_t kLoop1OutputChannel = 6;
- static const uint32_t kLoop1InputChannel = 7;
- static const uint32_t kLoop2OutputChannel = 8;
- static const uint32_t kLoop2InputChannel = 9;
-
- /* PWM channels */
- static const uint32_t kVictorChannel = 1;
- static const uint32_t kJaguarChannel = 2;
- static const uint32_t kCameraPanChannel = 8;
- static const uint32_t kCameraTiltChannel = 9;
-
- /* MXP digital channels */
- static const uint32_t kTalonChannel = 10;
- static const uint32_t kFakePressureSwitchChannel = 11;
- static const uint32_t kFakeSolenoid1Channel = 12;
- static const uint32_t kFakeSolenoid2Channel = 13;
- static const uint32_t kFakeRelayForward = 18;
- static const uint32_t kFakeRelayReverse = 19;
-
- /* Relay channels */
- static const uint32_t kRelayChannel = 0;
-
- /* PDP channels */
- static const uint32_t kJaguarPDPChannel = 6;
- static const uint32_t kVictorPDPChannel = 8;
- static const uint32_t kTalonPDPChannel = 10;
-
- /* PCM channels */
- static const int32_t kSolenoidChannel1 = 0;
- static const int32_t kSolenoidChannel2 = 1;
-
- /* Filter constants */
- static constexpr double kFilterStep = 0.005;
- static constexpr double kFilterTime = 2.0;
- static constexpr double kSinglePoleIIRTimeConstant = 0.015915;
- static constexpr double kSinglePoleIIRExpectedOutput = -3.2172003;
- static constexpr double kHighPassTimeConstant = 0.006631;
- static constexpr double kHighPassExpectedOutput = 10.074717;
- static constexpr int32_t kMovAvgTaps = 6;
- static constexpr double kMovAvgExpectedOutput = -10.191644;
-};
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/include/command/MockCommand.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/include/command/MockCommand.h
deleted file mode 100644
index 0efdfae..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/include/command/MockCommand.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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 <Commands/Command.h>
-
-namespace frc {
-
-class MockCommand : public Command {
- public:
- MockCommand();
- int32_t GetInitializeCount() { return m_initializeCount; }
- bool HasInitialized();
-
- int32_t GetExecuteCount() { return m_executeCount; }
- int32_t GetIsFinishedCount() { return m_isFinishedCount; }
- bool IsHasFinished() { return m_hasFinished; }
- void SetHasFinished(bool hasFinished) { m_hasFinished = hasFinished; }
- int32_t GetEndCount() { return m_endCount; }
- bool HasEnd();
-
- int32_t GetInterruptedCount() { return m_interruptedCount; }
- bool HasInterrupted();
-
- protected:
- void Initialize() override;
- void Execute() override;
- bool IsFinished() override;
- void End() override;
- void Interrupted() override;
-
- private:
- int32_t m_initializeCount;
- int32_t m_executeCount;
- int32_t m_isFinishedCount;
- bool m_hasFinished;
- int32_t m_endCount;
- int32_t m_interruptedCount;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/include/command/MockConditionalCommand.h b/third_party/allwpilib_2017/wpilibcIntegrationTests/include/command/MockConditionalCommand.h
deleted file mode 100644
index b00911e..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/include/command/MockConditionalCommand.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2017. 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 <Commands/ConditionalCommand.h>
-
-#include "command/MockCommand.h"
-
-namespace frc {
-
-class MockConditionalCommand : public ConditionalCommand {
- public:
- MockConditionalCommand(MockCommand* onTrue, MockCommand* onFalse);
- void SetCondition(bool condition);
-
- protected:
- bool Condition() override;
-
- private:
- bool m_condition = false;
-};
-
-} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/AnalogLoopTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/AnalogLoopTest.cpp
deleted file mode 100644
index 7b0d18d..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/AnalogLoopTest.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "AnalogInput.h"
-#include "AnalogOutput.h"
-#include "AnalogTrigger.h"
-#include "Counter.h"
-#include "TestBench.h"
-#include "Timer.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-static const double kDelayTime = 0.01;
-
-/**
- * A fixture with an analog input and an analog output wired together
- */
-class AnalogLoopTest : public testing::Test {
- protected:
- AnalogInput* m_input;
- AnalogOutput* m_output;
-
- void SetUp() override {
- m_input = new AnalogInput(TestBench::kFakeAnalogOutputChannel);
- m_output = new AnalogOutput(TestBench::kAnalogOutputChannel);
- }
-
- void TearDown() override {
- delete m_input;
- delete m_output;
- }
-};
-
-/**
- * Test analog inputs and outputs by setting one and making sure the other
- * matches.
- */
-TEST_F(AnalogLoopTest, AnalogInputWorks) {
- // Set the output voltage and check if the input measures the same voltage
- for (int32_t i = 0; i < 50; i++) {
- m_output->SetVoltage(i / 10.0);
-
- Wait(kDelayTime);
-
- EXPECT_NEAR(m_output->GetVoltage(), m_input->GetVoltage(), 0.01);
- }
-}
-
-/**
- * Test if we can use an analog trigger to check if the output is within a
- * range correctly.
- */
-TEST_F(AnalogLoopTest, AnalogTriggerWorks) {
- AnalogTrigger trigger(m_input);
- trigger.SetLimitsVoltage(2.0, 3.0);
-
- m_output->SetVoltage(1.0);
- Wait(kDelayTime);
-
- EXPECT_FALSE(trigger.GetInWindow())
- << "Analog trigger is in the window (2V, 3V)";
- EXPECT_FALSE(trigger.GetTriggerState()) << "Analog trigger is on";
-
- m_output->SetVoltage(2.5);
- Wait(kDelayTime);
-
- EXPECT_TRUE(trigger.GetInWindow())
- << "Analog trigger is not in the window (2V, 3V)";
- EXPECT_FALSE(trigger.GetTriggerState()) << "Analog trigger is on";
-
- m_output->SetVoltage(4.0);
- Wait(kDelayTime);
-
- EXPECT_FALSE(trigger.GetInWindow())
- << "Analog trigger is in the window (2V, 3V)";
- EXPECT_TRUE(trigger.GetTriggerState()) << "Analog trigger is not on";
-}
-
-/**
- * Test if we can count the right number of ticks from an analog trigger with
- * a counter.
- */
-TEST_F(AnalogLoopTest, AnalogTriggerCounterWorks) {
- AnalogTrigger trigger(m_input);
- trigger.SetLimitsVoltage(2.0, 3.0);
-
- Counter counter(trigger);
-
- // Turn the analog output low and high 50 times
- for (int32_t i = 0; i < 50; i++) {
- m_output->SetVoltage(1.0);
- Wait(kDelayTime);
- m_output->SetVoltage(4.0);
- Wait(kDelayTime);
- }
-
- // The counter should be 50
- EXPECT_EQ(50, counter.Get())
- << "Analog trigger counter did not count 50 ticks";
-}
-
-static void InterruptHandler(uint32_t interruptAssertedMask, void* param) {
- *reinterpret_cast<int32_t*>(param) = 12345;
-}
-
-TEST_F(AnalogLoopTest, AsynchronusInterruptWorks) {
- int32_t param = 0;
- AnalogTrigger trigger(m_input);
- trigger.SetLimitsVoltage(2.0, 3.0);
-
- // Given an interrupt handler that sets an int32_t to 12345
- std::shared_ptr<AnalogTriggerOutput> triggerOutput =
- trigger.CreateOutput(AnalogTriggerType::kState);
- triggerOutput->RequestInterrupts(InterruptHandler, ¶m);
- triggerOutput->EnableInterrupts();
-
- // If the analog output moves from below to above the window
- m_output->SetVoltage(0.0);
- Wait(kDelayTime);
- m_output->SetVoltage(5.0);
- triggerOutput->CancelInterrupts();
-
- // Then the int32_t should be 12345
- Wait(kDelayTime);
- EXPECT_EQ(12345, param) << "The interrupt did not run.";
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/AnalogPotentiometerTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/AnalogPotentiometerTest.cpp
deleted file mode 100644
index 16a733b..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/AnalogPotentiometerTest.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "AnalogPotentiometer.h" // NOLINT(build/include_order)
-
-#include "AnalogOutput.h"
-#include "ControllerPower.h"
-#include "TestBench.h"
-#include "Timer.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-static const double kScale = 270.0;
-static const double kAngle = 180.0;
-
-class AnalogPotentiometerTest : public testing::Test {
- protected:
- AnalogOutput* m_fakePot;
- AnalogPotentiometer* m_pot;
-
- void SetUp() override {
- m_fakePot = new AnalogOutput(TestBench::kAnalogOutputChannel);
- m_pot =
- new AnalogPotentiometer(TestBench::kFakeAnalogOutputChannel, kScale);
- }
-
- void TearDown() override {
- delete m_fakePot;
- delete m_pot;
- }
-};
-
-TEST_F(AnalogPotentiometerTest, TestInitialSettings) {
- m_fakePot->SetVoltage(0.0);
- Wait(0.1);
- EXPECT_NEAR(0.0, m_pot->Get(), 5.0)
- << "The potentiometer did not initialize to 0.";
-}
-
-TEST_F(AnalogPotentiometerTest, TestRangeValues) {
- m_fakePot->SetVoltage(kAngle / kScale * ControllerPower::GetVoltage5V());
- Wait(0.1);
- EXPECT_NEAR(kAngle, m_pot->Get(), 2.0)
- << "The potentiometer did not measure the correct angle.";
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/BuiltInAccelerometerTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/BuiltInAccelerometerTest.cpp
deleted file mode 100644
index abcac1b..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/BuiltInAccelerometerTest.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "BuiltInAccelerometer.h" // NOLINT(build/include_order)
-
-#include "Timer.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-static constexpr double kAccelerationTolerance = 0.1;
-/**
- * There's not much we can automatically test with the on-board accelerometer,
- * but checking for gravity is probably good enough to tell that it's working.
- */
-TEST(BuiltInAccelerometerTest, Accelerometer) {
- BuiltInAccelerometer accelerometer;
-
- /* The testbench sometimes shakes a little from a previous test. Give it
- some time. */
- Wait(1.0);
-
- ASSERT_NEAR(0.0, accelerometer.GetX(), kAccelerationTolerance);
- ASSERT_NEAR(1.0, accelerometer.GetY(), kAccelerationTolerance);
- ASSERT_NEAR(0.0, accelerometer.GetZ(), kAccelerationTolerance);
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/CircularBufferTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/CircularBufferTest.cpp
deleted file mode 100644
index 24b00a9..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/CircularBufferTest.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "CircularBuffer.h" // NOLINT(build/include_order)
-
-#include <array>
-
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-static const std::array<double, 10> values = {
- 751.848, 766.366, 342.657, 234.252, 716.126,
- 132.344, 445.697, 22.727, 421.125, 799.913};
-
-static const std::array<double, 8> pushFrontOut = {
- 799.913, 421.125, 22.727, 445.697, 132.344, 716.126, 234.252, 342.657};
-
-static const std::array<double, 8> pushBackOut = {
- 342.657, 234.252, 716.126, 132.344, 445.697, 22.727, 421.125, 799.913};
-
-TEST(CircularBufferTest, PushFrontTest) {
- CircularBuffer<double> queue(8);
-
- for (auto& value : values) {
- queue.PushFront(value);
- }
-
- for (size_t i = 0; i < pushFrontOut.size(); i++) {
- EXPECT_EQ(pushFrontOut[i], queue[i]);
- }
-}
-
-TEST(CircularBufferTest, PushBackTest) {
- CircularBuffer<double> queue(8);
-
- for (auto& value : values) {
- queue.PushBack(value);
- }
-
- for (size_t i = 0; i < pushBackOut.size(); i++) {
- EXPECT_EQ(pushBackOut[i], queue[i]);
- }
-}
-
-TEST(CircularBufferTest, PushPopTest) {
- CircularBuffer<double> queue(3);
-
- // Insert three elements into the buffer
- queue.PushBack(1.0);
- queue.PushBack(2.0);
- queue.PushBack(3.0);
-
- EXPECT_EQ(1.0, queue[0]);
- EXPECT_EQ(2.0, queue[1]);
- EXPECT_EQ(3.0, queue[2]);
-
- /*
- * The buffer is full now, so pushing subsequent elements will overwrite the
- * front-most elements.
- */
-
- queue.PushBack(4.0); // Overwrite 1 with 4
-
- // The buffer now contains 2, 3 and 4
- EXPECT_EQ(2.0, queue[0]);
- EXPECT_EQ(3.0, queue[1]);
- EXPECT_EQ(4.0, queue[2]);
-
- queue.PushBack(5.0); // Overwrite 2 with 5
-
- // The buffer now contains 3, 4 and 5
- EXPECT_EQ(3.0, queue[0]);
- EXPECT_EQ(4.0, queue[1]);
- EXPECT_EQ(5.0, queue[2]);
-
- EXPECT_EQ(5.0, queue.PopBack()); // 5 is removed
-
- // The buffer now contains 3 and 4
- EXPECT_EQ(3.0, queue[0]);
- EXPECT_EQ(4.0, queue[1]);
-
- EXPECT_EQ(3.0, queue.PopFront()); // 3 is removed
-
- // Leaving only one element with value == 4
- EXPECT_EQ(4.0, queue[0]);
-}
-
-TEST(CircularBufferTest, ResetTest) {
- CircularBuffer<double> queue(5);
-
- for (size_t i = 1; i < 6; i++) {
- queue.PushBack(i);
- }
-
- queue.Reset();
-
- for (size_t i = 0; i < 5; i++) {
- EXPECT_EQ(0.0, queue[i]);
- }
-}
-
-TEST(CircularBufferTest, ResizeTest) {
- CircularBuffer<double> queue(5);
-
- /* Buffer contains {1, 2, 3, _, _}
- * ^ front
- */
- queue.PushBack(1.0);
- queue.PushBack(2.0);
- queue.PushBack(3.0);
-
- queue.Resize(2);
- EXPECT_EQ(1.0, queue[0]);
- EXPECT_EQ(2.0, queue[1]);
-
- queue.Resize(5);
- EXPECT_EQ(1.0, queue[0]);
- EXPECT_EQ(2.0, queue[1]);
-
- queue.Reset();
-
- /* Buffer contains {_, 1, 2, 3, _}
- * ^ front
- */
- queue.PushBack(0.0);
- queue.PushBack(1.0);
- queue.PushBack(2.0);
- queue.PushBack(3.0);
- queue.PopFront();
-
- queue.Resize(2);
- EXPECT_EQ(1.0, queue[0]);
- EXPECT_EQ(2.0, queue[1]);
-
- queue.Resize(5);
- EXPECT_EQ(1.0, queue[0]);
- EXPECT_EQ(2.0, queue[1]);
-
- queue.Reset();
-
- /* Buffer contains {_, _, 1, 2, 3}
- * ^ front
- */
- queue.PushBack(0.0);
- queue.PushBack(0.0);
- queue.PushBack(1.0);
- queue.PushBack(2.0);
- queue.PushBack(3.0);
- queue.PopFront();
- queue.PopFront();
-
- queue.Resize(2);
- EXPECT_EQ(1.0, queue[0]);
- EXPECT_EQ(2.0, queue[1]);
-
- queue.Resize(5);
- EXPECT_EQ(1.0, queue[0]);
- EXPECT_EQ(2.0, queue[1]);
-
- queue.Reset();
-
- /* Buffer contains {3, _, _, 1, 2}
- * ^ front
- */
- queue.PushBack(3.0);
- queue.PushFront(2.0);
- queue.PushFront(1.0);
-
- queue.Resize(2);
- EXPECT_EQ(1.0, queue[0]);
- EXPECT_EQ(2.0, queue[1]);
-
- queue.Resize(5);
- EXPECT_EQ(1.0, queue[0]);
- EXPECT_EQ(2.0, queue[1]);
-
- queue.Reset();
-
- /* Buffer contains {2, 3, _, _, 1}
- * ^ front
- */
- queue.PushBack(2.0);
- queue.PushBack(3.0);
- queue.PushFront(1.0);
-
- queue.Resize(2);
- EXPECT_EQ(1.0, queue[0]);
- EXPECT_EQ(2.0, queue[1]);
-
- queue.Resize(5);
- EXPECT_EQ(1.0, queue[0]);
- EXPECT_EQ(2.0, queue[1]);
-
- // Test PushBack() after resize
- queue.PushBack(3.0);
- EXPECT_EQ(1.0, queue[0]);
- EXPECT_EQ(2.0, queue[1]);
- EXPECT_EQ(3.0, queue[2]);
-
- // Test PushFront() after resize
- queue.PushFront(4.0);
- EXPECT_EQ(4.0, queue[0]);
- EXPECT_EQ(1.0, queue[1]);
- EXPECT_EQ(2.0, queue[2]);
- EXPECT_EQ(3.0, queue[3]);
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/ConditionVariableTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/ConditionVariableTest.cpp
deleted file mode 100644
index e4e12aa..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/ConditionVariableTest.cpp
+++ /dev/null
@@ -1,298 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include <atomic>
-#include <chrono>
-#include <condition_variable>
-#include <mutex>
-#include <thread>
-
-#include "HAL/cpp/priority_condition_variable.h"
-#include "HAL/cpp/priority_mutex.h"
-#include "TestBench.h"
-#include "gtest/gtest.h"
-
-namespace wpilib {
-namespace testing {
-
-// Tests that the condition variable class which we wrote ourselves actually
-// does work.
-class ConditionVariableTest : public ::testing::Test {
- protected:
- typedef std::unique_lock<priority_mutex> priority_lock;
-
- // Condition variable to test.
- priority_condition_variable m_cond;
-
- // Mutex to pass to condition variable when waiting.
- priority_mutex m_mutex;
-
- // flags for testing when threads are completed.
- std::atomic<bool> m_done1{false}, m_done2{false};
- // Threads to use for testing. We want multiple threads to ensure that it
- // behaves correctly when multiple processes are waiting on a signal.
- std::thread m_watcher1, m_watcher2;
-
- // Information for when running with predicates.
- std::atomic<bool> m_pred_var{false};
-
- void ShortSleep(uint32_t time = 10) {
- std::this_thread::sleep_for(std::chrono::milliseconds(time));
- }
-
- // Start up the given threads with a wait function. The wait function should
- // call some version of m_cond.wait and should take as an argument a reference
- // to an std::atomic<bool> which it will set to true when it is ready to have
- // join called on it.
- template <class Function>
- void StartThreads(Function wait) {
- m_watcher1 = std::thread(wait, std::ref(m_done1));
- m_watcher2 = std::thread(wait, std::ref(m_done2));
-
- // Wait briefly to let the lock be unlocked.
- ShortSleep();
- bool locked = m_mutex.try_lock();
- if (locked) m_mutex.unlock();
- EXPECT_TRUE(locked) << "The condition variable failed to unlock the lock.";
- }
-
- void NotifyAll() { m_cond.notify_all(); }
- void NotifyOne() { m_cond.notify_one(); }
-
- // Test that all the threads are notified by a notify_all() call.
- void NotifyAllTest() {
- NotifyAll();
- // Wait briefly to let the lock be re-locked.
- ShortSleep();
- EXPECT_TRUE(m_done1) << "watcher1 failed to be notified.";
- EXPECT_TRUE(m_done2) << "watcher2 failed to be notified.";
- }
-
- // For use when testing predicates. First tries signalling the threads with
- // the predicate set to false (and ensures that they do not activate) and then
- // tests with the predicate set to true.
- void PredicateTest() {
- m_pred_var = false;
- NotifyAll();
- ShortSleep();
- EXPECT_FALSE(m_done1) << "watcher1 didn't pay attention to its predicate.";
- EXPECT_FALSE(m_done2) << "watcher2 didn't pay attention to its predicate.";
- m_pred_var = true;
- NotifyAllTest();
- }
-
- // Used by the WaitFor and WaitUntil tests to test that, without a predicate,
- // the timeout works properly.
- void WaitTimeTest(bool wait_for) {
- std::atomic<bool> timed_out{true};
- auto wait_until = [this, &timed_out, wait_for](std::atomic<bool>& done) {
- priority_lock lock(m_mutex);
- done = false;
- if (wait_for) {
- auto wait_time = std::chrono::milliseconds(100);
- timed_out = m_cond.wait_for(lock, wait_time) == std::cv_status::timeout;
- } else {
- auto wait_time =
- std::chrono::system_clock::now() + std::chrono::milliseconds(100);
- timed_out =
- m_cond.wait_until(lock, wait_time) == std::cv_status::timeout;
- }
- EXPECT_TRUE(lock.owns_lock())
- << "The condition variable should have reacquired the lock.";
- done = true;
- };
-
- // First, test without timing out.
- timed_out = true;
- StartThreads(wait_until);
-
- NotifyAllTest();
- EXPECT_FALSE(timed_out) << "The watcher should not have timed out.";
-
- TearDown();
-
- // Next, test and time out.
- timed_out = false;
- StartThreads(wait_until);
-
- ShortSleep(110);
-
- EXPECT_TRUE(m_done1) << "watcher1 should have timed out.";
- EXPECT_TRUE(m_done2) << "watcher2 should have timed out.";
- EXPECT_TRUE(timed_out) << "The watcher should have timed out.";
- }
-
- // For use with tests that have a timeout and a predicate.
- void WaitTimePredicateTest(bool wait_for) {
- // The condition_variable return value from the wait_for or wait_until
- // function should in the case of having a predicate, by a boolean. If the
- // predicate is true, then the return value will always be true. If the
- // condition times out and, at the time of the timeout, the predicate is
- // false, the return value will be false.
- std::atomic<bool> retval{true};
- auto predicate = [this]() -> bool { return m_pred_var; };
- auto wait_until = [this, &retval, predicate,
- wait_for](std::atomic<bool>& done) {
- priority_lock lock(m_mutex);
- done = false;
- if (wait_for) {
- auto wait_time = std::chrono::milliseconds(100);
- retval = m_cond.wait_for(lock, wait_time, predicate);
- } else {
- auto wait_time =
- std::chrono::system_clock::now() + std::chrono::milliseconds(100);
- retval = m_cond.wait_until(lock, wait_time, predicate);
- }
- EXPECT_TRUE(lock.owns_lock())
- << "The condition variable should have reacquired the lock.";
- done = true;
- };
-
- // Test without timing out and with the predicate set to true.
- retval = true;
- m_pred_var = true;
- StartThreads(wait_until);
-
- NotifyAllTest();
- EXPECT_TRUE(retval) << "The watcher should not have timed out.";
-
- TearDown();
-
- // Test with timing out and with the predicate set to true.
- retval = false;
- m_pred_var = false;
- StartThreads(wait_until);
-
- ShortSleep(110);
-
- EXPECT_TRUE(m_done1) << "watcher1 should have finished.";
- EXPECT_TRUE(m_done2) << "watcher2 should have finished.";
- EXPECT_FALSE(retval) << "The watcher should have timed out.";
-
- TearDown();
-
- // Test without timing out and run the PredicateTest().
- retval = false;
- StartThreads(wait_until);
-
- PredicateTest();
- EXPECT_TRUE(retval) << "The return value should have been true.";
-
- TearDown();
-
- // Test with timing out and the predicate set to true while we are waiting
- // for the condition variable to time out.
- retval = true;
- StartThreads(wait_until);
- ShortSleep();
- m_pred_var = true;
- ShortSleep(110);
- EXPECT_TRUE(retval) << "The return value should have been true.";
- }
-
- virtual void TearDown() {
- // If a thread has not completed, then continuing will cause the tests to
- // hang forever and could cause issues. If we don't call detach, then
- // std::terminate is called and all threads are terminated.
- // Detaching is non-optimal, but should allow the rest of the tests to run
- // before anything drastic occurs.
- if (m_done1)
- m_watcher1.join();
- else
- m_watcher1.detach();
- if (m_done2)
- m_watcher2.join();
- else
- m_watcher2.detach();
- }
-};
-
-TEST_F(ConditionVariableTest, NotifyAll) {
- auto wait = [this](std::atomic<bool>& done) {
- priority_lock lock(m_mutex);
- done = false;
- m_cond.wait(lock);
- EXPECT_TRUE(lock.owns_lock())
- << "The condition variable should have reacquired the lock.";
- done = true;
- };
-
- StartThreads(wait);
-
- NotifyAllTest();
-}
-
-TEST_F(ConditionVariableTest, NotifyOne) {
- auto wait = [this](std::atomic<bool>& done) {
- priority_lock lock(m_mutex);
- done = false;
- m_cond.wait(lock);
- EXPECT_TRUE(lock.owns_lock())
- << "The condition variable should have reacquired the lock.";
- done = true;
- };
-
- StartThreads(wait);
-
- NotifyOne();
- // Wait briefly to let things settle.
- ShortSleep();
- EXPECT_TRUE(m_done1 ^ m_done2) << "Only one thread should've been notified.";
- NotifyOne();
- ShortSleep();
- EXPECT_TRUE(m_done2 && m_done2) << "Both threads should've been notified.";
-}
-
-TEST_F(ConditionVariableTest, WaitWithPredicate) {
- auto predicate = [this]() -> bool { return m_pred_var; };
- auto wait_predicate = [this, predicate](std::atomic<bool>& done) {
- priority_lock lock(m_mutex);
- done = false;
- m_cond.wait(lock, predicate);
- EXPECT_TRUE(lock.owns_lock())
- << "The condition variable should have reacquired the lock.";
- done = true;
- };
-
- StartThreads(wait_predicate);
-
- PredicateTest();
-}
-
-TEST_F(ConditionVariableTest, WaitUntil) { WaitTimeTest(false); }
-
-TEST_F(ConditionVariableTest, WaitUntilWithPredicate) {
- WaitTimePredicateTest(false);
-}
-
-TEST_F(ConditionVariableTest, WaitFor) { WaitTimeTest(true); }
-
-TEST_F(ConditionVariableTest, WaitForWithPredicate) {
- WaitTimePredicateTest(true);
-}
-
-TEST_F(ConditionVariableTest, NativeHandle) {
- auto wait = [this](std::atomic<bool>& done) {
- priority_lock lock(m_mutex);
- done = false;
- m_cond.wait(lock);
- EXPECT_TRUE(lock.owns_lock())
- << "The condition variable should have reacquired the lock.";
- done = true;
- };
-
- StartThreads(wait);
-
- pthread_cond_t* native_handle = m_cond.native_handle();
- pthread_cond_broadcast(native_handle);
- ShortSleep();
- EXPECT_TRUE(m_done1) << "watcher1 failed to be notified.";
- EXPECT_TRUE(m_done2) << "watcher2 failed to be notified.";
-}
-
-} // namespace testing
-} // namespace wpilib
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/CounterTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/CounterTest.cpp
deleted file mode 100644
index 71b94bf..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/CounterTest.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Counter.h" // NOLINT(build/include_order)
-
-#include "Jaguar.h"
-#include "Talon.h"
-#include "TestBench.h"
-#include "Timer.h"
-#include "Victor.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-static const double kMotorDelay = 2.5;
-
-static const double kMaxPeriod = 2.0;
-
-class CounterTest : public testing::Test {
- protected:
- Counter* m_talonCounter;
- Counter* m_victorCounter;
- Counter* m_jaguarCounter;
- Talon* m_talon;
- Victor* m_victor;
- Jaguar* m_jaguar;
-
- void SetUp() override {
- m_talonCounter = new Counter(TestBench::kTalonEncoderChannelA);
- m_victorCounter = new Counter(TestBench::kVictorEncoderChannelA);
- m_jaguarCounter = new Counter(TestBench::kJaguarEncoderChannelA);
- m_victor = new Victor(TestBench::kVictorChannel);
- m_talon = new Talon(TestBench::kTalonChannel);
- m_jaguar = new Jaguar(TestBench::kJaguarChannel);
- }
-
- void TearDown() override {
- delete m_talonCounter;
- delete m_victorCounter;
- delete m_jaguarCounter;
- delete m_victor;
- delete m_talon;
- delete m_jaguar;
- }
-
- void Reset() {
- m_talonCounter->Reset();
- m_victorCounter->Reset();
- m_jaguarCounter->Reset();
- m_talon->Set(0.0);
- m_victor->Set(0.0);
- m_jaguar->Set(0.0);
- }
-};
-
-/**
- * Tests the counter by moving the motor and determining if the
- * counter is counting.
- */
-TEST_F(CounterTest, CountTalon) {
- Reset();
- /* Run the motor forward and determine if the counter is counting. */
- m_talon->Set(1.0);
- Wait(0.5);
- EXPECT_NE(0.0, m_talonCounter->Get()) << "The counter did not count (talon)";
- /* Set the motor to 0 and determine if the counter resets to 0. */
- m_talon->Set(0.0);
- Wait(0.5);
- m_talonCounter->Reset();
- EXPECT_FLOAT_EQ(0.0, m_talonCounter->Get())
- << "The counter did not restart to 0 (talon)";
-}
-
-TEST_F(CounterTest, CountVictor) {
- Reset();
- /* Run the motor forward and determine if the counter is counting. */
- m_victor->Set(1.0);
- Wait(0.5);
- EXPECT_NE(0.0, m_victorCounter->Get())
- << "The counter did not count (victor)";
- /* Set the motor to 0 and determine if the counter resets to 0. */
- m_victor->Set(0.0);
- Wait(0.5);
- m_victorCounter->Reset();
- EXPECT_FLOAT_EQ(0.0, m_victorCounter->Get())
- << "The counter did not restart to 0 (jaguar)";
-}
-
-TEST_F(CounterTest, CountJaguar) {
- Reset();
- /* Run the motor forward and determine if the counter is counting. */
- m_jaguar->Set(1.0);
- Wait(0.5);
- EXPECT_NE(0.0, m_jaguarCounter->Get())
- << "The counter did not count (jaguar)";
- /* Set the motor to 0 and determine if the counter resets to 0. */
- m_jaguar->Set(0.0);
- Wait(0.5);
- m_jaguarCounter->Reset();
- EXPECT_FLOAT_EQ(0.0, m_jaguarCounter->Get())
- << "The counter did not restart to 0 (jaguar)";
-}
-
-/**
- * Tests the GetStopped and SetMaxPeriod methods by setting the Max Period and
- * getting the value after a period of time.
- */
-TEST_F(CounterTest, TalonGetStopped) {
- Reset();
- /* Set the Max Period of the counter and run the motor */
- m_talonCounter->SetMaxPeriod(kMaxPeriod);
- m_talon->Set(1.0);
- Wait(0.5);
- EXPECT_FALSE(m_talonCounter->GetStopped()) << "The counter did not count.";
- /* Stop the motor and wait until the Max Period is exceeded */
- m_talon->Set(0.0);
- Wait(kMotorDelay);
- EXPECT_TRUE(m_talonCounter->GetStopped())
- << "The counter did not stop counting.";
-}
-
-TEST_F(CounterTest, VictorGetStopped) {
- Reset();
- /* Set the Max Period of the counter and run the motor */
- m_victorCounter->SetMaxPeriod(kMaxPeriod);
- m_victor->Set(1.0);
- Wait(0.5);
- EXPECT_FALSE(m_victorCounter->GetStopped()) << "The counter did not count.";
- /* Stop the motor and wait until the Max Period is exceeded */
- m_victor->Set(0.0);
- Wait(kMotorDelay);
- EXPECT_TRUE(m_victorCounter->GetStopped())
- << "The counter did not stop counting.";
-}
-
-TEST_F(CounterTest, JaguarGetStopped) {
- Reset();
- /* Set the Max Period of the counter and run the motor */
- m_jaguarCounter->SetMaxPeriod(kMaxPeriod);
- m_jaguar->Set(1.0);
- Wait(0.5);
- EXPECT_FALSE(m_jaguarCounter->GetStopped()) << "The counter did not count.";
- /* Stop the motor and wait until the Max Period is exceeded */
- m_jaguar->Set(0.0);
- Wait(kMotorDelay);
- EXPECT_TRUE(m_jaguarCounter->GetStopped())
- << "The counter did not stop counting.";
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/DIOLoopTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/DIOLoopTest.cpp
deleted file mode 100644
index 2678a52..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/DIOLoopTest.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "DigitalInput.h" // NOLINT(build/include_order)
-#include "DigitalOutput.h" // NOLINT(build/include_order)
-
-#include "Counter.h"
-#include "InterruptableSensorBase.h"
-#include "TestBench.h"
-#include "Timer.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-static const double kCounterTime = 0.001;
-
-static const double kDelayTime = 0.1;
-
-static const double kSynchronousInterruptTime = 2.0;
-static const double kSynchronousInterruptTimeTolerance = 0.01;
-
-/**
- * A fixture with a digital input and a digital output physically wired
- * together.
- */
-class DIOLoopTest : public testing::Test {
- protected:
- DigitalInput* m_input;
- DigitalOutput* m_output;
-
- void SetUp() override {
- m_input = new DigitalInput(TestBench::kLoop1InputChannel);
- m_output = new DigitalOutput(TestBench::kLoop1OutputChannel);
- }
-
- void TearDown() override {
- delete m_input;
- delete m_output;
- }
-
- void Reset() { m_output->Set(false); }
-};
-
-/**
- * Test the DigitalInput and DigitalOutput classes by setting the output and
- * reading the input.
- */
-TEST_F(DIOLoopTest, Loop) {
- Reset();
-
- m_output->Set(false);
- Wait(kDelayTime);
- EXPECT_FALSE(m_input->Get()) << "The digital output was turned off, but "
- << "the digital input is on.";
-
- m_output->Set(true);
- Wait(kDelayTime);
- EXPECT_TRUE(m_input->Get()) << "The digital output was turned on, but "
- << "the digital input is off.";
-}
-/**
- * Tests to see if the DIO PWM functionality works.
- */
-TEST_F(DIOLoopTest, DIOPWM) {
- Reset();
-
- m_output->Set(false);
- Wait(kDelayTime);
- EXPECT_FALSE(m_input->Get()) << "The digital output was turned off, but "
- << "the digital input is on.";
-
- // Set frequency to 2.0 Hz
- m_output->SetPWMRate(2.0);
- // Enable PWM, but leave it off
- m_output->EnablePWM(0.0);
- Wait(0.5);
- m_output->UpdateDutyCycle(0.5);
- m_input->RequestInterrupts();
- m_input->SetUpSourceEdge(false, true);
- InterruptableSensorBase::WaitResult result =
- m_input->WaitForInterrupt(3.0, true);
-
- Wait(0.5);
- bool firstCycle = m_input->Get();
- Wait(0.5);
- bool secondCycle = m_input->Get();
- Wait(0.5);
- bool thirdCycle = m_input->Get();
- Wait(0.5);
- bool forthCycle = m_input->Get();
- Wait(0.5);
- bool fifthCycle = m_input->Get();
- Wait(0.5);
- bool sixthCycle = m_input->Get();
- Wait(0.5);
- bool seventhCycle = m_input->Get();
- m_output->DisablePWM();
- Wait(0.5);
- bool firstAfterStop = m_input->Get();
- Wait(0.5);
- bool secondAfterStop = m_input->Get();
-
- EXPECT_EQ(InterruptableSensorBase::WaitResult::kFallingEdge, result)
- << "WaitForInterrupt was not falling.";
-
- EXPECT_FALSE(firstCycle) << "Input not low after first delay";
- EXPECT_TRUE(secondCycle) << "Input not high after second delay";
- EXPECT_FALSE(thirdCycle) << "Input not low after third delay";
- EXPECT_TRUE(forthCycle) << "Input not high after forth delay";
- EXPECT_FALSE(fifthCycle) << "Input not low after fifth delay";
- EXPECT_TRUE(sixthCycle) << "Input not high after sixth delay";
- EXPECT_FALSE(seventhCycle) << "Input not low after seventh delay";
- EXPECT_FALSE(firstAfterStop) << "Input not low after stopping first read";
- EXPECT_FALSE(secondAfterStop) << "Input not low after stopping second read";
-}
-
-/**
- * Test a fake "counter" that uses the DIO loop as an input to make sure the
- * Counter class works
- */
-TEST_F(DIOLoopTest, FakeCounter) {
- Reset();
-
- Counter counter(m_input);
-
- EXPECT_EQ(0, counter.Get()) << "Counter did not initialize to 0.";
-
- /* Count 100 ticks. The counter value should be 100 after this loop. */
- for (int32_t i = 0; i < 100; i++) {
- m_output->Set(true);
- Wait(kCounterTime);
- m_output->Set(false);
- Wait(kCounterTime);
- }
-
- EXPECT_EQ(100, counter.Get()) << "Counter did not count up to 100.";
-}
-
-static void InterruptHandler(uint32_t interruptAssertedMask, void* param) {
- *reinterpret_cast<int32_t*>(param) = 12345;
-}
-
-TEST_F(DIOLoopTest, AsynchronousInterruptWorks) {
- int32_t param = 0;
-
- // Given an interrupt handler that sets an int32_t to 12345
- m_input->RequestInterrupts(InterruptHandler, ¶m);
- m_input->EnableInterrupts();
-
- // If the voltage rises
- m_output->Set(false);
- m_output->Set(true);
- m_input->CancelInterrupts();
-
- // Then the int32_t should be 12345
- Wait(kDelayTime);
- EXPECT_EQ(12345, param) << "The interrupt did not run.";
-}
-
-static void* InterruptTriggerer(void* data) {
- DigitalOutput* output = static_cast<DigitalOutput*>(data);
- output->Set(false);
- Wait(kSynchronousInterruptTime);
- output->Set(true);
- return nullptr;
-}
-
-TEST_F(DIOLoopTest, SynchronousInterruptWorks) {
- // Given a synchronous interrupt
- m_input->RequestInterrupts();
-
- // If we have another thread trigger the interrupt in a few seconds
- pthread_t interruptTriggererLoop;
- pthread_create(&interruptTriggererLoop, nullptr, InterruptTriggerer,
- m_output);
-
- // Then this thread should pause and resume after that number of seconds
- Timer timer;
- timer.Start();
- m_input->WaitForInterrupt(kSynchronousInterruptTime + 1.0);
- EXPECT_NEAR(kSynchronousInterruptTime, timer.Get(),
- kSynchronousInterruptTimeTolerance);
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/DigitalGlitchFilterTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/DigitalGlitchFilterTest.cpp
deleted file mode 100644
index 701aa55..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/DigitalGlitchFilterTest.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "DigitalGlitchFilter.h" // NOLINT(build/include_order)
-
-#include "Counter.h"
-#include "DigitalInput.h"
-#include "Encoder.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-/**
- * Tests that configuring inputs to be filtered succeeds.
- *
- * This test actually tests everything except that the actual FPGA
- * implementation works as intended. We configure the FPGA and then query it to
- * make sure that the acutal configuration matches.
- */
-TEST(DigitalGlitchFilterTest, BasicTest) {
- DigitalInput input1(1);
- DigitalInput input2(2);
- DigitalInput input3(3);
- DigitalInput input4(4);
- Encoder encoder5(5, 6);
- Counter counter7(7);
-
- // Check that we can make a single filter and set the period.
- DigitalGlitchFilter filter1;
- filter1.Add(&input1);
- filter1.SetPeriodNanoSeconds(4200);
-
- // Check that we can make a second filter with 2 inputs.
- DigitalGlitchFilter filter2;
- filter2.Add(&input2);
- filter2.Add(&input3);
- filter2.SetPeriodNanoSeconds(97100);
-
- // Check that we can make a third filter with an input, an encoder, and a
- // counter.
- DigitalGlitchFilter filter3;
- filter3.Add(&input4);
- filter3.Add(&encoder5);
- filter3.Add(&counter7);
- filter3.SetPeriodNanoSeconds(167800);
-
- // Verify that the period was properly set for all 3 filters.
- EXPECT_EQ(4200u, filter1.GetPeriodNanoSeconds());
- EXPECT_EQ(97100u, filter2.GetPeriodNanoSeconds());
- EXPECT_EQ(167800u, filter3.GetPeriodNanoSeconds());
-
- // Clean up.
- filter1.Remove(&input1);
- filter2.Remove(&input2);
- filter2.Remove(&input3);
- filter3.Remove(&input4);
- filter3.Remove(&encoder5);
- filter3.Remove(&counter7);
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/DriverStationTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/DriverStationTest.cpp
deleted file mode 100644
index 7cea63e..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/DriverStationTest.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "DriverStation.h" // NOLINT(build/include_order)
-
-#include "TestBench.h"
-#include "Utility.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-constexpr double TIMER_TOLERANCE = 0.2;
-constexpr int64_t TIMER_RUNTIME = 1000000; // 1 second
-
-class DriverStationTest : public testing::Test {};
-
-/**
- * Test if the WaitForData function works
- */
-TEST_F(DriverStationTest, WaitForData) {
- uint64_t initialTime = GetFPGATime();
-
- for (int i = 0; i < 50; i++) {
- DriverStation::GetInstance().WaitForData();
- }
-
- uint64_t finalTime = GetFPGATime();
-
- EXPECT_NEAR(TIMER_RUNTIME, finalTime - initialTime,
- TIMER_TOLERANCE * TIMER_RUNTIME);
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/FakeEncoderTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/FakeEncoderTest.cpp
deleted file mode 100644
index 89610a9..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/FakeEncoderTest.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Encoder.h" // NOLINT(build/include_order)
-
-#include "AnalogOutput.h"
-#include "AnalogTrigger.h"
-#include "DigitalOutput.h"
-#include "TestBench.h"
-#include "Timer.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-static const double kDelayTime = 0.001;
-
-class FakeEncoderTest : public testing::Test {
- protected:
- DigitalOutput* m_outputA;
- DigitalOutput* m_outputB;
- AnalogOutput* m_indexOutput;
-
- Encoder* m_encoder;
- AnalogTrigger* m_indexAnalogTrigger;
- std::shared_ptr<AnalogTriggerOutput> m_indexAnalogTriggerOutput;
-
- void SetUp() override {
- m_outputA = new DigitalOutput(TestBench::kLoop2OutputChannel);
- m_outputB = new DigitalOutput(TestBench::kLoop1OutputChannel);
- m_indexOutput = new AnalogOutput(TestBench::kAnalogOutputChannel);
- m_outputA->Set(false);
- m_outputB->Set(false);
- m_encoder = new Encoder(TestBench::kLoop1InputChannel,
- TestBench::kLoop2InputChannel);
- m_indexAnalogTrigger =
- new AnalogTrigger(TestBench::kFakeAnalogOutputChannel);
- m_indexAnalogTrigger->SetLimitsVoltage(2.0, 3.0);
- m_indexAnalogTriggerOutput =
- m_indexAnalogTrigger->CreateOutput(AnalogTriggerType::kState);
- }
-
- void TearDown() override {
- delete m_outputA;
- delete m_outputB;
- delete m_indexOutput;
- delete m_encoder;
- delete m_indexAnalogTrigger;
- }
-
- /**
- * Output pulses to the encoder's input channels to simulate a change of 100
- * ticks
- */
- void Simulate100QuadratureTicks() {
- for (int32_t i = 0; i < 100; i++) {
- m_outputA->Set(true);
- Wait(kDelayTime);
- m_outputB->Set(true);
- Wait(kDelayTime);
- m_outputA->Set(false);
- Wait(kDelayTime);
- m_outputB->Set(false);
- Wait(kDelayTime);
- }
- }
-
- void SetIndexHigh() {
- m_indexOutput->SetVoltage(5.0);
- Wait(kDelayTime);
- }
-
- void SetIndexLow() {
- m_indexOutput->SetVoltage(0.0);
- Wait(kDelayTime);
- }
-};
-
-/**
- * Test the encoder by reseting it to 0 and reading the value.
- */
-TEST_F(FakeEncoderTest, TestDefaultState) {
- EXPECT_FLOAT_EQ(0.0, m_encoder->Get()) << "The encoder did not start at 0.";
-}
-
-/**
- * Test the encoder by setting the digital outputs and reading the value.
- */
-TEST_F(FakeEncoderTest, TestCountUp) {
- m_encoder->Reset();
- Simulate100QuadratureTicks();
-
- EXPECT_FLOAT_EQ(100.0, m_encoder->Get()) << "Encoder did not count to 100.";
-}
-
-/**
- * Test that the encoder can stay reset while the index source is high
- */
-TEST_F(FakeEncoderTest, TestResetWhileHigh) {
- m_encoder->SetIndexSource(*m_indexAnalogTriggerOutput,
- Encoder::IndexingType::kResetWhileHigh);
-
- SetIndexLow();
- Simulate100QuadratureTicks();
- SetIndexHigh();
- EXPECT_EQ(0, m_encoder->Get());
-
- Simulate100QuadratureTicks();
- EXPECT_EQ(0, m_encoder->Get());
-}
-
-/**
- * Test that the encoder can reset when the index source goes from low to high
- */
-TEST_F(FakeEncoderTest, TestResetOnRisingEdge) {
- m_encoder->SetIndexSource(*m_indexAnalogTriggerOutput,
- Encoder::IndexingType::kResetOnRisingEdge);
-
- SetIndexLow();
- Simulate100QuadratureTicks();
- SetIndexHigh();
- EXPECT_EQ(0, m_encoder->Get());
-
- Simulate100QuadratureTicks();
- EXPECT_EQ(100, m_encoder->Get());
-}
-
-/**
- * Test that the encoder can stay reset while the index source is low
- */
-TEST_F(FakeEncoderTest, TestResetWhileLow) {
- m_encoder->SetIndexSource(*m_indexAnalogTriggerOutput,
- Encoder::IndexingType::kResetWhileLow);
-
- SetIndexHigh();
- Simulate100QuadratureTicks();
- SetIndexLow();
- EXPECT_EQ(0, m_encoder->Get());
-
- Simulate100QuadratureTicks();
- EXPECT_EQ(0, m_encoder->Get());
-}
-
-/**
- * Test that the encoder can reset when the index source goes from high to low
- */
-TEST_F(FakeEncoderTest, TestResetOnFallingEdge) {
- m_encoder->SetIndexSource(*m_indexAnalogTriggerOutput,
- Encoder::IndexingType::kResetOnFallingEdge);
-
- SetIndexHigh();
- Simulate100QuadratureTicks();
- SetIndexLow();
- EXPECT_EQ(0, m_encoder->Get());
-
- Simulate100QuadratureTicks();
- EXPECT_EQ(100, m_encoder->Get());
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/FilterNoiseTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/FilterNoiseTest.cpp
deleted file mode 100644
index f99c544..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/FilterNoiseTest.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Filters/LinearDigitalFilter.h" // NOLINT(build/include_order)
-
-#include <cmath>
-#include <functional>
-#include <memory>
-#include <random>
-#include <thread>
-
-#include "Base.h"
-#include "TestBench.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-enum FilterNoiseTestType { TEST_SINGLE_POLE_IIR, TEST_MOVAVG };
-
-std::ostream& operator<<(std::ostream& os, const FilterNoiseTestType& type) {
- switch (type) {
- case TEST_SINGLE_POLE_IIR:
- os << "LinearDigitalFilter SinglePoleIIR";
- break;
- case TEST_MOVAVG:
- os << "LinearDigitalFilter MovingAverage";
- break;
- }
-
- return os;
-}
-
-using std::chrono::system_clock;
-
-constexpr double kStdDev = 10.0;
-
-/**
- * Adds Gaussian white noise to a function returning data. The noise will have
- * the standard deviation provided in the constructor.
- */
-class NoiseGenerator : public PIDSource {
- public:
- NoiseGenerator(double (*dataFunc)(double), double stdDev)
- : m_distr(0.0, stdDev) {
- m_dataFunc = dataFunc;
- }
-
- void SetPIDSourceType(PIDSourceType pidSource) override {}
-
- double Get() { return m_dataFunc(m_count) + m_noise; }
-
- double PIDGet() override {
- m_noise = m_distr(m_gen);
- m_count += TestBench::kFilterStep;
- return m_dataFunc(m_count) + m_noise;
- }
-
- void Reset() { m_count = -TestBench::kFilterStep; }
-
- private:
- std::function<double(double)> m_dataFunc;
- double m_noise = 0.0;
-
- // Make sure first call to PIDGet() uses m_count == 0
- double m_count = -TestBench::kFilterStep;
-
- std::random_device m_rd;
- std::mt19937 m_gen{m_rd()};
- std::normal_distribution<double> m_distr;
-};
-
-/**
- * A fixture that includes a noise generator wrapped in a filter
- */
-class FilterNoiseTest : public testing::TestWithParam<FilterNoiseTestType> {
- protected:
- std::unique_ptr<PIDSource> m_filter;
- std::shared_ptr<NoiseGenerator> m_noise;
-
- static double GetData(double t) { return 100.0 * std::sin(2.0 * M_PI * t); }
-
- void SetUp() override {
- m_noise = std::make_shared<NoiseGenerator>(GetData, kStdDev);
-
- switch (GetParam()) {
- case TEST_SINGLE_POLE_IIR: {
- m_filter = std::make_unique<LinearDigitalFilter>(
- LinearDigitalFilter::SinglePoleIIR(
- m_noise, TestBench::kSinglePoleIIRTimeConstant,
- TestBench::kFilterStep));
- break;
- }
-
- case TEST_MOVAVG: {
- m_filter = std::make_unique<LinearDigitalFilter>(
- LinearDigitalFilter::MovingAverage(m_noise,
- TestBench::kMovAvgTaps));
- break;
- }
- }
- }
-};
-
-/**
- * Test if the filter reduces the noise produced by a signal generator
- */
-TEST_P(FilterNoiseTest, NoiseReduce) {
- double theoryData = 0.0;
- double noiseGenError = 0.0;
- double filterError = 0.0;
-
- m_noise->Reset();
- for (double t = 0; t < TestBench::kFilterTime; t += TestBench::kFilterStep) {
- theoryData = GetData(t);
- filterError += std::abs(m_filter->PIDGet() - theoryData);
- noiseGenError += std::abs(m_noise->Get() - theoryData);
- }
-
- RecordProperty("FilterError", filterError);
-
- // The filter should have produced values closer to the theory
- EXPECT_GT(noiseGenError, filterError)
- << "Filter should have reduced noise accumulation but failed";
-}
-
-INSTANTIATE_TEST_CASE_P(Test, FilterNoiseTest,
- testing::Values(TEST_SINGLE_POLE_IIR, TEST_MOVAVG));
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/FilterOutputTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/FilterOutputTest.cpp
deleted file mode 100644
index e863518..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/FilterOutputTest.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Filters/LinearDigitalFilter.h" // NOLINT(build/include_order)
-
-#include <cmath>
-#include <functional>
-#include <memory>
-#include <random>
-#include <thread>
-
-#include "Base.h"
-#include "TestBench.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-enum FilterOutputTestType { TEST_SINGLE_POLE_IIR, TEST_HIGH_PASS, TEST_MOVAVG };
-
-std::ostream& operator<<(std::ostream& os, const FilterOutputTestType& type) {
- switch (type) {
- case TEST_SINGLE_POLE_IIR:
- os << "LinearDigitalFilter SinglePoleIIR";
- break;
- case TEST_HIGH_PASS:
- os << "LinearDigitalFilter HighPass";
- break;
- case TEST_MOVAVG:
- os << "LinearDigitalFilter MovingAverage";
- break;
- }
-
- return os;
-}
-
-class DataWrapper : public PIDSource {
- public:
- explicit DataWrapper(double (*dataFunc)(double)) { m_dataFunc = dataFunc; }
-
- virtual void SetPIDSourceType(PIDSourceType pidSource) {}
-
- virtual double PIDGet() {
- m_count += TestBench::kFilterStep;
- return m_dataFunc(m_count);
- }
-
- void Reset() { m_count = -TestBench::kFilterStep; }
-
- private:
- std::function<double(double)> m_dataFunc;
-
- // Make sure first call to PIDGet() uses m_count == 0
- double m_count = -TestBench::kFilterStep;
-};
-
-/**
- * A fixture that includes a consistent data source wrapped in a filter
- */
-class FilterOutputTest : public testing::TestWithParam<FilterOutputTestType> {
- protected:
- std::unique_ptr<PIDSource> m_filter;
- std::shared_ptr<DataWrapper> m_data;
- double m_expectedOutput = 0.0;
-
- static double GetData(double t) {
- return 100.0 * std::sin(2.0 * M_PI * t) + 20.0 * std::cos(50.0 * M_PI * t);
- }
-
- void SetUp() override {
- m_data = std::make_shared<DataWrapper>(GetData);
-
- switch (GetParam()) {
- case TEST_SINGLE_POLE_IIR: {
- m_filter = std::make_unique<LinearDigitalFilter>(
- LinearDigitalFilter::SinglePoleIIR(
- m_data, TestBench::kSinglePoleIIRTimeConstant,
- TestBench::kFilterStep));
- m_expectedOutput = TestBench::kSinglePoleIIRExpectedOutput;
- break;
- }
-
- case TEST_HIGH_PASS: {
- m_filter =
- std::make_unique<LinearDigitalFilter>(LinearDigitalFilter::HighPass(
- m_data, TestBench::kHighPassTimeConstant,
- TestBench::kFilterStep));
- m_expectedOutput = TestBench::kHighPassExpectedOutput;
- break;
- }
-
- case TEST_MOVAVG: {
- m_filter = std::make_unique<LinearDigitalFilter>(
- LinearDigitalFilter::MovingAverage(m_data, TestBench::kMovAvgTaps));
- m_expectedOutput = TestBench::kMovAvgExpectedOutput;
- break;
- }
- }
- }
-};
-
-/**
- * Test if the linear digital filters produce consistent output
- */
-TEST_P(FilterOutputTest, FilterOutput) {
- m_data->Reset();
-
- double filterOutput = 0.0;
- for (double t = 0.0; t < TestBench::kFilterTime;
- t += TestBench::kFilterStep) {
- filterOutput = m_filter->PIDGet();
- }
-
- RecordProperty("FilterOutput", filterOutput);
-
- EXPECT_FLOAT_EQ(m_expectedOutput, filterOutput)
- << "Filter output didn't match expected value";
-}
-
-INSTANTIATE_TEST_CASE_P(Test, FilterOutputTest,
- testing::Values(TEST_SINGLE_POLE_IIR, TEST_HIGH_PASS,
- TEST_MOVAVG));
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/MotorEncoderTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/MotorEncoderTest.cpp
deleted file mode 100644
index cdb9334..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/MotorEncoderTest.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Encoder.h"
-#include "Jaguar.h"
-#include "PIDController.h"
-#include "Talon.h"
-#include "TestBench.h"
-#include "Timer.h"
-#include "Victor.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-enum MotorEncoderTestType { TEST_VICTOR, TEST_JAGUAR, TEST_TALON };
-
-std::ostream& operator<<(std::ostream& os, MotorEncoderTestType const& type) {
- switch (type) {
- case TEST_VICTOR:
- os << "Victor";
- break;
- case TEST_JAGUAR:
- os << "Jaguar";
- break;
- case TEST_TALON:
- os << "Talon";
- break;
- }
-
- return os;
-}
-
-static constexpr double kMotorTime = 0.5;
-
-/**
- * A fixture that includes a PWM speed controller and an encoder connected to
- * the same motor.
- */
-class MotorEncoderTest : public testing::TestWithParam<MotorEncoderTestType> {
- protected:
- SpeedController* m_speedController;
- Encoder* m_encoder;
-
- void SetUp() override {
- switch (GetParam()) {
- case TEST_VICTOR:
- m_speedController = new Victor(TestBench::kVictorChannel);
- m_encoder = new Encoder(TestBench::kVictorEncoderChannelA,
- TestBench::kVictorEncoderChannelB);
- break;
-
- case TEST_JAGUAR:
- m_speedController = new Jaguar(TestBench::kJaguarChannel);
- m_encoder = new Encoder(TestBench::kJaguarEncoderChannelA,
- TestBench::kJaguarEncoderChannelB);
- break;
-
- case TEST_TALON:
- m_speedController = new Talon(TestBench::kTalonChannel);
- m_encoder = new Encoder(TestBench::kTalonEncoderChannelA,
- TestBench::kTalonEncoderChannelB);
- break;
- }
- }
-
- void TearDown() override {
- delete m_speedController;
- delete m_encoder;
- }
-
- void Reset() {
- m_speedController->Set(0.0);
- m_encoder->Reset();
- }
-};
-
-/**
- * Test if the encoder value increments after the motor drives forward
- */
-TEST_P(MotorEncoderTest, Increment) {
- Reset();
-
- /* Drive the speed controller briefly to move the encoder */
- m_speedController->Set(0.2f);
- Wait(kMotorTime);
- m_speedController->Set(0.0);
-
- /* The encoder should be positive now */
- EXPECT_GT(m_encoder->Get(), 0)
- << "Encoder should have incremented after the motor moved";
-}
-
-/**
- * Test if the encoder value decrements after the motor drives backwards
- */
-TEST_P(MotorEncoderTest, Decrement) {
- Reset();
-
- /* Drive the speed controller briefly to move the encoder */
- m_speedController->Set(-0.2);
- Wait(kMotorTime);
- m_speedController->Set(0.0);
-
- /* The encoder should be positive now */
- EXPECT_LT(m_encoder->Get(), 0.0)
- << "Encoder should have decremented after the motor moved";
-}
-
-/**
- * Test if motor speeds are clamped to [-1,1]
- */
-TEST_P(MotorEncoderTest, ClampSpeed) {
- Reset();
-
- m_speedController->Set(2.0);
- Wait(kMotorTime);
-
- EXPECT_FLOAT_EQ(1.0, m_speedController->Get());
-
- m_speedController->Set(-2.0);
- Wait(kMotorTime);
-
- EXPECT_FLOAT_EQ(-1.0, m_speedController->Get());
-}
-
-/**
- * Test if position PID loop works
- */
-TEST_P(MotorEncoderTest, PositionPIDController) {
- Reset();
- double goal = 1000;
- m_encoder->SetPIDSourceType(PIDSourceType::kDisplacement);
- PIDController pid(0.001, 0.0005, 0.0, m_encoder, m_speedController);
- pid.SetAbsoluteTolerance(50.0);
- pid.SetOutputRange(-0.2, 0.2);
- pid.SetSetpoint(goal);
-
- /* 10 seconds should be plenty time to get to the setpoint */
- pid.Enable();
- Wait(10.0);
- pid.Disable();
-
- RecordProperty("PIDError", pid.GetError());
-
- EXPECT_TRUE(pid.OnTarget())
- << "PID loop did not converge within 10 seconds. Goal was: " << goal
- << " Error was: " << pid.GetError();
-}
-
-/**
- * Test if velocity PID loop works
- */
-TEST_P(MotorEncoderTest, VelocityPIDController) {
- Reset();
-
- m_encoder->SetPIDSourceType(PIDSourceType::kRate);
- PIDController pid(1e-5, 0.0, 3e-5, 8e-5, m_encoder, m_speedController);
- pid.SetAbsoluteTolerance(200.0);
- pid.SetToleranceBuffer(50);
- pid.SetOutputRange(-0.3, 0.3);
- pid.SetSetpoint(600);
-
- /* 10 seconds should be plenty time to get to the setpoint */
- pid.Enable();
- Wait(10.0);
- pid.Disable();
- RecordProperty("PIDError", pid.GetError());
-
- EXPECT_TRUE(pid.OnTarget())
- << "PID loop did not converge within 10 seconds. Goal was: " << 600
- << " Error was: " << pid.GetError();
-}
-
-/**
- * Test resetting encoders
- */
-TEST_P(MotorEncoderTest, Reset) {
- Reset();
-
- EXPECT_EQ(0, m_encoder->Get()) << "Encoder did not reset to 0";
-}
-
-INSTANTIATE_TEST_CASE_P(Test, MotorEncoderTest,
- testing::Values(TEST_VICTOR, TEST_JAGUAR, TEST_TALON));
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/MotorInvertingTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/MotorInvertingTest.cpp
deleted file mode 100644
index c7015c8..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/MotorInvertingTest.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Encoder.h"
-#include "Jaguar.h"
-#include "Talon.h"
-#include "TestBench.h"
-#include "Timer.h"
-#include "Victor.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-enum MotorInvertingTestType { TEST_VICTOR, TEST_JAGUAR, TEST_TALON };
-static const double motorSpeed = 0.15;
-static const double delayTime = 0.5;
-std::ostream& operator<<(std::ostream& os, MotorInvertingTestType const& type) {
- switch (type) {
- case TEST_VICTOR:
- os << "Victor";
- break;
- case TEST_JAGUAR:
- os << "Jaguar";
- break;
- case TEST_TALON:
- os << "Talon";
- break;
- }
-
- return os;
-}
-class MotorInvertingTest
- : public testing::TestWithParam<MotorInvertingTestType> {
- protected:
- SpeedController* m_speedController;
- Encoder* m_encoder;
- void SetUp() override {
- switch (GetParam()) {
- case TEST_VICTOR:
- m_speedController = new Victor(TestBench::kVictorChannel);
- m_encoder = new Encoder(TestBench::kVictorEncoderChannelA,
- TestBench::kVictorEncoderChannelB);
- break;
-
- case TEST_JAGUAR:
- m_speedController = new Jaguar(TestBench::kJaguarChannel);
- m_encoder = new Encoder(TestBench::kJaguarEncoderChannelA,
- TestBench::kJaguarEncoderChannelB);
- break;
-
- case TEST_TALON:
- m_speedController = new Talon(TestBench::kTalonChannel);
- m_encoder = new Encoder(TestBench::kTalonEncoderChannelA,
- TestBench::kTalonEncoderChannelB);
- break;
- }
- }
- void TearDown() override {
- delete m_speedController;
- delete m_encoder;
- }
-
- void Reset() {
- m_speedController->SetInverted(false);
- m_speedController->Set(0.0);
- m_encoder->Reset();
- }
-};
-
-TEST_P(MotorInvertingTest, InvertingPositive) {
- Reset();
- m_speedController->Set(motorSpeed);
- Wait(delayTime);
- bool initDirection = m_encoder->GetDirection();
- m_speedController->SetInverted(true);
- m_speedController->Set(motorSpeed);
- Wait(delayTime);
- EXPECT_TRUE(m_encoder->GetDirection() != initDirection)
- << "Inverting with Positive value does not change direction";
- Reset();
-}
-TEST_P(MotorInvertingTest, InvertingNegative) {
- Reset();
- m_speedController->SetInverted(false);
- m_speedController->Set(-motorSpeed);
- Wait(delayTime);
- bool initDirection = m_encoder->GetDirection();
- m_speedController->SetInverted(true);
- m_speedController->Set(-motorSpeed);
- Wait(delayTime);
- EXPECT_TRUE(m_encoder->GetDirection() != initDirection)
- << "Inverting with Negative value does not change direction";
- Reset();
-}
-TEST_P(MotorInvertingTest, InvertingSwitchingPosToNeg) {
- Reset();
- m_speedController->SetInverted(false);
- m_speedController->Set(motorSpeed);
- Wait(delayTime);
- bool initDirection = m_encoder->GetDirection();
- m_speedController->SetInverted(true);
- m_speedController->Set(-motorSpeed);
- Wait(delayTime);
- EXPECT_TRUE(m_encoder->GetDirection() == initDirection)
- << "Inverting with Switching value does change direction";
- Reset();
-}
-TEST_P(MotorInvertingTest, InvertingSwitchingNegToPos) {
- Reset();
- m_speedController->SetInverted(false);
- m_speedController->Set(-motorSpeed);
- Wait(delayTime);
- bool initDirection = m_encoder->GetDirection();
- m_speedController->SetInverted(true);
- m_speedController->Set(motorSpeed);
- Wait(delayTime);
- EXPECT_TRUE(m_encoder->GetDirection() == initDirection)
- << "Inverting with Switching value does change direction";
- Reset();
-}
-INSTANTIATE_TEST_CASE_P(Test, MotorInvertingTest,
- testing::Values(TEST_VICTOR, TEST_JAGUAR, TEST_TALON));
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/MutexTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/MutexTest.cpp
deleted file mode 100644
index 8658388..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/MutexTest.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "HAL/cpp/priority_mutex.h" // NOLINT(build/include_order)
-
-#include <atomic>
-#include <condition_variable>
-#include <thread>
-
-#include "TestBench.h"
-#include "gtest/gtest.h"
-
-namespace wpilib {
-namespace testing {
-
-using std::chrono::system_clock;
-
-// Threading primitive used to notify many threads that a condition is now true.
-// The condition can not be cleared.
-class Notification {
- public:
- // Efficiently waits until the Notification has been notified once.
- void Wait() {
- std::unique_lock<priority_mutex> lock(m_mutex);
- while (!m_set) {
- m_condition.wait(lock);
- }
- }
- // Sets the condition to true, and wakes all waiting threads.
- void Notify() {
- std::lock_guard<priority_mutex> lock(m_mutex);
- m_set = true;
- m_condition.notify_all();
- }
-
- private:
- // priority_mutex used for the notification and to protect the bit.
- priority_mutex m_mutex;
- // Condition for threads to sleep on.
- std::condition_variable_any m_condition;
- // Bool which is true when the notification has been notified.
- bool m_set = false;
-};
-
-void SetProcessorAffinity(int32_t core_id) {
- cpu_set_t cpuset;
- CPU_ZERO(&cpuset);
- CPU_SET(core_id, &cpuset);
-
- pthread_t current_thread = pthread_self();
- ASSERT_EQ(pthread_setaffinity_np(current_thread, sizeof(cpu_set_t), &cpuset),
- 0);
-}
-
-void SetThreadRealtimePriorityOrDie(int32_t priority) {
- struct sched_param param;
- // Set realtime priority for this thread
- param.sched_priority = priority + sched_get_priority_min(SCHED_RR);
- ASSERT_EQ(pthread_setschedparam(pthread_self(), SCHED_RR, ¶m), 0)
- << ": Failed to set scheduler priority.";
-}
-
-// This thread holds the mutex and spins until signaled to release it and stop.
-template <typename MutexType>
-class LowPriorityThread {
- public:
- explicit LowPriorityThread(MutexType* mutex)
- : m_mutex(mutex), m_hold_mutex(1), m_success(0) {}
-
- void operator()() {
- SetProcessorAffinity(0);
- SetThreadRealtimePriorityOrDie(20);
- m_mutex->lock();
- m_started.Notify();
- while (m_hold_mutex.test_and_set()) {
- }
- m_mutex->unlock();
- m_success.store(1);
- }
-
- void WaitForStartup() { m_started.Wait(); }
- void release_mutex() { m_hold_mutex.clear(); }
- bool success() { return m_success.load(); }
-
- private:
- // priority_mutex to grab and release.
- MutexType* m_mutex;
- Notification m_started;
- // Atomic type used to signal when the thread should unlock the mutex.
- // Using a mutex to protect something could cause other issues, and a delay
- // between setting and reading isn't a problem as long as the set is atomic.
- std::atomic_flag m_hold_mutex;
- std::atomic<int> m_success;
-};
-
-// This thread spins forever until signaled to stop.
-class BusyWaitingThread {
- public:
- BusyWaitingThread() : m_run(1), m_success(0) {}
-
- void operator()() {
- SetProcessorAffinity(0);
- SetThreadRealtimePriorityOrDie(21);
- system_clock::time_point start_time = system_clock::now();
- m_started.Notify();
- while (m_run.test_and_set()) {
- // Have the busy waiting thread time out after a while. If it times out,
- // the test failed.
- if (system_clock::now() - start_time > std::chrono::milliseconds(50)) {
- return;
- }
- }
- m_success.store(1);
- }
-
- void quit() { m_run.clear(); }
- void WaitForStartup() { m_started.Wait(); }
- bool success() { return m_success.load(); }
-
- private:
- // Use an atomic type to signal if the thread should be running or not. A
- // mutex could affect the scheduler, which isn't worth it. A delay between
- // setting and reading the new value is fine.
- std::atomic_flag m_run;
-
- Notification m_started;
-
- std::atomic<int> m_success;
-};
-
-// This thread starts up, grabs the mutex, and then exits.
-template <typename MutexType>
-class HighPriorityThread {
- public:
- explicit HighPriorityThread(MutexType* mutex) : m_mutex(mutex) {}
-
- void operator()() {
- SetProcessorAffinity(0);
- SetThreadRealtimePriorityOrDie(22);
- m_started.Notify();
- m_mutex->lock();
- m_success.store(1);
- }
-
- void WaitForStartup() { m_started.Wait(); }
- bool success() { return m_success.load(); }
-
- private:
- Notification m_started;
- MutexType* m_mutex;
- std::atomic<int> m_success{0};
-};
-
-// Class to test a MutexType to see if it solves the priority inheritance
-// problem.
-//
-// To run the test, we need 3 threads, and then 1 thread to kick the test off.
-// The threads must all run on the same core, otherwise they wouldn't starve
-// eachother. The threads and their roles are as follows:
-//
-// Low priority thread:
-// Holds a lock that the high priority thread needs, and releases it upon
-// request.
-// Medium priority thread:
-// Hogs the processor so that the low priority thread will never run if it's
-// priority doesn't get bumped.
-// High priority thread:
-// Starts up and then goes to grab the lock that the low priority thread has.
-//
-// Control thread:
-// Sets the deadlock up so that it will happen 100% of the time by making sure
-// that each thread in order gets to the point that it needs to be at to cause
-// the deadlock.
-template <typename MutexType>
-class InversionTestRunner {
- public:
- void operator()() {
- // This thread must run at the highest priority or it can't coordinate the
- // inversion. This means that it can't busy wait or everything could
- // starve.
- SetThreadRealtimePriorityOrDie(23);
-
- MutexType m;
-
- // Start the lowest priority thread and wait until it holds the lock.
- LowPriorityThread<MutexType> low(&m);
- std::thread low_thread(std::ref(low));
- low.WaitForStartup();
-
- // Start the busy waiting thread and let it get to the loop.
- BusyWaitingThread busy;
- std::thread busy_thread(std::ref(busy));
- busy.WaitForStartup();
-
- // Start the high priority thread and let it become blocked on the lock.
- HighPriorityThread<MutexType> high(&m);
- std::thread high_thread(std::ref(high));
- high.WaitForStartup();
- // Startup and locking the mutex in the high priority thread aren't atomic,
- // but pretty close. Wait a bit to let it happen.
- std::this_thread::sleep_for(std::chrono::milliseconds(10));
-
- // Release the mutex in the low priority thread. If done right, everything
- // should finish now.
- low.release_mutex();
-
- // Wait for everything to finish and compute success.
- high_thread.join();
- busy.quit();
- busy_thread.join();
- low_thread.join();
- m_success = low.success() && busy.success() && high.success();
- }
-
- bool success() { return m_success; }
-
- private:
- bool m_success = false;
-};
-
-// TODO: Fix roborio permissions to run as root.
-
-// Priority inversion test.
-TEST(MutexTest, DISABLED_PriorityInversionTest) {
- InversionTestRunner<priority_mutex> runner;
- std::thread runner_thread(std::ref(runner));
- runner_thread.join();
- EXPECT_TRUE(runner.success());
-}
-
-// Verify that the non-priority inversion mutex doesn't pass the test.
-TEST(MutexTest, DISABLED_StdMutexPriorityInversionTest) {
- InversionTestRunner<std::mutex> runner;
- std::thread runner_thread(std::ref(runner));
- runner_thread.join();
- EXPECT_FALSE(runner.success());
-}
-
-// Smoke test to make sure that mutexes lock and unlock.
-TEST(MutexTest, TryLock) {
- priority_mutex m;
- m.lock();
- EXPECT_FALSE(m.try_lock());
- m.unlock();
- EXPECT_TRUE(m.try_lock());
-}
-
-// Priority inversion test.
-TEST(MutexTest, DISABLED_ReentrantPriorityInversionTest) {
- InversionTestRunner<priority_recursive_mutex> runner;
- std::thread runner_thread(std::ref(runner));
- runner_thread.join();
- EXPECT_TRUE(runner.success());
-}
-
-// Smoke test to make sure that mutexes lock and unlock.
-TEST(MutexTest, ReentrantTryLock) {
- priority_recursive_mutex m;
- m.lock();
- EXPECT_TRUE(m.try_lock());
- m.unlock();
- EXPECT_TRUE(m.try_lock());
-}
-
-} // namespace testing
-} // namespace wpilib
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/NotifierTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/NotifierTest.cpp
deleted file mode 100644
index 448ebb6..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/NotifierTest.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Notifier.h" // NOLINT(build/include_order)
-
-#include "TestBench.h"
-#include "Timer.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-unsigned notifierCounter;
-
-void notifierHandler(void*) { notifierCounter++; }
-
-/**
- * Test if the Wait function works
- */
-TEST(NotifierTest, DISABLED_TestTimerNotifications) {
- std::cout << "NotifierTest..." << std::endl;
- notifierCounter = 0;
- std::cout << "notifier(notifierHandler, nullptr)..." << std::endl;
- Notifier notifier(notifierHandler, nullptr);
- std::cout << "Start Periodic..." << std::endl;
- notifier.StartPeriodic(1.0);
-
- std::cout << "Wait..." << std::endl;
- Wait(10.5);
- std::cout << "...Wait" << std::endl;
-
- EXPECT_EQ(10u, notifierCounter) << "Received " << notifierCounter
- << " notifications in 10.5 seconds";
- std::cout << "Received " << notifierCounter
- << " notifications in 10.5 seconds";
-
- std::cout << "...NotifierTest" << std::endl;
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/PCMTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/PCMTest.cpp
deleted file mode 100644
index 1423e6e..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/PCMTest.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "AnalogInput.h"
-#include "Compressor.h"
-#include "DigitalInput.h"
-#include "DigitalOutput.h"
-#include "DoubleSolenoid.h"
-#include "Solenoid.h"
-#include "TestBench.h"
-#include "Timer.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-/* The PCM switches the compressor up to a couple seconds after the pressure
- switch changes. */
-static const double kCompressorDelayTime = 3.0;
-
-/* Solenoids should change much more quickly */
-static const double kSolenoidDelayTime = 0.5;
-
-/* The voltage divider on the test bench should bring the compressor output
- to around these values. */
-static const double kCompressorOnVoltage = 5.00;
-static const double kCompressorOffVoltage = 1.68;
-
-class PCMTest : public testing::Test {
- protected:
- Compressor* m_compressor;
-
- DigitalOutput* m_fakePressureSwitch;
- AnalogInput* m_fakeCompressor;
- DoubleSolenoid* m_doubleSolenoid;
- DigitalInput *m_fakeSolenoid1, *m_fakeSolenoid2;
-
- void SetUp() override {
- m_compressor = new Compressor();
-
- m_fakePressureSwitch =
- new DigitalOutput(TestBench::kFakePressureSwitchChannel);
- m_fakeCompressor = new AnalogInput(TestBench::kFakeCompressorChannel);
- m_fakeSolenoid1 = new DigitalInput(TestBench::kFakeSolenoid1Channel);
- m_fakeSolenoid2 = new DigitalInput(TestBench::kFakeSolenoid2Channel);
- }
-
- void TearDown() override {
- delete m_compressor;
- delete m_fakePressureSwitch;
- delete m_fakeCompressor;
- delete m_fakeSolenoid1;
- delete m_fakeSolenoid2;
- }
-
- void Reset() {
- m_compressor->Stop();
- m_fakePressureSwitch->Set(false);
- }
-};
-
-/**
- * Test if the compressor turns on and off when the pressure switch is toggled
- */
-TEST_F(PCMTest, PressureSwitch) {
- Reset();
-
- m_compressor->SetClosedLoopControl(true);
-
- // Turn on the compressor
- m_fakePressureSwitch->Set(true);
- Wait(kCompressorDelayTime);
- EXPECT_NEAR(kCompressorOnVoltage, m_fakeCompressor->GetVoltage(), 0.5)
- << "Compressor did not turn on when the pressure switch turned on.";
-
- // Turn off the compressor
- m_fakePressureSwitch->Set(false);
- Wait(kCompressorDelayTime);
- EXPECT_NEAR(kCompressorOffVoltage, m_fakeCompressor->GetVoltage(), 0.5)
- << "Compressor did not turn off when the pressure switch turned off.";
-}
-
-/**
- * Test if the correct solenoids turn on and off when they should
- */
-TEST_F(PCMTest, Solenoid) {
- Reset();
- Solenoid solenoid1(TestBench::kSolenoidChannel1);
- Solenoid solenoid2(TestBench::kSolenoidChannel2);
-
- // Turn both solenoids off
- solenoid1.Set(false);
- solenoid2.Set(false);
- Wait(kSolenoidDelayTime);
- EXPECT_TRUE(m_fakeSolenoid1->Get()) << "Solenoid #1 did not turn off";
- EXPECT_TRUE(m_fakeSolenoid2->Get()) << "Solenoid #2 did not turn off";
- EXPECT_FALSE(solenoid1.Get()) << "Solenoid #1 did not read off";
- EXPECT_FALSE(solenoid2.Get()) << "Solenoid #2 did not read off";
-
- // Turn one solenoid on and one off
- solenoid1.Set(true);
- solenoid2.Set(false);
- Wait(kSolenoidDelayTime);
- EXPECT_FALSE(m_fakeSolenoid1->Get()) << "Solenoid #1 did not turn on";
- EXPECT_TRUE(m_fakeSolenoid2->Get()) << "Solenoid #2 did not turn off";
- EXPECT_TRUE(solenoid1.Get()) << "Solenoid #1 did not read on";
- EXPECT_FALSE(solenoid2.Get()) << "Solenoid #2 did not read off";
-
- // Turn one solenoid on and one off
- solenoid1.Set(false);
- solenoid2.Set(true);
- Wait(kSolenoidDelayTime);
- EXPECT_TRUE(m_fakeSolenoid1->Get()) << "Solenoid #1 did not turn off";
- EXPECT_FALSE(m_fakeSolenoid2->Get()) << "Solenoid #2 did not turn on";
- EXPECT_FALSE(solenoid1.Get()) << "Solenoid #1 did not read off";
- EXPECT_TRUE(solenoid2.Get()) << "Solenoid #2 did not read on";
-
- // Turn both on
- solenoid1.Set(true);
- solenoid2.Set(true);
- Wait(kSolenoidDelayTime);
- EXPECT_FALSE(m_fakeSolenoid1->Get()) << "Solenoid #1 did not turn on";
- EXPECT_FALSE(m_fakeSolenoid2->Get()) << "Solenoid #2 did not turn on";
- EXPECT_TRUE(solenoid1.Get()) << "Solenoid #1 did not read on";
- EXPECT_TRUE(solenoid2.Get()) << "Solenoid #2 did not read on";
-}
-
-/**
- * Test if the correct solenoids turn on and off when they should when used
- * with the DoubleSolenoid class.
- */
-TEST_F(PCMTest, DoubleSolenoid) {
- DoubleSolenoid solenoid(TestBench::kSolenoidChannel1,
- TestBench::kSolenoidChannel2);
-
- solenoid.Set(DoubleSolenoid::kOff);
- Wait(kSolenoidDelayTime);
- EXPECT_TRUE(m_fakeSolenoid1->Get()) << "Solenoid #1 did not turn off";
- EXPECT_TRUE(m_fakeSolenoid2->Get()) << "Solenoid #2 did not turn off";
- EXPECT_TRUE(solenoid.Get() == DoubleSolenoid::kOff)
- << "Solenoid does not read off";
-
- solenoid.Set(DoubleSolenoid::kForward);
- Wait(kSolenoidDelayTime);
- EXPECT_FALSE(m_fakeSolenoid1->Get()) << "Solenoid #1 did not turn on";
- EXPECT_TRUE(m_fakeSolenoid2->Get()) << "Solenoid #2 did not turn off";
- EXPECT_TRUE(solenoid.Get() == DoubleSolenoid::kForward)
- << "Solenoid does not read forward";
-
- solenoid.Set(DoubleSolenoid::kReverse);
- Wait(kSolenoidDelayTime);
- EXPECT_TRUE(m_fakeSolenoid1->Get()) << "Solenoid #1 did not turn off";
- EXPECT_FALSE(m_fakeSolenoid2->Get()) << "Solenoid #2 did not turn on";
- EXPECT_TRUE(solenoid.Get() == DoubleSolenoid::kReverse)
- << "Solenoid does not read reverse";
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/PIDToleranceTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/PIDToleranceTest.cpp
deleted file mode 100644
index cf3849b..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/PIDToleranceTest.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "PIDController.h"
-#include "PIDOutput.h"
-#include "PIDSource.h"
-#include "TestBench.h"
-#include "Timer.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-class PIDToleranceTest : public testing::Test {
- protected:
- const double setpoint = 50.0;
- const double range = 200;
- const double tolerance = 10.0;
- class fakeInput : public PIDSource {
- public:
- double val = 0;
- void SetPIDSourceType(PIDSourceType pidSource) {}
- PIDSourceType GetPIDSourceType() { return PIDSourceType::kDisplacement; }
- double PIDGet() { return val; }
- };
- class fakeOutput : public PIDOutput {
- void PIDWrite(double output) {}
- };
- fakeInput inp;
- fakeOutput out;
- PIDController* pid;
- void SetUp() override {
- pid = new PIDController(0.5, 0.0, 0.0, &inp, &out);
- pid->SetInputRange(-range / 2, range / 2);
- }
- void TearDown() override { delete pid; }
- void Reset() { inp.val = 0; }
-};
-
-TEST_F(PIDToleranceTest, Absolute) {
- Reset();
- pid->SetAbsoluteTolerance(tolerance);
- pid->SetSetpoint(setpoint);
- pid->Enable();
- EXPECT_FALSE(pid->OnTarget())
- << "Error was in tolerance when it should not have been. Error was "
- << pid->GetAvgError();
- inp.val = setpoint + tolerance / 2;
- Wait(1.0);
- EXPECT_TRUE(pid->OnTarget())
- << "Error was not in tolerance when it should have been. Error was "
- << pid->GetAvgError();
- inp.val = setpoint + 10 * tolerance;
- Wait(1.0);
- EXPECT_FALSE(pid->OnTarget())
- << "Error was in tolerance when it should not have been. Error was "
- << pid->GetAvgError();
-}
-
-TEST_F(PIDToleranceTest, Percent) {
- Reset();
- pid->SetPercentTolerance(tolerance);
- pid->SetSetpoint(setpoint);
- pid->Enable();
- EXPECT_FALSE(pid->OnTarget())
- << "Error was in tolerance when it should not have been. Error was "
- << pid->GetAvgError();
- inp.val = setpoint +
- (tolerance) / 200 *
- range; // half of percent tolerance away from setpoint
- Wait(1.0);
- EXPECT_TRUE(pid->OnTarget())
- << "Error was not in tolerance when it should have been. Error was "
- << pid->GetAvgError();
- inp.val =
- setpoint +
- (tolerance) / 50 * range; // double percent tolerance away from setPoint
- Wait(1.0);
- EXPECT_FALSE(pid->OnTarget())
- << "Error was in tolerance when it should not have been. Error was "
- << pid->GetAvgError();
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/PowerDistributionPanelTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/PowerDistributionPanelTest.cpp
deleted file mode 100644
index 8bedcf5..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/PowerDistributionPanelTest.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "PowerDistributionPanel.h" // NOLINT(build/include_order)
-
-#include "Jaguar.h"
-#include "Talon.h"
-#include "TestBench.h"
-#include "Timer.h"
-#include "Victor.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-static const double kMotorTime = 0.25;
-
-class PowerDistributionPanelTest : public testing::Test {
- protected:
- PowerDistributionPanel* m_pdp;
- Talon* m_talon;
- Victor* m_victor;
- Jaguar* m_jaguar;
-
- void SetUp() override {
- m_pdp = new PowerDistributionPanel();
- m_talon = new Talon(TestBench::kTalonChannel);
- m_victor = new Victor(TestBench::kVictorChannel);
- m_jaguar = new Jaguar(TestBench::kJaguarChannel);
- }
-
- void TearDown() override {
- delete m_pdp;
- delete m_talon;
- delete m_victor;
- delete m_jaguar;
- }
-};
-
-/**
- * Test if the current changes when the motor is driven using a talon
- */
-TEST_F(PowerDistributionPanelTest, CheckCurrentTalon) {
- Wait(kMotorTime);
-
- /* The Current should be 0 */
- EXPECT_FLOAT_EQ(0, m_pdp->GetCurrent(TestBench::kTalonPDPChannel))
- << "The Talon current was non-zero";
-
- /* Set the motor to full forward */
- m_talon->Set(1.0);
- Wait(kMotorTime);
-
- /* The current should now be positive */
- ASSERT_GT(m_pdp->GetCurrent(TestBench::kTalonPDPChannel), 0)
- << "The Talon current was not positive";
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/PreferencesTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/PreferencesTest.cpp
deleted file mode 100644
index 60262fb..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/PreferencesTest.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Preferences.h" // NOLINT(build/include_order)
-
-#include <cstdio>
-#include <fstream>
-
-#include "Timer.h"
-#include "gtest/gtest.h"
-#include "ntcore.h"
-
-using namespace frc;
-
-static const char* kFileName = "networktables.ini";
-static const double kSaveTime = 1.2;
-
-/**
- * If we write a new networktables.ini with some sample values, test that
- * we get those same values back using the Preference class.
- */
-TEST(PreferencesTest, ReadPreferencesFromFile) {
- NetworkTable::Shutdown();
- std::remove(kFileName);
- std::ofstream preferencesFile(kFileName);
- preferencesFile << "[NetworkTables Storage 3.0]" << std::endl;
- preferencesFile
- << "string \"/Preferences/testFileGetString\"=\"Hello, preferences file\""
- << std::endl;
- preferencesFile << "double \"/Preferences/testFileGetInt\"=1" << std::endl;
- preferencesFile << "double \"/Preferences/testFileGetDouble\"=0.5"
- << std::endl;
- preferencesFile << "double \"/Preferences/testFileGetFloat\"=0.25"
- << std::endl;
- preferencesFile << "boolean \"/Preferences/testFileGetBoolean\"=true"
- << std::endl;
- preferencesFile
- << "double \"/Preferences/testFileGetLong\"=1000000000000000000"
- << std::endl;
- preferencesFile.close();
- NetworkTable::Initialize();
-
- Preferences* preferences = Preferences::GetInstance();
- EXPECT_EQ("Hello, preferences file",
- preferences->GetString("testFileGetString"));
- EXPECT_EQ(1, preferences->GetInt("testFileGetInt"));
- EXPECT_FLOAT_EQ(0.5, preferences->GetDouble("testFileGetDouble"));
- EXPECT_FLOAT_EQ(0.25f, preferences->GetFloat("testFileGetFloat"));
- EXPECT_TRUE(preferences->GetBoolean("testFileGetBoolean"));
- EXPECT_EQ(1000000000000000000ll, preferences->GetLong("testFileGetLong"));
-}
-
-/**
- * If we set some values using the Preferences class, test that they show up
- * in networktables.ini
- */
-TEST(PreferencesTest, WritePreferencesToFile) {
- NetworkTable::Shutdown();
- NetworkTable::GlobalDeleteAll();
- // persistent keys don't get deleted normally, so make remaining keys
- // non-persistent and delete them too
- for (const auto& info : nt::GetEntryInfo("", 0)) {
- nt::SetEntryFlags(info.name, 0);
- }
- NetworkTable::GlobalDeleteAll();
- std::remove(kFileName);
- NetworkTable::Initialize();
- Preferences* preferences = Preferences::GetInstance();
- preferences->PutString("testFilePutString", "Hello, preferences file");
- preferences->PutInt("testFilePutInt", 1);
- preferences->PutDouble("testFilePutDouble", 0.5);
- preferences->PutFloat("testFilePutFloat", 0.25f);
- preferences->PutBoolean("testFilePutBoolean", true);
- preferences->PutLong("testFilePutLong", 1000000000000000000ll);
- preferences->Save();
-
- Wait(kSaveTime);
-
- static char const* kExpectedFileContents[] = {
- "[NetworkTables Storage 3.0]",
- "boolean \"/Preferences/testFilePutBoolean\"=true",
- "double \"/Preferences/testFilePutDouble\"=0.5",
- "double \"/Preferences/testFilePutFloat\"=0.25",
- "double \"/Preferences/testFilePutInt\"=1",
- "double \"/Preferences/testFilePutLong\"=1e+18",
- "string \"/Preferences/testFilePutString\"=\"Hello, preferences file\""};
-
- std::ifstream preferencesFile(kFileName);
- for (auto& kExpectedFileContent : kExpectedFileContents) {
- ASSERT_FALSE(preferencesFile.eof())
- << "Preferences file prematurely reached EOF";
-
- std::string line;
- std::getline(preferencesFile, line);
-
- ASSERT_EQ(kExpectedFileContent, line)
- << "A line in networktables.ini was not correct";
- }
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/RelayTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/RelayTest.cpp
deleted file mode 100644
index 81a7c14..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/RelayTest.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Relay.h" // NOLINT(build/include_order)
-
-#include "DigitalInput.h"
-#include "TestBench.h"
-#include "Timer.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-static const double kDelayTime = 0.01;
-
-class RelayTest : public testing::Test {
- protected:
- Relay* m_relay;
- DigitalInput* m_forward;
- DigitalInput* m_reverse;
-
- void SetUp() override {
- m_relay = new Relay(TestBench::kRelayChannel);
- m_forward = new DigitalInput(TestBench::kFakeRelayForward);
- m_reverse = new DigitalInput(TestBench::kFakeRelayReverse);
- }
-
- void TearDown() override {
- delete m_relay;
- delete m_forward;
- delete m_reverse;
- }
-
- void Reset() { m_relay->Set(Relay::kOff); }
-};
-/**
- * Test the relay by setting it forward, reverse, off, and on.
- */
-TEST_F(RelayTest, Relay) {
- Reset();
-
- // set the relay to forward
- m_relay->Set(Relay::kForward);
- Wait(kDelayTime);
- EXPECT_TRUE(m_forward->Get()) << "Relay did not set forward";
- EXPECT_FALSE(m_reverse->Get()) << "Relay did not set forward";
-
- // set the relay to reverse
- m_relay->Set(Relay::kReverse);
- Wait(kDelayTime);
- EXPECT_TRUE(m_reverse->Get()) << "Relay did not set reverse";
- EXPECT_FALSE(m_forward->Get()) << "Relay did not set reverse";
-
- // set the relay to off
- m_relay->Set(Relay::kOff);
- Wait(kDelayTime);
- EXPECT_FALSE(m_forward->Get()) << "Relay did not set off";
- EXPECT_FALSE(m_reverse->Get()) << "Relay did not set off";
-
- // set the relay to on
- m_relay->Set(Relay::kOn);
- Wait(kDelayTime);
- EXPECT_TRUE(m_forward->Get()) << "Relay did not set on";
- EXPECT_TRUE(m_reverse->Get()) << "Relay did not set on";
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/TestEnvironment.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/TestEnvironment.cpp
deleted file mode 100644
index a59f0a8..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/TestEnvironment.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include <cstdlib>
-
-#include "DriverStation.h"
-#include "HAL/HAL.h"
-#include "LiveWindow/LiveWindow.h"
-#include "Timer.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-class TestEnvironment : public testing::Environment {
- bool m_alreadySetUp = false;
-
- public:
- void SetUp() override {
- /* Only set up once. This allows gtest_repeat to be used to
- automatically repeat tests. */
- if (m_alreadySetUp) return;
- m_alreadySetUp = true;
-
- if (!HAL_Initialize(0)) {
- std::cerr << "FATAL ERROR: HAL could not be initialized" << std::endl;
- std::exit(-1);
- }
-
- /* This sets up the network communications library to enable the driver
- station. After starting network coms, it will loop until the driver
- station returns that the robot is enabled, to ensure that tests
- will be able to run on the hardware. */
- HAL_ObserveUserProgramStarting();
- LiveWindow::GetInstance()->SetEnabled(false);
-
- std::cout << "Waiting for enable" << std::endl;
-
- while (!DriverStation::GetInstance().IsEnabled()) {
- Wait(0.1);
- }
- }
-
- void TearDown() override {}
-};
-
-testing::Environment* const environment =
- testing::AddGlobalTestEnvironment(new TestEnvironment);
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/TiltPanCameraTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/TiltPanCameraTest.cpp
deleted file mode 100644
index 0761205..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/TiltPanCameraTest.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include <cmath>
-
-#include "ADXL345_SPI.h"
-#include "AnalogGyro.h"
-#include "Servo.h"
-#include "TestBench.h"
-#include "Timer.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-static constexpr double kServoResetTime = 2.0;
-
-static constexpr double kTestAngle = 90.0;
-
-static constexpr double kTiltSetpoint0 = 0.22;
-static constexpr double kTiltSetpoint45 = 0.45;
-static constexpr double kTiltSetpoint90 = 0.68;
-static constexpr double kTiltTime = 1.0;
-static constexpr double kAccelerometerTolerance = 0.2;
-static constexpr double kSensitivity = 0.013;
-
-/**
- * A fixture for the camera with two servos and a gyro
- */
-class TiltPanCameraTest : public testing::Test {
- protected:
- static AnalogGyro* m_gyro;
- Servo *m_tilt, *m_pan;
- Accelerometer* m_spiAccel;
-
- static void SetUpTestCase() {
- // The gyro object blocks for 5 seconds in the constructor, so only
- // construct it once for the whole test case
- m_gyro = new AnalogGyro(TestBench::kCameraGyroChannel);
- m_gyro->SetSensitivity(kSensitivity);
- }
-
- static void TearDownTestCase() { delete m_gyro; }
-
- void SetUp() override {
- m_tilt = new Servo(TestBench::kCameraTiltChannel);
- m_pan = new Servo(TestBench::kCameraPanChannel);
- m_spiAccel = new ADXL345_SPI(SPI::kOnboardCS1);
-
- m_tilt->Set(kTiltSetpoint45);
- m_pan->SetAngle(0.0);
-
- Wait(kServoResetTime);
-
- m_gyro->Reset();
- }
-
- void DefaultGyroAngle();
- void GyroAngle();
- void GyroCalibratedParameters();
-
- void TearDown() override {
- delete m_tilt;
- delete m_pan;
- delete m_spiAccel;
- }
-};
-
-AnalogGyro* TiltPanCameraTest::m_gyro = nullptr;
-
-/**
- * Test if the gyro angle defaults to 0 immediately after being reset.
- */
-void TiltPanCameraTest::DefaultGyroAngle() {
- EXPECT_NEAR(0.0, m_gyro->GetAngle(), 1.0);
-}
-
-/**
- * Test if the servo turns 90 degrees and the gyroscope measures this angle
- * Note servo on TestBench is not the same type of servo that servo class
- * was designed for so setAngle is significantly off. This has been calibrated
- * for the servo on the rig.
- */
-void TiltPanCameraTest::GyroAngle() {
- // Make sure that the gyro doesn't get jerked when the servo goes to zero.
- m_pan->SetAngle(0.0);
- Wait(0.5);
- m_gyro->Reset();
-
- for (int32_t i = 0; i < 600; i++) {
- m_pan->Set(i / 1000.0);
- Wait(0.001);
- }
-
- double gyroAngle = m_gyro->GetAngle();
-
- EXPECT_NEAR(gyroAngle, kTestAngle, 10.0)
- << "Gyro measured " << gyroAngle << " degrees, servo should have turned "
- << kTestAngle << " degrees";
-}
-
-/**
- * Gets calibrated parameters from previously calibrated gyro, allocates a new
- * gyro with the given parameters for center and offset, and re-runs tests on
- * the new gyro.
- */
-void TiltPanCameraTest::GyroCalibratedParameters() {
- uint32_t cCenter = m_gyro->GetCenter();
- double cOffset = m_gyro->GetOffset();
- delete m_gyro;
- m_gyro = new AnalogGyro(TestBench::kCameraGyroChannel, cCenter, cOffset);
- m_gyro->SetSensitivity(kSensitivity);
-
- // Default gyro angle test
- // Accumulator needs a small amount of time to reset before being tested
- m_gyro->Reset();
- Wait(0.001);
- EXPECT_NEAR(0.0, m_gyro->GetAngle(), 1.0);
-
- // Gyro angle test
- // Make sure that the gyro doesn't get jerked when the servo goes to zero.
- m_pan->SetAngle(0.0);
- Wait(0.5);
- m_gyro->Reset();
-
- for (int32_t i = 0; i < 600; i++) {
- m_pan->Set(i / 1000.0);
- Wait(0.001);
- }
-
- double gyroAngle = m_gyro->GetAngle();
-
- EXPECT_NEAR(gyroAngle, kTestAngle, 10.0)
- << "Gyro measured " << gyroAngle << " degrees, servo should have turned "
- << kTestAngle << " degrees";
-}
-
-/**
- * Run all gyro tests in one function to make sure they are run in order.
- */
-TEST_F(TiltPanCameraTest, TestAllGyroTests) {
- DefaultGyroAngle();
- GyroAngle();
- GyroCalibratedParameters();
-}
-
-/**
- * Test if the accelerometer measures gravity along the correct axes when the
- * camera rotates
- */
-TEST_F(TiltPanCameraTest, SPIAccelerometer) {
- m_tilt->Set(kTiltSetpoint0);
- Wait(kTiltTime);
- EXPECT_NEAR(-1.0, m_spiAccel->GetX(), kAccelerometerTolerance);
- EXPECT_NEAR(0.0, m_spiAccel->GetY(), kAccelerometerTolerance);
- EXPECT_NEAR(0.0, m_spiAccel->GetZ(), kAccelerometerTolerance);
-
- m_tilt->Set(kTiltSetpoint45);
- Wait(kTiltTime);
- EXPECT_NEAR(-std::sqrt(0.5), m_spiAccel->GetX(), kAccelerometerTolerance);
- EXPECT_NEAR(0.0, m_spiAccel->GetY(), kAccelerometerTolerance);
- EXPECT_NEAR(std::sqrt(0.5), m_spiAccel->GetZ(), kAccelerometerTolerance);
-
- m_tilt->Set(kTiltSetpoint90);
- Wait(kTiltTime);
- EXPECT_NEAR(0.0, m_spiAccel->GetX(), kAccelerometerTolerance);
- EXPECT_NEAR(0.0, m_spiAccel->GetY(), kAccelerometerTolerance);
- EXPECT_NEAR(1.0, m_spiAccel->GetZ(), kAccelerometerTolerance);
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/TimerTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/TimerTest.cpp
deleted file mode 100644
index a328a06..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/TimerTest.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Timer.h" // NOLINT(build/include_order)
-
-#include "TestBench.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-static const double kWaitTime = 0.5;
-
-class TimerTest : public testing::Test {
- protected:
- Timer* m_timer;
-
- void SetUp() override { m_timer = new Timer; }
-
- void TearDown() override { delete m_timer; }
-
- void Reset() { m_timer->Reset(); }
-};
-
-/**
- * Test if the Wait function works
- */
-TEST_F(TimerTest, Wait) {
- Reset();
-
- double initialTime = m_timer->GetFPGATimestamp();
-
- Wait(kWaitTime);
-
- double finalTime = m_timer->GetFPGATimestamp();
-
- EXPECT_NEAR(kWaitTime, finalTime - initialTime, 0.001);
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/VisionTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/VisionTest.cpp
deleted file mode 100644
index d9ba821..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/VisionTest.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "vision/VisionRunner.h"
-
-using namespace frc;
-
-class VisionTester : public VisionPipeline {
- public:
- virtual ~VisionTester() = default;
- void Process(cv::Mat& mat) override {}
- void TestThing() {}
-};
-
-void TestVisionInitialization() {
- cs::CvSource source;
- VisionTester tester;
- VisionRunner<VisionTester> runner(source, &tester,
- [](VisionTester& t) { t.TestThing(); });
-
- runner.RunOnce();
- runner.RunForever();
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/command/CommandTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/command/CommandTest.cpp
deleted file mode 100644
index 351f3ba..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/command/CommandTest.cpp
+++ /dev/null
@@ -1,444 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Commands/CommandGroup.h"
-#include "Commands/Scheduler.h"
-#include "Commands/Subsystem.h"
-#include "DriverStation.h"
-#include "RobotState.h"
-#include "Timer.h"
-#include "command/MockCommand.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-class CommandTest : public testing::Test {
- protected:
- void SetUp() override {
- RobotState::SetImplementation(DriverStation::GetInstance());
- Scheduler::GetInstance()->SetEnabled(true);
- }
-
- /**
- * Tears Down the Scheduler at the end of each test.
- * Must be called at the end of each test inside each test in order to prevent
- * them being deallocated
- * when they leave the scope of the test (causing a segfault).
- * This can not be done within the virtual void Teardown() method because it
- * is called outside of the
- * scope of the test.
- */
- void TeardownScheduler() { Scheduler::GetInstance()->ResetAll(); }
-
- void AssertCommandState(MockCommand& command, int32_t initialize,
- int32_t execute, int32_t isFinished, int32_t end,
- int32_t interrupted) {
- EXPECT_EQ(initialize, command.GetInitializeCount());
- EXPECT_EQ(execute, command.GetExecuteCount());
- EXPECT_EQ(isFinished, command.GetIsFinishedCount());
- EXPECT_EQ(end, command.GetEndCount());
- EXPECT_EQ(interrupted, command.GetInterruptedCount());
- }
-};
-
-class ASubsystem : public Subsystem {
- private:
- Command* m_command = nullptr;
-
- public:
- explicit ASubsystem(const std::string& name) : Subsystem(name) {}
-
- void InitDefaultCommand() override {
- if (m_command != nullptr) {
- SetDefaultCommand(m_command);
- }
- }
-
- void Init(Command* command) { m_command = command; }
-};
-
-// CommandParallelGroupTest ported from CommandParallelGroupTest.java
-TEST_F(CommandTest, ParallelCommands) {
- MockCommand command1;
- MockCommand command2;
- CommandGroup commandGroup;
-
- commandGroup.AddParallel(&command1);
- commandGroup.AddParallel(&command2);
-
- AssertCommandState(command1, 0, 0, 0, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
- commandGroup.Start();
- AssertCommandState(command1, 0, 0, 0, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 0, 0, 0, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 1, 1, 0, 0);
- AssertCommandState(command2, 1, 1, 1, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 2, 2, 0, 0);
- AssertCommandState(command2, 1, 2, 2, 0, 0);
- command1.SetHasFinished(true);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 3, 3, 1, 0);
- AssertCommandState(command2, 1, 3, 3, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 3, 3, 1, 0);
- AssertCommandState(command2, 1, 4, 4, 0, 0);
- command2.SetHasFinished(true);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 3, 3, 1, 0);
- AssertCommandState(command2, 1, 5, 5, 1, 0);
-
- TeardownScheduler();
-}
-// END CommandParallelGroupTest
-
-// CommandScheduleTest ported from CommandScheduleTest.java
-TEST_F(CommandTest, RunAndTerminate) {
- MockCommand command;
- command.Start();
- AssertCommandState(command, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 1, 1, 1, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 1, 2, 2, 0, 0);
- command.SetHasFinished(true);
- AssertCommandState(command, 1, 2, 2, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 1, 3, 3, 1, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 1, 3, 3, 1, 0);
-
- TeardownScheduler();
-}
-
-TEST_F(CommandTest, RunAndCancel) {
- MockCommand command;
- command.Start();
- AssertCommandState(command, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 1, 1, 1, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 1, 2, 2, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 1, 3, 3, 0, 0);
- command.Cancel();
- AssertCommandState(command, 1, 3, 3, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 1, 3, 3, 0, 1);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 1, 3, 3, 0, 1);
-
- TeardownScheduler();
-}
-// END CommandScheduleTest
-
-// CommandSequentialGroupTest ported from CommandSequentialGroupTest.java
-TEST_F(CommandTest, ThreeCommandOnSubSystem) {
- ASubsystem subsystem("Three Command Test Subsystem");
- MockCommand command1;
- command1.Requires(&subsystem);
- MockCommand command2;
- command2.Requires(&subsystem);
- MockCommand command3;
- command3.Requires(&subsystem);
-
- CommandGroup commandGroup;
- commandGroup.AddSequential(&command1, 1.0);
- commandGroup.AddSequential(&command2, 2.0);
- commandGroup.AddSequential(&command3);
-
- AssertCommandState(command1, 0, 0, 0, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
- AssertCommandState(command3, 0, 0, 0, 0, 0);
-
- commandGroup.Start();
- AssertCommandState(command1, 0, 0, 0, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
- AssertCommandState(command3, 0, 0, 0, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 0, 0, 0, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
- AssertCommandState(command3, 0, 0, 0, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 1, 1, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
- AssertCommandState(command3, 0, 0, 0, 0, 0);
- Wait(1); // command 1 timeout
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 1, 1, 0, 1);
- AssertCommandState(command2, 1, 1, 1, 0, 0);
- AssertCommandState(command3, 0, 0, 0, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 1, 1, 0, 1);
- AssertCommandState(command2, 1, 2, 2, 0, 0);
- AssertCommandState(command3, 0, 0, 0, 0, 0);
- Wait(2); // command 2 timeout
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 1, 1, 0, 1);
- AssertCommandState(command2, 1, 2, 2, 0, 1);
- AssertCommandState(command3, 1, 1, 1, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 1, 1, 0, 1);
- AssertCommandState(command2, 1, 2, 2, 0, 1);
- AssertCommandState(command3, 1, 2, 2, 0, 0);
- command3.SetHasFinished(true);
- AssertCommandState(command1, 1, 1, 1, 0, 1);
- AssertCommandState(command2, 1, 2, 2, 0, 1);
- AssertCommandState(command3, 1, 2, 2, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 1, 1, 0, 1);
- AssertCommandState(command2, 1, 2, 2, 0, 1);
- AssertCommandState(command3, 1, 3, 3, 1, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 1, 1, 0, 1);
- AssertCommandState(command2, 1, 2, 2, 0, 1);
- AssertCommandState(command3, 1, 3, 3, 1, 0);
-
- TeardownScheduler();
-}
-// END CommandSequentialGroupTest
-
-// CommandSequentialGroupTest ported from CommandSequentialGroupTest.java
-TEST_F(CommandTest, OneCommandSupersedingAnotherBecauseOfDependencies) {
- auto subsystem = new ASubsystem("Command Superseding Test Subsystem");
- MockCommand command1;
- command1.Requires(subsystem);
- MockCommand command2;
- command2.Requires(subsystem);
-
- AssertCommandState(command1, 0, 0, 0, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- command1.Start();
- AssertCommandState(command1, 0, 0, 0, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 0, 0, 0, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 1, 1, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 2, 2, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 3, 3, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- command2.Start();
- AssertCommandState(command1, 1, 3, 3, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 4, 4, 0, 1);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 4, 4, 0, 1);
- AssertCommandState(command2, 1, 1, 1, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 4, 4, 0, 1);
- AssertCommandState(command2, 1, 2, 2, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 4, 4, 0, 1);
- AssertCommandState(command2, 1, 3, 3, 0, 0);
-
- TeardownScheduler();
-}
-
-TEST_F(CommandTest,
- OneCommandFailingSupersedingBecauseFirstCanNotBeInterrupted) {
- ASubsystem subsystem("Command Superseding Test Subsystem");
- MockCommand command1;
-
- command1.Requires(&subsystem);
-
- command1.SetInterruptible(false);
- MockCommand command2;
- command2.Requires(&subsystem);
-
- AssertCommandState(command1, 0, 0, 0, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- command1.Start();
- AssertCommandState(command1, 0, 0, 0, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 0, 0, 0, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 1, 1, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 2, 2, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 3, 3, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- command2.Start();
- AssertCommandState(command1, 1, 3, 3, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- Scheduler::GetInstance()->Run();
- AssertCommandState(command1, 1, 4, 4, 0, 0);
- AssertCommandState(command2, 0, 0, 0, 0, 0);
-
- TeardownScheduler();
-}
-
-// END CommandSequentialGroupTest
-
-class ModifiedMockCommand : public MockCommand {
- public:
- ModifiedMockCommand() : MockCommand() { SetTimeout(2.0); }
- bool IsFinished() override {
- return MockCommand::IsFinished() || IsTimedOut();
- }
-};
-
-TEST_F(CommandTest, TwoSecondTimeout) {
- ASubsystem subsystem("Two Second Timeout Test Subsystem");
- ModifiedMockCommand command;
- command.Requires(&subsystem);
-
- command.Start();
- AssertCommandState(command, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 1, 1, 1, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 1, 2, 2, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 1, 3, 3, 0, 0);
- Wait(2);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 1, 4, 4, 1, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(command, 1, 4, 4, 1, 0);
-
- TeardownScheduler();
-}
-
-TEST_F(CommandTest, DefaultCommandWhereTheInteruptingCommandEndsItself) {
- ASubsystem subsystem("Default Command Test Subsystem");
- MockCommand defaultCommand;
- defaultCommand.Requires(&subsystem);
- MockCommand anotherCommand;
- anotherCommand.Requires(&subsystem);
-
- AssertCommandState(defaultCommand, 0, 0, 0, 0, 0);
- subsystem.Init(&defaultCommand);
-
- AssertCommandState(defaultCommand, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 1, 1, 1, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 1, 2, 2, 0, 0);
-
- anotherCommand.Start();
- AssertCommandState(defaultCommand, 1, 2, 2, 0, 0);
- AssertCommandState(anotherCommand, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 1, 3, 3, 0, 1);
- AssertCommandState(anotherCommand, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 1, 3, 3, 0, 1);
- AssertCommandState(anotherCommand, 1, 1, 1, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 1, 3, 3, 0, 1);
- AssertCommandState(anotherCommand, 1, 2, 2, 0, 0);
- anotherCommand.SetHasFinished(true);
- AssertCommandState(defaultCommand, 1, 3, 3, 0, 1);
- AssertCommandState(anotherCommand, 1, 2, 2, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 1, 3, 3, 0, 1);
- AssertCommandState(anotherCommand, 1, 3, 3, 1, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 2, 4, 4, 0, 1);
- AssertCommandState(anotherCommand, 1, 3, 3, 1, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 2, 5, 5, 0, 1);
- AssertCommandState(anotherCommand, 1, 3, 3, 1, 0);
-
- TeardownScheduler();
-}
-
-TEST_F(CommandTest, DefaultCommandsInterruptingCommandCanceled) {
- ASubsystem subsystem("Default Command Test Subsystem");
- MockCommand defaultCommand;
- defaultCommand.Requires(&subsystem);
- MockCommand anotherCommand;
- anotherCommand.Requires(&subsystem);
-
- AssertCommandState(defaultCommand, 0, 0, 0, 0, 0);
- subsystem.Init(&defaultCommand);
- subsystem.InitDefaultCommand();
- AssertCommandState(defaultCommand, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 1, 1, 1, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 1, 2, 2, 0, 0);
-
- anotherCommand.Start();
- AssertCommandState(defaultCommand, 1, 2, 2, 0, 0);
- AssertCommandState(anotherCommand, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 1, 3, 3, 0, 1);
- AssertCommandState(anotherCommand, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 1, 3, 3, 0, 1);
- AssertCommandState(anotherCommand, 1, 1, 1, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 1, 3, 3, 0, 1);
- AssertCommandState(anotherCommand, 1, 2, 2, 0, 0);
- anotherCommand.Cancel();
- AssertCommandState(defaultCommand, 1, 3, 3, 0, 1);
- AssertCommandState(anotherCommand, 1, 2, 2, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 1, 3, 3, 0, 1);
- AssertCommandState(anotherCommand, 1, 2, 2, 0, 1);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 2, 4, 4, 0, 1);
- AssertCommandState(anotherCommand, 1, 2, 2, 0, 1);
- Scheduler::GetInstance()->Run();
- AssertCommandState(defaultCommand, 2, 5, 5, 0, 1);
- AssertCommandState(anotherCommand, 1, 2, 2, 0, 1);
-
- TeardownScheduler();
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/command/ConditionalCommandTest.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/command/ConditionalCommandTest.cpp
deleted file mode 100644
index 271131d..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/command/ConditionalCommandTest.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include <DriverStation.h>
-#include <RobotState.h>
-
-#include "Commands/ConditionalCommand.h"
-#include "Commands/Scheduler.h"
-#include "command/MockCommand.h"
-#include "command/MockConditionalCommand.h"
-#include "gtest/gtest.h"
-
-using namespace frc;
-
-class ConditionalCommandTest : public testing::Test {
- public:
- MockConditionalCommand* m_command;
- MockCommand* m_onTrue;
- MockCommand* m_onFalse;
-
- protected:
- void SetUp() override {
- RobotState::SetImplementation(DriverStation::GetInstance());
- Scheduler::GetInstance()->SetEnabled(true);
-
- m_onTrue = new MockCommand();
- m_onFalse = new MockCommand();
- m_command = new MockConditionalCommand(m_onTrue, m_onFalse);
- }
-
- void TearDown() override { delete m_command; }
-
- /**
- * Tears Down the Scheduler at the end of each test.
- *
- * Must be called at the end of each test inside each test in order to prevent
- * them being deallocated when they leave the scope of the test (causing a
- * segfault). This cannot be done within the virtual void Teardown() method
- * because it is called outside of the scope of the test.
- */
- void TeardownScheduler() { Scheduler::GetInstance()->ResetAll(); }
-
- void AssertCommandState(MockCommand& command, int32_t initialize,
- int32_t execute, int32_t isFinished, int32_t end,
- int32_t interrupted) {
- EXPECT_EQ(initialize, command.GetInitializeCount());
- EXPECT_EQ(execute, command.GetExecuteCount());
- EXPECT_EQ(isFinished, command.GetIsFinishedCount());
- EXPECT_EQ(end, command.GetEndCount());
- EXPECT_EQ(interrupted, command.GetInterruptedCount());
- }
-};
-
-TEST_F(ConditionalCommandTest, OnTrueTest) {
- m_command->SetCondition(true);
-
- Scheduler::GetInstance()->AddCommand(m_command);
- AssertCommandState(*m_onTrue, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run(); // init command and select m_onTrue
- AssertCommandState(*m_onTrue, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run(); // init m_onTrue
- AssertCommandState(*m_onTrue, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(*m_onTrue, 1, 1, 2, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(*m_onTrue, 1, 2, 4, 0, 0);
-
- EXPECT_TRUE(m_onTrue->GetInitializeCount() > 0)
- << "Did not initialize the true command\n";
- EXPECT_TRUE(m_onFalse->GetInitializeCount() == 0)
- << "Initialized the false command\n";
-
- TeardownScheduler();
-}
-
-TEST_F(ConditionalCommandTest, OnFalseTest) {
- m_command->SetCondition(false);
-
- Scheduler::GetInstance()->AddCommand(m_command);
- AssertCommandState(*m_onFalse, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run(); // init command and select m_onTrue
- AssertCommandState(*m_onFalse, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run(); // init m_onTrue
- AssertCommandState(*m_onFalse, 0, 0, 0, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(*m_onFalse, 1, 1, 2, 0, 0);
- Scheduler::GetInstance()->Run();
- AssertCommandState(*m_onFalse, 1, 2, 4, 0, 0);
-
- EXPECT_TRUE(m_onFalse->GetInitializeCount() > 0)
- << "Did not initialize the false command";
- EXPECT_TRUE(m_onTrue->GetInitializeCount() == 0)
- << "Initialized the true command";
-
- TeardownScheduler();
-}
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/command/MockCommand.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/command/MockCommand.cpp
deleted file mode 100644
index 19c0c64..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/command/MockCommand.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2014-2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "command/MockCommand.h"
-
-using namespace frc;
-
-MockCommand::MockCommand() {
- m_initializeCount = 0;
- m_executeCount = 0;
- m_isFinishedCount = 0;
- m_hasFinished = false;
- m_endCount = 0;
- m_interruptedCount = 0;
-}
-
-bool MockCommand::HasInitialized() { return GetInitializeCount() > 0; }
-
-bool MockCommand::HasEnd() { return GetEndCount() > 0; }
-
-bool MockCommand::HasInterrupted() { return GetInterruptedCount() > 0; }
-
-void MockCommand::Initialize() { ++m_initializeCount; }
-
-void MockCommand::Execute() { ++m_executeCount; }
-
-bool MockCommand::IsFinished() {
- ++m_isFinishedCount;
- return IsHasFinished();
-}
-
-void MockCommand::End() { ++m_endCount; }
-
-void MockCommand::Interrupted() { ++m_interruptedCount; }
diff --git a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/command/MockConditionalCommand.cpp b/third_party/allwpilib_2017/wpilibcIntegrationTests/src/command/MockConditionalCommand.cpp
deleted file mode 100644
index b23b815..0000000
--- a/third_party/allwpilib_2017/wpilibcIntegrationTests/src/command/MockConditionalCommand.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2017. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "command/MockConditionalCommand.h"
-
-using namespace frc;
-
-MockConditionalCommand::MockConditionalCommand(MockCommand* onTrue,
- MockCommand* onFalse)
- : ConditionalCommand(onTrue, onFalse) {}
-
-void MockConditionalCommand::SetCondition(bool condition) {
- m_condition = condition;
-}
-
-bool MockConditionalCommand::Condition() { return m_condition; }
diff --git a/third_party/ntcore_2017/.clang-format b/third_party/ntcore_2017/.clang-format
deleted file mode 100644
index ed38227..0000000
--- a/third_party/ntcore_2017/.clang-format
+++ /dev/null
@@ -1,89 +0,0 @@
----
-Language: Cpp
-BasedOnStyle: Google
-AccessModifierOffset: -1
-AlignAfterOpenBracket: Align
-AlignConsecutiveAssignments: false
-AlignConsecutiveDeclarations: false
-AlignEscapedNewlinesLeft: true
-AlignOperands: true
-AlignTrailingComments: true
-AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
-AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: All
-AllowShortIfStatementsOnASingleLine: true
-AllowShortLoopsOnASingleLine: true
-AlwaysBreakAfterDefinitionReturnType: None
-AlwaysBreakAfterReturnType: None
-AlwaysBreakBeforeMultilineStrings: true
-AlwaysBreakTemplateDeclarations: true
-BinPackArguments: true
-BinPackParameters: true
-BraceWrapping:
- AfterClass: false
- AfterControlStatement: false
- AfterEnum: false
- AfterFunction: false
- AfterNamespace: false
- AfterObjCDeclaration: false
- AfterStruct: false
- AfterUnion: false
- BeforeCatch: false
- BeforeElse: false
- IndentBraces: false
-BreakBeforeBinaryOperators: None
-BreakBeforeBraces: Attach
-BreakBeforeTernaryOperators: true
-BreakConstructorInitializersBeforeComma: false
-ColumnLimit: 80
-CommentPragmas: '^ IWYU pragma:'
-ConstructorInitializerAllOnOneLineOrOnePerLine: true
-ConstructorInitializerIndentWidth: 4
-ContinuationIndentWidth: 4
-Cpp11BracedListStyle: true
-DerivePointerAlignment: false
-DisableFormat: false
-ExperimentalAutoDetectBinPacking: false
-ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
-IncludeCategories:
- - Regex: '^<.*\.h>'
- Priority: 1
- - Regex: '^<.*'
- Priority: 2
- - Regex: '.*'
- Priority: 3
-IndentCaseLabels: true
-IndentWidth: 2
-IndentWrappedFunctionNames: false
-KeepEmptyLinesAtTheStartOfBlocks: false
-MacroBlockBegin: ''
-MacroBlockEnd: ''
-MaxEmptyLinesToKeep: 1
-NamespaceIndentation: None
-ObjCBlockIndentWidth: 2
-ObjCSpaceAfterProperty: false
-ObjCSpaceBeforeProtocolList: false
-PenaltyBreakBeforeFirstCallParameter: 1
-PenaltyBreakComment: 300
-PenaltyBreakFirstLessLess: 120
-PenaltyBreakString: 1000
-PenaltyExcessCharacter: 1000000
-PenaltyReturnTypeOnItsOwnLine: 200
-PointerAlignment: Left
-ReflowComments: true
-SortIncludes: true
-SpaceAfterCStyleCast: false
-SpaceBeforeAssignmentOperators: true
-SpaceBeforeParens: ControlStatements
-SpaceInEmptyParentheses: false
-SpacesBeforeTrailingComments: 2
-SpacesInAngles: false
-SpacesInContainerLiterals: true
-SpacesInCStyleCastParentheses: false
-SpacesInParentheses: false
-SpacesInSquareBrackets: false
-Standard: Auto
-TabWidth: 8
-UseTab: Never
-...
diff --git a/third_party/ntcore_2017/.gitignore b/third_party/ntcore_2017/.gitignore
deleted file mode 100644
index fbf0a47..0000000
--- a/third_party/ntcore_2017/.gitignore
+++ /dev/null
@@ -1,223 +0,0 @@
-### C++ ###
-# Compiled Object files
-*.slo
-*.lo
-*.o
-*.obj
-
-# Precompiled Headers
-*.gch
-*.pch
-
-# Compiled Dynamic libraries
-*.so
-*.dylib
-*.dll
-
-# Compiled Static libraries
-*.lai
-*.la
-*.a
-*.lib
-
-# Executables
-*.exe
-*.out
-*.app
-
-.vs/
-*.def
-!ntcore.def
-!ntcore-jni.def
-*.opensdf
-*.vcxproj
-*.vcxproj.user
-*.sdf
-*.sublime-project
-*.sublime-workspace
-
-# Compiled Java files
-*.class
-
-# Build directories
-/.gradle
-/build*
-!build.gradle
-/native
-/arm
-/gmock/build
-
-
-# Created by https://www.gitignore.io/api/intellij,eclipse,netbeans,java,gradle,c++,cmake
-
-### Intellij ###
-# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
-# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
-
-# User-specific stuff:
-.idea/*
-
-## File-based project format:
-*.iws
-
-## Plugin-specific files:
-
-# IntelliJ
-/out/
-
-# mpeltonen/sbt-idea plugin
-.idea_modules/
-
-# JIRA plugin
-atlassian-ide-plugin.xml
-
-# Crashlytics plugin (for Android Studio and IntelliJ)
-com_crashlytics_export_strings.xml
-crashlytics.properties
-crashlytics-build.properties
-fabric.properties
-
-### Intellij Patch ###
-# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
-
-# *.iml
-# modules.xml
-
-
-### Eclipse ###
-
-.metadata
-bin/
-tmp/
-*.tmp
-*.bak
-*.swp
-*~.nib
-local.properties
-.settings/
-.loadpath
-.recommenders
-
-# Eclipse Core
-.project
-
-# External tool builders
-.externalToolBuilders/
-
-# Locally stored "Eclipse launch configurations"
-*.launch
-
-# PyDev specific (Python IDE for Eclipse)
-*.pydevproject
-
-# CDT-specific (C/C++ Development Tooling)
-.cproject
-
-# JDT-specific (Eclipse Java Development Tools)
-.classpath
-
-# Java annotation processor (APT)
-.factorypath
-
-# PDT-specific (PHP Development Tools)
-.buildpath
-
-# sbteclipse plugin
-.target
-
-# Tern plugin
-.tern-project
-
-# TeXlipse plugin
-.texlipse
-
-# STS (Spring Tool Suite)
-.springBeans
-
-# Code Recommenders
-.recommenders/
-
-
-### NetBeans ###
-nbproject/private/
-build/
-nbbuild/
-dist/
-nbdist/
-nbactions.xml
-.nb-gradle/
-
-
-### C++ ###
-# Compiled Object files
-*.slo
-*.lo
-*.o
-*.obj
-
-# Precompiled Headers
-*.gch
-*.pch
-
-# Compiled Dynamic libraries
-*.so
-*.dylib
-*.dll
-
-# Fortran module files
-*.mod
-
-# Compiled Static libraries
-*.lai
-*.la
-*.a
-*.lib
-
-# Executables
-*.exe
-*.out
-*.app
-
-
-### CMake ###
-CMakeCache.txt
-CMakeFiles
-CMakeScripts
-Makefile
-cmake_install.cmake
-install_manifest.txt
-
-
-### Java ###
-*.class
-
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
-
-# Package Files #
-*.jar
-*.war
-*.ear
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
-
-
-### Gradle ###
-.gradle
-build/
-
-# Ignore Gradle GUI config
-gradle-app.setting
-
-# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
-!gradle-wrapper.jar
-
-# Cache of project
-.gradletasknamecache
-
-# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
-# gradle/wrapper/gradle-wrapper.properties
-
-#VSCode
-.vscode/
diff --git a/third_party/ntcore_2017/.gitreview b/third_party/ntcore_2017/.gitreview
deleted file mode 100644
index 0aa481b..0000000
--- a/third_party/ntcore_2017/.gitreview
+++ /dev/null
@@ -1,5 +0,0 @@
-[gerrit]
-host=usfirst.collab.net
-port=29418
-project=ntcore
-defaultbranch=master
\ No newline at end of file
diff --git a/third_party/ntcore_2017/.travis-scripts/install.sh b/third_party/ntcore_2017/.travis-scripts/install.sh
deleted file mode 100755
index 75d95ce..0000000
--- a/third_party/ntcore_2017/.travis-scripts/install.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-if [[ $TRAVIS_OS_NAME != 'osx' ]]; then
- # Install custom requirements on Linux
- sudo add-apt-repository ppa:wpilib/toolchain -y
- sudo apt-get update -q
- sudo apt-get install frc-toolchain -y
-fi
diff --git a/third_party/ntcore_2017/.travis.yml b/third_party/ntcore_2017/.travis.yml
deleted file mode 100644
index 3cd1b41..0000000
--- a/third_party/ntcore_2017/.travis.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-language: java
-
-matrix:
- include:
- - os: linux
- dist: trusty
- sudo: required
- - os: osx
- osx_image: xcode8
- env: WPILIB_FLAGS=-PskipArm
-
-addons:
- apt:
- packages:
- - g++-multilib
- - lib32stdc++6
-
-before_install:
- - .travis-scripts/install.sh
-
-install:
- - ./gradlew assemble $WPILIB_FLAGS
-
-script:
- - ./gradlew build $WPILIB_FLAGS
-
-before_cache:
- - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
-cache:
- directories:
- - $HOME/.gradle/caches/
- - $HOME/.gradle/wrapper/
diff --git a/third_party/ntcore_2017/BUILD b/third_party/ntcore_2017/BUILD
deleted file mode 100644
index 82f3545..0000000
--- a/third_party/ntcore_2017/BUILD
+++ /dev/null
@@ -1,28 +0,0 @@
-licenses(['notice'])
-
-cc_library(
- name = 'ntcore',
- visibility = ['//visibility:public'],
- srcs = glob([
- 'src/**/*.cpp',
- 'src/**/*.h',
- 'wpiutil/src/**/*.cpp',
- ], exclude = [
- 'src/networktables/**',
- ]),
- copts = [
- '-Wno-switch-enum',
- '-Wno-cast-align',
- ],
- hdrs = glob([
- 'include/**/*.h',
- 'wpiutil/include/**/*.h',
- ]),
- includes = [
- 'include',
- 'wpiutil/include',
- ],
- linkopts = [
- '-lpthread',
- ],
-)
diff --git a/third_party/ntcore_2017/CMakeLists.txt b/third_party/ntcore_2017/CMakeLists.txt
deleted file mode 100644
index 7ccb6fb..0000000
--- a/third_party/ntcore_2017/CMakeLists.txt
+++ /dev/null
@@ -1,112 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-project(ntcore)
-
-if (MSVC)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DNOMINMAX /D_SCL_SECURE_NO_WARNINGS /D_WINSOCK_DEPRECATED_NO_WARNINGS")
-else()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++1y -Wformat=2 -Wall -Wextra -Werror -pedantic -Wno-unused-parameter")
-endif()
-
-# This must be a macro(), as inside a function string() can only
-# update variables in the function scope.
-macro(fix_default_compiler_settings_)
- if (MSVC)
- # For MSVC, CMake sets certain flags to defaults we want to override.
- # This replacement code is taken from sample in the CMake Wiki at
- # http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace.
- foreach (flag_var
- CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
- CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
- if (NOT BUILD_SHARED_LIBS AND NOT gtest_force_shared_crt)
- # When Google Test is built as a shared library, it should also use
- # shared runtime libraries. Otherwise, it may end up with multiple
- # copies of runtime library data in different modules, resulting in
- # hard-to-find crashes. When it is built as a static library, it is
- # preferable to use CRT as static libraries, as we don't have to rely
- # on CRT DLLs being available. CMake always defaults to using shared
- # CRT libraries, so we override that default here.
- string(REPLACE "/MD" "-MT" ${flag_var} "${${flag_var}}")
- endif()
- endforeach()
- endif()
-endmacro()
-fix_default_compiler_settings_()
-
-file(GLOB_RECURSE SRC_FILES src/*.cpp)
-include_directories(include src wpiutil/include)
-
-# Java bindings
-if (NOT WITHOUT_JAVA)
- find_package(Java)
- find_package(JNI)
- include(UseJava)
- set(CMAKE_JAVA_COMPILE_FLAGS "-Xlint:unchecked")
-
- include_directories(${JNI_INCLUDE_DIRS})
- list(APPEND SRC_FILES java/lib/NetworkTablesJNI.cpp)
-
- file(GLOB_RECURSE JAVA_SOURCES java/src/*.java)
- set(CMAKE_JNI_TARGET true)
- add_jar(ntcore_jar ${JAVA_SOURCES} OUTPUT_NAME ntcore)
-
- # Generate JNI headers
- add_custom_command(
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI.h"
- DEPENDS ntcore_jar java/src/edu/wpi/first/wpilibj/networktables/NetworkTablesJNI.java
- COMMAND "${Java_JAVAH_EXECUTABLE}"
- -jni
- -o "${CMAKE_CURRENT_BINARY_DIR}/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI.h"
- -classpath "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/ntcore_jar.dir/"
- edu.wpi.first.wpilibj.networktables.NetworkTablesJNI
- )
- include_directories("${CMAKE_CURRENT_BINARY_DIR}")
- set_source_files_properties(
- java/lib/NetworkTablesJNI.cpp
- OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI.h"
- )
-
- #add_subdirectory(java/test)
-endif()
-
-if (WIN32)
- if (NOT WITHOUT_JAVA)
- add_library(ntcore SHARED ${SRC_FILES} ntcore-jni.def)
- else()
- add_library(ntcore SHARED ${SRC_FILES} ntcore.def)
- endif()
-else()
- add_library(ntcore SHARED ${SRC_FILES})
-endif()
-set_target_properties(ntcore PROPERTIES VERSION 1.0.0 SOVERSION 1)
-target_link_libraries(ntcore wpiutil)
-if (WIN32)
- add_library(ntcore_static STATIC ${SRC_FILES})
- target_link_libraries(ntcore_static wpiutil)
- target_link_libraries(ntcore ws2_32)
- target_link_libraries(ntcore_static ws2_32)
-endif()
-INSTALL(TARGETS ntcore
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib COMPONENT lib)
-INSTALL(DIRECTORY include DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT headers)
-
-file(GLOB_RECURSE WPIUTIL_SRC_FILES wpiutil/src/*.cpp)
-add_library(wpiutil STATIC ${WPIUTIL_SRC_FILES})
-INSTALL(TARGETS wpiutil
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib COMPONENT lib)
-INSTALL(DIRECTORY wpiutil/include DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT headers)
-
-# We need thread support
-find_package(Threads REQUIRED)
-
-if (NOT WITHOUT_TESTS)
- enable_testing()
-
- add_subdirectory(gmock)
- include_directories("gmock/include")
- include_directories("gmock/gtest/include")
- add_subdirectory(test)
-endif()
diff --git a/third_party/ntcore_2017/CONTRIBUTING.md b/third_party/ntcore_2017/CONTRIBUTING.md
deleted file mode 100644
index aae5b31..0000000
--- a/third_party/ntcore_2017/CONTRIBUTING.md
+++ /dev/null
@@ -1,53 +0,0 @@
-# Contributing to ntcore
-
-So you want to contribute your changes back to ntcore. Great! We have a few contributing rules that will help you make sure your changes will be accepted into the project. Please remember to follow the rules written here, and behave with Gracious Professionalism.
-
-- [General Contribution Rules](#general-contribution-rules)
-- [What to Contribute](#what-to-contribute)
-- [Coding Guidelines](#coding-guidelines)
-- [Submitting Changes](#submitting-changes)
- - [Pull Request Format](#pull-request-format)
- - [Merge Process](#merge-process)
-- [Licensing](#licensing)
-
-## General Contribution Rules
-
-- Everything in the library must work for the 3000+ teams that will be using it.
-- We need to be able to maintain submitted changes, even if you are no longer working on the project.
-- Excluding bug fixes, changes in one language generally need to have corresponding changes in other languages.
- - Substantial changes often need to have corresponding LabVIEW changes. To do this, we will work with NI on these large changes.
- - Protocol changes must be carefully considered. Please open issues for protocol enhancements so we can discuss first.
-- Changes should have tests.
-- Code should be well documented.
- - This often involves ScreenSteps. To add content to ScreenSteps, we will work with you to get the appropriate articles written.
-
-## What to Contribute
-
-- Bug reports and fixes
- - We will generally accept bug fixes without too much question. If they are only implemented for one language, we will implement them for any other necessary languages. Bug reports are also welcome, please submit them to our GitHub issue tracker.
-- While we do welcome improvements to the API, there are a few important rules to consider:
- - Features must be added to both the C++ API and the Java API, with rare exceptions.
- - During competition season, we will not merge any new feature additions. We want to ensure that the API is stable during the season to help minimize issues for teams.
- - Ask about large changes before spending a bunch of time on them! You can create a new issue on our GitHub tracker for feature request/discussion and talk about it with us there.
- - Features that make it easier for teams with less experience to be more successful are more likely to be accepted.
- - Features in ntcore should be broadly applicable to all teams. Anything that is team specific should not be submitted.
-
-## Coding Guidelines
-
-ntcore uses Google style guides for both C++ and Java. Autoformatters are available for many popular editors at [https://github.com/google/styleguide]. An online version of the styleguide for [C++](https://google.github.io/styleguide/cppguide.html) and [Java](https://google.github.io/styleguide/javaguide.html) are also available. Additionally, offline copies of the style guide can be found in the style guide directory of the repository.
-
-While the library should be fully formatted according to the styles, additional elements of the style guide were not followed when the library was initially created. All new code should follow the guidelines. If you are looking for some easy ramp-up tasks, finding areas that don't follow the style guide and fixing them is very welcome.
-
-## Submitting Changes
-
-### Pull Request Format
-
-Changes should be submitted as a Pull Request against the master branch of ntcore. For most changes, we ask that you squash your changes down to a single commit. For particularly large changes, multiple commits are ok, but assume one commit unless asked otherwise. No change will be merged unless it is up to date with the current master. We will also not merge any changes with merge commits in them; please rebase off of master before submitting a pull request. We do this to make sure that the git history isn't too cluttered.
-
-### Merge Process
-
-When you first submit changes, Travis-CI will attempt to run `./gradlew check` on your change. If this fails, you will need to fix any issues that it sees. Once Travis passes, we will begin the review process in more earnest. One or more WPILib team members will review your change. This will be a back-and-forth process with the WPILib team and the greater community. Once we are satisfied that your change is ready, we will allow our Jenkins instance to test it. This will run the full gamut of checks, including integration tests on actual hardware. Once all tests have passed and the team is satisfied, we will merge your change into the WPILib repository.
-
-## Licensing
-
-By contributing to ntcore, you agree that your code will be distributed with ntcore, and licensed under the license for the ntcore project. You should not contribute code that you do not have permission to relicense in this manner. This includes code that is licensed under the GPL that you do not have permission to relicense, as ntcore is not released under a copyleft license. Our license is the 3-clause BSD license, which you can find [here](license.txt).
\ No newline at end of file
diff --git a/third_party/ntcore_2017/README.md b/third_party/ntcore_2017/README.md
deleted file mode 100644
index 5bc1388..0000000
--- a/third_party/ntcore_2017/README.md
+++ /dev/null
@@ -1,106 +0,0 @@
-# ntcore
-
-[](https://travis-ci.org/wpilibsuite/ntcore)
-[](https://ci.appveyor.com/project/frcjenkins/ntcore)
-
-
-ntcore is the reimplementation of the NetworkTables protocol for both Java and C++, communicating with the former by way of a JNI interface. ntcore implements v3 of the NetworkTables spec.
-
-## Build Requirements
-To build ntcore, a few requirements must be met:
-
-- Platform Native Toolchain - You must have a toolchain for your native platform installed if you wish to build ntcore for your machine. On Windows, this is Visual Studio. On Mac, this is Clang, and on Linux, this is GCC. Your toolchain must support the `-std=c++11` language flag.
-- Platform Native JDK - In order to compile ntcore your native platform, you must have the JDK for your platform installed, so that the correct JNI headers can be included.
-- ARM Toolchain - To crosscompile ntcore for the roboRIO, you must have the FRC ARM toolchain installed, which can be found [here](http://first.wpi.edu/FRC/roborio/toolchains/).
-- CMake (Optional) - If you with to build with CMake, you must install CMake. The build can also be done with Gradle, and the WPILib build server will build with Gradle.
-
-## Building
-Gradle is the main build system used by ntcore. All tasks are run with the `gradlew` wrapper, which is included in the root of the repository. All targets that can be accomplished by Gradle are referred to as tasks. The main task available is `build`. To run Gradle, cd into the build directory and run:
-
-```bash
-./gradlew build
-```
-
-To build just the Native or ARM version, you must access the approriate subproject and build just that version. For example:
-
-```bash
-./gradlew :arm:build # Builds just the arm version of ntcore
-./gradlew :native:build # Builds just the native version of ntcore
-```
-
-If you are building the native version on a 64 bit Linux computer, use a GCC installation which has multilib support enabled (it can compile both 32 and 64 bit programs). The package providing that support on most Linux distributions is called `gcc-multilib`.
-
-If you do not have the ARM toolchain installed on your computer, you will run into build issues. To disable the ARM platform entirely, run with the flag `-PskipArm`, and it will be entirely skipped.
-
-```bash
-./gradlew build -PskipArm # Builds native, disables the ARM project
-```
-
-The native version of ntcore will run tests on build. The ARM version will not, as the current platform likely does not allow running of an ARM binary.
-
-
-### Custom Cross Compilers
-By default, the ARM version of ntcore uses the FRC cross compiler, which has the prefix `arm-frc-linux-gnueabi-`. If you want to cross compile with a different ARM toolchain, you can specify the `-PcompilerPrefix=prefix-string` flag. For example, to compile with `arm-linux-gnueabi-gcc`, you would run:
-
-```bash
-./gradlew :arm:build -PcompilerPrefix=arm-linux-gnueabi-
-```
-
-Keeping the full prefix is important: if you do not specify this correctly, Gradle will likely fail with an error that looks like this:
-
-```Shell
-ntcore master* $ ./gradlew :arm:build -PcompilerPrefix=doesnotexist
-Defining custom 'check' task when using the standard Gradle lifecycle plugins has been deprecated and is scheduled to be removed in Gradle 3.0
-:arm:compileJava UP-TO-DATE
-:arm:processResources UP-TO-DATE
-:arm:classes UP-TO-DATE
-:arm:jniHeadersNetworkTables UP-TO-DATE
-:arm:compileNtcoreSharedLibraryNtcoreCpp FAILED
-
-FAILURE: Build failed with an exception.
-
-* What went wrong:
-Execution failed for task ':arm:compileNtcoreSharedLibraryNtcoreCpp'.
-> No tool chain is available to build for platform 'arm':
- - Tool chain 'gcc' (GNU GCC): Could not find C compiler 'gcc' in system path.
- - Tool chain 'macGcc' (Clang): Could not find C compiler 'clang' in system path.
-
-* Try:
-Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
-
-BUILD FAILED
-
-Total time: 2.441 secs
-```
-
-If you have the Toolchain installed somewhere not on the System PATH, you can use the `toolChainPath` property to specify where the bin location of the toolchain is installed to, for example:
-
-```bash
-./gradlew :arm:build -PtoolChainPath=some/path/to/my/toolchain/bin
-```
-
-## Testing
-By default, tests will be built for the x86 and x64 versions of ntcore, and will be run during any execution of the `build` or `publish` tasks. To skip building and running the tests, use the `-PwithoutTests` command line flag when running Gradle.
-
-## Publishing
-To use ntcore in downstream projects as a Maven-style dependency, use the `publish` command. This will publish four artifacts, where platform_name is your current platform (windows, mac, linux):
-
-- edu.wpi.first.wpilib.networktables.cpp:NetworkTables:3.0.0-SNAPSHOT:arm@zip
-- edu.wpi.first.wpilib.networktables.cpp:NetworkTables:3.0.0-SNAPSHOT:platform_name@zip
-- edu.wpi.first.wpilib.networktables.java:NetworkTables:3.0.0-SNAPSHOT:arm
-- edu.wpi.first.wpilib.networktables.java:NetworkTables:3.0.0-SNAPSHOT:platform_name
-
-These are published to ~/releases/maven/development. To publish to a different repo, specify the `-Prepo=repo_name` flag. Valid repos are:
-
-- development - The default repo.
-- beta - Publishes to ~/releases/maven/beta.
-- stable - Publishes to ~/releases/maven/stable.
-- release - Publishes to ~/releases/maven/release.
-
-Most downstream projects that run on the desktop do not depend on the `platform_name` classifier version of ntcore. Rather, they depend on a version with the `desktop` classifier. Normally, this is a version of ntcore built by the FRC Build server that includes binaries for the 3 major operating systems (Windows, Mac, Linux) and 2 major CPU architectures (x86, x86_64). However, if you are locally testing changes to ntcore, you may want to build a version with the `:desktop` classifier for use on your current platform. To do this, specify the `-PmakeDesktop` flag when publishing. For example:
-
-```bash
-./gradlew publish -PmakeDesktop
-```
-
-When you do a publish of ntcore locally, regardless of whether `-PmakeDesktop` is found, the locally built copy will override all references to networktables dependencies from the FRC Maven server. To undo this, you must delete `~/releases/maven/<repo>/edu/wpi/first/wpilib/networktables`.
diff --git a/third_party/ntcore_2017/TODO.md b/third_party/ntcore_2017/TODO.md
deleted file mode 100644
index 864c5af..0000000
--- a/third_party/ntcore_2017/TODO.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# ntcore TODO
-
-## Functionality
-
-* Initial connection flag
-
-## Unit Test Coverage
-
-* Message class
-* SequenceNumber class
-* NetworkCommunication class
-* Dispatcher class
-* Storage incoming processing
-* Keepalives
-* Notifiers
-* RPC
-* C++ API
-* C API
-* SavePersistent safe file handling (part of C++ API)
-* More LoadPersistent warning cases
-* Automatic persistent saves
diff --git a/third_party/ntcore_2017/appveyor.yml b/third_party/ntcore_2017/appveyor.yml
deleted file mode 100644
index f89348a..0000000
--- a/third_party/ntcore_2017/appveyor.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-version: "{branch} {build}"
-
-image:
-- Visual Studio 2015
-- Visual Studio 2013
-
-build:
- verbosity: detailed
-
-build_script:
- - gradlew.bat assemble --info -PskipArm
-
-test_script:
-- cmd: >-
- SET JAVA_HOME=C:\Program Files\Java\jdk1.8.0
-
- gradlew.bat check --info -PskipArm
-
- SET JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0
-
- gradlew.bat check --info -PskipArm
-
-cache:
- - C:\Users\appveyor\.gradle
-
-matrix:
- fast_finish: true
diff --git a/third_party/ntcore_2017/build.gradle b/third_party/ntcore_2017/build.gradle
deleted file mode 100644
index 065deae..0000000
--- a/third_party/ntcore_2017/build.gradle
+++ /dev/null
@@ -1,74 +0,0 @@
-import org.gradle.internal.os.OperatingSystem
-
-buildscript {
- repositories {
- maven {
- url "https://plugins.gradle.org/m2/"
- }
- }
- dependencies {
- classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.8'
- classpath 'gradle.plugin.edu.wpi.first.wpilib.versioning:wpilib-version-plugin:1.6'
- }
-}
-
-ext.buildArm = !project.hasProperty('skipArm')
-ext.includeJava = !project.hasProperty('skipJava')
-
-if (hasProperty('makeDesktop')) {
- println 'Making desktop classifier jar. NOTE: This desktop version should only be used for local testing.' +
- 'It will only support the current platform, and will override fetching the latest development version from' +
- ' the maven repo until you manually delete it!'
-}
-
-ext.getPlatformPath = { binary ->
- if (binary.targetPlatform.architecture.arm) {
- return 'Linux/arm'
- } else if (binary.targetPlatform.operatingSystem.linux) {
- if (binary.targetPlatform.architecture.amd64) {
- return 'Linux/amd64'
- } else {
- return 'Linux/' + binary.targetPlatform.architecture.name
- }
- } else if (binary.targetPlatform.operatingSystem.windows) {
- if (binary.targetPlatform.architecture.amd64) {
- return 'Windows/amd64'
- } else {
- return 'Windows/' + binary.targetPlatform.architecture.name
- }
- } else if (binary.targetPlatform.operatingSystem.macOsX) {
- if (binary.targetPlatform.architecture.amd64) {
- return 'Mac OS X/x86_64'
- } else {
- return 'Mac OS X/' + binary.targetPlatform.architecture.name
- }
- } else {
- return binary.targetPlatform.operatingSystem.name + '/' + binary.targetPlatform.architecture.name
- }
-}
-
-ext.setupDefines = { project, binaries ->
- binaries.all {
- if (project.hasProperty('debug')) {
- project.setupDebugDefines(cppCompiler, linker)
- } else {
- project.setupReleaseDefines(cppCompiler, linker)
- }
- }
-}
-
-apply from: "ntcore.gradle"
-apply from: "wpiutil.gradle"
-
-// Empty task for build so that ntcoreSourceZip and wpiutilSourceZip will be
-// built when running ./gradlew build
-task build
-
-build.dependsOn ntcoreSourceZip
-build.dependsOn wpiutilSourceZip
-
-apply from: 'publish.gradle'
-
-task wrapper(type: Wrapper) {
- gradleVersion = '3.3'
-}
diff --git a/third_party/ntcore_2017/doc/alloy-model.adoc b/third_party/ntcore_2017/doc/alloy-model.adoc
deleted file mode 100644
index 35ca7d8..0000000
--- a/third_party/ntcore_2017/doc/alloy-model.adoc
+++ /dev/null
@@ -1,198 +0,0 @@
-= Network Tables Alloy Model
-
-Alloy (http://alloy.mit.edu/alloy/) is a formal logic tool that can analyze
-first-order logic expressions. Under the proposed sequence number -based
-protocol, assuming that all nodes start from the same state, Alloy is unable to
-find a way where two nodes with the same sequence number have different state
-when activity ceases.
-
-The model used is included below. Although Alloy cannot test all cases, since
-such an exhaustive search is intractable, it provides a high level of
-confidence in the proposed protocol.
-
-----
---- Models a distributed, centralized hash table system called NetworkTables
---- System state is protected by sequence numbers; the server's value for a certain sequence number always wins
---- Paul Malmsten, 2012 pmalmsten@gmail.com
-
-open util/ordering[Time] as TO
-open util/natural as natural
-
-sig Time {}
-sig State {}
-
---- Define nodes and server
-sig Node {
- state: State -> Time,
- sequenceNumber: Natural -> Time
-}
-
---- Only one server
-one sig Server extends Node {
-}
-
---- Define possible events
-abstract sig Event {
- pre,post: Time,
- receiver: one Node
-}
-
-// For all events, event.post is the time directly following event.pre
-fact {
- all e:Event {
- e.post = e.pre.next
- }
-}
-
-// Represents that state has changed on a node
-sig StateChangeEvent extends Event {
-}
-
-// Represents that state has been transferred from one node to another
-sig StateTransferEvent extends Event {
- sender: one Node
-}
-
-fact {
- --- Every node must assume at most one state
- all t:Time, n:Node | #n.state.t = 1
-
- --- Every node must assume one sequence number
- all t:Time, n:Node | #n.sequenceNumber.t = 1
-
- --- Sequence numbers may only increment
- all t:Time - last, n:Node | let t' = t.next | natural/gte[n.sequenceNumber.t', n.sequenceNumber.t]
-}
-
-
-fact stateChangedImpliesAStateTransfer {
- all sce:StateChangeEvent {
- // A StateChange on a client causes a transfer to the Server if its sequence number is greater than the server's
- sce.receiver in Node - Server and natural/gt[sce.receiver.sequenceNumber.(sce.post), Server.sequenceNumber.(sce.post)]
- implies
- some ste:StateTransferEvent {
- ste.pre = sce.post and ste.sender = sce.receiver and ste.receiver = Server
- }
- }
-
- all sce:StateChangeEvent {
- // A StateChange on the server causes a transfer to all clients
- sce.receiver = Server implies
- all n:Node - Server {
- some ste:StateTransferEvent {
- ste.pre = sce.post and ste.sender = Server and ste.receiver = n
- }
- }
- }
-
- all sce:StateTransferEvent {
- // A StateTransfer to the server causes a transfer to all clients
- sce.receiver = Server implies
- all n:Node - Server {
- some ste:StateTransferEvent {
- ste.pre = sce.post and ste.sender = Server and ste.receiver = n
- }
- }
- }
-}
-
-fact stateTransferEventsMoveState {
- all ste:StateTransferEvent {
- ste.sender = Server and not ste.receiver = Server or ste.receiver = Server and not ste.sender = Server
-
- // Nodes can only post to the server if their sequence number is greater than the servers
- ste.receiver = Server implies natural/gt[ste.sender.sequenceNumber.(ste.pre), ste.receiver.sequenceNumber.(ste.pre)]
-
- // Server can only post to clients if its sequence number is greater than or equal to the client
- ste.sender = Server implies natural/gte[ste.sender.sequenceNumber.(ste.pre), ste.receiver.sequenceNumber.(ste.pre)]
-
- // Actual transfer
- (ste.receiver.state.(ste.post) = ste.sender.state.(ste.pre) and
- ste.receiver.sequenceNumber.(ste.post) = ste.sender.sequenceNumber.(ste.pre))
- }
-}
-
-
-fact noEventsPendingAtEnd {
- no e:Event {
- e.pre = last
- }
-}
-
-fact noDuplicateEvents {
- all e,e2:Event {
- // Two different events with the same receiver imply they occurred at different times
- e.receiver = e2.receiver and e != e2 implies e.pre != e2.pre
- }
-}
-
-fact noStateTransfersToSelf {
- all ste:StateTransferEvent {
- ste.sender != ste.receiver
- }
-}
-
-fact noDuplicateStateTransferEvents {
- all ste,ste2:StateTransferEvent {
- // Two state transfer events with the same nodes imply that they occurred at different times
- ste.sender = ste2.sender and ste.receiver = ste2.receiver and ste != ste2 implies ste.pre != ste2.pre
- }
-}
-
---- Trace (time invariant)
-fact trace {
- all t:Time - last | let t' = t.next {
- all n:Node {
- // A node in (pre.t).receiver means it is being pointed to by some event that will happen over the next time step
- n in (pre.t).receiver implies n.state.t' != n.state.t and n.sequenceNumber.t' != n.sequenceNumber.t // A node which receives some sort of event at time t causes it to change state
- else n.state.t' = n.state.t and n.sequenceNumber.t' = n.sequenceNumber.t // Otherwise, it does not change state
- }
- }
-}
-
---- Things we might like to be true, but are not always true
-
-pred atLeastOneEvent {
- #Event >= 1
-}
-
-pred allNodesStartAtSameStateAndSequenceNumber {
- all n,n2:Node {
- n.state.first = n2.state.first and n.sequenceNumber.first = n2.sequenceNumber.first
- }
-}
-
-pred noStateChangeEventsAtEnd {
- no e:StateChangeEvent {
- e.post = last
- }
-}
-
---- Demonstration (Alloy will try to satisfy this)
-
-pred show {
- atLeastOneEvent
-}
-run show
-
---- Assertions (Alloy will try to break these)
-
-assert allNodesConsistentAtEnd {
- allNodesStartAtSameStateAndSequenceNumber implies
- all n,n2:Node {
- // At the end of a sequence (last) all nodes with the same sequence number have the same state
- n.sequenceNumber.last = n2.sequenceNumber.last implies n.state.last = n2.state.last
- }
-}
-check allNodesConsistentAtEnd for 3 Event, 10 Node, 3 State, 5 Time, 5 Natural
-check allNodesConsistentAtEnd for 8 Event, 2 Node, 5 State, 9 Time, 9 Natural
-
-assert serverHasHighestSeqNumAtEnd {
- allNodesStartAtSameStateAndSequenceNumber implies
- all n:Node - Server{
- // At the end of a sequence (last) all nodes with the same sequence number have the same state
- natural/gte[Server.sequenceNumber.last, n.sequenceNumber.last]
- }
-}
-check serverHasHighestSeqNumAtEnd for 3 Event, 10 Node, 3 State, 5 Time, 5 Natural
-----
diff --git a/third_party/ntcore_2017/doc/networktables2.adoc b/third_party/ntcore_2017/doc/networktables2.adoc
deleted file mode 100644
index 579403d..0000000
--- a/third_party/ntcore_2017/doc/networktables2.adoc
+++ /dev/null
@@ -1,454 +0,0 @@
-= Network Tables Protocol Specification, Version 2.0
-Protocol Revision 2.0 (0x0200), 1/8/2013
-:toc:
-:toc-placement: preamble
-:sectanchors:
-
-This document defines a network protocol for a key-value store that may be read
-from and written to by multiple remote clients. A central server, most often
-running on a FIRST FRC robot controller, is responsible for providing
-information consistency and for facilitating communication between clients.
-
-Information consistency is guaranteed through the use of a sequence number
-associated with each key-value pair. An update of a key-value pair increments
-the associated sequence number, and this update information is shared with all
-participating clients. The central server only applies and redistributes
-updates which have a larger sequence number than its own, which guarantees that
-a client must have received a server's most recent state before it can replace
-it with a new value.
-
-This is a backwards-incompatible rework of the Network Tables network protocol
-originally introduced for the 2012 FIRST Robotics Competition. Note that this
-revision of the Network Tables protocol no longer includes the concept of
-sub-tables. We suggest that instead of representing sub-tables as first-class
-data types in the network protocol, it would be easy for an implementation to
-provide a similar API abstraction by adding prefixes to keys. For example, we
-suggest using Unix-style path strings to define sub-table hierarchies. The
-prefix ensures that sub-table namespaces do not collide in a global hashtable
-without requiring an explicit sub-table representation.
-
-In addition, the explicit concept of grouping multiple updates such that they
-are all visible at the same time to user code on a remote device was discarded.
-Instead, array types for all common elements are provided. By using an array
-data type, users may achieve the same level of atomicity for common operations
-(e.g. sending a cartesian coordinate pair) without requiring the complexity of
-arbitrarily grouped updates.
-
-This document conforms to <<rfc2119>> - Key words for use in RFCs to Indicate
-Requirement Levels.
-
-[[references]]
-== References
-
-[[rfc1982,RFC 1982]]
-* RFC 1982, Serial Number Arithmetic, http://tools.ietf.org/html/rfc1982
-
-[[rfc2119,RFC 2119]]
-* RFC 2119, Key words for use in RFCs to Indicate Requirement Levels,
-http://tools.ietf.org/html/rfc2119
-
-[[definitions]]
-== Definitions
-
-[[def-client]]
-Client:: An implementation of this protocol running in client configuration.
-Any number of Clients may exist for a given Network.
-
-[[def-entry]]
-Entry:: A data value identified by a string name.
-
-[[def-entry-id]]
-Entry ID:: An unsigned 2-byte ID by which the Server and Clients refer to an
-Entry across the network instead of using the full string key for the Entry.
-Entry IDs range from 0x0000 to 0xFFFE (0xFFFF is reserved for an Entry
-Assignment issued by a Client).
-
-[[def-server]]
-Server:: An implementation of this protocol running in server configuration.
-One and only one Server must exist for a given Network.
-
-[[def-network]]
-Network:: One or more Client nodes connected to a Server.
-
-[[def-user-code]]
-User Code:: User-supplied code which may interact with a Client or Server. User
-Code should be executed on the same computer as the Client or Server instance
-it interacts with.
-
-[[def-sequence-number]]
-Sequence Number:: An unsigned number which allows the Server to resolve update
-conflicts between Clients and/or the Server. Sequence numbers may overflow.
-Sequential arithmetic comparisons, which must be used with Sequence Numbers,
-are defined by RFC 1982.
-
-[[def-protocol-revision]]
-Protocol Revision:: A 16-bit unsigned integer which indicates the version of
-the network tables protocol that a client wishes to use. The protocol revision
-assigned to this version of the network tables specification is listed at the
-top of this document. This number is listed in dot-decimal notation as well as
-its equivalent hexadecimal value.
-
-== Transport Layer
-
-Conventional implementations of this protocol should use TCP for reliable
-communication; the Server should listen on TCP port 1735 for incoming
-connections.
-
-== Example Exchanges
-
-[[exchange-connect]]
-=== Client Connects to the Server
-
-Directly after client establishes a connection with the Server, the following
-procedure must be followed:
-
-. The Client sends a <<msg-client-hello>> message to the Server
-
-. The Server sends one <<msg-assign>> for every field it currently recognizes.
-
-. The Server sends a <<msg-server-hello-complete>> message.
-
-. For all Entries the Client recognizes that the Server did not identify with a
-Entry Assignment, the client follows the <<exchange-client-creates-entry>>
-protocol.
-
-In the event that the Server does not support the protocol revision that the
-Client has requested in a Client Hello message, the Server must instead issue a
-<<msg-protocol-unsupported>> message to the joining client and close the
-connection.
-
-[[exchange-client-creates-entry]]
-=== Client Creates an Entry
-
-When User Code on a Client assigns a value to an Entry that the Server has not
-yet issued a Entry Assignment for, the following procedure must be followed:
-
-. The Client sends an <<msg-assign>> with an Entry ID of 0xFFFF.
-
-. The Server issues an <<msg-assign>> to all Clients (including the sender) for
-the new field containing a real Entry ID and Sequence Number for the new field.
-
-In the event that User Code on the Client updates the value of the
-to-be-announced field again before the expected Entry Assignment is received,
-then the Client must save the new value and take no other action (the most
-recent value of the field should be issued when the Entry Assignment arrives,
-if it differs from the value contained in the received Entry Assignment).
-
-In the event that the Client receives a Entry Assignment from the Server for
-the Entry that it intended to issue an Entry Assignment for, before it issued
-its own Entry Assignment, the procedure may end early.
-
-In the event that the Server receives a duplicate Entry Assignment from a
-Client (likely due to the client having not yet received the Server's Entry
-Assignment), the Server should ignore the duplicate Entry Assignment.
-
-[[exchange-client-updates-entry]]
-=== Client Updates an Entry
-
-When User Code on a Client updates the value of an Entry, the Client must send
-an <<msg-update>> message to the Server. The Sequence Number included in the
-Entry Update message must be the most recently received Sequence Number for the
-Entry to be updated incremented by one.
-
-.Example:
-
-. Client receives Entry Assignment message for Entry "a" with integer value 1,
-Entry ID of 0, and Sequence Number 1.
-
-. User Code on Client updates value of Entry "a" to 16 (arbitrary).
-
-. Client sends Entry Update message to Server for Entry 0 with a Sequence
-Number of 2 and a value of 16.
-
-When the Server receives an Entry Update message, it first checks the Sequence
-Number in the message against the Server's value for the Sequence Number
-associated with the Entry to be updated. If the received Sequence Number is
-strictly greater than (aside: see definition of "greater than" under the
-definition of Sequence Number) the Server's Sequence Number for the Entry to be
-updated, the Server must apply the new value for the indicated Entry and repeat
-the Entry Update message to all other connected Clients.
-
-If the received Sequence Number is less than or equal (see definition of "less
-than or equal" in RFC 1982) to the Server's Sequence Number for the Entry to be
-updated, this implies that the Client which issued the Entry Update message has
-not yet received one or more Entry Update message(s) that the Server recently
-sent to it; therefore, the Server must ignore the received Entry Update
-message. In the event that comparison between two Sequence Numbers is undefined
-(see RFC 1982), then the Server must always win (it ignores the Entry Update
-message under consideration).
-
-[[update-rate]]
-NOTE: If User Code modifies the value of an Entry too quickly, 1) users may not
-see every value appear on remote machines, and 2) the consistency protection
-offered by the Entry's Sequence Number may be lost (by overflowing before
-remote devices hear recent values). It is recommended that implementations
-detect when user code updates an Entry more frequently than once every 5
-milliseconds and print a warning message to the user (and/or offer some other
-means of informing User Code of this condition).
-
-[[exchange-server-creates-entry]]
-=== Server Creates an Entry
-
-When User Code on the Server assigns a value to a Entry which does not exist,
-the Server must issue an <<msg-assign>> message to all connected clients.
-
-[[exchange-server-updates-entry]]
-=== Server Updates an Entry
-
-When User Code on the Server updates the value of an Entry, the Server must
-apply the new value to the Entry immediately, increment the associated Entry's
-Sequence Number, and issue a <<msg-update>> message containing the new value
-and Sequence Number of the associated Entry to all connected Clients.
-
-NOTE: See <<update-rate,Note>> under <<exchange-client-updates-entry>>.
-
-[[exchange-keep-alive]]
-=== Keep Alive
-
-To maintain a connection and prove a socket is still open, a Client or Server
-may issue <<msg-keep-alive>> messages. Clients and the Server should ignore
-incoming Keep Alive messages.
-
-The intent is that by writing a Keep Alive to a socket, a Client forces its
-network layer (TCP) to reevaluate the state of the network connection as it
-attempts to deliver the Keep Alive message. In the event that a connection is
-no longer usable, a Client's network layer should inform the Client that it is
-no longer usable within a few attempts to send a Keep Alive message.
-
-To provide timely connection status information, Clients should send a Keep
-Alive message to the Server after every 1 second period of connection
-inactivity (i.e. no information is being sent to the Server). Clients should
-not send Keep Alive messages more frequently than once every 100 milliseconds.
-
-Since the Server does not require as timely information about the status of a
-connection, it is not required to send Keep Alive messages during a period of
-inactivity.
-
-[[bandwidth]]
-== Bandwidth and Latency Considerations
-
-To reduce unnecessary bandwidth usage, implementations of this protocol should:
-
-* Send an Entry Update if and only if the value of an Entry is changed to a
-value that is different from its prior value.
-
-* Buffer messages and transmit them in groups, when possible, to reduce
-transport protocol overhead.
-
-* Only send the most recent value of an Entry. When User Code updates the value
-of an Entry more than once before the new value is transmitted, only the latest
-value of the Entry should be sent.
-
-It is important to note that these behaviors will increase the latency between
-when a Client or Server updates the value of an Entry and when all Clients
-reflect the new value. The exact behavior of this buffering is left to
-implementations to determine, although the chosen scheme should reflect the
-needs of User Code. Implementations may include a method by which User Code can
-specify the maximum tolerable send latency.
-
-[[entry-types]]
-== Entry Types
-
-Entry Type must assume one the following values:
-
-[cols="1,3"]
-|===
-|Numeric Value |Type
-
-|0x00
-|Boolean
-
-|0x01
-|Double
-
-|0x02
-|String
-
-|0x10
-|Boolean Array
-
-|0x11
-|Double Array
-
-|0x12
-|String Array
-|===
-
-[[entry-values]]
-== Entry Values
-
-Entry Value must assume the following structure as indicated by Entry Type:
-
-[cols="1,3"]
-|===
-|Entry Type |Entry Value Format
-
-|[[entry-value-boolean]]Boolean
-|1 byte, unsigned; True = 0x01, False = 0x00
-
-|[[entry-value-double]]Double
-|8 bytes, IEEE 754 floating-point "double format" bit layout; (big endian)
-
-|[[entry-value-string]]String
-|2 byte, unsigned length prefix (big endian) of the number of raw bytes to
-follow, followed by the string encoded in UTF-8
-
-|[[entry-value-boolean-array]]Boolean Array
-|1 byte, unsigned, number of elements within the array to follow
-
-N bytes - The raw bytes representing each Boolean element contained within the
-array, beginning with the item at index 0 within the array.
-
-|[[entry-value-double-array]]Double Array
-|1 byte, unsigned, number of elements within the array to follow
-
-N bytes - The raw bytes representing each Double element contained within the
-array, beginning with the item at index 0 within the array.
-
-|[[entry-value-string-array]]String Array
-|1 byte, unsigned, number of elements within the array to follow
-
-N bytes - The raw bytes representing each String element contained within the
-array, beginning with the item at index 0 within the array.
-|===
-
-== Message Structures
-
-All messages are of the following format:
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|Message Type
-|1 byte, unsigned
-
-|Message Data
-|N bytes (length determined by Message Type)
-|===
-
-[[msg-keep-alive]]
-=== Keep Alive
-
-Indicates that the remote party is checking the status of a network connection.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x00 - Keep Alive
-|1 byte, unsigned; Message Type
-|===
-
-[[msg-client-hello]]
-=== Client Hello
-
-A Client issues a Client Hello message when first establishing a connection.
-The Client Protocol Revision field specifies the Network Table protocol
-revision that the Client would like to use.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x01 - Client Hello
-|1 byte, unsigned; Message Type
-
-|Client Protocol Revision
-|2 bytes, Unsigned 16-bit integer (big-endian).
-
-See <<def-protocol-revision,Protocol Revision>>
-|===
-
-[[msg-protocol-unsupported]]
-=== Protocol Version Unsupported
-
-A Server issues a Protocol Version Unsupported message to a Client to inform it
-that the requested protocol revision is not supported. It also includes the
-most recent protocol revision which it supports, such that a Client may
-reconnect under a prior protocol revision if able.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x02 - Protocol Version Unsupported
-|1 byte, unsigned; Message Type
-
-|Server Supported Protocol Revision
-|2 bytes, Unsigned 16-bit integer (big-endian).
-
-See <<def-protocol-revision,Protocol Revision>>
-|===
-
-[[msg-server-hello-complete]]
-=== Server Hello Complete
-
-A Server issues a Server Hello Complete message when it has finished informing
-a newly-connected client of all of the fields it currently recognizes.
-Following the receipt of this message, a Client should inform the Server of
-any/all additional fields that it recognizes that the Server did not announce.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x03 - Server Hello Complete
-|1 byte, unsigned; Message Type
-|===
-
-[[msg-assign]]
-=== Entry Assignment
-
-A Entry Assignment message informs the remote party of a new Entry. An Entry
-Assignment's value field must be the most recent value of the field being
-assigned at the time that the Entry Assignment is sent.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x10 - Entry Assignment
-|1 byte, unsigned; Message Type
-
-|Entry Name
-|<<entry-value-string,String>>
-
-|Entry Type
-|1 byte, unsigned; see <<entry-types,Entry Types>>
-
-|Entry ID
-|2 bytes, unsigned
-
-|Entry Sequence Number
-|2 bytes, unsigned
-
-|Entry Value
-|N bytes, length depends on Entry Type
-|===
-
-If the Entry ID is 0xFFFF, then this assignment represents a request from a
-Client to the Server. In this event, the Entry ID field and the Entry Sequence
-Number field must not be stored or relied upon as they otherwise would be.
-
-[[msg-update]]
-=== Entry Update
-
-An Entry Update message informs a remote party of a new value for an Entry.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x11 - Entry Update
-|1 byte, unsigned; Message Type
-
-|Entry ID
-|2 bytes, unsigned
-
-|Entry Sequence Number
-|2 bytes, unsigned
-
-|Entry Value
-|N bytes, length dependent on value type
-|===
diff --git a/third_party/ntcore_2017/doc/networktables3.adoc b/third_party/ntcore_2017/doc/networktables3.adoc
deleted file mode 100644
index a4cc506..0000000
--- a/third_party/ntcore_2017/doc/networktables3.adoc
+++ /dev/null
@@ -1,838 +0,0 @@
-= Network Tables Protocol Specification, Version 3.0
-Protocol Revision 3.0 (0x0300), 6/12/2015
-:toc:
-:toc-placement: preamble
-:sectanchors:
-
-This document defines a network protocol for a key-value store that may be read
-from and written to by multiple remote clients. A central server, most often
-running on a FIRST FRC robot controller, is responsible for providing
-information consistency and for facilitating communication between clients.
-
-Information consistency is guaranteed through the use of a sequence number
-associated with each key-value pair. An update of a key-value pair increments
-the associated sequence number, and this update information is shared with all
-participating clients. The central server only applies and redistributes
-updates which have a larger sequence number than its own, which guarantees that
-a client must have received a server's most recent state before it can replace
-it with a new value.
-
-This is a backwards-compatible update of <<networktables2,version 2.0>> of the
-Network Tables network protocol. The protocol is designed such that 3.0 clients
-and servers can interoperate with 2.0 clients and servers with the only loss of
-functionality being the extended features introduced in 3.0.
-
-This document conforms to <<rfc2119>> - Key words for use in RFCs to Indicate
-Requirement Levels.
-
-== Summary of Changes from 2.0 to 3.0
-
-3 way connection handshake:: When a Client establishes a connection, after
-receiving the <<msg-server-hello-complete>> message and sending its local
-entries, it finishes with a <<msg-client-hello-complete>> message to the
-server. This enables the Server to be aware of when the Client is fully
-synchronized.
-
-String length encoding:: String length is now encoded as unsigned <<leb128>>
-rather than as a 2-byte unsigned integer. This both allows string lengths
-longer than 64K and is more space efficient for the common case of short
-strings (<128 byte strings only require a single byte for length).
-
-Entry deletion:: Entries may now be deleted by any member of the Network using
-the <<msg-delete>> and <<msg-clear-all>> messages. Note that in a Network
-consisting of mixed 2.0 and 3.0 Clients, deletion may be ineffective because
-the deletion message will not be propagated to the 2.0 Clients.
-
-// TODO: needs more description in the text of how these messages are
-// propagated
-
-Remote procedure call:: The Server may create specially-typed entries that
-inform Clients of remotely callable functions on the Server. Clients can then
-execute these functions via the Network Tables protocol. See <<rpc-operation>>.
-
-Raw data type:: An arbitrary data type has been added. While string could be
-used to encode raw data, the reason for a different data type is so that
-dashboards can choose not to display the raw data (or display it in a different
-format).
-
-Client and server self-identification:: Clients self-identify with a
-user-defined string name when connecting to the Server (this is part of the new
-<<msg-client-hello-complete>> message). This provides a more reliable method
-than simply the remote IP address for determining on the Server side whether or
-not a particular Client is connected. While Clients are less likely to care
-what Server they are connected to, for completeness a similar Server
-self-identification string has been added to the Server Hello Complete message.
-Note that Server connection information is not provided from the Server to
-Clients (at least in a way built into the protocol), so it is not possible for
-a Client to determine what other Clients are connected to the Server.
-
-Server reboot detection:: The Server keeps an internal list of all Client
-identity strings that have ever connected to it (this list is always empty at
-Server start). During the initial connection process, the Server sends the
-Client a flag (as part of the new <<msg-server-hello>> message) that indicates
-whether or not the Client was already on this list. Clients use this flag to
-determine whether the Server has rebooted since the previous connection.
-
-Entry flags:: Each Entry now has an 8-bit flags value associated with it (see
-<<entry-flags>>). The initial value of the flags are provided as part of the
-<<msg-assign>> message. The value of the flags may be updated by any member of
-the Network via use of the <<msg-flags-update>> message.
-
-Entry persistence:: The Server is required to provide a feature to
-automatically save entries (including their last known values) across Server
-restarts. By default, no values are automatically saved in this manner, but
-any member of the Network may set the “Persistent” Entry Flag on an Entry to
-indicate to the server that the Entry must be persisted by the Server. The
-Server must periodically save such flagged Entries to a file; on Server start,
-the Server reads the file to create the initial set of Server Entries.
-
-More robust Entry Update message encoding:: The entry type has been added to
-the <<msg-update>> message. This is used only to specify the length of value
-encoded in the Entry Update message, and has no effect on the Client or Server
-handling of Entry Updates. Clients and Servers must ignore Entry Update
-messages with mismatching type to their currently stored value. This increases
-robustness of Entry Updates in the presence of Entry Assignments with varying
-type (which should be uncommon, but this fixes a weakness in the 2.0 protocol).
-
-////
-TODO
-
-Synchronization on reconnect:: The approach to how Clients should handle
-conflicting values when reconnecting to a Server has been clarified.
-
-////
-
-[[references]]
-== References
-
-[[networktables2]]
-* <<networktables2.adoc#,Network Tables Protocol Specification, Protocol
-Revision 2.0 (0x0200)>>, dated 1/8/2013.
-
-[[leb128,LEB128]]
-* LEB128 definition in DWARF Specification 3.0
-(http://dwarfstd.org/doc/Dwarf3.pdf, section 7.6 and Appendix C, also explained
-in http://en.wikipedia.org/wiki/LEB128)
-
-[[rfc1982,RFC1982]]
-* RFC 1982, Serial Number Arithmetic, http://tools.ietf.org/html/rfc1982
-
-[[rfc2119,RFC2119]]
-* RFC 2119, Key words for use in RFCs to Indicate Requirement Levels,
-http://tools.ietf.org/html/rfc2119
-
-[[definitions]]
-== Definitions
-
-[[def-client]]
-Client:: An implementation of this protocol running in client configuration.
-Any number of Clients may exist for a given Network.
-
-[[def-entry]]
-Entry:: A data value identified by a string name.
-
-[[def-entry-id]]
-Entry ID:: An unsigned 2-byte ID by which the Server and Clients refer to an
-Entry across the network instead of using the full string key for the Entry.
-Entry IDs range from 0x0000 to 0xFFFE (0xFFFF is reserved for an Entry
-Assignment issued by a Client).
-
-[[def-server]]
-Server:: An implementation of this protocol running in server configuration.
-One and only one Server must exist for a given Network.
-
-[[def-network]]
-Network:: One or more Client nodes connected to a Server.
-
-[[def-user-code]]
-User Code:: User-supplied code which may interact with a Client or Server. User
-Code should be executed on the same computer as the Client or Server instance
-it interacts with.
-
-[[def-sequence-number]]
-Sequence Number:: An unsigned number which allows the Server to resolve update
-conflicts between Clients and/or the Server. Sequence numbers may overflow.
-Sequential arithmetic comparisons, which must be used with Sequence Numbers,
-are defined by <<rfc1982>>.
-
-[[def-protocol-revision]]
-Protocol Revision:: A 16-bit unsigned integer which indicates the version of
-the network tables protocol that a client wishes to use. The protocol revision
-assigned to this version of the network tables specification is listed at the
-top of this document. This number is listed in dot-decimal notation as well as
-its equivalent hexadecimal value.
-
-== Transport Layer
-
-Conventional implementations of this protocol should use TCP for reliable
-communication; the Server should listen on TCP port 1735 for incoming
-connections.
-
-== Example Exchanges
-
-[[exchange-connect]]
-=== Client Connects to the Server
-
-Directly after client establishes a connection with the Server, the following
-procedure must be followed:
-
-. The Client sends a <<msg-client-hello>> message to the Server
-
-. The Server sends a <<msg-server-hello>> message.
-
-. The Server sends one <<msg-assign>> for every field it currently recognizes.
-
-. The Server sends a <<msg-server-hello-complete>> message.
-
-. For all Entries the Client recognizes that the Server did not identify with a
-Entry Assignment, the client follows the <<exchange-client-creates-entry>>
-protocol.
-
-. The Client sends a <<msg-client-hello-complete>> message.
-
-In the event that the Server does not support the protocol revision that the
-Client has requested in a Client Hello message, the Server must instead issue a
-<<msg-protocol-unsupported>> message to the joining client and close the
-connection.
-
-[[exchange-client-creates-entry]]
-=== Client Creates an Entry
-
-When User Code on a Client assigns a value to an Entry that the Server has not
-yet issued a Entry Assignment for, the following procedure must be followed:
-
-. The Client sends an <<msg-assign>> with an Entry ID of 0xFFFF.
-
-. The Server issues an <<msg-assign>> to all Clients (including the sender) for
-the new field containing a real Entry ID and Sequence Number for the new field.
-
-In the event that User Code on the Client updates the value of the
-to-be-announced field again before the expected Entry Assignment is received,
-then the Client must save the new value and take no other action (the most
-recent value of the field should be issued when the Entry Assignment arrives,
-if it differs from the value contained in the received Entry Assignment).
-
-In the event that the Client receives a Entry Assignment from the Server for
-the Entry that it intended to issue an Entry Assignment for, before it issued
-its own Entry Assignment, the procedure may end early.
-
-In the event that the Server receives a duplicate Entry Assignment from a
-Client (likely due to the client having not yet received the Server's Entry
-Assignment), the Server should ignore the duplicate Entry Assignment.
-
-[[exchange-client-updates-entry]]
-=== Client Updates an Entry
-
-When User Code on a Client updates the value of an Entry, the Client must send
-an <<msg-update>> message to the Server. The Sequence Number included in the
-Entry Update message must be the most recently received Sequence Number for the
-Entry to be updated incremented by one.
-
-.Example:
-
-. Client receives Entry Assignment message for Entry "a" with integer value 1,
-Entry ID of 0, and Sequence Number 1.
-
-. User Code on Client updates value of Entry "a" to 16 (arbitrary).
-
-. Client sends Entry Update message to Server for Entry 0 with a Sequence
-Number of 2 and a value of 16.
-
-When the Server receives an Entry Update message, it first checks the Sequence
-Number in the message against the Server's value for the Sequence Number
-associated with the Entry to be updated. If the received Sequence Number is
-strictly greater than (aside: see definition of "greater than" under the
-definition of Sequence Number) the Server's Sequence Number for the Entry to be
-updated, the Server must apply the new value for the indicated Entry and repeat
-the Entry Update message to all other connected Clients.
-
-If the received Sequence Number is less than or equal (see definition of "less
-than or equal" in RFC 1982) to the Server's Sequence Number for the Entry to be
-updated, this implies that the Client which issued the Entry Update message has
-not yet received one or more Entry Update message(s) that the Server recently
-sent to it; therefore, the Server must ignore the received Entry Update
-message. In the event that comparison between two Sequence Numbers is undefined
-(see RFC 1982), then the Server must always win (it ignores the Entry Update
-message under consideration).
-
-[[update-rate]]
-NOTE: If User Code modifies the value of an Entry too quickly, 1) users may not
-see every value appear on remote machines, and 2) the consistency protection
-offered by the Entry's Sequence Number may be lost (by overflowing before
-remote devices hear recent values). It is recommended that implementations
-detect when user code updates an Entry more frequently than once every 5
-milliseconds and print a warning message to the user (and/or offer some other
-means of informing User Code of this condition).
-
-[[exchange-client-updates-flags]]
-=== Client Updates an Entry's Flags
-
-When User Code on a Client updates an Entry's flags, the Client must apply the
-new flags to the Entry immediately, and send an <<msg-flags-update>> message to
-the Server.
-
-When the Server receives an Entry Flags Update message, it must apply the new
-flags to the indicated Entry and repeat the Entry Flags Update message to all
-other connected Clients.
-
-[[exchange-client-deletes-entry]]
-=== Client Deletes an Entry
-
-When User Code on a Client deletes an Entry, the Client must immediately delete
-the Entry, and send an <<msg-delete>> message to the Server.
-
-When the Server receives an Entry Delete message, it must delete the indicated
-Entry and repeat the Entry Delete message to all other connected Clients.
-
-[[exchange-server-creates-entry]]
-=== Server Creates an Entry
-
-When User Code on the Server assigns a value to a Entry which does not exist,
-the Server must issue an <<msg-assign>> message to all connected clients.
-
-[[exchange-server-updates-entry]]
-=== Server Updates an Entry
-
-When User Code on the Server updates the value of an Entry, the Server must
-apply the new value to the Entry immediately, increment the associated Entry's
-Sequence Number, and issue a <<msg-update>> message containing the new value
-and Sequence Number of the associated Entry to all connected Clients.
-
-NOTE: See <<update-rate,Note>> under <<exchange-client-updates-entry>>.
-
-[[exchange-server-updates-flags]]
-=== Server Updates an Entry's Flags
-
-When User Code on the Server updates an Entry's flags, the Server must apply
-the new flags to the Entry immediately, and issue a <<msg-flags-update>>
-message containing the new flags value to all connected Clients.
-
-[[exchange-server-deletes-entry]]
-=== Server Deletes an Entry
-
-When User Code on the Server deletes an Entry, the Server must immediately
-delete the Entry, and issue a <<msg-delete>> message to all connected Clients.
-
-[[exchange-keep-alive]]
-=== Keep Alive
-
-To maintain a connection and prove a socket is still open, a Client or Server
-may issue <<msg-keep-alive>> messages. Clients and the Server should ignore
-incoming Keep Alive messages.
-
-The intent is that by writing a Keep Alive to a socket, a Client forces its
-network layer (TCP) to reevaluate the state of the network connection as it
-attempts to deliver the Keep Alive message. In the event that a connection is
-no longer usable, a Client's network layer should inform the Client that it is
-no longer usable within a few attempts to send a Keep Alive message.
-
-To provide timely connection status information, Clients should send a Keep
-Alive message to the Server after every 1 second period of connection
-inactivity (i.e. no information is being sent to the Server). Clients should
-not send Keep Alive messages more frequently than once every 100 milliseconds.
-
-Since the Server does not require as timely information about the status of a
-connection, it is not required to send Keep Alive messages during a period of
-inactivity.
-
-[[bandwidth]]
-== Bandwidth and Latency Considerations
-
-To reduce unnecessary bandwidth usage, implementations of this protocol should:
-
-* Send an Entry Update if and only if the value of an Entry is changed to a
-value that is different from its prior value.
-
-* Buffer messages and transmit them in groups, when possible, to reduce
-transport protocol overhead.
-
-* Only send the most recent value of an Entry. When User Code updates the value
-of an Entry more than once before the new value is transmitted, only the latest
-value of the Entry should be sent.
-
-It is important to note that these behaviors will increase the latency between
-when a Client or Server updates the value of an Entry and when all Clients
-reflect the new value. The exact behavior of this buffering is left to
-implementations to determine, although the chosen scheme should reflect the
-needs of User Code. Implementations may include a method by which User Code can
-specify the maximum tolerable send latency.
-
-[[entry-types]]
-== Entry Types
-
-Entry Type must assume one the following values:
-
-[cols="1,3"]
-|===
-|Numeric Value |Type
-
-|0x00
-|Boolean
-
-|0x01
-|Double
-
-|0x02
-|String
-
-|0x03
-|Raw Data
-
-|0x10
-|Boolean Array
-
-|0x11
-|Double Array
-
-|0x12
-|String Array
-
-|0x20
-|Remote Procedure Call Definition
-|===
-
-[[entry-values]]
-== Entry Values
-
-Entry Value must assume the following structure as indicated by Entry Type:
-
-[cols="1,3"]
-|===
-|Entry Type |Entry Value Format
-
-|[[entry-value-boolean]]Boolean
-|1 byte, unsigned; True = 0x01, False = 0x00
-
-|[[entry-value-double]]Double
-|8 bytes, IEEE 754 floating-point "double format" bit layout; (big endian)
-
-|[[entry-value-string]]String
-|N bytes, unsigned <<leb128>> encoded length of the number of raw bytes to
-follow, followed by the string encoded in UTF-8
-
-|[[entry-value-raw]]Raw Data
-|N bytes, unsigned LEB128 encoded length of the number of raw bytes to follow,
-followed by the raw bytes.
-
-While the raw data definition is unspecified, it's recommended that users use
-the first byte of the raw data to "tag" the type of data actually being stored.
-
-|[[entry-value-boolean-array]]Boolean Array
-|1 byte, unsigned, number of elements within the array to follow
-
-N bytes - The raw bytes representing each Boolean element contained within the
-array, beginning with the item at index 0 within the array.
-
-|[[entry-value-double-array]]Double Array
-|1 byte, unsigned, number of elements within the array to follow
-
-N bytes - The raw bytes representing each Double element contained within the
-array, beginning with the item at index 0 within the array.
-
-|[[entry-value-string-array]]String Array
-|1 byte, unsigned, number of elements within the array to follow
-
-N bytes - The raw bytes representing each String element contained within the
-array, beginning with the item at index 0 within the array.
-
-|[[entry-value-rpc]]Remote Procedure Call Definition
-|N bytes, unsigned LEB128 encoded length of the number of raw bytes to follow.
-
-N bytes - data as defined in Remote Procedure Call Definition Data
-|===
-
-[[entry-flags]]
-== Entry Flags
-
-Entry Flags are as follows:
-
-[cols="1,3"]
-|===
-|Bit Mask |Bit Value Meaning
-
-|[[entry-flag-persistent]]0x01 (least significant bit) - Persistent
-
-|0x00: Entry is not persistent. The entry and its value will not be retained
-across a server restart.
-
-0x01: Entry is persistent. Updates to the value are automatically saved and
-the entry will be automatically created and the last known value restored when
-the server starts.
-
-|0xFE
-|Reserved
-|===
-
-== Message Structures
-
-All messages are of the following format:
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|Message Type
-|1 byte, unsigned
-
-|Message Data
-|N bytes (length determined by Message Type)
-|===
-
-[[msg-keep-alive]]
-=== Keep Alive
-
-Indicates that the remote party is checking the status of a network connection.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x00 - Keep Alive
-|1 byte, unsigned; Message Type
-|===
-
-[[msg-client-hello]]
-=== Client Hello
-
-A Client issues a Client Hello message when first establishing a connection.
-The Client Protocol Revision field specifies the Network Table protocol
-revision that the Client would like to use.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x01 - Client Hello
-|1 byte, unsigned; Message Type
-
-|Client Protocol Revision
-|2 bytes, Unsigned 16-bit integer (big-endian). See
-<<def-protocol-revision,Protocol Revision>>.
-
-|Client identity (name)
-|<<entry-value-string,String>>
-|===
-
-[[msg-protocol-unsupported]]
-=== Protocol Version Unsupported
-
-A Server issues a Protocol Version Unsupported message to a Client to inform it
-that the requested protocol revision is not supported. It also includes the
-most recent protocol revision which it supports, such that a Client may
-reconnect under a prior protocol revision if able.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x02 - Protocol Version Unsupported
-|1 byte, unsigned; Message Type
-
-|Server Supported Protocol Revision
-|2 bytes, Unsigned 16-bit integer (big-endian). See
-<<def-protocol-revision,Protocol Revision>>.
-|===
-
-[[msg-server-hello-complete]]
-=== Server Hello Complete
-
-A Server issues a Server Hello Complete message when it has finished informing
-a newly-connected client of all of the fields it currently recognizes.
-Following the receipt of this message, a Client should inform the Server of
-any/all additional fields that it recognizes that the Server did not announce.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x03 - Server Hello Complete
-|1 byte, unsigned; Message Type
-|===
-
-[[msg-server-hello]]
-=== Server Hello
-
-A Server issues a Server Hello message in response to a Client Hello message,
-immediately prior to informing a newly-connected client of all of the fields it
-currently recognizes.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x04 - Server Hello
-|1 byte, unsigned; Message Type
-
-|Flags
-a|1 byte, unsigned.
-
-Least Significant Bit (bit 0): reconnect flag
-
-* 0 if this is the first time (since server start) the server has seen the
-client
-
-* 1 if the server has previously seen (since server start) the client (as
-identified in the <<msg-client-hello,Client Hello>> message)
-
-Bits 1-7: Reserved, set to 0.
-
-|Server identity (name)
-|<<entry-value-string,String>>
-|===
-
-[[msg-client-hello-complete]]
-=== Client Hello Complete
-
-A Client issues a Client Hello Complete message when it has finished informing
-the Server of any/all of the additional fields it recognizes that the Server
-did not announce.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x05 - Client Hello Complete
-|1 byte, unsigned; Message Type
-|===
-
-[[msg-assign]]
-=== Entry Assignment
-
-A Entry Assignment message informs the remote party of a new Entry. An Entry
-Assignment's value field must be the most recent value of the field being
-assigned at the time that the Entry Assignment is sent.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x10 - Entry Assignment
-|1 byte, unsigned; Message Type
-
-|Entry Name
-|<<entry-value-string,String>>
-
-|Entry Type
-|1 byte, unsigned; see <<entry-types,Entry Types>>
-
-|Entry ID
-|2 bytes, unsigned
-
-|Entry Sequence Number
-|2 bytes, unsigned
-
-|Entry Flags
-|1 byte, unsigned; see <<entry-flags,Entry Flags>>
-
-|Entry Value
-|N bytes, length depends on Entry Type
-|===
-
-If the Entry ID is 0xFFFF, then this assignment represents a request from a
-Client to the Server. In this event, the Entry ID field and the Entry Sequence
-Number field must not be stored or relied upon as they otherwise would be.
-
-[[msg-update]]
-=== Entry Update
-
-An Entry Update message informs a remote party of a new value for an Entry.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x11 - Entry Update
-|1 byte, unsigned; Message Type
-
-|Entry ID
-|2 bytes, unsigned
-
-|Entry Sequence Number
-|2 bytes, unsigned
-
-|Entry Type
-|1 byte, unsigned; see <<entry-types,Entry Types>>.
-
-Note this type is only used to determine the length of the entry value, and
-does NOT change the stored entry type if it is different (due to an intervening
-Entry Assignment); Clients and Servers must ignore Entry Update messages with
-mismatching entry type.
-
-|Entry Value
-|N bytes, length dependent on value type
-|===
-
-[[msg-flags-update]]
-=== Entry Flags Update
-
-An Entry Flags Update message informs a remote party of new flags for an Entry.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x12 - Entry Flags Update
-|1 byte, unsigned; Message Type
-
-|Entry ID
-|2 bytes, unsigned
-
-|Entry Flags
-|1 byte, unsigned; see <<entry-flags,Entry Flags>>
-|===
-
-Entries may be globally deleted using the following messages. These messages
-must be rebroadcast by the server in the same fashion as the Entry Update
-message. Clients and servers must remove the requested entry/entries from
-their local tables. Update messages received after the Entry Delete message
-for the deleted Entry ID must be ignored by Clients and Servers until a new
-Assignment message for that Entry ID is issued.
-
-[[msg-delete]]
-=== Entry Delete
-
-Deletes a single entry or procedure.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x13 - Entry Delete
-|1 byte, unsigned; message type
-
-|Entry ID
-|2 bytes, unsigned
-|===
-
-[[msg-clear-all]]
-=== Clear All Entries
-
-Deletes all entries. The magic value is required to be exactly this value
-(this is to avoid accidental misinterpretation of the message).
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x14 - Clear All Entries
-|1 byte, unsigned; message type
-
-|Magic Value (0xD06CB27A)
-|4 bytes; exact value required (big endian)
-|===
-
-[[msg-rpc-execute]]
-=== Remote Procedure Call (RPC) Execute
-
-Executes a remote procedure. Intended for client to server use only.
-
-The client shall provide a value for every RPC parameter specified in the
-corresponding RPC entry definition.
-
-The server shall ignore any Execute RPC message whose decoding does not match
-the parameters defined in the corresponding RPC entry definition.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x20 - Execute RPC
-|1 byte, unsigned; message type
-
-|RPC Definition Entry ID
-|2 bytes, unsigned
-
-|Unique ID
-|2 bytes, unsigned; incremented value for matching return values to call.
-
-|Parameter Value Length
-|N bytes, unsigned <<leb128>> encoded length of total number of bytes of
-parameter values in this message
-
-|Parameter Value(s)
-|Array of values; N bytes for each parameter (length dependent on the parameter
-type defined in the <<rpc-definition,RPC entry definition>>)
-|===
-
-[[msg-rpc-response]]
-=== RPC Response
-
-Return responses from a remote procedure call. Even calls with zero outputs
-will respond.
-
-[cols="1,3"]
-|===
-|Field Name |Field Type
-
-|0x21 - RPC Response
-|1 byte, unsigned; message type
-
-|RPC Definition Entry ID
-|2 bytes, unsigned
-
-|Unique ID
-|2 bytes, unsigned; matching ID from <<msg-rpc-execute,RPC Execute>> message
-
-|Result Value Length
-|N bytes, unsigned <<leb128>> encoded length of total number of bytes of result
-values in this message
-
-|Result Value(s)
-|Array of values; N bytes for each result (length dependent on the result type
-defined in the <<rpc-definition,RPC entry definition>>)
-|===
-
-[[rpc-operation]]
-== Remote Procedure Call (RPC) Operation
-
-Remote procedure call entries shall only be assigned by the server.
-
-Remote procedure call execute messages will result in asynchronous execution of
-the corresponding function on the server.
-
-Client implementations shall not transmit an Execute RPC message and return an
-error to user code that attempts to call an undefined RPC, call one with
-incorrectly typed parameters, or attempts to make a call when the Client is not
-connected to a Server.
-
-Remote procedure calls cannot be persisted.
-
-[[rpc-definition]]
-=== Remote Procedure Call Definition Data
-
-The data provided in the RPC definition entry consists of:
-
-[cols="1,3"]
-|===
-|RPC Definition Version
-|1 byte, unsigned; always set to 1 for this version of the protocol.
-
-|Procedure (Entry) Name
-|<<entry-value-string,String>>
-
-|Number of Parameters
-|1 byte, unsigned (may be 0)
-
-2+s|Parameter Specification (one set per input parameter)
-
-|Parameter Type
-|1 byte, unsigned; <<entry-types,Entry Type>> for parameter value
-
-|Parameter Name
-|<<entry-value-string,String>>
-
-|Parameter Default Value
-|N bytes; length based on parameter type (encoded consistent with corresponding
-<<entry-values,Entry Value>> definition)
-
-|Number of Output Results
-|1 byte, unsigned (may be 0)
-
-2+s|Result Specification (one set per output)
-
-|Result Type
-|1 byte, unsigned; <<entry-types,Entry Type>> for value
-
-|Result Name
-|<<entry-value-string,String>>
-|===
diff --git a/third_party/ntcore_2017/gmock/CMakeLists.txt b/third_party/ntcore_2017/gmock/CMakeLists.txt
deleted file mode 100644
index e1af629..0000000
--- a/third_party/ntcore_2017/gmock/CMakeLists.txt
+++ /dev/null
@@ -1,86 +0,0 @@
-########################################################################
-# CMake build script for Google Mock.
-#
-# To run the tests for Google Mock itself on Linux, use 'make test' or
-# ctest. You can select which tests to run using 'ctest -R regex'.
-# For more options, run 'ctest --help'.
-
-# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
-# make it prominent in the GUI.
-option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
-
-# A directory to find Google Test sources.
-if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt")
- set(gtest_dir gtest)
-else()
- set(gtest_dir ../gtest)
-endif()
-
-# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
-include("${gtest_dir}/cmake/hermetic_build.cmake" OPTIONAL)
-
-if (COMMAND pre_project_set_up_hermetic_build)
- # Google Test also calls hermetic setup functions from add_subdirectory,
- # although its changes will not affect things at the current scope.
- pre_project_set_up_hermetic_build()
-endif()
-
-########################################################################
-#
-# Project-wide settings
-
-# Name of the project.
-#
-# CMake files in this project can refer to the root source directory
-# as ${gmock_SOURCE_DIR} and to the root binary directory as
-# ${gmock_BINARY_DIR}.
-# Language "C" is required for find_package(Threads).
-project(gmock CXX C)
-cmake_minimum_required(VERSION 2.6.2)
-
-if (COMMAND set_up_hermetic_build)
- set_up_hermetic_build()
-endif()
-
-if (NOT MSVC)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-field-initializers -Wno-format-nonliteral")
-endif()
-
-# Instructs CMake to process Google Test's CMakeLists.txt and add its
-# targets to the current scope. We are placing Google Test's binary
-# directory in a subdirectory of our own as VC compilation may break
-# if they are the same (the default).
-add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/gtest")
-
-# Although Google Test's CMakeLists.txt calls this function, the
-# changes there don't affect the current scope. Therefore we have to
-# call it again here.
-config_compiler_and_linker() # from ${gtest_dir}/cmake/internal_utils.cmake
-
-# Adds Google Mock's and Google Test's header directories to the search path.
-include_directories("${gmock_SOURCE_DIR}/include"
- "${gmock_SOURCE_DIR}"
- "${gtest_SOURCE_DIR}/include"
- # This directory is needed to build directly from Google
- # Test sources.
- "${gtest_SOURCE_DIR}")
-
-########################################################################
-#
-# Defines the gmock & gmock_main libraries. User tests should link
-# with one of them.
-
-# Google Mock libraries. We build them using more strict warnings than what
-# are used for other targets, to ensure that Google Mock can be compiled by
-# a user aggressive about warnings.
-cxx_library(gmock
- "${cxx_strict}"
- "${gtest_dir}/src/gtest-all.cc"
- src/gmock-all.cc)
-
-cxx_library(gmock_main
- "${cxx_strict}"
- "${gtest_dir}/src/gtest-all.cc"
- src/gmock-all.cc
- src/gmock_main.cc)
-
diff --git a/third_party/ntcore_2017/gmock/LICENSE b/third_party/ntcore_2017/gmock/LICENSE
deleted file mode 100644
index 1941a11..0000000
--- a/third_party/ntcore_2017/gmock/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright 2008, Google Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/third_party/ntcore_2017/gmock/build.gradle b/third_party/ntcore_2017/gmock/build.gradle
deleted file mode 100644
index 809c55c..0000000
--- a/third_party/ntcore_2017/gmock/build.gradle
+++ /dev/null
@@ -1,51 +0,0 @@
-import org.gradle.internal.os.OperatingSystem
-
-apply plugin: 'cpp'
-apply plugin: 'visual-studio'
-
-// Apply the correct toolchain settings for the target platform
-if (OperatingSystem.current().isLinux()) {
- apply from: '../toolchains/linux.gradle'
-} else if (OperatingSystem.current().isMacOsX()) {
- apply from: '../toolchains/mac.gradle'
-} else if (OperatingSystem.current().isWindows()) {
- apply from: '../toolchains/windows.gradle'
-} else {
- throw new GradleException("ntcore does not support building on ${OperatingSystem.current().getFamilyName()}.")
-}
-
-model {
- platforms {
- x86 {
- architecture 'x86'
- }
- x64 {
- architecture 'x86_64'
- }
- }
- components {
- gmock(NativeLibrarySpec) {
- targetPlatform 'x86'
- targetPlatform 'x64'
- sources {
- cpp {
- source {
- srcDirs = ['src', 'gtest/src']
- includes = ['*-all.cc']
- }
- exportedHeaders {
- srcDirs = ['include', 'gtest/include', '.', 'gtest']
- includes = ['**/*.h', '**/*.cc']
- }
- }
- }
- binaries.all {
- if (toolChain in VisualCpp) {
- cppCompiler.args '-D_UNICODE', '-DUNICODE', '-DWIN32', '-D_WIN32', '-DSTRICT', '-DWIN32_LEAN_AND_MEAN', '-D_HAS_EXCEPTIONS=1'
- } else {
- cppCompiler.args '-Wall', '-Wshadow', '-fexceptions', '-Wextra', '-Wno-unused-parameter', '-Wno-missing-field-initializers', '-pthread', '-fPIC'
- }
- }
- }
- }
-}
diff --git a/third_party/ntcore_2017/gmock/gtest/CMakeLists.txt b/third_party/ntcore_2017/gmock/gtest/CMakeLists.txt
deleted file mode 100644
index b9498cd..0000000
--- a/third_party/ntcore_2017/gmock/gtest/CMakeLists.txt
+++ /dev/null
@@ -1,69 +0,0 @@
-########################################################################
-# CMake build script for Google Test.
-#
-# To run the tests for Google Test itself on Linux, use 'make test' or
-# ctest. You can select which tests to run using 'ctest -R regex'.
-# For more options, run 'ctest --help'.
-
-# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
-# make it prominent in the GUI.
-option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
-
-# When other libraries are using a shared version of runtime libraries,
-# Google Test also has to use one.
-option(
- gtest_force_shared_crt
- "Use shared (DLL) run-time lib even when Google Test is built as static lib."
- OFF)
-
-option(gtest_disable_pthreads "Disable uses of pthreads in gtest." OFF)
-
-# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
-include(cmake/hermetic_build.cmake OPTIONAL)
-
-if (COMMAND pre_project_set_up_hermetic_build)
- pre_project_set_up_hermetic_build()
-endif()
-
-########################################################################
-#
-# Project-wide settings
-
-# Name of the project.
-#
-# CMake files in this project can refer to the root source directory
-# as ${gtest_SOURCE_DIR} and to the root binary directory as
-# ${gtest_BINARY_DIR}.
-# Language "C" is required for find_package(Threads).
-project(gtest CXX C)
-cmake_minimum_required(VERSION 2.6.2)
-
-if (COMMAND set_up_hermetic_build)
- set_up_hermetic_build()
-endif()
-
-# Define helper functions and macros used by Google Test.
-include(cmake/internal_utils.cmake)
-
-config_compiler_and_linker() # Defined in internal_utils.cmake.
-
-# Where Google Test's .h files can be found.
-include_directories(
- ${gtest_SOURCE_DIR}/include
- ${gtest_SOURCE_DIR})
-
-# Where Google Test's libraries can be found.
-link_directories(${gtest_BINARY_DIR}/src)
-
-########################################################################
-#
-# Defines the gtest & gtest_main libraries. User tests should link
-# with one of them.
-
-# Google Test libraries. We build them using more strict warnings than what
-# are used for other targets, to ensure that gtest can be compiled by a user
-# aggressive about warnings.
-cxx_library(gtest "${cxx_strict}" src/gtest-all.cc)
-cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
-target_link_libraries(gtest_main gtest)
-
diff --git a/third_party/ntcore_2017/gmock/gtest/LICENSE b/third_party/ntcore_2017/gmock/gtest/LICENSE
deleted file mode 100644
index 1941a11..0000000
--- a/third_party/ntcore_2017/gmock/gtest/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright 2008, Google Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/third_party/ntcore_2017/gmock/gtest/cmake/internal_utils.cmake b/third_party/ntcore_2017/gmock/gtest/cmake/internal_utils.cmake
deleted file mode 100644
index 075410a..0000000
--- a/third_party/ntcore_2017/gmock/gtest/cmake/internal_utils.cmake
+++ /dev/null
@@ -1,206 +0,0 @@
-# Defines functions and macros useful for building Google Test and
-# Google Mock.
-#
-# Note:
-#
-# - This file will be run twice when building Google Mock (once via
-# Google Test's CMakeLists.txt, and once via Google Mock's).
-# Therefore it shouldn't have any side effects other than defining
-# the functions and macros.
-#
-# - The functions/macros defined in this file may depend on Google
-# Test and Google Mock's option() definitions, and thus must be
-# called *after* the options have been defined.
-
-# Tweaks CMake's default compiler/linker settings to suit Google Test's needs.
-#
-# This must be a macro(), as inside a function string() can only
-# update variables in the function scope.
-macro(fix_default_compiler_settings_)
- if (MSVC)
- # For MSVC, CMake sets certain flags to defaults we want to override.
- # This replacement code is taken from sample in the CMake Wiki at
- # http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace.
- foreach (flag_var
- CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
- CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
- if (NOT BUILD_SHARED_LIBS AND NOT gtest_force_shared_crt)
- # When Google Test is built as a shared library, it should also use
- # shared runtime libraries. Otherwise, it may end up with multiple
- # copies of runtime library data in different modules, resulting in
- # hard-to-find crashes. When it is built as a static library, it is
- # preferable to use CRT as static libraries, as we don't have to rely
- # on CRT DLLs being available. CMake always defaults to using shared
- # CRT libraries, so we override that default here.
- string(REPLACE "/MD" "-MT" ${flag_var} "${${flag_var}}")
- endif()
-
- # We prefer more strict warning checking for building Google Test.
- # Replaces /W3 with /W4 in defaults.
- string(REPLACE "/W3" "-W4" ${flag_var} "${${flag_var}}")
- endforeach()
- endif()
-endmacro()
-
-# Defines the compiler/linker flags used to build Google Test and
-# Google Mock. You can tweak these definitions to suit your need. A
-# variable's value is empty before it's explicitly assigned to.
-macro(config_compiler_and_linker)
- if (NOT gtest_disable_pthreads)
- # Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT.
- find_package(Threads)
- endif()
-
- fix_default_compiler_settings_()
- if (MSVC)
- # Newlines inside flags variables break CMake's NMake generator.
- # TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds.
- set(cxx_base_flags "-GS -W4 -WX -wd4127 -wd4251 -wd4275 -nologo -J -Zi")
- if (MSVC_VERSION LESS 1400)
- # Suppress spurious warnings MSVC 7.1 sometimes issues.
- # Forcing value to bool.
- set(cxx_base_flags "${cxx_base_flags} -wd4800")
- # Copy constructor and assignment operator could not be generated.
- set(cxx_base_flags "${cxx_base_flags} -wd4511 -wd4512")
- # Compatibility warnings not applicable to Google Test.
- # Resolved overload was found by argument-dependent lookup.
- set(cxx_base_flags "${cxx_base_flags} -wd4675")
- endif()
- set(cxx_base_flags "${cxx_base_flags} -D_UNICODE -DUNICODE -DWIN32 -D_WIN32")
- set(cxx_base_flags "${cxx_base_flags} -DSTRICT -DWIN32_LEAN_AND_MEAN")
- set(cxx_exception_flags "-EHsc -D_HAS_EXCEPTIONS=1")
- set(cxx_no_exception_flags "-D_HAS_EXCEPTIONS=0")
- set(cxx_no_rtti_flags "-GR-")
- elseif (CMAKE_COMPILER_IS_GNUCXX)
- set(cxx_base_flags "-Wall -Wshadow")
- set(cxx_exception_flags "-fexceptions")
- set(cxx_no_exception_flags "-fno-exceptions")
- # Until version 4.3.2, GCC doesn't define a macro to indicate
- # whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI
- # explicitly.
- set(cxx_no_rtti_flags "-fno-rtti -DGTEST_HAS_RTTI=0")
- set(cxx_strict_flags
- "-Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
- elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
- set(cxx_exception_flags "-features=except")
- # Sun Pro doesn't provide macros to indicate whether exceptions and
- # RTTI are enabled, so we define GTEST_HAS_* explicitly.
- set(cxx_no_exception_flags "-features=no%except -DGTEST_HAS_EXCEPTIONS=0")
- set(cxx_no_rtti_flags "-features=no%rtti -DGTEST_HAS_RTTI=0")
- elseif (CMAKE_CXX_COMPILER_ID STREQUAL "VisualAge" OR
- CMAKE_CXX_COMPILER_ID STREQUAL "XL")
- # CMake 2.8 changes Visual Age's compiler ID to "XL".
- set(cxx_exception_flags "-qeh")
- set(cxx_no_exception_flags "-qnoeh")
- # Until version 9.0, Visual Age doesn't define a macro to indicate
- # whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI
- # explicitly.
- set(cxx_no_rtti_flags "-qnortti -DGTEST_HAS_RTTI=0")
- elseif (CMAKE_CXX_COMPILER_ID STREQUAL "HP")
- set(cxx_base_flags "-AA -mt")
- set(cxx_exception_flags "-DGTEST_HAS_EXCEPTIONS=1")
- set(cxx_no_exception_flags "+noeh -DGTEST_HAS_EXCEPTIONS=0")
- # RTTI can not be disabled in HP aCC compiler.
- set(cxx_no_rtti_flags "")
- endif()
-
- if (CMAKE_USE_PTHREADS_INIT) # The pthreads library is available and allowed.
- set(cxx_base_flags "${cxx_base_flags} -DGTEST_HAS_PTHREAD=1")
- else()
- set(cxx_base_flags "${cxx_base_flags} -DGTEST_HAS_PTHREAD=0")
- endif()
-
- # For building gtest's own tests and samples.
- set(cxx_exception "${CMAKE_CXX_FLAGS} ${cxx_base_flags} ${cxx_exception_flags}")
- set(cxx_no_exception
- "${CMAKE_CXX_FLAGS} ${cxx_base_flags} ${cxx_no_exception_flags}")
- set(cxx_default "${cxx_exception}")
- set(cxx_no_rtti "${cxx_default} ${cxx_no_rtti_flags}")
- set(cxx_use_own_tuple "${cxx_default} -DGTEST_USE_OWN_TR1_TUPLE=1")
-
- # For building the gtest libraries.
- set(cxx_strict "${cxx_default} ${cxx_strict_flags}")
-endmacro()
-
-# Defines the gtest & gtest_main libraries. User tests should link
-# with one of them.
-function(cxx_library_with_type name type cxx_flags)
- # type can be either STATIC or SHARED to denote a static or shared library.
- # ARGN refers to additional arguments after 'cxx_flags'.
- add_library(${name} ${type} ${ARGN})
- set_target_properties(${name}
- PROPERTIES
- COMPILE_FLAGS "${cxx_flags}")
- if (BUILD_SHARED_LIBS OR type STREQUAL "SHARED")
- set_target_properties(${name}
- PROPERTIES
- COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1")
- endif()
- if (CMAKE_USE_PTHREADS_INIT)
- target_link_libraries(${name} ${CMAKE_THREAD_LIBS_INIT})
- endif()
-endfunction()
-
-########################################################################
-#
-# Helper functions for creating build targets.
-
-function(cxx_shared_library name cxx_flags)
- cxx_library_with_type(${name} SHARED "${cxx_flags}" ${ARGN})
-endfunction()
-
-function(cxx_library name cxx_flags)
- cxx_library_with_type(${name} "" "${cxx_flags}" ${ARGN})
-endfunction()
-
-# cxx_executable_with_flags(name cxx_flags libs srcs...)
-#
-# creates a named C++ executable that depends on the given libraries and
-# is built from the given source files with the given compiler flags.
-function(cxx_executable_with_flags name cxx_flags libs)
- add_executable(${name} ${ARGN})
- if (cxx_flags)
- set_target_properties(${name}
- PROPERTIES
- COMPILE_FLAGS "${cxx_flags}")
- endif()
- if (BUILD_SHARED_LIBS)
- set_target_properties(${name}
- PROPERTIES
- COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
- endif()
- # To support mixing linking in static and dynamic libraries, link each
- # library in with an extra call to target_link_libraries.
- foreach (lib "${libs}")
- target_link_libraries(${name} ${lib})
- endforeach()
-endfunction()
-
-# cxx_executable(name dir lib srcs...)
-#
-# creates a named target that depends on the given libs and is built
-# from the given source files. dir/name.cc is implicitly included in
-# the source file list.
-function(cxx_executable name dir libs)
- cxx_executable_with_flags(
- ${name} "${cxx_default}" "${libs}" "${dir}/${name}.cc" ${ARGN})
-endfunction()
-
-# cxx_test_with_flags(name cxx_flags libs srcs...)
-#
-# creates a named C++ test that depends on the given libs and is built
-# from the given source files with the given compiler flags.
-function(cxx_test_with_flags name cxx_flags libs)
- cxx_executable_with_flags(${name} "${cxx_flags}" "${libs}" ${ARGN})
- add_test(${name} ${name})
-endfunction()
-
-# cxx_test(name libs srcs...)
-#
-# creates a named test target that depends on the given libs and is
-# built from the given source files. Unlike cxx_test_with_flags,
-# test/name.cc is already implicitly included in the source file list.
-function(cxx_test name libs)
- cxx_test_with_flags("${name}" "${cxx_default}" "${libs}"
- "test/${name}.cc" ${ARGN})
-endfunction()
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-death-test.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-death-test.h
deleted file mode 100644
index 957a69c..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-death-test.h
+++ /dev/null
@@ -1,294 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the public API for death tests. It is
-// #included by gtest.h so a user doesn't need to include this
-// directly.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
-
-#include "gtest/internal/gtest-death-test-internal.h"
-
-namespace testing {
-
-// This flag controls the style of death tests. Valid values are "threadsafe",
-// meaning that the death test child process will re-execute the test binary
-// from the start, running only a single death test, or "fast",
-// meaning that the child process will execute the test logic immediately
-// after forking.
-GTEST_DECLARE_string_(death_test_style);
-
-#if GTEST_HAS_DEATH_TEST
-
-namespace internal {
-
-// Returns a Boolean value indicating whether the caller is currently
-// executing in the context of the death test child process. Tools such as
-// Valgrind heap checkers may need this to modify their behavior in death
-// tests. IMPORTANT: This is an internal utility. Using it may break the
-// implementation of death tests. User code MUST NOT use it.
-GTEST_API_ bool InDeathTestChild();
-
-} // namespace internal
-
-// The following macros are useful for writing death tests.
-
-// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
-// executed:
-//
-// 1. It generates a warning if there is more than one active
-// thread. This is because it's safe to fork() or clone() only
-// when there is a single thread.
-//
-// 2. The parent process clone()s a sub-process and runs the death
-// test in it; the sub-process exits with code 0 at the end of the
-// death test, if it hasn't exited already.
-//
-// 3. The parent process waits for the sub-process to terminate.
-//
-// 4. The parent process checks the exit code and error message of
-// the sub-process.
-//
-// Examples:
-//
-// ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
-// for (int i = 0; i < 5; i++) {
-// EXPECT_DEATH(server.ProcessRequest(i),
-// "Invalid request .* in ProcessRequest()")
-// << "Failed to die on request " << i;
-// }
-//
-// ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
-//
-// bool KilledBySIGHUP(int exit_code) {
-// return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
-// }
-//
-// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
-//
-// On the regular expressions used in death tests:
-//
-// On POSIX-compliant systems (*nix), we use the <regex.h> library,
-// which uses the POSIX extended regex syntax.
-//
-// On other platforms (e.g. Windows), we only support a simple regex
-// syntax implemented as part of Google Test. This limited
-// implementation should be enough most of the time when writing
-// death tests; though it lacks many features you can find in PCRE
-// or POSIX extended regex syntax. For example, we don't support
-// union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
-// repetition count ("x{5,7}"), among others.
-//
-// Below is the syntax that we do support. We chose it to be a
-// subset of both PCRE and POSIX extended regex, so it's easy to
-// learn wherever you come from. In the following: 'A' denotes a
-// literal character, period (.), or a single \\ escape sequence;
-// 'x' and 'y' denote regular expressions; 'm' and 'n' are for
-// natural numbers.
-//
-// c matches any literal character c
-// \\d matches any decimal digit
-// \\D matches any character that's not a decimal digit
-// \\f matches \f
-// \\n matches \n
-// \\r matches \r
-// \\s matches any ASCII whitespace, including \n
-// \\S matches any character that's not a whitespace
-// \\t matches \t
-// \\v matches \v
-// \\w matches any letter, _, or decimal digit
-// \\W matches any character that \\w doesn't match
-// \\c matches any literal character c, which must be a punctuation
-// . matches any single character except \n
-// A? matches 0 or 1 occurrences of A
-// A* matches 0 or many occurrences of A
-// A+ matches 1 or many occurrences of A
-// ^ matches the beginning of a string (not that of each line)
-// $ matches the end of a string (not that of each line)
-// xy matches x followed by y
-//
-// If you accidentally use PCRE or POSIX extended regex features
-// not implemented by us, you will get a run-time failure. In that
-// case, please try to rewrite your regular expression within the
-// above syntax.
-//
-// This implementation is *not* meant to be as highly tuned or robust
-// as a compiled regex library, but should perform well enough for a
-// death test, which already incurs significant overhead by launching
-// a child process.
-//
-// Known caveats:
-//
-// A "threadsafe" style death test obtains the path to the test
-// program from argv[0] and re-executes it in the sub-process. For
-// simplicity, the current implementation doesn't search the PATH
-// when launching the sub-process. This means that the user must
-// invoke the test program via a path that contains at least one
-// path separator (e.g. path/to/foo_test and
-// /absolute/path/to/bar_test are fine, but foo_test is not). This
-// is rarely a problem as people usually don't put the test binary
-// directory in PATH.
-//
-// TODO(wan@google.com): make thread-safe death tests search the PATH.
-
-// Asserts that a given statement causes the program to exit, with an
-// integer exit status that satisfies predicate, and emitting error output
-// that matches regex.
-# define ASSERT_EXIT(statement, predicate, regex) \
- GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
-
-// Like ASSERT_EXIT, but continues on to successive tests in the
-// test case, if any:
-# define EXPECT_EXIT(statement, predicate, regex) \
- GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
-
-// Asserts that a given statement causes the program to exit, either by
-// explicitly exiting with a nonzero exit code or being killed by a
-// signal, and emitting error output that matches regex.
-# define ASSERT_DEATH(statement, regex) \
- ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
-
-// Like ASSERT_DEATH, but continues on to successive tests in the
-// test case, if any:
-# define EXPECT_DEATH(statement, regex) \
- EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
-
-// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
-
-// Tests that an exit code describes a normal exit with a given exit code.
-class GTEST_API_ ExitedWithCode {
- public:
- explicit ExitedWithCode(int exit_code);
- bool operator()(int exit_status) const;
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ExitedWithCode& other);
-
- const int exit_code_;
-};
-
-# if !GTEST_OS_WINDOWS
-// Tests that an exit code describes an exit due to termination by a
-// given signal.
-class GTEST_API_ KilledBySignal {
- public:
- explicit KilledBySignal(int signum);
- bool operator()(int exit_status) const;
- private:
- const int signum_;
-};
-# endif // !GTEST_OS_WINDOWS
-
-// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
-// The death testing framework causes this to have interesting semantics,
-// since the sideeffects of the call are only visible in opt mode, and not
-// in debug mode.
-//
-// In practice, this can be used to test functions that utilize the
-// LOG(DFATAL) macro using the following style:
-//
-// int DieInDebugOr12(int* sideeffect) {
-// if (sideeffect) {
-// *sideeffect = 12;
-// }
-// LOG(DFATAL) << "death";
-// return 12;
-// }
-//
-// TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {
-// int sideeffect = 0;
-// // Only asserts in dbg.
-// EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
-//
-// #ifdef NDEBUG
-// // opt-mode has sideeffect visible.
-// EXPECT_EQ(12, sideeffect);
-// #else
-// // dbg-mode no visible sideeffect.
-// EXPECT_EQ(0, sideeffect);
-// #endif
-// }
-//
-// This will assert that DieInDebugReturn12InOpt() crashes in debug
-// mode, usually due to a DCHECK or LOG(DFATAL), but returns the
-// appropriate fallback value (12 in this case) in opt mode. If you
-// need to test that a function has appropriate side-effects in opt
-// mode, include assertions against the side-effects. A general
-// pattern for this is:
-//
-// EXPECT_DEBUG_DEATH({
-// // Side-effects here will have an effect after this statement in
-// // opt mode, but none in debug mode.
-// EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
-// }, "death");
-//
-# ifdef NDEBUG
-
-# define EXPECT_DEBUG_DEATH(statement, regex) \
- GTEST_EXECUTE_STATEMENT_(statement, regex)
-
-# define ASSERT_DEBUG_DEATH(statement, regex) \
- GTEST_EXECUTE_STATEMENT_(statement, regex)
-
-# else
-
-# define EXPECT_DEBUG_DEATH(statement, regex) \
- EXPECT_DEATH(statement, regex)
-
-# define ASSERT_DEBUG_DEATH(statement, regex) \
- ASSERT_DEATH(statement, regex)
-
-# endif // NDEBUG for EXPECT_DEBUG_DEATH
-#endif // GTEST_HAS_DEATH_TEST
-
-// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
-// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
-// death tests are supported; otherwise they just issue a warning. This is
-// useful when you are combining death test assertions with normal test
-// assertions in one test.
-#if GTEST_HAS_DEATH_TEST
-# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
- EXPECT_DEATH(statement, regex)
-# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
- ASSERT_DEATH(statement, regex)
-#else
-# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
- GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
-# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
- GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
-#endif
-
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-message.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-message.h
deleted file mode 100644
index fe879bc..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-message.h
+++ /dev/null
@@ -1,250 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the Message class.
-//
-// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
-// leave some internal implementation details in this header file.
-// They are clearly marked by comments like this:
-//
-// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-//
-// Such code is NOT meant to be used by a user directly, and is subject
-// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
-// program!
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
-#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
-
-#include <limits>
-
-#include "gtest/internal/gtest-port.h"
-
-// Ensures that there is at least one operator<< in the global namespace.
-// See Message& operator<<(...) below for why.
-void operator<<(const testing::internal::Secret&, int);
-
-namespace testing {
-
-// The Message class works like an ostream repeater.
-//
-// Typical usage:
-//
-// 1. You stream a bunch of values to a Message object.
-// It will remember the text in a stringstream.
-// 2. Then you stream the Message object to an ostream.
-// This causes the text in the Message to be streamed
-// to the ostream.
-//
-// For example;
-//
-// testing::Message foo;
-// foo << 1 << " != " << 2;
-// std::cout << foo;
-//
-// will print "1 != 2".
-//
-// Message is not intended to be inherited from. In particular, its
-// destructor is not virtual.
-//
-// Note that stringstream behaves differently in gcc and in MSVC. You
-// can stream a NULL char pointer to it in the former, but not in the
-// latter (it causes an access violation if you do). The Message
-// class hides this difference by treating a NULL char pointer as
-// "(null)".
-class GTEST_API_ Message {
- private:
- // The type of basic IO manipulators (endl, ends, and flush) for
- // narrow streams.
- typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
-
- public:
- // Constructs an empty Message.
- Message();
-
- // Copy constructor.
- Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT
- *ss_ << msg.GetString();
- }
-
- // Constructs a Message from a C-string.
- explicit Message(const char* str) : ss_(new ::std::stringstream) {
- *ss_ << str;
- }
-
-#if GTEST_OS_SYMBIAN
- // Streams a value (either a pointer or not) to this object.
- template <typename T>
- inline Message& operator <<(const T& value) {
- StreamHelper(typename internal::is_pointer<T>::type(), value);
- return *this;
- }
-#else
- // Streams a non-pointer value to this object.
- template <typename T>
- inline Message& operator <<(const T& val) {
- // Some libraries overload << for STL containers. These
- // overloads are defined in the global namespace instead of ::std.
- //
- // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
- // overloads are visible in either the std namespace or the global
- // namespace, but not other namespaces, including the testing
- // namespace which Google Test's Message class is in.
- //
- // To allow STL containers (and other types that has a << operator
- // defined in the global namespace) to be used in Google Test
- // assertions, testing::Message must access the custom << operator
- // from the global namespace. With this using declaration,
- // overloads of << defined in the global namespace and those
- // visible via Koenig lookup are both exposed in this function.
- using ::operator <<;
- *ss_ << val;
- return *this;
- }
-
- // Streams a pointer value to this object.
- //
- // This function is an overload of the previous one. When you
- // stream a pointer to a Message, this definition will be used as it
- // is more specialized. (The C++ Standard, section
- // [temp.func.order].) If you stream a non-pointer, then the
- // previous definition will be used.
- //
- // The reason for this overload is that streaming a NULL pointer to
- // ostream is undefined behavior. Depending on the compiler, you
- // may get "0", "(nil)", "(null)", or an access violation. To
- // ensure consistent result across compilers, we always treat NULL
- // as "(null)".
- template <typename T>
- inline Message& operator <<(T* const& pointer) { // NOLINT
- if (pointer == NULL) {
- *ss_ << "(null)";
- } else {
- *ss_ << pointer;
- }
- return *this;
- }
-#endif // GTEST_OS_SYMBIAN
-
- // Since the basic IO manipulators are overloaded for both narrow
- // and wide streams, we have to provide this specialized definition
- // of operator <<, even though its body is the same as the
- // templatized version above. Without this definition, streaming
- // endl or other basic IO manipulators to Message will confuse the
- // compiler.
- Message& operator <<(BasicNarrowIoManip val) {
- *ss_ << val;
- return *this;
- }
-
- // Instead of 1/0, we want to see true/false for bool values.
- Message& operator <<(bool b) {
- return *this << (b ? "true" : "false");
- }
-
- // These two overloads allow streaming a wide C string to a Message
- // using the UTF-8 encoding.
- Message& operator <<(const wchar_t* wide_c_str);
- Message& operator <<(wchar_t* wide_c_str);
-
-#if GTEST_HAS_STD_WSTRING
- // Converts the given wide string to a narrow string using the UTF-8
- // encoding, and streams the result to this Message object.
- Message& operator <<(const ::std::wstring& wstr);
-#endif // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
- // Converts the given wide string to a narrow string using the UTF-8
- // encoding, and streams the result to this Message object.
- Message& operator <<(const ::wstring& wstr);
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
- // Gets the text streamed to this object so far as an std::string.
- // Each '\0' character in the buffer is replaced with "\\0".
- //
- // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
- std::string GetString() const;
-
- private:
-
-#if GTEST_OS_SYMBIAN
- // These are needed as the Nokia Symbian Compiler cannot decide between
- // const T& and const T* in a function template. The Nokia compiler _can_
- // decide between class template specializations for T and T*, so a
- // tr1::type_traits-like is_pointer works, and we can overload on that.
- template <typename T>
- inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) {
- if (pointer == NULL) {
- *ss_ << "(null)";
- } else {
- *ss_ << pointer;
- }
- }
- template <typename T>
- inline void StreamHelper(internal::false_type /*is_pointer*/,
- const T& value) {
- // See the comments in Message& operator <<(const T&) above for why
- // we need this using statement.
- using ::operator <<;
- *ss_ << value;
- }
-#endif // GTEST_OS_SYMBIAN
-
- // We'll hold the text streamed to this object here.
- const internal::scoped_ptr< ::std::stringstream> ss_;
-
- // We declare (but don't implement) this to prevent the compiler
- // from implementing the assignment operator.
- void operator=(const Message&);
-};
-
-// Streams a Message to an ostream.
-inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
- return os << sb.GetString();
-}
-
-namespace internal {
-
-// Converts a streamable value to an std::string. A NULL pointer is
-// converted to "(null)". When the input value is a ::string,
-// ::std::string, ::wstring, or ::std::wstring object, each NUL
-// character in it is replaced with "\\0".
-template <typename T>
-std::string StreamableToString(const T& streamable) {
- return (Message() << streamable).GetString();
-}
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-param-test.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-param-test.h
deleted file mode 100644
index d6702c8..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-param-test.h
+++ /dev/null
@@ -1,1421 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gtest-param-test.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: vladl@google.com (Vlad Losev)
-//
-// Macros and functions for implementing parameterized tests
-// in Google C++ Testing Framework (Google Test)
-//
-// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-
-
-// Value-parameterized tests allow you to test your code with different
-// parameters without writing multiple copies of the same test.
-//
-// Here is how you use value-parameterized tests:
-
-#if 0
-
-// To write value-parameterized tests, first you should define a fixture
-// class. It is usually derived from testing::TestWithParam<T> (see below for
-// another inheritance scheme that's sometimes useful in more complicated
-// class hierarchies), where the type of your parameter values.
-// TestWithParam<T> is itself derived from testing::Test. T can be any
-// copyable type. If it's a raw pointer, you are responsible for managing the
-// lifespan of the pointed values.
-
-class FooTest : public ::testing::TestWithParam<const char*> {
- // You can implement all the usual class fixture members here.
-};
-
-// Then, use the TEST_P macro to define as many parameterized tests
-// for this fixture as you want. The _P suffix is for "parameterized"
-// or "pattern", whichever you prefer to think.
-
-TEST_P(FooTest, DoesBlah) {
- // Inside a test, access the test parameter with the GetParam() method
- // of the TestWithParam<T> class:
- EXPECT_TRUE(foo.Blah(GetParam()));
- ...
-}
-
-TEST_P(FooTest, HasBlahBlah) {
- ...
-}
-
-// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
-// case with any set of parameters you want. Google Test defines a number
-// of functions for generating test parameters. They return what we call
-// (surprise!) parameter generators. Here is a summary of them, which
-// are all in the testing namespace:
-//
-//
-// Range(begin, end [, step]) - Yields values {begin, begin+step,
-// begin+step+step, ...}. The values do not
-// include end. step defaults to 1.
-// Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
-// ValuesIn(container) - Yields values from a C-style array, an STL
-// ValuesIn(begin,end) container, or an iterator range [begin, end).
-// Bool() - Yields sequence {false, true}.
-// Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
-// for the math savvy) of the values generated
-// by the N generators.
-//
-// For more details, see comments at the definitions of these functions below
-// in this file.
-//
-// The following statement will instantiate tests from the FooTest test case
-// each with parameter values "meeny", "miny", and "moe".
-
-INSTANTIATE_TEST_CASE_P(InstantiationName,
- FooTest,
- Values("meeny", "miny", "moe"));
-
-// To distinguish different instances of the pattern, (yes, you
-// can instantiate it more then once) the first argument to the
-// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
-// actual test case name. Remember to pick unique prefixes for different
-// instantiations. The tests from the instantiation above will have
-// these names:
-//
-// * InstantiationName/FooTest.DoesBlah/0 for "meeny"
-// * InstantiationName/FooTest.DoesBlah/1 for "miny"
-// * InstantiationName/FooTest.DoesBlah/2 for "moe"
-// * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
-// * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
-// * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
-//
-// You can use these names in --gtest_filter.
-//
-// This statement will instantiate all tests from FooTest again, each
-// with parameter values "cat" and "dog":
-
-const char* pets[] = {"cat", "dog"};
-INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
-
-// The tests from the instantiation above will have these names:
-//
-// * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
-// * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
-// * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
-// * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
-//
-// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
-// in the given test case, whether their definitions come before or
-// AFTER the INSTANTIATE_TEST_CASE_P statement.
-//
-// Please also note that generator expressions (including parameters to the
-// generators) are evaluated in InitGoogleTest(), after main() has started.
-// This allows the user on one hand, to adjust generator parameters in order
-// to dynamically determine a set of tests to run and on the other hand,
-// give the user a chance to inspect the generated tests with Google Test
-// reflection API before RUN_ALL_TESTS() is executed.
-//
-// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
-// for more examples.
-//
-// In the future, we plan to publish the API for defining new parameter
-// generators. But for now this interface remains part of the internal
-// implementation and is subject to change.
-//
-//
-// A parameterized test fixture must be derived from testing::Test and from
-// testing::WithParamInterface<T>, where T is the type of the parameter
-// values. Inheriting from TestWithParam<T> satisfies that requirement because
-// TestWithParam<T> inherits from both Test and WithParamInterface. In more
-// complicated hierarchies, however, it is occasionally useful to inherit
-// separately from Test and WithParamInterface. For example:
-
-class BaseTest : public ::testing::Test {
- // You can inherit all the usual members for a non-parameterized test
- // fixture here.
-};
-
-class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
- // The usual test fixture members go here too.
-};
-
-TEST_F(BaseTest, HasFoo) {
- // This is an ordinary non-parameterized test.
-}
-
-TEST_P(DerivedTest, DoesBlah) {
- // GetParam works just the same here as if you inherit from TestWithParam.
- EXPECT_TRUE(foo.Blah(GetParam()));
-}
-
-#endif // 0
-
-#include "gtest/internal/gtest-port.h"
-
-#if !GTEST_OS_SYMBIAN
-# include <utility>
-#endif
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-param-util.h"
-#include "gtest/internal/gtest-param-util-generated.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Functions producing parameter generators.
-//
-// Google Test uses these generators to produce parameters for value-
-// parameterized tests. When a parameterized test case is instantiated
-// with a particular generator, Google Test creates and runs tests
-// for each element in the sequence produced by the generator.
-//
-// In the following sample, tests from test case FooTest are instantiated
-// each three times with parameter values 3, 5, and 8:
-//
-// class FooTest : public TestWithParam<int> { ... };
-//
-// TEST_P(FooTest, TestThis) {
-// }
-// TEST_P(FooTest, TestThat) {
-// }
-// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
-//
-
-// Range() returns generators providing sequences of values in a range.
-//
-// Synopsis:
-// Range(start, end)
-// - returns a generator producing a sequence of values {start, start+1,
-// start+2, ..., }.
-// Range(start, end, step)
-// - returns a generator producing a sequence of values {start, start+step,
-// start+step+step, ..., }.
-// Notes:
-// * The generated sequences never include end. For example, Range(1, 5)
-// returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
-// returns a generator producing {1, 3, 5, 7}.
-// * start and end must have the same type. That type may be any integral or
-// floating-point type or a user defined type satisfying these conditions:
-// * It must be assignable (have operator=() defined).
-// * It must have operator+() (operator+(int-compatible type) for
-// two-operand version).
-// * It must have operator<() defined.
-// Elements in the resulting sequences will also have that type.
-// * Condition start < end must be satisfied in order for resulting sequences
-// to contain any elements.
-//
-template <typename T, typename IncrementT>
-internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
- return internal::ParamGenerator<T>(
- new internal::RangeGenerator<T, IncrementT>(start, end, step));
-}
-
-template <typename T>
-internal::ParamGenerator<T> Range(T start, T end) {
- return Range(start, end, 1);
-}
-
-// ValuesIn() function allows generation of tests with parameters coming from
-// a container.
-//
-// Synopsis:
-// ValuesIn(const T (&array)[N])
-// - returns a generator producing sequences with elements from
-// a C-style array.
-// ValuesIn(const Container& container)
-// - returns a generator producing sequences with elements from
-// an STL-style container.
-// ValuesIn(Iterator begin, Iterator end)
-// - returns a generator producing sequences with elements from
-// a range [begin, end) defined by a pair of STL-style iterators. These
-// iterators can also be plain C pointers.
-//
-// Please note that ValuesIn copies the values from the containers
-// passed in and keeps them to generate tests in RUN_ALL_TESTS().
-//
-// Examples:
-//
-// This instantiates tests from test case StringTest
-// each with C-string values of "foo", "bar", and "baz":
-//
-// const char* strings[] = {"foo", "bar", "baz"};
-// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
-//
-// This instantiates tests from test case StlStringTest
-// each with STL strings with values "a" and "b":
-//
-// ::std::vector< ::std::string> GetParameterStrings() {
-// ::std::vector< ::std::string> v;
-// v.push_back("a");
-// v.push_back("b");
-// return v;
-// }
-//
-// INSTANTIATE_TEST_CASE_P(CharSequence,
-// StlStringTest,
-// ValuesIn(GetParameterStrings()));
-//
-//
-// This will also instantiate tests from CharTest
-// each with parameter values 'a' and 'b':
-//
-// ::std::list<char> GetParameterChars() {
-// ::std::list<char> list;
-// list.push_back('a');
-// list.push_back('b');
-// return list;
-// }
-// ::std::list<char> l = GetParameterChars();
-// INSTANTIATE_TEST_CASE_P(CharSequence2,
-// CharTest,
-// ValuesIn(l.begin(), l.end()));
-//
-template <typename ForwardIterator>
-internal::ParamGenerator<
- typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
-ValuesIn(ForwardIterator begin, ForwardIterator end) {
- typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
- ::value_type ParamType;
- return internal::ParamGenerator<ParamType>(
- new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
-}
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
- return ValuesIn(array, array + N);
-}
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
- const Container& container) {
- return ValuesIn(container.begin(), container.end());
-}
-
-// Values() allows generating tests from explicitly specified list of
-// parameters.
-//
-// Synopsis:
-// Values(T v1, T v2, ..., T vN)
-// - returns a generator producing sequences with elements v1, v2, ..., vN.
-//
-// For example, this instantiates tests from test case BarTest each
-// with values "one", "two", and "three":
-//
-// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
-//
-// This instantiates tests from test case BazTest each with values 1, 2, 3.5.
-// The exact type of values will depend on the type of parameter in BazTest.
-//
-// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
-//
-// Currently, Values() supports from 1 to 50 parameters.
-//
-template <typename T1>
-internal::ValueArray1<T1> Values(T1 v1) {
- return internal::ValueArray1<T1>(v1);
-}
-
-template <typename T1, typename T2>
-internal::ValueArray2<T1, T2> Values(T1 v1, T2 v2) {
- return internal::ValueArray2<T1, T2>(v1, v2);
-}
-
-template <typename T1, typename T2, typename T3>
-internal::ValueArray3<T1, T2, T3> Values(T1 v1, T2 v2, T3 v3) {
- return internal::ValueArray3<T1, T2, T3>(v1, v2, v3);
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-internal::ValueArray4<T1, T2, T3, T4> Values(T1 v1, T2 v2, T3 v3, T4 v4) {
- return internal::ValueArray4<T1, T2, T3, T4>(v1, v2, v3, v4);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-internal::ValueArray5<T1, T2, T3, T4, T5> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5) {
- return internal::ValueArray5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-internal::ValueArray6<T1, T2, T3, T4, T5, T6> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6) {
- return internal::ValueArray6<T1, T2, T3, T4, T5, T6>(v1, v2, v3, v4, v5, v6);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6, T7 v7) {
- return internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7>(v1, v2, v3, v4, v5,
- v6, v7);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) {
- return internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8>(v1, v2, v3, v4,
- v5, v6, v7, v8);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) {
- return internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1, v2, v3,
- v4, v5, v6, v7, v8, v9);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Values(T1 v1,
- T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) {
- return internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1,
- v2, v3, v4, v5, v6, v7, v8, v9, v10);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
- T11> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11) {
- return internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
- T11>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12) {
- return internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13) {
- return internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) {
- return internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
- v14);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) {
- return internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
- v13, v14, v15);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16) {
- return internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
- v12, v13, v14, v15, v16);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17) {
- return internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
- v11, v12, v13, v14, v15, v16, v17);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
- T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18) {
- return internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
- v10, v11, v12, v13, v14, v15, v16, v17, v18);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
- T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
- T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) {
- return internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19>(v1, v2, v3, v4, v5, v6, v7, v8,
- v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) {
- return internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20>(v1, v2, v3, v4, v5, v6, v7,
- v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) {
- return internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(v1, v2, v3, v4, v5, v6,
- v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22) {
- return internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>(v1, v2, v3, v4,
- v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23) {
- return internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23>(v1, v2, v3,
- v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24) {
- return internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24>(v1, v2,
- v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
- v19, v20, v21, v22, v23, v24);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Values(T1 v1,
- T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
- T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
- T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) {
- return internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25>(v1,
- v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
- v18, v19, v20, v21, v22, v23, v24, v25);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26) {
- return internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
- v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27) {
- return internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
- v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28) {
- return internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
- v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
- v28);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29) {
- return internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
- v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
- v27, v28, v29);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
- T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
- T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) {
- return internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
- v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
- v26, v27, v28, v29, v30);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) {
- return internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
- v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
- v25, v26, v27, v28, v29, v30, v31);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32) {
- return internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
- v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
- T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33) {
- return internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33>(v1, v2, v3, v4, v5, v6, v7, v8,
- v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32, v33);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
- T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
- T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
- T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
- T31 v31, T32 v32, T33 v33, T34 v34) {
- return internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34>(v1, v2, v3, v4, v5, v6, v7,
- v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
- v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
- T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
- T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) {
- return internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35>(v1, v2, v3, v4, v5, v6,
- v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
- v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
- T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
- T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) {
- return internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36>(v1, v2, v3, v4,
- v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
- v34, v35, v36);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
- T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
- T37 v37) {
- return internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37>(v1, v2, v3,
- v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
- v34, v35, v36, v37);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
- T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
- T37 v37, T38 v38) {
- return internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38>(v1, v2,
- v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
- v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32,
- v33, v34, v35, v36, v37, v38);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
- T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
- T37 v37, T38 v38, T39 v39) {
- return internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39>(v1,
- v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
- v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,
- v32, v33, v34, v35, v36, v37, v38, v39);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Values(T1 v1,
- T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
- T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
- T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27,
- T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35,
- T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) {
- return internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
- v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29,
- v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) {
- return internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
- v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28,
- v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42) {
- return internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
- v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
- v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41,
- v42);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43) {
- return internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
- v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
- v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40,
- v41, v42, v43);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44) {
- return internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
- v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
- v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39,
- v40, v41, v42, v43, v44);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
- T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
- T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
- T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
- T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) {
- return internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
- v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
- v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38,
- v39, v40, v41, v42, v43, v44, v45);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
- T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) {
- return internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
- v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
- v38, v39, v40, v41, v42, v43, v44, v45, v46);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
- T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) {
- return internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47>(v1, v2, v3, v4, v5, v6, v7, v8,
- v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
- v38, v39, v40, v41, v42, v43, v44, v45, v46, v47);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
- T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
- T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47,
- T48 v48) {
- return internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47, T48>(v1, v2, v3, v4, v5, v6, v7,
- v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
- v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36,
- v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
- T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
- T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
- T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
- T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38,
- T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46,
- T47 v47, T48 v48, T49 v49) {
- return internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47, T48, T49>(v1, v2, v3, v4, v5, v6,
- v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
- v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35,
- v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49, T50> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
- T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
- T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37,
- T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45,
- T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) {
- return internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>(v1, v2, v3, v4,
- v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
- v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47,
- v48, v49, v50);
-}
-
-// Bool() allows generating tests with parameters in a set of (false, true).
-//
-// Synopsis:
-// Bool()
-// - returns a generator producing sequences with elements {false, true}.
-//
-// It is useful when testing code that depends on Boolean flags. Combinations
-// of multiple flags can be tested when several Bool()'s are combined using
-// Combine() function.
-//
-// In the following example all tests in the test case FlagDependentTest
-// will be instantiated twice with parameters false and true.
-//
-// class FlagDependentTest : public testing::TestWithParam<bool> {
-// virtual void SetUp() {
-// external_flag = GetParam();
-// }
-// }
-// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
-//
-inline internal::ParamGenerator<bool> Bool() {
- return Values(false, true);
-}
-
-# if GTEST_HAS_COMBINE
-// Combine() allows the user to combine two or more sequences to produce
-// values of a Cartesian product of those sequences' elements.
-//
-// Synopsis:
-// Combine(gen1, gen2, ..., genN)
-// - returns a generator producing sequences with elements coming from
-// the Cartesian product of elements from the sequences generated by
-// gen1, gen2, ..., genN. The sequence elements will have a type of
-// tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
-// of elements from sequences produces by gen1, gen2, ..., genN.
-//
-// Combine can have up to 10 arguments. This number is currently limited
-// by the maximum number of elements in the tuple implementation used by Google
-// Test.
-//
-// Example:
-//
-// This will instantiate tests in test case AnimalTest each one with
-// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
-// tuple("dog", BLACK), and tuple("dog", WHITE):
-//
-// enum Color { BLACK, GRAY, WHITE };
-// class AnimalTest
-// : public testing::TestWithParam<tuple<const char*, Color> > {...};
-//
-// TEST_P(AnimalTest, AnimalLooksNice) {...}
-//
-// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
-// Combine(Values("cat", "dog"),
-// Values(BLACK, WHITE)));
-//
-// This will instantiate tests in FlagDependentTest with all variations of two
-// Boolean flags:
-//
-// class FlagDependentTest
-// : public testing::TestWithParam<tuple<bool, bool> > {
-// virtual void SetUp() {
-// // Assigns external_flag_1 and external_flag_2 values from the tuple.
-// tie(external_flag_1, external_flag_2) = GetParam();
-// }
-// };
-//
-// TEST_P(FlagDependentTest, TestFeature1) {
-// // Test your code using external_flag_1 and external_flag_2 here.
-// }
-// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
-// Combine(Bool(), Bool()));
-//
-template <typename Generator1, typename Generator2>
-internal::CartesianProductHolder2<Generator1, Generator2> Combine(
- const Generator1& g1, const Generator2& g2) {
- return internal::CartesianProductHolder2<Generator1, Generator2>(
- g1, g2);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3>
-internal::CartesianProductHolder3<Generator1, Generator2, Generator3> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3) {
- return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
- g1, g2, g3);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4>
-internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
- Generator4> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4) {
- return internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
- Generator4>(
- g1, g2, g3, g4);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5>
-internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
- Generator4, Generator5> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5) {
- return internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
- Generator4, Generator5>(
- g1, g2, g3, g4, g5);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6>
-internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6) {
- return internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6>(
- g1, g2, g3, g4, g5, g6);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7>
-internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7) {
- return internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7>(
- g1, g2, g3, g4, g5, g6, g7);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7, typename Generator8>
-internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7, const Generator8& g8) {
- return internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8>(
- g1, g2, g3, g4, g5, g6, g7, g8);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7, typename Generator8, typename Generator9>
-internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8,
- Generator9> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7, const Generator8& g8, const Generator9& g9) {
- return internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>(
- g1, g2, g3, g4, g5, g6, g7, g8, g9);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7, typename Generator8, typename Generator9,
- typename Generator10>
-internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
- Generator10> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7, const Generator8& g8, const Generator9& g9,
- const Generator10& g10) {
- return internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
- Generator10>(
- g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);
-}
-# endif // GTEST_HAS_COMBINE
-
-
-
-# define TEST_P(test_case_name, test_name) \
- class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
- : public test_case_name { \
- public: \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
- virtual void TestBody(); \
- private: \
- static int AddToRegistry() { \
- ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
- GetTestCasePatternHolder<test_case_name>(\
- #test_case_name, __FILE__, __LINE__)->AddTestPattern(\
- #test_case_name, \
- #test_name, \
- new ::testing::internal::TestMetaFactory< \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
- return 0; \
- } \
- static int gtest_registering_dummy_; \
- GTEST_DISALLOW_COPY_AND_ASSIGN_(\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
- }; \
- int GTEST_TEST_CLASS_NAME_(test_case_name, \
- test_name)::gtest_registering_dummy_ = \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
- void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
-
-# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
- ::testing::internal::ParamGenerator<test_case_name::ParamType> \
- gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
- int gtest_##prefix##test_case_name##_dummy_ = \
- ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
- GetTestCasePatternHolder<test_case_name>(\
- #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\
- #prefix, \
- >est_##prefix##test_case_name##_EvalGenerator_, \
- __FILE__, __LINE__)
-
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-param-test.h.pump b/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-param-test.h.pump
deleted file mode 100644
index 2dc9303..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-param-test.h.pump
+++ /dev/null
@@ -1,487 +0,0 @@
-$$ -*- mode: c++; -*-
-$var n = 50 $$ Maximum length of Values arguments we want to support.
-$var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: vladl@google.com (Vlad Losev)
-//
-// Macros and functions for implementing parameterized tests
-// in Google C++ Testing Framework (Google Test)
-//
-// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-
-
-// Value-parameterized tests allow you to test your code with different
-// parameters without writing multiple copies of the same test.
-//
-// Here is how you use value-parameterized tests:
-
-#if 0
-
-// To write value-parameterized tests, first you should define a fixture
-// class. It is usually derived from testing::TestWithParam<T> (see below for
-// another inheritance scheme that's sometimes useful in more complicated
-// class hierarchies), where the type of your parameter values.
-// TestWithParam<T> is itself derived from testing::Test. T can be any
-// copyable type. If it's a raw pointer, you are responsible for managing the
-// lifespan of the pointed values.
-
-class FooTest : public ::testing::TestWithParam<const char*> {
- // You can implement all the usual class fixture members here.
-};
-
-// Then, use the TEST_P macro to define as many parameterized tests
-// for this fixture as you want. The _P suffix is for "parameterized"
-// or "pattern", whichever you prefer to think.
-
-TEST_P(FooTest, DoesBlah) {
- // Inside a test, access the test parameter with the GetParam() method
- // of the TestWithParam<T> class:
- EXPECT_TRUE(foo.Blah(GetParam()));
- ...
-}
-
-TEST_P(FooTest, HasBlahBlah) {
- ...
-}
-
-// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
-// case with any set of parameters you want. Google Test defines a number
-// of functions for generating test parameters. They return what we call
-// (surprise!) parameter generators. Here is a summary of them, which
-// are all in the testing namespace:
-//
-//
-// Range(begin, end [, step]) - Yields values {begin, begin+step,
-// begin+step+step, ...}. The values do not
-// include end. step defaults to 1.
-// Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
-// ValuesIn(container) - Yields values from a C-style array, an STL
-// ValuesIn(begin,end) container, or an iterator range [begin, end).
-// Bool() - Yields sequence {false, true}.
-// Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
-// for the math savvy) of the values generated
-// by the N generators.
-//
-// For more details, see comments at the definitions of these functions below
-// in this file.
-//
-// The following statement will instantiate tests from the FooTest test case
-// each with parameter values "meeny", "miny", and "moe".
-
-INSTANTIATE_TEST_CASE_P(InstantiationName,
- FooTest,
- Values("meeny", "miny", "moe"));
-
-// To distinguish different instances of the pattern, (yes, you
-// can instantiate it more then once) the first argument to the
-// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
-// actual test case name. Remember to pick unique prefixes for different
-// instantiations. The tests from the instantiation above will have
-// these names:
-//
-// * InstantiationName/FooTest.DoesBlah/0 for "meeny"
-// * InstantiationName/FooTest.DoesBlah/1 for "miny"
-// * InstantiationName/FooTest.DoesBlah/2 for "moe"
-// * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
-// * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
-// * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
-//
-// You can use these names in --gtest_filter.
-//
-// This statement will instantiate all tests from FooTest again, each
-// with parameter values "cat" and "dog":
-
-const char* pets[] = {"cat", "dog"};
-INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
-
-// The tests from the instantiation above will have these names:
-//
-// * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
-// * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
-// * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
-// * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
-//
-// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
-// in the given test case, whether their definitions come before or
-// AFTER the INSTANTIATE_TEST_CASE_P statement.
-//
-// Please also note that generator expressions (including parameters to the
-// generators) are evaluated in InitGoogleTest(), after main() has started.
-// This allows the user on one hand, to adjust generator parameters in order
-// to dynamically determine a set of tests to run and on the other hand,
-// give the user a chance to inspect the generated tests with Google Test
-// reflection API before RUN_ALL_TESTS() is executed.
-//
-// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
-// for more examples.
-//
-// In the future, we plan to publish the API for defining new parameter
-// generators. But for now this interface remains part of the internal
-// implementation and is subject to change.
-//
-//
-// A parameterized test fixture must be derived from testing::Test and from
-// testing::WithParamInterface<T>, where T is the type of the parameter
-// values. Inheriting from TestWithParam<T> satisfies that requirement because
-// TestWithParam<T> inherits from both Test and WithParamInterface. In more
-// complicated hierarchies, however, it is occasionally useful to inherit
-// separately from Test and WithParamInterface. For example:
-
-class BaseTest : public ::testing::Test {
- // You can inherit all the usual members for a non-parameterized test
- // fixture here.
-};
-
-class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
- // The usual test fixture members go here too.
-};
-
-TEST_F(BaseTest, HasFoo) {
- // This is an ordinary non-parameterized test.
-}
-
-TEST_P(DerivedTest, DoesBlah) {
- // GetParam works just the same here as if you inherit from TestWithParam.
- EXPECT_TRUE(foo.Blah(GetParam()));
-}
-
-#endif // 0
-
-#include "gtest/internal/gtest-port.h"
-
-#if !GTEST_OS_SYMBIAN
-# include <utility>
-#endif
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-param-util.h"
-#include "gtest/internal/gtest-param-util-generated.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Functions producing parameter generators.
-//
-// Google Test uses these generators to produce parameters for value-
-// parameterized tests. When a parameterized test case is instantiated
-// with a particular generator, Google Test creates and runs tests
-// for each element in the sequence produced by the generator.
-//
-// In the following sample, tests from test case FooTest are instantiated
-// each three times with parameter values 3, 5, and 8:
-//
-// class FooTest : public TestWithParam<int> { ... };
-//
-// TEST_P(FooTest, TestThis) {
-// }
-// TEST_P(FooTest, TestThat) {
-// }
-// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
-//
-
-// Range() returns generators providing sequences of values in a range.
-//
-// Synopsis:
-// Range(start, end)
-// - returns a generator producing a sequence of values {start, start+1,
-// start+2, ..., }.
-// Range(start, end, step)
-// - returns a generator producing a sequence of values {start, start+step,
-// start+step+step, ..., }.
-// Notes:
-// * The generated sequences never include end. For example, Range(1, 5)
-// returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
-// returns a generator producing {1, 3, 5, 7}.
-// * start and end must have the same type. That type may be any integral or
-// floating-point type or a user defined type satisfying these conditions:
-// * It must be assignable (have operator=() defined).
-// * It must have operator+() (operator+(int-compatible type) for
-// two-operand version).
-// * It must have operator<() defined.
-// Elements in the resulting sequences will also have that type.
-// * Condition start < end must be satisfied in order for resulting sequences
-// to contain any elements.
-//
-template <typename T, typename IncrementT>
-internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
- return internal::ParamGenerator<T>(
- new internal::RangeGenerator<T, IncrementT>(start, end, step));
-}
-
-template <typename T>
-internal::ParamGenerator<T> Range(T start, T end) {
- return Range(start, end, 1);
-}
-
-// ValuesIn() function allows generation of tests with parameters coming from
-// a container.
-//
-// Synopsis:
-// ValuesIn(const T (&array)[N])
-// - returns a generator producing sequences with elements from
-// a C-style array.
-// ValuesIn(const Container& container)
-// - returns a generator producing sequences with elements from
-// an STL-style container.
-// ValuesIn(Iterator begin, Iterator end)
-// - returns a generator producing sequences with elements from
-// a range [begin, end) defined by a pair of STL-style iterators. These
-// iterators can also be plain C pointers.
-//
-// Please note that ValuesIn copies the values from the containers
-// passed in and keeps them to generate tests in RUN_ALL_TESTS().
-//
-// Examples:
-//
-// This instantiates tests from test case StringTest
-// each with C-string values of "foo", "bar", and "baz":
-//
-// const char* strings[] = {"foo", "bar", "baz"};
-// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
-//
-// This instantiates tests from test case StlStringTest
-// each with STL strings with values "a" and "b":
-//
-// ::std::vector< ::std::string> GetParameterStrings() {
-// ::std::vector< ::std::string> v;
-// v.push_back("a");
-// v.push_back("b");
-// return v;
-// }
-//
-// INSTANTIATE_TEST_CASE_P(CharSequence,
-// StlStringTest,
-// ValuesIn(GetParameterStrings()));
-//
-//
-// This will also instantiate tests from CharTest
-// each with parameter values 'a' and 'b':
-//
-// ::std::list<char> GetParameterChars() {
-// ::std::list<char> list;
-// list.push_back('a');
-// list.push_back('b');
-// return list;
-// }
-// ::std::list<char> l = GetParameterChars();
-// INSTANTIATE_TEST_CASE_P(CharSequence2,
-// CharTest,
-// ValuesIn(l.begin(), l.end()));
-//
-template <typename ForwardIterator>
-internal::ParamGenerator<
- typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
-ValuesIn(ForwardIterator begin, ForwardIterator end) {
- typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
- ::value_type ParamType;
- return internal::ParamGenerator<ParamType>(
- new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
-}
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
- return ValuesIn(array, array + N);
-}
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
- const Container& container) {
- return ValuesIn(container.begin(), container.end());
-}
-
-// Values() allows generating tests from explicitly specified list of
-// parameters.
-//
-// Synopsis:
-// Values(T v1, T v2, ..., T vN)
-// - returns a generator producing sequences with elements v1, v2, ..., vN.
-//
-// For example, this instantiates tests from test case BarTest each
-// with values "one", "two", and "three":
-//
-// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
-//
-// This instantiates tests from test case BazTest each with values 1, 2, 3.5.
-// The exact type of values will depend on the type of parameter in BazTest.
-//
-// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
-//
-// Currently, Values() supports from 1 to $n parameters.
-//
-$range i 1..n
-$for i [[
-$range j 1..i
-
-template <$for j, [[typename T$j]]>
-internal::ValueArray$i<$for j, [[T$j]]> Values($for j, [[T$j v$j]]) {
- return internal::ValueArray$i<$for j, [[T$j]]>($for j, [[v$j]]);
-}
-
-]]
-
-// Bool() allows generating tests with parameters in a set of (false, true).
-//
-// Synopsis:
-// Bool()
-// - returns a generator producing sequences with elements {false, true}.
-//
-// It is useful when testing code that depends on Boolean flags. Combinations
-// of multiple flags can be tested when several Bool()'s are combined using
-// Combine() function.
-//
-// In the following example all tests in the test case FlagDependentTest
-// will be instantiated twice with parameters false and true.
-//
-// class FlagDependentTest : public testing::TestWithParam<bool> {
-// virtual void SetUp() {
-// external_flag = GetParam();
-// }
-// }
-// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
-//
-inline internal::ParamGenerator<bool> Bool() {
- return Values(false, true);
-}
-
-# if GTEST_HAS_COMBINE
-// Combine() allows the user to combine two or more sequences to produce
-// values of a Cartesian product of those sequences' elements.
-//
-// Synopsis:
-// Combine(gen1, gen2, ..., genN)
-// - returns a generator producing sequences with elements coming from
-// the Cartesian product of elements from the sequences generated by
-// gen1, gen2, ..., genN. The sequence elements will have a type of
-// tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
-// of elements from sequences produces by gen1, gen2, ..., genN.
-//
-// Combine can have up to $maxtuple arguments. This number is currently limited
-// by the maximum number of elements in the tuple implementation used by Google
-// Test.
-//
-// Example:
-//
-// This will instantiate tests in test case AnimalTest each one with
-// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
-// tuple("dog", BLACK), and tuple("dog", WHITE):
-//
-// enum Color { BLACK, GRAY, WHITE };
-// class AnimalTest
-// : public testing::TestWithParam<tuple<const char*, Color> > {...};
-//
-// TEST_P(AnimalTest, AnimalLooksNice) {...}
-//
-// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
-// Combine(Values("cat", "dog"),
-// Values(BLACK, WHITE)));
-//
-// This will instantiate tests in FlagDependentTest with all variations of two
-// Boolean flags:
-//
-// class FlagDependentTest
-// : public testing::TestWithParam<tuple<bool, bool> > {
-// virtual void SetUp() {
-// // Assigns external_flag_1 and external_flag_2 values from the tuple.
-// tie(external_flag_1, external_flag_2) = GetParam();
-// }
-// };
-//
-// TEST_P(FlagDependentTest, TestFeature1) {
-// // Test your code using external_flag_1 and external_flag_2 here.
-// }
-// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
-// Combine(Bool(), Bool()));
-//
-$range i 2..maxtuple
-$for i [[
-$range j 1..i
-
-template <$for j, [[typename Generator$j]]>
-internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
- $for j, [[const Generator$j& g$j]]) {
- return internal::CartesianProductHolder$i<$for j, [[Generator$j]]>(
- $for j, [[g$j]]);
-}
-
-]]
-# endif // GTEST_HAS_COMBINE
-
-
-
-# define TEST_P(test_case_name, test_name) \
- class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
- : public test_case_name { \
- public: \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
- virtual void TestBody(); \
- private: \
- static int AddToRegistry() { \
- ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
- GetTestCasePatternHolder<test_case_name>(\
- #test_case_name, __FILE__, __LINE__)->AddTestPattern(\
- #test_case_name, \
- #test_name, \
- new ::testing::internal::TestMetaFactory< \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
- return 0; \
- } \
- static int gtest_registering_dummy_; \
- GTEST_DISALLOW_COPY_AND_ASSIGN_(\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
- }; \
- int GTEST_TEST_CLASS_NAME_(test_case_name, \
- test_name)::gtest_registering_dummy_ = \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
- void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
-
-# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
- ::testing::internal::ParamGenerator<test_case_name::ParamType> \
- gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
- int gtest_##prefix##test_case_name##_dummy_ = \
- ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
- GetTestCasePatternHolder<test_case_name>(\
- #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\
- #prefix, \
- >est_##prefix##test_case_name##_EvalGenerator_, \
- __FILE__, __LINE__)
-
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-printers.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-printers.h
deleted file mode 100644
index 0639d9f..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-printers.h
+++ /dev/null
@@ -1,855 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Test - The Google C++ Testing Framework
-//
-// This file implements a universal value printer that can print a
-// value of any type T:
-//
-// void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
-//
-// A user can teach this function how to print a class type T by
-// defining either operator<<() or PrintTo() in the namespace that
-// defines T. More specifically, the FIRST defined function in the
-// following list will be used (assuming T is defined in namespace
-// foo):
-//
-// 1. foo::PrintTo(const T&, ostream*)
-// 2. operator<<(ostream&, const T&) defined in either foo or the
-// global namespace.
-//
-// If none of the above is defined, it will print the debug string of
-// the value if it is a protocol buffer, or print the raw bytes in the
-// value otherwise.
-//
-// To aid debugging: when T is a reference type, the address of the
-// value is also printed; when T is a (const) char pointer, both the
-// pointer value and the NUL-terminated string it points to are
-// printed.
-//
-// We also provide some convenient wrappers:
-//
-// // Prints a value to a string. For a (const or not) char
-// // pointer, the NUL-terminated string (but not the pointer) is
-// // printed.
-// std::string ::testing::PrintToString(const T& value);
-//
-// // Prints a value tersely: for a reference type, the referenced
-// // value (but not the address) is printed; for a (const or not) char
-// // pointer, the NUL-terminated string (but not the pointer) is
-// // printed.
-// void ::testing::internal::UniversalTersePrint(const T& value, ostream*);
-//
-// // Prints value using the type inferred by the compiler. The difference
-// // from UniversalTersePrint() is that this function prints both the
-// // pointer and the NUL-terminated string for a (const or not) char pointer.
-// void ::testing::internal::UniversalPrint(const T& value, ostream*);
-//
-// // Prints the fields of a tuple tersely to a string vector, one
-// // element for each field. Tuple support must be enabled in
-// // gtest-port.h.
-// std::vector<string> UniversalTersePrintTupleFieldsToStrings(
-// const Tuple& value);
-//
-// Known limitation:
-//
-// The print primitives print the elements of an STL-style container
-// using the compiler-inferred type of *iter where iter is a
-// const_iterator of the container. When const_iterator is an input
-// iterator but not a forward iterator, this inferred type may not
-// match value_type, and the print output may be incorrect. In
-// practice, this is rarely a problem as for most containers
-// const_iterator is a forward iterator. We'll fix this if there's an
-// actual need for it. Note that this fix cannot rely on value_type
-// being defined as many user-defined container types don't have
-// value_type.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
-
-#include <ostream> // NOLINT
-#include <sstream>
-#include <string>
-#include <utility>
-#include <vector>
-#include "gtest/internal/gtest-port.h"
-#include "gtest/internal/gtest-internal.h"
-
-namespace testing {
-
-// Definitions in the 'internal' and 'internal2' name spaces are
-// subject to change without notice. DO NOT USE THEM IN USER CODE!
-namespace internal2 {
-
-// Prints the given number of bytes in the given object to the given
-// ostream.
-GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
- size_t count,
- ::std::ostream* os);
-
-// For selecting which printer to use when a given type has neither <<
-// nor PrintTo().
-enum TypeKind {
- kProtobuf, // a protobuf type
- kConvertibleToInteger, // a type implicitly convertible to BiggestInt
- // (e.g. a named or unnamed enum type)
- kOtherType // anything else
-};
-
-// TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called
-// by the universal printer to print a value of type T when neither
-// operator<< nor PrintTo() is defined for T, where kTypeKind is the
-// "kind" of T as defined by enum TypeKind.
-template <typename T, TypeKind kTypeKind>
-class TypeWithoutFormatter {
- public:
- // This default version is called when kTypeKind is kOtherType.
- static void PrintValue(const T& value, ::std::ostream* os) {
- PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value),
- sizeof(value), os);
- }
-};
-
-// We print a protobuf using its ShortDebugString() when the string
-// doesn't exceed this many characters; otherwise we print it using
-// DebugString() for better readability.
-const size_t kProtobufOneLinerMaxLength = 50;
-
-template <typename T>
-class TypeWithoutFormatter<T, kProtobuf> {
- public:
- static void PrintValue(const T& value, ::std::ostream* os) {
- const ::testing::internal::string short_str = value.ShortDebugString();
- const ::testing::internal::string pretty_str =
- short_str.length() <= kProtobufOneLinerMaxLength ?
- short_str : ("\n" + value.DebugString());
- *os << ("<" + pretty_str + ">");
- }
-};
-
-template <typename T>
-class TypeWithoutFormatter<T, kConvertibleToInteger> {
- public:
- // Since T has no << operator or PrintTo() but can be implicitly
- // converted to BiggestInt, we print it as a BiggestInt.
- //
- // Most likely T is an enum type (either named or unnamed), in which
- // case printing it as an integer is the desired behavior. In case
- // T is not an enum, printing it as an integer is the best we can do
- // given that it has no user-defined printer.
- static void PrintValue(const T& value, ::std::ostream* os) {
- const internal::BiggestInt kBigInt = value;
- *os << kBigInt;
- }
-};
-
-// Prints the given value to the given ostream. If the value is a
-// protocol message, its debug string is printed; if it's an enum or
-// of a type implicitly convertible to BiggestInt, it's printed as an
-// integer; otherwise the bytes in the value are printed. This is
-// what UniversalPrinter<T>::Print() does when it knows nothing about
-// type T and T has neither << operator nor PrintTo().
-//
-// A user can override this behavior for a class type Foo by defining
-// a << operator in the namespace where Foo is defined.
-//
-// We put this operator in namespace 'internal2' instead of 'internal'
-// to simplify the implementation, as much code in 'internal' needs to
-// use << in STL, which would conflict with our own << were it defined
-// in 'internal'.
-//
-// Note that this operator<< takes a generic std::basic_ostream<Char,
-// CharTraits> type instead of the more restricted std::ostream. If
-// we define it to take an std::ostream instead, we'll get an
-// "ambiguous overloads" compiler error when trying to print a type
-// Foo that supports streaming to std::basic_ostream<Char,
-// CharTraits>, as the compiler cannot tell whether
-// operator<<(std::ostream&, const T&) or
-// operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more
-// specific.
-template <typename Char, typename CharTraits, typename T>
-::std::basic_ostream<Char, CharTraits>& operator<<(
- ::std::basic_ostream<Char, CharTraits>& os, const T& x) {
- TypeWithoutFormatter<T,
- (internal::IsAProtocolMessage<T>::value ? kProtobuf :
- internal::ImplicitlyConvertible<const T&, internal::BiggestInt>::value ?
- kConvertibleToInteger : kOtherType)>::PrintValue(x, &os);
- return os;
-}
-
-} // namespace internal2
-} // namespace testing
-
-// This namespace MUST NOT BE NESTED IN ::testing, or the name look-up
-// magic needed for implementing UniversalPrinter won't work.
-namespace testing_internal {
-
-// Used to print a value that is not an STL-style container when the
-// user doesn't define PrintTo() for it.
-template <typename T>
-void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {
- // With the following statement, during unqualified name lookup,
- // testing::internal2::operator<< appears as if it was declared in
- // the nearest enclosing namespace that contains both
- // ::testing_internal and ::testing::internal2, i.e. the global
- // namespace. For more details, refer to the C++ Standard section
- // 7.3.4-1 [namespace.udir]. This allows us to fall back onto
- // testing::internal2::operator<< in case T doesn't come with a <<
- // operator.
- //
- // We cannot write 'using ::testing::internal2::operator<<;', which
- // gcc 3.3 fails to compile due to a compiler bug.
- using namespace ::testing::internal2; // NOLINT
-
- // Assuming T is defined in namespace foo, in the next statement,
- // the compiler will consider all of:
- //
- // 1. foo::operator<< (thanks to Koenig look-up),
- // 2. ::operator<< (as the current namespace is enclosed in ::),
- // 3. testing::internal2::operator<< (thanks to the using statement above).
- //
- // The operator<< whose type matches T best will be picked.
- //
- // We deliberately allow #2 to be a candidate, as sometimes it's
- // impossible to define #1 (e.g. when foo is ::std, defining
- // anything in it is undefined behavior unless you are a compiler
- // vendor.).
- *os << value;
-}
-
-} // namespace testing_internal
-
-namespace testing {
-namespace internal {
-
-// UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
-// value to the given ostream. The caller must ensure that
-// 'ostream_ptr' is not NULL, or the behavior is undefined.
-//
-// We define UniversalPrinter as a class template (as opposed to a
-// function template), as we need to partially specialize it for
-// reference types, which cannot be done with function templates.
-template <typename T>
-class UniversalPrinter;
-
-template <typename T>
-void UniversalPrint(const T& value, ::std::ostream* os);
-
-// Used to print an STL-style container when the user doesn't define
-// a PrintTo() for it.
-template <typename C>
-void DefaultPrintTo(IsContainer /* dummy */,
- false_type /* is not a pointer */,
- const C& container, ::std::ostream* os) {
- const size_t kMaxCount = 32; // The maximum number of elements to print.
- *os << '{';
- size_t count = 0;
- for (typename C::const_iterator it = container.begin();
- it != container.end(); ++it, ++count) {
- if (count > 0) {
- *os << ',';
- if (count == kMaxCount) { // Enough has been printed.
- *os << " ...";
- break;
- }
- }
- *os << ' ';
- // We cannot call PrintTo(*it, os) here as PrintTo() doesn't
- // handle *it being a native array.
- internal::UniversalPrint(*it, os);
- }
-
- if (count > 0) {
- *os << ' ';
- }
- *os << '}';
-}
-
-// Used to print a pointer that is neither a char pointer nor a member
-// pointer, when the user doesn't define PrintTo() for it. (A member
-// variable pointer or member function pointer doesn't really point to
-// a location in the address space. Their representation is
-// implementation-defined. Therefore they will be printed as raw
-// bytes.)
-template <typename T>
-void DefaultPrintTo(IsNotContainer /* dummy */,
- true_type /* is a pointer */,
- T* p, ::std::ostream* os) {
- if (p == NULL) {
- *os << "NULL";
- } else {
- // C++ doesn't allow casting from a function pointer to any object
- // pointer.
- //
- // IsTrue() silences warnings: "Condition is always true",
- // "unreachable code".
- if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {
- // T is not a function type. We just call << to print p,
- // relying on ADL to pick up user-defined << for their pointer
- // types, if any.
- *os << p;
- } else {
- // T is a function type, so '*os << p' doesn't do what we want
- // (it just prints p as bool). We want to print p as a const
- // void*. However, we cannot cast it to const void* directly,
- // even using reinterpret_cast, as earlier versions of gcc
- // (e.g. 3.4.5) cannot compile the cast when p is a function
- // pointer. Casting to UInt64 first solves the problem.
- *os << reinterpret_cast<const void*>(
- reinterpret_cast<internal::UInt64>(p));
- }
- }
-}
-
-// Used to print a non-container, non-pointer value when the user
-// doesn't define PrintTo() for it.
-template <typename T>
-void DefaultPrintTo(IsNotContainer /* dummy */,
- false_type /* is not a pointer */,
- const T& value, ::std::ostream* os) {
- ::testing_internal::DefaultPrintNonContainerTo(value, os);
-}
-
-// Prints the given value using the << operator if it has one;
-// otherwise prints the bytes in it. This is what
-// UniversalPrinter<T>::Print() does when PrintTo() is not specialized
-// or overloaded for type T.
-//
-// A user can override this behavior for a class type Foo by defining
-// an overload of PrintTo() in the namespace where Foo is defined. We
-// give the user this option as sometimes defining a << operator for
-// Foo is not desirable (e.g. the coding style may prevent doing it,
-// or there is already a << operator but it doesn't do what the user
-// wants).
-template <typename T>
-void PrintTo(const T& value, ::std::ostream* os) {
- // DefaultPrintTo() is overloaded. The type of its first two
- // arguments determine which version will be picked. If T is an
- // STL-style container, the version for container will be called; if
- // T is a pointer, the pointer version will be called; otherwise the
- // generic version will be called.
- //
- // Note that we check for container types here, prior to we check
- // for protocol message types in our operator<<. The rationale is:
- //
- // For protocol messages, we want to give people a chance to
- // override Google Mock's format by defining a PrintTo() or
- // operator<<. For STL containers, other formats can be
- // incompatible with Google Mock's format for the container
- // elements; therefore we check for container types here to ensure
- // that our format is used.
- //
- // The second argument of DefaultPrintTo() is needed to bypass a bug
- // in Symbian's C++ compiler that prevents it from picking the right
- // overload between:
- //
- // PrintTo(const T& x, ...);
- // PrintTo(T* x, ...);
- DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os);
-}
-
-// The following list of PrintTo() overloads tells
-// UniversalPrinter<T>::Print() how to print standard types (built-in
-// types, strings, plain arrays, and pointers).
-
-// Overloads for various char types.
-GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os);
-GTEST_API_ void PrintTo(signed char c, ::std::ostream* os);
-inline void PrintTo(char c, ::std::ostream* os) {
- // When printing a plain char, we always treat it as unsigned. This
- // way, the output won't be affected by whether the compiler thinks
- // char is signed or not.
- PrintTo(static_cast<unsigned char>(c), os);
-}
-
-// Overloads for other simple built-in types.
-inline void PrintTo(bool x, ::std::ostream* os) {
- *os << (x ? "true" : "false");
-}
-
-// Overload for wchar_t type.
-// Prints a wchar_t as a symbol if it is printable or as its internal
-// code otherwise and also as its decimal code (except for L'\0').
-// The L'\0' char is printed as "L'\\0'". The decimal code is printed
-// as signed integer when wchar_t is implemented by the compiler
-// as a signed type and is printed as an unsigned integer when wchar_t
-// is implemented as an unsigned type.
-GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);
-
-// Overloads for C strings.
-GTEST_API_ void PrintTo(const char* s, ::std::ostream* os);
-inline void PrintTo(char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const char*>(s), os);
-}
-
-// signed/unsigned char is often used for representing binary data, so
-// we print pointers to it as void* to be safe.
-inline void PrintTo(const signed char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-inline void PrintTo(signed char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-inline void PrintTo(unsigned char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-
-// MSVC can be configured to define wchar_t as a typedef of unsigned
-// short. It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native
-// type. When wchar_t is a typedef, defining an overload for const
-// wchar_t* would cause unsigned short* be printed as a wide string,
-// possibly causing invalid memory accesses.
-#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
-// Overloads for wide C strings
-GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os);
-inline void PrintTo(wchar_t* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const wchar_t*>(s), os);
-}
-#endif
-
-// Overload for C arrays. Multi-dimensional arrays are printed
-// properly.
-
-// Prints the given number of elements in an array, without printing
-// the curly braces.
-template <typename T>
-void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
- UniversalPrint(a[0], os);
- for (size_t i = 1; i != count; i++) {
- *os << ", ";
- UniversalPrint(a[i], os);
- }
-}
-
-// Overloads for ::string and ::std::string.
-#if GTEST_HAS_GLOBAL_STRING
-GTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os);
-inline void PrintTo(const ::string& s, ::std::ostream* os) {
- PrintStringTo(s, os);
-}
-#endif // GTEST_HAS_GLOBAL_STRING
-
-GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);
-inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
- PrintStringTo(s, os);
-}
-
-// Overloads for ::wstring and ::std::wstring.
-#if GTEST_HAS_GLOBAL_WSTRING
-GTEST_API_ void PrintWideStringTo(const ::wstring&s, ::std::ostream* os);
-inline void PrintTo(const ::wstring& s, ::std::ostream* os) {
- PrintWideStringTo(s, os);
-}
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-#if GTEST_HAS_STD_WSTRING
-GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);
-inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
- PrintWideStringTo(s, os);
-}
-#endif // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_TR1_TUPLE
-// Overload for ::std::tr1::tuple. Needed for printing function arguments,
-// which are packed as tuples.
-
-// Helper function for printing a tuple. T must be instantiated with
-// a tuple type.
-template <typename T>
-void PrintTupleTo(const T& t, ::std::ostream* os);
-
-// Overloaded PrintTo() for tuples of various arities. We support
-// tuples of up-to 10 fields. The following implementation works
-// regardless of whether tr1::tuple is implemented using the
-// non-standard variadic template feature or not.
-
-inline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1>
-void PrintTo(const ::std::tr1::tuple<T1>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2>
-void PrintTo(const ::std::tr1::tuple<T1, T2>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-void PrintTo(
- const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-#endif // GTEST_HAS_TR1_TUPLE
-
-// Overload for std::pair.
-template <typename T1, typename T2>
-void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
- *os << '(';
- // We cannot use UniversalPrint(value.first, os) here, as T1 may be
- // a reference type. The same for printing value.second.
- UniversalPrinter<T1>::Print(value.first, os);
- *os << ", ";
- UniversalPrinter<T2>::Print(value.second, os);
- *os << ')';
-}
-
-// Implements printing a non-reference type T by letting the compiler
-// pick the right overload of PrintTo() for T.
-template <typename T>
-class UniversalPrinter {
- public:
- // MSVC warns about adding const to a function type, so we want to
- // disable the warning.
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4180) // Temporarily disables warning 4180.
-#endif // _MSC_VER
-
- // Note: we deliberately don't call this PrintTo(), as that name
- // conflicts with ::testing::internal::PrintTo in the body of the
- // function.
- static void Print(const T& value, ::std::ostream* os) {
- // By default, ::testing::internal::PrintTo() is used for printing
- // the value.
- //
- // Thanks to Koenig look-up, if T is a class and has its own
- // PrintTo() function defined in its namespace, that function will
- // be visible here. Since it is more specific than the generic ones
- // in ::testing::internal, it will be picked by the compiler in the
- // following statement - exactly what we want.
- PrintTo(value, os);
- }
-
-#ifdef _MSC_VER
-# pragma warning(pop) // Restores the warning state.
-#endif // _MSC_VER
-};
-
-// UniversalPrintArray(begin, len, os) prints an array of 'len'
-// elements, starting at address 'begin'.
-template <typename T>
-void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
- if (len == 0) {
- *os << "{}";
- } else {
- *os << "{ ";
- const size_t kThreshold = 18;
- const size_t kChunkSize = 8;
- // If the array has more than kThreshold elements, we'll have to
- // omit some details by printing only the first and the last
- // kChunkSize elements.
- // TODO(wan@google.com): let the user control the threshold using a flag.
- if (len <= kThreshold) {
- PrintRawArrayTo(begin, len, os);
- } else {
- PrintRawArrayTo(begin, kChunkSize, os);
- *os << ", ..., ";
- PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
- }
- *os << " }";
- }
-}
-// This overload prints a (const) char array compactly.
-GTEST_API_ void UniversalPrintArray(
- const char* begin, size_t len, ::std::ostream* os);
-
-// This overload prints a (const) wchar_t array compactly.
-GTEST_API_ void UniversalPrintArray(
- const wchar_t* begin, size_t len, ::std::ostream* os);
-
-// Implements printing an array type T[N].
-template <typename T, size_t N>
-class UniversalPrinter<T[N]> {
- public:
- // Prints the given array, omitting some elements when there are too
- // many.
- static void Print(const T (&a)[N], ::std::ostream* os) {
- UniversalPrintArray(a, N, os);
- }
-};
-
-// Implements printing a reference type T&.
-template <typename T>
-class UniversalPrinter<T&> {
- public:
- // MSVC warns about adding const to a function type, so we want to
- // disable the warning.
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4180) // Temporarily disables warning 4180.
-#endif // _MSC_VER
-
- static void Print(const T& value, ::std::ostream* os) {
- // Prints the address of the value. We use reinterpret_cast here
- // as static_cast doesn't compile when T is a function type.
- *os << "@" << reinterpret_cast<const void*>(&value) << " ";
-
- // Then prints the value itself.
- UniversalPrint(value, os);
- }
-
-#ifdef _MSC_VER
-# pragma warning(pop) // Restores the warning state.
-#endif // _MSC_VER
-};
-
-// Prints a value tersely: for a reference type, the referenced value
-// (but not the address) is printed; for a (const) char pointer, the
-// NUL-terminated string (but not the pointer) is printed.
-
-template <typename T>
-class UniversalTersePrinter {
- public:
- static void Print(const T& value, ::std::ostream* os) {
- UniversalPrint(value, os);
- }
-};
-template <typename T>
-class UniversalTersePrinter<T&> {
- public:
- static void Print(const T& value, ::std::ostream* os) {
- UniversalPrint(value, os);
- }
-};
-template <typename T, size_t N>
-class UniversalTersePrinter<T[N]> {
- public:
- static void Print(const T (&value)[N], ::std::ostream* os) {
- UniversalPrinter<T[N]>::Print(value, os);
- }
-};
-template <>
-class UniversalTersePrinter<const char*> {
- public:
- static void Print(const char* str, ::std::ostream* os) {
- if (str == NULL) {
- *os << "NULL";
- } else {
- UniversalPrint(string(str), os);
- }
- }
-};
-template <>
-class UniversalTersePrinter<char*> {
- public:
- static void Print(char* str, ::std::ostream* os) {
- UniversalTersePrinter<const char*>::Print(str, os);
- }
-};
-
-#if GTEST_HAS_STD_WSTRING
-template <>
-class UniversalTersePrinter<const wchar_t*> {
- public:
- static void Print(const wchar_t* str, ::std::ostream* os) {
- if (str == NULL) {
- *os << "NULL";
- } else {
- UniversalPrint(::std::wstring(str), os);
- }
- }
-};
-#endif
-
-template <>
-class UniversalTersePrinter<wchar_t*> {
- public:
- static void Print(wchar_t* str, ::std::ostream* os) {
- UniversalTersePrinter<const wchar_t*>::Print(str, os);
- }
-};
-
-template <typename T>
-void UniversalTersePrint(const T& value, ::std::ostream* os) {
- UniversalTersePrinter<T>::Print(value, os);
-}
-
-// Prints a value using the type inferred by the compiler. The
-// difference between this and UniversalTersePrint() is that for a
-// (const) char pointer, this prints both the pointer and the
-// NUL-terminated string.
-template <typename T>
-void UniversalPrint(const T& value, ::std::ostream* os) {
- // A workarond for the bug in VC++ 7.1 that prevents us from instantiating
- // UniversalPrinter with T directly.
- typedef T T1;
- UniversalPrinter<T1>::Print(value, os);
-}
-
-#if GTEST_HAS_TR1_TUPLE
-typedef ::std::vector<string> Strings;
-
-// This helper template allows PrintTo() for tuples and
-// UniversalTersePrintTupleFieldsToStrings() to be defined by
-// induction on the number of tuple fields. The idea is that
-// TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N
-// fields in tuple t, and can be defined in terms of
-// TuplePrefixPrinter<N - 1>.
-
-// The inductive case.
-template <size_t N>
-struct TuplePrefixPrinter {
- // Prints the first N fields of a tuple.
- template <typename Tuple>
- static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
- TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os);
- *os << ", ";
- UniversalPrinter<typename ::std::tr1::tuple_element<N - 1, Tuple>::type>
- ::Print(::std::tr1::get<N - 1>(t), os);
- }
-
- // Tersely prints the first N fields of a tuple to a string vector,
- // one element for each field.
- template <typename Tuple>
- static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
- TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings);
- ::std::stringstream ss;
- UniversalTersePrint(::std::tr1::get<N - 1>(t), &ss);
- strings->push_back(ss.str());
- }
-};
-
-// Base cases.
-template <>
-struct TuplePrefixPrinter<0> {
- template <typename Tuple>
- static void PrintPrefixTo(const Tuple&, ::std::ostream*) {}
-
- template <typename Tuple>
- static void TersePrintPrefixToStrings(const Tuple&, Strings*) {}
-};
-// We have to specialize the entire TuplePrefixPrinter<> class
-// template here, even though the definition of
-// TersePrintPrefixToStrings() is the same as the generic version, as
-// Embarcadero (formerly CodeGear, formerly Borland) C++ doesn't
-// support specializing a method template of a class template.
-template <>
-struct TuplePrefixPrinter<1> {
- template <typename Tuple>
- static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
- UniversalPrinter<typename ::std::tr1::tuple_element<0, Tuple>::type>::
- Print(::std::tr1::get<0>(t), os);
- }
-
- template <typename Tuple>
- static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
- ::std::stringstream ss;
- UniversalTersePrint(::std::tr1::get<0>(t), &ss);
- strings->push_back(ss.str());
- }
-};
-
-// Helper function for printing a tuple. T must be instantiated with
-// a tuple type.
-template <typename T>
-void PrintTupleTo(const T& t, ::std::ostream* os) {
- *os << "(";
- TuplePrefixPrinter< ::std::tr1::tuple_size<T>::value>::
- PrintPrefixTo(t, os);
- *os << ")";
-}
-
-// Prints the fields of a tuple tersely to a string vector, one
-// element for each field. See the comment before
-// UniversalTersePrint() for how we define "tersely".
-template <typename Tuple>
-Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
- Strings result;
- TuplePrefixPrinter< ::std::tr1::tuple_size<Tuple>::value>::
- TersePrintPrefixToStrings(value, &result);
- return result;
-}
-#endif // GTEST_HAS_TR1_TUPLE
-
-} // namespace internal
-
-template <typename T>
-::std::string PrintToString(const T& value) {
- ::std::stringstream ss;
- internal::UniversalTersePrinter<T>::Print(value, &ss);
- return ss.str();
-}
-
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-spi.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-spi.h
deleted file mode 100644
index f63fa9a..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-spi.h
+++ /dev/null
@@ -1,232 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// Utilities for testing Google Test itself and code that uses Google Test
-// (e.g. frameworks built on top of Google Test).
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_
-#define GTEST_INCLUDE_GTEST_GTEST_SPI_H_
-
-#include "gtest/gtest.h"
-
-namespace testing {
-
-// This helper class can be used to mock out Google Test failure reporting
-// so that we can test Google Test or code that builds on Google Test.
-//
-// An object of this class appends a TestPartResult object to the
-// TestPartResultArray object given in the constructor whenever a Google Test
-// failure is reported. It can either intercept only failures that are
-// generated in the same thread that created this object or it can intercept
-// all generated failures. The scope of this mock object can be controlled with
-// the second argument to the two arguments constructor.
-class GTEST_API_ ScopedFakeTestPartResultReporter
- : public TestPartResultReporterInterface {
- public:
- // The two possible mocking modes of this object.
- enum InterceptMode {
- INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures.
- INTERCEPT_ALL_THREADS // Intercepts all failures.
- };
-
- // The c'tor sets this object as the test part result reporter used
- // by Google Test. The 'result' parameter specifies where to report the
- // results. This reporter will only catch failures generated in the current
- // thread. DEPRECATED
- explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
-
- // Same as above, but you can choose the interception scope of this object.
- ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,
- TestPartResultArray* result);
-
- // The d'tor restores the previous test part result reporter.
- virtual ~ScopedFakeTestPartResultReporter();
-
- // Appends the TestPartResult object to the TestPartResultArray
- // received in the constructor.
- //
- // This method is from the TestPartResultReporterInterface
- // interface.
- virtual void ReportTestPartResult(const TestPartResult& result);
- private:
- void Init();
-
- const InterceptMode intercept_mode_;
- TestPartResultReporterInterface* old_reporter_;
- TestPartResultArray* const result_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
-};
-
-namespace internal {
-
-// A helper class for implementing EXPECT_FATAL_FAILURE() and
-// EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given
-// TestPartResultArray contains exactly one failure that has the given
-// type and contains the given substring. If that's not the case, a
-// non-fatal failure will be generated.
-class GTEST_API_ SingleFailureChecker {
- public:
- // The constructor remembers the arguments.
- SingleFailureChecker(const TestPartResultArray* results,
- TestPartResult::Type type,
- const string& substr);
- ~SingleFailureChecker();
- private:
- const TestPartResultArray* const results_;
- const TestPartResult::Type type_;
- const string substr_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
-};
-
-} // namespace internal
-
-} // namespace testing
-
-// A set of macros for testing Google Test assertions or code that's expected
-// to generate Google Test fatal failures. It verifies that the given
-// statement will cause exactly one fatal Google Test failure with 'substr'
-// being part of the failure message.
-//
-// There are two different versions of this macro. EXPECT_FATAL_FAILURE only
-// affects and considers failures generated in the current thread and
-// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
-//
-// The verification of the assertion is done correctly even when the statement
-// throws an exception or aborts the current function.
-//
-// Known restrictions:
-// - 'statement' cannot reference local non-static variables or
-// non-static members of the current object.
-// - 'statement' cannot return a value.
-// - You cannot stream a failure message to this macro.
-//
-// Note that even though the implementations of the following two
-// macros are much alike, we cannot refactor them to use a common
-// helper macro, due to some peculiarity in how the preprocessor
-// works. The AcceptsMacroThatExpandsToUnprotectedComma test in
-// gtest_unittest.cc will fail to compile if we do that.
-#define EXPECT_FATAL_FAILURE(statement, substr) \
- do { \
- class GTestExpectFatalFailureHelper {\
- public:\
- static void Execute() { statement; }\
- };\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter:: \
- INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
- GTestExpectFatalFailureHelper::Execute();\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
- do { \
- class GTestExpectFatalFailureHelper {\
- public:\
- static void Execute() { statement; }\
- };\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter:: \
- INTERCEPT_ALL_THREADS, >est_failures);\
- GTestExpectFatalFailureHelper::Execute();\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-// A macro for testing Google Test assertions or code that's expected to
-// generate Google Test non-fatal failures. It asserts that the given
-// statement will cause exactly one non-fatal Google Test failure with 'substr'
-// being part of the failure message.
-//
-// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
-// affects and considers failures generated in the current thread and
-// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
-//
-// 'statement' is allowed to reference local variables and members of
-// the current object.
-//
-// The verification of the assertion is done correctly even when the statement
-// throws an exception or aborts the current function.
-//
-// Known restrictions:
-// - You cannot stream a failure message to this macro.
-//
-// Note that even though the implementations of the following two
-// macros are much alike, we cannot refactor them to use a common
-// helper macro, due to some peculiarity in how the preprocessor
-// works. If we do that, the code won't compile when the user gives
-// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that
-// expands to code containing an unprotected comma. The
-// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc
-// catches that.
-//
-// For the same reason, we have to write
-// if (::testing::internal::AlwaysTrue()) { statement; }
-// instead of
-// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
-// to avoid an MSVC warning on unreachable code.
-#define EXPECT_NONFATAL_FAILURE(statement, substr) \
- do {\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- >est_failures, ::testing::TestPartResult::kNonFatalFailure, \
- (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter:: \
- INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
- if (::testing::internal::AlwaysTrue()) { statement; }\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
- do {\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- >est_failures, ::testing::TestPartResult::kNonFatalFailure, \
- (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
- >est_failures);\
- if (::testing::internal::AlwaysTrue()) { statement; }\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-test-part.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-test-part.h
deleted file mode 100644
index 77eb844..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-test-part.h
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: mheule@google.com (Markus Heule)
-//
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
-#define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
-
-#include <iosfwd>
-#include <vector>
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-string.h"
-
-namespace testing {
-
-// A copyable object representing the result of a test part (i.e. an
-// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
-//
-// Don't inherit from TestPartResult as its destructor is not virtual.
-class GTEST_API_ TestPartResult {
- public:
- // The possible outcomes of a test part (i.e. an assertion or an
- // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
- enum Type {
- kSuccess, // Succeeded.
- kNonFatalFailure, // Failed but the test can continue.
- kFatalFailure // Failed and the test should be terminated.
- };
-
- // C'tor. TestPartResult does NOT have a default constructor.
- // Always use this constructor (with parameters) to create a
- // TestPartResult object.
- TestPartResult(Type a_type,
- const char* a_file_name,
- int a_line_number,
- const char* a_message)
- : type_(a_type),
- file_name_(a_file_name == NULL ? "" : a_file_name),
- line_number_(a_line_number),
- summary_(ExtractSummary(a_message)),
- message_(a_message) {
- }
-
- // Gets the outcome of the test part.
- Type type() const { return type_; }
-
- // Gets the name of the source file where the test part took place, or
- // NULL if it's unknown.
- const char* file_name() const {
- return file_name_.empty() ? NULL : file_name_.c_str();
- }
-
- // Gets the line in the source file where the test part took place,
- // or -1 if it's unknown.
- int line_number() const { return line_number_; }
-
- // Gets the summary of the failure message.
- const char* summary() const { return summary_.c_str(); }
-
- // Gets the message associated with the test part.
- const char* message() const { return message_.c_str(); }
-
- // Returns true iff the test part passed.
- bool passed() const { return type_ == kSuccess; }
-
- // Returns true iff the test part failed.
- bool failed() const { return type_ != kSuccess; }
-
- // Returns true iff the test part non-fatally failed.
- bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
-
- // Returns true iff the test part fatally failed.
- bool fatally_failed() const { return type_ == kFatalFailure; }
-
- private:
- Type type_;
-
- // Gets the summary of the failure message by omitting the stack
- // trace in it.
- static std::string ExtractSummary(const char* message);
-
- // The name of the source file where the test part took place, or
- // "" if the source file is unknown.
- std::string file_name_;
- // The line in the source file where the test part took place, or -1
- // if the line number is unknown.
- int line_number_;
- std::string summary_; // The test failure summary.
- std::string message_; // The test failure message.
-};
-
-// Prints a TestPartResult object.
-std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
-
-// An array of TestPartResult objects.
-//
-// Don't inherit from TestPartResultArray as its destructor is not
-// virtual.
-class GTEST_API_ TestPartResultArray {
- public:
- TestPartResultArray() {}
-
- // Appends the given TestPartResult to the array.
- void Append(const TestPartResult& result);
-
- // Returns the TestPartResult at the given index (0-based).
- const TestPartResult& GetTestPartResult(int index) const;
-
- // Returns the number of TestPartResult objects in the array.
- int size() const;
-
- private:
- std::vector<TestPartResult> array_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
-};
-
-// This interface knows how to report a test part result.
-class TestPartResultReporterInterface {
- public:
- virtual ~TestPartResultReporterInterface() {}
-
- virtual void ReportTestPartResult(const TestPartResult& result) = 0;
-};
-
-namespace internal {
-
-// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
-// statement generates new fatal failures. To do so it registers itself as the
-// current test part result reporter. Besides checking if fatal failures were
-// reported, it only delegates the reporting to the former result reporter.
-// The original result reporter is restored in the destructor.
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-class GTEST_API_ HasNewFatalFailureHelper
- : public TestPartResultReporterInterface {
- public:
- HasNewFatalFailureHelper();
- virtual ~HasNewFatalFailureHelper();
- virtual void ReportTestPartResult(const TestPartResult& result);
- bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
- private:
- bool has_new_fatal_failure_;
- TestPartResultReporterInterface* original_reporter_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
-};
-
-} // namespace internal
-
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-typed-test.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-typed-test.h
deleted file mode 100644
index fe1e83b..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest-typed-test.h
+++ /dev/null
@@ -1,259 +0,0 @@
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
-
-// This header implements typed tests and type-parameterized tests.
-
-// Typed (aka type-driven) tests repeat the same test for types in a
-// list. You must know which types you want to test with when writing
-// typed tests. Here's how you do it:
-
-#if 0
-
-// First, define a fixture class template. It should be parameterized
-// by a type. Remember to derive it from testing::Test.
-template <typename T>
-class FooTest : public testing::Test {
- public:
- ...
- typedef std::list<T> List;
- static T shared_;
- T value_;
-};
-
-// Next, associate a list of types with the test case, which will be
-// repeated for each type in the list. The typedef is necessary for
-// the macro to parse correctly.
-typedef testing::Types<char, int, unsigned int> MyTypes;
-TYPED_TEST_CASE(FooTest, MyTypes);
-
-// If the type list contains only one type, you can write that type
-// directly without Types<...>:
-// TYPED_TEST_CASE(FooTest, int);
-
-// Then, use TYPED_TEST() instead of TEST_F() to define as many typed
-// tests for this test case as you want.
-TYPED_TEST(FooTest, DoesBlah) {
- // Inside a test, refer to TypeParam to get the type parameter.
- // Since we are inside a derived class template, C++ requires use to
- // visit the members of FooTest via 'this'.
- TypeParam n = this->value_;
-
- // To visit static members of the fixture, add the TestFixture::
- // prefix.
- n += TestFixture::shared_;
-
- // To refer to typedefs in the fixture, add the "typename
- // TestFixture::" prefix.
- typename TestFixture::List values;
- values.push_back(n);
- ...
-}
-
-TYPED_TEST(FooTest, HasPropertyA) { ... }
-
-#endif // 0
-
-// Type-parameterized tests are abstract test patterns parameterized
-// by a type. Compared with typed tests, type-parameterized tests
-// allow you to define the test pattern without knowing what the type
-// parameters are. The defined pattern can be instantiated with
-// different types any number of times, in any number of translation
-// units.
-//
-// If you are designing an interface or concept, you can define a
-// suite of type-parameterized tests to verify properties that any
-// valid implementation of the interface/concept should have. Then,
-// each implementation can easily instantiate the test suite to verify
-// that it conforms to the requirements, without having to write
-// similar tests repeatedly. Here's an example:
-
-#if 0
-
-// First, define a fixture class template. It should be parameterized
-// by a type. Remember to derive it from testing::Test.
-template <typename T>
-class FooTest : public testing::Test {
- ...
-};
-
-// Next, declare that you will define a type-parameterized test case
-// (the _P suffix is for "parameterized" or "pattern", whichever you
-// prefer):
-TYPED_TEST_CASE_P(FooTest);
-
-// Then, use TYPED_TEST_P() to define as many type-parameterized tests
-// for this type-parameterized test case as you want.
-TYPED_TEST_P(FooTest, DoesBlah) {
- // Inside a test, refer to TypeParam to get the type parameter.
- TypeParam n = 0;
- ...
-}
-
-TYPED_TEST_P(FooTest, HasPropertyA) { ... }
-
-// Now the tricky part: you need to register all test patterns before
-// you can instantiate them. The first argument of the macro is the
-// test case name; the rest are the names of the tests in this test
-// case.
-REGISTER_TYPED_TEST_CASE_P(FooTest,
- DoesBlah, HasPropertyA);
-
-// Finally, you are free to instantiate the pattern with the types you
-// want. If you put the above code in a header file, you can #include
-// it in multiple C++ source files and instantiate it multiple times.
-//
-// To distinguish different instances of the pattern, the first
-// argument to the INSTANTIATE_* macro is a prefix that will be added
-// to the actual test case name. Remember to pick unique prefixes for
-// different instances.
-typedef testing::Types<char, int, unsigned int> MyTypes;
-INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
-
-// If the type list contains only one type, you can write that type
-// directly without Types<...>:
-// INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
-
-#endif // 0
-
-#include "gtest/internal/gtest-port.h"
-#include "gtest/internal/gtest-type-util.h"
-
-// Implements typed tests.
-
-#if GTEST_HAS_TYPED_TEST
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the name of the typedef for the type parameters of the
-// given test case.
-# define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
-
-// The 'Types' template argument below must have spaces around it
-// since some compilers may choke on '>>' when passing a template
-// instance (e.g. Types<int>)
-# define TYPED_TEST_CASE(CaseName, Types) \
- typedef ::testing::internal::TypeList< Types >::type \
- GTEST_TYPE_PARAMS_(CaseName)
-
-# define TYPED_TEST(CaseName, TestName) \
- template <typename gtest_TypeParam_> \
- class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
- : public CaseName<gtest_TypeParam_> { \
- private: \
- typedef CaseName<gtest_TypeParam_> TestFixture; \
- typedef gtest_TypeParam_ TypeParam; \
- virtual void TestBody(); \
- }; \
- bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \
- ::testing::internal::TypeParameterizedTest< \
- CaseName, \
- ::testing::internal::TemplateSel< \
- GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \
- GTEST_TYPE_PARAMS_(CaseName)>::Register(\
- "", #CaseName, #TestName, 0); \
- template <typename gtest_TypeParam_> \
- void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody()
-
-#endif // GTEST_HAS_TYPED_TEST
-
-// Implements type-parameterized tests.
-
-#if GTEST_HAS_TYPED_TEST_P
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the namespace name that the type-parameterized tests for
-// the given type-parameterized test case are defined in. The exact
-// name of the namespace is subject to change without notice.
-# define GTEST_CASE_NAMESPACE_(TestCaseName) \
- gtest_case_##TestCaseName##_
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the name of the variable used to remember the names of
-// the defined tests in the given test case.
-# define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
- gtest_typed_test_case_p_state_##TestCaseName##_
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
-//
-// Expands to the name of the variable used to remember the names of
-// the registered tests in the given test case.
-# define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
- gtest_registered_test_names_##TestCaseName##_
-
-// The variables defined in the type-parameterized test macros are
-// static as typically these macros are used in a .h file that can be
-// #included in multiple translation units linked together.
-# define TYPED_TEST_CASE_P(CaseName) \
- static ::testing::internal::TypedTestCasePState \
- GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
-
-# define TYPED_TEST_P(CaseName, TestName) \
- namespace GTEST_CASE_NAMESPACE_(CaseName) { \
- template <typename gtest_TypeParam_> \
- class TestName : public CaseName<gtest_TypeParam_> { \
- private: \
- typedef CaseName<gtest_TypeParam_> TestFixture; \
- typedef gtest_TypeParam_ TypeParam; \
- virtual void TestBody(); \
- }; \
- static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
- GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\
- __FILE__, __LINE__, #CaseName, #TestName); \
- } \
- template <typename gtest_TypeParam_> \
- void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
-
-# define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
- namespace GTEST_CASE_NAMESPACE_(CaseName) { \
- typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
- } \
- static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \
- GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
- __FILE__, __LINE__, #__VA_ARGS__)
-
-// The 'Types' template argument below must have spaces around it
-// since some compilers may choke on '>>' when passing a template
-// instance (e.g. Types<int>)
-# define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
- bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \
- ::testing::internal::TypeParameterizedTestCase<CaseName, \
- GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
- ::testing::internal::TypeList< Types >::type>::Register(\
- #Prefix, #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))
-
-#endif // GTEST_HAS_TYPED_TEST_P
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest.h
deleted file mode 100644
index 6fa0a39..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest.h
+++ /dev/null
@@ -1,2291 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the public API for Google Test. It should be
-// included by any test program that uses Google Test.
-//
-// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
-// leave some internal implementation details in this header file.
-// They are clearly marked by comments like this:
-//
-// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-//
-// Such code is NOT meant to be used by a user directly, and is subject
-// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
-// program!
-//
-// Acknowledgment: Google Test borrowed the idea of automatic test
-// registration from Barthelemy Dagenais' (barthelemy@prologique.com)
-// easyUnit framework.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_H_
-
-#include <limits>
-#include <ostream>
-#include <vector>
-
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-string.h"
-#include "gtest/gtest-death-test.h"
-#include "gtest/gtest-message.h"
-#include "gtest/gtest-param-test.h"
-#include "gtest/gtest-printers.h"
-#include "gtest/gtest_prod.h"
-#include "gtest/gtest-test-part.h"
-#include "gtest/gtest-typed-test.h"
-
-// Depending on the platform, different string classes are available.
-// On Linux, in addition to ::std::string, Google also makes use of
-// class ::string, which has the same interface as ::std::string, but
-// has a different implementation.
-//
-// The user can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that
-// ::string is available AND is a distinct type to ::std::string, or
-// define it to 0 to indicate otherwise.
-//
-// If the user's ::std::string and ::string are the same class due to
-// aliasing, he should define GTEST_HAS_GLOBAL_STRING to 0.
-//
-// If the user doesn't define GTEST_HAS_GLOBAL_STRING, it is defined
-// heuristically.
-
-namespace testing {
-
-// Declares the flags.
-
-// This flag temporary enables the disabled tests.
-GTEST_DECLARE_bool_(also_run_disabled_tests);
-
-// This flag brings the debugger on an assertion failure.
-GTEST_DECLARE_bool_(break_on_failure);
-
-// This flag controls whether Google Test catches all test-thrown exceptions
-// and logs them as failures.
-GTEST_DECLARE_bool_(catch_exceptions);
-
-// This flag enables using colors in terminal output. Available values are
-// "yes" to enable colors, "no" (disable colors), or "auto" (the default)
-// to let Google Test decide.
-GTEST_DECLARE_string_(color);
-
-// This flag sets up the filter to select by name using a glob pattern
-// the tests to run. If the filter is not given all tests are executed.
-GTEST_DECLARE_string_(filter);
-
-// This flag causes the Google Test to list tests. None of the tests listed
-// are actually run if the flag is provided.
-GTEST_DECLARE_bool_(list_tests);
-
-// This flag controls whether Google Test emits a detailed XML report to a file
-// in addition to its normal textual output.
-GTEST_DECLARE_string_(output);
-
-// This flags control whether Google Test prints the elapsed time for each
-// test.
-GTEST_DECLARE_bool_(print_time);
-
-// This flag specifies the random number seed.
-GTEST_DECLARE_int32_(random_seed);
-
-// This flag sets how many times the tests are repeated. The default value
-// is 1. If the value is -1 the tests are repeating forever.
-GTEST_DECLARE_int32_(repeat);
-
-// This flag controls whether Google Test includes Google Test internal
-// stack frames in failure stack traces.
-GTEST_DECLARE_bool_(show_internal_stack_frames);
-
-// When this flag is specified, tests' order is randomized on every iteration.
-GTEST_DECLARE_bool_(shuffle);
-
-// This flag specifies the maximum number of stack frames to be
-// printed in a failure message.
-GTEST_DECLARE_int32_(stack_trace_depth);
-
-// When this flag is specified, a failed assertion will throw an
-// exception if exceptions are enabled, or exit the program with a
-// non-zero code otherwise.
-GTEST_DECLARE_bool_(throw_on_failure);
-
-// When this flag is set with a "host:port" string, on supported
-// platforms test results are streamed to the specified port on
-// the specified host machine.
-GTEST_DECLARE_string_(stream_result_to);
-
-// The upper limit for valid stack trace depths.
-const int kMaxStackTraceDepth = 100;
-
-namespace internal {
-
-class AssertHelper;
-class DefaultGlobalTestPartResultReporter;
-class ExecDeathTest;
-class NoExecDeathTest;
-class FinalSuccessChecker;
-class GTestFlagSaver;
-class StreamingListenerTest;
-class TestResultAccessor;
-class TestEventListenersAccessor;
-class TestEventRepeater;
-class UnitTestRecordPropertyTestHelper;
-class WindowsDeathTest;
-class UnitTestImpl* GetUnitTestImpl();
-void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
- const std::string& message);
-
-} // namespace internal
-
-// The friend relationship of some of these classes is cyclic.
-// If we don't forward declare them the compiler might confuse the classes
-// in friendship clauses with same named classes on the scope.
-class Test;
-class TestCase;
-class TestInfo;
-class UnitTest;
-
-// A class for indicating whether an assertion was successful. When
-// the assertion wasn't successful, the AssertionResult object
-// remembers a non-empty message that describes how it failed.
-//
-// To create an instance of this class, use one of the factory functions
-// (AssertionSuccess() and AssertionFailure()).
-//
-// This class is useful for two purposes:
-// 1. Defining predicate functions to be used with Boolean test assertions
-// EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
-// 2. Defining predicate-format functions to be
-// used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
-//
-// For example, if you define IsEven predicate:
-//
-// testing::AssertionResult IsEven(int n) {
-// if ((n % 2) == 0)
-// return testing::AssertionSuccess();
-// else
-// return testing::AssertionFailure() << n << " is odd";
-// }
-//
-// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
-// will print the message
-//
-// Value of: IsEven(Fib(5))
-// Actual: false (5 is odd)
-// Expected: true
-//
-// instead of a more opaque
-//
-// Value of: IsEven(Fib(5))
-// Actual: false
-// Expected: true
-//
-// in case IsEven is a simple Boolean predicate.
-//
-// If you expect your predicate to be reused and want to support informative
-// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
-// about half as often as positive ones in our tests), supply messages for
-// both success and failure cases:
-//
-// testing::AssertionResult IsEven(int n) {
-// if ((n % 2) == 0)
-// return testing::AssertionSuccess() << n << " is even";
-// else
-// return testing::AssertionFailure() << n << " is odd";
-// }
-//
-// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
-//
-// Value of: IsEven(Fib(6))
-// Actual: true (8 is even)
-// Expected: false
-//
-// NB: Predicates that support negative Boolean assertions have reduced
-// performance in positive ones so be careful not to use them in tests
-// that have lots (tens of thousands) of positive Boolean assertions.
-//
-// To use this class with EXPECT_PRED_FORMAT assertions such as:
-//
-// // Verifies that Foo() returns an even number.
-// EXPECT_PRED_FORMAT1(IsEven, Foo());
-//
-// you need to define:
-//
-// testing::AssertionResult IsEven(const char* expr, int n) {
-// if ((n % 2) == 0)
-// return testing::AssertionSuccess();
-// else
-// return testing::AssertionFailure()
-// << "Expected: " << expr << " is even\n Actual: it's " << n;
-// }
-//
-// If Foo() returns 5, you will see the following message:
-//
-// Expected: Foo() is even
-// Actual: it's 5
-//
-class GTEST_API_ AssertionResult {
- public:
- // Copy constructor.
- // Used in EXPECT_TRUE/FALSE(assertion_result).
- AssertionResult(const AssertionResult& other);
- // Used in the EXPECT_TRUE/FALSE(bool_expression).
- explicit AssertionResult(bool success) : success_(success) {}
-
- // Returns true iff the assertion succeeded.
- operator bool() const { return success_; } // NOLINT
-
- // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
- AssertionResult operator!() const;
-
- // Returns the text streamed into this AssertionResult. Test assertions
- // use it when they fail (i.e., the predicate's outcome doesn't match the
- // assertion's expectation). When nothing has been streamed into the
- // object, returns an empty string.
- const char* message() const {
- return message_.get() != NULL ? message_->c_str() : "";
- }
- // TODO(vladl@google.com): Remove this after making sure no clients use it.
- // Deprecated; please use message() instead.
- const char* failure_message() const { return message(); }
-
- // Streams a custom failure message into this object.
- template <typename T> AssertionResult& operator<<(const T& value) {
- AppendMessage(Message() << value);
- return *this;
- }
-
- // Allows streaming basic output manipulators such as endl or flush into
- // this object.
- AssertionResult& operator<<(
- ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
- AppendMessage(Message() << basic_manipulator);
- return *this;
- }
-
- private:
- // Appends the contents of message to message_.
- void AppendMessage(const Message& a_message) {
- if (message_.get() == NULL)
- message_.reset(new ::std::string);
- message_->append(a_message.GetString().c_str());
- }
-
- // Stores result of the assertion predicate.
- bool success_;
- // Stores the message describing the condition in case the expectation
- // construct is not satisfied with the predicate's outcome.
- // Referenced via a pointer to avoid taking too much stack frame space
- // with test assertions.
- internal::scoped_ptr< ::std::string> message_;
-
- GTEST_DISALLOW_ASSIGN_(AssertionResult);
-};
-
-// Makes a successful assertion result.
-GTEST_API_ AssertionResult AssertionSuccess();
-
-// Makes a failed assertion result.
-GTEST_API_ AssertionResult AssertionFailure();
-
-// Makes a failed assertion result with the given failure message.
-// Deprecated; use AssertionFailure() << msg.
-GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
-
-// The abstract class that all tests inherit from.
-//
-// In Google Test, a unit test program contains one or many TestCases, and
-// each TestCase contains one or many Tests.
-//
-// When you define a test using the TEST macro, you don't need to
-// explicitly derive from Test - the TEST macro automatically does
-// this for you.
-//
-// The only time you derive from Test is when defining a test fixture
-// to be used a TEST_F. For example:
-//
-// class FooTest : public testing::Test {
-// protected:
-// virtual void SetUp() { ... }
-// virtual void TearDown() { ... }
-// ...
-// };
-//
-// TEST_F(FooTest, Bar) { ... }
-// TEST_F(FooTest, Baz) { ... }
-//
-// Test is not copyable.
-class GTEST_API_ Test {
- public:
- friend class TestInfo;
-
- // Defines types for pointers to functions that set up and tear down
- // a test case.
- typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc;
- typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc;
-
- // The d'tor is virtual as we intend to inherit from Test.
- virtual ~Test();
-
- // Sets up the stuff shared by all tests in this test case.
- //
- // Google Test will call Foo::SetUpTestCase() before running the first
- // test in test case Foo. Hence a sub-class can define its own
- // SetUpTestCase() method to shadow the one defined in the super
- // class.
- static void SetUpTestCase() {}
-
- // Tears down the stuff shared by all tests in this test case.
- //
- // Google Test will call Foo::TearDownTestCase() after running the last
- // test in test case Foo. Hence a sub-class can define its own
- // TearDownTestCase() method to shadow the one defined in the super
- // class.
- static void TearDownTestCase() {}
-
- // Returns true iff the current test has a fatal failure.
- static bool HasFatalFailure();
-
- // Returns true iff the current test has a non-fatal failure.
- static bool HasNonfatalFailure();
-
- // Returns true iff the current test has a (either fatal or
- // non-fatal) failure.
- static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
-
- // Logs a property for the current test, test case, or for the entire
- // invocation of the test program when used outside of the context of a
- // test case. Only the last value for a given key is remembered. These
- // are public static so they can be called from utility functions that are
- // not members of the test fixture. Calls to RecordProperty made during
- // lifespan of the test (from the moment its constructor starts to the
- // moment its destructor finishes) will be output in XML as attributes of
- // the <testcase> element. Properties recorded from fixture's
- // SetUpTestCase or TearDownTestCase are logged as attributes of the
- // corresponding <testsuite> element. Calls to RecordProperty made in the
- // global context (before or after invocation of RUN_ALL_TESTS and from
- // SetUp/TearDown method of Environment objects registered with Google
- // Test) will be output as attributes of the <testsuites> element.
- static void RecordProperty(const std::string& key, const std::string& value);
- static void RecordProperty(const std::string& key, int value);
-
- protected:
- // Creates a Test object.
- Test();
-
- // Sets up the test fixture.
- virtual void SetUp();
-
- // Tears down the test fixture.
- virtual void TearDown();
-
- private:
- // Returns true iff the current test has the same fixture class as
- // the first test in the current test case.
- static bool HasSameFixtureClass();
-
- // Runs the test after the test fixture has been set up.
- //
- // A sub-class must implement this to define the test logic.
- //
- // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
- // Instead, use the TEST or TEST_F macro.
- virtual void TestBody() = 0;
-
- // Sets up, executes, and tears down the test.
- void Run();
-
- // Deletes self. We deliberately pick an unusual name for this
- // internal method to avoid clashing with names used in user TESTs.
- void DeleteSelf_() { delete this; }
-
- // Uses a GTestFlagSaver to save and restore all Google Test flags.
- const internal::GTestFlagSaver* const gtest_flag_saver_;
-
- // Often a user mis-spells SetUp() as Setup() and spends a long time
- // wondering why it is never called by Google Test. The declaration of
- // the following method is solely for catching such an error at
- // compile time:
- //
- // - The return type is deliberately chosen to be not void, so it
- // will be a conflict if a user declares void Setup() in his test
- // fixture.
- //
- // - This method is private, so it will be another compiler error
- // if a user calls it from his test fixture.
- //
- // DO NOT OVERRIDE THIS FUNCTION.
- //
- // If you see an error about overriding the following function or
- // about it being private, you have mis-spelled SetUp() as Setup().
- struct Setup_should_be_spelled_SetUp {};
- virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
-
- // We disallow copying Tests.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
-};
-
-typedef internal::TimeInMillis TimeInMillis;
-
-// A copyable object representing a user specified test property which can be
-// output as a key/value string pair.
-//
-// Don't inherit from TestProperty as its destructor is not virtual.
-class TestProperty {
- public:
- // C'tor. TestProperty does NOT have a default constructor.
- // Always use this constructor (with parameters) to create a
- // TestProperty object.
- TestProperty(const std::string& a_key, const std::string& a_value) :
- key_(a_key), value_(a_value) {
- }
-
- // Gets the user supplied key.
- const char* key() const {
- return key_.c_str();
- }
-
- // Gets the user supplied value.
- const char* value() const {
- return value_.c_str();
- }
-
- // Sets a new value, overriding the one supplied in the constructor.
- void SetValue(const std::string& new_value) {
- value_ = new_value;
- }
-
- private:
- // The key supplied by the user.
- std::string key_;
- // The value supplied by the user.
- std::string value_;
-};
-
-// The result of a single Test. This includes a list of
-// TestPartResults, a list of TestProperties, a count of how many
-// death tests there are in the Test, and how much time it took to run
-// the Test.
-//
-// TestResult is not copyable.
-class GTEST_API_ TestResult {
- public:
- // Creates an empty TestResult.
- TestResult();
-
- // D'tor. Do not inherit from TestResult.
- ~TestResult();
-
- // Gets the number of all test parts. This is the sum of the number
- // of successful test parts and the number of failed test parts.
- int total_part_count() const;
-
- // Returns the number of the test properties.
- int test_property_count() const;
-
- // Returns true iff the test passed (i.e. no test part failed).
- bool Passed() const { return !Failed(); }
-
- // Returns true iff the test failed.
- bool Failed() const;
-
- // Returns true iff the test fatally failed.
- bool HasFatalFailure() const;
-
- // Returns true iff the test has a non-fatal failure.
- bool HasNonfatalFailure() const;
-
- // Returns the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const { return elapsed_time_; }
-
- // Returns the i-th test part result among all the results. i can range
- // from 0 to test_property_count() - 1. If i is not in that range, aborts
- // the program.
- const TestPartResult& GetTestPartResult(int i) const;
-
- // Returns the i-th test property. i can range from 0 to
- // test_property_count() - 1. If i is not in that range, aborts the
- // program.
- const TestProperty& GetTestProperty(int i) const;
-
- private:
- friend class TestInfo;
- friend class TestCase;
- friend class UnitTest;
- friend class internal::DefaultGlobalTestPartResultReporter;
- friend class internal::ExecDeathTest;
- friend class internal::TestResultAccessor;
- friend class internal::UnitTestImpl;
- friend class internal::WindowsDeathTest;
-
- // Gets the vector of TestPartResults.
- const std::vector<TestPartResult>& test_part_results() const {
- return test_part_results_;
- }
-
- // Gets the vector of TestProperties.
- const std::vector<TestProperty>& test_properties() const {
- return test_properties_;
- }
-
- // Sets the elapsed time.
- void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
-
- // Adds a test property to the list. The property is validated and may add
- // a non-fatal failure if invalid (e.g., if it conflicts with reserved
- // key names). If a property is already recorded for the same key, the
- // value will be updated, rather than storing multiple values for the same
- // key. xml_element specifies the element for which the property is being
- // recorded and is used for validation.
- void RecordProperty(const std::string& xml_element,
- const TestProperty& test_property);
-
- // Adds a failure if the key is a reserved attribute of Google Test
- // testcase tags. Returns true if the property is valid.
- // TODO(russr): Validate attribute names are legal and human readable.
- static bool ValidateTestProperty(const std::string& xml_element,
- const TestProperty& test_property);
-
- // Adds a test part result to the list.
- void AddTestPartResult(const TestPartResult& test_part_result);
-
- // Returns the death test count.
- int death_test_count() const { return death_test_count_; }
-
- // Increments the death test count, returning the new count.
- int increment_death_test_count() { return ++death_test_count_; }
-
- // Clears the test part results.
- void ClearTestPartResults();
-
- // Clears the object.
- void Clear();
-
- // Protects mutable state of the property vector and of owned
- // properties, whose values may be updated.
- internal::Mutex test_properites_mutex_;
-
- // The vector of TestPartResults
- std::vector<TestPartResult> test_part_results_;
- // The vector of TestProperties
- std::vector<TestProperty> test_properties_;
- // Running count of death tests.
- int death_test_count_;
- // The elapsed time, in milliseconds.
- TimeInMillis elapsed_time_;
-
- // We disallow copying TestResult.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
-}; // class TestResult
-
-// A TestInfo object stores the following information about a test:
-//
-// Test case name
-// Test name
-// Whether the test should be run
-// A function pointer that creates the test object when invoked
-// Test result
-//
-// The constructor of TestInfo registers itself with the UnitTest
-// singleton such that the RUN_ALL_TESTS() macro knows which tests to
-// run.
-class GTEST_API_ TestInfo {
- public:
- // Destructs a TestInfo object. This function is not virtual, so
- // don't inherit from TestInfo.
- ~TestInfo();
-
- // Returns the test case name.
- const char* test_case_name() const { return test_case_name_.c_str(); }
-
- // Returns the test name.
- const char* name() const { return name_.c_str(); }
-
- // Returns the name of the parameter type, or NULL if this is not a typed
- // or a type-parameterized test.
- const char* type_param() const {
- if (type_param_.get() != NULL)
- return type_param_->c_str();
- return NULL;
- }
-
- // Returns the text representation of the value parameter, or NULL if this
- // is not a value-parameterized test.
- const char* value_param() const {
- if (value_param_.get() != NULL)
- return value_param_->c_str();
- return NULL;
- }
-
- // Returns true if this test should run, that is if the test is not
- // disabled (or it is disabled but the also_run_disabled_tests flag has
- // been specified) and its full name matches the user-specified filter.
- //
- // Google Test allows the user to filter the tests by their full names.
- // The full name of a test Bar in test case Foo is defined as
- // "Foo.Bar". Only the tests that match the filter will run.
- //
- // A filter is a colon-separated list of glob (not regex) patterns,
- // optionally followed by a '-' and a colon-separated list of
- // negative patterns (tests to exclude). A test is run if it
- // matches one of the positive patterns and does not match any of
- // the negative patterns.
- //
- // For example, *A*:Foo.* is a filter that matches any string that
- // contains the character 'A' or starts with "Foo.".
- bool should_run() const { return should_run_; }
-
- // Returns true iff this test will appear in the XML report.
- bool is_reportable() const {
- // For now, the XML report includes all tests matching the filter.
- // In the future, we may trim tests that are excluded because of
- // sharding.
- return matches_filter_;
- }
-
- // Returns the result of the test.
- const TestResult* result() const { return &result_; }
-
- private:
-#if GTEST_HAS_DEATH_TEST
- friend class internal::DefaultDeathTestFactory;
-#endif // GTEST_HAS_DEATH_TEST
- friend class Test;
- friend class TestCase;
- friend class internal::UnitTestImpl;
- friend class internal::StreamingListenerTest;
- friend TestInfo* internal::MakeAndRegisterTestInfo(
- const char* test_case_name,
- const char* name,
- const char* type_param,
- const char* value_param,
- internal::TypeId fixture_class_id,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc,
- internal::TestFactoryBase* factory);
-
- // Constructs a TestInfo object. The newly constructed instance assumes
- // ownership of the factory object.
- TestInfo(const std::string& test_case_name,
- const std::string& name,
- const char* a_type_param, // NULL if not a type-parameterized test
- const char* a_value_param, // NULL if not a value-parameterized test
- internal::TypeId fixture_class_id,
- internal::TestFactoryBase* factory);
-
- // Increments the number of death tests encountered in this test so
- // far.
- int increment_death_test_count() {
- return result_.increment_death_test_count();
- }
-
- // Creates the test object, runs it, records its result, and then
- // deletes it.
- void Run();
-
- static void ClearTestResult(TestInfo* test_info) {
- test_info->result_.Clear();
- }
-
- // These fields are immutable properties of the test.
- const std::string test_case_name_; // Test case name
- const std::string name_; // Test name
- // Name of the parameter type, or NULL if this is not a typed or a
- // type-parameterized test.
- const internal::scoped_ptr<const ::std::string> type_param_;
- // Text representation of the value parameter, or NULL if this is not a
- // value-parameterized test.
- const internal::scoped_ptr<const ::std::string> value_param_;
- const internal::TypeId fixture_class_id_; // ID of the test fixture class
- bool should_run_; // True iff this test should run
- bool is_disabled_; // True iff this test is disabled
- bool matches_filter_; // True if this test matches the
- // user-specified filter.
- internal::TestFactoryBase* const factory_; // The factory that creates
- // the test object
-
- // This field is mutable and needs to be reset before running the
- // test for the second time.
- TestResult result_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
-};
-
-// A test case, which consists of a vector of TestInfos.
-//
-// TestCase is not copyable.
-class GTEST_API_ TestCase {
- public:
- // Creates a TestCase with the given name.
- //
- // TestCase does NOT have a default constructor. Always use this
- // constructor to create a TestCase object.
- //
- // Arguments:
- //
- // name: name of the test case
- // a_type_param: the name of the test's type parameter, or NULL if
- // this is not a type-parameterized test.
- // set_up_tc: pointer to the function that sets up the test case
- // tear_down_tc: pointer to the function that tears down the test case
- TestCase(const char* name, const char* a_type_param,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc);
-
- // Destructor of TestCase.
- virtual ~TestCase();
-
- // Gets the name of the TestCase.
- const char* name() const { return name_.c_str(); }
-
- // Returns the name of the parameter type, or NULL if this is not a
- // type-parameterized test case.
- const char* type_param() const {
- if (type_param_.get() != NULL)
- return type_param_->c_str();
- return NULL;
- }
-
- // Returns true if any test in this test case should run.
- bool should_run() const { return should_run_; }
-
- // Gets the number of successful tests in this test case.
- int successful_test_count() const;
-
- // Gets the number of failed tests in this test case.
- int failed_test_count() const;
-
- // Gets the number of disabled tests that will be reported in the XML report.
- int reportable_disabled_test_count() const;
-
- // Gets the number of disabled tests in this test case.
- int disabled_test_count() const;
-
- // Gets the number of tests to be printed in the XML report.
- int reportable_test_count() const;
-
- // Get the number of tests in this test case that should run.
- int test_to_run_count() const;
-
- // Gets the number of all tests in this test case.
- int total_test_count() const;
-
- // Returns true iff the test case passed.
- bool Passed() const { return !Failed(); }
-
- // Returns true iff the test case failed.
- bool Failed() const { return failed_test_count() > 0; }
-
- // Returns the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const { return elapsed_time_; }
-
- // Returns the i-th test among all the tests. i can range from 0 to
- // total_test_count() - 1. If i is not in that range, returns NULL.
- const TestInfo* GetTestInfo(int i) const;
-
- // Returns the TestResult that holds test properties recorded during
- // execution of SetUpTestCase and TearDownTestCase.
- const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; }
-
- private:
- friend class Test;
- friend class internal::UnitTestImpl;
-
- // Gets the (mutable) vector of TestInfos in this TestCase.
- std::vector<TestInfo*>& test_info_list() { return test_info_list_; }
-
- // Gets the (immutable) vector of TestInfos in this TestCase.
- const std::vector<TestInfo*>& test_info_list() const {
- return test_info_list_;
- }
-
- // Returns the i-th test among all the tests. i can range from 0 to
- // total_test_count() - 1. If i is not in that range, returns NULL.
- TestInfo* GetMutableTestInfo(int i);
-
- // Sets the should_run member.
- void set_should_run(bool should) { should_run_ = should; }
-
- // Adds a TestInfo to this test case. Will delete the TestInfo upon
- // destruction of the TestCase object.
- void AddTestInfo(TestInfo * test_info);
-
- // Clears the results of all tests in this test case.
- void ClearResult();
-
- // Clears the results of all tests in the given test case.
- static void ClearTestCaseResult(TestCase* test_case) {
- test_case->ClearResult();
- }
-
- // Runs every test in this TestCase.
- void Run();
-
- // Runs SetUpTestCase() for this TestCase. This wrapper is needed
- // for catching exceptions thrown from SetUpTestCase().
- void RunSetUpTestCase() { (*set_up_tc_)(); }
-
- // Runs TearDownTestCase() for this TestCase. This wrapper is
- // needed for catching exceptions thrown from TearDownTestCase().
- void RunTearDownTestCase() { (*tear_down_tc_)(); }
-
- // Returns true iff test passed.
- static bool TestPassed(const TestInfo* test_info) {
- return test_info->should_run() && test_info->result()->Passed();
- }
-
- // Returns true iff test failed.
- static bool TestFailed(const TestInfo* test_info) {
- return test_info->should_run() && test_info->result()->Failed();
- }
-
- // Returns true iff the test is disabled and will be reported in the XML
- // report.
- static bool TestReportableDisabled(const TestInfo* test_info) {
- return test_info->is_reportable() && test_info->is_disabled_;
- }
-
- // Returns true iff test is disabled.
- static bool TestDisabled(const TestInfo* test_info) {
- return test_info->is_disabled_;
- }
-
- // Returns true iff this test will appear in the XML report.
- static bool TestReportable(const TestInfo* test_info) {
- return test_info->is_reportable();
- }
-
- // Returns true if the given test should run.
- static bool ShouldRunTest(const TestInfo* test_info) {
- return test_info->should_run();
- }
-
- // Shuffles the tests in this test case.
- void ShuffleTests(internal::Random* random);
-
- // Restores the test order to before the first shuffle.
- void UnshuffleTests();
-
- // Name of the test case.
- std::string name_;
- // Name of the parameter type, or NULL if this is not a typed or a
- // type-parameterized test.
- const internal::scoped_ptr<const ::std::string> type_param_;
- // The vector of TestInfos in their original order. It owns the
- // elements in the vector.
- std::vector<TestInfo*> test_info_list_;
- // Provides a level of indirection for the test list to allow easy
- // shuffling and restoring the test order. The i-th element in this
- // vector is the index of the i-th test in the shuffled test list.
- std::vector<int> test_indices_;
- // Pointer to the function that sets up the test case.
- Test::SetUpTestCaseFunc set_up_tc_;
- // Pointer to the function that tears down the test case.
- Test::TearDownTestCaseFunc tear_down_tc_;
- // True iff any test in this test case should run.
- bool should_run_;
- // Elapsed time, in milliseconds.
- TimeInMillis elapsed_time_;
- // Holds test properties recorded during execution of SetUpTestCase and
- // TearDownTestCase.
- TestResult ad_hoc_test_result_;
-
- // We disallow copying TestCases.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);
-};
-
-// An Environment object is capable of setting up and tearing down an
-// environment. The user should subclass this to define his own
-// environment(s).
-//
-// An Environment object does the set-up and tear-down in virtual
-// methods SetUp() and TearDown() instead of the constructor and the
-// destructor, as:
-//
-// 1. You cannot safely throw from a destructor. This is a problem
-// as in some cases Google Test is used where exceptions are enabled, and
-// we may want to implement ASSERT_* using exceptions where they are
-// available.
-// 2. You cannot use ASSERT_* directly in a constructor or
-// destructor.
-class Environment {
- public:
- // The d'tor is virtual as we need to subclass Environment.
- virtual ~Environment() {}
-
- // Override this to define how to set up the environment.
- virtual void SetUp() {}
-
- // Override this to define how to tear down the environment.
- virtual void TearDown() {}
- private:
- // If you see an error about overriding the following function or
- // about it being private, you have mis-spelled SetUp() as Setup().
- struct Setup_should_be_spelled_SetUp {};
- virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
-};
-
-// The interface for tracing execution of tests. The methods are organized in
-// the order the corresponding events are fired.
-class TestEventListener {
- public:
- virtual ~TestEventListener() {}
-
- // Fired before any test activity starts.
- virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
-
- // Fired before each iteration of tests starts. There may be more than
- // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
- // index, starting from 0.
- virtual void OnTestIterationStart(const UnitTest& unit_test,
- int iteration) = 0;
-
- // Fired before environment set-up for each iteration of tests starts.
- virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;
-
- // Fired after environment set-up for each iteration of tests ends.
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
-
- // Fired before the test case starts.
- virtual void OnTestCaseStart(const TestCase& test_case) = 0;
-
- // Fired before the test starts.
- virtual void OnTestStart(const TestInfo& test_info) = 0;
-
- // Fired after a failed assertion or a SUCCEED() invocation.
- virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
-
- // Fired after the test ends.
- virtual void OnTestEnd(const TestInfo& test_info) = 0;
-
- // Fired after the test case ends.
- virtual void OnTestCaseEnd(const TestCase& test_case) = 0;
-
- // Fired before environment tear-down for each iteration of tests starts.
- virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;
-
- // Fired after environment tear-down for each iteration of tests ends.
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
-
- // Fired after each iteration of tests finishes.
- virtual void OnTestIterationEnd(const UnitTest& unit_test,
- int iteration) = 0;
-
- // Fired after all test activities have ended.
- virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
-};
-
-// The convenience class for users who need to override just one or two
-// methods and are not concerned that a possible change to a signature of
-// the methods they override will not be caught during the build. For
-// comments about each method please see the definition of TestEventListener
-// above.
-class EmptyTestEventListener : public TestEventListener {
- public:
- virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
- virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
- int /*iteration*/) {}
- virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {}
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
- virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
- virtual void OnTestStart(const TestInfo& /*test_info*/) {}
- virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {}
- virtual void OnTestEnd(const TestInfo& /*test_info*/) {}
- virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
- virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {}
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
- virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
- int /*iteration*/) {}
- virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
-};
-
-// TestEventListeners lets users add listeners to track events in Google Test.
-class GTEST_API_ TestEventListeners {
- public:
- TestEventListeners();
- ~TestEventListeners();
-
- // Appends an event listener to the end of the list. Google Test assumes
- // the ownership of the listener (i.e. it will delete the listener when
- // the test program finishes).
- void Append(TestEventListener* listener);
-
- // Removes the given event listener from the list and returns it. It then
- // becomes the caller's responsibility to delete the listener. Returns
- // NULL if the listener is not found in the list.
- TestEventListener* Release(TestEventListener* listener);
-
- // Returns the standard listener responsible for the default console
- // output. Can be removed from the listeners list to shut down default
- // console output. Note that removing this object from the listener list
- // with Release transfers its ownership to the caller and makes this
- // function return NULL the next time.
- TestEventListener* default_result_printer() const {
- return default_result_printer_;
- }
-
- // Returns the standard listener responsible for the default XML output
- // controlled by the --gtest_output=xml flag. Can be removed from the
- // listeners list by users who want to shut down the default XML output
- // controlled by this flag and substitute it with custom one. Note that
- // removing this object from the listener list with Release transfers its
- // ownership to the caller and makes this function return NULL the next
- // time.
- TestEventListener* default_xml_generator() const {
- return default_xml_generator_;
- }
-
- private:
- friend class TestCase;
- friend class TestInfo;
- friend class internal::DefaultGlobalTestPartResultReporter;
- friend class internal::NoExecDeathTest;
- friend class internal::TestEventListenersAccessor;
- friend class internal::UnitTestImpl;
-
- // Returns repeater that broadcasts the TestEventListener events to all
- // subscribers.
- TestEventListener* repeater();
-
- // Sets the default_result_printer attribute to the provided listener.
- // The listener is also added to the listener list and previous
- // default_result_printer is removed from it and deleted. The listener can
- // also be NULL in which case it will not be added to the list. Does
- // nothing if the previous and the current listener objects are the same.
- void SetDefaultResultPrinter(TestEventListener* listener);
-
- // Sets the default_xml_generator attribute to the provided listener. The
- // listener is also added to the listener list and previous
- // default_xml_generator is removed from it and deleted. The listener can
- // also be NULL in which case it will not be added to the list. Does
- // nothing if the previous and the current listener objects are the same.
- void SetDefaultXmlGenerator(TestEventListener* listener);
-
- // Controls whether events will be forwarded by the repeater to the
- // listeners in the list.
- bool EventForwardingEnabled() const;
- void SuppressEventForwarding();
-
- // The actual list of listeners.
- internal::TestEventRepeater* repeater_;
- // Listener responsible for the standard result output.
- TestEventListener* default_result_printer_;
- // Listener responsible for the creation of the XML output file.
- TestEventListener* default_xml_generator_;
-
- // We disallow copying TestEventListeners.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
-};
-
-// A UnitTest consists of a vector of TestCases.
-//
-// This is a singleton class. The only instance of UnitTest is
-// created when UnitTest::GetInstance() is first called. This
-// instance is never deleted.
-//
-// UnitTest is not copyable.
-//
-// This class is thread-safe as long as the methods are called
-// according to their specification.
-class GTEST_API_ UnitTest {
- public:
- // Gets the singleton UnitTest object. The first time this method
- // is called, a UnitTest object is constructed and returned.
- // Consecutive calls will return the same object.
- static UnitTest* GetInstance();
-
- // Runs all tests in this UnitTest object and prints the result.
- // Returns 0 if successful, or 1 otherwise.
- //
- // This method can only be called from the main thread.
- //
- // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
- int Run() GTEST_MUST_USE_RESULT_;
-
- // Returns the working directory when the first TEST() or TEST_F()
- // was executed. The UnitTest object owns the string.
- const char* original_working_dir() const;
-
- // Returns the TestCase object for the test that's currently running,
- // or NULL if no test is running.
- const TestCase* current_test_case() const
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Returns the TestInfo object for the test that's currently running,
- // or NULL if no test is running.
- const TestInfo* current_test_info() const
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Returns the random seed used at the start of the current test run.
- int random_seed() const;
-
-#if GTEST_HAS_PARAM_TEST
- // Returns the ParameterizedTestCaseRegistry object used to keep track of
- // value-parameterized tests and instantiate and register them.
- //
- // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
- internal::ParameterizedTestCaseRegistry& parameterized_test_registry()
- GTEST_LOCK_EXCLUDED_(mutex_);
-#endif // GTEST_HAS_PARAM_TEST
-
- // Gets the number of successful test cases.
- int successful_test_case_count() const;
-
- // Gets the number of failed test cases.
- int failed_test_case_count() const;
-
- // Gets the number of all test cases.
- int total_test_case_count() const;
-
- // Gets the number of all test cases that contain at least one test
- // that should run.
- int test_case_to_run_count() const;
-
- // Gets the number of successful tests.
- int successful_test_count() const;
-
- // Gets the number of failed tests.
- int failed_test_count() const;
-
- // Gets the number of disabled tests that will be reported in the XML report.
- int reportable_disabled_test_count() const;
-
- // Gets the number of disabled tests.
- int disabled_test_count() const;
-
- // Gets the number of tests to be printed in the XML report.
- int reportable_test_count() const;
-
- // Gets the number of all tests.
- int total_test_count() const;
-
- // Gets the number of tests that should run.
- int test_to_run_count() const;
-
- // Gets the time of the test program start, in ms from the start of the
- // UNIX epoch.
- TimeInMillis start_timestamp() const;
-
- // Gets the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const;
-
- // Returns true iff the unit test passed (i.e. all test cases passed).
- bool Passed() const;
-
- // Returns true iff the unit test failed (i.e. some test case failed
- // or something outside of all tests failed).
- bool Failed() const;
-
- // Gets the i-th test case among all the test cases. i can range from 0 to
- // total_test_case_count() - 1. If i is not in that range, returns NULL.
- const TestCase* GetTestCase(int i) const;
-
- // Returns the TestResult containing information on test failures and
- // properties logged outside of individual test cases.
- const TestResult& ad_hoc_test_result() const;
-
- // Returns the list of event listeners that can be used to track events
- // inside Google Test.
- TestEventListeners& listeners();
-
- private:
- // Registers and returns a global test environment. When a test
- // program is run, all global test environments will be set-up in
- // the order they were registered. After all tests in the program
- // have finished, all global test environments will be torn-down in
- // the *reverse* order they were registered.
- //
- // The UnitTest object takes ownership of the given environment.
- //
- // This method can only be called from the main thread.
- Environment* AddEnvironment(Environment* env);
-
- // Adds a TestPartResult to the current TestResult object. All
- // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
- // eventually call this to report their results. The user code
- // should use the assertion macros instead of calling this directly.
- void AddTestPartResult(TestPartResult::Type result_type,
- const char* file_name,
- int line_number,
- const std::string& message,
- const std::string& os_stack_trace)
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Adds a TestProperty to the current TestResult object when invoked from
- // inside a test, to current TestCase's ad_hoc_test_result_ when invoked
- // from SetUpTestCase or TearDownTestCase, or to the global property set
- // when invoked elsewhere. If the result already contains a property with
- // the same key, the value will be updated.
- void RecordProperty(const std::string& key, const std::string& value);
-
- // Gets the i-th test case among all the test cases. i can range from 0 to
- // total_test_case_count() - 1. If i is not in that range, returns NULL.
- TestCase* GetMutableTestCase(int i);
-
- // Accessors for the implementation object.
- internal::UnitTestImpl* impl() { return impl_; }
- const internal::UnitTestImpl* impl() const { return impl_; }
-
- // These classes and funcions are friends as they need to access private
- // members of UnitTest.
- friend class Test;
- friend class internal::AssertHelper;
- friend class internal::ScopedTrace;
- friend class internal::StreamingListenerTest;
- friend class internal::UnitTestRecordPropertyTestHelper;
- friend Environment* AddGlobalTestEnvironment(Environment* env);
- friend internal::UnitTestImpl* internal::GetUnitTestImpl();
- friend void internal::ReportFailureInUnknownLocation(
- TestPartResult::Type result_type,
- const std::string& message);
-
- // Creates an empty UnitTest.
- UnitTest();
-
- // D'tor
- virtual ~UnitTest();
-
- // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
- // Google Test trace stack.
- void PushGTestTrace(const internal::TraceInfo& trace)
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Pops a trace from the per-thread Google Test trace stack.
- void PopGTestTrace()
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Protects mutable state in *impl_. This is mutable as some const
- // methods need to lock it too.
- mutable internal::Mutex mutex_;
-
- // Opaque implementation object. This field is never changed once
- // the object is constructed. We don't mark it as const here, as
- // doing so will cause a warning in the constructor of UnitTest.
- // Mutable state in *impl_ is protected by mutex_.
- internal::UnitTestImpl* impl_;
-
- // We disallow copying UnitTest.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
-};
-
-// A convenient wrapper for adding an environment for the test
-// program.
-//
-// You should call this before RUN_ALL_TESTS() is called, probably in
-// main(). If you use gtest_main, you need to call this before main()
-// starts for it to take effect. For example, you can define a global
-// variable like this:
-//
-// testing::Environment* const foo_env =
-// testing::AddGlobalTestEnvironment(new FooEnvironment);
-//
-// However, we strongly recommend you to write your own main() and
-// call AddGlobalTestEnvironment() there, as relying on initialization
-// of global variables makes the code harder to read and may cause
-// problems when you register multiple environments from different
-// translation units and the environments have dependencies among them
-// (remember that the compiler doesn't guarantee the order in which
-// global variables from different translation units are initialized).
-inline Environment* AddGlobalTestEnvironment(Environment* env) {
- return UnitTest::GetInstance()->AddEnvironment(env);
-}
-
-// Initializes Google Test. This must be called before calling
-// RUN_ALL_TESTS(). In particular, it parses a command line for the
-// flags that Google Test recognizes. Whenever a Google Test flag is
-// seen, it is removed from argv, and *argc is decremented.
-//
-// No value is returned. Instead, the Google Test flag variables are
-// updated.
-//
-// Calling the function for the second time has no user-visible effect.
-GTEST_API_ void InitGoogleTest(int* argc, char** argv);
-
-// This overloaded version can be used in Windows programs compiled in
-// UNICODE mode.
-GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
-
-namespace internal {
-
-// FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a
-// value of type ToPrint that is an operand of a comparison assertion
-// (e.g. ASSERT_EQ). OtherOperand is the type of the other operand in
-// the comparison, and is used to help determine the best way to
-// format the value. In particular, when the value is a C string
-// (char pointer) and the other operand is an STL string object, we
-// want to format the C string as a string, since we know it is
-// compared by value with the string object. If the value is a char
-// pointer but the other operand is not an STL string object, we don't
-// know whether the pointer is supposed to point to a NUL-terminated
-// string, and thus want to print it as a pointer to be safe.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-
-// The default case.
-template <typename ToPrint, typename OtherOperand>
-class FormatForComparison {
- public:
- static ::std::string Format(const ToPrint& value) {
- return ::testing::PrintToString(value);
- }
-};
-
-// Array.
-template <typename ToPrint, size_t N, typename OtherOperand>
-class FormatForComparison<ToPrint[N], OtherOperand> {
- public:
- static ::std::string Format(const ToPrint* value) {
- return FormatForComparison<const ToPrint*, OtherOperand>::Format(value);
- }
-};
-
-// By default, print C string as pointers to be safe, as we don't know
-// whether they actually point to a NUL-terminated string.
-
-#define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType) \
- template <typename OtherOperand> \
- class FormatForComparison<CharType*, OtherOperand> { \
- public: \
- static ::std::string Format(CharType* value) { \
- return ::testing::PrintToString(static_cast<const void*>(value)); \
- } \
- }
-
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
-
-#undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
-
-// If a C string is compared with an STL string object, we know it's meant
-// to point to a NUL-terminated string, and thus can print it as a string.
-
-#define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
- template <> \
- class FormatForComparison<CharType*, OtherStringType> { \
- public: \
- static ::std::string Format(CharType* value) { \
- return ::testing::PrintToString(value); \
- } \
- }
-
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);
-
-#if GTEST_HAS_GLOBAL_STRING
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string);
-#endif
-
-#if GTEST_HAS_GLOBAL_WSTRING
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring);
-#endif
-
-#if GTEST_HAS_STD_WSTRING
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);
-#endif
-
-#undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_
-
-// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
-// operand to be used in a failure message. The type (but not value)
-// of the other operand may affect the format. This allows us to
-// print a char* as a raw pointer when it is compared against another
-// char* or void*, and print it as a C string when it is compared
-// against an std::string object, for example.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-template <typename T1, typename T2>
-std::string FormatForComparisonFailureMessage(
- const T1& value, const T2& /* other_operand */) {
- return FormatForComparison<T1, T2>::Format(value);
-}
-
-// The helper function for {ASSERT|EXPECT}_EQ.
-template <typename T1, typename T2>
-AssertionResult CmpHelperEQ(const char* expected_expression,
- const char* actual_expression,
- const T1& expected,
- const T2& actual) {
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4389) // Temporarily disables warning on
- // signed/unsigned mismatch.
-#endif
-
- if (expected == actual) {
- return AssertionSuccess();
- }
-
-#ifdef _MSC_VER
-# pragma warning(pop) // Restores the warning state.
-#endif
-
- return EqFailure(expected_expression,
- actual_expression,
- FormatForComparisonFailureMessage(expected, actual),
- FormatForComparisonFailureMessage(actual, expected),
- false);
-}
-
-// With this overloaded version, we allow anonymous enums to be used
-// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
-// can be implicitly cast to BiggestInt.
-GTEST_API_ AssertionResult CmpHelperEQ(const char* expected_expression,
- const char* actual_expression,
- BiggestInt expected,
- BiggestInt actual);
-
-// The helper class for {ASSERT|EXPECT}_EQ. The template argument
-// lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
-// is a null pointer literal. The following default implementation is
-// for lhs_is_null_literal being false.
-template <bool lhs_is_null_literal>
-class EqHelper {
- public:
- // This templatized version is for the general case.
- template <typename T1, typename T2>
- static AssertionResult Compare(const char* expected_expression,
- const char* actual_expression,
- const T1& expected,
- const T2& actual) {
- return CmpHelperEQ(expected_expression, actual_expression, expected,
- actual);
- }
-
- // With this overloaded version, we allow anonymous enums to be used
- // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
- // enums can be implicitly cast to BiggestInt.
- //
- // Even though its body looks the same as the above version, we
- // cannot merge the two, as it will make anonymous enums unhappy.
- static AssertionResult Compare(const char* expected_expression,
- const char* actual_expression,
- BiggestInt expected,
- BiggestInt actual) {
- return CmpHelperEQ(expected_expression, actual_expression, expected,
- actual);
- }
-};
-
-// This specialization is used when the first argument to ASSERT_EQ()
-// is a null pointer literal, like NULL, false, or 0.
-template <>
-class EqHelper<true> {
- public:
- // We define two overloaded versions of Compare(). The first
- // version will be picked when the second argument to ASSERT_EQ() is
- // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or
- // EXPECT_EQ(false, a_bool).
- template <typename T1, typename T2>
- static AssertionResult Compare(
- const char* expected_expression,
- const char* actual_expression,
- const T1& expected,
- const T2& actual,
- // The following line prevents this overload from being considered if T2
- // is not a pointer type. We need this because ASSERT_EQ(NULL, my_ptr)
- // expands to Compare("", "", NULL, my_ptr), which requires a conversion
- // to match the Secret* in the other overload, which would otherwise make
- // this template match better.
- typename EnableIf<!is_pointer<T2>::value>::type* = 0) {
- return CmpHelperEQ(expected_expression, actual_expression, expected,
- actual);
- }
-
- // This version will be picked when the second argument to ASSERT_EQ() is a
- // pointer, e.g. ASSERT_EQ(NULL, a_pointer).
- template <typename T>
- static AssertionResult Compare(
- const char* expected_expression,
- const char* actual_expression,
- // We used to have a second template parameter instead of Secret*. That
- // template parameter would deduce to 'long', making this a better match
- // than the first overload even without the first overload's EnableIf.
- // Unfortunately, gcc with -Wconversion-null warns when "passing NULL to
- // non-pointer argument" (even a deduced integral argument), so the old
- // implementation caused warnings in user code.
- Secret* /* expected (NULL) */,
- T* actual) {
- // We already know that 'expected' is a null pointer.
- return CmpHelperEQ(expected_expression, actual_expression,
- static_cast<T*>(NULL), actual);
- }
-};
-
-// A macro for implementing the helper functions needed to implement
-// ASSERT_?? and EXPECT_??. It is here just to avoid copy-and-paste
-// of similar code.
-//
-// For each templatized helper function, we also define an overloaded
-// version for BiggestInt in order to reduce code bloat and allow
-// anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled
-// with gcc 4.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
-template <typename T1, typename T2>\
-AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
- const T1& val1, const T2& val2) {\
- if (val1 op val2) {\
- return AssertionSuccess();\
- } else {\
- return AssertionFailure() \
- << "Expected: (" << expr1 << ") " #op " (" << expr2\
- << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
- << " vs " << FormatForComparisonFailureMessage(val2, val1);\
- }\
-}\
-GTEST_API_ AssertionResult CmpHelper##op_name(\
- const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-
-// Implements the helper function for {ASSERT|EXPECT}_NE
-GTEST_IMPL_CMP_HELPER_(NE, !=);
-// Implements the helper function for {ASSERT|EXPECT}_LE
-GTEST_IMPL_CMP_HELPER_(LE, <=);
-// Implements the helper function for {ASSERT|EXPECT}_LT
-GTEST_IMPL_CMP_HELPER_(LT, <);
-// Implements the helper function for {ASSERT|EXPECT}_GE
-GTEST_IMPL_CMP_HELPER_(GE, >=);
-// Implements the helper function for {ASSERT|EXPECT}_GT
-GTEST_IMPL_CMP_HELPER_(GT, >);
-
-#undef GTEST_IMPL_CMP_HELPER_
-
-// The helper function for {ASSERT|EXPECT}_STREQ.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual);
-
-// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual);
-
-// The helper function for {ASSERT|EXPECT}_STRNE.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2);
-
-// The helper function for {ASSERT|EXPECT}_STRCASENE.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2);
-
-
-// Helper function for *_STREQ on wide strings.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const wchar_t* expected,
- const wchar_t* actual);
-
-// Helper function for *_STRNE on wide strings.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const wchar_t* s1,
- const wchar_t* s2);
-
-} // namespace internal
-
-// IsSubstring() and IsNotSubstring() are intended to be used as the
-// first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
-// themselves. They check whether needle is a substring of haystack
-// (NULL is considered a substring of itself only), and return an
-// appropriate error message when they fail.
-//
-// The {needle,haystack}_expr arguments are the stringified
-// expressions that generated the two real arguments.
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const char* needle, const char* haystack);
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const wchar_t* needle, const wchar_t* haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const char* needle, const char* haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const wchar_t* needle, const wchar_t* haystack);
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::string& needle, const ::std::string& haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::string& needle, const ::std::string& haystack);
-
-#if GTEST_HAS_STD_WSTRING
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::wstring& needle, const ::std::wstring& haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::wstring& needle, const ::std::wstring& haystack);
-#endif // GTEST_HAS_STD_WSTRING
-
-namespace internal {
-
-// Helper template function for comparing floating-points.
-//
-// Template parameter:
-//
-// RawType: the raw floating-point type (either float or double)
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-template <typename RawType>
-AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
- const char* actual_expression,
- RawType expected,
- RawType actual) {
- const FloatingPoint<RawType> lhs(expected), rhs(actual);
-
- if (lhs.AlmostEquals(rhs)) {
- return AssertionSuccess();
- }
-
- ::std::stringstream expected_ss;
- expected_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << expected;
-
- ::std::stringstream actual_ss;
- actual_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << actual;
-
- return EqFailure(expected_expression,
- actual_expression,
- StringStreamToString(&expected_ss),
- StringStreamToString(&actual_ss),
- false);
-}
-
-// Helper function for implementing ASSERT_NEAR.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
- const char* expr2,
- const char* abs_error_expr,
- double val1,
- double val2,
- double abs_error);
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-// A class that enables one to stream messages to assertion macros
-class GTEST_API_ AssertHelper {
- public:
- // Constructor.
- AssertHelper(TestPartResult::Type type,
- const char* file,
- int line,
- const char* message);
- ~AssertHelper();
-
- // Message assignment is a semantic trick to enable assertion
- // streaming; see the GTEST_MESSAGE_ macro below.
- void operator=(const Message& message) const;
-
- private:
- // We put our data in a struct so that the size of the AssertHelper class can
- // be as small as possible. This is important because gcc is incapable of
- // re-using stack space even for temporary variables, so every EXPECT_EQ
- // reserves stack space for another AssertHelper.
- struct AssertHelperData {
- AssertHelperData(TestPartResult::Type t,
- const char* srcfile,
- int line_num,
- const char* msg)
- : type(t), file(srcfile), line(line_num), message(msg) { }
-
- TestPartResult::Type const type;
- const char* const file;
- int const line;
- std::string const message;
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
- };
-
- AssertHelperData* const data_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
-};
-
-} // namespace internal
-
-#if GTEST_HAS_PARAM_TEST
-// The pure interface class that all value-parameterized tests inherit from.
-// A value-parameterized class must inherit from both ::testing::Test and
-// ::testing::WithParamInterface. In most cases that just means inheriting
-// from ::testing::TestWithParam, but more complicated test hierarchies
-// may need to inherit from Test and WithParamInterface at different levels.
-//
-// This interface has support for accessing the test parameter value via
-// the GetParam() method.
-//
-// Use it with one of the parameter generator defining functions, like Range(),
-// Values(), ValuesIn(), Bool(), and Combine().
-//
-// class FooTest : public ::testing::TestWithParam<int> {
-// protected:
-// FooTest() {
-// // Can use GetParam() here.
-// }
-// virtual ~FooTest() {
-// // Can use GetParam() here.
-// }
-// virtual void SetUp() {
-// // Can use GetParam() here.
-// }
-// virtual void TearDown {
-// // Can use GetParam() here.
-// }
-// };
-// TEST_P(FooTest, DoesBar) {
-// // Can use GetParam() method here.
-// Foo foo;
-// ASSERT_TRUE(foo.DoesBar(GetParam()));
-// }
-// INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
-
-template <typename T>
-class WithParamInterface {
- public:
- typedef T ParamType;
- virtual ~WithParamInterface() {}
-
- // The current parameter value. Is also available in the test fixture's
- // constructor. This member function is non-static, even though it only
- // references static data, to reduce the opportunity for incorrect uses
- // like writing 'WithParamInterface<bool>::GetParam()' for a test that
- // uses a fixture whose parameter type is int.
- const ParamType& GetParam() const {
- GTEST_CHECK_(parameter_ != NULL)
- << "GetParam() can only be called inside a value-parameterized test "
- << "-- did you intend to write TEST_P instead of TEST_F?";
- return *parameter_;
- }
-
- private:
- // Sets parameter value. The caller is responsible for making sure the value
- // remains alive and unchanged throughout the current test.
- static void SetParam(const ParamType* parameter) {
- parameter_ = parameter;
- }
-
- // Static value used for accessing parameter during a test lifetime.
- static const ParamType* parameter_;
-
- // TestClass must be a subclass of WithParamInterface<T> and Test.
- template <class TestClass> friend class internal::ParameterizedTestFactory;
-};
-
-template <typename T>
-const T* WithParamInterface<T>::parameter_ = NULL;
-
-// Most value-parameterized classes can ignore the existence of
-// WithParamInterface, and can just inherit from ::testing::TestWithParam.
-
-template <typename T>
-class TestWithParam : public Test, public WithParamInterface<T> {
-};
-
-#endif // GTEST_HAS_PARAM_TEST
-
-// Macros for indicating success/failure in test code.
-
-// ADD_FAILURE unconditionally adds a failure to the current test.
-// SUCCEED generates a success - it doesn't automatically make the
-// current test successful, as a test is only successful when it has
-// no failure.
-//
-// EXPECT_* verifies that a certain condition is satisfied. If not,
-// it behaves like ADD_FAILURE. In particular:
-//
-// EXPECT_TRUE verifies that a Boolean condition is true.
-// EXPECT_FALSE verifies that a Boolean condition is false.
-//
-// FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
-// that they will also abort the current function on failure. People
-// usually want the fail-fast behavior of FAIL and ASSERT_*, but those
-// writing data-driven tests often find themselves using ADD_FAILURE
-// and EXPECT_* more.
-
-// Generates a nonfatal failure with a generic message.
-#define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
-
-// Generates a nonfatal failure at the given source file location with
-// a generic message.
-#define ADD_FAILURE_AT(file, line) \
- GTEST_MESSAGE_AT_(file, line, "Failed", \
- ::testing::TestPartResult::kNonFatalFailure)
-
-// Generates a fatal failure with a generic message.
-#define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
-
-// Define this macro to 1 to omit the definition of FAIL(), which is a
-// generic name and clashes with some other libraries.
-#if !GTEST_DONT_DEFINE_FAIL
-# define FAIL() GTEST_FAIL()
-#endif
-
-// Generates a success with a generic message.
-#define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
-
-// Define this macro to 1 to omit the definition of SUCCEED(), which
-// is a generic name and clashes with some other libraries.
-#if !GTEST_DONT_DEFINE_SUCCEED
-# define SUCCEED() GTEST_SUCCEED()
-#endif
-
-// Macros for testing exceptions.
-//
-// * {ASSERT|EXPECT}_THROW(statement, expected_exception):
-// Tests that the statement throws the expected exception.
-// * {ASSERT|EXPECT}_NO_THROW(statement):
-// Tests that the statement doesn't throw any exception.
-// * {ASSERT|EXPECT}_ANY_THROW(statement):
-// Tests that the statement throws an exception.
-
-#define EXPECT_THROW(statement, expected_exception) \
- GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_NO_THROW(statement) \
- GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_ANY_THROW(statement) \
- GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_THROW(statement, expected_exception) \
- GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
-#define ASSERT_NO_THROW(statement) \
- GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
-#define ASSERT_ANY_THROW(statement) \
- GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
-
-// Boolean assertions. Condition can be either a Boolean expression or an
-// AssertionResult. For more information on how to use AssertionResult with
-// these macros see comments on that class.
-#define EXPECT_TRUE(condition) \
- GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
- GTEST_NONFATAL_FAILURE_)
-#define EXPECT_FALSE(condition) \
- GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
- GTEST_NONFATAL_FAILURE_)
-#define ASSERT_TRUE(condition) \
- GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
- GTEST_FATAL_FAILURE_)
-#define ASSERT_FALSE(condition) \
- GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
- GTEST_FATAL_FAILURE_)
-
-// Includes the auto-generated header that implements a family of
-// generic predicate assertion macros.
-#include "gtest/gtest_pred_impl.h"
-
-// Macros for testing equalities and inequalities.
-//
-// * {ASSERT|EXPECT}_EQ(expected, actual): Tests that expected == actual
-// * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2
-// * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2
-// * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2
-// * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2
-// * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2
-//
-// When they are not, Google Test prints both the tested expressions and
-// their actual values. The values must be compatible built-in types,
-// or you will get a compiler error. By "compatible" we mean that the
-// values can be compared by the respective operator.
-//
-// Note:
-//
-// 1. It is possible to make a user-defined type work with
-// {ASSERT|EXPECT}_??(), but that requires overloading the
-// comparison operators and is thus discouraged by the Google C++
-// Usage Guide. Therefore, you are advised to use the
-// {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
-// equal.
-//
-// 2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
-// pointers (in particular, C strings). Therefore, if you use it
-// with two C strings, you are testing how their locations in memory
-// are related, not how their content is related. To compare two C
-// strings by content, use {ASSERT|EXPECT}_STR*().
-//
-// 3. {ASSERT|EXPECT}_EQ(expected, actual) is preferred to
-// {ASSERT|EXPECT}_TRUE(expected == actual), as the former tells you
-// what the actual value is when it fails, and similarly for the
-// other comparisons.
-//
-// 4. Do not depend on the order in which {ASSERT|EXPECT}_??()
-// evaluate their arguments, which is undefined.
-//
-// 5. These macros evaluate their arguments exactly once.
-//
-// Examples:
-//
-// EXPECT_NE(5, Foo());
-// EXPECT_EQ(NULL, a_pointer);
-// ASSERT_LT(i, array_size);
-// ASSERT_GT(records.size(), 0) << "There is no record left.";
-
-#define EXPECT_EQ(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal:: \
- EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
- expected, actual)
-#define EXPECT_NE(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual)
-#define EXPECT_LE(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
-#define EXPECT_LT(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
-#define EXPECT_GE(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
-#define EXPECT_GT(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
-
-#define GTEST_ASSERT_EQ(expected, actual) \
- ASSERT_PRED_FORMAT2(::testing::internal:: \
- EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
- expected, actual)
-#define GTEST_ASSERT_NE(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
-#define GTEST_ASSERT_LE(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
-#define GTEST_ASSERT_LT(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
-#define GTEST_ASSERT_GE(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
-#define GTEST_ASSERT_GT(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
-
-// Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of
-// ASSERT_XY(), which clashes with some users' own code.
-
-#if !GTEST_DONT_DEFINE_ASSERT_EQ
-# define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_NE
-# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_LE
-# define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_LT
-# define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_GE
-# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_GT
-# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
-#endif
-
-// C-string Comparisons. All tests treat NULL and any non-NULL string
-// as different. Two NULLs are equal.
-//
-// * {ASSERT|EXPECT}_STREQ(s1, s2): Tests that s1 == s2
-// * {ASSERT|EXPECT}_STRNE(s1, s2): Tests that s1 != s2
-// * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
-// * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
-//
-// For wide or narrow string objects, you can use the
-// {ASSERT|EXPECT}_??() macros.
-//
-// Don't depend on the order in which the arguments are evaluated,
-// which is undefined.
-//
-// These macros evaluate their arguments exactly once.
-
-#define EXPECT_STREQ(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
-#define EXPECT_STRNE(s1, s2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
-#define EXPECT_STRCASEEQ(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
-#define EXPECT_STRCASENE(s1, s2)\
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
-
-#define ASSERT_STREQ(expected, actual) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
-#define ASSERT_STRNE(s1, s2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
-#define ASSERT_STRCASEEQ(expected, actual) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
-#define ASSERT_STRCASENE(s1, s2)\
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
-
-// Macros for comparing floating-point numbers.
-//
-// * {ASSERT|EXPECT}_FLOAT_EQ(expected, actual):
-// Tests that two float values are almost equal.
-// * {ASSERT|EXPECT}_DOUBLE_EQ(expected, actual):
-// Tests that two double values are almost equal.
-// * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
-// Tests that v1 and v2 are within the given distance to each other.
-//
-// Google Test uses ULP-based comparison to automatically pick a default
-// error bound that is appropriate for the operands. See the
-// FloatingPoint template class in gtest-internal.h if you are
-// interested in the implementation details.
-
-#define EXPECT_FLOAT_EQ(expected, actual)\
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
- expected, actual)
-
-#define EXPECT_DOUBLE_EQ(expected, actual)\
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
- expected, actual)
-
-#define ASSERT_FLOAT_EQ(expected, actual)\
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
- expected, actual)
-
-#define ASSERT_DOUBLE_EQ(expected, actual)\
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
- expected, actual)
-
-#define EXPECT_NEAR(val1, val2, abs_error)\
- EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
- val1, val2, abs_error)
-
-#define ASSERT_NEAR(val1, val2, abs_error)\
- ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
- val1, val2, abs_error)
-
-// These predicate format functions work on floating-point values, and
-// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
-//
-// EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
-
-// Asserts that val1 is less than, or almost equal to, val2. Fails
-// otherwise. In particular, it fails if either val1 or val2 is NaN.
-GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
- float val1, float val2);
-GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
- double val1, double val2);
-
-
-#if GTEST_OS_WINDOWS
-
-// Macros that test for HRESULT failure and success, these are only useful
-// on Windows, and rely on Windows SDK macros and APIs to compile.
-//
-// * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
-//
-// When expr unexpectedly fails or succeeds, Google Test prints the
-// expected result and the actual result with both a human-readable
-// string representation of the error, if available, as well as the
-// hex result code.
-# define EXPECT_HRESULT_SUCCEEDED(expr) \
- EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
-
-# define ASSERT_HRESULT_SUCCEEDED(expr) \
- ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
-
-# define EXPECT_HRESULT_FAILED(expr) \
- EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
-
-# define ASSERT_HRESULT_FAILED(expr) \
- ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
-
-#endif // GTEST_OS_WINDOWS
-
-// Macros that execute statement and check that it doesn't generate new fatal
-// failures in the current thread.
-//
-// * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
-//
-// Examples:
-//
-// EXPECT_NO_FATAL_FAILURE(Process());
-// ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
-//
-#define ASSERT_NO_FATAL_FAILURE(statement) \
- GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
-#define EXPECT_NO_FATAL_FAILURE(statement) \
- GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
-
-// Causes a trace (including the source file path, the current line
-// number, and the given message) to be included in every test failure
-// message generated by code in the current scope. The effect is
-// undone when the control leaves the current scope.
-//
-// The message argument can be anything streamable to std::ostream.
-//
-// In the implementation, we include the current line number as part
-// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
-// to appear in the same block - as long as they are on different
-// lines.
-#define SCOPED_TRACE(message) \
- ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
- __FILE__, __LINE__, ::testing::Message() << (message))
-
-// Compile-time assertion for type equality.
-// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
-// the same type. The value it returns is not interesting.
-//
-// Instead of making StaticAssertTypeEq a class template, we make it a
-// function template that invokes a helper class template. This
-// prevents a user from misusing StaticAssertTypeEq<T1, T2> by
-// defining objects of that type.
-//
-// CAVEAT:
-//
-// When used inside a method of a class template,
-// StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
-// instantiated. For example, given:
-//
-// template <typename T> class Foo {
-// public:
-// void Bar() { testing::StaticAssertTypeEq<int, T>(); }
-// };
-//
-// the code:
-//
-// void Test1() { Foo<bool> foo; }
-//
-// will NOT generate a compiler error, as Foo<bool>::Bar() is never
-// actually instantiated. Instead, you need:
-//
-// void Test2() { Foo<bool> foo; foo.Bar(); }
-//
-// to cause a compiler error.
-template <typename T1, typename T2>
-bool StaticAssertTypeEq() {
- (void)internal::StaticAssertTypeEqHelper<T1, T2>();
- return true;
-}
-
-// Defines a test.
-//
-// The first parameter is the name of the test case, and the second
-// parameter is the name of the test within the test case.
-//
-// The convention is to end the test case name with "Test". For
-// example, a test case for the Foo class can be named FooTest.
-//
-// The user should put his test code between braces after using this
-// macro. Example:
-//
-// TEST(FooTest, InitializesCorrectly) {
-// Foo foo;
-// EXPECT_TRUE(foo.StatusIsOK());
-// }
-
-// Note that we call GetTestTypeId() instead of GetTypeId<
-// ::testing::Test>() here to get the type ID of testing::Test. This
-// is to work around a suspected linker bug when using Google Test as
-// a framework on Mac OS X. The bug causes GetTypeId<
-// ::testing::Test>() to return different values depending on whether
-// the call is from the Google Test framework itself or from user test
-// code. GetTestTypeId() is guaranteed to always return the same
-// value, as it always calls GetTypeId<>() from the Google Test
-// framework.
-#define GTEST_TEST(test_case_name, test_name)\
- GTEST_TEST_(test_case_name, test_name, \
- ::testing::Test, ::testing::internal::GetTestTypeId())
-
-// Define this macro to 1 to omit the definition of TEST(), which
-// is a generic name and clashes with some other libraries.
-#if !GTEST_DONT_DEFINE_TEST
-# define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
-#endif
-
-// Defines a test that uses a test fixture.
-//
-// The first parameter is the name of the test fixture class, which
-// also doubles as the test case name. The second parameter is the
-// name of the test within the test case.
-//
-// A test fixture class must be declared earlier. The user should put
-// his test code between braces after using this macro. Example:
-//
-// class FooTest : public testing::Test {
-// protected:
-// virtual void SetUp() { b_.AddElement(3); }
-//
-// Foo a_;
-// Foo b_;
-// };
-//
-// TEST_F(FooTest, InitializesCorrectly) {
-// EXPECT_TRUE(a_.StatusIsOK());
-// }
-//
-// TEST_F(FooTest, ReturnsElementCountCorrectly) {
-// EXPECT_EQ(0, a_.size());
-// EXPECT_EQ(1, b_.size());
-// }
-
-#define TEST_F(test_fixture, test_name)\
- GTEST_TEST_(test_fixture, test_name, test_fixture, \
- ::testing::internal::GetTypeId<test_fixture>())
-
-} // namespace testing
-
-// Use this function in main() to run all tests. It returns 0 if all
-// tests are successful, or 1 otherwise.
-//
-// RUN_ALL_TESTS() should be invoked after the command line has been
-// parsed by InitGoogleTest().
-//
-// This function was formerly a macro; thus, it is in the global
-// namespace and has an all-caps name.
-int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;
-
-inline int RUN_ALL_TESTS() {
- return ::testing::UnitTest::GetInstance()->Run();
-}
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest_pred_impl.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest_pred_impl.h
deleted file mode 100644
index 30ae712..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest_pred_impl.h
+++ /dev/null
@@ -1,358 +0,0 @@
-// Copyright 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command
-// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
-//
-// Implements a family of generic predicate assertion macros.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
-
-// Makes sure this header is not included before gtest.h.
-#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
-# error Do not include gtest_pred_impl.h directly. Include gtest.h instead.
-#endif // GTEST_INCLUDE_GTEST_GTEST_H_
-
-// This header implements a family of generic predicate assertion
-// macros:
-//
-// ASSERT_PRED_FORMAT1(pred_format, v1)
-// ASSERT_PRED_FORMAT2(pred_format, v1, v2)
-// ...
-//
-// where pred_format is a function or functor that takes n (in the
-// case of ASSERT_PRED_FORMATn) values and their source expression
-// text, and returns a testing::AssertionResult. See the definition
-// of ASSERT_EQ in gtest.h for an example.
-//
-// If you don't care about formatting, you can use the more
-// restrictive version:
-//
-// ASSERT_PRED1(pred, v1)
-// ASSERT_PRED2(pred, v1, v2)
-// ...
-//
-// where pred is an n-ary function or functor that returns bool,
-// and the values v1, v2, ..., must support the << operator for
-// streaming to std::ostream.
-//
-// We also define the EXPECT_* variations.
-//
-// For now we only support predicates whose arity is at most 5.
-// Please email googletestframework@googlegroups.com if you need
-// support for higher arities.
-
-// GTEST_ASSERT_ is the basic statement to which all of the assertions
-// in this file reduce. Don't use this in your code.
-
-#define GTEST_ASSERT_(expression, on_failure) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (const ::testing::AssertionResult gtest_ar = (expression)) \
- ; \
- else \
- on_failure(gtest_ar.failure_message())
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use
-// this in your code.
-template <typename Pred,
- typename T1>
-AssertionResult AssertPred1Helper(const char* pred_text,
- const char* e1,
- Pred pred,
- const T1& v1) {
- if (pred(v1)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, v1), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use
-// this in your code.
-#define GTEST_PRED1_(pred, v1, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
- #v1, \
- pred, \
- v1), on_failure)
-
-// Unary predicate assertion macros.
-#define EXPECT_PRED_FORMAT1(pred_format, v1) \
- GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED1(pred, v1) \
- GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT1(pred_format, v1) \
- GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED1(pred, v1) \
- GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2>
-AssertionResult AssertPred2Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- Pred pred,
- const T1& v1,
- const T2& v2) {
- if (pred(v1, v2)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use
-// this in your code.
-#define GTEST_PRED2_(pred, v1, v2, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
- #v1, \
- #v2, \
- pred, \
- v1, \
- v2), on_failure)
-
-// Binary predicate assertion macros.
-#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
- GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED2(pred, v1, v2) \
- GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
- GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED2(pred, v1, v2) \
- GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2,
- typename T3>
-AssertionResult AssertPred3Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- const char* e3,
- Pred pred,
- const T1& v1,
- const T2& v2,
- const T3& v3) {
- if (pred(v1, v2, v3)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ", "
- << e3 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2
- << "\n" << e3 << " evaluates to " << v3;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use
-// this in your code.
-#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
- #v1, \
- #v2, \
- #v3, \
- pred, \
- v1, \
- v2, \
- v3), on_failure)
-
-// Ternary predicate assertion macros.
-#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
- GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED3(pred, v1, v2, v3) \
- GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
- GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED3(pred, v1, v2, v3) \
- GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2,
- typename T3,
- typename T4>
-AssertionResult AssertPred4Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- const char* e3,
- const char* e4,
- Pred pred,
- const T1& v1,
- const T2& v2,
- const T3& v3,
- const T4& v4) {
- if (pred(v1, v2, v3, v4)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ", "
- << e3 << ", "
- << e4 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2
- << "\n" << e3 << " evaluates to " << v3
- << "\n" << e4 << " evaluates to " << v4;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use
-// this in your code.
-#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
- #v1, \
- #v2, \
- #v3, \
- #v4, \
- pred, \
- v1, \
- v2, \
- v3, \
- v4), on_failure)
-
-// 4-ary predicate assertion macros.
-#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
- GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED4(pred, v1, v2, v3, v4) \
- GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
- GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED4(pred, v1, v2, v3, v4) \
- GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5>
-AssertionResult AssertPred5Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- const char* e3,
- const char* e4,
- const char* e5,
- Pred pred,
- const T1& v1,
- const T2& v2,
- const T3& v3,
- const T4& v4,
- const T5& v5) {
- if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ", "
- << e3 << ", "
- << e4 << ", "
- << e5 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2
- << "\n" << e3 << " evaluates to " << v3
- << "\n" << e4 << " evaluates to " << v4
- << "\n" << e5 << " evaluates to " << v5;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use
-// this in your code.
-#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
- #v1, \
- #v2, \
- #v3, \
- #v4, \
- #v5, \
- pred, \
- v1, \
- v2, \
- v3, \
- v4, \
- v5), on_failure)
-
-// 5-ary predicate assertion macros.
-#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
- GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
- GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
- GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
- GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
-
-
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest_prod.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest_prod.h
deleted file mode 100644
index da80ddc..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/gtest_prod.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// Google C++ Testing Framework definitions useful in production code.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
-
-// When you need to test the private or protected members of a class,
-// use the FRIEND_TEST macro to declare your tests as friends of the
-// class. For example:
-//
-// class MyClass {
-// private:
-// void MyMethod();
-// FRIEND_TEST(MyClassTest, MyMethod);
-// };
-//
-// class MyClassTest : public testing::Test {
-// // ...
-// };
-//
-// TEST_F(MyClassTest, MyMethod) {
-// // Can call MyClass::MyMethod() here.
-// }
-
-#define FRIEND_TEST(test_case_name, test_name)\
-friend class test_case_name##_##test_name##_Test
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-death-test-internal.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-death-test-internal.h
deleted file mode 100644
index 2b3a78f..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-death-test-internal.h
+++ /dev/null
@@ -1,319 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines internal utilities needed for implementing
-// death tests. They are subject to change without notice.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
-
-#include "gtest/internal/gtest-internal.h"
-
-#include <stdio.h>
-
-namespace testing {
-namespace internal {
-
-GTEST_DECLARE_string_(internal_run_death_test);
-
-// Names of the flags (needed for parsing Google Test flags).
-const char kDeathTestStyleFlag[] = "death_test_style";
-const char kDeathTestUseFork[] = "death_test_use_fork";
-const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
-
-#if GTEST_HAS_DEATH_TEST
-
-// DeathTest is a class that hides much of the complexity of the
-// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
-// returns a concrete class that depends on the prevailing death test
-// style, as defined by the --gtest_death_test_style and/or
-// --gtest_internal_run_death_test flags.
-
-// In describing the results of death tests, these terms are used with
-// the corresponding definitions:
-//
-// exit status: The integer exit information in the format specified
-// by wait(2)
-// exit code: The integer code passed to exit(3), _exit(2), or
-// returned from main()
-class GTEST_API_ DeathTest {
- public:
- // Create returns false if there was an error determining the
- // appropriate action to take for the current death test; for example,
- // if the gtest_death_test_style flag is set to an invalid value.
- // The LastMessage method will return a more detailed message in that
- // case. Otherwise, the DeathTest pointer pointed to by the "test"
- // argument is set. If the death test should be skipped, the pointer
- // is set to NULL; otherwise, it is set to the address of a new concrete
- // DeathTest object that controls the execution of the current test.
- static bool Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test);
- DeathTest();
- virtual ~DeathTest() { }
-
- // A helper class that aborts a death test when it's deleted.
- class ReturnSentinel {
- public:
- explicit ReturnSentinel(DeathTest* test) : test_(test) { }
- ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
- private:
- DeathTest* const test_;
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
- } GTEST_ATTRIBUTE_UNUSED_;
-
- // An enumeration of possible roles that may be taken when a death
- // test is encountered. EXECUTE means that the death test logic should
- // be executed immediately. OVERSEE means that the program should prepare
- // the appropriate environment for a child process to execute the death
- // test, then wait for it to complete.
- enum TestRole { OVERSEE_TEST, EXECUTE_TEST };
-
- // An enumeration of the three reasons that a test might be aborted.
- enum AbortReason {
- TEST_ENCOUNTERED_RETURN_STATEMENT,
- TEST_THREW_EXCEPTION,
- TEST_DID_NOT_DIE
- };
-
- // Assumes one of the above roles.
- virtual TestRole AssumeRole() = 0;
-
- // Waits for the death test to finish and returns its status.
- virtual int Wait() = 0;
-
- // Returns true if the death test passed; that is, the test process
- // exited during the test, its exit status matches a user-supplied
- // predicate, and its stderr output matches a user-supplied regular
- // expression.
- // The user-supplied predicate may be a macro expression rather
- // than a function pointer or functor, or else Wait and Passed could
- // be combined.
- virtual bool Passed(bool exit_status_ok) = 0;
-
- // Signals that the death test did not die as expected.
- virtual void Abort(AbortReason reason) = 0;
-
- // Returns a human-readable outcome message regarding the outcome of
- // the last death test.
- static const char* LastMessage();
-
- static void set_last_death_test_message(const std::string& message);
-
- private:
- // A string containing a description of the outcome of the last death test.
- static std::string last_death_test_message_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
-};
-
-// Factory interface for death tests. May be mocked out for testing.
-class DeathTestFactory {
- public:
- virtual ~DeathTestFactory() { }
- virtual bool Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test) = 0;
-};
-
-// A concrete DeathTestFactory implementation for normal use.
-class DefaultDeathTestFactory : public DeathTestFactory {
- public:
- virtual bool Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test);
-};
-
-// Returns true if exit_status describes a process that was terminated
-// by a signal, or exited normally with a nonzero exit code.
-GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
-
-// Traps C++ exceptions escaping statement and reports them as test
-// failures. Note that trapping SEH exceptions is not implemented here.
-# if GTEST_HAS_EXCEPTIONS
-# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } catch (const ::std::exception& gtest_exception) { \
- fprintf(\
- stderr, \
- "\n%s: Caught std::exception-derived exception escaping the " \
- "death test statement. Exception message: %s\n", \
- ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
- gtest_exception.what()); \
- fflush(stderr); \
- death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
- } catch (...) { \
- death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
- }
-
-# else
-# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
-
-# endif
-
-// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
-// ASSERT_EXIT*, and EXPECT_EXIT*.
-# define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- const ::testing::internal::RE& gtest_regex = (regex); \
- ::testing::internal::DeathTest* gtest_dt; \
- if (!::testing::internal::DeathTest::Create(#statement, >est_regex, \
- __FILE__, __LINE__, >est_dt)) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
- } \
- if (gtest_dt != NULL) { \
- ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \
- gtest_dt_ptr(gtest_dt); \
- switch (gtest_dt->AssumeRole()) { \
- case ::testing::internal::DeathTest::OVERSEE_TEST: \
- if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
- } \
- break; \
- case ::testing::internal::DeathTest::EXECUTE_TEST: { \
- ::testing::internal::DeathTest::ReturnSentinel \
- gtest_sentinel(gtest_dt); \
- GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \
- gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
- break; \
- } \
- default: \
- break; \
- } \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \
- fail(::testing::internal::DeathTest::LastMessage())
-// The symbol "fail" here expands to something into which a message
-// can be streamed.
-
-// This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
-// NDEBUG mode. In this case we need the statements to be executed, the regex is
-// ignored, and the macro must accept a streamed message even though the message
-// is never printed.
-# define GTEST_EXECUTE_STATEMENT_(statement, regex) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } else \
- ::testing::Message()
-
-// A class representing the parsed contents of the
-// --gtest_internal_run_death_test flag, as it existed when
-// RUN_ALL_TESTS was called.
-class InternalRunDeathTestFlag {
- public:
- InternalRunDeathTestFlag(const std::string& a_file,
- int a_line,
- int an_index,
- int a_write_fd)
- : file_(a_file), line_(a_line), index_(an_index),
- write_fd_(a_write_fd) {}
-
- ~InternalRunDeathTestFlag() {
- if (write_fd_ >= 0)
- posix::Close(write_fd_);
- }
-
- const std::string& file() const { return file_; }
- int line() const { return line_; }
- int index() const { return index_; }
- int write_fd() const { return write_fd_; }
-
- private:
- std::string file_;
- int line_;
- int index_;
- int write_fd_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
-};
-
-// Returns a newly created InternalRunDeathTestFlag object with fields
-// initialized from the GTEST_FLAG(internal_run_death_test) flag if
-// the flag is specified; otherwise returns NULL.
-InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
-
-#else // GTEST_HAS_DEATH_TEST
-
-// This macro is used for implementing macros such as
-// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
-// death tests are not supported. Those macros must compile on such systems
-// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
-// systems that support death tests. This allows one to write such a macro
-// on a system that does not support death tests and be sure that it will
-// compile on a death-test supporting system.
-//
-// Parameters:
-// statement - A statement that a macro such as EXPECT_DEATH would test
-// for program termination. This macro has to make sure this
-// statement is compiled but not executed, to ensure that
-// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
-// parameter iff EXPECT_DEATH compiles with it.
-// regex - A regex that a macro such as EXPECT_DEATH would use to test
-// the output of statement. This parameter has to be
-// compiled but not evaluated by this macro, to ensure that
-// this macro only accepts expressions that a macro such as
-// EXPECT_DEATH would accept.
-// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
-// and a return statement for ASSERT_DEATH_IF_SUPPORTED.
-// This ensures that ASSERT_DEATH_IF_SUPPORTED will not
-// compile inside functions where ASSERT_DEATH doesn't
-// compile.
-//
-// The branch that has an always false condition is used to ensure that
-// statement and regex are compiled (and thus syntactically correct) but
-// never executed. The unreachable code macro protects the terminator
-// statement from generating an 'unreachable code' warning in case
-// statement unconditionally returns or throws. The Message constructor at
-// the end allows the syntax of streaming additional messages into the
-// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
-# define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- GTEST_LOG_(WARNING) \
- << "Death tests are not supported on this platform.\n" \
- << "Statement '" #statement "' cannot be verified."; \
- } else if (::testing::internal::AlwaysFalse()) { \
- ::testing::internal::RE::PartialMatch(".*", (regex)); \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- terminator; \
- } else \
- ::testing::Message()
-
-#endif // GTEST_HAS_DEATH_TEST
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-filepath.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-filepath.h
deleted file mode 100644
index 7a13b4b..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-filepath.h
+++ /dev/null
@@ -1,206 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: keith.ray@gmail.com (Keith Ray)
-//
-// Google Test filepath utilities
-//
-// This header file declares classes and functions used internally by
-// Google Test. They are subject to change without notice.
-//
-// This file is #included in <gtest/internal/gtest-internal.h>.
-// Do not include this header file separately!
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
-
-#include "gtest/internal/gtest-string.h"
-
-namespace testing {
-namespace internal {
-
-// FilePath - a class for file and directory pathname manipulation which
-// handles platform-specific conventions (like the pathname separator).
-// Used for helper functions for naming files in a directory for xml output.
-// Except for Set methods, all methods are const or static, which provides an
-// "immutable value object" -- useful for peace of mind.
-// A FilePath with a value ending in a path separator ("like/this/") represents
-// a directory, otherwise it is assumed to represent a file. In either case,
-// it may or may not represent an actual file or directory in the file system.
-// Names are NOT checked for syntax correctness -- no checking for illegal
-// characters, malformed paths, etc.
-
-class GTEST_API_ FilePath {
- public:
- FilePath() : pathname_("") { }
- FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
-
- explicit FilePath(const std::string& pathname) : pathname_(pathname) {
- Normalize();
- }
-
- FilePath& operator=(const FilePath& rhs) {
- Set(rhs);
- return *this;
- }
-
- void Set(const FilePath& rhs) {
- pathname_ = rhs.pathname_;
- }
-
- const std::string& string() const { return pathname_; }
- const char* c_str() const { return pathname_.c_str(); }
-
- // Returns the current working directory, or "" if unsuccessful.
- static FilePath GetCurrentDir();
-
- // Given directory = "dir", base_name = "test", number = 0,
- // extension = "xml", returns "dir/test.xml". If number is greater
- // than zero (e.g., 12), returns "dir/test_12.xml".
- // On Windows platform, uses \ as the separator rather than /.
- static FilePath MakeFileName(const FilePath& directory,
- const FilePath& base_name,
- int number,
- const char* extension);
-
- // Given directory = "dir", relative_path = "test.xml",
- // returns "dir/test.xml".
- // On Windows, uses \ as the separator rather than /.
- static FilePath ConcatPaths(const FilePath& directory,
- const FilePath& relative_path);
-
- // Returns a pathname for a file that does not currently exist. The pathname
- // will be directory/base_name.extension or
- // directory/base_name_<number>.extension if directory/base_name.extension
- // already exists. The number will be incremented until a pathname is found
- // that does not already exist.
- // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
- // There could be a race condition if two or more processes are calling this
- // function at the same time -- they could both pick the same filename.
- static FilePath GenerateUniqueFileName(const FilePath& directory,
- const FilePath& base_name,
- const char* extension);
-
- // Returns true iff the path is "".
- bool IsEmpty() const { return pathname_.empty(); }
-
- // If input name has a trailing separator character, removes it and returns
- // the name, otherwise return the name string unmodified.
- // On Windows platform, uses \ as the separator, other platforms use /.
- FilePath RemoveTrailingPathSeparator() const;
-
- // Returns a copy of the FilePath with the directory part removed.
- // Example: FilePath("path/to/file").RemoveDirectoryName() returns
- // FilePath("file"). If there is no directory part ("just_a_file"), it returns
- // the FilePath unmodified. If there is no file part ("just_a_dir/") it
- // returns an empty FilePath ("").
- // On Windows platform, '\' is the path separator, otherwise it is '/'.
- FilePath RemoveDirectoryName() const;
-
- // RemoveFileName returns the directory path with the filename removed.
- // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
- // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
- // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
- // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
- // On Windows platform, '\' is the path separator, otherwise it is '/'.
- FilePath RemoveFileName() const;
-
- // Returns a copy of the FilePath with the case-insensitive extension removed.
- // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
- // FilePath("dir/file"). If a case-insensitive extension is not
- // found, returns a copy of the original FilePath.
- FilePath RemoveExtension(const char* extension) const;
-
- // Creates directories so that path exists. Returns true if successful or if
- // the directories already exist; returns false if unable to create
- // directories for any reason. Will also return false if the FilePath does
- // not represent a directory (that is, it doesn't end with a path separator).
- bool CreateDirectoriesRecursively() const;
-
- // Create the directory so that path exists. Returns true if successful or
- // if the directory already exists; returns false if unable to create the
- // directory for any reason, including if the parent directory does not
- // exist. Not named "CreateDirectory" because that's a macro on Windows.
- bool CreateFolder() const;
-
- // Returns true if FilePath describes something in the file-system,
- // either a file, directory, or whatever, and that something exists.
- bool FileOrDirectoryExists() const;
-
- // Returns true if pathname describes a directory in the file-system
- // that exists.
- bool DirectoryExists() const;
-
- // Returns true if FilePath ends with a path separator, which indicates that
- // it is intended to represent a directory. Returns false otherwise.
- // This does NOT check that a directory (or file) actually exists.
- bool IsDirectory() const;
-
- // Returns true if pathname describes a root directory. (Windows has one
- // root directory per disk drive.)
- bool IsRootDirectory() const;
-
- // Returns true if pathname describes an absolute path.
- bool IsAbsolutePath() const;
-
- private:
- // Replaces multiple consecutive separators with a single separator.
- // For example, "bar///foo" becomes "bar/foo". Does not eliminate other
- // redundancies that might be in a pathname involving "." or "..".
- //
- // A pathname with multiple consecutive separators may occur either through
- // user error or as a result of some scripts or APIs that generate a pathname
- // with a trailing separator. On other platforms the same API or script
- // may NOT generate a pathname with a trailing "/". Then elsewhere that
- // pathname may have another "/" and pathname components added to it,
- // without checking for the separator already being there.
- // The script language and operating system may allow paths like "foo//bar"
- // but some of the functions in FilePath will not handle that correctly. In
- // particular, RemoveTrailingPathSeparator() only removes one separator, and
- // it is called in CreateDirectoriesRecursively() assuming that it will change
- // a pathname from directory syntax (trailing separator) to filename syntax.
- //
- // On Windows this method also replaces the alternate path separator '/' with
- // the primary path separator '\\', so that for example "bar\\/\\foo" becomes
- // "bar\\foo".
-
- void Normalize();
-
- // Returns a pointer to the last occurence of a valid path separator in
- // the FilePath. On Windows, for example, both '/' and '\' are valid path
- // separators. Returns NULL if no path separator was found.
- const char* FindLastPathSeparator() const;
-
- std::string pathname_;
-}; // class FilePath
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-internal.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-internal.h
deleted file mode 100644
index 0dcc3a3..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-internal.h
+++ /dev/null
@@ -1,1158 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file declares functions and macros used internally by
-// Google Test. They are subject to change without notice.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
-
-#include "gtest/internal/gtest-port.h"
-
-#if GTEST_OS_LINUX
-# include <stdlib.h>
-# include <sys/types.h>
-# include <sys/wait.h>
-# include <unistd.h>
-#endif // GTEST_OS_LINUX
-
-#if GTEST_HAS_EXCEPTIONS
-# include <stdexcept>
-#endif
-
-#include <ctype.h>
-#include <float.h>
-#include <string.h>
-#include <iomanip>
-#include <limits>
-#include <set>
-
-#include "gtest/gtest-message.h"
-#include "gtest/internal/gtest-string.h"
-#include "gtest/internal/gtest-filepath.h"
-#include "gtest/internal/gtest-type-util.h"
-
-// Due to C++ preprocessor weirdness, we need double indirection to
-// concatenate two tokens when one of them is __LINE__. Writing
-//
-// foo ## __LINE__
-//
-// will result in the token foo__LINE__, instead of foo followed by
-// the current line number. For more details, see
-// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
-#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
-#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
-
-class ProtocolMessage;
-namespace proto2 { class Message; }
-
-namespace testing {
-
-// Forward declarations.
-
-class AssertionResult; // Result of an assertion.
-class Message; // Represents a failure message.
-class Test; // Represents a test.
-class TestInfo; // Information about a test.
-class TestPartResult; // Result of a test part.
-class UnitTest; // A collection of test cases.
-
-template <typename T>
-::std::string PrintToString(const T& value);
-
-namespace internal {
-
-struct TraceInfo; // Information about a trace point.
-class ScopedTrace; // Implements scoped trace.
-class TestInfoImpl; // Opaque implementation of TestInfo
-class UnitTestImpl; // Opaque implementation of UnitTest
-
-// How many times InitGoogleTest() has been called.
-GTEST_API_ extern int g_init_gtest_count;
-
-// The text used in failure messages to indicate the start of the
-// stack trace.
-GTEST_API_ extern const char kStackTraceMarker[];
-
-// Two overloaded helpers for checking at compile time whether an
-// expression is a null pointer literal (i.e. NULL or any 0-valued
-// compile-time integral constant). Their return values have
-// different sizes, so we can use sizeof() to test which version is
-// picked by the compiler. These helpers have no implementations, as
-// we only need their signatures.
-//
-// Given IsNullLiteralHelper(x), the compiler will pick the first
-// version if x can be implicitly converted to Secret*, and pick the
-// second version otherwise. Since Secret is a secret and incomplete
-// type, the only expression a user can write that has type Secret* is
-// a null pointer literal. Therefore, we know that x is a null
-// pointer literal if and only if the first version is picked by the
-// compiler.
-char IsNullLiteralHelper(Secret* p);
-char (&IsNullLiteralHelper(...))[2]; // NOLINT
-
-// A compile-time bool constant that is true if and only if x is a
-// null pointer literal (i.e. NULL or any 0-valued compile-time
-// integral constant).
-#ifdef GTEST_ELLIPSIS_NEEDS_POD_
-// We lose support for NULL detection where the compiler doesn't like
-// passing non-POD classes through ellipsis (...).
-# define GTEST_IS_NULL_LITERAL_(x) false
-#else
-# define GTEST_IS_NULL_LITERAL_(x) \
- (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
-#endif // GTEST_ELLIPSIS_NEEDS_POD_
-
-// Appends the user-supplied message to the Google-Test-generated message.
-GTEST_API_ std::string AppendUserMessage(
- const std::string& gtest_msg, const Message& user_msg);
-
-#if GTEST_HAS_EXCEPTIONS
-
-// This exception is thrown by (and only by) a failed Google Test
-// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
-// are enabled). We derive it from std::runtime_error, which is for
-// errors presumably detectable only at run time. Since
-// std::runtime_error inherits from std::exception, many testing
-// frameworks know how to extract and print the message inside it.
-class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
- public:
- explicit GoogleTestFailureException(const TestPartResult& failure);
-};
-
-#endif // GTEST_HAS_EXCEPTIONS
-
-// A helper class for creating scoped traces in user programs.
-class GTEST_API_ ScopedTrace {
- public:
- // The c'tor pushes the given source file location and message onto
- // a trace stack maintained by Google Test.
- ScopedTrace(const char* file, int line, const Message& message);
-
- // The d'tor pops the info pushed by the c'tor.
- //
- // Note that the d'tor is not virtual in order to be efficient.
- // Don't inherit from ScopedTrace!
- ~ScopedTrace();
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
-} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
- // c'tor and d'tor. Therefore it doesn't
- // need to be used otherwise.
-
-// Constructs and returns the message for an equality assertion
-// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
-//
-// The first four parameters are the expressions used in the assertion
-// and their values, as strings. For example, for ASSERT_EQ(foo, bar)
-// where foo is 5 and bar is 6, we have:
-//
-// expected_expression: "foo"
-// actual_expression: "bar"
-// expected_value: "5"
-// actual_value: "6"
-//
-// The ignoring_case parameter is true iff the assertion is a
-// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
-// be inserted into the message.
-GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
- const char* actual_expression,
- const std::string& expected_value,
- const std::string& actual_value,
- bool ignoring_case);
-
-// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
-GTEST_API_ std::string GetBoolAssertionFailureMessage(
- const AssertionResult& assertion_result,
- const char* expression_text,
- const char* actual_predicate_value,
- const char* expected_predicate_value);
-
-// This template class represents an IEEE floating-point number
-// (either single-precision or double-precision, depending on the
-// template parameters).
-//
-// The purpose of this class is to do more sophisticated number
-// comparison. (Due to round-off error, etc, it's very unlikely that
-// two floating-points will be equal exactly. Hence a naive
-// comparison by the == operation often doesn't work.)
-//
-// Format of IEEE floating-point:
-//
-// The most-significant bit being the leftmost, an IEEE
-// floating-point looks like
-//
-// sign_bit exponent_bits fraction_bits
-//
-// Here, sign_bit is a single bit that designates the sign of the
-// number.
-//
-// For float, there are 8 exponent bits and 23 fraction bits.
-//
-// For double, there are 11 exponent bits and 52 fraction bits.
-//
-// More details can be found at
-// http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
-//
-// Template parameter:
-//
-// RawType: the raw floating-point type (either float or double)
-template <typename RawType>
-class FloatingPoint {
- public:
- // Defines the unsigned integer type that has the same size as the
- // floating point number.
- typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;
-
- // Constants.
-
- // # of bits in a number.
- static const size_t kBitCount = 8*sizeof(RawType);
-
- // # of fraction bits in a number.
- static const size_t kFractionBitCount =
- std::numeric_limits<RawType>::digits - 1;
-
- // # of exponent bits in a number.
- static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
-
- // The mask for the sign bit.
- static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
-
- // The mask for the fraction bits.
- static const Bits kFractionBitMask =
- ~static_cast<Bits>(0) >> (kExponentBitCount + 1);
-
- // The mask for the exponent bits.
- static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);
-
- // How many ULP's (Units in the Last Place) we want to tolerate when
- // comparing two numbers. The larger the value, the more error we
- // allow. A 0 value means that two numbers must be exactly the same
- // to be considered equal.
- //
- // The maximum error of a single floating-point operation is 0.5
- // units in the last place. On Intel CPU's, all floating-point
- // calculations are done with 80-bit precision, while double has 64
- // bits. Therefore, 4 should be enough for ordinary use.
- //
- // See the following article for more details on ULP:
- // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
- static const size_t kMaxUlps = 4;
-
- // Constructs a FloatingPoint from a raw floating-point number.
- //
- // On an Intel CPU, passing a non-normalized NAN (Not a Number)
- // around may change its bits, although the new value is guaranteed
- // to be also a NAN. Therefore, don't expect this constructor to
- // preserve the bits in x when x is a NAN.
- explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
-
- // Static methods
-
- // Reinterprets a bit pattern as a floating-point number.
- //
- // This function is needed to test the AlmostEquals() method.
- static RawType ReinterpretBits(const Bits bits) {
- FloatingPoint fp(0);
- fp.u_.bits_ = bits;
- return fp.u_.value_;
- }
-
- // Returns the floating-point number that represent positive infinity.
- static RawType Infinity() {
- return ReinterpretBits(kExponentBitMask);
- }
-
- // Returns the maximum representable finite floating-point number.
- static RawType Max();
-
- // Non-static methods
-
- // Returns the bits that represents this number.
- const Bits &bits() const { return u_.bits_; }
-
- // Returns the exponent bits of this number.
- Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
-
- // Returns the fraction bits of this number.
- Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
-
- // Returns the sign bit of this number.
- Bits sign_bit() const { return kSignBitMask & u_.bits_; }
-
- // Returns true iff this is NAN (not a number).
- bool is_nan() const {
- // It's a NAN if the exponent bits are all ones and the fraction
- // bits are not entirely zeros.
- return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
- }
-
- // Returns true iff this number is at most kMaxUlps ULP's away from
- // rhs. In particular, this function:
- //
- // - returns false if either number is (or both are) NAN.
- // - treats really large numbers as almost equal to infinity.
- // - thinks +0.0 and -0.0 are 0 DLP's apart.
- bool AlmostEquals(const FloatingPoint& rhs) const {
- // The IEEE standard says that any comparison operation involving
- // a NAN must return false.
- if (is_nan() || rhs.is_nan()) return false;
-
- return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
- <= kMaxUlps;
- }
-
- private:
- // The data type used to store the actual floating-point number.
- union FloatingPointUnion {
- RawType value_; // The raw floating-point number.
- Bits bits_; // The bits that represent the number.
- };
-
- // Converts an integer from the sign-and-magnitude representation to
- // the biased representation. More precisely, let N be 2 to the
- // power of (kBitCount - 1), an integer x is represented by the
- // unsigned number x + N.
- //
- // For instance,
- //
- // -N + 1 (the most negative number representable using
- // sign-and-magnitude) is represented by 1;
- // 0 is represented by N; and
- // N - 1 (the biggest number representable using
- // sign-and-magnitude) is represented by 2N - 1.
- //
- // Read http://en.wikipedia.org/wiki/Signed_number_representations
- // for more details on signed number representations.
- static Bits SignAndMagnitudeToBiased(const Bits &sam) {
- if (kSignBitMask & sam) {
- // sam represents a negative number.
- return ~sam + 1;
- } else {
- // sam represents a positive number.
- return kSignBitMask | sam;
- }
- }
-
- // Given two numbers in the sign-and-magnitude representation,
- // returns the distance between them as an unsigned number.
- static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
- const Bits &sam2) {
- const Bits biased1 = SignAndMagnitudeToBiased(sam1);
- const Bits biased2 = SignAndMagnitudeToBiased(sam2);
- return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
- }
-
- FloatingPointUnion u_;
-};
-
-// We cannot use std::numeric_limits<T>::max() as it clashes with the max()
-// macro defined by <windows.h>.
-template <>
-inline float FloatingPoint<float>::Max() { return FLT_MAX; }
-template <>
-inline double FloatingPoint<double>::Max() { return DBL_MAX; }
-
-// Typedefs the instances of the FloatingPoint template class that we
-// care to use.
-typedef FloatingPoint<float> Float;
-typedef FloatingPoint<double> Double;
-
-// In order to catch the mistake of putting tests that use different
-// test fixture classes in the same test case, we need to assign
-// unique IDs to fixture classes and compare them. The TypeId type is
-// used to hold such IDs. The user should treat TypeId as an opaque
-// type: the only operation allowed on TypeId values is to compare
-// them for equality using the == operator.
-typedef const void* TypeId;
-
-template <typename T>
-class TypeIdHelper {
- public:
- // dummy_ must not have a const type. Otherwise an overly eager
- // compiler (e.g. MSVC 7.1 & 8.0) may try to merge
- // TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
- static bool dummy_;
-};
-
-template <typename T>
-bool TypeIdHelper<T>::dummy_ = false;
-
-// GetTypeId<T>() returns the ID of type T. Different values will be
-// returned for different types. Calling the function twice with the
-// same type argument is guaranteed to return the same ID.
-template <typename T>
-TypeId GetTypeId() {
- // The compiler is required to allocate a different
- // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
- // the template. Therefore, the address of dummy_ is guaranteed to
- // be unique.
- return &(TypeIdHelper<T>::dummy_);
-}
-
-// Returns the type ID of ::testing::Test. Always call this instead
-// of GetTypeId< ::testing::Test>() to get the type ID of
-// ::testing::Test, as the latter may give the wrong result due to a
-// suspected linker bug when compiling Google Test as a Mac OS X
-// framework.
-GTEST_API_ TypeId GetTestTypeId();
-
-// Defines the abstract factory interface that creates instances
-// of a Test object.
-class TestFactoryBase {
- public:
- virtual ~TestFactoryBase() {}
-
- // Creates a test instance to run. The instance is both created and destroyed
- // within TestInfoImpl::Run()
- virtual Test* CreateTest() = 0;
-
- protected:
- TestFactoryBase() {}
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
-};
-
-// This class provides implementation of TeastFactoryBase interface.
-// It is used in TEST and TEST_F macros.
-template <class TestClass>
-class TestFactoryImpl : public TestFactoryBase {
- public:
- virtual Test* CreateTest() { return new TestClass; }
-};
-
-#if GTEST_OS_WINDOWS
-
-// Predicate-formatters for implementing the HRESULT checking macros
-// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
-// We pass a long instead of HRESULT to avoid causing an
-// include dependency for the HRESULT type.
-GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,
- long hr); // NOLINT
-GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
- long hr); // NOLINT
-
-#endif // GTEST_OS_WINDOWS
-
-// Types of SetUpTestCase() and TearDownTestCase() functions.
-typedef void (*SetUpTestCaseFunc)();
-typedef void (*TearDownTestCaseFunc)();
-
-// Creates a new TestInfo object and registers it with Google Test;
-// returns the created object.
-//
-// Arguments:
-//
-// test_case_name: name of the test case
-// name: name of the test
-// type_param the name of the test's type parameter, or NULL if
-// this is not a typed or a type-parameterized test.
-// value_param text representation of the test's value parameter,
-// or NULL if this is not a type-parameterized test.
-// fixture_class_id: ID of the test fixture class
-// set_up_tc: pointer to the function that sets up the test case
-// tear_down_tc: pointer to the function that tears down the test case
-// factory: pointer to the factory that creates a test object.
-// The newly created TestInfo instance will assume
-// ownership of the factory object.
-GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
- const char* test_case_name,
- const char* name,
- const char* type_param,
- const char* value_param,
- TypeId fixture_class_id,
- SetUpTestCaseFunc set_up_tc,
- TearDownTestCaseFunc tear_down_tc,
- TestFactoryBase* factory);
-
-// If *pstr starts with the given prefix, modifies *pstr to be right
-// past the prefix and returns true; otherwise leaves *pstr unchanged
-// and returns false. None of pstr, *pstr, and prefix can be NULL.
-GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
-
-#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// State of the definition of a type-parameterized test case.
-class GTEST_API_ TypedTestCasePState {
- public:
- TypedTestCasePState() : registered_(false) {}
-
- // Adds the given test name to defined_test_names_ and return true
- // if the test case hasn't been registered; otherwise aborts the
- // program.
- bool AddTestName(const char* file, int line, const char* case_name,
- const char* test_name) {
- if (registered_) {
- fprintf(stderr, "%s Test %s must be defined before "
- "REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
- FormatFileLocation(file, line).c_str(), test_name, case_name);
- fflush(stderr);
- posix::Abort();
- }
- defined_test_names_.insert(test_name);
- return true;
- }
-
- // Verifies that registered_tests match the test names in
- // defined_test_names_; returns registered_tests if successful, or
- // aborts the program otherwise.
- const char* VerifyRegisteredTestNames(
- const char* file, int line, const char* registered_tests);
-
- private:
- bool registered_;
- ::std::set<const char*> defined_test_names_;
-};
-
-// Skips to the first non-space char after the first comma in 'str';
-// returns NULL if no comma is found in 'str'.
-inline const char* SkipComma(const char* str) {
- const char* comma = strchr(str, ',');
- if (comma == NULL) {
- return NULL;
- }
- while (IsSpace(*(++comma))) {}
- return comma;
-}
-
-// Returns the prefix of 'str' before the first comma in it; returns
-// the entire string if it contains no comma.
-inline std::string GetPrefixUntilComma(const char* str) {
- const char* comma = strchr(str, ',');
- return comma == NULL ? str : std::string(str, comma);
-}
-
-// TypeParameterizedTest<Fixture, TestSel, Types>::Register()
-// registers a list of type-parameterized tests with Google Test. The
-// return value is insignificant - we just need to return something
-// such that we can call this function in a namespace scope.
-//
-// Implementation note: The GTEST_TEMPLATE_ macro declares a template
-// template parameter. It's defined in gtest-type-util.h.
-template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
-class TypeParameterizedTest {
- public:
- // 'index' is the index of the test in the type list 'Types'
- // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,
- // Types). Valid values for 'index' are [0, N - 1] where N is the
- // length of Types.
- static bool Register(const char* prefix, const char* case_name,
- const char* test_names, int index) {
- typedef typename Types::Head Type;
- typedef Fixture<Type> FixtureClass;
- typedef typename GTEST_BIND_(TestSel, Type) TestClass;
-
- // First, registers the first type-parameterized test in the type
- // list.
- MakeAndRegisterTestInfo(
- (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + "/"
- + StreamableToString(index)).c_str(),
- GetPrefixUntilComma(test_names).c_str(),
- GetTypeName<Type>().c_str(),
- NULL, // No value parameter.
- GetTypeId<FixtureClass>(),
- TestClass::SetUpTestCase,
- TestClass::TearDownTestCase,
- new TestFactoryImpl<TestClass>);
-
- // Next, recurses (at compile time) with the tail of the type list.
- return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>
- ::Register(prefix, case_name, test_names, index + 1);
- }
-};
-
-// The base case for the compile time recursion.
-template <GTEST_TEMPLATE_ Fixture, class TestSel>
-class TypeParameterizedTest<Fixture, TestSel, Types0> {
- public:
- static bool Register(const char* /*prefix*/, const char* /*case_name*/,
- const char* /*test_names*/, int /*index*/) {
- return true;
- }
-};
-
-// TypeParameterizedTestCase<Fixture, Tests, Types>::Register()
-// registers *all combinations* of 'Tests' and 'Types' with Google
-// Test. The return value is insignificant - we just need to return
-// something such that we can call this function in a namespace scope.
-template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
-class TypeParameterizedTestCase {
- public:
- static bool Register(const char* prefix, const char* case_name,
- const char* test_names) {
- typedef typename Tests::Head Head;
-
- // First, register the first test in 'Test' for each type in 'Types'.
- TypeParameterizedTest<Fixture, Head, Types>::Register(
- prefix, case_name, test_names, 0);
-
- // Next, recurses (at compile time) with the tail of the test list.
- return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types>
- ::Register(prefix, case_name, SkipComma(test_names));
- }
-};
-
-// The base case for the compile time recursion.
-template <GTEST_TEMPLATE_ Fixture, typename Types>
-class TypeParameterizedTestCase<Fixture, Templates0, Types> {
- public:
- static bool Register(const char* /*prefix*/, const char* /*case_name*/,
- const char* /*test_names*/) {
- return true;
- }
-};
-
-#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// Returns the current OS stack trace as an std::string.
-//
-// The maximum number of stack frames to be included is specified by
-// the gtest_stack_trace_depth flag. The skip_count parameter
-// specifies the number of top frames to be skipped, which doesn't
-// count against the number of frames to be included.
-//
-// For example, if Foo() calls Bar(), which in turn calls
-// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
-// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
-GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(
- UnitTest* unit_test, int skip_count);
-
-// Helpers for suppressing warnings on unreachable code or constant
-// condition.
-
-// Always returns true.
-GTEST_API_ bool AlwaysTrue();
-
-// Always returns false.
-inline bool AlwaysFalse() { return !AlwaysTrue(); }
-
-// Helper for suppressing false warning from Clang on a const char*
-// variable declared in a conditional expression always being NULL in
-// the else branch.
-struct GTEST_API_ ConstCharPtr {
- ConstCharPtr(const char* str) : value(str) {}
- operator bool() const { return true; }
- const char* value;
-};
-
-// A simple Linear Congruential Generator for generating random
-// numbers with a uniform distribution. Unlike rand() and srand(), it
-// doesn't use global state (and therefore can't interfere with user
-// code). Unlike rand_r(), it's portable. An LCG isn't very random,
-// but it's good enough for our purposes.
-class GTEST_API_ Random {
- public:
- static const UInt32 kMaxRange = 1u << 31;
-
- explicit Random(UInt32 seed) : state_(seed) {}
-
- void Reseed(UInt32 seed) { state_ = seed; }
-
- // Generates a random number from [0, range). Crashes if 'range' is
- // 0 or greater than kMaxRange.
- UInt32 Generate(UInt32 range);
-
- private:
- UInt32 state_;
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);
-};
-
-// Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a
-// compiler error iff T1 and T2 are different types.
-template <typename T1, typename T2>
-struct CompileAssertTypesEqual;
-
-template <typename T>
-struct CompileAssertTypesEqual<T, T> {
-};
-
-// Removes the reference from a type if it is a reference type,
-// otherwise leaves it unchanged. This is the same as
-// tr1::remove_reference, which is not widely available yet.
-template <typename T>
-struct RemoveReference { typedef T type; }; // NOLINT
-template <typename T>
-struct RemoveReference<T&> { typedef T type; }; // NOLINT
-
-// A handy wrapper around RemoveReference that works when the argument
-// T depends on template parameters.
-#define GTEST_REMOVE_REFERENCE_(T) \
- typename ::testing::internal::RemoveReference<T>::type
-
-// Removes const from a type if it is a const type, otherwise leaves
-// it unchanged. This is the same as tr1::remove_const, which is not
-// widely available yet.
-template <typename T>
-struct RemoveConst { typedef T type; }; // NOLINT
-template <typename T>
-struct RemoveConst<const T> { typedef T type; }; // NOLINT
-
-// MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above
-// definition to fail to remove the const in 'const int[3]' and 'const
-// char[3][4]'. The following specialization works around the bug.
-template <typename T, size_t N>
-struct RemoveConst<const T[N]> {
- typedef typename RemoveConst<T>::type type[N];
-};
-
-#if defined(_MSC_VER) && _MSC_VER < 1400
-// This is the only specialization that allows VC++ 7.1 to remove const in
-// 'const int[3] and 'const int[3][4]'. However, it causes trouble with GCC
-// and thus needs to be conditionally compiled.
-template <typename T, size_t N>
-struct RemoveConst<T[N]> {
- typedef typename RemoveConst<T>::type type[N];
-};
-#endif
-
-// A handy wrapper around RemoveConst that works when the argument
-// T depends on template parameters.
-#define GTEST_REMOVE_CONST_(T) \
- typename ::testing::internal::RemoveConst<T>::type
-
-// Turns const U&, U&, const U, and U all into U.
-#define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
- GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))
-
-// Adds reference to a type if it is not a reference type,
-// otherwise leaves it unchanged. This is the same as
-// tr1::add_reference, which is not widely available yet.
-template <typename T>
-struct AddReference { typedef T& type; }; // NOLINT
-template <typename T>
-struct AddReference<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper around AddReference that works when the argument T
-// depends on template parameters.
-#define GTEST_ADD_REFERENCE_(T) \
- typename ::testing::internal::AddReference<T>::type
-
-// Adds a reference to const on top of T as necessary. For example,
-// it transforms
-//
-// char ==> const char&
-// const char ==> const char&
-// char& ==> const char&
-// const char& ==> const char&
-//
-// The argument T must depend on some template parameters.
-#define GTEST_REFERENCE_TO_CONST_(T) \
- GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T))
-
-// ImplicitlyConvertible<From, To>::value is a compile-time bool
-// constant that's true iff type From can be implicitly converted to
-// type To.
-template <typename From, typename To>
-class ImplicitlyConvertible {
- private:
- // We need the following helper functions only for their types.
- // They have no implementations.
-
- // MakeFrom() is an expression whose type is From. We cannot simply
- // use From(), as the type From may not have a public default
- // constructor.
- static From MakeFrom();
-
- // These two functions are overloaded. Given an expression
- // Helper(x), the compiler will pick the first version if x can be
- // implicitly converted to type To; otherwise it will pick the
- // second version.
- //
- // The first version returns a value of size 1, and the second
- // version returns a value of size 2. Therefore, by checking the
- // size of Helper(x), which can be done at compile time, we can tell
- // which version of Helper() is used, and hence whether x can be
- // implicitly converted to type To.
- static char Helper(To);
- static char (&Helper(...))[2]; // NOLINT
-
- // We have to put the 'public' section after the 'private' section,
- // or MSVC refuses to compile the code.
- public:
- // MSVC warns about implicitly converting from double to int for
- // possible loss of data, so we need to temporarily disable the
- // warning.
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4244) // Temporarily disables warning 4244.
-
- static const bool value =
- sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
-# pragma warning(pop) // Restores the warning state.
-#elif defined(__BORLANDC__)
- // C++Builder cannot use member overload resolution during template
- // instantiation. The simplest workaround is to use its C++0x type traits
- // functions (C++Builder 2009 and above only).
- static const bool value = __is_convertible(From, To);
-#else
- static const bool value =
- sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
-#endif // _MSV_VER
-};
-template <typename From, typename To>
-const bool ImplicitlyConvertible<From, To>::value;
-
-// IsAProtocolMessage<T>::value is a compile-time bool constant that's
-// true iff T is type ProtocolMessage, proto2::Message, or a subclass
-// of those.
-template <typename T>
-struct IsAProtocolMessage
- : public bool_constant<
- ImplicitlyConvertible<const T*, const ::ProtocolMessage*>::value ||
- ImplicitlyConvertible<const T*, const ::proto2::Message*>::value> {
-};
-
-// When the compiler sees expression IsContainerTest<C>(0), if C is an
-// STL-style container class, the first overload of IsContainerTest
-// will be viable (since both C::iterator* and C::const_iterator* are
-// valid types and NULL can be implicitly converted to them). It will
-// be picked over the second overload as 'int' is a perfect match for
-// the type of argument 0. If C::iterator or C::const_iterator is not
-// a valid type, the first overload is not viable, and the second
-// overload will be picked. Therefore, we can determine whether C is
-// a container class by checking the type of IsContainerTest<C>(0).
-// The value of the expression is insignificant.
-//
-// Note that we look for both C::iterator and C::const_iterator. The
-// reason is that C++ injects the name of a class as a member of the
-// class itself (e.g. you can refer to class iterator as either
-// 'iterator' or 'iterator::iterator'). If we look for C::iterator
-// only, for example, we would mistakenly think that a class named
-// iterator is an STL container.
-//
-// Also note that the simpler approach of overloading
-// IsContainerTest(typename C::const_iterator*) and
-// IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
-typedef int IsContainer;
-template <class C>
-IsContainer IsContainerTest(int /* dummy */,
- typename C::iterator* /* it */ = NULL,
- typename C::const_iterator* /* const_it */ = NULL) {
- return 0;
-}
-
-typedef char IsNotContainer;
-template <class C>
-IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
-
-// EnableIf<condition>::type is void when 'Cond' is true, and
-// undefined when 'Cond' is false. To use SFINAE to make a function
-// overload only apply when a particular expression is true, add
-// "typename EnableIf<expression>::type* = 0" as the last parameter.
-template<bool> struct EnableIf;
-template<> struct EnableIf<true> { typedef void type; }; // NOLINT
-
-// Utilities for native arrays.
-
-// ArrayEq() compares two k-dimensional native arrays using the
-// elements' operator==, where k can be any integer >= 0. When k is
-// 0, ArrayEq() degenerates into comparing a single pair of values.
-
-template <typename T, typename U>
-bool ArrayEq(const T* lhs, size_t size, const U* rhs);
-
-// This generic version is used when k is 0.
-template <typename T, typename U>
-inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }
-
-// This overload is used when k >= 1.
-template <typename T, typename U, size_t N>
-inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
- return internal::ArrayEq(lhs, N, rhs);
-}
-
-// This helper reduces code bloat. If we instead put its logic inside
-// the previous ArrayEq() function, arrays with different sizes would
-// lead to different copies of the template code.
-template <typename T, typename U>
-bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
- for (size_t i = 0; i != size; i++) {
- if (!internal::ArrayEq(lhs[i], rhs[i]))
- return false;
- }
- return true;
-}
-
-// Finds the first element in the iterator range [begin, end) that
-// equals elem. Element may be a native array type itself.
-template <typename Iter, typename Element>
-Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {
- for (Iter it = begin; it != end; ++it) {
- if (internal::ArrayEq(*it, elem))
- return it;
- }
- return end;
-}
-
-// CopyArray() copies a k-dimensional native array using the elements'
-// operator=, where k can be any integer >= 0. When k is 0,
-// CopyArray() degenerates into copying a single value.
-
-template <typename T, typename U>
-void CopyArray(const T* from, size_t size, U* to);
-
-// This generic version is used when k is 0.
-template <typename T, typename U>
-inline void CopyArray(const T& from, U* to) { *to = from; }
-
-// This overload is used when k >= 1.
-template <typename T, typename U, size_t N>
-inline void CopyArray(const T(&from)[N], U(*to)[N]) {
- internal::CopyArray(from, N, *to);
-}
-
-// This helper reduces code bloat. If we instead put its logic inside
-// the previous CopyArray() function, arrays with different sizes
-// would lead to different copies of the template code.
-template <typename T, typename U>
-void CopyArray(const T* from, size_t size, U* to) {
- for (size_t i = 0; i != size; i++) {
- internal::CopyArray(from[i], to + i);
- }
-}
-
-// The relation between an NativeArray object (see below) and the
-// native array it represents.
-enum RelationToSource {
- kReference, // The NativeArray references the native array.
- kCopy // The NativeArray makes a copy of the native array and
- // owns the copy.
-};
-
-// Adapts a native array to a read-only STL-style container. Instead
-// of the complete STL container concept, this adaptor only implements
-// members useful for Google Mock's container matchers. New members
-// should be added as needed. To simplify the implementation, we only
-// support Element being a raw type (i.e. having no top-level const or
-// reference modifier). It's the client's responsibility to satisfy
-// this requirement. Element can be an array type itself (hence
-// multi-dimensional arrays are supported).
-template <typename Element>
-class NativeArray {
- public:
- // STL-style container typedefs.
- typedef Element value_type;
- typedef Element* iterator;
- typedef const Element* const_iterator;
-
- // Constructs from a native array.
- NativeArray(const Element* array, size_t count, RelationToSource relation) {
- Init(array, count, relation);
- }
-
- // Copy constructor.
- NativeArray(const NativeArray& rhs) {
- Init(rhs.array_, rhs.size_, rhs.relation_to_source_);
- }
-
- ~NativeArray() {
- // Ensures that the user doesn't instantiate NativeArray with a
- // const or reference type.
- static_cast<void>(StaticAssertTypeEqHelper<Element,
- GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>());
- if (relation_to_source_ == kCopy)
- delete[] array_;
- }
-
- // STL-style container methods.
- size_t size() const { return size_; }
- const_iterator begin() const { return array_; }
- const_iterator end() const { return array_ + size_; }
- bool operator==(const NativeArray& rhs) const {
- return size() == rhs.size() &&
- ArrayEq(begin(), size(), rhs.begin());
- }
-
- private:
- // Initializes this object; makes a copy of the input array if
- // 'relation' is kCopy.
- void Init(const Element* array, size_t a_size, RelationToSource relation) {
- if (relation == kReference) {
- array_ = array;
- } else {
- Element* const copy = new Element[a_size];
- CopyArray(array, a_size, copy);
- array_ = copy;
- }
- size_ = a_size;
- relation_to_source_ = relation;
- }
-
- const Element* array_;
- size_t size_;
- RelationToSource relation_to_source_;
-
- GTEST_DISALLOW_ASSIGN_(NativeArray);
-};
-
-} // namespace internal
-} // namespace testing
-
-#define GTEST_MESSAGE_AT_(file, line, message, result_type) \
- ::testing::internal::AssertHelper(result_type, file, line, message) \
- = ::testing::Message()
-
-#define GTEST_MESSAGE_(message, result_type) \
- GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
-
-#define GTEST_FATAL_FAILURE_(message) \
- return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
-
-#define GTEST_NONFATAL_FAILURE_(message) \
- GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
-
-#define GTEST_SUCCESS_(message) \
- GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
-
-// Suppresses MSVC warnings 4072 (unreachable code) for the code following
-// statement if it returns or throws (or doesn't return or throw in some
-// situations).
-#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
- if (::testing::internal::AlwaysTrue()) { statement; }
-
-#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::ConstCharPtr gtest_msg = "") { \
- bool gtest_caught_expected = false; \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } \
- catch (expected_exception const&) { \
- gtest_caught_expected = true; \
- } \
- catch (...) { \
- gtest_msg.value = \
- "Expected: " #statement " throws an exception of type " \
- #expected_exception ".\n Actual: it throws a different type."; \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
- } \
- if (!gtest_caught_expected) { \
- gtest_msg.value = \
- "Expected: " #statement " throws an exception of type " \
- #expected_exception ".\n Actual: it throws nothing."; \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
- fail(gtest_msg.value)
-
-#define GTEST_TEST_NO_THROW_(statement, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } \
- catch (...) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
- fail("Expected: " #statement " doesn't throw an exception.\n" \
- " Actual: it throws.")
-
-#define GTEST_TEST_ANY_THROW_(statement, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- bool gtest_caught_any = false; \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } \
- catch (...) { \
- gtest_caught_any = true; \
- } \
- if (!gtest_caught_any) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
- fail("Expected: " #statement " throws an exception.\n" \
- " Actual: it doesn't.")
-
-
-// Implements Boolean test assertions such as EXPECT_TRUE. expression can be
-// either a boolean expression or an AssertionResult. text is a textual
-// represenation of expression as it was passed into the EXPECT_TRUE.
-#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (const ::testing::AssertionResult gtest_ar_ = \
- ::testing::AssertionResult(expression)) \
- ; \
- else \
- fail(::testing::internal::GetBoolAssertionFailureMessage(\
- gtest_ar_, text, #actual, #expected).c_str())
-
-#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
- fail("Expected: " #statement " doesn't generate new fatal " \
- "failures in the current thread.\n" \
- " Actual: it does.")
-
-// Expands to the name of the class that implements the given test.
-#define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
- test_case_name##_##test_name##_Test
-
-// Helper macro for defining tests.
-#define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\
-class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
- public:\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
- private:\
- virtual void TestBody();\
- static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
- GTEST_DISALLOW_COPY_AND_ASSIGN_(\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
-};\
-\
-::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
- ::test_info_ =\
- ::testing::internal::MakeAndRegisterTestInfo(\
- #test_case_name, #test_name, NULL, NULL, \
- (parent_id), \
- parent_class::SetUpTestCase, \
- parent_class::TearDownTestCase, \
- new ::testing::internal::TestFactoryImpl<\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
-void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-linked_ptr.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-linked_ptr.h
deleted file mode 100644
index b1362cd..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-linked_ptr.h
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright 2003 Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: Dan Egnor (egnor@google.com)
-//
-// A "smart" pointer type with reference tracking. Every pointer to a
-// particular object is kept on a circular linked list. When the last pointer
-// to an object is destroyed or reassigned, the object is deleted.
-//
-// Used properly, this deletes the object when the last reference goes away.
-// There are several caveats:
-// - Like all reference counting schemes, cycles lead to leaks.
-// - Each smart pointer is actually two pointers (8 bytes instead of 4).
-// - Every time a pointer is assigned, the entire list of pointers to that
-// object is traversed. This class is therefore NOT SUITABLE when there
-// will often be more than two or three pointers to a particular object.
-// - References are only tracked as long as linked_ptr<> objects are copied.
-// If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS
-// will happen (double deletion).
-//
-// A good use of this class is storing object references in STL containers.
-// You can safely put linked_ptr<> in a vector<>.
-// Other uses may not be as good.
-//
-// Note: If you use an incomplete type with linked_ptr<>, the class
-// *containing* linked_ptr<> must have a constructor and destructor (even
-// if they do nothing!).
-//
-// Bill Gibbons suggested we use something like this.
-//
-// Thread Safety:
-// Unlike other linked_ptr implementations, in this implementation
-// a linked_ptr object is thread-safe in the sense that:
-// - it's safe to copy linked_ptr objects concurrently,
-// - it's safe to copy *from* a linked_ptr and read its underlying
-// raw pointer (e.g. via get()) concurrently, and
-// - it's safe to write to two linked_ptrs that point to the same
-// shared object concurrently.
-// TODO(wan@google.com): rename this to safe_linked_ptr to avoid
-// confusion with normal linked_ptr.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
-
-#include <stdlib.h>
-#include <assert.h>
-
-#include "gtest/internal/gtest-port.h"
-
-namespace testing {
-namespace internal {
-
-// Protects copying of all linked_ptr objects.
-GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex);
-
-// This is used internally by all instances of linked_ptr<>. It needs to be
-// a non-template class because different types of linked_ptr<> can refer to
-// the same object (linked_ptr<Superclass>(obj) vs linked_ptr<Subclass>(obj)).
-// So, it needs to be possible for different types of linked_ptr to participate
-// in the same circular linked list, so we need a single class type here.
-//
-// DO NOT USE THIS CLASS DIRECTLY YOURSELF. Use linked_ptr<T>.
-class linked_ptr_internal {
- public:
- // Create a new circle that includes only this instance.
- void join_new() {
- next_ = this;
- }
-
- // Many linked_ptr operations may change p.link_ for some linked_ptr
- // variable p in the same circle as this object. Therefore we need
- // to prevent two such operations from occurring concurrently.
- //
- // Note that different types of linked_ptr objects can coexist in a
- // circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and
- // linked_ptr<Derived2>). Therefore we must use a single mutex to
- // protect all linked_ptr objects. This can create serious
- // contention in production code, but is acceptable in a testing
- // framework.
-
- // Join an existing circle.
- void join(linked_ptr_internal const* ptr)
- GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
- MutexLock lock(&g_linked_ptr_mutex);
-
- linked_ptr_internal const* p = ptr;
- while (p->next_ != ptr) p = p->next_;
- p->next_ = this;
- next_ = ptr;
- }
-
- // Leave whatever circle we're part of. Returns true if we were the
- // last member of the circle. Once this is done, you can join() another.
- bool depart()
- GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
- MutexLock lock(&g_linked_ptr_mutex);
-
- if (next_ == this) return true;
- linked_ptr_internal const* p = next_;
- while (p->next_ != this) p = p->next_;
- p->next_ = next_;
- return false;
- }
-
- private:
- mutable linked_ptr_internal const* next_;
-};
-
-template <typename T>
-class linked_ptr {
- public:
- typedef T element_type;
-
- // Take over ownership of a raw pointer. This should happen as soon as
- // possible after the object is created.
- explicit linked_ptr(T* ptr = NULL) { capture(ptr); }
- ~linked_ptr() { depart(); }
-
- // Copy an existing linked_ptr<>, adding ourselves to the list of references.
- template <typename U> linked_ptr(linked_ptr<U> const& ptr) { copy(&ptr); }
- linked_ptr(linked_ptr const& ptr) { // NOLINT
- assert(&ptr != this);
- copy(&ptr);
- }
-
- // Assignment releases the old value and acquires the new.
- template <typename U> linked_ptr& operator=(linked_ptr<U> const& ptr) {
- depart();
- copy(&ptr);
- return *this;
- }
-
- linked_ptr& operator=(linked_ptr const& ptr) {
- if (&ptr != this) {
- depart();
- copy(&ptr);
- }
- return *this;
- }
-
- // Smart pointer members.
- void reset(T* ptr = NULL) {
- depart();
- capture(ptr);
- }
- T* get() const { return value_; }
- T* operator->() const { return value_; }
- T& operator*() const { return *value_; }
-
- bool operator==(T* p) const { return value_ == p; }
- bool operator!=(T* p) const { return value_ != p; }
- template <typename U>
- bool operator==(linked_ptr<U> const& ptr) const {
- return value_ == ptr.get();
- }
- template <typename U>
- bool operator!=(linked_ptr<U> const& ptr) const {
- return value_ != ptr.get();
- }
-
- private:
- template <typename U>
- friend class linked_ptr;
-
- T* value_;
- linked_ptr_internal link_;
-
- void depart() {
- if (link_.depart()) delete value_;
- }
-
- void capture(T* ptr) {
- value_ = ptr;
- link_.join_new();
- }
-
- template <typename U> void copy(linked_ptr<U> const* ptr) {
- value_ = ptr->get();
- if (value_)
- link_.join(&ptr->link_);
- else
- link_.join_new();
- }
-};
-
-template<typename T> inline
-bool operator==(T* ptr, const linked_ptr<T>& x) {
- return ptr == x.get();
-}
-
-template<typename T> inline
-bool operator!=(T* ptr, const linked_ptr<T>& x) {
- return ptr != x.get();
-}
-
-// A function to convert T* into linked_ptr<T>
-// Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation
-// for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
-template <typename T>
-linked_ptr<T> make_linked_ptr(T* ptr) {
- return linked_ptr<T>(ptr);
-}
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-param-util-generated.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-param-util-generated.h
deleted file mode 100644
index e805485..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-param-util-generated.h
+++ /dev/null
@@ -1,5143 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gtest-param-util-generated.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: vladl@google.com (Vlad Losev)
-
-// Type and function utilities for implementing parameterized tests.
-// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-// Currently Google Test supports at most 50 arguments in Values,
-// and at most 10 arguments in Combine. Please contact
-// googletestframework@googlegroups.com if you need more.
-// Please note that the number of arguments to Combine is limited
-// by the maximum arity of the implementation of tr1::tuple which is
-// currently set at 10.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-param-util.h"
-#include "gtest/internal/gtest-port.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Forward declarations of ValuesIn(), which is implemented in
-// include/gtest/gtest-param-test.h.
-template <typename ForwardIterator>
-internal::ParamGenerator<
- typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
-ValuesIn(ForwardIterator begin, ForwardIterator end);
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]);
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
- const Container& container);
-
-namespace internal {
-
-// Used in the Values() function to provide polymorphic capabilities.
-template <typename T1>
-class ValueArray1 {
- public:
- explicit ValueArray1(T1 v1) : v1_(v1) {}
-
- template <typename T>
- operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray1& other);
-
- const T1 v1_;
-};
-
-template <typename T1, typename T2>
-class ValueArray2 {
- public:
- ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray2& other);
-
- const T1 v1_;
- const T2 v2_;
-};
-
-template <typename T1, typename T2, typename T3>
-class ValueArray3 {
- public:
- ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray3& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4>
-class ValueArray4 {
- public:
- ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray4& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-class ValueArray5 {
- public:
- ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray5& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-class ValueArray6 {
- public:
- ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray6& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-class ValueArray7 {
- public:
- ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray7& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-class ValueArray8 {
- public:
- ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray8& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-class ValueArray9 {
- public:
- ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray9& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-class ValueArray10 {
- public:
- ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray10& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-class ValueArray11 {
- public:
- ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray11& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-class ValueArray12 {
- public:
- ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray12& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-class ValueArray13 {
- public:
- ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray13& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-class ValueArray14 {
- public:
- ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray14& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-class ValueArray15 {
- public:
- ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray15& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-class ValueArray16 {
- public:
- ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray16& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-class ValueArray17 {
- public:
- ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
- T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray17& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-class ValueArray18 {
- public:
- ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray18& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-class ValueArray19 {
- public:
- ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray19& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-class ValueArray20 {
- public:
- ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray20& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-class ValueArray21 {
- public:
- ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray21& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-class ValueArray22 {
- public:
- ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray22& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-class ValueArray23 {
- public:
- ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray23& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-class ValueArray24 {
- public:
- ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray24& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-class ValueArray25 {
- public:
- ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
- T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray25& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-class ValueArray26 {
- public:
- ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray26& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-class ValueArray27 {
- public:
- ValueArray27(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
- v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
- v26_(v26), v27_(v27) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray27& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-class ValueArray28 {
- public:
- ValueArray28(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
- v25_(v25), v26_(v26), v27_(v27), v28_(v28) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray28& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-class ValueArray29 {
- public:
- ValueArray29(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
- v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray29& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-class ValueArray30 {
- public:
- ValueArray30(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray30& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-class ValueArray31 {
- public:
- ValueArray31(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray31& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-class ValueArray32 {
- public:
- ValueArray32(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
- v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray32& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-class ValueArray33 {
- public:
- ValueArray33(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
- T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray33& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-class ValueArray34 {
- public:
- ValueArray34(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray34& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-class ValueArray35 {
- public:
- ValueArray35(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
- v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
- v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
- v32_(v32), v33_(v33), v34_(v34), v35_(v35) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray35& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-class ValueArray36 {
- public:
- ValueArray36(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
- v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
- v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray36& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-class ValueArray37 {
- public:
- ValueArray37(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
- v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
- v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
- v36_(v36), v37_(v37) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray37& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-class ValueArray38 {
- public:
- ValueArray38(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray38& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-class ValueArray39 {
- public:
- ValueArray39(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray39& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-class ValueArray40 {
- public:
- ValueArray40(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
- v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
- v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
- v40_(v40) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray40& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-class ValueArray41 {
- public:
- ValueArray41(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
- T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray41& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-class ValueArray42 {
- public:
- ValueArray42(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41), v42_(v42) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray42& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-class ValueArray43 {
- public:
- ValueArray43(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
- v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
- v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
- v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37),
- v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray43& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-class ValueArray44 {
- public:
- ValueArray44(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
- v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
- v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36),
- v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42),
- v43_(v43), v44_(v44) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray44& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-class ValueArray45 {
- public:
- ValueArray45(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
- v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
- v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
- v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41),
- v42_(v42), v43_(v43), v44_(v44), v45_(v45) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray45& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-class ValueArray46 {
- public:
- ValueArray46(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
- v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray46& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-class ValueArray47 {
- public:
- ValueArray47(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
- v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46),
- v47_(v47) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray47& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-class ValueArray48 {
- public:
- ValueArray48(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
- v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
- v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
- v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45),
- v46_(v46), v47_(v47), v48_(v48) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
- static_cast<T>(v48_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray48& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
- const T48 v48_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-class ValueArray49 {
- public:
- ValueArray49(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48,
- T49 v49) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
- v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
- static_cast<T>(v48_), static_cast<T>(v49_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray49& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
- const T48 v48_;
- const T49 v49_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-class ValueArray50 {
- public:
- ValueArray50(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49,
- T50 v50) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
- v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
- static_cast<T>(v48_), static_cast<T>(v49_), static_cast<T>(v50_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray50& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
- const T48 v48_;
- const T49 v49_;
- const T50 v50_;
-};
-
-# if GTEST_HAS_COMBINE
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Generates values from the Cartesian product of values produced
-// by the argument generators.
-//
-template <typename T1, typename T2>
-class CartesianProductGenerator2
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2> > {
- public:
- typedef ::std::tr1::tuple<T1, T2> ParamType;
-
- CartesianProductGenerator2(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2)
- : g1_(g1), g2_(g2) {}
- virtual ~CartesianProductGenerator2() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current2_;
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- ParamType current_value_;
- }; // class CartesianProductGenerator2::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator2& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
-}; // class CartesianProductGenerator2
-
-
-template <typename T1, typename T2, typename T3>
-class CartesianProductGenerator3
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3> ParamType;
-
- CartesianProductGenerator3(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3)
- : g1_(g1), g2_(g2), g3_(g3) {}
- virtual ~CartesianProductGenerator3() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current3_;
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- ParamType current_value_;
- }; // class CartesianProductGenerator3::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator3& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
-}; // class CartesianProductGenerator3
-
-
-template <typename T1, typename T2, typename T3, typename T4>
-class CartesianProductGenerator4
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3, T4> ParamType;
-
- CartesianProductGenerator4(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
- virtual ~CartesianProductGenerator4() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current4_;
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- ParamType current_value_;
- }; // class CartesianProductGenerator4::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator4& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
-}; // class CartesianProductGenerator4
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-class CartesianProductGenerator5
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3, T4, T5> ParamType;
-
- CartesianProductGenerator5(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
- virtual ~CartesianProductGenerator5() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current5_;
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- ParamType current_value_;
- }; // class CartesianProductGenerator5::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator5& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
-}; // class CartesianProductGenerator5
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-class CartesianProductGenerator6
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
- T6> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> ParamType;
-
- CartesianProductGenerator6(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
- virtual ~CartesianProductGenerator6() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current6_;
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- ParamType current_value_;
- }; // class CartesianProductGenerator6::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator6& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
-}; // class CartesianProductGenerator6
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-class CartesianProductGenerator7
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
- T7> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;
-
- CartesianProductGenerator7(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
- virtual ~CartesianProductGenerator7() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current7_;
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- ParamType current_value_;
- }; // class CartesianProductGenerator7::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator7& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
-}; // class CartesianProductGenerator7
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-class CartesianProductGenerator8
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
- T7, T8> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;
-
- CartesianProductGenerator8(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
- const ParamGenerator<T8>& g8)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
- g8_(g8) {}
- virtual ~CartesianProductGenerator8() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin(), g8_, g8_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
- g8_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7,
- const ParamGenerator<T8>& g8,
- const typename ParamGenerator<T8>::iterator& current8)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
- begin8_(g8.begin()), end8_(g8.end()), current8_(current8) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current8_;
- if (current8_ == end8_) {
- current8_ = begin8_;
- ++current7_;
- }
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_ &&
- current8_ == typed_other->current8_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_),
- begin8_(other.begin8_),
- end8_(other.end8_),
- current8_(other.current8_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_, *current8_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_ ||
- current8_ == end8_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- const typename ParamGenerator<T8>::iterator begin8_;
- const typename ParamGenerator<T8>::iterator end8_;
- typename ParamGenerator<T8>::iterator current8_;
- ParamType current_value_;
- }; // class CartesianProductGenerator8::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator8& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
- const ParamGenerator<T8> g8_;
-}; // class CartesianProductGenerator8
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-class CartesianProductGenerator9
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
- T7, T8, T9> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;
-
- CartesianProductGenerator9(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
- const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9) {}
- virtual ~CartesianProductGenerator9() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
- g8_.end(), g9_, g9_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7,
- const ParamGenerator<T8>& g8,
- const typename ParamGenerator<T8>::iterator& current8,
- const ParamGenerator<T9>& g9,
- const typename ParamGenerator<T9>::iterator& current9)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
- begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
- begin9_(g9.begin()), end9_(g9.end()), current9_(current9) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current9_;
- if (current9_ == end9_) {
- current9_ = begin9_;
- ++current8_;
- }
- if (current8_ == end8_) {
- current8_ = begin8_;
- ++current7_;
- }
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_ &&
- current8_ == typed_other->current8_ &&
- current9_ == typed_other->current9_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_),
- begin8_(other.begin8_),
- end8_(other.end8_),
- current8_(other.current8_),
- begin9_(other.begin9_),
- end9_(other.end9_),
- current9_(other.current9_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_, *current8_,
- *current9_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_ ||
- current8_ == end8_ ||
- current9_ == end9_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- const typename ParamGenerator<T8>::iterator begin8_;
- const typename ParamGenerator<T8>::iterator end8_;
- typename ParamGenerator<T8>::iterator current8_;
- const typename ParamGenerator<T9>::iterator begin9_;
- const typename ParamGenerator<T9>::iterator end9_;
- typename ParamGenerator<T9>::iterator current9_;
- ParamType current_value_;
- }; // class CartesianProductGenerator9::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator9& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
- const ParamGenerator<T8> g8_;
- const ParamGenerator<T9> g9_;
-}; // class CartesianProductGenerator9
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-class CartesianProductGenerator10
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
- T7, T8, T9, T10> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;
-
- CartesianProductGenerator10(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
- const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9,
- const ParamGenerator<T10>& g10)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9), g10_(g10) {}
- virtual ~CartesianProductGenerator10() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
- g8_.end(), g9_, g9_.end(), g10_, g10_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7,
- const ParamGenerator<T8>& g8,
- const typename ParamGenerator<T8>::iterator& current8,
- const ParamGenerator<T9>& g9,
- const typename ParamGenerator<T9>::iterator& current9,
- const ParamGenerator<T10>& g10,
- const typename ParamGenerator<T10>::iterator& current10)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
- begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
- begin9_(g9.begin()), end9_(g9.end()), current9_(current9),
- begin10_(g10.begin()), end10_(g10.end()), current10_(current10) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current10_;
- if (current10_ == end10_) {
- current10_ = begin10_;
- ++current9_;
- }
- if (current9_ == end9_) {
- current9_ = begin9_;
- ++current8_;
- }
- if (current8_ == end8_) {
- current8_ = begin8_;
- ++current7_;
- }
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_ &&
- current8_ == typed_other->current8_ &&
- current9_ == typed_other->current9_ &&
- current10_ == typed_other->current10_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_),
- begin8_(other.begin8_),
- end8_(other.end8_),
- current8_(other.current8_),
- begin9_(other.begin9_),
- end9_(other.end9_),
- current9_(other.current9_),
- begin10_(other.begin10_),
- end10_(other.end10_),
- current10_(other.current10_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_, *current8_,
- *current9_, *current10_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_ ||
- current8_ == end8_ ||
- current9_ == end9_ ||
- current10_ == end10_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- const typename ParamGenerator<T8>::iterator begin8_;
- const typename ParamGenerator<T8>::iterator end8_;
- typename ParamGenerator<T8>::iterator current8_;
- const typename ParamGenerator<T9>::iterator begin9_;
- const typename ParamGenerator<T9>::iterator end9_;
- typename ParamGenerator<T9>::iterator current9_;
- const typename ParamGenerator<T10>::iterator begin10_;
- const typename ParamGenerator<T10>::iterator end10_;
- typename ParamGenerator<T10>::iterator current10_;
- ParamType current_value_;
- }; // class CartesianProductGenerator10::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator10& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
- const ParamGenerator<T8> g8_;
- const ParamGenerator<T9> g9_;
- const ParamGenerator<T10> g10_;
-}; // class CartesianProductGenerator10
-
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Helper classes providing Combine() with polymorphic features. They allow
-// casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
-// convertible to U.
-//
-template <class Generator1, class Generator2>
-class CartesianProductHolder2 {
- public:
-CartesianProductHolder2(const Generator1& g1, const Generator2& g2)
- : g1_(g1), g2_(g2) {}
- template <typename T1, typename T2>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2> >(
- new CartesianProductGenerator2<T1, T2>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder2& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
-}; // class CartesianProductHolder2
-
-template <class Generator1, class Generator2, class Generator3>
-class CartesianProductHolder3 {
- public:
-CartesianProductHolder3(const Generator1& g1, const Generator2& g2,
- const Generator3& g3)
- : g1_(g1), g2_(g2), g3_(g3) {}
- template <typename T1, typename T2, typename T3>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >(
- new CartesianProductGenerator3<T1, T2, T3>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder3& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
-}; // class CartesianProductHolder3
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4>
-class CartesianProductHolder4 {
- public:
-CartesianProductHolder4(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
- template <typename T1, typename T2, typename T3, typename T4>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >(
- new CartesianProductGenerator4<T1, T2, T3, T4>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder4& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
-}; // class CartesianProductHolder4
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5>
-class CartesianProductHolder5 {
- public:
-CartesianProductHolder5(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >(
- new CartesianProductGenerator5<T1, T2, T3, T4, T5>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder5& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
-}; // class CartesianProductHolder5
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6>
-class CartesianProductHolder6 {
- public:
-CartesianProductHolder6(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >(
- new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder6& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
-}; // class CartesianProductHolder6
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7>
-class CartesianProductHolder7 {
- public:
-CartesianProductHolder7(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
- T7> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> >(
- new CartesianProductGenerator7<T1, T2, T3, T4, T5, T6, T7>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder7& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
-}; // class CartesianProductHolder7
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7,
- class Generator8>
-class CartesianProductHolder8 {
- public:
-CartesianProductHolder8(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7, const Generator8& g8)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
- g8_(g8) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7,
- T8> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >(
- new CartesianProductGenerator8<T1, T2, T3, T4, T5, T6, T7, T8>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_),
- static_cast<ParamGenerator<T8> >(g8_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder8& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
- const Generator8 g8_;
-}; // class CartesianProductHolder8
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7,
- class Generator8, class Generator9>
-class CartesianProductHolder9 {
- public:
-CartesianProductHolder9(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7, const Generator8& g8,
- const Generator9& g9)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
- T9> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
- T9> >(
- new CartesianProductGenerator9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_),
- static_cast<ParamGenerator<T8> >(g8_),
- static_cast<ParamGenerator<T9> >(g9_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder9& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
- const Generator8 g8_;
- const Generator9 g9_;
-}; // class CartesianProductHolder9
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7,
- class Generator8, class Generator9, class Generator10>
-class CartesianProductHolder10 {
- public:
-CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7, const Generator8& g8,
- const Generator9& g9, const Generator10& g10)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9), g10_(g10) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
- T9, T10> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
- T9, T10> >(
- new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
- T10>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_),
- static_cast<ParamGenerator<T8> >(g8_),
- static_cast<ParamGenerator<T9> >(g9_),
- static_cast<ParamGenerator<T10> >(g10_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder10& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
- const Generator8 g8_;
- const Generator9 g9_;
- const Generator10 g10_;
-}; // class CartesianProductHolder10
-
-# endif // GTEST_HAS_COMBINE
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-param-util-generated.h.pump b/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-param-util-generated.h.pump
deleted file mode 100644
index 009206f..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-param-util-generated.h.pump
+++ /dev/null
@@ -1,301 +0,0 @@
-$$ -*- mode: c++; -*-
-$var n = 50 $$ Maximum length of Values arguments we want to support.
-$var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: vladl@google.com (Vlad Losev)
-
-// Type and function utilities for implementing parameterized tests.
-// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-// Currently Google Test supports at most $n arguments in Values,
-// and at most $maxtuple arguments in Combine. Please contact
-// googletestframework@googlegroups.com if you need more.
-// Please note that the number of arguments to Combine is limited
-// by the maximum arity of the implementation of tr1::tuple which is
-// currently set at $maxtuple.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-param-util.h"
-#include "gtest/internal/gtest-port.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Forward declarations of ValuesIn(), which is implemented in
-// include/gtest/gtest-param-test.h.
-template <typename ForwardIterator>
-internal::ParamGenerator<
- typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
-ValuesIn(ForwardIterator begin, ForwardIterator end);
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]);
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
- const Container& container);
-
-namespace internal {
-
-// Used in the Values() function to provide polymorphic capabilities.
-template <typename T1>
-class ValueArray1 {
- public:
- explicit ValueArray1(T1 v1) : v1_(v1) {}
-
- template <typename T>
- operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray1& other);
-
- const T1 v1_;
-};
-
-$range i 2..n
-$for i [[
-$range j 1..i
-
-template <$for j, [[typename T$j]]>
-class ValueArray$i {
- public:
- ValueArray$i($for j, [[T$j v$j]]) : $for j, [[v$(j)_(v$j)]] {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {$for j, [[static_cast<T>(v$(j)_)]]};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray$i& other);
-
-$for j [[
-
- const T$j v$(j)_;
-]]
-
-};
-
-]]
-
-# if GTEST_HAS_COMBINE
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Generates values from the Cartesian product of values produced
-// by the argument generators.
-//
-$range i 2..maxtuple
-$for i [[
-$range j 1..i
-$range k 2..i
-
-template <$for j, [[typename T$j]]>
-class CartesianProductGenerator$i
- : public ParamGeneratorInterface< ::std::tr1::tuple<$for j, [[T$j]]> > {
- public:
- typedef ::std::tr1::tuple<$for j, [[T$j]]> ParamType;
-
- CartesianProductGenerator$i($for j, [[const ParamGenerator<T$j>& g$j]])
- : $for j, [[g$(j)_(g$j)]] {}
- virtual ~CartesianProductGenerator$i() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, $for j, [[g$(j)_, g$(j)_.begin()]]);
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, $for j, [[g$(j)_, g$(j)_.end()]]);
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base, $for j, [[
-
- const ParamGenerator<T$j>& g$j,
- const typename ParamGenerator<T$j>::iterator& current$(j)]])
- : base_(base),
-$for j, [[
-
- begin$(j)_(g$j.begin()), end$(j)_(g$j.end()), current$(j)_(current$j)
-]] {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current$(i)_;
-
-$for k [[
- if (current$(i+2-k)_ == end$(i+2-k)_) {
- current$(i+2-k)_ = begin$(i+2-k)_;
- ++current$(i+2-k-1)_;
- }
-
-]]
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return ¤t_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- ($for j && [[
-
- current$(j)_ == typed_other->current$(j)_
-]]);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_), $for j, [[
-
- begin$(j)_(other.begin$(j)_),
- end$(j)_(other.end$(j)_),
- current$(j)_(other.current$(j)_)
-]] {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType($for j, [[*current$(j)_]]);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
-$for j || [[
-
- current$(j)_ == end$(j)_
-]];
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
-$for j [[
-
- const typename ParamGenerator<T$j>::iterator begin$(j)_;
- const typename ParamGenerator<T$j>::iterator end$(j)_;
- typename ParamGenerator<T$j>::iterator current$(j)_;
-]]
-
- ParamType current_value_;
- }; // class CartesianProductGenerator$i::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator$i& other);
-
-
-$for j [[
- const ParamGenerator<T$j> g$(j)_;
-
-]]
-}; // class CartesianProductGenerator$i
-
-
-]]
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Helper classes providing Combine() with polymorphic features. They allow
-// casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
-// convertible to U.
-//
-$range i 2..maxtuple
-$for i [[
-$range j 1..i
-
-template <$for j, [[class Generator$j]]>
-class CartesianProductHolder$i {
- public:
-CartesianProductHolder$i($for j, [[const Generator$j& g$j]])
- : $for j, [[g$(j)_(g$j)]] {}
- template <$for j, [[typename T$j]]>
- operator ParamGenerator< ::std::tr1::tuple<$for j, [[T$j]]> >() const {
- return ParamGenerator< ::std::tr1::tuple<$for j, [[T$j]]> >(
- new CartesianProductGenerator$i<$for j, [[T$j]]>(
-$for j,[[
-
- static_cast<ParamGenerator<T$j> >(g$(j)_)
-]]));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder$i& other);
-
-
-$for j [[
- const Generator$j g$(j)_;
-
-]]
-}; // class CartesianProductHolder$i
-
-]]
-
-# endif // GTEST_HAS_COMBINE
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-param-util.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-param-util.h
deleted file mode 100644
index d5e1028..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-param-util.h
+++ /dev/null
@@ -1,619 +0,0 @@
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: vladl@google.com (Vlad Losev)
-
-// Type and function utilities for implementing parameterized tests.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
-
-#include <iterator>
-#include <utility>
-#include <vector>
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-linked_ptr.h"
-#include "gtest/internal/gtest-port.h"
-#include "gtest/gtest-printers.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-namespace internal {
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Outputs a message explaining invalid registration of different
-// fixture class for the same test case. This may happen when
-// TEST_P macro is used to define two tests with the same name
-// but in different namespaces.
-GTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name,
- const char* file, int line);
-
-template <typename> class ParamGeneratorInterface;
-template <typename> class ParamGenerator;
-
-// Interface for iterating over elements provided by an implementation
-// of ParamGeneratorInterface<T>.
-template <typename T>
-class ParamIteratorInterface {
- public:
- virtual ~ParamIteratorInterface() {}
- // A pointer to the base generator instance.
- // Used only for the purposes of iterator comparison
- // to make sure that two iterators belong to the same generator.
- virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;
- // Advances iterator to point to the next element
- // provided by the generator. The caller is responsible
- // for not calling Advance() on an iterator equal to
- // BaseGenerator()->End().
- virtual void Advance() = 0;
- // Clones the iterator object. Used for implementing copy semantics
- // of ParamIterator<T>.
- virtual ParamIteratorInterface* Clone() const = 0;
- // Dereferences the current iterator and provides (read-only) access
- // to the pointed value. It is the caller's responsibility not to call
- // Current() on an iterator equal to BaseGenerator()->End().
- // Used for implementing ParamGenerator<T>::operator*().
- virtual const T* Current() const = 0;
- // Determines whether the given iterator and other point to the same
- // element in the sequence generated by the generator.
- // Used for implementing ParamGenerator<T>::operator==().
- virtual bool Equals(const ParamIteratorInterface& other) const = 0;
-};
-
-// Class iterating over elements provided by an implementation of
-// ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>
-// and implements the const forward iterator concept.
-template <typename T>
-class ParamIterator {
- public:
- typedef T value_type;
- typedef const T& reference;
- typedef ptrdiff_t difference_type;
-
- // ParamIterator assumes ownership of the impl_ pointer.
- ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
- ParamIterator& operator=(const ParamIterator& other) {
- if (this != &other)
- impl_.reset(other.impl_->Clone());
- return *this;
- }
-
- const T& operator*() const { return *impl_->Current(); }
- const T* operator->() const { return impl_->Current(); }
- // Prefix version of operator++.
- ParamIterator& operator++() {
- impl_->Advance();
- return *this;
- }
- // Postfix version of operator++.
- ParamIterator operator++(int /*unused*/) {
- ParamIteratorInterface<T>* clone = impl_->Clone();
- impl_->Advance();
- return ParamIterator(clone);
- }
- bool operator==(const ParamIterator& other) const {
- return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);
- }
- bool operator!=(const ParamIterator& other) const {
- return !(*this == other);
- }
-
- private:
- friend class ParamGenerator<T>;
- explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
- scoped_ptr<ParamIteratorInterface<T> > impl_;
-};
-
-// ParamGeneratorInterface<T> is the binary interface to access generators
-// defined in other translation units.
-template <typename T>
-class ParamGeneratorInterface {
- public:
- typedef T ParamType;
-
- virtual ~ParamGeneratorInterface() {}
-
- // Generator interface definition
- virtual ParamIteratorInterface<T>* Begin() const = 0;
- virtual ParamIteratorInterface<T>* End() const = 0;
-};
-
-// Wraps ParamGeneratorInterface<T> and provides general generator syntax
-// compatible with the STL Container concept.
-// This class implements copy initialization semantics and the contained
-// ParamGeneratorInterface<T> instance is shared among all copies
-// of the original object. This is possible because that instance is immutable.
-template<typename T>
-class ParamGenerator {
- public:
- typedef ParamIterator<T> iterator;
-
- explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}
- ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}
-
- ParamGenerator& operator=(const ParamGenerator& other) {
- impl_ = other.impl_;
- return *this;
- }
-
- iterator begin() const { return iterator(impl_->Begin()); }
- iterator end() const { return iterator(impl_->End()); }
-
- private:
- linked_ptr<const ParamGeneratorInterface<T> > impl_;
-};
-
-// Generates values from a range of two comparable values. Can be used to
-// generate sequences of user-defined types that implement operator+() and
-// operator<().
-// This class is used in the Range() function.
-template <typename T, typename IncrementT>
-class RangeGenerator : public ParamGeneratorInterface<T> {
- public:
- RangeGenerator(T begin, T end, IncrementT step)
- : begin_(begin), end_(end),
- step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}
- virtual ~RangeGenerator() {}
-
- virtual ParamIteratorInterface<T>* Begin() const {
- return new Iterator(this, begin_, 0, step_);
- }
- virtual ParamIteratorInterface<T>* End() const {
- return new Iterator(this, end_, end_index_, step_);
- }
-
- private:
- class Iterator : public ParamIteratorInterface<T> {
- public:
- Iterator(const ParamGeneratorInterface<T>* base, T value, int index,
- IncrementT step)
- : base_(base), value_(value), index_(index), step_(step) {}
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
- return base_;
- }
- virtual void Advance() {
- value_ = value_ + step_;
- index_++;
- }
- virtual ParamIteratorInterface<T>* Clone() const {
- return new Iterator(*this);
- }
- virtual const T* Current() const { return &value_; }
- virtual bool Equals(const ParamIteratorInterface<T>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const int other_index =
- CheckedDowncastToActualType<const Iterator>(&other)->index_;
- return index_ == other_index;
- }
-
- private:
- Iterator(const Iterator& other)
- : ParamIteratorInterface<T>(),
- base_(other.base_), value_(other.value_), index_(other.index_),
- step_(other.step_) {}
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<T>* const base_;
- T value_;
- int index_;
- const IncrementT step_;
- }; // class RangeGenerator::Iterator
-
- static int CalculateEndIndex(const T& begin,
- const T& end,
- const IncrementT& step) {
- int end_index = 0;
- for (T i = begin; i < end; i = i + step)
- end_index++;
- return end_index;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const RangeGenerator& other);
-
- const T begin_;
- const T end_;
- const IncrementT step_;
- // The index for the end() iterator. All the elements in the generated
- // sequence are indexed (0-based) to aid iterator comparison.
- const int end_index_;
-}; // class RangeGenerator
-
-
-// Generates values from a pair of STL-style iterators. Used in the
-// ValuesIn() function. The elements are copied from the source range
-// since the source can be located on the stack, and the generator
-// is likely to persist beyond that stack frame.
-template <typename T>
-class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
- public:
- template <typename ForwardIterator>
- ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
- : container_(begin, end) {}
- virtual ~ValuesInIteratorRangeGenerator() {}
-
- virtual ParamIteratorInterface<T>* Begin() const {
- return new Iterator(this, container_.begin());
- }
- virtual ParamIteratorInterface<T>* End() const {
- return new Iterator(this, container_.end());
- }
-
- private:
- typedef typename ::std::vector<T> ContainerType;
-
- class Iterator : public ParamIteratorInterface<T> {
- public:
- Iterator(const ParamGeneratorInterface<T>* base,
- typename ContainerType::const_iterator iterator)
- : base_(base), iterator_(iterator) {}
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
- return base_;
- }
- virtual void Advance() {
- ++iterator_;
- value_.reset();
- }
- virtual ParamIteratorInterface<T>* Clone() const {
- return new Iterator(*this);
- }
- // We need to use cached value referenced by iterator_ because *iterator_
- // can return a temporary object (and of type other then T), so just
- // having "return &*iterator_;" doesn't work.
- // value_ is updated here and not in Advance() because Advance()
- // can advance iterator_ beyond the end of the range, and we cannot
- // detect that fact. The client code, on the other hand, is
- // responsible for not calling Current() on an out-of-range iterator.
- virtual const T* Current() const {
- if (value_.get() == NULL)
- value_.reset(new T(*iterator_));
- return value_.get();
- }
- virtual bool Equals(const ParamIteratorInterface<T>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- return iterator_ ==
- CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
- }
-
- private:
- Iterator(const Iterator& other)
- // The explicit constructor call suppresses a false warning
- // emitted by gcc when supplied with the -Wextra option.
- : ParamIteratorInterface<T>(),
- base_(other.base_),
- iterator_(other.iterator_) {}
-
- const ParamGeneratorInterface<T>* const base_;
- typename ContainerType::const_iterator iterator_;
- // A cached value of *iterator_. We keep it here to allow access by
- // pointer in the wrapping iterator's operator->().
- // value_ needs to be mutable to be accessed in Current().
- // Use of scoped_ptr helps manage cached value's lifetime,
- // which is bound by the lifespan of the iterator itself.
- mutable scoped_ptr<const T> value_;
- }; // class ValuesInIteratorRangeGenerator::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const ValuesInIteratorRangeGenerator& other);
-
- const ContainerType container_;
-}; // class ValuesInIteratorRangeGenerator
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Stores a parameter value and later creates tests parameterized with that
-// value.
-template <class TestClass>
-class ParameterizedTestFactory : public TestFactoryBase {
- public:
- typedef typename TestClass::ParamType ParamType;
- explicit ParameterizedTestFactory(ParamType parameter) :
- parameter_(parameter) {}
- virtual Test* CreateTest() {
- TestClass::SetParam(¶meter_);
- return new TestClass();
- }
-
- private:
- const ParamType parameter_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// TestMetaFactoryBase is a base class for meta-factories that create
-// test factories for passing into MakeAndRegisterTestInfo function.
-template <class ParamType>
-class TestMetaFactoryBase {
- public:
- virtual ~TestMetaFactoryBase() {}
-
- virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// TestMetaFactory creates test factories for passing into
-// MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives
-// ownership of test factory pointer, same factory object cannot be passed
-// into that method twice. But ParameterizedTestCaseInfo is going to call
-// it for each Test/Parameter value combination. Thus it needs meta factory
-// creator class.
-template <class TestCase>
-class TestMetaFactory
- : public TestMetaFactoryBase<typename TestCase::ParamType> {
- public:
- typedef typename TestCase::ParamType ParamType;
-
- TestMetaFactory() {}
-
- virtual TestFactoryBase* CreateTestFactory(ParamType parameter) {
- return new ParameterizedTestFactory<TestCase>(parameter);
- }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseInfoBase is a generic interface
-// to ParameterizedTestCaseInfo classes. ParameterizedTestCaseInfoBase
-// accumulates test information provided by TEST_P macro invocations
-// and generators provided by INSTANTIATE_TEST_CASE_P macro invocations
-// and uses that information to register all resulting test instances
-// in RegisterTests method. The ParameterizeTestCaseRegistry class holds
-// a collection of pointers to the ParameterizedTestCaseInfo objects
-// and calls RegisterTests() on each of them when asked.
-class ParameterizedTestCaseInfoBase {
- public:
- virtual ~ParameterizedTestCaseInfoBase() {}
-
- // Base part of test case name for display purposes.
- virtual const string& GetTestCaseName() const = 0;
- // Test case id to verify identity.
- virtual TypeId GetTestCaseTypeId() const = 0;
- // UnitTest class invokes this method to register tests in this
- // test case right before running them in RUN_ALL_TESTS macro.
- // This method should not be called more then once on any single
- // instance of a ParameterizedTestCaseInfoBase derived class.
- virtual void RegisterTests() = 0;
-
- protected:
- ParameterizedTestCaseInfoBase() {}
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfoBase);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseInfo accumulates tests obtained from TEST_P
-// macro invocations for a particular test case and generators
-// obtained from INSTANTIATE_TEST_CASE_P macro invocations for that
-// test case. It registers tests with all values generated by all
-// generators when asked.
-template <class TestCase>
-class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
- public:
- // ParamType and GeneratorCreationFunc are private types but are required
- // for declarations of public methods AddTestPattern() and
- // AddTestCaseInstantiation().
- typedef typename TestCase::ParamType ParamType;
- // A function that returns an instance of appropriate generator type.
- typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();
-
- explicit ParameterizedTestCaseInfo(const char* name)
- : test_case_name_(name) {}
-
- // Test case base name for display purposes.
- virtual const string& GetTestCaseName() const { return test_case_name_; }
- // Test case id to verify identity.
- virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }
- // TEST_P macro uses AddTestPattern() to record information
- // about a single test in a LocalTestInfo structure.
- // test_case_name is the base name of the test case (without invocation
- // prefix). test_base_name is the name of an individual test without
- // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is
- // test case base name and DoBar is test base name.
- void AddTestPattern(const char* test_case_name,
- const char* test_base_name,
- TestMetaFactoryBase<ParamType>* meta_factory) {
- tests_.push_back(linked_ptr<TestInfo>(new TestInfo(test_case_name,
- test_base_name,
- meta_factory)));
- }
- // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information
- // about a generator.
- int AddTestCaseInstantiation(const string& instantiation_name,
- GeneratorCreationFunc* func,
- const char* /* file */,
- int /* line */) {
- instantiations_.push_back(::std::make_pair(instantiation_name, func));
- return 0; // Return value used only to run this method in namespace scope.
- }
- // UnitTest class invokes this method to register tests in this test case
- // test cases right before running tests in RUN_ALL_TESTS macro.
- // This method should not be called more then once on any single
- // instance of a ParameterizedTestCaseInfoBase derived class.
- // UnitTest has a guard to prevent from calling this method more then once.
- virtual void RegisterTests() {
- for (typename TestInfoContainer::iterator test_it = tests_.begin();
- test_it != tests_.end(); ++test_it) {
- linked_ptr<TestInfo> test_info = *test_it;
- for (typename InstantiationContainer::iterator gen_it =
- instantiations_.begin(); gen_it != instantiations_.end();
- ++gen_it) {
- const string& instantiation_name = gen_it->first;
- ParamGenerator<ParamType> generator((*gen_it->second)());
-
- string test_case_name;
- if ( !instantiation_name.empty() )
- test_case_name = instantiation_name + "/";
- test_case_name += test_info->test_case_base_name;
-
- int i = 0;
- for (typename ParamGenerator<ParamType>::iterator param_it =
- generator.begin();
- param_it != generator.end(); ++param_it, ++i) {
- Message test_name_stream;
- test_name_stream << test_info->test_base_name << "/" << i;
- MakeAndRegisterTestInfo(
- test_case_name.c_str(),
- test_name_stream.GetString().c_str(),
- NULL, // No type parameter.
- PrintToString(*param_it).c_str(),
- GetTestCaseTypeId(),
- TestCase::SetUpTestCase,
- TestCase::TearDownTestCase,
- test_info->test_meta_factory->CreateTestFactory(*param_it));
- } // for param_it
- } // for gen_it
- } // for test_it
- } // RegisterTests
-
- private:
- // LocalTestInfo structure keeps information about a single test registered
- // with TEST_P macro.
- struct TestInfo {
- TestInfo(const char* a_test_case_base_name,
- const char* a_test_base_name,
- TestMetaFactoryBase<ParamType>* a_test_meta_factory) :
- test_case_base_name(a_test_case_base_name),
- test_base_name(a_test_base_name),
- test_meta_factory(a_test_meta_factory) {}
-
- const string test_case_base_name;
- const string test_base_name;
- const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
- };
- typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;
- // Keeps pairs of <Instantiation name, Sequence generator creation function>
- // received from INSTANTIATE_TEST_CASE_P macros.
- typedef ::std::vector<std::pair<string, GeneratorCreationFunc*> >
- InstantiationContainer;
-
- const string test_case_name_;
- TestInfoContainer tests_;
- InstantiationContainer instantiations_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfo);
-}; // class ParameterizedTestCaseInfo
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseRegistry contains a map of ParameterizedTestCaseInfoBase
-// classes accessed by test case names. TEST_P and INSTANTIATE_TEST_CASE_P
-// macros use it to locate their corresponding ParameterizedTestCaseInfo
-// descriptors.
-class ParameterizedTestCaseRegistry {
- public:
- ParameterizedTestCaseRegistry() {}
- ~ParameterizedTestCaseRegistry() {
- for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
- it != test_case_infos_.end(); ++it) {
- delete *it;
- }
- }
-
- // Looks up or creates and returns a structure containing information about
- // tests and instantiations of a particular test case.
- template <class TestCase>
- ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder(
- const char* test_case_name,
- const char* file,
- int line) {
- ParameterizedTestCaseInfo<TestCase>* typed_test_info = NULL;
- for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
- it != test_case_infos_.end(); ++it) {
- if ((*it)->GetTestCaseName() == test_case_name) {
- if ((*it)->GetTestCaseTypeId() != GetTypeId<TestCase>()) {
- // Complain about incorrect usage of Google Test facilities
- // and terminate the program since we cannot guaranty correct
- // test case setup and tear-down in this case.
- ReportInvalidTestCaseType(test_case_name, file, line);
- posix::Abort();
- } else {
- // At this point we are sure that the object we found is of the same
- // type we are looking for, so we downcast it to that type
- // without further checks.
- typed_test_info = CheckedDowncastToActualType<
- ParameterizedTestCaseInfo<TestCase> >(*it);
- }
- break;
- }
- }
- if (typed_test_info == NULL) {
- typed_test_info = new ParameterizedTestCaseInfo<TestCase>(test_case_name);
- test_case_infos_.push_back(typed_test_info);
- }
- return typed_test_info;
- }
- void RegisterTests() {
- for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
- it != test_case_infos_.end(); ++it) {
- (*it)->RegisterTests();
- }
- }
-
- private:
- typedef ::std::vector<ParameterizedTestCaseInfoBase*> TestCaseInfoContainer;
-
- TestCaseInfoContainer test_case_infos_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseRegistry);
-};
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-port.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-port.h
deleted file mode 100644
index dc4fe0c..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-port.h
+++ /dev/null
@@ -1,1947 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan)
-//
-// Low-level types and utilities for porting Google Test to various
-// platforms. They are subject to change without notice. DO NOT USE
-// THEM IN USER CODE.
-//
-// This file is fundamental to Google Test. All other Google Test source
-// files are expected to #include this. Therefore, it cannot #include
-// any other Google Test header.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
-
-// The user can define the following macros in the build script to
-// control Google Test's behavior. If the user doesn't define a macro
-// in this list, Google Test will define it.
-//
-// GTEST_HAS_CLONE - Define it to 1/0 to indicate that clone(2)
-// is/isn't available.
-// GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions
-// are enabled.
-// GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string
-// is/isn't available (some systems define
-// ::string, which is different to std::string).
-// GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
-// is/isn't available (some systems define
-// ::wstring, which is different to std::wstring).
-// GTEST_HAS_POSIX_RE - Define it to 1/0 to indicate that POSIX regular
-// expressions are/aren't available.
-// GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h>
-// is/isn't available.
-// GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't
-// enabled.
-// GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that
-// std::wstring does/doesn't work (Google Test can
-// be used where std::wstring is unavailable).
-// GTEST_HAS_TR1_TUPLE - Define it to 1/0 to indicate tr1::tuple
-// is/isn't available.
-// GTEST_HAS_SEH - Define it to 1/0 to indicate whether the
-// compiler supports Microsoft's "Structured
-// Exception Handling".
-// GTEST_HAS_STREAM_REDIRECTION
-// - Define it to 1/0 to indicate whether the
-// platform supports I/O stream redirection using
-// dup() and dup2().
-// GTEST_USE_OWN_TR1_TUPLE - Define it to 1/0 to indicate whether Google
-// Test's own tr1 tuple implementation should be
-// used. Unused when the user sets
-// GTEST_HAS_TR1_TUPLE to 0.
-// GTEST_LANG_CXX11 - Define it to 1/0 to indicate that Google Test
-// is building in C++11/C++98 mode.
-// GTEST_LINKED_AS_SHARED_LIBRARY
-// - Define to 1 when compiling tests that use
-// Google Test as a shared library (known as
-// DLL on Windows).
-// GTEST_CREATE_SHARED_LIBRARY
-// - Define to 1 when compiling Google Test itself
-// as a shared library.
-
-// This header defines the following utilities:
-//
-// Macros indicating the current platform (defined to 1 if compiled on
-// the given platform; otherwise undefined):
-// GTEST_OS_AIX - IBM AIX
-// GTEST_OS_CYGWIN - Cygwin
-// GTEST_OS_HPUX - HP-UX
-// GTEST_OS_LINUX - Linux
-// GTEST_OS_LINUX_ANDROID - Google Android
-// GTEST_OS_MAC - Mac OS X
-// GTEST_OS_IOS - iOS
-// GTEST_OS_IOS_SIMULATOR - iOS simulator
-// GTEST_OS_NACL - Google Native Client (NaCl)
-// GTEST_OS_OPENBSD - OpenBSD
-// GTEST_OS_QNX - QNX
-// GTEST_OS_SOLARIS - Sun Solaris
-// GTEST_OS_SYMBIAN - Symbian
-// GTEST_OS_WINDOWS - Windows (Desktop, MinGW, or Mobile)
-// GTEST_OS_WINDOWS_DESKTOP - Windows Desktop
-// GTEST_OS_WINDOWS_MINGW - MinGW
-// GTEST_OS_WINDOWS_MOBILE - Windows Mobile
-// GTEST_OS_ZOS - z/OS
-//
-// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
-// most stable support. Since core members of the Google Test project
-// don't have access to other platforms, support for them may be less
-// stable. If you notice any problems on your platform, please notify
-// googletestframework@googlegroups.com (patches for fixing them are
-// even more welcome!).
-//
-// Note that it is possible that none of the GTEST_OS_* macros are defined.
-//
-// Macros indicating available Google Test features (defined to 1 if
-// the corresponding feature is supported; otherwise undefined):
-// GTEST_HAS_COMBINE - the Combine() function (for value-parameterized
-// tests)
-// GTEST_HAS_DEATH_TEST - death tests
-// GTEST_HAS_PARAM_TEST - value-parameterized tests
-// GTEST_HAS_TYPED_TEST - typed tests
-// GTEST_HAS_TYPED_TEST_P - type-parameterized tests
-// GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse with
-// GTEST_HAS_POSIX_RE (see above) which users can
-// define themselves.
-// GTEST_USES_SIMPLE_RE - our own simple regex is used;
-// the above two are mutually exclusive.
-// GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
-//
-// Macros for basic C++ coding:
-// GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
-// GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a
-// variable don't have to be used.
-// GTEST_DISALLOW_ASSIGN_ - disables operator=.
-// GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
-// GTEST_MUST_USE_RESULT_ - declares that a function's result must be used.
-//
-// Synchronization:
-// Mutex, MutexLock, ThreadLocal, GetThreadCount()
-// - synchronization primitives.
-// GTEST_IS_THREADSAFE - defined to 1 to indicate that the above
-// synchronization primitives have real implementations
-// and Google Test is thread-safe; or 0 otherwise.
-//
-// Template meta programming:
-// is_pointer - as in TR1; needed on Symbian and IBM XL C/C++ only.
-// IteratorTraits - partial implementation of std::iterator_traits, which
-// is not available in libCstd when compiled with Sun C++.
-//
-// Smart pointers:
-// scoped_ptr - as in TR2.
-//
-// Regular expressions:
-// RE - a simple regular expression class using the POSIX
-// Extended Regular Expression syntax on UNIX-like
-// platforms, or a reduced regular exception syntax on
-// other platforms, including Windows.
-//
-// Logging:
-// GTEST_LOG_() - logs messages at the specified severity level.
-// LogToStderr() - directs all log messages to stderr.
-// FlushInfoLog() - flushes informational log messages.
-//
-// Stdout and stderr capturing:
-// CaptureStdout() - starts capturing stdout.
-// GetCapturedStdout() - stops capturing stdout and returns the captured
-// string.
-// CaptureStderr() - starts capturing stderr.
-// GetCapturedStderr() - stops capturing stderr and returns the captured
-// string.
-//
-// Integer types:
-// TypeWithSize - maps an integer to a int type.
-// Int32, UInt32, Int64, UInt64, TimeInMillis
-// - integers of known sizes.
-// BiggestInt - the biggest signed integer type.
-//
-// Command-line utilities:
-// GTEST_FLAG() - references a flag.
-// GTEST_DECLARE_*() - declares a flag.
-// GTEST_DEFINE_*() - defines a flag.
-// GetInjectableArgvs() - returns the command line as a vector of strings.
-//
-// Environment variable utilities:
-// GetEnv() - gets the value of an environment variable.
-// BoolFromGTestEnv() - parses a bool environment variable.
-// Int32FromGTestEnv() - parses an Int32 environment variable.
-// StringFromGTestEnv() - parses a string environment variable.
-
-#include <ctype.h> // for isspace, etc
-#include <stddef.h> // for ptrdiff_t
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#ifndef _WIN32_WCE
-# include <sys/types.h>
-# include <sys/stat.h>
-#endif // !_WIN32_WCE
-
-#if defined __APPLE__
-# include <AvailabilityMacros.h>
-# include <TargetConditionals.h>
-#endif
-
-#include <iostream> // NOLINT
-#include <sstream> // NOLINT
-#include <string> // NOLINT
-
-#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
-#define GTEST_FLAG_PREFIX_ "gtest_"
-#define GTEST_FLAG_PREFIX_DASH_ "gtest-"
-#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
-#define GTEST_NAME_ "Google Test"
-#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
-
-// Determines the version of gcc that is used to compile this.
-#ifdef __GNUC__
-// 40302 means version 4.3.2.
-# define GTEST_GCC_VER_ \
- (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
-#endif // __GNUC__
-
-// Determines the platform on which Google Test is compiled.
-#ifdef __CYGWIN__
-# define GTEST_OS_CYGWIN 1
-#elif defined __SYMBIAN32__
-# define GTEST_OS_SYMBIAN 1
-#elif defined _WIN32
-# define GTEST_OS_WINDOWS 1
-# ifdef _WIN32_WCE
-# define GTEST_OS_WINDOWS_MOBILE 1
-# elif defined(__MINGW__) || defined(__MINGW32__)
-# define GTEST_OS_WINDOWS_MINGW 1
-# else
-# define GTEST_OS_WINDOWS_DESKTOP 1
-# endif // _WIN32_WCE
-#elif defined __APPLE__
-# define GTEST_OS_MAC 1
-# if TARGET_OS_IPHONE
-# define GTEST_OS_IOS 1
-# if TARGET_IPHONE_SIMULATOR
-# define GTEST_OS_IOS_SIMULATOR 1
-# endif
-# endif
-#elif defined __linux__
-# define GTEST_OS_LINUX 1
-# if defined __ANDROID__
-# define GTEST_OS_LINUX_ANDROID 1
-# endif
-#elif defined __MVS__
-# define GTEST_OS_ZOS 1
-#elif defined(__sun) && defined(__SVR4)
-# define GTEST_OS_SOLARIS 1
-#elif defined(_AIX)
-# define GTEST_OS_AIX 1
-#elif defined(__hpux)
-# define GTEST_OS_HPUX 1
-#elif defined __native_client__
-# define GTEST_OS_NACL 1
-#elif defined __OpenBSD__
-# define GTEST_OS_OPENBSD 1
-#elif defined __QNX__
-# define GTEST_OS_QNX 1
-#endif // __CYGWIN__
-
-#ifndef GTEST_LANG_CXX11
-// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
-// -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a
-// value for __cplusplus, and recent versions of clang, gcc, and
-// probably other compilers set that too in C++11 mode.
-# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
-// Compiling in at least C++11 mode.
-# define GTEST_LANG_CXX11 1
-# else
-# define GTEST_LANG_CXX11 0
-# endif
-#endif
-
-// Brings in definitions for functions used in the testing::internal::posix
-// namespace (read, write, close, chdir, isatty, stat). We do not currently
-// use them on Windows Mobile.
-#if !GTEST_OS_WINDOWS
-// This assumes that non-Windows OSes provide unistd.h. For OSes where this
-// is not the case, we need to include headers that provide the functions
-// mentioned above.
-# include <unistd.h>
-# include <strings.h>
-#elif !GTEST_OS_WINDOWS_MOBILE
-# include <direct.h>
-# include <io.h>
-#endif
-
-#if GTEST_OS_LINUX_ANDROID
-// Used to define __ANDROID_API__ matching the target NDK API level.
-# include <android/api-level.h> // NOLINT
-#endif
-
-// Defines this to true iff Google Test can use POSIX regular expressions.
-#ifndef GTEST_HAS_POSIX_RE
-# if GTEST_OS_LINUX_ANDROID
-// On Android, <regex.h> is only available starting with Gingerbread.
-# define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
-# else
-# define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
-# endif
-#endif
-
-#if GTEST_HAS_POSIX_RE
-
-// On some platforms, <regex.h> needs someone to define size_t, and
-// won't compile otherwise. We can #include it here as we already
-// included <stdlib.h>, which is guaranteed to define size_t through
-// <stddef.h>.
-# include <regex.h> // NOLINT
-
-# define GTEST_USES_POSIX_RE 1
-
-#elif GTEST_OS_WINDOWS
-
-// <regex.h> is not available on Windows. Use our own simple regex
-// implementation instead.
-# define GTEST_USES_SIMPLE_RE 1
-
-#else
-
-// <regex.h> may not be available on this platform. Use our own
-// simple regex implementation instead.
-# define GTEST_USES_SIMPLE_RE 1
-
-#endif // GTEST_HAS_POSIX_RE
-
-#ifndef GTEST_HAS_EXCEPTIONS
-// The user didn't tell us whether exceptions are enabled, so we need
-// to figure it out.
-# if defined(_MSC_VER) || defined(__BORLANDC__)
-// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
-// macro to enable exceptions, so we'll do the same.
-// Assumes that exceptions are enabled by default.
-# ifndef _HAS_EXCEPTIONS
-# define _HAS_EXCEPTIONS 1
-# endif // _HAS_EXCEPTIONS
-# define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
-# elif defined(__GNUC__) && __EXCEPTIONS
-// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
-# define GTEST_HAS_EXCEPTIONS 1
-# elif defined(__SUNPRO_CC)
-// Sun Pro CC supports exceptions. However, there is no compile-time way of
-// detecting whether they are enabled or not. Therefore, we assume that
-// they are enabled unless the user tells us otherwise.
-# define GTEST_HAS_EXCEPTIONS 1
-# elif defined(__IBMCPP__) && __EXCEPTIONS
-// xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
-# define GTEST_HAS_EXCEPTIONS 1
-# elif defined(__HP_aCC)
-// Exception handling is in effect by default in HP aCC compiler. It has to
-// be turned of by +noeh compiler option if desired.
-# define GTEST_HAS_EXCEPTIONS 1
-# else
-// For other compilers, we assume exceptions are disabled to be
-// conservative.
-# define GTEST_HAS_EXCEPTIONS 0
-# endif // defined(_MSC_VER) || defined(__BORLANDC__)
-#endif // GTEST_HAS_EXCEPTIONS
-
-#if !defined(GTEST_HAS_STD_STRING)
-// Even though we don't use this macro any longer, we keep it in case
-// some clients still depend on it.
-# define GTEST_HAS_STD_STRING 1
-#elif !GTEST_HAS_STD_STRING
-// The user told us that ::std::string isn't available.
-# error "Google Test cannot be used where ::std::string isn't available."
-#endif // !defined(GTEST_HAS_STD_STRING)
-
-#ifndef GTEST_HAS_GLOBAL_STRING
-// The user didn't tell us whether ::string is available, so we need
-// to figure it out.
-
-# define GTEST_HAS_GLOBAL_STRING 0
-
-#endif // GTEST_HAS_GLOBAL_STRING
-
-#ifndef GTEST_HAS_STD_WSTRING
-// The user didn't tell us whether ::std::wstring is available, so we need
-// to figure it out.
-// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
-// is available.
-
-// Cygwin 1.7 and below doesn't support ::std::wstring.
-// Solaris' libc++ doesn't support it either. Android has
-// no support for it at least as recent as Froyo (2.2).
-# define GTEST_HAS_STD_WSTRING \
- (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
-
-#endif // GTEST_HAS_STD_WSTRING
-
-#ifndef GTEST_HAS_GLOBAL_WSTRING
-// The user didn't tell us whether ::wstring is available, so we need
-// to figure it out.
-# define GTEST_HAS_GLOBAL_WSTRING \
- (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-// Determines whether RTTI is available.
-#ifndef GTEST_HAS_RTTI
-// The user didn't tell us whether RTTI is enabled, so we need to
-// figure it out.
-
-# ifdef _MSC_VER
-
-# ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled.
-# define GTEST_HAS_RTTI 1
-# else
-# define GTEST_HAS_RTTI 0
-# endif
-
-// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
-# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
-
-# ifdef __GXX_RTTI
-// When building against STLport with the Android NDK and with
-// -frtti -fno-exceptions, the build fails at link time with undefined
-// references to __cxa_bad_typeid. Note sure if STL or toolchain bug,
-// so disable RTTI when detected.
-# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \
- !defined(__EXCEPTIONS)
-# define GTEST_HAS_RTTI 0
-# else
-# define GTEST_HAS_RTTI 1
-# endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS
-# else
-# define GTEST_HAS_RTTI 0
-# endif // __GXX_RTTI
-
-// Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
-// using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
-// first version with C++ support.
-# elif defined(__clang__)
-
-# define GTEST_HAS_RTTI __has_feature(cxx_rtti)
-
-// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
-// both the typeid and dynamic_cast features are present.
-# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
-
-# ifdef __RTTI_ALL__
-# define GTEST_HAS_RTTI 1
-# else
-# define GTEST_HAS_RTTI 0
-# endif
-
-# else
-
-// For all other compilers, we assume RTTI is enabled.
-# define GTEST_HAS_RTTI 1
-
-# endif // _MSC_VER
-
-#endif // GTEST_HAS_RTTI
-
-// It's this header's responsibility to #include <typeinfo> when RTTI
-// is enabled.
-#if GTEST_HAS_RTTI
-# include <typeinfo>
-#endif
-
-// Determines whether Google Test can use the pthreads library.
-#ifndef GTEST_HAS_PTHREAD
-// The user didn't tell us explicitly, so we assume pthreads support is
-// available on Linux and Mac.
-//
-// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
-// to your compiler flags.
-# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \
- || GTEST_OS_QNX)
-#endif // GTEST_HAS_PTHREAD
-
-#if GTEST_HAS_PTHREAD
-// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
-// true.
-# include <pthread.h> // NOLINT
-
-// For timespec and nanosleep, used below.
-# include <time.h> // NOLINT
-#endif
-
-// Determines whether Google Test can use tr1/tuple. You can define
-// this macro to 0 to prevent Google Test from using tuple (any
-// feature depending on tuple with be disabled in this mode).
-#ifndef GTEST_HAS_TR1_TUPLE
-# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR)
-// STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>.
-# define GTEST_HAS_TR1_TUPLE 0
-# else
-// The user didn't tell us not to do it, so we assume it's OK.
-# define GTEST_HAS_TR1_TUPLE 1
-# endif
-#endif // GTEST_HAS_TR1_TUPLE
-
-// Determines whether Google Test's own tr1 tuple implementation
-// should be used.
-#ifndef GTEST_USE_OWN_TR1_TUPLE
-// The user didn't tell us, so we need to figure it out.
-
-// We use our own TR1 tuple if we aren't sure the user has an
-// implementation of it already. At this time, libstdc++ 4.0.0+ and
-// MSVC 2010 are the only mainstream standard libraries that come
-// with a TR1 tuple implementation. NVIDIA's CUDA NVCC compiler
-// pretends to be GCC by defining __GNUC__ and friends, but cannot
-// compile GCC's tuple implementation. MSVC 2008 (9.0) provides TR1
-// tuple in a 323 MB Feature Pack download, which we cannot assume the
-// user has. QNX's QCC compiler is a modified GCC but it doesn't
-// support TR1 tuple. libc++ only provides std::tuple, in C++11 mode,
-// and it can be used with some compilers that define __GNUC__.
-# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
- && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600
-# define GTEST_ENV_HAS_TR1_TUPLE_ 1
-# endif
-
-// C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used
-// in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6
-// can build with clang but need to use gcc4.2's libstdc++).
-# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
-# define GTEST_ENV_HAS_STD_TUPLE_ 1
-# endif
-
-# if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_
-# define GTEST_USE_OWN_TR1_TUPLE 0
-# else
-# define GTEST_USE_OWN_TR1_TUPLE 1
-# endif
-
-#endif // GTEST_USE_OWN_TR1_TUPLE
-
-// To avoid conditional compilation everywhere, we make it
-// gtest-port.h's responsibility to #include the header implementing
-// tr1/tuple.
-#if GTEST_HAS_TR1_TUPLE
-
-# if GTEST_USE_OWN_TR1_TUPLE
-# include "gtest/internal/gtest-tuple.h"
-# elif GTEST_ENV_HAS_STD_TUPLE_
-# include <tuple>
-// C++11 puts its tuple into the ::std namespace rather than
-// ::std::tr1. gtest expects tuple to live in ::std::tr1, so put it there.
-// This causes undefined behavior, but supported compilers react in
-// the way we intend.
-namespace std {
-namespace tr1 {
-using ::std::get;
-using ::std::make_tuple;
-using ::std::tuple;
-using ::std::tuple_element;
-using ::std::tuple_size;
-}
-}
-
-# elif GTEST_OS_SYMBIAN
-
-// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
-// use STLport's tuple implementation, which unfortunately doesn't
-// work as the copy of STLport distributed with Symbian is incomplete.
-// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
-// use its own tuple implementation.
-# ifdef BOOST_HAS_TR1_TUPLE
-# undef BOOST_HAS_TR1_TUPLE
-# endif // BOOST_HAS_TR1_TUPLE
-
-// This prevents <boost/tr1/detail/config.hpp>, which defines
-// BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
-# define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
-# include <tuple>
-
-# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
-// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header. This does
-// not conform to the TR1 spec, which requires the header to be <tuple>.
-
-# if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
-// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
-// which is #included by <tr1/tuple>, to not compile when RTTI is
-// disabled. _TR1_FUNCTIONAL is the header guard for
-// <tr1/functional>. Hence the following #define is a hack to prevent
-// <tr1/functional> from being included.
-# define _TR1_FUNCTIONAL 1
-# include <tr1/tuple>
-# undef _TR1_FUNCTIONAL // Allows the user to #include
- // <tr1/functional> if he chooses to.
-# else
-# include <tr1/tuple> // NOLINT
-# endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
-
-# else
-// If the compiler is not GCC 4.0+, we assume the user is using a
-// spec-conforming TR1 implementation.
-# include <tuple> // NOLINT
-# endif // GTEST_USE_OWN_TR1_TUPLE
-
-#endif // GTEST_HAS_TR1_TUPLE
-
-// Determines whether clone(2) is supported.
-// Usually it will only be available on Linux, excluding
-// Linux on the Itanium architecture.
-// Also see http://linux.die.net/man/2/clone.
-#ifndef GTEST_HAS_CLONE
-// The user didn't tell us, so we need to figure it out.
-
-# if GTEST_OS_LINUX && !defined(__ia64__)
-# if GTEST_OS_LINUX_ANDROID
-// On Android, clone() is only available on ARM starting with Gingerbread.
-# if defined(__arm__) && __ANDROID_API__ >= 9
-# define GTEST_HAS_CLONE 1
-# else
-# define GTEST_HAS_CLONE 0
-# endif
-# else
-# define GTEST_HAS_CLONE 1
-# endif
-# else
-# define GTEST_HAS_CLONE 0
-# endif // GTEST_OS_LINUX && !defined(__ia64__)
-
-#endif // GTEST_HAS_CLONE
-
-// Determines whether to support stream redirection. This is used to test
-// output correctness and to implement death tests.
-#ifndef GTEST_HAS_STREAM_REDIRECTION
-// By default, we assume that stream redirection is supported on all
-// platforms except known mobile ones.
-# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN
-# define GTEST_HAS_STREAM_REDIRECTION 0
-# else
-# define GTEST_HAS_STREAM_REDIRECTION 1
-# endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN
-#endif // GTEST_HAS_STREAM_REDIRECTION
-
-// Determines whether to support death tests.
-// Google Test does not support death tests for VC 7.1 and earlier as
-// abort() in a VC 7.1 application compiled as GUI in debug config
-// pops up a dialog window that cannot be suppressed programmatically.
-#if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
- (GTEST_OS_MAC && !GTEST_OS_IOS) || GTEST_OS_IOS_SIMULATOR || \
- (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
- GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
- GTEST_OS_OPENBSD || GTEST_OS_QNX)
-# define GTEST_HAS_DEATH_TEST 1
-# include <vector> // NOLINT
-#endif
-
-// We don't support MSVC 7.1 with exceptions disabled now. Therefore
-// all the compilers we care about are adequate for supporting
-// value-parameterized tests.
-#define GTEST_HAS_PARAM_TEST 1
-
-// Determines whether to support type-driven tests.
-
-// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
-// Sun Pro CC, IBM Visual Age, and HP aCC support.
-#if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \
- defined(__IBMCPP__) || defined(__HP_aCC)
-# define GTEST_HAS_TYPED_TEST 1
-# define GTEST_HAS_TYPED_TEST_P 1
-#endif
-
-// Determines whether to support Combine(). This only makes sense when
-// value-parameterized tests are enabled. The implementation doesn't
-// work on Sun Studio since it doesn't understand templated conversion
-// operators.
-#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
-# define GTEST_HAS_COMBINE 1
-#endif
-
-// Determines whether the system compiler uses UTF-16 for encoding wide strings.
-#define GTEST_WIDE_STRING_USES_UTF16_ \
- (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX)
-
-// Determines whether test results can be streamed to a socket.
-#if GTEST_OS_LINUX
-# define GTEST_CAN_STREAM_RESULTS_ 1
-#endif
-
-// Defines some utility macros.
-
-// The GNU compiler emits a warning if nested "if" statements are followed by
-// an "else" statement and braces are not used to explicitly disambiguate the
-// "else" binding. This leads to problems with code like:
-//
-// if (gate)
-// ASSERT_*(condition) << "Some message";
-//
-// The "switch (0) case 0:" idiom is used to suppress this.
-#ifdef __INTEL_COMPILER
-# define GTEST_AMBIGUOUS_ELSE_BLOCKER_
-#else
-# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT
-#endif
-
-// Use this annotation at the end of a struct/class definition to
-// prevent the compiler from optimizing away instances that are never
-// used. This is useful when all interesting logic happens inside the
-// c'tor and / or d'tor. Example:
-//
-// struct Foo {
-// Foo() { ... }
-// } GTEST_ATTRIBUTE_UNUSED_;
-//
-// Also use it after a variable or parameter declaration to tell the
-// compiler the variable/parameter does not have to be used.
-#if defined(__GNUC__) && !defined(COMPILER_ICC)
-# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
-#else
-# define GTEST_ATTRIBUTE_UNUSED_
-#endif
-
-// A macro to disallow operator=
-// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_ASSIGN_(type)\
- void operator=(type const &)
-
-// A macro to disallow copy constructor and operator=
-// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
- type(type const &);\
- GTEST_DISALLOW_ASSIGN_(type)
-
-// Tell the compiler to warn about unused return values for functions declared
-// with this macro. The macro should be used on function declarations
-// following the argument list:
-//
-// Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
-#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
-# define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
-#else
-# define GTEST_MUST_USE_RESULT_
-#endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
-
-// Determine whether the compiler supports Microsoft's Structured Exception
-// Handling. This is supported by several Windows compilers but generally
-// does not exist on any other system.
-#ifndef GTEST_HAS_SEH
-// The user didn't tell us, so we need to figure it out.
-
-# if defined(_MSC_VER) || defined(__BORLANDC__)
-// These two compilers are known to support SEH.
-# define GTEST_HAS_SEH 1
-# else
-// Assume no SEH.
-# define GTEST_HAS_SEH 0
-# endif
-
-#endif // GTEST_HAS_SEH
-
-#ifdef _MSC_VER
-
-# if GTEST_LINKED_AS_SHARED_LIBRARY
-# define GTEST_API_ __declspec(dllimport)
-# elif GTEST_CREATE_SHARED_LIBRARY
-# define GTEST_API_ __declspec(dllexport)
-# endif
-
-#endif // _MSC_VER
-
-#ifndef GTEST_API_
-# define GTEST_API_
-#endif
-
-#ifdef __GNUC__
-// Ask the compiler to never inline a given function.
-# define GTEST_NO_INLINE_ __attribute__((noinline))
-#else
-# define GTEST_NO_INLINE_
-#endif
-
-// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
-#if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)
-# define GTEST_HAS_CXXABI_H_ 1
-#else
-# define GTEST_HAS_CXXABI_H_ 0
-#endif
-
-namespace testing {
-
-class Message;
-
-namespace internal {
-
-// A secret type that Google Test users don't know about. It has no
-// definition on purpose. Therefore it's impossible to create a
-// Secret object, which is what we want.
-class Secret;
-
-// The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile time
-// expression is true. For example, you could use it to verify the
-// size of a static array:
-//
-// GTEST_COMPILE_ASSERT_(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES,
-// content_type_names_incorrect_size);
-//
-// or to make sure a struct is smaller than a certain size:
-//
-// GTEST_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large);
-//
-// The second argument to the macro is the name of the variable. If
-// the expression is false, most compilers will issue a warning/error
-// containing the name of the variable.
-
-template <bool>
-struct CompileAssert {
-};
-
-#define GTEST_COMPILE_ASSERT_(expr, msg) \
- typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
- msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
-
-// Implementation details of GTEST_COMPILE_ASSERT_:
-//
-// - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1
-// elements (and thus is invalid) when the expression is false.
-//
-// - The simpler definition
-//
-// #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]
-//
-// does not work, as gcc supports variable-length arrays whose sizes
-// are determined at run-time (this is gcc's extension and not part
-// of the C++ standard). As a result, gcc fails to reject the
-// following code with the simple definition:
-//
-// int foo;
-// GTEST_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is
-// // not a compile-time constant.
-//
-// - By using the type CompileAssert<(bool(expr))>, we ensures that
-// expr is a compile-time constant. (Template arguments must be
-// determined at compile-time.)
-//
-// - The outter parentheses in CompileAssert<(bool(expr))> are necessary
-// to work around a bug in gcc 3.4.4 and 4.0.1. If we had written
-//
-// CompileAssert<bool(expr)>
-//
-// instead, these compilers will refuse to compile
-//
-// GTEST_COMPILE_ASSERT_(5 > 0, some_message);
-//
-// (They seem to think the ">" in "5 > 0" marks the end of the
-// template argument list.)
-//
-// - The array size is (bool(expr) ? 1 : -1), instead of simply
-//
-// ((expr) ? 1 : -1).
-//
-// This is to avoid running into a bug in MS VC 7.1, which
-// causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
-
-// StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h.
-//
-// This template is declared, but intentionally undefined.
-template <typename T1, typename T2>
-struct StaticAssertTypeEqHelper;
-
-template <typename T>
-struct StaticAssertTypeEqHelper<T, T> {};
-
-#if GTEST_HAS_GLOBAL_STRING
-typedef ::string string;
-#else
-typedef ::std::string string;
-#endif // GTEST_HAS_GLOBAL_STRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
-typedef ::wstring wstring;
-#elif GTEST_HAS_STD_WSTRING
-typedef ::std::wstring wstring;
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-// A helper for suppressing warnings on constant condition. It just
-// returns 'condition'.
-GTEST_API_ bool IsTrue(bool condition);
-
-// Defines scoped_ptr.
-
-// This implementation of scoped_ptr is PARTIAL - it only contains
-// enough stuff to satisfy Google Test's need.
-template <typename T>
-class scoped_ptr {
- public:
- typedef T element_type;
-
- explicit scoped_ptr(T* p = NULL) : ptr_(p) {}
- ~scoped_ptr() { reset(); }
-
- T& operator*() const { return *ptr_; }
- T* operator->() const { return ptr_; }
- T* get() const { return ptr_; }
-
- T* release() {
- T* const ptr = ptr_;
- ptr_ = NULL;
- return ptr;
- }
-
- void reset(T* p = NULL) {
- if (p != ptr_) {
- if (IsTrue(sizeof(T) > 0)) { // Makes sure T is a complete type.
- delete ptr_;
- }
- ptr_ = p;
- }
- }
-
- private:
- T* ptr_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
-};
-
-// Defines RE.
-
-// A simple C++ wrapper for <regex.h>. It uses the POSIX Extended
-// Regular Expression syntax.
-class GTEST_API_ RE {
- public:
- // A copy constructor is required by the Standard to initialize object
- // references from r-values.
- RE(const RE& other) { Init(other.pattern()); }
-
- // Constructs an RE from a string.
- RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT
-
-#if GTEST_HAS_GLOBAL_STRING
-
- RE(const ::string& regex) { Init(regex.c_str()); } // NOLINT
-
-#endif // GTEST_HAS_GLOBAL_STRING
-
- RE(const char* regex) { Init(regex); } // NOLINT
- ~RE();
-
- // Returns the string representation of the regex.
- const char* pattern() const { return pattern_; }
-
- // FullMatch(str, re) returns true iff regular expression re matches
- // the entire str.
- // PartialMatch(str, re) returns true iff regular expression re
- // matches a substring of str (including str itself).
- //
- // TODO(wan@google.com): make FullMatch() and PartialMatch() work
- // when str contains NUL characters.
- static bool FullMatch(const ::std::string& str, const RE& re) {
- return FullMatch(str.c_str(), re);
- }
- static bool PartialMatch(const ::std::string& str, const RE& re) {
- return PartialMatch(str.c_str(), re);
- }
-
-#if GTEST_HAS_GLOBAL_STRING
-
- static bool FullMatch(const ::string& str, const RE& re) {
- return FullMatch(str.c_str(), re);
- }
- static bool PartialMatch(const ::string& str, const RE& re) {
- return PartialMatch(str.c_str(), re);
- }
-
-#endif // GTEST_HAS_GLOBAL_STRING
-
- static bool FullMatch(const char* str, const RE& re);
- static bool PartialMatch(const char* str, const RE& re);
-
- private:
- void Init(const char* regex);
-
- // We use a const char* instead of an std::string, as Google Test used to be
- // used where std::string is not available. TODO(wan@google.com): change to
- // std::string.
- const char* pattern_;
- bool is_valid_;
-
-#if GTEST_USES_POSIX_RE
-
- regex_t full_regex_; // For FullMatch().
- regex_t partial_regex_; // For PartialMatch().
-
-#else // GTEST_USES_SIMPLE_RE
-
- const char* full_pattern_; // For FullMatch();
-
-#endif
-
- GTEST_DISALLOW_ASSIGN_(RE);
-};
-
-// Formats a source file path and a line number as they would appear
-// in an error message from the compiler used to compile this code.
-GTEST_API_ ::std::string FormatFileLocation(const char* file, int line);
-
-// Formats a file location for compiler-independent XML output.
-// Although this function is not platform dependent, we put it next to
-// FormatFileLocation in order to contrast the two functions.
-GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,
- int line);
-
-// Defines logging utilities:
-// GTEST_LOG_(severity) - logs messages at the specified severity level. The
-// message itself is streamed into the macro.
-// LogToStderr() - directs all log messages to stderr.
-// FlushInfoLog() - flushes informational log messages.
-
-enum GTestLogSeverity {
- GTEST_INFO,
- GTEST_WARNING,
- GTEST_ERROR,
- GTEST_FATAL
-};
-
-// Formats log entry severity, provides a stream object for streaming the
-// log message, and terminates the message with a newline when going out of
-// scope.
-class GTEST_API_ GTestLog {
- public:
- GTestLog(GTestLogSeverity severity, const char* file, int line);
-
- // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
- ~GTestLog();
-
- ::std::ostream& GetStream() { return ::std::cerr; }
-
- private:
- const GTestLogSeverity severity_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);
-};
-
-#define GTEST_LOG_(severity) \
- ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
- __FILE__, __LINE__).GetStream()
-
-inline void LogToStderr() {}
-inline void FlushInfoLog() { fflush(NULL); }
-
-// INTERNAL IMPLEMENTATION - DO NOT USE.
-//
-// GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
-// is not satisfied.
-// Synopsys:
-// GTEST_CHECK_(boolean_condition);
-// or
-// GTEST_CHECK_(boolean_condition) << "Additional message";
-//
-// This checks the condition and if the condition is not satisfied
-// it prints message about the condition violation, including the
-// condition itself, plus additional message streamed into it, if any,
-// and then it aborts the program. It aborts the program irrespective of
-// whether it is built in the debug mode or not.
-#define GTEST_CHECK_(condition) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::IsTrue(condition)) \
- ; \
- else \
- GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
-
-// An all-mode assert to verify that the given POSIX-style function
-// call returns 0 (indicating success). Known limitation: this
-// doesn't expand to a balanced 'if' statement, so enclose the macro
-// in {} if you need to use it as the only statement in an 'if'
-// branch.
-#define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \
- if (const int gtest_error = (posix_call)) \
- GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
- << gtest_error
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Use ImplicitCast_ as a safe version of static_cast for upcasting in
-// the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a
-// const Foo*). When you use ImplicitCast_, the compiler checks that
-// the cast is safe. Such explicit ImplicitCast_s are necessary in
-// surprisingly many situations where C++ demands an exact type match
-// instead of an argument type convertable to a target type.
-//
-// The syntax for using ImplicitCast_ is the same as for static_cast:
-//
-// ImplicitCast_<ToType>(expr)
-//
-// ImplicitCast_ would have been part of the C++ standard library,
-// but the proposal was submitted too late. It will probably make
-// its way into the language in the future.
-//
-// This relatively ugly name is intentional. It prevents clashes with
-// similar functions users may have (e.g., implicit_cast). The internal
-// namespace alone is not enough because the function can be found by ADL.
-template<typename To>
-inline To ImplicitCast_(To x) { return x; }
-
-// When you upcast (that is, cast a pointer from type Foo to type
-// SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts
-// always succeed. When you downcast (that is, cast a pointer from
-// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
-// how do you know the pointer is really of type SubclassOfFoo? It
-// could be a bare Foo, or of type DifferentSubclassOfFoo. Thus,
-// when you downcast, you should use this macro. In debug mode, we
-// use dynamic_cast<> to double-check the downcast is legal (we die
-// if it's not). In normal mode, we do the efficient static_cast<>
-// instead. Thus, it's important to test in debug mode to make sure
-// the cast is legal!
-// This is the only place in the code we should use dynamic_cast<>.
-// In particular, you SHOULDN'T be using dynamic_cast<> in order to
-// do RTTI (eg code like this:
-// if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
-// if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
-// You should design the code some other way not to need this.
-//
-// This relatively ugly name is intentional. It prevents clashes with
-// similar functions users may have (e.g., down_cast). The internal
-// namespace alone is not enough because the function can be found by ADL.
-template<typename To, typename From> // use like this: DownCast_<T*>(foo);
-inline To DownCast_(From* f) { // so we only accept pointers
- // Ensures that To is a sub-type of From *. This test is here only
- // for compile-time type checking, and has no overhead in an
- // optimized build at run-time, as it will be optimized away
- // completely.
- if (false) {
- const To to = NULL;
- ::testing::internal::ImplicitCast_<From*>(to);
- }
-
-#if GTEST_HAS_RTTI
- // RTTI: debug mode only!
- GTEST_CHECK_(f == NULL || dynamic_cast<To>(f) != NULL);
-#endif
- return static_cast<To>(f);
-}
-
-// Downcasts the pointer of type Base to Derived.
-// Derived must be a subclass of Base. The parameter MUST
-// point to a class of type Derived, not any subclass of it.
-// When RTTI is available, the function performs a runtime
-// check to enforce this.
-template <class Derived, class Base>
-Derived* CheckedDowncastToActualType(Base* base) {
-#if GTEST_HAS_RTTI
- GTEST_CHECK_(typeid(*base) == typeid(Derived));
- return dynamic_cast<Derived*>(base); // NOLINT
-#else
- return static_cast<Derived*>(base); // Poor man's downcast.
-#endif
-}
-
-#if GTEST_HAS_STREAM_REDIRECTION
-
-// Defines the stderr capturer:
-// CaptureStdout - starts capturing stdout.
-// GetCapturedStdout - stops capturing stdout and returns the captured string.
-// CaptureStderr - starts capturing stderr.
-// GetCapturedStderr - stops capturing stderr and returns the captured string.
-//
-GTEST_API_ void CaptureStdout();
-GTEST_API_ std::string GetCapturedStdout();
-GTEST_API_ void CaptureStderr();
-GTEST_API_ std::string GetCapturedStderr();
-
-#endif // GTEST_HAS_STREAM_REDIRECTION
-
-
-#if GTEST_HAS_DEATH_TEST
-
-const ::std::vector<testing::internal::string>& GetInjectableArgvs();
-void SetInjectableArgvs(const ::std::vector<testing::internal::string>*
- new_argvs);
-
-// A copy of all command line arguments. Set by InitGoogleTest().
-extern ::std::vector<testing::internal::string> g_argvs;
-
-#endif // GTEST_HAS_DEATH_TEST
-
-// Defines synchronization primitives.
-
-#if GTEST_HAS_PTHREAD
-
-// Sleeps for (roughly) n milli-seconds. This function is only for
-// testing Google Test's own constructs. Don't use it in user tests,
-// either directly or indirectly.
-inline void SleepMilliseconds(int n) {
- const timespec time = {
- 0, // 0 seconds.
- n * 1000L * 1000L, // And n ms.
- };
- nanosleep(&time, NULL);
-}
-
-// Allows a controller thread to pause execution of newly created
-// threads until notified. Instances of this class must be created
-// and destroyed in the controller thread.
-//
-// This class is only for testing Google Test's own constructs. Do not
-// use it in user tests, either directly or indirectly.
-class Notification {
- public:
- Notification() : notified_(false) {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
- }
- ~Notification() {
- pthread_mutex_destroy(&mutex_);
- }
-
- // Notifies all threads created with this notification to start. Must
- // be called from the controller thread.
- void Notify() {
- pthread_mutex_lock(&mutex_);
- notified_ = true;
- pthread_mutex_unlock(&mutex_);
- }
-
- // Blocks until the controller thread notifies. Must be called from a test
- // thread.
- void WaitForNotification() {
- for (;;) {
- pthread_mutex_lock(&mutex_);
- const bool notified = notified_;
- pthread_mutex_unlock(&mutex_);
- if (notified)
- break;
- SleepMilliseconds(10);
- }
- }
-
- private:
- pthread_mutex_t mutex_;
- bool notified_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
-};
-
-// As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
-// Consequently, it cannot select a correct instantiation of ThreadWithParam
-// in order to call its Run(). Introducing ThreadWithParamBase as a
-// non-templated base class for ThreadWithParam allows us to bypass this
-// problem.
-class ThreadWithParamBase {
- public:
- virtual ~ThreadWithParamBase() {}
- virtual void Run() = 0;
-};
-
-// pthread_create() accepts a pointer to a function type with the C linkage.
-// According to the Standard (7.5/1), function types with different linkages
-// are different even if they are otherwise identical. Some compilers (for
-// example, SunStudio) treat them as different types. Since class methods
-// cannot be defined with C-linkage we need to define a free C-function to
-// pass into pthread_create().
-extern "C" inline void* ThreadFuncWithCLinkage(void* thread) {
- static_cast<ThreadWithParamBase*>(thread)->Run();
- return NULL;
-}
-
-// Helper class for testing Google Test's multi-threading constructs.
-// To use it, write:
-//
-// void ThreadFunc(int param) { /* Do things with param */ }
-// Notification thread_can_start;
-// ...
-// // The thread_can_start parameter is optional; you can supply NULL.
-// ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start);
-// thread_can_start.Notify();
-//
-// These classes are only for testing Google Test's own constructs. Do
-// not use them in user tests, either directly or indirectly.
-template <typename T>
-class ThreadWithParam : public ThreadWithParamBase {
- public:
- typedef void (*UserThreadFunc)(T);
-
- ThreadWithParam(
- UserThreadFunc func, T param, Notification* thread_can_start)
- : func_(func),
- param_(param),
- thread_can_start_(thread_can_start),
- finished_(false) {
- ThreadWithParamBase* const base = this;
- // The thread can be created only after all fields except thread_
- // have been initialized.
- GTEST_CHECK_POSIX_SUCCESS_(
- pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base));
- }
- ~ThreadWithParam() { Join(); }
-
- void Join() {
- if (!finished_) {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, 0));
- finished_ = true;
- }
- }
-
- virtual void Run() {
- if (thread_can_start_ != NULL)
- thread_can_start_->WaitForNotification();
- func_(param_);
- }
-
- private:
- const UserThreadFunc func_; // User-supplied thread function.
- const T param_; // User-supplied parameter to the thread function.
- // When non-NULL, used to block execution until the controller thread
- // notifies.
- Notification* const thread_can_start_;
- bool finished_; // true iff we know that the thread function has finished.
- pthread_t thread_; // The native thread object.
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
-};
-
-// MutexBase and Mutex implement mutex on pthreads-based platforms. They
-// are used in conjunction with class MutexLock:
-//
-// Mutex mutex;
-// ...
-// MutexLock lock(&mutex); // Acquires the mutex and releases it at the end
-// // of the current scope.
-//
-// MutexBase implements behavior for both statically and dynamically
-// allocated mutexes. Do not use MutexBase directly. Instead, write
-// the following to define a static mutex:
-//
-// GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);
-//
-// You can forward declare a static mutex like this:
-//
-// GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
-//
-// To create a dynamic mutex, just define an object of type Mutex.
-class MutexBase {
- public:
- // Acquires this mutex.
- void Lock() {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
- owner_ = pthread_self();
- has_owner_ = true;
- }
-
- // Releases this mutex.
- void Unlock() {
- // Since the lock is being released the owner_ field should no longer be
- // considered valid. We don't protect writing to has_owner_ here, as it's
- // the caller's responsibility to ensure that the current thread holds the
- // mutex when this is called.
- has_owner_ = false;
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
- }
-
- // Does nothing if the current thread holds the mutex. Otherwise, crashes
- // with high probability.
- void AssertHeld() const {
- GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
- << "The current thread is not holding the mutex @" << this;
- }
-
- // A static mutex may be used before main() is entered. It may even
- // be used before the dynamic initialization stage. Therefore we
- // must be able to initialize a static mutex object at link time.
- // This means MutexBase has to be a POD and its member variables
- // have to be public.
- public:
- pthread_mutex_t mutex_; // The underlying pthread mutex.
- // has_owner_ indicates whether the owner_ field below contains a valid thread
- // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All
- // accesses to the owner_ field should be protected by a check of this field.
- // An alternative might be to memset() owner_ to all zeros, but there's no
- // guarantee that a zero'd pthread_t is necessarily invalid or even different
- // from pthread_self().
- bool has_owner_;
- pthread_t owner_; // The thread holding the mutex.
-};
-
-// Forward-declares a static mutex.
-# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
- extern ::testing::internal::MutexBase mutex
-
-// Defines and statically (i.e. at link time) initializes a static mutex.
-// The initialization list here does not explicitly initialize each field,
-// instead relying on default initialization for the unspecified fields. In
-// particular, the owner_ field (a pthread_t) is not explicitly initialized.
-// This allows initialization to work whether pthread_t is a scalar or struct.
-// The flag -Wmissing-field-initializers must not be specified for this to work.
-# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
- ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false }
-
-// The Mutex class can only be used for mutexes created at runtime. It
-// shares its API with MutexBase otherwise.
-class Mutex : public MutexBase {
- public:
- Mutex() {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
- has_owner_ = false;
- }
- ~Mutex() {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
- }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
-};
-
-// We cannot name this class MutexLock as the ctor declaration would
-// conflict with a macro named MutexLock, which is defined on some
-// platforms. Hence the typedef trick below.
-class GTestMutexLock {
- public:
- explicit GTestMutexLock(MutexBase* mutex)
- : mutex_(mutex) { mutex_->Lock(); }
-
- ~GTestMutexLock() { mutex_->Unlock(); }
-
- private:
- MutexBase* const mutex_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
-};
-
-typedef GTestMutexLock MutexLock;
-
-// Helpers for ThreadLocal.
-
-// pthread_key_create() requires DeleteThreadLocalValue() to have
-// C-linkage. Therefore it cannot be templatized to access
-// ThreadLocal<T>. Hence the need for class
-// ThreadLocalValueHolderBase.
-class ThreadLocalValueHolderBase {
- public:
- virtual ~ThreadLocalValueHolderBase() {}
-};
-
-// Called by pthread to delete thread-local data stored by
-// pthread_setspecific().
-extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
- delete static_cast<ThreadLocalValueHolderBase*>(value_holder);
-}
-
-// Implements thread-local storage on pthreads-based systems.
-//
-// // Thread 1
-// ThreadLocal<int> tl(100); // 100 is the default value for each thread.
-//
-// // Thread 2
-// tl.set(150); // Changes the value for thread 2 only.
-// EXPECT_EQ(150, tl.get());
-//
-// // Thread 1
-// EXPECT_EQ(100, tl.get()); // In thread 1, tl has the original value.
-// tl.set(200);
-// EXPECT_EQ(200, tl.get());
-//
-// The template type argument T must have a public copy constructor.
-// In addition, the default ThreadLocal constructor requires T to have
-// a public default constructor.
-//
-// An object managed for a thread by a ThreadLocal instance is deleted
-// when the thread exits. Or, if the ThreadLocal instance dies in
-// that thread, when the ThreadLocal dies. It's the user's
-// responsibility to ensure that all other threads using a ThreadLocal
-// have exited when it dies, or the per-thread objects for those
-// threads will not be deleted.
-//
-// Google Test only uses global ThreadLocal objects. That means they
-// will die after main() has returned. Therefore, no per-thread
-// object managed by Google Test will be leaked as long as all threads
-// using Google Test have exited when main() returns.
-template <typename T>
-class ThreadLocal {
- public:
- ThreadLocal() : key_(CreateKey()),
- default_() {}
- explicit ThreadLocal(const T& value) : key_(CreateKey()),
- default_(value) {}
-
- ~ThreadLocal() {
- // Destroys the managed object for the current thread, if any.
- DeleteThreadLocalValue(pthread_getspecific(key_));
-
- // Releases resources associated with the key. This will *not*
- // delete managed objects for other threads.
- GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));
- }
-
- T* pointer() { return GetOrCreateValue(); }
- const T* pointer() const { return GetOrCreateValue(); }
- const T& get() const { return *pointer(); }
- void set(const T& value) { *pointer() = value; }
-
- private:
- // Holds a value of type T.
- class ValueHolder : public ThreadLocalValueHolderBase {
- public:
- explicit ValueHolder(const T& value) : value_(value) {}
-
- T* pointer() { return &value_; }
-
- private:
- T value_;
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
- };
-
- static pthread_key_t CreateKey() {
- pthread_key_t key;
- // When a thread exits, DeleteThreadLocalValue() will be called on
- // the object managed for that thread.
- GTEST_CHECK_POSIX_SUCCESS_(
- pthread_key_create(&key, &DeleteThreadLocalValue));
- return key;
- }
-
- T* GetOrCreateValue() const {
- ThreadLocalValueHolderBase* const holder =
- static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));
- if (holder != NULL) {
- return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
- }
-
- ValueHolder* const new_holder = new ValueHolder(default_);
- ThreadLocalValueHolderBase* const holder_base = new_holder;
- GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));
- return new_holder->pointer();
- }
-
- // A key pthreads uses for looking up per-thread values.
- const pthread_key_t key_;
- const T default_; // The default value for each thread.
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
-};
-
-# define GTEST_IS_THREADSAFE 1
-
-#else // GTEST_HAS_PTHREAD
-
-// A dummy implementation of synchronization primitives (mutex, lock,
-// and thread-local variable). Necessary for compiling Google Test where
-// mutex is not supported - using Google Test in multiple threads is not
-// supported on such platforms.
-
-class Mutex {
- public:
- Mutex() {}
- void Lock() {}
- void Unlock() {}
- void AssertHeld() const {}
-};
-
-# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
- extern ::testing::internal::Mutex mutex
-
-# define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
-
-class GTestMutexLock {
- public:
- explicit GTestMutexLock(Mutex*) {} // NOLINT
-};
-
-typedef GTestMutexLock MutexLock;
-
-template <typename T>
-class ThreadLocal {
- public:
- ThreadLocal() : value_() {}
- explicit ThreadLocal(const T& value) : value_(value) {}
- T* pointer() { return &value_; }
- const T* pointer() const { return &value_; }
- const T& get() const { return value_; }
- void set(const T& value) { value_ = value; }
- private:
- T value_;
-};
-
-// The above synchronization primitives have dummy implementations.
-// Therefore Google Test is not thread-safe.
-# define GTEST_IS_THREADSAFE 0
-
-#endif // GTEST_HAS_PTHREAD
-
-// Returns the number of threads running in the process, or 0 to indicate that
-// we cannot detect it.
-GTEST_API_ size_t GetThreadCount();
-
-// Passing non-POD classes through ellipsis (...) crashes the ARM
-// compiler and generates a warning in Sun Studio. The Nokia Symbian
-// and the IBM XL C/C++ compiler try to instantiate a copy constructor
-// for objects passed through ellipsis (...), failing for uncopyable
-// objects. We define this to ensure that only POD is passed through
-// ellipsis on these systems.
-#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
-// We lose support for NULL detection where the compiler doesn't like
-// passing non-POD classes through ellipsis (...).
-# define GTEST_ELLIPSIS_NEEDS_POD_ 1
-#else
-# define GTEST_CAN_COMPARE_NULL 1
-#endif
-
-// The Nokia Symbian and IBM XL C/C++ compilers cannot decide between
-// const T& and const T* in a function template. These compilers
-// _can_ decide between class template specializations for T and T*,
-// so a tr1::type_traits-like is_pointer works.
-#if defined(__SYMBIAN32__) || defined(__IBMCPP__)
-# define GTEST_NEEDS_IS_POINTER_ 1
-#endif
-
-template <bool bool_value>
-struct bool_constant {
- typedef bool_constant<bool_value> type;
- static const bool value = bool_value;
-};
-template <bool bool_value> const bool bool_constant<bool_value>::value;
-
-typedef bool_constant<false> false_type;
-typedef bool_constant<true> true_type;
-
-template <typename T>
-struct is_pointer : public false_type {};
-
-template <typename T>
-struct is_pointer<T*> : public true_type {};
-
-template <typename Iterator>
-struct IteratorTraits {
- typedef typename Iterator::value_type value_type;
-};
-
-template <typename T>
-struct IteratorTraits<T*> {
- typedef T value_type;
-};
-
-template <typename T>
-struct IteratorTraits<const T*> {
- typedef T value_type;
-};
-
-#if GTEST_OS_WINDOWS
-# define GTEST_PATH_SEP_ "\\"
-# define GTEST_HAS_ALT_PATH_SEP_ 1
-// The biggest signed integer type the compiler supports.
-typedef __int64 BiggestInt;
-#else
-# define GTEST_PATH_SEP_ "/"
-# define GTEST_HAS_ALT_PATH_SEP_ 0
-typedef long long BiggestInt; // NOLINT
-#endif // GTEST_OS_WINDOWS
-
-// Utilities for char.
-
-// isspace(int ch) and friends accept an unsigned char or EOF. char
-// may be signed, depending on the compiler (or compiler flags).
-// Therefore we need to cast a char to unsigned char before calling
-// isspace(), etc.
-
-inline bool IsAlpha(char ch) {
- return isalpha(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsAlNum(char ch) {
- return isalnum(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsDigit(char ch) {
- return isdigit(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsLower(char ch) {
- return islower(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsSpace(char ch) {
- return isspace(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsUpper(char ch) {
- return isupper(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsXDigit(char ch) {
- return isxdigit(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsXDigit(wchar_t ch) {
- const unsigned char low_byte = static_cast<unsigned char>(ch);
- return ch == low_byte && isxdigit(low_byte) != 0;
-}
-
-inline char ToLower(char ch) {
- return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
-}
-inline char ToUpper(char ch) {
- return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
-}
-
-// The testing::internal::posix namespace holds wrappers for common
-// POSIX functions. These wrappers hide the differences between
-// Windows/MSVC and POSIX systems. Since some compilers define these
-// standard functions as macros, the wrapper cannot have the same name
-// as the wrapped function.
-
-namespace posix {
-
-// Functions with a different name on Windows.
-
-#if GTEST_OS_WINDOWS
-
-typedef struct _stat StatStruct;
-
-# ifdef __BORLANDC__
-inline int IsATTY(int fd) { return isatty(fd); }
-inline int StrCaseCmp(const char* s1, const char* s2) {
- return stricmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return strdup(src); }
-# else // !__BORLANDC__
-# if GTEST_OS_WINDOWS_MOBILE
-inline int IsATTY(int /* fd */) { return 0; }
-# else
-inline int IsATTY(int fd) { return _isatty(fd); }
-# endif // GTEST_OS_WINDOWS_MOBILE
-inline int StrCaseCmp(const char* s1, const char* s2) {
- return _stricmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return _strdup(src); }
-# endif // __BORLANDC__
-
-# if GTEST_OS_WINDOWS_MOBILE
-inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
-// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
-// time and thus not defined there.
-# else
-inline int FileNo(FILE* file) { return _fileno(file); }
-inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
-inline int RmDir(const char* dir) { return _rmdir(dir); }
-inline bool IsDir(const StatStruct& st) {
- return (_S_IFDIR & st.st_mode) != 0;
-}
-# endif // GTEST_OS_WINDOWS_MOBILE
-
-#else
-
-typedef struct stat StatStruct;
-
-inline int FileNo(FILE* file) { return fileno(file); }
-inline int IsATTY(int fd) { return isatty(fd); }
-inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }
-inline int StrCaseCmp(const char* s1, const char* s2) {
- return strcasecmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return strdup(src); }
-inline int RmDir(const char* dir) { return rmdir(dir); }
-inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
-
-#endif // GTEST_OS_WINDOWS
-
-// Functions deprecated by MSVC 8.0.
-
-#ifdef _MSC_VER
-// Temporarily disable warning 4996 (deprecated function).
-# pragma warning(push)
-# pragma warning(disable:4996)
-#endif
-
-inline const char* StrNCpy(char* dest, const char* src, size_t n) {
- return strncpy(dest, src, n);
-}
-
-// ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
-// StrError() aren't needed on Windows CE at this time and thus not
-// defined there.
-
-#if !GTEST_OS_WINDOWS_MOBILE
-inline int ChDir(const char* dir) { return chdir(dir); }
-#endif
-inline FILE* FOpen(const char* path, const char* mode) {
- return fopen(path, mode);
-}
-#if !GTEST_OS_WINDOWS_MOBILE
-inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
- return freopen(path, mode, stream);
-}
-inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
-#endif
-inline int FClose(FILE* fp) { return fclose(fp); }
-#if !GTEST_OS_WINDOWS_MOBILE
-inline int Read(int fd, void* buf, unsigned int count) {
- return static_cast<int>(read(fd, buf, count));
-}
-inline int Write(int fd, const void* buf, unsigned int count) {
- return static_cast<int>(write(fd, buf, count));
-}
-inline int Close(int fd) { return close(fd); }
-inline const char* StrError(int errnum) { return strerror(errnum); }
-#endif
-inline const char* GetEnv(const char* name) {
-#if GTEST_OS_WINDOWS_MOBILE
- // We are on Windows CE, which has no environment variables.
- return NULL;
-#elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
- // Environment variables which we programmatically clear will be set to the
- // empty string rather than unset (NULL). Handle that case.
- const char* const env = getenv(name);
- return (env != NULL && env[0] != '\0') ? env : NULL;
-#else
- return getenv(name);
-#endif
-}
-
-#ifdef _MSC_VER
-# pragma warning(pop) // Restores the warning state.
-#endif
-
-#if GTEST_OS_WINDOWS_MOBILE
-// Windows CE has no C library. The abort() function is used in
-// several places in Google Test. This implementation provides a reasonable
-// imitation of standard behaviour.
-void Abort();
-#else
-inline void Abort() { abort(); }
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-} // namespace posix
-
-// MSVC "deprecates" snprintf and issues warnings wherever it is used. In
-// order to avoid these warnings, we need to use _snprintf or _snprintf_s on
-// MSVC-based platforms. We map the GTEST_SNPRINTF_ macro to the appropriate
-// function in order to achieve that. We use macro definition here because
-// snprintf is a variadic function.
-#if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
-// MSVC 2005 and above support variadic macros.
-# define GTEST_SNPRINTF_(buffer, size, format, ...) \
- _snprintf_s(buffer, size, size, format, __VA_ARGS__)
-#elif defined(_MSC_VER)
-// Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't
-// complain about _snprintf.
-# define GTEST_SNPRINTF_ _snprintf
-#else
-# define GTEST_SNPRINTF_ snprintf
-#endif
-
-// The maximum number a BiggestInt can represent. This definition
-// works no matter BiggestInt is represented in one's complement or
-// two's complement.
-//
-// We cannot rely on numeric_limits in STL, as __int64 and long long
-// are not part of standard C++ and numeric_limits doesn't need to be
-// defined for them.
-const BiggestInt kMaxBiggestInt =
- ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));
-
-// This template class serves as a compile-time function from size to
-// type. It maps a size in bytes to a primitive type with that
-// size. e.g.
-//
-// TypeWithSize<4>::UInt
-//
-// is typedef-ed to be unsigned int (unsigned integer made up of 4
-// bytes).
-//
-// Such functionality should belong to STL, but I cannot find it
-// there.
-//
-// Google Test uses this class in the implementation of floating-point
-// comparison.
-//
-// For now it only handles UInt (unsigned int) as that's all Google Test
-// needs. Other types can be easily added in the future if need
-// arises.
-template <size_t size>
-class TypeWithSize {
- public:
- // This prevents the user from using TypeWithSize<N> with incorrect
- // values of N.
- typedef void UInt;
-};
-
-// The specialization for size 4.
-template <>
-class TypeWithSize<4> {
- public:
- // unsigned int has size 4 in both gcc and MSVC.
- //
- // As base/basictypes.h doesn't compile on Windows, we cannot use
- // uint32, uint64, and etc here.
- typedef int Int;
- typedef unsigned int UInt;
-};
-
-// The specialization for size 8.
-template <>
-class TypeWithSize<8> {
- public:
-#if GTEST_OS_WINDOWS
- typedef __int64 Int;
- typedef unsigned __int64 UInt;
-#else
- typedef long long Int; // NOLINT
- typedef unsigned long long UInt; // NOLINT
-#endif // GTEST_OS_WINDOWS
-};
-
-// Integer types of known sizes.
-typedef TypeWithSize<4>::Int Int32;
-typedef TypeWithSize<4>::UInt UInt32;
-typedef TypeWithSize<8>::Int Int64;
-typedef TypeWithSize<8>::UInt UInt64;
-typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
-
-// Utilities for command line flags and environment variables.
-
-// Macro for referencing flags.
-#define GTEST_FLAG(name) FLAGS_gtest_##name
-
-// Macros for declaring flags.
-#define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
-#define GTEST_DECLARE_int32_(name) \
- GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
-#define GTEST_DECLARE_string_(name) \
- GTEST_API_ extern ::std::string GTEST_FLAG(name)
-
-// Macros for defining flags.
-#define GTEST_DEFINE_bool_(name, default_val, doc) \
- GTEST_API_ bool GTEST_FLAG(name) = (default_val)
-#define GTEST_DEFINE_int32_(name, default_val, doc) \
- GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
-#define GTEST_DEFINE_string_(name, default_val, doc) \
- GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
-
-// Thread annotations
-#define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
-#define GTEST_LOCK_EXCLUDED_(locks)
-
-// Parses 'str' for a 32-bit signed integer. If successful, writes the result
-// to *value and returns true; otherwise leaves *value unchanged and returns
-// false.
-// TODO(chandlerc): Find a better way to refactor flag and environment parsing
-// out of both gtest-port.cc and gtest.cc to avoid exporting this utility
-// function.
-bool ParseInt32(const Message& src_text, const char* str, Int32* value);
-
-// Parses a bool/Int32/string from the environment variable
-// corresponding to the given Google Test flag.
-bool BoolFromGTestEnv(const char* flag, bool default_val);
-GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
-const char* StringFromGTestEnv(const char* flag, const char* default_val);
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-string.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-string.h
deleted file mode 100644
index 97f1a7f..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-string.h
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file declares the String class and functions used internally by
-// Google Test. They are subject to change without notice. They should not used
-// by code external to Google Test.
-//
-// This header file is #included by <gtest/internal/gtest-internal.h>.
-// It should not be #included by other files.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
-
-#ifdef __BORLANDC__
-// string.h is not guaranteed to provide strcpy on C++ Builder.
-# include <mem.h>
-#endif
-
-#include <string.h>
-#include <string>
-
-#include "gtest/internal/gtest-port.h"
-
-namespace testing {
-namespace internal {
-
-// String - an abstract class holding static string utilities.
-class GTEST_API_ String {
- public:
- // Static utility methods
-
- // Clones a 0-terminated C string, allocating memory using new. The
- // caller is responsible for deleting the return value using
- // delete[]. Returns the cloned string, or NULL if the input is
- // NULL.
- //
- // This is different from strdup() in string.h, which allocates
- // memory using malloc().
- static const char* CloneCString(const char* c_str);
-
-#if GTEST_OS_WINDOWS_MOBILE
- // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
- // able to pass strings to Win32 APIs on CE we need to convert them
- // to 'Unicode', UTF-16.
-
- // Creates a UTF-16 wide string from the given ANSI string, allocating
- // memory using new. The caller is responsible for deleting the return
- // value using delete[]. Returns the wide string, or NULL if the
- // input is NULL.
- //
- // The wide string is created using the ANSI codepage (CP_ACP) to
- // match the behaviour of the ANSI versions of Win32 calls and the
- // C runtime.
- static LPCWSTR AnsiToUtf16(const char* c_str);
-
- // Creates an ANSI string from the given wide string, allocating
- // memory using new. The caller is responsible for deleting the return
- // value using delete[]. Returns the ANSI string, or NULL if the
- // input is NULL.
- //
- // The returned string is created using the ANSI codepage (CP_ACP) to
- // match the behaviour of the ANSI versions of Win32 calls and the
- // C runtime.
- static const char* Utf16ToAnsi(LPCWSTR utf16_str);
-#endif
-
- // Compares two C strings. Returns true iff they have the same content.
- //
- // Unlike strcmp(), this function can handle NULL argument(s). A
- // NULL C string is considered different to any non-NULL C string,
- // including the empty string.
- static bool CStringEquals(const char* lhs, const char* rhs);
-
- // Converts a wide C string to a String using the UTF-8 encoding.
- // NULL will be converted to "(null)". If an error occurred during
- // the conversion, "(failed to convert from wide string)" is
- // returned.
- static std::string ShowWideCString(const wchar_t* wide_c_str);
-
- // Compares two wide C strings. Returns true iff they have the same
- // content.
- //
- // Unlike wcscmp(), this function can handle NULL argument(s). A
- // NULL C string is considered different to any non-NULL C string,
- // including the empty string.
- static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
-
- // Compares two C strings, ignoring case. Returns true iff they
- // have the same content.
- //
- // Unlike strcasecmp(), this function can handle NULL argument(s).
- // A NULL C string is considered different to any non-NULL C string,
- // including the empty string.
- static bool CaseInsensitiveCStringEquals(const char* lhs,
- const char* rhs);
-
- // Compares two wide C strings, ignoring case. Returns true iff they
- // have the same content.
- //
- // Unlike wcscasecmp(), this function can handle NULL argument(s).
- // A NULL C string is considered different to any non-NULL wide C string,
- // including the empty string.
- // NB: The implementations on different platforms slightly differ.
- // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
- // environment variable. On GNU platform this method uses wcscasecmp
- // which compares according to LC_CTYPE category of the current locale.
- // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
- // current locale.
- static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
- const wchar_t* rhs);
-
- // Returns true iff the given string ends with the given suffix, ignoring
- // case. Any string is considered to end with an empty suffix.
- static bool EndsWithCaseInsensitive(
- const std::string& str, const std::string& suffix);
-
- // Formats an int value as "%02d".
- static std::string FormatIntWidth2(int value); // "%02d" for width == 2
-
- // Formats an int value as "%X".
- static std::string FormatHexInt(int value);
-
- // Formats a byte as "%02X".
- static std::string FormatByte(unsigned char value);
-
- private:
- String(); // Not meant to be instantiated.
-}; // class String
-
-// Gets the content of the stringstream's buffer as an std::string. Each '\0'
-// character in the buffer is replaced with "\\0".
-GTEST_API_ std::string StringStreamToString(::std::stringstream* stream);
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-tuple.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-tuple.h
deleted file mode 100644
index 7b3dfc3..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-tuple.h
+++ /dev/null
@@ -1,1012 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gtest-tuple.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2009 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-
-#include <utility> // For ::std::pair.
-
-// The compiler used in Symbian has a bug that prevents us from declaring the
-// tuple template as a friend (it complains that tuple is redefined). This
-// hack bypasses the bug by declaring the members that should otherwise be
-// private as public.
-// Sun Studio versions < 12 also have the above bug.
-#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
-# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
-#else
-# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
- template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
- private:
-#endif
-
-// GTEST_n_TUPLE_(T) is the type of an n-tuple.
-#define GTEST_0_TUPLE_(T) tuple<>
-#define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
- void, void, void>
-#define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
- void, void, void>
-#define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
- void, void, void>
-#define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
- void, void, void>
-#define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
- void, void, void>
-#define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
- void, void, void>
-#define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- void, void, void>
-#define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- T##7, void, void>
-#define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- T##7, T##8, void>
-#define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- T##7, T##8, T##9>
-
-// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
-#define GTEST_0_TYPENAMES_(T)
-#define GTEST_1_TYPENAMES_(T) typename T##0
-#define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
-#define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
-#define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3
-#define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4
-#define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5
-#define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6
-#define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
-#define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6, \
- typename T##7, typename T##8
-#define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6, \
- typename T##7, typename T##8, typename T##9
-
-// In theory, defining stuff in the ::std namespace is undefined
-// behavior. We can do this as we are playing the role of a standard
-// library vendor.
-namespace std {
-namespace tr1 {
-
-template <typename T0 = void, typename T1 = void, typename T2 = void,
- typename T3 = void, typename T4 = void, typename T5 = void,
- typename T6 = void, typename T7 = void, typename T8 = void,
- typename T9 = void>
-class tuple;
-
-// Anything in namespace gtest_internal is Google Test's INTERNAL
-// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
-namespace gtest_internal {
-
-// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
-template <typename T>
-struct ByRef { typedef const T& type; }; // NOLINT
-template <typename T>
-struct ByRef<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper for ByRef.
-#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
-
-// AddRef<T>::type is T if T is a reference; otherwise it's T&. This
-// is the same as tr1::add_reference<T>::type.
-template <typename T>
-struct AddRef { typedef T& type; }; // NOLINT
-template <typename T>
-struct AddRef<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper for AddRef.
-#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
-
-// A helper for implementing get<k>().
-template <int k> class Get;
-
-// A helper for implementing tuple_element<k, T>. kIndexValid is true
-// iff k < the number of fields in tuple type T.
-template <bool kIndexValid, int kIndex, class Tuple>
-struct TupleElement;
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 0, GTEST_10_TUPLE_(T) > {
- typedef T0 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 1, GTEST_10_TUPLE_(T) > {
- typedef T1 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 2, GTEST_10_TUPLE_(T) > {
- typedef T2 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 3, GTEST_10_TUPLE_(T) > {
- typedef T3 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 4, GTEST_10_TUPLE_(T) > {
- typedef T4 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 5, GTEST_10_TUPLE_(T) > {
- typedef T5 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 6, GTEST_10_TUPLE_(T) > {
- typedef T6 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 7, GTEST_10_TUPLE_(T) > {
- typedef T7 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 8, GTEST_10_TUPLE_(T) > {
- typedef T8 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 9, GTEST_10_TUPLE_(T) > {
- typedef T9 type;
-};
-
-} // namespace gtest_internal
-
-template <>
-class tuple<> {
- public:
- tuple() {}
- tuple(const tuple& /* t */) {}
- tuple& operator=(const tuple& /* t */) { return *this; }
-};
-
-template <GTEST_1_TYPENAMES_(T)>
-class GTEST_1_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
-
- tuple(const tuple& t) : f0_(t.f0_) {}
-
- template <GTEST_1_TYPENAMES_(U)>
- tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_1_TYPENAMES_(U)>
- tuple& operator=(const GTEST_1_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_1_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {
- f0_ = t.f0_;
- return *this;
- }
-
- T0 f0_;
-};
-
-template <GTEST_2_TYPENAMES_(T)>
-class GTEST_2_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
- f1_(f1) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}
-
- template <GTEST_2_TYPENAMES_(U)>
- tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}
- template <typename U0, typename U1>
- tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_2_TYPENAMES_(U)>
- tuple& operator=(const GTEST_2_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
- template <typename U0, typename U1>
- tuple& operator=(const ::std::pair<U0, U1>& p) {
- f0_ = p.first;
- f1_ = p.second;
- return *this;
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_2_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
-};
-
-template <GTEST_3_TYPENAMES_(T)>
-class GTEST_3_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
-
- template <GTEST_3_TYPENAMES_(U)>
- tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_3_TYPENAMES_(U)>
- tuple& operator=(const GTEST_3_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_3_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
-};
-
-template <GTEST_4_TYPENAMES_(T)>
-class GTEST_4_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
- f3_(f3) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}
-
- template <GTEST_4_TYPENAMES_(U)>
- tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_4_TYPENAMES_(U)>
- tuple& operator=(const GTEST_4_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_4_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
-};
-
-template <GTEST_5_TYPENAMES_(T)>
-class GTEST_5_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
- GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_) {}
-
- template <GTEST_5_TYPENAMES_(U)>
- tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_5_TYPENAMES_(U)>
- tuple& operator=(const GTEST_5_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_5_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
-};
-
-template <GTEST_6_TYPENAMES_(T)>
-class GTEST_6_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
- f5_(f5) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_) {}
-
- template <GTEST_6_TYPENAMES_(U)>
- tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_6_TYPENAMES_(U)>
- tuple& operator=(const GTEST_6_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_6_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
-};
-
-template <GTEST_7_TYPENAMES_(T)>
-class GTEST_7_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),
- f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
-
- template <GTEST_7_TYPENAMES_(U)>
- tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_7_TYPENAMES_(U)>
- tuple& operator=(const GTEST_7_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_7_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
-};
-
-template <GTEST_8_TYPENAMES_(T)>
-class GTEST_8_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,
- GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
- f5_(f5), f6_(f6), f7_(f7) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
-
- template <GTEST_8_TYPENAMES_(U)>
- tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_8_TYPENAMES_(U)>
- tuple& operator=(const GTEST_8_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_8_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- f7_ = t.f7_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
- T7 f7_;
-};
-
-template <GTEST_9_TYPENAMES_(T)>
-class GTEST_9_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
- GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
- f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
-
- template <GTEST_9_TYPENAMES_(U)>
- tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_9_TYPENAMES_(U)>
- tuple& operator=(const GTEST_9_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_9_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- f7_ = t.f7_;
- f8_ = t.f8_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
- T7 f7_;
- T8 f8_;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-class tuple {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
- f9_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
- GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),
- f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}
-
- template <GTEST_10_TYPENAMES_(U)>
- tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),
- f9_(t.f9_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_10_TYPENAMES_(U)>
- tuple& operator=(const GTEST_10_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_10_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- f7_ = t.f7_;
- f8_ = t.f8_;
- f9_ = t.f9_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
- T7 f7_;
- T8 f8_;
- T9 f9_;
-};
-
-// 6.1.3.2 Tuple creation functions.
-
-// Known limitations: we don't support passing an
-// std::tr1::reference_wrapper<T> to make_tuple(). And we don't
-// implement tie().
-
-inline tuple<> make_tuple() { return tuple<>(); }
-
-template <GTEST_1_TYPENAMES_(T)>
-inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {
- return GTEST_1_TUPLE_(T)(f0);
-}
-
-template <GTEST_2_TYPENAMES_(T)>
-inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {
- return GTEST_2_TUPLE_(T)(f0, f1);
-}
-
-template <GTEST_3_TYPENAMES_(T)>
-inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {
- return GTEST_3_TUPLE_(T)(f0, f1, f2);
-}
-
-template <GTEST_4_TYPENAMES_(T)>
-inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3) {
- return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);
-}
-
-template <GTEST_5_TYPENAMES_(T)>
-inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4) {
- return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);
-}
-
-template <GTEST_6_TYPENAMES_(T)>
-inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5) {
- return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);
-}
-
-template <GTEST_7_TYPENAMES_(T)>
-inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6) {
- return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);
-}
-
-template <GTEST_8_TYPENAMES_(T)>
-inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {
- return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);
-}
-
-template <GTEST_9_TYPENAMES_(T)>
-inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
- const T8& f8) {
- return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);
-}
-
-template <GTEST_10_TYPENAMES_(T)>
-inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
- const T8& f8, const T9& f9) {
- return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
-}
-
-// 6.1.3.3 Tuple helper classes.
-
-template <typename Tuple> struct tuple_size;
-
-template <GTEST_0_TYPENAMES_(T)>
-struct tuple_size<GTEST_0_TUPLE_(T) > {
- static const int value = 0;
-};
-
-template <GTEST_1_TYPENAMES_(T)>
-struct tuple_size<GTEST_1_TUPLE_(T) > {
- static const int value = 1;
-};
-
-template <GTEST_2_TYPENAMES_(T)>
-struct tuple_size<GTEST_2_TUPLE_(T) > {
- static const int value = 2;
-};
-
-template <GTEST_3_TYPENAMES_(T)>
-struct tuple_size<GTEST_3_TUPLE_(T) > {
- static const int value = 3;
-};
-
-template <GTEST_4_TYPENAMES_(T)>
-struct tuple_size<GTEST_4_TUPLE_(T) > {
- static const int value = 4;
-};
-
-template <GTEST_5_TYPENAMES_(T)>
-struct tuple_size<GTEST_5_TUPLE_(T) > {
- static const int value = 5;
-};
-
-template <GTEST_6_TYPENAMES_(T)>
-struct tuple_size<GTEST_6_TUPLE_(T) > {
- static const int value = 6;
-};
-
-template <GTEST_7_TYPENAMES_(T)>
-struct tuple_size<GTEST_7_TUPLE_(T) > {
- static const int value = 7;
-};
-
-template <GTEST_8_TYPENAMES_(T)>
-struct tuple_size<GTEST_8_TUPLE_(T) > {
- static const int value = 8;
-};
-
-template <GTEST_9_TYPENAMES_(T)>
-struct tuple_size<GTEST_9_TUPLE_(T) > {
- static const int value = 9;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct tuple_size<GTEST_10_TUPLE_(T) > {
- static const int value = 10;
-};
-
-template <int k, class Tuple>
-struct tuple_element {
- typedef typename gtest_internal::TupleElement<
- k < (tuple_size<Tuple>::value), k, Tuple>::type type;
-};
-
-#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
-
-// 6.1.3.4 Element access.
-
-namespace gtest_internal {
-
-template <>
-class Get<0> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
- Field(Tuple& t) { return t.f0_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
- ConstField(const Tuple& t) { return t.f0_; }
-};
-
-template <>
-class Get<1> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
- Field(Tuple& t) { return t.f1_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
- ConstField(const Tuple& t) { return t.f1_; }
-};
-
-template <>
-class Get<2> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
- Field(Tuple& t) { return t.f2_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
- ConstField(const Tuple& t) { return t.f2_; }
-};
-
-template <>
-class Get<3> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
- Field(Tuple& t) { return t.f3_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
- ConstField(const Tuple& t) { return t.f3_; }
-};
-
-template <>
-class Get<4> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
- Field(Tuple& t) { return t.f4_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
- ConstField(const Tuple& t) { return t.f4_; }
-};
-
-template <>
-class Get<5> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
- Field(Tuple& t) { return t.f5_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
- ConstField(const Tuple& t) { return t.f5_; }
-};
-
-template <>
-class Get<6> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
- Field(Tuple& t) { return t.f6_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
- ConstField(const Tuple& t) { return t.f6_; }
-};
-
-template <>
-class Get<7> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
- Field(Tuple& t) { return t.f7_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
- ConstField(const Tuple& t) { return t.f7_; }
-};
-
-template <>
-class Get<8> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
- Field(Tuple& t) { return t.f8_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
- ConstField(const Tuple& t) { return t.f8_; }
-};
-
-template <>
-class Get<9> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
- Field(Tuple& t) { return t.f9_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
- ConstField(const Tuple& t) { return t.f9_; }
-};
-
-} // namespace gtest_internal
-
-template <int k, GTEST_10_TYPENAMES_(T)>
-GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
-get(GTEST_10_TUPLE_(T)& t) {
- return gtest_internal::Get<k>::Field(t);
-}
-
-template <int k, GTEST_10_TYPENAMES_(T)>
-GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
-get(const GTEST_10_TUPLE_(T)& t) {
- return gtest_internal::Get<k>::ConstField(t);
-}
-
-// 6.1.3.5 Relational operators
-
-// We only implement == and !=, as we don't have a need for the rest yet.
-
-namespace gtest_internal {
-
-// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
-// first k fields of t1 equals the first k fields of t2.
-// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
-// k1 != k2.
-template <int kSize1, int kSize2>
-struct SameSizeTuplePrefixComparator;
-
-template <>
-struct SameSizeTuplePrefixComparator<0, 0> {
- template <class Tuple1, class Tuple2>
- static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
- return true;
- }
-};
-
-template <int k>
-struct SameSizeTuplePrefixComparator<k, k> {
- template <class Tuple1, class Tuple2>
- static bool Eq(const Tuple1& t1, const Tuple2& t2) {
- return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
- ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
- }
-};
-
-} // namespace gtest_internal
-
-template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
-inline bool operator==(const GTEST_10_TUPLE_(T)& t,
- const GTEST_10_TUPLE_(U)& u) {
- return gtest_internal::SameSizeTuplePrefixComparator<
- tuple_size<GTEST_10_TUPLE_(T) >::value,
- tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u);
-}
-
-template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
-inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
- const GTEST_10_TUPLE_(U)& u) { return !(t == u); }
-
-// 6.1.4 Pairs.
-// Unimplemented.
-
-} // namespace tr1
-} // namespace std
-
-#undef GTEST_0_TUPLE_
-#undef GTEST_1_TUPLE_
-#undef GTEST_2_TUPLE_
-#undef GTEST_3_TUPLE_
-#undef GTEST_4_TUPLE_
-#undef GTEST_5_TUPLE_
-#undef GTEST_6_TUPLE_
-#undef GTEST_7_TUPLE_
-#undef GTEST_8_TUPLE_
-#undef GTEST_9_TUPLE_
-#undef GTEST_10_TUPLE_
-
-#undef GTEST_0_TYPENAMES_
-#undef GTEST_1_TYPENAMES_
-#undef GTEST_2_TYPENAMES_
-#undef GTEST_3_TYPENAMES_
-#undef GTEST_4_TYPENAMES_
-#undef GTEST_5_TYPENAMES_
-#undef GTEST_6_TYPENAMES_
-#undef GTEST_7_TYPENAMES_
-#undef GTEST_8_TYPENAMES_
-#undef GTEST_9_TYPENAMES_
-#undef GTEST_10_TYPENAMES_
-
-#undef GTEST_DECLARE_TUPLE_AS_FRIEND_
-#undef GTEST_BY_REF_
-#undef GTEST_ADD_REF_
-#undef GTEST_TUPLE_ELEMENT_
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-tuple.h.pump b/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-tuple.h.pump
deleted file mode 100644
index c7d9e03..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-tuple.h.pump
+++ /dev/null
@@ -1,339 +0,0 @@
-$$ -*- mode: c++; -*-
-$var n = 10 $$ Maximum number of tuple fields we want to support.
-$$ This meta comment fixes auto-indentation in Emacs. }}
-// Copyright 2009 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-
-#include <utility> // For ::std::pair.
-
-// The compiler used in Symbian has a bug that prevents us from declaring the
-// tuple template as a friend (it complains that tuple is redefined). This
-// hack bypasses the bug by declaring the members that should otherwise be
-// private as public.
-// Sun Studio versions < 12 also have the above bug.
-#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
-# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
-#else
-# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
- template <GTEST_$(n)_TYPENAMES_(U)> friend class tuple; \
- private:
-#endif
-
-
-$range i 0..n-1
-$range j 0..n
-$range k 1..n
-// GTEST_n_TUPLE_(T) is the type of an n-tuple.
-#define GTEST_0_TUPLE_(T) tuple<>
-
-$for k [[
-$range m 0..k-1
-$range m2 k..n-1
-#define GTEST_$(k)_TUPLE_(T) tuple<$for m, [[T##$m]]$for m2 [[, void]]>
-
-]]
-
-// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
-
-$for j [[
-$range m 0..j-1
-#define GTEST_$(j)_TYPENAMES_(T) $for m, [[typename T##$m]]
-
-
-]]
-
-// In theory, defining stuff in the ::std namespace is undefined
-// behavior. We can do this as we are playing the role of a standard
-// library vendor.
-namespace std {
-namespace tr1 {
-
-template <$for i, [[typename T$i = void]]>
-class tuple;
-
-// Anything in namespace gtest_internal is Google Test's INTERNAL
-// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
-namespace gtest_internal {
-
-// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
-template <typename T>
-struct ByRef { typedef const T& type; }; // NOLINT
-template <typename T>
-struct ByRef<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper for ByRef.
-#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
-
-// AddRef<T>::type is T if T is a reference; otherwise it's T&. This
-// is the same as tr1::add_reference<T>::type.
-template <typename T>
-struct AddRef { typedef T& type; }; // NOLINT
-template <typename T>
-struct AddRef<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper for AddRef.
-#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
-
-// A helper for implementing get<k>().
-template <int k> class Get;
-
-// A helper for implementing tuple_element<k, T>. kIndexValid is true
-// iff k < the number of fields in tuple type T.
-template <bool kIndexValid, int kIndex, class Tuple>
-struct TupleElement;
-
-
-$for i [[
-template <GTEST_$(n)_TYPENAMES_(T)>
-struct TupleElement<true, $i, GTEST_$(n)_TUPLE_(T) > {
- typedef T$i type;
-};
-
-
-]]
-} // namespace gtest_internal
-
-template <>
-class tuple<> {
- public:
- tuple() {}
- tuple(const tuple& /* t */) {}
- tuple& operator=(const tuple& /* t */) { return *this; }
-};
-
-
-$for k [[
-$range m 0..k-1
-template <GTEST_$(k)_TYPENAMES_(T)>
-class $if k < n [[GTEST_$(k)_TUPLE_(T)]] $else [[tuple]] {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : $for m, [[f$(m)_()]] {}
-
- explicit tuple($for m, [[GTEST_BY_REF_(T$m) f$m]]) : [[]]
-$for m, [[f$(m)_(f$m)]] {}
-
- tuple(const tuple& t) : $for m, [[f$(m)_(t.f$(m)_)]] {}
-
- template <GTEST_$(k)_TYPENAMES_(U)>
- tuple(const GTEST_$(k)_TUPLE_(U)& t) : $for m, [[f$(m)_(t.f$(m)_)]] {}
-
-$if k == 2 [[
- template <typename U0, typename U1>
- tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
-
-]]
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_$(k)_TYPENAMES_(U)>
- tuple& operator=(const GTEST_$(k)_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
-$if k == 2 [[
- template <typename U0, typename U1>
- tuple& operator=(const ::std::pair<U0, U1>& p) {
- f0_ = p.first;
- f1_ = p.second;
- return *this;
- }
-
-]]
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_$(k)_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_$(k)_TUPLE_(U)& t) {
-
-$for m [[
- f$(m)_ = t.f$(m)_;
-
-]]
- return *this;
- }
-
-
-$for m [[
- T$m f$(m)_;
-
-]]
-};
-
-
-]]
-// 6.1.3.2 Tuple creation functions.
-
-// Known limitations: we don't support passing an
-// std::tr1::reference_wrapper<T> to make_tuple(). And we don't
-// implement tie().
-
-inline tuple<> make_tuple() { return tuple<>(); }
-
-$for k [[
-$range m 0..k-1
-
-template <GTEST_$(k)_TYPENAMES_(T)>
-inline GTEST_$(k)_TUPLE_(T) make_tuple($for m, [[const T$m& f$m]]) {
- return GTEST_$(k)_TUPLE_(T)($for m, [[f$m]]);
-}
-
-]]
-
-// 6.1.3.3 Tuple helper classes.
-
-template <typename Tuple> struct tuple_size;
-
-
-$for j [[
-template <GTEST_$(j)_TYPENAMES_(T)>
-struct tuple_size<GTEST_$(j)_TUPLE_(T) > {
- static const int value = $j;
-};
-
-
-]]
-template <int k, class Tuple>
-struct tuple_element {
- typedef typename gtest_internal::TupleElement<
- k < (tuple_size<Tuple>::value), k, Tuple>::type type;
-};
-
-#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
-
-// 6.1.3.4 Element access.
-
-namespace gtest_internal {
-
-
-$for i [[
-template <>
-class Get<$i> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple))
- Field(Tuple& t) { return t.f$(i)_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple))
- ConstField(const Tuple& t) { return t.f$(i)_; }
-};
-
-
-]]
-} // namespace gtest_internal
-
-template <int k, GTEST_$(n)_TYPENAMES_(T)>
-GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T)))
-get(GTEST_$(n)_TUPLE_(T)& t) {
- return gtest_internal::Get<k>::Field(t);
-}
-
-template <int k, GTEST_$(n)_TYPENAMES_(T)>
-GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T)))
-get(const GTEST_$(n)_TUPLE_(T)& t) {
- return gtest_internal::Get<k>::ConstField(t);
-}
-
-// 6.1.3.5 Relational operators
-
-// We only implement == and !=, as we don't have a need for the rest yet.
-
-namespace gtest_internal {
-
-// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
-// first k fields of t1 equals the first k fields of t2.
-// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
-// k1 != k2.
-template <int kSize1, int kSize2>
-struct SameSizeTuplePrefixComparator;
-
-template <>
-struct SameSizeTuplePrefixComparator<0, 0> {
- template <class Tuple1, class Tuple2>
- static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
- return true;
- }
-};
-
-template <int k>
-struct SameSizeTuplePrefixComparator<k, k> {
- template <class Tuple1, class Tuple2>
- static bool Eq(const Tuple1& t1, const Tuple2& t2) {
- return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
- ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
- }
-};
-
-} // namespace gtest_internal
-
-template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>
-inline bool operator==(const GTEST_$(n)_TUPLE_(T)& t,
- const GTEST_$(n)_TUPLE_(U)& u) {
- return gtest_internal::SameSizeTuplePrefixComparator<
- tuple_size<GTEST_$(n)_TUPLE_(T) >::value,
- tuple_size<GTEST_$(n)_TUPLE_(U) >::value>::Eq(t, u);
-}
-
-template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>
-inline bool operator!=(const GTEST_$(n)_TUPLE_(T)& t,
- const GTEST_$(n)_TUPLE_(U)& u) { return !(t == u); }
-
-// 6.1.4 Pairs.
-// Unimplemented.
-
-} // namespace tr1
-} // namespace std
-
-
-$for j [[
-#undef GTEST_$(j)_TUPLE_
-
-]]
-
-
-$for j [[
-#undef GTEST_$(j)_TYPENAMES_
-
-]]
-
-#undef GTEST_DECLARE_TUPLE_AS_FRIEND_
-#undef GTEST_BY_REF_
-#undef GTEST_ADD_REF_
-#undef GTEST_TUPLE_ELEMENT_
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-type-util.h b/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-type-util.h
deleted file mode 100644
index e46f7cf..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-type-util.h
+++ /dev/null
@@ -1,3331 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gtest-type-util.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Type utilities needed for implementing typed and type-parameterized
-// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-// Currently we support at most 50 types in a list, and at most 50
-// type-parameterized tests in one type-parameterized test case.
-// Please contact googletestframework@googlegroups.com if you need
-// more.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-
-#include "gtest/internal/gtest-port.h"
-
-// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
-// libstdc++ (which is where cxxabi.h comes from).
-# if GTEST_HAS_CXXABI_H_
-# include <cxxabi.h>
-# elif defined(__HP_aCC)
-# include <acxx_demangle.h>
-# endif // GTEST_HASH_CXXABI_H_
-
-namespace testing {
-namespace internal {
-
-// GetTypeName<T>() returns a human-readable name of type T.
-// NB: This function is also used in Google Mock, so don't move it inside of
-// the typed-test-only section below.
-template <typename T>
-std::string GetTypeName() {
-# if GTEST_HAS_RTTI
-
- const char* const name = typeid(T).name();
-# if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
- int status = 0;
- // gcc's implementation of typeid(T).name() mangles the type name,
- // so we have to demangle it.
-# if GTEST_HAS_CXXABI_H_
- using abi::__cxa_demangle;
-# endif // GTEST_HAS_CXXABI_H_
- char* const readable_name = __cxa_demangle(name, 0, 0, &status);
- const std::string name_str(status == 0 ? readable_name : name);
- free(readable_name);
- return name_str;
-# else
- return name;
-# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
-
-# else
-
- return "<type>";
-
-# endif // GTEST_HAS_RTTI
-}
-
-#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
-// type. This can be used as a compile-time assertion to ensure that
-// two types are equal.
-
-template <typename T1, typename T2>
-struct AssertTypeEq;
-
-template <typename T>
-struct AssertTypeEq<T, T> {
- typedef bool type;
-};
-
-// A unique type used as the default value for the arguments of class
-// template Types. This allows us to simulate variadic templates
-// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
-// support directly.
-struct None {};
-
-// The following family of struct and struct templates are used to
-// represent type lists. In particular, TypesN<T1, T2, ..., TN>
-// represents a type list with N types (T1, T2, ..., and TN) in it.
-// Except for Types0, every struct in the family has two member types:
-// Head for the first type in the list, and Tail for the rest of the
-// list.
-
-// The empty type list.
-struct Types0 {};
-
-// Type lists of length 1, 2, 3, and so on.
-
-template <typename T1>
-struct Types1 {
- typedef T1 Head;
- typedef Types0 Tail;
-};
-template <typename T1, typename T2>
-struct Types2 {
- typedef T1 Head;
- typedef Types1<T2> Tail;
-};
-
-template <typename T1, typename T2, typename T3>
-struct Types3 {
- typedef T1 Head;
- typedef Types2<T2, T3> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4>
-struct Types4 {
- typedef T1 Head;
- typedef Types3<T2, T3, T4> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-struct Types5 {
- typedef T1 Head;
- typedef Types4<T2, T3, T4, T5> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-struct Types6 {
- typedef T1 Head;
- typedef Types5<T2, T3, T4, T5, T6> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-struct Types7 {
- typedef T1 Head;
- typedef Types6<T2, T3, T4, T5, T6, T7> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-struct Types8 {
- typedef T1 Head;
- typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-struct Types9 {
- typedef T1 Head;
- typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-struct Types10 {
- typedef T1 Head;
- typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-struct Types11 {
- typedef T1 Head;
- typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-struct Types12 {
- typedef T1 Head;
- typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-struct Types13 {
- typedef T1 Head;
- typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-struct Types14 {
- typedef T1 Head;
- typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-struct Types15 {
- typedef T1 Head;
- typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-struct Types16 {
- typedef T1 Head;
- typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-struct Types17 {
- typedef T1 Head;
- typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-struct Types18 {
- typedef T1 Head;
- typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-struct Types19 {
- typedef T1 Head;
- typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-struct Types20 {
- typedef T1 Head;
- typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-struct Types21 {
- typedef T1 Head;
- typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-struct Types22 {
- typedef T1 Head;
- typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-struct Types23 {
- typedef T1 Head;
- typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-struct Types24 {
- typedef T1 Head;
- typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-struct Types25 {
- typedef T1 Head;
- typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-struct Types26 {
- typedef T1 Head;
- typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-struct Types27 {
- typedef T1 Head;
- typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-struct Types28 {
- typedef T1 Head;
- typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-struct Types29 {
- typedef T1 Head;
- typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-struct Types30 {
- typedef T1 Head;
- typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-struct Types31 {
- typedef T1 Head;
- typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-struct Types32 {
- typedef T1 Head;
- typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-struct Types33 {
- typedef T1 Head;
- typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-struct Types34 {
- typedef T1 Head;
- typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-struct Types35 {
- typedef T1 Head;
- typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-struct Types36 {
- typedef T1 Head;
- typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-struct Types37 {
- typedef T1 Head;
- typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-struct Types38 {
- typedef T1 Head;
- typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-struct Types39 {
- typedef T1 Head;
- typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-struct Types40 {
- typedef T1 Head;
- typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-struct Types41 {
- typedef T1 Head;
- typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-struct Types42 {
- typedef T1 Head;
- typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-struct Types43 {
- typedef T1 Head;
- typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-struct Types44 {
- typedef T1 Head;
- typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-struct Types45 {
- typedef T1 Head;
- typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-struct Types46 {
- typedef T1 Head;
- typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-struct Types47 {
- typedef T1 Head;
- typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-struct Types48 {
- typedef T1 Head;
- typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-struct Types49 {
- typedef T1 Head;
- typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-struct Types50 {
- typedef T1 Head;
- typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49, T50> Tail;
-};
-
-
-} // namespace internal
-
-// We don't want to require the users to write TypesN<...> directly,
-// as that would require them to count the length. Types<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Types<int>
-// will appear as Types<int, None, None, ..., None> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Types<T1, ..., TN>, and Google Test will translate
-// that to TypesN<T1, ..., TN> internally to make error messages
-// readable. The translation is done by the 'type' member of the
-// Types template.
-template <typename T1 = internal::None, typename T2 = internal::None,
- typename T3 = internal::None, typename T4 = internal::None,
- typename T5 = internal::None, typename T6 = internal::None,
- typename T7 = internal::None, typename T8 = internal::None,
- typename T9 = internal::None, typename T10 = internal::None,
- typename T11 = internal::None, typename T12 = internal::None,
- typename T13 = internal::None, typename T14 = internal::None,
- typename T15 = internal::None, typename T16 = internal::None,
- typename T17 = internal::None, typename T18 = internal::None,
- typename T19 = internal::None, typename T20 = internal::None,
- typename T21 = internal::None, typename T22 = internal::None,
- typename T23 = internal::None, typename T24 = internal::None,
- typename T25 = internal::None, typename T26 = internal::None,
- typename T27 = internal::None, typename T28 = internal::None,
- typename T29 = internal::None, typename T30 = internal::None,
- typename T31 = internal::None, typename T32 = internal::None,
- typename T33 = internal::None, typename T34 = internal::None,
- typename T35 = internal::None, typename T36 = internal::None,
- typename T37 = internal::None, typename T38 = internal::None,
- typename T39 = internal::None, typename T40 = internal::None,
- typename T41 = internal::None, typename T42 = internal::None,
- typename T43 = internal::None, typename T44 = internal::None,
- typename T45 = internal::None, typename T46 = internal::None,
- typename T47 = internal::None, typename T48 = internal::None,
- typename T49 = internal::None, typename T50 = internal::None>
-struct Types {
- typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
-};
-
-template <>
-struct Types<internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types0 type;
-};
-template <typename T1>
-struct Types<T1, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types1<T1> type;
-};
-template <typename T1, typename T2>
-struct Types<T1, T2, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types2<T1, T2> type;
-};
-template <typename T1, typename T2, typename T3>
-struct Types<T1, T2, T3, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types3<T1, T2, T3> type;
-};
-template <typename T1, typename T2, typename T3, typename T4>
-struct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types4<T1, T2, T3, T4> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-struct Types<T1, T2, T3, T4, T5, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types5<T1, T2, T3, T4, T5> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-struct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types6<T1, T2, T3, T4, T5, T6> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-struct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, T47, internal::None, internal::None, internal::None> {
- typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, T47, T48, internal::None, internal::None> {
- typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, T47, T48, T49, internal::None> {
- typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48, T49> type;
-};
-
-namespace internal {
-
-# define GTEST_TEMPLATE_ template <typename T> class
-
-// The template "selector" struct TemplateSel<Tmpl> is used to
-// represent Tmpl, which must be a class template with one type
-// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined
-// as the type Tmpl<T>. This allows us to actually instantiate the
-// template "selected" by TemplateSel<Tmpl>.
-//
-// This trick is necessary for simulating typedef for class templates,
-// which C++ doesn't support directly.
-template <GTEST_TEMPLATE_ Tmpl>
-struct TemplateSel {
- template <typename T>
- struct Bind {
- typedef Tmpl<T> type;
- };
-};
-
-# define GTEST_BIND_(TmplSel, T) \
- TmplSel::template Bind<T>::type
-
-// A unique struct template used as the default value for the
-// arguments of class template Templates. This allows us to simulate
-// variadic templates (e.g. Templates<int>, Templates<int, double>,
-// and etc), which C++ doesn't support directly.
-template <typename T>
-struct NoneT {};
-
-// The following family of struct and struct templates are used to
-// represent template lists. In particular, TemplatesN<T1, T2, ...,
-// TN> represents a list of N templates (T1, T2, ..., and TN). Except
-// for Templates0, every struct in the family has two member types:
-// Head for the selector of the first template in the list, and Tail
-// for the rest of the list.
-
-// The empty template list.
-struct Templates0 {};
-
-// Template lists of length 1, 2, 3, and so on.
-
-template <GTEST_TEMPLATE_ T1>
-struct Templates1 {
- typedef TemplateSel<T1> Head;
- typedef Templates0 Tail;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
-struct Templates2 {
- typedef TemplateSel<T1> Head;
- typedef Templates1<T2> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
-struct Templates3 {
- typedef TemplateSel<T1> Head;
- typedef Templates2<T2, T3> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4>
-struct Templates4 {
- typedef TemplateSel<T1> Head;
- typedef Templates3<T2, T3, T4> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
-struct Templates5 {
- typedef TemplateSel<T1> Head;
- typedef Templates4<T2, T3, T4, T5> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
-struct Templates6 {
- typedef TemplateSel<T1> Head;
- typedef Templates5<T2, T3, T4, T5, T6> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7>
-struct Templates7 {
- typedef TemplateSel<T1> Head;
- typedef Templates6<T2, T3, T4, T5, T6, T7> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
-struct Templates8 {
- typedef TemplateSel<T1> Head;
- typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
-struct Templates9 {
- typedef TemplateSel<T1> Head;
- typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10>
-struct Templates10 {
- typedef TemplateSel<T1> Head;
- typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
-struct Templates11 {
- typedef TemplateSel<T1> Head;
- typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
-struct Templates12 {
- typedef TemplateSel<T1> Head;
- typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13>
-struct Templates13 {
- typedef TemplateSel<T1> Head;
- typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
-struct Templates14 {
- typedef TemplateSel<T1> Head;
- typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
-struct Templates15 {
- typedef TemplateSel<T1> Head;
- typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16>
-struct Templates16 {
- typedef TemplateSel<T1> Head;
- typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
-struct Templates17 {
- typedef TemplateSel<T1> Head;
- typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
-struct Templates18 {
- typedef TemplateSel<T1> Head;
- typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19>
-struct Templates19 {
- typedef TemplateSel<T1> Head;
- typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
-struct Templates20 {
- typedef TemplateSel<T1> Head;
- typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
-struct Templates21 {
- typedef TemplateSel<T1> Head;
- typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22>
-struct Templates22 {
- typedef TemplateSel<T1> Head;
- typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
-struct Templates23 {
- typedef TemplateSel<T1> Head;
- typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
-struct Templates24 {
- typedef TemplateSel<T1> Head;
- typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25>
-struct Templates25 {
- typedef TemplateSel<T1> Head;
- typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
-struct Templates26 {
- typedef TemplateSel<T1> Head;
- typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
-struct Templates27 {
- typedef TemplateSel<T1> Head;
- typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28>
-struct Templates28 {
- typedef TemplateSel<T1> Head;
- typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
-struct Templates29 {
- typedef TemplateSel<T1> Head;
- typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
-struct Templates30 {
- typedef TemplateSel<T1> Head;
- typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31>
-struct Templates31 {
- typedef TemplateSel<T1> Head;
- typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
-struct Templates32 {
- typedef TemplateSel<T1> Head;
- typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
-struct Templates33 {
- typedef TemplateSel<T1> Head;
- typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34>
-struct Templates34 {
- typedef TemplateSel<T1> Head;
- typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
-struct Templates35 {
- typedef TemplateSel<T1> Head;
- typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
-struct Templates36 {
- typedef TemplateSel<T1> Head;
- typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37>
-struct Templates37 {
- typedef TemplateSel<T1> Head;
- typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
-struct Templates38 {
- typedef TemplateSel<T1> Head;
- typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
-struct Templates39 {
- typedef TemplateSel<T1> Head;
- typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40>
-struct Templates40 {
- typedef TemplateSel<T1> Head;
- typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
-struct Templates41 {
- typedef TemplateSel<T1> Head;
- typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
-struct Templates42 {
- typedef TemplateSel<T1> Head;
- typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43>
-struct Templates43 {
- typedef TemplateSel<T1> Head;
- typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
-struct Templates44 {
- typedef TemplateSel<T1> Head;
- typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
-struct Templates45 {
- typedef TemplateSel<T1> Head;
- typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46>
-struct Templates46 {
- typedef TemplateSel<T1> Head;
- typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
-struct Templates47 {
- typedef TemplateSel<T1> Head;
- typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
-struct Templates48 {
- typedef TemplateSel<T1> Head;
- typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47, T48> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
- GTEST_TEMPLATE_ T49>
-struct Templates49 {
- typedef TemplateSel<T1> Head;
- typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47, T48, T49> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
- GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50>
-struct Templates50 {
- typedef TemplateSel<T1> Head;
- typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47, T48, T49, T50> Tail;
-};
-
-
-// We don't want to require the users to write TemplatesN<...> directly,
-// as that would require them to count the length. Templates<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Templates<list>
-// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Templates<T1, ..., TN>, and Google Test will translate
-// that to TemplatesN<T1, ..., TN> internally to make error messages
-// readable. The translation is done by the 'type' member of the
-// Templates template.
-template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT,
- GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT,
- GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT,
- GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT,
- GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT,
- GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT,
- GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT,
- GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT,
- GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT,
- GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT,
- GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT,
- GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT,
- GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT,
- GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT,
- GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT,
- GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT,
- GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT,
- GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT,
- GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT,
- GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT,
- GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT,
- GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT,
- GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT,
- GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT,
- GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT>
-struct Templates {
- typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
-};
-
-template <>
-struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates0 type;
-};
-template <GTEST_TEMPLATE_ T1>
-struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates1<T1> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
-struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates2<T1, T2> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
-struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates3<T1, T2, T3> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4>
-struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates4<T1, T2, T3, T4> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
-struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates5<T1, T2, T3, T4, T5> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
-struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates6<T1, T2, T3, T4, T5, T6> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT> {
- typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT> {
- typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT> {
- typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, T47, NoneT, NoneT, NoneT> {
- typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, T47, T48, NoneT, NoneT> {
- typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47, T48> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
- GTEST_TEMPLATE_ T49>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, T47, T48, T49, NoneT> {
- typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47, T48, T49> type;
-};
-
-// The TypeList template makes it possible to use either a single type
-// or a Types<...> list in TYPED_TEST_CASE() and
-// INSTANTIATE_TYPED_TEST_CASE_P().
-
-template <typename T>
-struct TypeList {
- typedef Types1<T> type;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49, T50> > {
- typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;
-};
-
-#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-type-util.h.pump b/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-type-util.h.pump
deleted file mode 100644
index 251fdf0..0000000
--- a/third_party/ntcore_2017/gmock/gtest/include/gtest/internal/gtest-type-util.h.pump
+++ /dev/null
@@ -1,297 +0,0 @@
-$$ -*- mode: c++; -*-
-$var n = 50 $$ Maximum length of type lists we want to support.
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Type utilities needed for implementing typed and type-parameterized
-// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-// Currently we support at most $n types in a list, and at most $n
-// type-parameterized tests in one type-parameterized test case.
-// Please contact googletestframework@googlegroups.com if you need
-// more.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-
-#include "gtest/internal/gtest-port.h"
-
-// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
-// libstdc++ (which is where cxxabi.h comes from).
-# if GTEST_HAS_CXXABI_H_
-# include <cxxabi.h>
-# elif defined(__HP_aCC)
-# include <acxx_demangle.h>
-# endif // GTEST_HASH_CXXABI_H_
-
-namespace testing {
-namespace internal {
-
-// GetTypeName<T>() returns a human-readable name of type T.
-// NB: This function is also used in Google Mock, so don't move it inside of
-// the typed-test-only section below.
-template <typename T>
-std::string GetTypeName() {
-# if GTEST_HAS_RTTI
-
- const char* const name = typeid(T).name();
-# if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
- int status = 0;
- // gcc's implementation of typeid(T).name() mangles the type name,
- // so we have to demangle it.
-# if GTEST_HAS_CXXABI_H_
- using abi::__cxa_demangle;
-# endif // GTEST_HAS_CXXABI_H_
- char* const readable_name = __cxa_demangle(name, 0, 0, &status);
- const std::string name_str(status == 0 ? readable_name : name);
- free(readable_name);
- return name_str;
-# else
- return name;
-# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
-
-# else
-
- return "<type>";
-
-# endif // GTEST_HAS_RTTI
-}
-
-#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
-// type. This can be used as a compile-time assertion to ensure that
-// two types are equal.
-
-template <typename T1, typename T2>
-struct AssertTypeEq;
-
-template <typename T>
-struct AssertTypeEq<T, T> {
- typedef bool type;
-};
-
-// A unique type used as the default value for the arguments of class
-// template Types. This allows us to simulate variadic templates
-// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
-// support directly.
-struct None {};
-
-// The following family of struct and struct templates are used to
-// represent type lists. In particular, TypesN<T1, T2, ..., TN>
-// represents a type list with N types (T1, T2, ..., and TN) in it.
-// Except for Types0, every struct in the family has two member types:
-// Head for the first type in the list, and Tail for the rest of the
-// list.
-
-// The empty type list.
-struct Types0 {};
-
-// Type lists of length 1, 2, 3, and so on.
-
-template <typename T1>
-struct Types1 {
- typedef T1 Head;
- typedef Types0 Tail;
-};
-
-$range i 2..n
-
-$for i [[
-$range j 1..i
-$range k 2..i
-template <$for j, [[typename T$j]]>
-struct Types$i {
- typedef T1 Head;
- typedef Types$(i-1)<$for k, [[T$k]]> Tail;
-};
-
-
-]]
-
-} // namespace internal
-
-// We don't want to require the users to write TypesN<...> directly,
-// as that would require them to count the length. Types<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Types<int>
-// will appear as Types<int, None, None, ..., None> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Types<T1, ..., TN>, and Google Test will translate
-// that to TypesN<T1, ..., TN> internally to make error messages
-// readable. The translation is done by the 'type' member of the
-// Types template.
-
-$range i 1..n
-template <$for i, [[typename T$i = internal::None]]>
-struct Types {
- typedef internal::Types$n<$for i, [[T$i]]> type;
-};
-
-template <>
-struct Types<$for i, [[internal::None]]> {
- typedef internal::Types0 type;
-};
-
-$range i 1..n-1
-$for i [[
-$range j 1..i
-$range k i+1..n
-template <$for j, [[typename T$j]]>
-struct Types<$for j, [[T$j]]$for k[[, internal::None]]> {
- typedef internal::Types$i<$for j, [[T$j]]> type;
-};
-
-]]
-
-namespace internal {
-
-# define GTEST_TEMPLATE_ template <typename T> class
-
-// The template "selector" struct TemplateSel<Tmpl> is used to
-// represent Tmpl, which must be a class template with one type
-// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined
-// as the type Tmpl<T>. This allows us to actually instantiate the
-// template "selected" by TemplateSel<Tmpl>.
-//
-// This trick is necessary for simulating typedef for class templates,
-// which C++ doesn't support directly.
-template <GTEST_TEMPLATE_ Tmpl>
-struct TemplateSel {
- template <typename T>
- struct Bind {
- typedef Tmpl<T> type;
- };
-};
-
-# define GTEST_BIND_(TmplSel, T) \
- TmplSel::template Bind<T>::type
-
-// A unique struct template used as the default value for the
-// arguments of class template Templates. This allows us to simulate
-// variadic templates (e.g. Templates<int>, Templates<int, double>,
-// and etc), which C++ doesn't support directly.
-template <typename T>
-struct NoneT {};
-
-// The following family of struct and struct templates are used to
-// represent template lists. In particular, TemplatesN<T1, T2, ...,
-// TN> represents a list of N templates (T1, T2, ..., and TN). Except
-// for Templates0, every struct in the family has two member types:
-// Head for the selector of the first template in the list, and Tail
-// for the rest of the list.
-
-// The empty template list.
-struct Templates0 {};
-
-// Template lists of length 1, 2, 3, and so on.
-
-template <GTEST_TEMPLATE_ T1>
-struct Templates1 {
- typedef TemplateSel<T1> Head;
- typedef Templates0 Tail;
-};
-
-$range i 2..n
-
-$for i [[
-$range j 1..i
-$range k 2..i
-template <$for j, [[GTEST_TEMPLATE_ T$j]]>
-struct Templates$i {
- typedef TemplateSel<T1> Head;
- typedef Templates$(i-1)<$for k, [[T$k]]> Tail;
-};
-
-
-]]
-
-// We don't want to require the users to write TemplatesN<...> directly,
-// as that would require them to count the length. Templates<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Templates<list>
-// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Templates<T1, ..., TN>, and Google Test will translate
-// that to TemplatesN<T1, ..., TN> internally to make error messages
-// readable. The translation is done by the 'type' member of the
-// Templates template.
-
-$range i 1..n
-template <$for i, [[GTEST_TEMPLATE_ T$i = NoneT]]>
-struct Templates {
- typedef Templates$n<$for i, [[T$i]]> type;
-};
-
-template <>
-struct Templates<$for i, [[NoneT]]> {
- typedef Templates0 type;
-};
-
-$range i 1..n-1
-$for i [[
-$range j 1..i
-$range k i+1..n
-template <$for j, [[GTEST_TEMPLATE_ T$j]]>
-struct Templates<$for j, [[T$j]]$for k[[, NoneT]]> {
- typedef Templates$i<$for j, [[T$j]]> type;
-};
-
-]]
-
-// The TypeList template makes it possible to use either a single type
-// or a Types<...> list in TYPED_TEST_CASE() and
-// INSTANTIATE_TYPED_TEST_CASE_P().
-
-template <typename T>
-struct TypeList {
- typedef Types1<T> type;
-};
-
-
-$range i 1..n
-template <$for i, [[typename T$i]]>
-struct TypeList<Types<$for i, [[T$i]]> > {
- typedef typename Types<$for i, [[T$i]]>::type type;
-};
-
-#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/src/gtest-all.cc b/third_party/ntcore_2017/gmock/gtest/src/gtest-all.cc
deleted file mode 100644
index 0a9cee5..0000000
--- a/third_party/ntcore_2017/gmock/gtest/src/gtest-all.cc
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: mheule@google.com (Markus Heule)
-//
-// Google C++ Testing Framework (Google Test)
-//
-// Sometimes it's desirable to build Google Test by compiling a single file.
-// This file serves this purpose.
-
-// This line ensures that gtest.h can be compiled on its own, even
-// when it's fused.
-#include "gtest/gtest.h"
-
-// The following lines pull in the real gtest *.cc files.
-#include "src/gtest.cc"
-#include "src/gtest-death-test.cc"
-#include "src/gtest-filepath.cc"
-#include "src/gtest-port.cc"
-#include "src/gtest-printers.cc"
-#include "src/gtest-test-part.cc"
-#include "src/gtest-typed-test.cc"
diff --git a/third_party/ntcore_2017/gmock/gtest/src/gtest-death-test.cc b/third_party/ntcore_2017/gmock/gtest/src/gtest-death-test.cc
deleted file mode 100644
index a6023fc..0000000
--- a/third_party/ntcore_2017/gmock/gtest/src/gtest-death-test.cc
+++ /dev/null
@@ -1,1344 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev)
-//
-// This file implements death tests.
-
-#include "gtest/gtest-death-test.h"
-#include "gtest/internal/gtest-port.h"
-
-#if GTEST_HAS_DEATH_TEST
-
-# if GTEST_OS_MAC
-# include <crt_externs.h>
-# endif // GTEST_OS_MAC
-
-# include <errno.h>
-# include <fcntl.h>
-# include <limits.h>
-
-# if GTEST_OS_LINUX
-# include <signal.h>
-# endif // GTEST_OS_LINUX
-
-# include <stdarg.h>
-
-# if GTEST_OS_WINDOWS
-# include <windows.h>
-# else
-# include <sys/mman.h>
-# include <sys/wait.h>
-# endif // GTEST_OS_WINDOWS
-
-# if GTEST_OS_QNX
-# include <spawn.h>
-# endif // GTEST_OS_QNX
-
-#endif // GTEST_HAS_DEATH_TEST
-
-#include "gtest/gtest-message.h"
-#include "gtest/internal/gtest-string.h"
-
-// Indicates that this translation unit is part of Google Test's
-// implementation. It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error. This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION_
-
-namespace testing {
-
-// Constants.
-
-// The default death test style.
-static const char kDefaultDeathTestStyle[] = "fast";
-
-GTEST_DEFINE_string_(
- death_test_style,
- internal::StringFromGTestEnv("death_test_style", kDefaultDeathTestStyle),
- "Indicates how to run a death test in a forked child process: "
- "\"threadsafe\" (child process re-executes the test binary "
- "from the beginning, running only the specific death test) or "
- "\"fast\" (child process runs the death test immediately "
- "after forking).");
-
-GTEST_DEFINE_bool_(
- death_test_use_fork,
- internal::BoolFromGTestEnv("death_test_use_fork", false),
- "Instructs to use fork()/_exit() instead of clone() in death tests. "
- "Ignored and always uses fork() on POSIX systems where clone() is not "
- "implemented. Useful when running under valgrind or similar tools if "
- "those do not support clone(). Valgrind 3.3.1 will just fail if "
- "it sees an unsupported combination of clone() flags. "
- "It is not recommended to use this flag w/o valgrind though it will "
- "work in 99% of the cases. Once valgrind is fixed, this flag will "
- "most likely be removed.");
-
-namespace internal {
-GTEST_DEFINE_string_(
- internal_run_death_test, "",
- "Indicates the file, line number, temporal index of "
- "the single death test to run, and a file descriptor to "
- "which a success code may be sent, all separated by "
- "the '|' characters. This flag is specified if and only if the current "
- "process is a sub-process launched for running a thread-safe "
- "death test. FOR INTERNAL USE ONLY.");
-} // namespace internal
-
-#if GTEST_HAS_DEATH_TEST
-
-namespace internal {
-
-// Valid only for fast death tests. Indicates the code is running in the
-// child process of a fast style death test.
-static bool g_in_fast_death_test_child = false;
-
-// Returns a Boolean value indicating whether the caller is currently
-// executing in the context of the death test child process. Tools such as
-// Valgrind heap checkers may need this to modify their behavior in death
-// tests. IMPORTANT: This is an internal utility. Using it may break the
-// implementation of death tests. User code MUST NOT use it.
-bool InDeathTestChild() {
-# if GTEST_OS_WINDOWS
-
- // On Windows, death tests are thread-safe regardless of the value of the
- // death_test_style flag.
- return !GTEST_FLAG(internal_run_death_test).empty();
-
-# else
-
- if (GTEST_FLAG(death_test_style) == "threadsafe")
- return !GTEST_FLAG(internal_run_death_test).empty();
- else
- return g_in_fast_death_test_child;
-#endif
-}
-
-} // namespace internal
-
-// ExitedWithCode constructor.
-ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {
-}
-
-// ExitedWithCode function-call operator.
-bool ExitedWithCode::operator()(int exit_status) const {
-# if GTEST_OS_WINDOWS
-
- return exit_status == exit_code_;
-
-# else
-
- return WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == exit_code_;
-
-# endif // GTEST_OS_WINDOWS
-}
-
-# if !GTEST_OS_WINDOWS
-// KilledBySignal constructor.
-KilledBySignal::KilledBySignal(int signum) : signum_(signum) {
-}
-
-// KilledBySignal function-call operator.
-bool KilledBySignal::operator()(int exit_status) const {
- return WIFSIGNALED(exit_status) && WTERMSIG(exit_status) == signum_;
-}
-# endif // !GTEST_OS_WINDOWS
-
-namespace internal {
-
-// Utilities needed for death tests.
-
-// Generates a textual description of a given exit code, in the format
-// specified by wait(2).
-static std::string ExitSummary(int exit_code) {
- Message m;
-
-# if GTEST_OS_WINDOWS
-
- m << "Exited with exit status " << exit_code;
-
-# else
-
- if (WIFEXITED(exit_code)) {
- m << "Exited with exit status " << WEXITSTATUS(exit_code);
- } else if (WIFSIGNALED(exit_code)) {
- m << "Terminated by signal " << WTERMSIG(exit_code);
- }
-# ifdef WCOREDUMP
- if (WCOREDUMP(exit_code)) {
- m << " (core dumped)";
- }
-# endif
-# endif // GTEST_OS_WINDOWS
-
- return m.GetString();
-}
-
-// Returns true if exit_status describes a process that was terminated
-// by a signal, or exited normally with a nonzero exit code.
-bool ExitedUnsuccessfully(int exit_status) {
- return !ExitedWithCode(0)(exit_status);
-}
-
-# if !GTEST_OS_WINDOWS
-// Generates a textual failure message when a death test finds more than
-// one thread running, or cannot determine the number of threads, prior
-// to executing the given statement. It is the responsibility of the
-// caller not to pass a thread_count of 1.
-static std::string DeathTestThreadWarning(size_t thread_count) {
- Message msg;
- msg << "Death tests use fork(), which is unsafe particularly"
- << " in a threaded context. For this test, " << GTEST_NAME_ << " ";
- if (thread_count == 0)
- msg << "couldn't detect the number of threads.";
- else
- msg << "detected " << thread_count << " threads.";
- return msg.GetString();
-}
-# endif // !GTEST_OS_WINDOWS
-
-// Flag characters for reporting a death test that did not die.
-static const char kDeathTestLived = 'L';
-static const char kDeathTestReturned = 'R';
-static const char kDeathTestThrew = 'T';
-static const char kDeathTestInternalError = 'I';
-
-// An enumeration describing all of the possible ways that a death test can
-// conclude. DIED means that the process died while executing the test
-// code; LIVED means that process lived beyond the end of the test code;
-// RETURNED means that the test statement attempted to execute a return
-// statement, which is not allowed; THREW means that the test statement
-// returned control by throwing an exception. IN_PROGRESS means the test
-// has not yet concluded.
-// TODO(vladl@google.com): Unify names and possibly values for
-// AbortReason, DeathTestOutcome, and flag characters above.
-enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
-
-// Routine for aborting the program which is safe to call from an
-// exec-style death test child process, in which case the error
-// message is propagated back to the parent process. Otherwise, the
-// message is simply printed to stderr. In either case, the program
-// then exits with status 1.
-void DeathTestAbort(const std::string& message) {
- // On a POSIX system, this function may be called from a threadsafe-style
- // death test child process, which operates on a very small stack. Use
- // the heap for any additional non-minuscule memory requirements.
- const InternalRunDeathTestFlag* const flag =
- GetUnitTestImpl()->internal_run_death_test_flag();
- if (flag != NULL) {
- FILE* parent = posix::FDOpen(flag->write_fd(), "w");
- fputc(kDeathTestInternalError, parent);
- fprintf(parent, "%s", message.c_str());
- fflush(parent);
- _exit(1);
- } else {
- fprintf(stderr, "%s", message.c_str());
- fflush(stderr);
- posix::Abort();
- }
-}
-
-// A replacement for CHECK that calls DeathTestAbort if the assertion
-// fails.
-# define GTEST_DEATH_TEST_CHECK_(expression) \
- do { \
- if (!::testing::internal::IsTrue(expression)) { \
- DeathTestAbort( \
- ::std::string("CHECK failed: File ") + __FILE__ + ", line " \
- + ::testing::internal::StreamableToString(__LINE__) + ": " \
- + #expression); \
- } \
- } while (::testing::internal::AlwaysFalse())
-
-// This macro is similar to GTEST_DEATH_TEST_CHECK_, but it is meant for
-// evaluating any system call that fulfills two conditions: it must return
-// -1 on failure, and set errno to EINTR when it is interrupted and
-// should be tried again. The macro expands to a loop that repeatedly
-// evaluates the expression as long as it evaluates to -1 and sets
-// errno to EINTR. If the expression evaluates to -1 but errno is
-// something other than EINTR, DeathTestAbort is called.
-# define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \
- do { \
- int gtest_retval; \
- do { \
- gtest_retval = (expression); \
- } while (gtest_retval == -1 && errno == EINTR); \
- if (gtest_retval == -1) { \
- DeathTestAbort( \
- ::std::string("CHECK failed: File ") + __FILE__ + ", line " \
- + ::testing::internal::StreamableToString(__LINE__) + ": " \
- + #expression + " != -1"); \
- } \
- } while (::testing::internal::AlwaysFalse())
-
-// Returns the message describing the last system error in errno.
-std::string GetLastErrnoDescription() {
- return errno == 0 ? "" : posix::StrError(errno);
-}
-
-// This is called from a death test parent process to read a failure
-// message from the death test child process and log it with the FATAL
-// severity. On Windows, the message is read from a pipe handle. On other
-// platforms, it is read from a file descriptor.
-static void FailFromInternalError(int fd) {
- Message error;
- char buffer[256];
- int num_read;
-
- do {
- while ((num_read = posix::Read(fd, buffer, 255)) > 0) {
- buffer[num_read] = '\0';
- error << buffer;
- }
- } while (num_read == -1 && errno == EINTR);
-
- if (num_read == 0) {
- GTEST_LOG_(FATAL) << error.GetString();
- } else {
- const int last_error = errno;
- GTEST_LOG_(FATAL) << "Error while reading death test internal: "
- << GetLastErrnoDescription() << " [" << last_error << "]";
- }
-}
-
-// Death test constructor. Increments the running death test count
-// for the current test.
-DeathTest::DeathTest() {
- TestInfo* const info = GetUnitTestImpl()->current_test_info();
- if (info == NULL) {
- DeathTestAbort("Cannot run a death test outside of a TEST or "
- "TEST_F construct");
- }
-}
-
-// Creates and returns a death test by dispatching to the current
-// death test factory.
-bool DeathTest::Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test) {
- return GetUnitTestImpl()->death_test_factory()->Create(
- statement, regex, file, line, test);
-}
-
-const char* DeathTest::LastMessage() {
- return last_death_test_message_.c_str();
-}
-
-void DeathTest::set_last_death_test_message(const std::string& message) {
- last_death_test_message_ = message;
-}
-
-std::string DeathTest::last_death_test_message_;
-
-// Provides cross platform implementation for some death functionality.
-class DeathTestImpl : public DeathTest {
- protected:
- DeathTestImpl(const char* a_statement, const RE* a_regex)
- : statement_(a_statement),
- regex_(a_regex),
- spawned_(false),
- status_(-1),
- outcome_(IN_PROGRESS),
- read_fd_(-1),
- write_fd_(-1) {}
-
- // read_fd_ is expected to be closed and cleared by a derived class.
- ~DeathTestImpl() { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); }
-
- void Abort(AbortReason reason);
- virtual bool Passed(bool status_ok);
-
- const char* statement() const { return statement_; }
- const RE* regex() const { return regex_; }
- bool spawned() const { return spawned_; }
- void set_spawned(bool is_spawned) { spawned_ = is_spawned; }
- int status() const { return status_; }
- void set_status(int a_status) { status_ = a_status; }
- DeathTestOutcome outcome() const { return outcome_; }
- void set_outcome(DeathTestOutcome an_outcome) { outcome_ = an_outcome; }
- int read_fd() const { return read_fd_; }
- void set_read_fd(int fd) { read_fd_ = fd; }
- int write_fd() const { return write_fd_; }
- void set_write_fd(int fd) { write_fd_ = fd; }
-
- // Called in the parent process only. Reads the result code of the death
- // test child process via a pipe, interprets it to set the outcome_
- // member, and closes read_fd_. Outputs diagnostics and terminates in
- // case of unexpected codes.
- void ReadAndInterpretStatusByte();
-
- private:
- // The textual content of the code this object is testing. This class
- // doesn't own this string and should not attempt to delete it.
- const char* const statement_;
- // The regular expression which test output must match. DeathTestImpl
- // doesn't own this object and should not attempt to delete it.
- const RE* const regex_;
- // True if the death test child process has been successfully spawned.
- bool spawned_;
- // The exit status of the child process.
- int status_;
- // How the death test concluded.
- DeathTestOutcome outcome_;
- // Descriptor to the read end of the pipe to the child process. It is
- // always -1 in the child process. The child keeps its write end of the
- // pipe in write_fd_.
- int read_fd_;
- // Descriptor to the child's write end of the pipe to the parent process.
- // It is always -1 in the parent process. The parent keeps its end of the
- // pipe in read_fd_.
- int write_fd_;
-};
-
-// Called in the parent process only. Reads the result code of the death
-// test child process via a pipe, interprets it to set the outcome_
-// member, and closes read_fd_. Outputs diagnostics and terminates in
-// case of unexpected codes.
-void DeathTestImpl::ReadAndInterpretStatusByte() {
- char flag;
- int bytes_read;
-
- // The read() here blocks until data is available (signifying the
- // failure of the death test) or until the pipe is closed (signifying
- // its success), so it's okay to call this in the parent before
- // the child process has exited.
- do {
- bytes_read = posix::Read(read_fd(), &flag, 1);
- } while (bytes_read == -1 && errno == EINTR);
-
- if (bytes_read == 0) {
- set_outcome(DIED);
- } else if (bytes_read == 1) {
- switch (flag) {
- case kDeathTestReturned:
- set_outcome(RETURNED);
- break;
- case kDeathTestThrew:
- set_outcome(THREW);
- break;
- case kDeathTestLived:
- set_outcome(LIVED);
- break;
- case kDeathTestInternalError:
- FailFromInternalError(read_fd()); // Does not return.
- break;
- default:
- GTEST_LOG_(FATAL) << "Death test child process reported "
- << "unexpected status byte ("
- << static_cast<unsigned int>(flag) << ")";
- }
- } else {
- GTEST_LOG_(FATAL) << "Read from death test child process failed: "
- << GetLastErrnoDescription();
- }
- GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Close(read_fd()));
- set_read_fd(-1);
-}
-
-// Signals that the death test code which should have exited, didn't.
-// Should be called only in a death test child process.
-// Writes a status byte to the child's status file descriptor, then
-// calls _exit(1).
-void DeathTestImpl::Abort(AbortReason reason) {
- // The parent process considers the death test to be a failure if
- // it finds any data in our pipe. So, here we write a single flag byte
- // to the pipe, then exit.
- const char status_ch =
- reason == TEST_DID_NOT_DIE ? kDeathTestLived :
- reason == TEST_THREW_EXCEPTION ? kDeathTestThrew : kDeathTestReturned;
-
- GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Write(write_fd(), &status_ch, 1));
- // We are leaking the descriptor here because on some platforms (i.e.,
- // when built as Windows DLL), destructors of global objects will still
- // run after calling _exit(). On such systems, write_fd_ will be
- // indirectly closed from the destructor of UnitTestImpl, causing double
- // close if it is also closed here. On debug configurations, double close
- // may assert. As there are no in-process buffers to flush here, we are
- // relying on the OS to close the descriptor after the process terminates
- // when the destructors are not run.
- _exit(1); // Exits w/o any normal exit hooks (we were supposed to crash)
-}
-
-// Returns an indented copy of stderr output for a death test.
-// This makes distinguishing death test output lines from regular log lines
-// much easier.
-static ::std::string FormatDeathTestOutput(const ::std::string& output) {
- ::std::string ret;
- for (size_t at = 0; ; ) {
- const size_t line_end = output.find('\n', at);
- ret += "[ DEATH ] ";
- if (line_end == ::std::string::npos) {
- ret += output.substr(at);
- break;
- }
- ret += output.substr(at, line_end + 1 - at);
- at = line_end + 1;
- }
- return ret;
-}
-
-// Assesses the success or failure of a death test, using both private
-// members which have previously been set, and one argument:
-//
-// Private data members:
-// outcome: An enumeration describing how the death test
-// concluded: DIED, LIVED, THREW, or RETURNED. The death test
-// fails in the latter three cases.
-// status: The exit status of the child process. On *nix, it is in the
-// in the format specified by wait(2). On Windows, this is the
-// value supplied to the ExitProcess() API or a numeric code
-// of the exception that terminated the program.
-// regex: A regular expression object to be applied to
-// the test's captured standard error output; the death test
-// fails if it does not match.
-//
-// Argument:
-// status_ok: true if exit_status is acceptable in the context of
-// this particular death test, which fails if it is false
-//
-// Returns true iff all of the above conditions are met. Otherwise, the
-// first failing condition, in the order given above, is the one that is
-// reported. Also sets the last death test message string.
-bool DeathTestImpl::Passed(bool status_ok) {
- if (!spawned())
- return false;
-
- const std::string error_message = GetCapturedStderr();
-
- bool success = false;
- Message buffer;
-
- buffer << "Death test: " << statement() << "\n";
- switch (outcome()) {
- case LIVED:
- buffer << " Result: failed to die.\n"
- << " Error msg:\n" << FormatDeathTestOutput(error_message);
- break;
- case THREW:
- buffer << " Result: threw an exception.\n"
- << " Error msg:\n" << FormatDeathTestOutput(error_message);
- break;
- case RETURNED:
- buffer << " Result: illegal return in test statement.\n"
- << " Error msg:\n" << FormatDeathTestOutput(error_message);
- break;
- case DIED:
- if (status_ok) {
- const bool matched = RE::PartialMatch(error_message.c_str(), *regex());
- if (matched) {
- success = true;
- } else {
- buffer << " Result: died but not with expected error.\n"
- << " Expected: " << regex()->pattern() << "\n"
- << "Actual msg:\n" << FormatDeathTestOutput(error_message);
- }
- } else {
- buffer << " Result: died but not with expected exit code:\n"
- << " " << ExitSummary(status()) << "\n"
- << "Actual msg:\n" << FormatDeathTestOutput(error_message);
- }
- break;
- case IN_PROGRESS:
- default:
- GTEST_LOG_(FATAL)
- << "DeathTest::Passed somehow called before conclusion of test";
- }
-
- DeathTest::set_last_death_test_message(buffer.GetString());
- return success;
-}
-
-# if GTEST_OS_WINDOWS
-// WindowsDeathTest implements death tests on Windows. Due to the
-// specifics of starting new processes on Windows, death tests there are
-// always threadsafe, and Google Test considers the
-// --gtest_death_test_style=fast setting to be equivalent to
-// --gtest_death_test_style=threadsafe there.
-//
-// A few implementation notes: Like the Linux version, the Windows
-// implementation uses pipes for child-to-parent communication. But due to
-// the specifics of pipes on Windows, some extra steps are required:
-//
-// 1. The parent creates a communication pipe and stores handles to both
-// ends of it.
-// 2. The parent starts the child and provides it with the information
-// necessary to acquire the handle to the write end of the pipe.
-// 3. The child acquires the write end of the pipe and signals the parent
-// using a Windows event.
-// 4. Now the parent can release the write end of the pipe on its side. If
-// this is done before step 3, the object's reference count goes down to
-// 0 and it is destroyed, preventing the child from acquiring it. The
-// parent now has to release it, or read operations on the read end of
-// the pipe will not return when the child terminates.
-// 5. The parent reads child's output through the pipe (outcome code and
-// any possible error messages) from the pipe, and its stderr and then
-// determines whether to fail the test.
-//
-// Note: to distinguish Win32 API calls from the local method and function
-// calls, the former are explicitly resolved in the global namespace.
-//
-class WindowsDeathTest : public DeathTestImpl {
- public:
- WindowsDeathTest(const char* a_statement,
- const RE* a_regex,
- const char* file,
- int line)
- : DeathTestImpl(a_statement, a_regex), file_(file), line_(line) {}
-
- // All of these virtual functions are inherited from DeathTest.
- virtual int Wait();
- virtual TestRole AssumeRole();
-
- private:
- // The name of the file in which the death test is located.
- const char* const file_;
- // The line number on which the death test is located.
- const int line_;
- // Handle to the write end of the pipe to the child process.
- AutoHandle write_handle_;
- // Child process handle.
- AutoHandle child_handle_;
- // Event the child process uses to signal the parent that it has
- // acquired the handle to the write end of the pipe. After seeing this
- // event the parent can release its own handles to make sure its
- // ReadFile() calls return when the child terminates.
- AutoHandle event_handle_;
-};
-
-// Waits for the child in a death test to exit, returning its exit
-// status, or 0 if no child process exists. As a side effect, sets the
-// outcome data member.
-int WindowsDeathTest::Wait() {
- if (!spawned())
- return 0;
-
- // Wait until the child either signals that it has acquired the write end
- // of the pipe or it dies.
- const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() };
- switch (::WaitForMultipleObjects(2,
- wait_handles,
- FALSE, // Waits for any of the handles.
- INFINITE)) {
- case WAIT_OBJECT_0:
- case WAIT_OBJECT_0 + 1:
- break;
- default:
- GTEST_DEATH_TEST_CHECK_(false); // Should not get here.
- }
-
- // The child has acquired the write end of the pipe or exited.
- // We release the handle on our side and continue.
- write_handle_.Reset();
- event_handle_.Reset();
-
- ReadAndInterpretStatusByte();
-
- // Waits for the child process to exit if it haven't already. This
- // returns immediately if the child has already exited, regardless of
- // whether previous calls to WaitForMultipleObjects synchronized on this
- // handle or not.
- GTEST_DEATH_TEST_CHECK_(
- WAIT_OBJECT_0 == ::WaitForSingleObject(child_handle_.Get(),
- INFINITE));
- DWORD status_code;
- GTEST_DEATH_TEST_CHECK_(
- ::GetExitCodeProcess(child_handle_.Get(), &status_code) != FALSE);
- child_handle_.Reset();
- set_status(static_cast<int>(status_code));
- return status();
-}
-
-// The AssumeRole process for a Windows death test. It creates a child
-// process with the same executable as the current process to run the
-// death test. The child process is given the --gtest_filter and
-// --gtest_internal_run_death_test flags such that it knows to run the
-// current death test only.
-DeathTest::TestRole WindowsDeathTest::AssumeRole() {
- const UnitTestImpl* const impl = GetUnitTestImpl();
- const InternalRunDeathTestFlag* const flag =
- impl->internal_run_death_test_flag();
- const TestInfo* const info = impl->current_test_info();
- const int death_test_index = info->result()->death_test_count();
-
- if (flag != NULL) {
- // ParseInternalRunDeathTestFlag() has performed all the necessary
- // processing.
- set_write_fd(flag->write_fd());
- return EXECUTE_TEST;
- }
-
- // WindowsDeathTest uses an anonymous pipe to communicate results of
- // a death test.
- SECURITY_ATTRIBUTES handles_are_inheritable = {
- sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };
- HANDLE read_handle, write_handle;
- GTEST_DEATH_TEST_CHECK_(
- ::CreatePipe(&read_handle, &write_handle, &handles_are_inheritable,
- 0) // Default buffer size.
- != FALSE);
- set_read_fd(::_open_osfhandle(reinterpret_cast<intptr_t>(read_handle),
- O_RDONLY));
- write_handle_.Reset(write_handle);
- event_handle_.Reset(::CreateEvent(
- &handles_are_inheritable,
- TRUE, // The event will automatically reset to non-signaled state.
- FALSE, // The initial state is non-signalled.
- NULL)); // The even is unnamed.
- GTEST_DEATH_TEST_CHECK_(event_handle_.Get() != NULL);
- const std::string filter_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kFilterFlag + "=" +
- info->test_case_name() + "." + info->name();
- const std::string internal_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag +
- "=" + file_ + "|" + StreamableToString(line_) + "|" +
- StreamableToString(death_test_index) + "|" +
- StreamableToString(static_cast<unsigned int>(::GetCurrentProcessId())) +
- // size_t has the same width as pointers on both 32-bit and 64-bit
- // Windows platforms.
- // See http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx.
- "|" + StreamableToString(reinterpret_cast<size_t>(write_handle)) +
- "|" + StreamableToString(reinterpret_cast<size_t>(event_handle_.Get()));
-
- char executable_path[_MAX_PATH + 1]; // NOLINT
- GTEST_DEATH_TEST_CHECK_(
- _MAX_PATH + 1 != ::GetModuleFileNameA(NULL,
- executable_path,
- _MAX_PATH));
-
- std::string command_line =
- std::string(::GetCommandLineA()) + " " + filter_flag + " \"" +
- internal_flag + "\"";
-
- DeathTest::set_last_death_test_message("");
-
- CaptureStderr();
- // Flush the log buffers since the log streams are shared with the child.
- FlushInfoLog();
-
- // The child process will share the standard handles with the parent.
- STARTUPINFOA startup_info;
- memset(&startup_info, 0, sizeof(STARTUPINFO));
- startup_info.dwFlags = STARTF_USESTDHANDLES;
- startup_info.hStdInput = ::GetStdHandle(STD_INPUT_HANDLE);
- startup_info.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE);
- startup_info.hStdError = ::GetStdHandle(STD_ERROR_HANDLE);
-
- PROCESS_INFORMATION process_info;
- GTEST_DEATH_TEST_CHECK_(::CreateProcessA(
- executable_path,
- const_cast<char*>(command_line.c_str()),
- NULL, // Retuned process handle is not inheritable.
- NULL, // Retuned thread handle is not inheritable.
- TRUE, // Child inherits all inheritable handles (for write_handle_).
- 0x0, // Default creation flags.
- NULL, // Inherit the parent's environment.
- UnitTest::GetInstance()->original_working_dir(),
- &startup_info,
- &process_info) != FALSE);
- child_handle_.Reset(process_info.hProcess);
- ::CloseHandle(process_info.hThread);
- set_spawned(true);
- return OVERSEE_TEST;
-}
-# else // We are not on Windows.
-
-// ForkingDeathTest provides implementations for most of the abstract
-// methods of the DeathTest interface. Only the AssumeRole method is
-// left undefined.
-class ForkingDeathTest : public DeathTestImpl {
- public:
- ForkingDeathTest(const char* statement, const RE* regex);
-
- // All of these virtual functions are inherited from DeathTest.
- virtual int Wait();
-
- protected:
- void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; }
-
- private:
- // PID of child process during death test; 0 in the child process itself.
- pid_t child_pid_;
-};
-
-// Constructs a ForkingDeathTest.
-ForkingDeathTest::ForkingDeathTest(const char* a_statement, const RE* a_regex)
- : DeathTestImpl(a_statement, a_regex),
- child_pid_(-1) {}
-
-// Waits for the child in a death test to exit, returning its exit
-// status, or 0 if no child process exists. As a side effect, sets the
-// outcome data member.
-int ForkingDeathTest::Wait() {
- if (!spawned())
- return 0;
-
- ReadAndInterpretStatusByte();
-
- int status_value;
- GTEST_DEATH_TEST_CHECK_SYSCALL_(waitpid(child_pid_, &status_value, 0));
- set_status(status_value);
- return status_value;
-}
-
-// A concrete death test class that forks, then immediately runs the test
-// in the child process.
-class NoExecDeathTest : public ForkingDeathTest {
- public:
- NoExecDeathTest(const char* a_statement, const RE* a_regex) :
- ForkingDeathTest(a_statement, a_regex) { }
- virtual TestRole AssumeRole();
-};
-
-// The AssumeRole process for a fork-and-run death test. It implements a
-// straightforward fork, with a simple pipe to transmit the status byte.
-DeathTest::TestRole NoExecDeathTest::AssumeRole() {
- const size_t thread_count = GetThreadCount();
- if (thread_count != 1) {
- GTEST_LOG_(WARNING) << DeathTestThreadWarning(thread_count);
- }
-
- int pipe_fd[2];
- GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);
-
- DeathTest::set_last_death_test_message("");
- CaptureStderr();
- // When we fork the process below, the log file buffers are copied, but the
- // file descriptors are shared. We flush all log files here so that closing
- // the file descriptors in the child process doesn't throw off the
- // synchronization between descriptors and buffers in the parent process.
- // This is as close to the fork as possible to avoid a race condition in case
- // there are multiple threads running before the death test, and another
- // thread writes to the log file.
- FlushInfoLog();
-
- const pid_t child_pid = fork();
- GTEST_DEATH_TEST_CHECK_(child_pid != -1);
- set_child_pid(child_pid);
- if (child_pid == 0) {
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0]));
- set_write_fd(pipe_fd[1]);
- // Redirects all logging to stderr in the child process to prevent
- // concurrent writes to the log files. We capture stderr in the parent
- // process and append the child process' output to a log.
- LogToStderr();
- // Event forwarding to the listeners of event listener API mush be shut
- // down in death test subprocesses.
- GetUnitTestImpl()->listeners()->SuppressEventForwarding();
- g_in_fast_death_test_child = true;
- return EXECUTE_TEST;
- } else {
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
- set_read_fd(pipe_fd[0]);
- set_spawned(true);
- return OVERSEE_TEST;
- }
-}
-
-// A concrete death test class that forks and re-executes the main
-// program from the beginning, with command-line flags set that cause
-// only this specific death test to be run.
-class ExecDeathTest : public ForkingDeathTest {
- public:
- ExecDeathTest(const char* a_statement, const RE* a_regex,
- const char* file, int line) :
- ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { }
- virtual TestRole AssumeRole();
- private:
- static ::std::vector<testing::internal::string>
- GetArgvsForDeathTestChildProcess() {
- ::std::vector<testing::internal::string> args = GetInjectableArgvs();
- return args;
- }
- // The name of the file in which the death test is located.
- const char* const file_;
- // The line number on which the death test is located.
- const int line_;
-};
-
-// Utility class for accumulating command-line arguments.
-class Arguments {
- public:
- Arguments() {
- args_.push_back(NULL);
- }
-
- ~Arguments() {
- for (std::vector<char*>::iterator i = args_.begin(); i != args_.end();
- ++i) {
- free(*i);
- }
- }
- void AddArgument(const char* argument) {
- args_.insert(args_.end() - 1, posix::StrDup(argument));
- }
-
- template <typename Str>
- void AddArguments(const ::std::vector<Str>& arguments) {
- for (typename ::std::vector<Str>::const_iterator i = arguments.begin();
- i != arguments.end();
- ++i) {
- args_.insert(args_.end() - 1, posix::StrDup(i->c_str()));
- }
- }
- char* const* Argv() {
- return &args_[0];
- }
-
- private:
- std::vector<char*> args_;
-};
-
-// A struct that encompasses the arguments to the child process of a
-// threadsafe-style death test process.
-struct ExecDeathTestArgs {
- char* const* argv; // Command-line arguments for the child's call to exec
- int close_fd; // File descriptor to close; the read end of a pipe
-};
-
-# if GTEST_OS_MAC
-inline char** GetEnviron() {
- // When Google Test is built as a framework on MacOS X, the environ variable
- // is unavailable. Apple's documentation (man environ) recommends using
- // _NSGetEnviron() instead.
- return *_NSGetEnviron();
-}
-# else
-// Some POSIX platforms expect you to declare environ. extern "C" makes
-// it reside in the global namespace.
-extern "C" char** environ;
-inline char** GetEnviron() { return environ; }
-# endif // GTEST_OS_MAC
-
-# if !GTEST_OS_QNX
-// The main function for a threadsafe-style death test child process.
-// This function is called in a clone()-ed process and thus must avoid
-// any potentially unsafe operations like malloc or libc functions.
-static int ExecDeathTestChildMain(void* child_arg) {
- ExecDeathTestArgs* const args = static_cast<ExecDeathTestArgs*>(child_arg);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(args->close_fd));
-
- // We need to execute the test program in the same environment where
- // it was originally invoked. Therefore we change to the original
- // working directory first.
- const char* const original_dir =
- UnitTest::GetInstance()->original_working_dir();
- // We can safely call chdir() as it's a direct system call.
- if (chdir(original_dir) != 0) {
- DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " +
- GetLastErrnoDescription());
- return EXIT_FAILURE;
- }
-
- // We can safely call execve() as it's a direct system call. We
- // cannot use execvp() as it's a libc function and thus potentially
- // unsafe. Since execve() doesn't search the PATH, the user must
- // invoke the test program via a valid path that contains at least
- // one path separator.
- execve(args->argv[0], args->argv, GetEnviron());
- DeathTestAbort(std::string("execve(") + args->argv[0] + ", ...) in " +
- original_dir + " failed: " +
- GetLastErrnoDescription());
- return EXIT_FAILURE;
-}
-# endif // !GTEST_OS_QNX
-
-// Two utility routines that together determine the direction the stack
-// grows.
-// This could be accomplished more elegantly by a single recursive
-// function, but we want to guard against the unlikely possibility of
-// a smart compiler optimizing the recursion away.
-//
-// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining
-// StackLowerThanAddress into StackGrowsDown, which then doesn't give
-// correct answer.
-void StackLowerThanAddress(const void* ptr, bool* result) GTEST_NO_INLINE_;
-void StackLowerThanAddress(const void* ptr, bool* result) {
- int dummy;
- *result = (&dummy < ptr);
-}
-
-bool StackGrowsDown() {
- int dummy;
- bool result;
- StackLowerThanAddress(&dummy, &result);
- return result;
-}
-
-// Spawns a child process with the same executable as the current process in
-// a thread-safe manner and instructs it to run the death test. The
-// implementation uses fork(2) + exec. On systems where clone(2) is
-// available, it is used instead, being slightly more thread-safe. On QNX,
-// fork supports only single-threaded environments, so this function uses
-// spawn(2) there instead. The function dies with an error message if
-// anything goes wrong.
-static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
- ExecDeathTestArgs args = { argv, close_fd };
- pid_t child_pid = -1;
-
-# if GTEST_OS_QNX
- // Obtains the current directory and sets it to be closed in the child
- // process.
- const int cwd_fd = open(".", O_RDONLY);
- GTEST_DEATH_TEST_CHECK_(cwd_fd != -1);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(cwd_fd, F_SETFD, FD_CLOEXEC));
- // We need to execute the test program in the same environment where
- // it was originally invoked. Therefore we change to the original
- // working directory first.
- const char* const original_dir =
- UnitTest::GetInstance()->original_working_dir();
- // We can safely call chdir() as it's a direct system call.
- if (chdir(original_dir) != 0) {
- DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " +
- GetLastErrnoDescription());
- return EXIT_FAILURE;
- }
-
- int fd_flags;
- // Set close_fd to be closed after spawn.
- GTEST_DEATH_TEST_CHECK_SYSCALL_(fd_flags = fcntl(close_fd, F_GETFD));
- GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(close_fd, F_SETFD,
- fd_flags | FD_CLOEXEC));
- struct inheritance inherit = {0};
- // spawn is a system call.
- child_pid = spawn(args.argv[0], 0, NULL, &inherit, args.argv, GetEnviron());
- // Restores the current working directory.
- GTEST_DEATH_TEST_CHECK_(fchdir(cwd_fd) != -1);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(cwd_fd));
-
-# else // GTEST_OS_QNX
-# if GTEST_OS_LINUX
- // When a SIGPROF signal is received while fork() or clone() are executing,
- // the process may hang. To avoid this, we ignore SIGPROF here and re-enable
- // it after the call to fork()/clone() is complete.
- struct sigaction saved_sigprof_action;
- struct sigaction ignore_sigprof_action;
- memset(&ignore_sigprof_action, 0, sizeof(ignore_sigprof_action));
- sigemptyset(&ignore_sigprof_action.sa_mask);
- ignore_sigprof_action.sa_handler = SIG_IGN;
- GTEST_DEATH_TEST_CHECK_SYSCALL_(sigaction(
- SIGPROF, &ignore_sigprof_action, &saved_sigprof_action));
-# endif // GTEST_OS_LINUX
-
-# if GTEST_HAS_CLONE
- const bool use_fork = GTEST_FLAG(death_test_use_fork);
-
- if (!use_fork) {
- static const bool stack_grows_down = StackGrowsDown();
- const size_t stack_size = getpagesize();
- // MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead.
- void* const stack = mmap(NULL, stack_size, PROT_READ | PROT_WRITE,
- MAP_ANON | MAP_PRIVATE, -1, 0);
- GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED);
-
- // Maximum stack alignment in bytes: For a downward-growing stack, this
- // amount is subtracted from size of the stack space to get an address
- // that is within the stack space and is aligned on all systems we care
- // about. As far as I know there is no ABI with stack alignment greater
- // than 64. We assume stack and stack_size already have alignment of
- // kMaxStackAlignment.
- const size_t kMaxStackAlignment = 64;
- void* const stack_top =
- static_cast<char*>(stack) +
- (stack_grows_down ? stack_size - kMaxStackAlignment : 0);
- GTEST_DEATH_TEST_CHECK_(stack_size > kMaxStackAlignment &&
- reinterpret_cast<intptr_t>(stack_top) % kMaxStackAlignment == 0);
-
- child_pid = clone(&ExecDeathTestChildMain, stack_top, SIGCHLD, &args);
-
- GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1);
- }
-# else
- const bool use_fork = true;
-# endif // GTEST_HAS_CLONE
-
- if (use_fork && (child_pid = fork()) == 0) {
- ExecDeathTestChildMain(&args);
- _exit(0);
- }
-# endif // GTEST_OS_QNX
-# if GTEST_OS_LINUX
- GTEST_DEATH_TEST_CHECK_SYSCALL_(
- sigaction(SIGPROF, &saved_sigprof_action, NULL));
-# endif // GTEST_OS_LINUX
-
- GTEST_DEATH_TEST_CHECK_(child_pid != -1);
- return child_pid;
-}
-
-// The AssumeRole process for a fork-and-exec death test. It re-executes the
-// main program from the beginning, setting the --gtest_filter
-// and --gtest_internal_run_death_test flags to cause only the current
-// death test to be re-run.
-DeathTest::TestRole ExecDeathTest::AssumeRole() {
- const UnitTestImpl* const impl = GetUnitTestImpl();
- const InternalRunDeathTestFlag* const flag =
- impl->internal_run_death_test_flag();
- const TestInfo* const info = impl->current_test_info();
- const int death_test_index = info->result()->death_test_count();
-
- if (flag != NULL) {
- set_write_fd(flag->write_fd());
- return EXECUTE_TEST;
- }
-
- int pipe_fd[2];
- GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);
- // Clear the close-on-exec flag on the write end of the pipe, lest
- // it be closed when the child process does an exec:
- GTEST_DEATH_TEST_CHECK_(fcntl(pipe_fd[1], F_SETFD, 0) != -1);
-
- const std::string filter_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kFilterFlag + "="
- + info->test_case_name() + "." + info->name();
- const std::string internal_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + "="
- + file_ + "|" + StreamableToString(line_) + "|"
- + StreamableToString(death_test_index) + "|"
- + StreamableToString(pipe_fd[1]);
- Arguments args;
- args.AddArguments(GetArgvsForDeathTestChildProcess());
- args.AddArgument(filter_flag.c_str());
- args.AddArgument(internal_flag.c_str());
-
- DeathTest::set_last_death_test_message("");
-
- CaptureStderr();
- // See the comment in NoExecDeathTest::AssumeRole for why the next line
- // is necessary.
- FlushInfoLog();
-
- const pid_t child_pid = ExecDeathTestSpawnChild(args.Argv(), pipe_fd[0]);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
- set_child_pid(child_pid);
- set_read_fd(pipe_fd[0]);
- set_spawned(true);
- return OVERSEE_TEST;
-}
-
-# endif // !GTEST_OS_WINDOWS
-
-// Creates a concrete DeathTest-derived class that depends on the
-// --gtest_death_test_style flag, and sets the pointer pointed to
-// by the "test" argument to its address. If the test should be
-// skipped, sets that pointer to NULL. Returns true, unless the
-// flag is set to an invalid value.
-bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,
- const char* file, int line,
- DeathTest** test) {
- UnitTestImpl* const impl = GetUnitTestImpl();
- const InternalRunDeathTestFlag* const flag =
- impl->internal_run_death_test_flag();
- const int death_test_index = impl->current_test_info()
- ->increment_death_test_count();
-
- if (flag != NULL) {
- if (death_test_index > flag->index()) {
- DeathTest::set_last_death_test_message(
- "Death test count (" + StreamableToString(death_test_index)
- + ") somehow exceeded expected maximum ("
- + StreamableToString(flag->index()) + ")");
- return false;
- }
-
- if (!(flag->file() == file && flag->line() == line &&
- flag->index() == death_test_index)) {
- *test = NULL;
- return true;
- }
- }
-
-# if GTEST_OS_WINDOWS
-
- if (GTEST_FLAG(death_test_style) == "threadsafe" ||
- GTEST_FLAG(death_test_style) == "fast") {
- *test = new WindowsDeathTest(statement, regex, file, line);
- }
-
-# else
-
- if (GTEST_FLAG(death_test_style) == "threadsafe") {
- *test = new ExecDeathTest(statement, regex, file, line);
- } else if (GTEST_FLAG(death_test_style) == "fast") {
- *test = new NoExecDeathTest(statement, regex);
- }
-
-# endif // GTEST_OS_WINDOWS
-
- else { // NOLINT - this is more readable than unbalanced brackets inside #if.
- DeathTest::set_last_death_test_message(
- "Unknown death test style \"" + GTEST_FLAG(death_test_style)
- + "\" encountered");
- return false;
- }
-
- return true;
-}
-
-// Splits a given string on a given delimiter, populating a given
-// vector with the fields. GTEST_HAS_DEATH_TEST implies that we have
-// ::std::string, so we can use it here.
-static void SplitString(const ::std::string& str, char delimiter,
- ::std::vector< ::std::string>* dest) {
- ::std::vector< ::std::string> parsed;
- ::std::string::size_type pos = 0;
- while (::testing::internal::AlwaysTrue()) {
- const ::std::string::size_type colon = str.find(delimiter, pos);
- if (colon == ::std::string::npos) {
- parsed.push_back(str.substr(pos));
- break;
- } else {
- parsed.push_back(str.substr(pos, colon - pos));
- pos = colon + 1;
- }
- }
- dest->swap(parsed);
-}
-
-# if GTEST_OS_WINDOWS
-// Recreates the pipe and event handles from the provided parameters,
-// signals the event, and returns a file descriptor wrapped around the pipe
-// handle. This function is called in the child process only.
-int GetStatusFileDescriptor(unsigned int parent_process_id,
- size_t write_handle_as_size_t,
- size_t event_handle_as_size_t) {
- AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE,
- FALSE, // Non-inheritable.
- parent_process_id));
- if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) {
- DeathTestAbort("Unable to open parent process " +
- StreamableToString(parent_process_id));
- }
-
- // TODO(vladl@google.com): Replace the following check with a
- // compile-time assertion when available.
- GTEST_CHECK_(sizeof(HANDLE) <= sizeof(size_t));
-
- const HANDLE write_handle =
- reinterpret_cast<HANDLE>(write_handle_as_size_t);
- HANDLE dup_write_handle;
-
- // The newly initialized handle is accessible only in in the parent
- // process. To obtain one accessible within the child, we need to use
- // DuplicateHandle.
- if (!::DuplicateHandle(parent_process_handle.Get(), write_handle,
- ::GetCurrentProcess(), &dup_write_handle,
- 0x0, // Requested privileges ignored since
- // DUPLICATE_SAME_ACCESS is used.
- FALSE, // Request non-inheritable handler.
- DUPLICATE_SAME_ACCESS)) {
- DeathTestAbort("Unable to duplicate the pipe handle " +
- StreamableToString(write_handle_as_size_t) +
- " from the parent process " +
- StreamableToString(parent_process_id));
- }
-
- const HANDLE event_handle = reinterpret_cast<HANDLE>(event_handle_as_size_t);
- HANDLE dup_event_handle;
-
- if (!::DuplicateHandle(parent_process_handle.Get(), event_handle,
- ::GetCurrentProcess(), &dup_event_handle,
- 0x0,
- FALSE,
- DUPLICATE_SAME_ACCESS)) {
- DeathTestAbort("Unable to duplicate the event handle " +
- StreamableToString(event_handle_as_size_t) +
- " from the parent process " +
- StreamableToString(parent_process_id));
- }
-
- const int write_fd =
- ::_open_osfhandle(reinterpret_cast<intptr_t>(dup_write_handle), O_APPEND);
- if (write_fd == -1) {
- DeathTestAbort("Unable to convert pipe handle " +
- StreamableToString(write_handle_as_size_t) +
- " to a file descriptor");
- }
-
- // Signals the parent that the write end of the pipe has been acquired
- // so the parent can release its own write end.
- ::SetEvent(dup_event_handle);
-
- return write_fd;
-}
-# endif // GTEST_OS_WINDOWS
-
-// Returns a newly created InternalRunDeathTestFlag object with fields
-// initialized from the GTEST_FLAG(internal_run_death_test) flag if
-// the flag is specified; otherwise returns NULL.
-InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
- if (GTEST_FLAG(internal_run_death_test) == "") return NULL;
-
- // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we
- // can use it here.
- int line = -1;
- int index = -1;
- ::std::vector< ::std::string> fields;
- SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields);
- int write_fd = -1;
-
-# if GTEST_OS_WINDOWS
-
- unsigned int parent_process_id = 0;
- size_t write_handle_as_size_t = 0;
- size_t event_handle_as_size_t = 0;
-
- if (fields.size() != 6
- || !ParseNaturalNumber(fields[1], &line)
- || !ParseNaturalNumber(fields[2], &index)
- || !ParseNaturalNumber(fields[3], &parent_process_id)
- || !ParseNaturalNumber(fields[4], &write_handle_as_size_t)
- || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) {
- DeathTestAbort("Bad --gtest_internal_run_death_test flag: " +
- GTEST_FLAG(internal_run_death_test));
- }
- write_fd = GetStatusFileDescriptor(parent_process_id,
- write_handle_as_size_t,
- event_handle_as_size_t);
-# else
-
- if (fields.size() != 4
- || !ParseNaturalNumber(fields[1], &line)
- || !ParseNaturalNumber(fields[2], &index)
- || !ParseNaturalNumber(fields[3], &write_fd)) {
- DeathTestAbort("Bad --gtest_internal_run_death_test flag: "
- + GTEST_FLAG(internal_run_death_test));
- }
-
-# endif // GTEST_OS_WINDOWS
-
- return new InternalRunDeathTestFlag(fields[0], line, index, write_fd);
-}
-
-} // namespace internal
-
-#endif // GTEST_HAS_DEATH_TEST
-
-} // namespace testing
diff --git a/third_party/ntcore_2017/gmock/gtest/src/gtest-filepath.cc b/third_party/ntcore_2017/gmock/gtest/src/gtest-filepath.cc
deleted file mode 100644
index 6be58b6..0000000
--- a/third_party/ntcore_2017/gmock/gtest/src/gtest-filepath.cc
+++ /dev/null
@@ -1,382 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: keith.ray@gmail.com (Keith Ray)
-
-#include "gtest/gtest-message.h"
-#include "gtest/internal/gtest-filepath.h"
-#include "gtest/internal/gtest-port.h"
-
-#include <stdlib.h>
-
-#if GTEST_OS_WINDOWS_MOBILE
-# include <windows.h>
-#elif GTEST_OS_WINDOWS
-# include <direct.h>
-# include <io.h>
-#elif GTEST_OS_SYMBIAN
-// Symbian OpenC has PATH_MAX in sys/syslimits.h
-# include <sys/syslimits.h>
-#else
-# include <limits.h>
-# include <climits> // Some Linux distributions define PATH_MAX here.
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-#if GTEST_OS_WINDOWS
-# define GTEST_PATH_MAX_ _MAX_PATH
-#elif defined(PATH_MAX)
-# define GTEST_PATH_MAX_ PATH_MAX
-#elif defined(_XOPEN_PATH_MAX)
-# define GTEST_PATH_MAX_ _XOPEN_PATH_MAX
-#else
-# define GTEST_PATH_MAX_ _POSIX_PATH_MAX
-#endif // GTEST_OS_WINDOWS
-
-#include "gtest/internal/gtest-string.h"
-
-namespace testing {
-namespace internal {
-
-#if GTEST_OS_WINDOWS
-// On Windows, '\\' is the standard path separator, but many tools and the
-// Windows API also accept '/' as an alternate path separator. Unless otherwise
-// noted, a file path can contain either kind of path separators, or a mixture
-// of them.
-const char kPathSeparator = '\\';
-const char kAlternatePathSeparator = '/';
-const char kPathSeparatorString[] = "\\";
-const char kAlternatePathSeparatorString[] = "/";
-# if GTEST_OS_WINDOWS_MOBILE
-// Windows CE doesn't have a current directory. You should not use
-// the current directory in tests on Windows CE, but this at least
-// provides a reasonable fallback.
-const char kCurrentDirectoryString[] = "\\";
-// Windows CE doesn't define INVALID_FILE_ATTRIBUTES
-const DWORD kInvalidFileAttributes = 0xffffffff;
-# else
-const char kCurrentDirectoryString[] = ".\\";
-# endif // GTEST_OS_WINDOWS_MOBILE
-#else
-const char kPathSeparator = '/';
-const char kPathSeparatorString[] = "/";
-const char kCurrentDirectoryString[] = "./";
-#endif // GTEST_OS_WINDOWS
-
-// Returns whether the given character is a valid path separator.
-static bool IsPathSeparator(char c) {
-#if GTEST_HAS_ALT_PATH_SEP_
- return (c == kPathSeparator) || (c == kAlternatePathSeparator);
-#else
- return c == kPathSeparator;
-#endif
-}
-
-// Returns the current working directory, or "" if unsuccessful.
-FilePath FilePath::GetCurrentDir() {
-#if GTEST_OS_WINDOWS_MOBILE
- // Windows CE doesn't have a current directory, so we just return
- // something reasonable.
- return FilePath(kCurrentDirectoryString);
-#elif GTEST_OS_WINDOWS
- char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
- return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
-#else
- char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
- return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
-#endif // GTEST_OS_WINDOWS_MOBILE
-}
-
-// Returns a copy of the FilePath with the case-insensitive extension removed.
-// Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
-// FilePath("dir/file"). If a case-insensitive extension is not
-// found, returns a copy of the original FilePath.
-FilePath FilePath::RemoveExtension(const char* extension) const {
- const std::string dot_extension = std::string(".") + extension;
- if (String::EndsWithCaseInsensitive(pathname_, dot_extension)) {
- return FilePath(pathname_.substr(
- 0, pathname_.length() - dot_extension.length()));
- }
- return *this;
-}
-
-// Returns a pointer to the last occurence of a valid path separator in
-// the FilePath. On Windows, for example, both '/' and '\' are valid path
-// separators. Returns NULL if no path separator was found.
-const char* FilePath::FindLastPathSeparator() const {
- const char* const last_sep = strrchr(c_str(), kPathSeparator);
-#if GTEST_HAS_ALT_PATH_SEP_
- const char* const last_alt_sep = strrchr(c_str(), kAlternatePathSeparator);
- // Comparing two pointers of which only one is NULL is undefined.
- if (last_alt_sep != NULL &&
- (last_sep == NULL || last_alt_sep > last_sep)) {
- return last_alt_sep;
- }
-#endif
- return last_sep;
-}
-
-// Returns a copy of the FilePath with the directory part removed.
-// Example: FilePath("path/to/file").RemoveDirectoryName() returns
-// FilePath("file"). If there is no directory part ("just_a_file"), it returns
-// the FilePath unmodified. If there is no file part ("just_a_dir/") it
-// returns an empty FilePath ("").
-// On Windows platform, '\' is the path separator, otherwise it is '/'.
-FilePath FilePath::RemoveDirectoryName() const {
- const char* const last_sep = FindLastPathSeparator();
- return last_sep ? FilePath(last_sep + 1) : *this;
-}
-
-// RemoveFileName returns the directory path with the filename removed.
-// Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
-// If the FilePath is "a_file" or "/a_file", RemoveFileName returns
-// FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
-// not have a file, like "just/a/dir/", it returns the FilePath unmodified.
-// On Windows platform, '\' is the path separator, otherwise it is '/'.
-FilePath FilePath::RemoveFileName() const {
- const char* const last_sep = FindLastPathSeparator();
- std::string dir;
- if (last_sep) {
- dir = std::string(c_str(), last_sep + 1 - c_str());
- } else {
- dir = kCurrentDirectoryString;
- }
- return FilePath(dir);
-}
-
-// Helper functions for naming files in a directory for xml output.
-
-// Given directory = "dir", base_name = "test", number = 0,
-// extension = "xml", returns "dir/test.xml". If number is greater
-// than zero (e.g., 12), returns "dir/test_12.xml".
-// On Windows platform, uses \ as the separator rather than /.
-FilePath FilePath::MakeFileName(const FilePath& directory,
- const FilePath& base_name,
- int number,
- const char* extension) {
- std::string file;
- if (number == 0) {
- file = base_name.string() + "." + extension;
- } else {
- file = base_name.string() + "_" + StreamableToString(number)
- + "." + extension;
- }
- return ConcatPaths(directory, FilePath(file));
-}
-
-// Given directory = "dir", relative_path = "test.xml", returns "dir/test.xml".
-// On Windows, uses \ as the separator rather than /.
-FilePath FilePath::ConcatPaths(const FilePath& directory,
- const FilePath& relative_path) {
- if (directory.IsEmpty())
- return relative_path;
- const FilePath dir(directory.RemoveTrailingPathSeparator());
- return FilePath(dir.string() + kPathSeparator + relative_path.string());
-}
-
-// Returns true if pathname describes something findable in the file-system,
-// either a file, directory, or whatever.
-bool FilePath::FileOrDirectoryExists() const {
-#if GTEST_OS_WINDOWS_MOBILE
- LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str());
- const DWORD attributes = GetFileAttributes(unicode);
- delete [] unicode;
- return attributes != kInvalidFileAttributes;
-#else
- posix::StatStruct file_stat;
- return posix::Stat(pathname_.c_str(), &file_stat) == 0;
-#endif // GTEST_OS_WINDOWS_MOBILE
-}
-
-// Returns true if pathname describes a directory in the file-system
-// that exists.
-bool FilePath::DirectoryExists() const {
- bool result = false;
-#if GTEST_OS_WINDOWS
- // Don't strip off trailing separator if path is a root directory on
- // Windows (like "C:\\").
- const FilePath& path(IsRootDirectory() ? *this :
- RemoveTrailingPathSeparator());
-#else
- const FilePath& path(*this);
-#endif
-
-#if GTEST_OS_WINDOWS_MOBILE
- LPCWSTR unicode = String::AnsiToUtf16(path.c_str());
- const DWORD attributes = GetFileAttributes(unicode);
- delete [] unicode;
- if ((attributes != kInvalidFileAttributes) &&
- (attributes & FILE_ATTRIBUTE_DIRECTORY)) {
- result = true;
- }
-#else
- posix::StatStruct file_stat;
- result = posix::Stat(path.c_str(), &file_stat) == 0 &&
- posix::IsDir(file_stat);
-#endif // GTEST_OS_WINDOWS_MOBILE
-
- return result;
-}
-
-// Returns true if pathname describes a root directory. (Windows has one
-// root directory per disk drive.)
-bool FilePath::IsRootDirectory() const {
-#if GTEST_OS_WINDOWS
- // TODO(wan@google.com): on Windows a network share like
- // \\server\share can be a root directory, although it cannot be the
- // current directory. Handle this properly.
- return pathname_.length() == 3 && IsAbsolutePath();
-#else
- return pathname_.length() == 1 && IsPathSeparator(pathname_.c_str()[0]);
-#endif
-}
-
-// Returns true if pathname describes an absolute path.
-bool FilePath::IsAbsolutePath() const {
- const char* const name = pathname_.c_str();
-#if GTEST_OS_WINDOWS
- return pathname_.length() >= 3 &&
- ((name[0] >= 'a' && name[0] <= 'z') ||
- (name[0] >= 'A' && name[0] <= 'Z')) &&
- name[1] == ':' &&
- IsPathSeparator(name[2]);
-#else
- return IsPathSeparator(name[0]);
-#endif
-}
-
-// Returns a pathname for a file that does not currently exist. The pathname
-// will be directory/base_name.extension or
-// directory/base_name_<number>.extension if directory/base_name.extension
-// already exists. The number will be incremented until a pathname is found
-// that does not already exist.
-// Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
-// There could be a race condition if two or more processes are calling this
-// function at the same time -- they could both pick the same filename.
-FilePath FilePath::GenerateUniqueFileName(const FilePath& directory,
- const FilePath& base_name,
- const char* extension) {
- FilePath full_pathname;
- int number = 0;
- do {
- full_pathname.Set(MakeFileName(directory, base_name, number++, extension));
- } while (full_pathname.FileOrDirectoryExists());
- return full_pathname;
-}
-
-// Returns true if FilePath ends with a path separator, which indicates that
-// it is intended to represent a directory. Returns false otherwise.
-// This does NOT check that a directory (or file) actually exists.
-bool FilePath::IsDirectory() const {
- return !pathname_.empty() &&
- IsPathSeparator(pathname_.c_str()[pathname_.length() - 1]);
-}
-
-// Create directories so that path exists. Returns true if successful or if
-// the directories already exist; returns false if unable to create directories
-// for any reason.
-bool FilePath::CreateDirectoriesRecursively() const {
- if (!this->IsDirectory()) {
- return false;
- }
-
- if (pathname_.length() == 0 || this->DirectoryExists()) {
- return true;
- }
-
- const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName());
- return parent.CreateDirectoriesRecursively() && this->CreateFolder();
-}
-
-// Create the directory so that path exists. Returns true if successful or
-// if the directory already exists; returns false if unable to create the
-// directory for any reason, including if the parent directory does not
-// exist. Not named "CreateDirectory" because that's a macro on Windows.
-bool FilePath::CreateFolder() const {
-#if GTEST_OS_WINDOWS_MOBILE
- FilePath removed_sep(this->RemoveTrailingPathSeparator());
- LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());
- int result = CreateDirectory(unicode, NULL) ? 0 : -1;
- delete [] unicode;
-#elif GTEST_OS_WINDOWS
- int result = _mkdir(pathname_.c_str());
-#else
- int result = mkdir(pathname_.c_str(), 0777);
-#endif // GTEST_OS_WINDOWS_MOBILE
-
- if (result == -1) {
- return this->DirectoryExists(); // An error is OK if the directory exists.
- }
- return true; // No error.
-}
-
-// If input name has a trailing separator character, remove it and return the
-// name, otherwise return the name string unmodified.
-// On Windows platform, uses \ as the separator, other platforms use /.
-FilePath FilePath::RemoveTrailingPathSeparator() const {
- return IsDirectory()
- ? FilePath(pathname_.substr(0, pathname_.length() - 1))
- : *this;
-}
-
-// Removes any redundant separators that might be in the pathname.
-// For example, "bar///foo" becomes "bar/foo". Does not eliminate other
-// redundancies that might be in a pathname involving "." or "..".
-// TODO(wan@google.com): handle Windows network shares (e.g. \\server\share).
-void FilePath::Normalize() {
- if (pathname_.c_str() == NULL) {
- pathname_ = "";
- return;
- }
- const char* src = pathname_.c_str();
- char* const dest = new char[pathname_.length() + 1];
- char* dest_ptr = dest;
- memset(dest_ptr, 0, pathname_.length() + 1);
-
- while (*src != '\0') {
- *dest_ptr = *src;
- if (!IsPathSeparator(*src)) {
- src++;
- } else {
-#if GTEST_HAS_ALT_PATH_SEP_
- if (*dest_ptr == kAlternatePathSeparator) {
- *dest_ptr = kPathSeparator;
- }
-#endif
- while (IsPathSeparator(*src))
- src++;
- }
- dest_ptr++;
- }
- *dest_ptr = '\0';
- pathname_ = dest;
- delete[] dest;
-}
-
-} // namespace internal
-} // namespace testing
diff --git a/third_party/ntcore_2017/gmock/gtest/src/gtest-internal-inl.h b/third_party/ntcore_2017/gmock/gtest/src/gtest-internal-inl.h
deleted file mode 100644
index 35df303..0000000
--- a/third_party/ntcore_2017/gmock/gtest/src/gtest-internal-inl.h
+++ /dev/null
@@ -1,1218 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Utility functions and classes used by the Google C++ testing framework.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// This file contains purely Google Test's internal implementation. Please
-// DO NOT #INCLUDE IT IN A USER PROGRAM.
-
-#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
-#define GTEST_SRC_GTEST_INTERNAL_INL_H_
-
-// GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is
-// part of Google Test's implementation; otherwise it's undefined.
-#if !GTEST_IMPLEMENTATION_
-// A user is trying to include this from his code - just say no.
-# error "gtest-internal-inl.h is part of Google Test's internal implementation."
-# error "It must not be included except by Google Test itself."
-#endif // GTEST_IMPLEMENTATION_
-
-#ifndef _WIN32_WCE
-# include <errno.h>
-#endif // !_WIN32_WCE
-#include <stddef.h>
-#include <stdlib.h> // For strtoll/_strtoul64/malloc/free.
-#include <string.h> // For memmove.
-
-#include <algorithm>
-#include <string>
-#include <vector>
-
-#include "gtest/internal/gtest-port.h"
-
-#if GTEST_CAN_STREAM_RESULTS_
-# include <arpa/inet.h> // NOLINT
-# include <netdb.h> // NOLINT
-#endif
-
-#if GTEST_OS_WINDOWS
-# include <windows.h> // NOLINT
-#endif // GTEST_OS_WINDOWS
-
-#include "gtest/gtest.h" // NOLINT
-#include "gtest/gtest-spi.h"
-
-namespace testing {
-
-// Declares the flags.
-//
-// We don't want the users to modify this flag in the code, but want
-// Google Test's own unit tests to be able to access it. Therefore we
-// declare it here as opposed to in gtest.h.
-GTEST_DECLARE_bool_(death_test_use_fork);
-
-namespace internal {
-
-// The value of GetTestTypeId() as seen from within the Google Test
-// library. This is solely for testing GetTestTypeId().
-GTEST_API_ extern const TypeId kTestTypeIdInGoogleTest;
-
-// Names of the flags (needed for parsing Google Test flags).
-const char kAlsoRunDisabledTestsFlag[] = "also_run_disabled_tests";
-const char kBreakOnFailureFlag[] = "break_on_failure";
-const char kCatchExceptionsFlag[] = "catch_exceptions";
-const char kColorFlag[] = "color";
-const char kFilterFlag[] = "filter";
-const char kListTestsFlag[] = "list_tests";
-const char kOutputFlag[] = "output";
-const char kPrintTimeFlag[] = "print_time";
-const char kRandomSeedFlag[] = "random_seed";
-const char kRepeatFlag[] = "repeat";
-const char kShuffleFlag[] = "shuffle";
-const char kStackTraceDepthFlag[] = "stack_trace_depth";
-const char kStreamResultToFlag[] = "stream_result_to";
-const char kThrowOnFailureFlag[] = "throw_on_failure";
-
-// A valid random seed must be in [1, kMaxRandomSeed].
-const int kMaxRandomSeed = 99999;
-
-// g_help_flag is true iff the --help flag or an equivalent form is
-// specified on the command line.
-GTEST_API_ extern bool g_help_flag;
-
-// Returns the current time in milliseconds.
-GTEST_API_ TimeInMillis GetTimeInMillis();
-
-// Returns true iff Google Test should use colors in the output.
-GTEST_API_ bool ShouldUseColor(bool stdout_is_tty);
-
-// Formats the given time in milliseconds as seconds.
-GTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms);
-
-// Converts the given time in milliseconds to a date string in the ISO 8601
-// format, without the timezone information. N.B.: due to the use the
-// non-reentrant localtime() function, this function is not thread safe. Do
-// not use it in any code that can be called from multiple threads.
-GTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms);
-
-// Parses a string for an Int32 flag, in the form of "--flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true. On failure, returns false without changing *value.
-GTEST_API_ bool ParseInt32Flag(
- const char* str, const char* flag, Int32* value);
-
-// Returns a random seed in range [1, kMaxRandomSeed] based on the
-// given --gtest_random_seed flag value.
-inline int GetRandomSeedFromFlag(Int32 random_seed_flag) {
- const unsigned int raw_seed = (random_seed_flag == 0) ?
- static_cast<unsigned int>(GetTimeInMillis()) :
- static_cast<unsigned int>(random_seed_flag);
-
- // Normalizes the actual seed to range [1, kMaxRandomSeed] such that
- // it's easy to type.
- const int normalized_seed =
- static_cast<int>((raw_seed - 1U) %
- static_cast<unsigned int>(kMaxRandomSeed)) + 1;
- return normalized_seed;
-}
-
-// Returns the first valid random seed after 'seed'. The behavior is
-// undefined if 'seed' is invalid. The seed after kMaxRandomSeed is
-// considered to be 1.
-inline int GetNextRandomSeed(int seed) {
- GTEST_CHECK_(1 <= seed && seed <= kMaxRandomSeed)
- << "Invalid random seed " << seed << " - must be in [1, "
- << kMaxRandomSeed << "].";
- const int next_seed = seed + 1;
- return (next_seed > kMaxRandomSeed) ? 1 : next_seed;
-}
-
-// This class saves the values of all Google Test flags in its c'tor, and
-// restores them in its d'tor.
-class GTestFlagSaver {
- public:
- // The c'tor.
- GTestFlagSaver() {
- also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests);
- break_on_failure_ = GTEST_FLAG(break_on_failure);
- catch_exceptions_ = GTEST_FLAG(catch_exceptions);
- color_ = GTEST_FLAG(color);
- death_test_style_ = GTEST_FLAG(death_test_style);
- death_test_use_fork_ = GTEST_FLAG(death_test_use_fork);
- filter_ = GTEST_FLAG(filter);
- internal_run_death_test_ = GTEST_FLAG(internal_run_death_test);
- list_tests_ = GTEST_FLAG(list_tests);
- output_ = GTEST_FLAG(output);
- print_time_ = GTEST_FLAG(print_time);
- random_seed_ = GTEST_FLAG(random_seed);
- repeat_ = GTEST_FLAG(repeat);
- shuffle_ = GTEST_FLAG(shuffle);
- stack_trace_depth_ = GTEST_FLAG(stack_trace_depth);
- stream_result_to_ = GTEST_FLAG(stream_result_to);
- throw_on_failure_ = GTEST_FLAG(throw_on_failure);
- }
-
- // The d'tor is not virtual. DO NOT INHERIT FROM THIS CLASS.
- ~GTestFlagSaver() {
- GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_;
- GTEST_FLAG(break_on_failure) = break_on_failure_;
- GTEST_FLAG(catch_exceptions) = catch_exceptions_;
- GTEST_FLAG(color) = color_;
- GTEST_FLAG(death_test_style) = death_test_style_;
- GTEST_FLAG(death_test_use_fork) = death_test_use_fork_;
- GTEST_FLAG(filter) = filter_;
- GTEST_FLAG(internal_run_death_test) = internal_run_death_test_;
- GTEST_FLAG(list_tests) = list_tests_;
- GTEST_FLAG(output) = output_;
- GTEST_FLAG(print_time) = print_time_;
- GTEST_FLAG(random_seed) = random_seed_;
- GTEST_FLAG(repeat) = repeat_;
- GTEST_FLAG(shuffle) = shuffle_;
- GTEST_FLAG(stack_trace_depth) = stack_trace_depth_;
- GTEST_FLAG(stream_result_to) = stream_result_to_;
- GTEST_FLAG(throw_on_failure) = throw_on_failure_;
- }
-
- private:
- // Fields for saving the original values of flags.
- bool also_run_disabled_tests_;
- bool break_on_failure_;
- bool catch_exceptions_;
- std::string color_;
- std::string death_test_style_;
- bool death_test_use_fork_;
- std::string filter_;
- std::string internal_run_death_test_;
- bool list_tests_;
- std::string output_;
- bool print_time_;
- internal::Int32 random_seed_;
- internal::Int32 repeat_;
- bool shuffle_;
- internal::Int32 stack_trace_depth_;
- std::string stream_result_to_;
- bool throw_on_failure_;
-} GTEST_ATTRIBUTE_UNUSED_;
-
-// Converts a Unicode code point to a narrow string in UTF-8 encoding.
-// code_point parameter is of type UInt32 because wchar_t may not be
-// wide enough to contain a code point.
-// If the code_point is not a valid Unicode code point
-// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted
-// to "(Invalid Unicode 0xXXXXXXXX)".
-GTEST_API_ std::string CodePointToUtf8(UInt32 code_point);
-
-// Converts a wide string to a narrow string in UTF-8 encoding.
-// The wide string is assumed to have the following encoding:
-// UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)
-// UTF-32 if sizeof(wchar_t) == 4 (on Linux)
-// Parameter str points to a null-terminated wide string.
-// Parameter num_chars may additionally limit the number
-// of wchar_t characters processed. -1 is used when the entire string
-// should be processed.
-// If the string contains code points that are not valid Unicode code points
-// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output
-// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
-// and contains invalid UTF-16 surrogate pairs, values in those pairs
-// will be encoded as individual Unicode characters from Basic Normal Plane.
-GTEST_API_ std::string WideStringToUtf8(const wchar_t* str, int num_chars);
-
-// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
-// if the variable is present. If a file already exists at this location, this
-// function will write over it. If the variable is present, but the file cannot
-// be created, prints an error and exits.
-void WriteToShardStatusFileIfNeeded();
-
-// Checks whether sharding is enabled by examining the relevant
-// environment variable values. If the variables are present,
-// but inconsistent (e.g., shard_index >= total_shards), prints
-// an error and exits. If in_subprocess_for_death_test, sharding is
-// disabled because it must only be applied to the original test
-// process. Otherwise, we could filter out death tests we intended to execute.
-GTEST_API_ bool ShouldShard(const char* total_shards_str,
- const char* shard_index_str,
- bool in_subprocess_for_death_test);
-
-// Parses the environment variable var as an Int32. If it is unset,
-// returns default_val. If it is not an Int32, prints an error and
-// and aborts.
-GTEST_API_ Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val);
-
-// Given the total number of shards, the shard index, and the test id,
-// returns true iff the test should be run on this shard. The test id is
-// some arbitrary but unique non-negative integer assigned to each test
-// method. Assumes that 0 <= shard_index < total_shards.
-GTEST_API_ bool ShouldRunTestOnShard(
- int total_shards, int shard_index, int test_id);
-
-// STL container utilities.
-
-// Returns the number of elements in the given container that satisfy
-// the given predicate.
-template <class Container, typename Predicate>
-inline int CountIf(const Container& c, Predicate predicate) {
- // Implemented as an explicit loop since std::count_if() in libCstd on
- // Solaris has a non-standard signature.
- int count = 0;
- for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) {
- if (predicate(*it))
- ++count;
- }
- return count;
-}
-
-// Applies a function/functor to each element in the container.
-template <class Container, typename Functor>
-void ForEach(const Container& c, Functor functor) {
- std::for_each(c.begin(), c.end(), functor);
-}
-
-// Returns the i-th element of the vector, or default_value if i is not
-// in range [0, v.size()).
-template <typename E>
-inline E GetElementOr(const std::vector<E>& v, int i, E default_value) {
- return (i < 0 || i >= static_cast<int>(v.size())) ? default_value : v[i];
-}
-
-// Performs an in-place shuffle of a range of the vector's elements.
-// 'begin' and 'end' are element indices as an STL-style range;
-// i.e. [begin, end) are shuffled, where 'end' == size() means to
-// shuffle to the end of the vector.
-template <typename E>
-void ShuffleRange(internal::Random* random, int begin, int end,
- std::vector<E>* v) {
- const int size = static_cast<int>(v->size());
- GTEST_CHECK_(0 <= begin && begin <= size)
- << "Invalid shuffle range start " << begin << ": must be in range [0, "
- << size << "].";
- GTEST_CHECK_(begin <= end && end <= size)
- << "Invalid shuffle range finish " << end << ": must be in range ["
- << begin << ", " << size << "].";
-
- // Fisher-Yates shuffle, from
- // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
- for (int range_width = end - begin; range_width >= 2; range_width--) {
- const int last_in_range = begin + range_width - 1;
- const int selected = begin + random->Generate(range_width);
- std::swap((*v)[selected], (*v)[last_in_range]);
- }
-}
-
-// Performs an in-place shuffle of the vector's elements.
-template <typename E>
-inline void Shuffle(internal::Random* random, std::vector<E>* v) {
- ShuffleRange(random, 0, static_cast<int>(v->size()), v);
-}
-
-// A function for deleting an object. Handy for being used as a
-// functor.
-template <typename T>
-static void Delete(T* x) {
- delete x;
-}
-
-// A predicate that checks the key of a TestProperty against a known key.
-//
-// TestPropertyKeyIs is copyable.
-class TestPropertyKeyIs {
- public:
- // Constructor.
- //
- // TestPropertyKeyIs has NO default constructor.
- explicit TestPropertyKeyIs(const std::string& key) : key_(key) {}
-
- // Returns true iff the test name of test property matches on key_.
- bool operator()(const TestProperty& test_property) const {
- return test_property.key() == key_;
- }
-
- private:
- std::string key_;
-};
-
-// Class UnitTestOptions.
-//
-// This class contains functions for processing options the user
-// specifies when running the tests. It has only static members.
-//
-// In most cases, the user can specify an option using either an
-// environment variable or a command line flag. E.g. you can set the
-// test filter using either GTEST_FILTER or --gtest_filter. If both
-// the variable and the flag are present, the latter overrides the
-// former.
-class GTEST_API_ UnitTestOptions {
- public:
- // Functions for processing the gtest_output flag.
-
- // Returns the output format, or "" for normal printed output.
- static std::string GetOutputFormat();
-
- // Returns the absolute path of the requested output file, or the
- // default (test_detail.xml in the original working directory) if
- // none was explicitly specified.
- static std::string GetAbsolutePathToOutputFile();
-
- // Functions for processing the gtest_filter flag.
-
- // Returns true iff the wildcard pattern matches the string. The
- // first ':' or '\0' character in pattern marks the end of it.
- //
- // This recursive algorithm isn't very efficient, but is clear and
- // works well enough for matching test names, which are short.
- static bool PatternMatchesString(const char *pattern, const char *str);
-
- // Returns true iff the user-specified filter matches the test case
- // name and the test name.
- static bool FilterMatchesTest(const std::string &test_case_name,
- const std::string &test_name);
-
-#if GTEST_OS_WINDOWS
- // Function for supporting the gtest_catch_exception flag.
-
- // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
- // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
- // This function is useful as an __except condition.
- static int GTestShouldProcessSEH(DWORD exception_code);
-#endif // GTEST_OS_WINDOWS
-
- // Returns true if "name" matches the ':' separated list of glob-style
- // filters in "filter".
- static bool MatchesFilter(const std::string& name, const char* filter);
-};
-
-// Returns the current application's name, removing directory path if that
-// is present. Used by UnitTestOptions::GetOutputFile.
-GTEST_API_ FilePath GetCurrentExecutableName();
-
-// The role interface for getting the OS stack trace as a string.
-class OsStackTraceGetterInterface {
- public:
- OsStackTraceGetterInterface() {}
- virtual ~OsStackTraceGetterInterface() {}
-
- // Returns the current OS stack trace as an std::string. Parameters:
- //
- // max_depth - the maximum number of stack frames to be included
- // in the trace.
- // skip_count - the number of top frames to be skipped; doesn't count
- // against max_depth.
- virtual string CurrentStackTrace(int max_depth, int skip_count) = 0;
-
- // UponLeavingGTest() should be called immediately before Google Test calls
- // user code. It saves some information about the current stack that
- // CurrentStackTrace() will use to find and hide Google Test stack frames.
- virtual void UponLeavingGTest() = 0;
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface);
-};
-
-// A working implementation of the OsStackTraceGetterInterface interface.
-class OsStackTraceGetter : public OsStackTraceGetterInterface {
- public:
- OsStackTraceGetter() : caller_frame_(NULL) {}
-
- virtual string CurrentStackTrace(int max_depth, int skip_count)
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- virtual void UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_);
-
- // This string is inserted in place of stack frames that are part of
- // Google Test's implementation.
- static const char* const kElidedFramesMarker;
-
- private:
- Mutex mutex_; // protects all internal state
-
- // We save the stack frame below the frame that calls user code.
- // We do this because the address of the frame immediately below
- // the user code changes between the call to UponLeavingGTest()
- // and any calls to CurrentStackTrace() from within the user code.
- void* caller_frame_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter);
-};
-
-// Information about a Google Test trace point.
-struct TraceInfo {
- const char* file;
- int line;
- std::string message;
-};
-
-// This is the default global test part result reporter used in UnitTestImpl.
-// This class should only be used by UnitTestImpl.
-class DefaultGlobalTestPartResultReporter
- : public TestPartResultReporterInterface {
- public:
- explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test);
- // Implements the TestPartResultReporterInterface. Reports the test part
- // result in the current test.
- virtual void ReportTestPartResult(const TestPartResult& result);
-
- private:
- UnitTestImpl* const unit_test_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter);
-};
-
-// This is the default per thread test part result reporter used in
-// UnitTestImpl. This class should only be used by UnitTestImpl.
-class DefaultPerThreadTestPartResultReporter
- : public TestPartResultReporterInterface {
- public:
- explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test);
- // Implements the TestPartResultReporterInterface. The implementation just
- // delegates to the current global test part result reporter of *unit_test_.
- virtual void ReportTestPartResult(const TestPartResult& result);
-
- private:
- UnitTestImpl* const unit_test_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter);
-};
-
-// The private implementation of the UnitTest class. We don't protect
-// the methods under a mutex, as this class is not accessible by a
-// user and the UnitTest class that delegates work to this class does
-// proper locking.
-class GTEST_API_ UnitTestImpl {
- public:
- explicit UnitTestImpl(UnitTest* parent);
- virtual ~UnitTestImpl();
-
- // There are two different ways to register your own TestPartResultReporter.
- // You can register your own repoter to listen either only for test results
- // from the current thread or for results from all threads.
- // By default, each per-thread test result repoter just passes a new
- // TestPartResult to the global test result reporter, which registers the
- // test part result for the currently running test.
-
- // Returns the global test part result reporter.
- TestPartResultReporterInterface* GetGlobalTestPartResultReporter();
-
- // Sets the global test part result reporter.
- void SetGlobalTestPartResultReporter(
- TestPartResultReporterInterface* reporter);
-
- // Returns the test part result reporter for the current thread.
- TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread();
-
- // Sets the test part result reporter for the current thread.
- void SetTestPartResultReporterForCurrentThread(
- TestPartResultReporterInterface* reporter);
-
- // Gets the number of successful test cases.
- int successful_test_case_count() const;
-
- // Gets the number of failed test cases.
- int failed_test_case_count() const;
-
- // Gets the number of all test cases.
- int total_test_case_count() const;
-
- // Gets the number of all test cases that contain at least one test
- // that should run.
- int test_case_to_run_count() const;
-
- // Gets the number of successful tests.
- int successful_test_count() const;
-
- // Gets the number of failed tests.
- int failed_test_count() const;
-
- // Gets the number of disabled tests that will be reported in the XML report.
- int reportable_disabled_test_count() const;
-
- // Gets the number of disabled tests.
- int disabled_test_count() const;
-
- // Gets the number of tests to be printed in the XML report.
- int reportable_test_count() const;
-
- // Gets the number of all tests.
- int total_test_count() const;
-
- // Gets the number of tests that should run.
- int test_to_run_count() const;
-
- // Gets the time of the test program start, in ms from the start of the
- // UNIX epoch.
- TimeInMillis start_timestamp() const { return start_timestamp_; }
-
- // Gets the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const { return elapsed_time_; }
-
- // Returns true iff the unit test passed (i.e. all test cases passed).
- bool Passed() const { return !Failed(); }
-
- // Returns true iff the unit test failed (i.e. some test case failed
- // or something outside of all tests failed).
- bool Failed() const {
- return failed_test_case_count() > 0 || ad_hoc_test_result()->Failed();
- }
-
- // Gets the i-th test case among all the test cases. i can range from 0 to
- // total_test_case_count() - 1. If i is not in that range, returns NULL.
- const TestCase* GetTestCase(int i) const {
- const int index = GetElementOr(test_case_indices_, i, -1);
- return index < 0 ? NULL : test_cases_[i];
- }
-
- // Gets the i-th test case among all the test cases. i can range from 0 to
- // total_test_case_count() - 1. If i is not in that range, returns NULL.
- TestCase* GetMutableTestCase(int i) {
- const int index = GetElementOr(test_case_indices_, i, -1);
- return index < 0 ? NULL : test_cases_[index];
- }
-
- // Provides access to the event listener list.
- TestEventListeners* listeners() { return &listeners_; }
-
- // Returns the TestResult for the test that's currently running, or
- // the TestResult for the ad hoc test if no test is running.
- TestResult* current_test_result();
-
- // Returns the TestResult for the ad hoc test.
- const TestResult* ad_hoc_test_result() const { return &ad_hoc_test_result_; }
-
- // Sets the OS stack trace getter.
- //
- // Does nothing if the input and the current OS stack trace getter
- // are the same; otherwise, deletes the old getter and makes the
- // input the current getter.
- void set_os_stack_trace_getter(OsStackTraceGetterInterface* getter);
-
- // Returns the current OS stack trace getter if it is not NULL;
- // otherwise, creates an OsStackTraceGetter, makes it the current
- // getter, and returns it.
- OsStackTraceGetterInterface* os_stack_trace_getter();
-
- // Returns the current OS stack trace as an std::string.
- //
- // The maximum number of stack frames to be included is specified by
- // the gtest_stack_trace_depth flag. The skip_count parameter
- // specifies the number of top frames to be skipped, which doesn't
- // count against the number of frames to be included.
- //
- // For example, if Foo() calls Bar(), which in turn calls
- // CurrentOsStackTraceExceptTop(1), Foo() will be included in the
- // trace but Bar() and CurrentOsStackTraceExceptTop() won't.
- std::string CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_;
-
- // Finds and returns a TestCase with the given name. If one doesn't
- // exist, creates one and returns it.
- //
- // Arguments:
- //
- // test_case_name: name of the test case
- // type_param: the name of the test's type parameter, or NULL if
- // this is not a typed or a type-parameterized test.
- // set_up_tc: pointer to the function that sets up the test case
- // tear_down_tc: pointer to the function that tears down the test case
- TestCase* GetTestCase(const char* test_case_name,
- const char* type_param,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc);
-
- // Adds a TestInfo to the unit test.
- //
- // Arguments:
- //
- // set_up_tc: pointer to the function that sets up the test case
- // tear_down_tc: pointer to the function that tears down the test case
- // test_info: the TestInfo object
- void AddTestInfo(Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc,
- TestInfo* test_info) {
- // In order to support thread-safe death tests, we need to
- // remember the original working directory when the test program
- // was first invoked. We cannot do this in RUN_ALL_TESTS(), as
- // the user may have changed the current directory before calling
- // RUN_ALL_TESTS(). Therefore we capture the current directory in
- // AddTestInfo(), which is called to register a TEST or TEST_F
- // before main() is reached.
- if (original_working_dir_.IsEmpty()) {
- original_working_dir_.Set(FilePath::GetCurrentDir());
- GTEST_CHECK_(!original_working_dir_.IsEmpty())
- << "Failed to get the current working directory.";
- }
-
- GetTestCase(test_info->test_case_name(),
- test_info->type_param(),
- set_up_tc,
- tear_down_tc)->AddTestInfo(test_info);
- }
-
-#if GTEST_HAS_PARAM_TEST
- // Returns ParameterizedTestCaseRegistry object used to keep track of
- // value-parameterized tests and instantiate and register them.
- internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {
- return parameterized_test_registry_;
- }
-#endif // GTEST_HAS_PARAM_TEST
-
- // Sets the TestCase object for the test that's currently running.
- void set_current_test_case(TestCase* a_current_test_case) {
- current_test_case_ = a_current_test_case;
- }
-
- // Sets the TestInfo object for the test that's currently running. If
- // current_test_info is NULL, the assertion results will be stored in
- // ad_hoc_test_result_.
- void set_current_test_info(TestInfo* a_current_test_info) {
- current_test_info_ = a_current_test_info;
- }
-
- // Registers all parameterized tests defined using TEST_P and
- // INSTANTIATE_TEST_CASE_P, creating regular tests for each test/parameter
- // combination. This method can be called more then once; it has guards
- // protecting from registering the tests more then once. If
- // value-parameterized tests are disabled, RegisterParameterizedTests is
- // present but does nothing.
- void RegisterParameterizedTests();
-
- // Runs all tests in this UnitTest object, prints the result, and
- // returns true if all tests are successful. If any exception is
- // thrown during a test, this test is considered to be failed, but
- // the rest of the tests will still be run.
- bool RunAllTests();
-
- // Clears the results of all tests, except the ad hoc tests.
- void ClearNonAdHocTestResult() {
- ForEach(test_cases_, TestCase::ClearTestCaseResult);
- }
-
- // Clears the results of ad-hoc test assertions.
- void ClearAdHocTestResult() {
- ad_hoc_test_result_.Clear();
- }
-
- // Adds a TestProperty to the current TestResult object when invoked in a
- // context of a test or a test case, or to the global property set. If the
- // result already contains a property with the same key, the value will be
- // updated.
- void RecordProperty(const TestProperty& test_property);
-
- enum ReactionToSharding {
- HONOR_SHARDING_PROTOCOL,
- IGNORE_SHARDING_PROTOCOL
- };
-
- // Matches the full name of each test against the user-specified
- // filter to decide whether the test should run, then records the
- // result in each TestCase and TestInfo object.
- // If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests
- // based on sharding variables in the environment.
- // Returns the number of tests that should run.
- int FilterTests(ReactionToSharding shard_tests);
-
- // Prints the names of the tests matching the user-specified filter flag.
- void ListTestsMatchingFilter();
-
- const TestCase* current_test_case() const { return current_test_case_; }
- TestInfo* current_test_info() { return current_test_info_; }
- const TestInfo* current_test_info() const { return current_test_info_; }
-
- // Returns the vector of environments that need to be set-up/torn-down
- // before/after the tests are run.
- std::vector<Environment*>& environments() { return environments_; }
-
- // Getters for the per-thread Google Test trace stack.
- std::vector<TraceInfo>& gtest_trace_stack() {
- return *(gtest_trace_stack_.pointer());
- }
- const std::vector<TraceInfo>& gtest_trace_stack() const {
- return gtest_trace_stack_.get();
- }
-
-#if GTEST_HAS_DEATH_TEST
- void InitDeathTestSubprocessControlInfo() {
- internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag());
- }
- // Returns a pointer to the parsed --gtest_internal_run_death_test
- // flag, or NULL if that flag was not specified.
- // This information is useful only in a death test child process.
- // Must not be called before a call to InitGoogleTest.
- const InternalRunDeathTestFlag* internal_run_death_test_flag() const {
- return internal_run_death_test_flag_.get();
- }
-
- // Returns a pointer to the current death test factory.
- internal::DeathTestFactory* death_test_factory() {
- return death_test_factory_.get();
- }
-
- void SuppressTestEventsIfInSubprocess();
-
- friend class ReplaceDeathTestFactory;
-#endif // GTEST_HAS_DEATH_TEST
-
- // Initializes the event listener performing XML output as specified by
- // UnitTestOptions. Must not be called before InitGoogleTest.
- void ConfigureXmlOutput();
-
-#if GTEST_CAN_STREAM_RESULTS_
- // Initializes the event listener for streaming test results to a socket.
- // Must not be called before InitGoogleTest.
- void ConfigureStreamingOutput();
-#endif
-
- // Performs initialization dependent upon flag values obtained in
- // ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to
- // ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest
- // this function is also called from RunAllTests. Since this function can be
- // called more than once, it has to be idempotent.
- void PostFlagParsingInit();
-
- // Gets the random seed used at the start of the current test iteration.
- int random_seed() const { return random_seed_; }
-
- // Gets the random number generator.
- internal::Random* random() { return &random_; }
-
- // Shuffles all test cases, and the tests within each test case,
- // making sure that death tests are still run first.
- void ShuffleTests();
-
- // Restores the test cases and tests to their order before the first shuffle.
- void UnshuffleTests();
-
- // Returns the value of GTEST_FLAG(catch_exceptions) at the moment
- // UnitTest::Run() starts.
- bool catch_exceptions() const { return catch_exceptions_; }
-
- private:
- friend class ::testing::UnitTest;
-
- // Used by UnitTest::Run() to capture the state of
- // GTEST_FLAG(catch_exceptions) at the moment it starts.
- void set_catch_exceptions(bool value) { catch_exceptions_ = value; }
-
- // The UnitTest object that owns this implementation object.
- UnitTest* const parent_;
-
- // The working directory when the first TEST() or TEST_F() was
- // executed.
- internal::FilePath original_working_dir_;
-
- // The default test part result reporters.
- DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_;
- DefaultPerThreadTestPartResultReporter
- default_per_thread_test_part_result_reporter_;
-
- // Points to (but doesn't own) the global test part result reporter.
- TestPartResultReporterInterface* global_test_part_result_repoter_;
-
- // Protects read and write access to global_test_part_result_reporter_.
- internal::Mutex global_test_part_result_reporter_mutex_;
-
- // Points to (but doesn't own) the per-thread test part result reporter.
- internal::ThreadLocal<TestPartResultReporterInterface*>
- per_thread_test_part_result_reporter_;
-
- // The vector of environments that need to be set-up/torn-down
- // before/after the tests are run.
- std::vector<Environment*> environments_;
-
- // The vector of TestCases in their original order. It owns the
- // elements in the vector.
- std::vector<TestCase*> test_cases_;
-
- // Provides a level of indirection for the test case list to allow
- // easy shuffling and restoring the test case order. The i-th
- // element of this vector is the index of the i-th test case in the
- // shuffled order.
- std::vector<int> test_case_indices_;
-
-#if GTEST_HAS_PARAM_TEST
- // ParameterizedTestRegistry object used to register value-parameterized
- // tests.
- internal::ParameterizedTestCaseRegistry parameterized_test_registry_;
-
- // Indicates whether RegisterParameterizedTests() has been called already.
- bool parameterized_tests_registered_;
-#endif // GTEST_HAS_PARAM_TEST
-
- // Index of the last death test case registered. Initially -1.
- int last_death_test_case_;
-
- // This points to the TestCase for the currently running test. It
- // changes as Google Test goes through one test case after another.
- // When no test is running, this is set to NULL and Google Test
- // stores assertion results in ad_hoc_test_result_. Initially NULL.
- TestCase* current_test_case_;
-
- // This points to the TestInfo for the currently running test. It
- // changes as Google Test goes through one test after another. When
- // no test is running, this is set to NULL and Google Test stores
- // assertion results in ad_hoc_test_result_. Initially NULL.
- TestInfo* current_test_info_;
-
- // Normally, a user only writes assertions inside a TEST or TEST_F,
- // or inside a function called by a TEST or TEST_F. Since Google
- // Test keeps track of which test is current running, it can
- // associate such an assertion with the test it belongs to.
- //
- // If an assertion is encountered when no TEST or TEST_F is running,
- // Google Test attributes the assertion result to an imaginary "ad hoc"
- // test, and records the result in ad_hoc_test_result_.
- TestResult ad_hoc_test_result_;
-
- // The list of event listeners that can be used to track events inside
- // Google Test.
- TestEventListeners listeners_;
-
- // The OS stack trace getter. Will be deleted when the UnitTest
- // object is destructed. By default, an OsStackTraceGetter is used,
- // but the user can set this field to use a custom getter if that is
- // desired.
- OsStackTraceGetterInterface* os_stack_trace_getter_;
-
- // True iff PostFlagParsingInit() has been called.
- bool post_flag_parse_init_performed_;
-
- // The random number seed used at the beginning of the test run.
- int random_seed_;
-
- // Our random number generator.
- internal::Random random_;
-
- // The time of the test program start, in ms from the start of the
- // UNIX epoch.
- TimeInMillis start_timestamp_;
-
- // How long the test took to run, in milliseconds.
- TimeInMillis elapsed_time_;
-
-#if GTEST_HAS_DEATH_TEST
- // The decomposed components of the gtest_internal_run_death_test flag,
- // parsed when RUN_ALL_TESTS is called.
- internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
- internal::scoped_ptr<internal::DeathTestFactory> death_test_factory_;
-#endif // GTEST_HAS_DEATH_TEST
-
- // A per-thread stack of traces created by the SCOPED_TRACE() macro.
- internal::ThreadLocal<std::vector<TraceInfo> > gtest_trace_stack_;
-
- // The value of GTEST_FLAG(catch_exceptions) at the moment RunAllTests()
- // starts.
- bool catch_exceptions_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl);
-}; // class UnitTestImpl
-
-// Convenience function for accessing the global UnitTest
-// implementation object.
-inline UnitTestImpl* GetUnitTestImpl() {
- return UnitTest::GetInstance()->impl();
-}
-
-#if GTEST_USES_SIMPLE_RE
-
-// Internal helper functions for implementing the simple regular
-// expression matcher.
-GTEST_API_ bool IsInSet(char ch, const char* str);
-GTEST_API_ bool IsAsciiDigit(char ch);
-GTEST_API_ bool IsAsciiPunct(char ch);
-GTEST_API_ bool IsRepeat(char ch);
-GTEST_API_ bool IsAsciiWhiteSpace(char ch);
-GTEST_API_ bool IsAsciiWordChar(char ch);
-GTEST_API_ bool IsValidEscape(char ch);
-GTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch);
-GTEST_API_ bool ValidateRegex(const char* regex);
-GTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str);
-GTEST_API_ bool MatchRepetitionAndRegexAtHead(
- bool escaped, char ch, char repeat, const char* regex, const char* str);
-GTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str);
-
-#endif // GTEST_USES_SIMPLE_RE
-
-// Parses the command line for Google Test flags, without initializing
-// other parts of Google Test.
-GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, char** argv);
-GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
-
-#if GTEST_HAS_DEATH_TEST
-
-// Returns the message describing the last system error, regardless of the
-// platform.
-GTEST_API_ std::string GetLastErrnoDescription();
-
-# if GTEST_OS_WINDOWS
-// Provides leak-safe Windows kernel handle ownership.
-class AutoHandle {
- public:
- AutoHandle() : handle_(INVALID_HANDLE_VALUE) {}
- explicit AutoHandle(HANDLE handle) : handle_(handle) {}
-
- ~AutoHandle() { Reset(); }
-
- HANDLE Get() const { return handle_; }
- void Reset() { Reset(INVALID_HANDLE_VALUE); }
- void Reset(HANDLE handle) {
- if (handle != handle_) {
- if (handle_ != INVALID_HANDLE_VALUE)
- ::CloseHandle(handle_);
- handle_ = handle;
- }
- }
-
- private:
- HANDLE handle_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
-};
-# endif // GTEST_OS_WINDOWS
-
-// Attempts to parse a string into a positive integer pointed to by the
-// number parameter. Returns true if that is possible.
-// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use
-// it here.
-template <typename Integer>
-bool ParseNaturalNumber(const ::std::string& str, Integer* number) {
- // Fail fast if the given string does not begin with a digit;
- // this bypasses strtoXXX's "optional leading whitespace and plus
- // or minus sign" semantics, which are undesirable here.
- if (str.empty() || !IsDigit(str[0])) {
- return false;
- }
- errno = 0;
-
- char* end;
- // BiggestConvertible is the largest integer type that system-provided
- // string-to-number conversion routines can return.
-
-# if GTEST_OS_WINDOWS && !defined(__GNUC__)
-
- // MSVC and C++ Builder define __int64 instead of the standard long long.
- typedef unsigned __int64 BiggestConvertible;
- const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10);
-
-# else
-
- typedef unsigned long long BiggestConvertible; // NOLINT
- const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10);
-
-# endif // GTEST_OS_WINDOWS && !defined(__GNUC__)
-
- const bool parse_success = *end == '\0' && errno == 0;
-
- // TODO(vladl@google.com): Convert this to compile time assertion when it is
- // available.
- GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed));
-
- const Integer result = static_cast<Integer>(parsed);
- if (parse_success && static_cast<BiggestConvertible>(result) == parsed) {
- *number = result;
- return true;
- }
- return false;
-}
-#endif // GTEST_HAS_DEATH_TEST
-
-// TestResult contains some private methods that should be hidden from
-// Google Test user but are required for testing. This class allow our tests
-// to access them.
-//
-// This class is supplied only for the purpose of testing Google Test's own
-// constructs. Do not use it in user tests, either directly or indirectly.
-class TestResultAccessor {
- public:
- static void RecordProperty(TestResult* test_result,
- const std::string& xml_element,
- const TestProperty& property) {
- test_result->RecordProperty(xml_element, property);
- }
-
- static void ClearTestPartResults(TestResult* test_result) {
- test_result->ClearTestPartResults();
- }
-
- static const std::vector<testing::TestPartResult>& test_part_results(
- const TestResult& test_result) {
- return test_result.test_part_results();
- }
-};
-
-#if GTEST_CAN_STREAM_RESULTS_
-
-// Streams test results to the given port on the given host machine.
-class StreamingListener : public EmptyTestEventListener {
- public:
- // Abstract base class for writing strings to a socket.
- class AbstractSocketWriter {
- public:
- virtual ~AbstractSocketWriter() {}
-
- // Sends a string to the socket.
- virtual void Send(const string& message) = 0;
-
- // Closes the socket.
- virtual void CloseConnection() {}
-
- // Sends a string and a newline to the socket.
- void SendLn(const string& message) {
- Send(message + "\n");
- }
- };
-
- // Concrete class for actually writing strings to a socket.
- class SocketWriter : public AbstractSocketWriter {
- public:
- SocketWriter(const string& host, const string& port)
- : sockfd_(-1), host_name_(host), port_num_(port) {
- MakeConnection();
- }
-
- virtual ~SocketWriter() {
- if (sockfd_ != -1)
- CloseConnection();
- }
-
- // Sends a string to the socket.
- virtual void Send(const string& message) {
- GTEST_CHECK_(sockfd_ != -1)
- << "Send() can be called only when there is a connection.";
-
- const int len = static_cast<int>(message.length());
- if (write(sockfd_, message.c_str(), len) != len) {
- GTEST_LOG_(WARNING)
- << "stream_result_to: failed to stream to "
- << host_name_ << ":" << port_num_;
- }
- }
-
- private:
- // Creates a client socket and connects to the server.
- void MakeConnection();
-
- // Closes the socket.
- void CloseConnection() {
- GTEST_CHECK_(sockfd_ != -1)
- << "CloseConnection() can be called only when there is a connection.";
-
- close(sockfd_);
- sockfd_ = -1;
- }
-
- int sockfd_; // socket file descriptor
- const string host_name_;
- const string port_num_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter);
- }; // class SocketWriter
-
- // Escapes '=', '&', '%', and '\n' characters in str as "%xx".
- static string UrlEncode(const char* str);
-
- StreamingListener(const string& host, const string& port)
- : socket_writer_(new SocketWriter(host, port)) { Start(); }
-
- explicit StreamingListener(AbstractSocketWriter* socket_writer)
- : socket_writer_(socket_writer) { Start(); }
-
- void OnTestProgramStart(const UnitTest& /* unit_test */) {
- SendLn("event=TestProgramStart");
- }
-
- void OnTestProgramEnd(const UnitTest& unit_test) {
- // Note that Google Test current only report elapsed time for each
- // test iteration, not for the entire test program.
- SendLn("event=TestProgramEnd&passed=" + FormatBool(unit_test.Passed()));
-
- // Notify the streaming server to stop.
- socket_writer_->CloseConnection();
- }
-
- void OnTestIterationStart(const UnitTest& /* unit_test */, int iteration) {
- SendLn("event=TestIterationStart&iteration=" +
- StreamableToString(iteration));
- }
-
- void OnTestIterationEnd(const UnitTest& unit_test, int /* iteration */) {
- SendLn("event=TestIterationEnd&passed=" +
- FormatBool(unit_test.Passed()) + "&elapsed_time=" +
- StreamableToString(unit_test.elapsed_time()) + "ms");
- }
-
- void OnTestCaseStart(const TestCase& test_case) {
- SendLn(std::string("event=TestCaseStart&name=") + test_case.name());
- }
-
- void OnTestCaseEnd(const TestCase& test_case) {
- SendLn("event=TestCaseEnd&passed=" + FormatBool(test_case.Passed())
- + "&elapsed_time=" + StreamableToString(test_case.elapsed_time())
- + "ms");
- }
-
- void OnTestStart(const TestInfo& test_info) {
- SendLn(std::string("event=TestStart&name=") + test_info.name());
- }
-
- void OnTestEnd(const TestInfo& test_info) {
- SendLn("event=TestEnd&passed=" +
- FormatBool((test_info.result())->Passed()) +
- "&elapsed_time=" +
- StreamableToString((test_info.result())->elapsed_time()) + "ms");
- }
-
- void OnTestPartResult(const TestPartResult& test_part_result) {
- const char* file_name = test_part_result.file_name();
- if (file_name == NULL)
- file_name = "";
- SendLn("event=TestPartResult&file=" + UrlEncode(file_name) +
- "&line=" + StreamableToString(test_part_result.line_number()) +
- "&message=" + UrlEncode(test_part_result.message()));
- }
-
- private:
- // Sends the given message and a newline to the socket.
- void SendLn(const string& message) { socket_writer_->SendLn(message); }
-
- // Called at the start of streaming to notify the receiver what
- // protocol we are using.
- void Start() { SendLn("gtest_streaming_protocol_version=1.0"); }
-
- string FormatBool(bool value) { return value ? "1" : "0"; }
-
- const scoped_ptr<AbstractSocketWriter> socket_writer_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamingListener);
-}; // class StreamingListener
-
-#endif // GTEST_CAN_STREAM_RESULTS_
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_SRC_GTEST_INTERNAL_INL_H_
diff --git a/third_party/ntcore_2017/gmock/gtest/src/gtest-port.cc b/third_party/ntcore_2017/gmock/gtest/src/gtest-port.cc
deleted file mode 100644
index 0c4df5f..0000000
--- a/third_party/ntcore_2017/gmock/gtest/src/gtest-port.cc
+++ /dev/null
@@ -1,805 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#include "gtest/internal/gtest-port.h"
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#if GTEST_OS_WINDOWS_MOBILE
-# include <windows.h> // For TerminateProcess()
-#elif GTEST_OS_WINDOWS
-# include <io.h>
-# include <sys/stat.h>
-#else
-# include <unistd.h>
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-#if GTEST_OS_MAC
-# include <mach/mach_init.h>
-# include <mach/task.h>
-# include <mach/vm_map.h>
-#endif // GTEST_OS_MAC
-
-#if GTEST_OS_QNX
-# include <devctl.h>
-# include <sys/procfs.h>
-#endif // GTEST_OS_QNX
-
-#include "gtest/gtest-spi.h"
-#include "gtest/gtest-message.h"
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-string.h"
-
-// Indicates that this translation unit is part of Google Test's
-// implementation. It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error. This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION_
-
-namespace testing {
-namespace internal {
-
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
-const int kStdOutFileno = 1;
-const int kStdErrFileno = 2;
-#else
-const int kStdOutFileno = STDOUT_FILENO;
-const int kStdErrFileno = STDERR_FILENO;
-#endif // _MSC_VER
-
-#if GTEST_OS_MAC
-
-// Returns the number of threads running in the process, or 0 to indicate that
-// we cannot detect it.
-size_t GetThreadCount() {
- const task_t task = mach_task_self();
- mach_msg_type_number_t thread_count;
- thread_act_array_t thread_list;
- const kern_return_t status = task_threads(task, &thread_list, &thread_count);
- if (status == KERN_SUCCESS) {
- // task_threads allocates resources in thread_list and we need to free them
- // to avoid leaks.
- vm_deallocate(task,
- reinterpret_cast<vm_address_t>(thread_list),
- sizeof(thread_t) * thread_count);
- return static_cast<size_t>(thread_count);
- } else {
- return 0;
- }
-}
-
-#elif GTEST_OS_QNX
-
-// Returns the number of threads running in the process, or 0 to indicate that
-// we cannot detect it.
-size_t GetThreadCount() {
- const int fd = open("/proc/self/as", O_RDONLY);
- if (fd < 0) {
- return 0;
- }
- procfs_info process_info;
- const int status =
- devctl(fd, DCMD_PROC_INFO, &process_info, sizeof(process_info), NULL);
- close(fd);
- if (status == EOK) {
- return static_cast<size_t>(process_info.num_threads);
- } else {
- return 0;
- }
-}
-
-#else
-
-size_t GetThreadCount() {
- // There's no portable way to detect the number of threads, so we just
- // return 0 to indicate that we cannot detect it.
- return 0;
-}
-
-#endif // GTEST_OS_MAC
-
-#if GTEST_USES_POSIX_RE
-
-// Implements RE. Currently only needed for death tests.
-
-RE::~RE() {
- if (is_valid_) {
- // regfree'ing an invalid regex might crash because the content
- // of the regex is undefined. Since the regex's are essentially
- // the same, one cannot be valid (or invalid) without the other
- // being so too.
- regfree(&partial_regex_);
- regfree(&full_regex_);
- }
- free(const_cast<char*>(pattern_));
-}
-
-// Returns true iff regular expression re matches the entire str.
-bool RE::FullMatch(const char* str, const RE& re) {
- if (!re.is_valid_) return false;
-
- regmatch_t match;
- return regexec(&re.full_regex_, str, 1, &match, 0) == 0;
-}
-
-// Returns true iff regular expression re matches a substring of str
-// (including str itself).
-bool RE::PartialMatch(const char* str, const RE& re) {
- if (!re.is_valid_) return false;
-
- regmatch_t match;
- return regexec(&re.partial_regex_, str, 1, &match, 0) == 0;
-}
-
-// Initializes an RE from its string representation.
-void RE::Init(const char* regex) {
- pattern_ = posix::StrDup(regex);
-
- // Reserves enough bytes to hold the regular expression used for a
- // full match.
- const size_t full_regex_len = strlen(regex) + 10;
- char* const full_pattern = new char[full_regex_len];
-
- snprintf(full_pattern, full_regex_len, "^(%s)$", regex);
- is_valid_ = regcomp(&full_regex_, full_pattern, REG_EXTENDED) == 0;
- // We want to call regcomp(&partial_regex_, ...) even if the
- // previous expression returns false. Otherwise partial_regex_ may
- // not be properly initialized can may cause trouble when it's
- // freed.
- //
- // Some implementation of POSIX regex (e.g. on at least some
- // versions of Cygwin) doesn't accept the empty string as a valid
- // regex. We change it to an equivalent form "()" to be safe.
- if (is_valid_) {
- const char* const partial_regex = (*regex == '\0') ? "()" : regex;
- is_valid_ = regcomp(&partial_regex_, partial_regex, REG_EXTENDED) == 0;
- }
- EXPECT_TRUE(is_valid_)
- << "Regular expression \"" << regex
- << "\" is not a valid POSIX Extended regular expression.";
-
- delete[] full_pattern;
-}
-
-#elif GTEST_USES_SIMPLE_RE
-
-// Returns true iff ch appears anywhere in str (excluding the
-// terminating '\0' character).
-bool IsInSet(char ch, const char* str) {
- return ch != '\0' && strchr(str, ch) != NULL;
-}
-
-// Returns true iff ch belongs to the given classification. Unlike
-// similar functions in <ctype.h>, these aren't affected by the
-// current locale.
-bool IsAsciiDigit(char ch) { return '0' <= ch && ch <= '9'; }
-bool IsAsciiPunct(char ch) {
- return IsInSet(ch, "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~");
-}
-bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); }
-bool IsAsciiWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); }
-bool IsAsciiWordChar(char ch) {
- return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||
- ('0' <= ch && ch <= '9') || ch == '_';
-}
-
-// Returns true iff "\\c" is a supported escape sequence.
-bool IsValidEscape(char c) {
- return (IsAsciiPunct(c) || IsInSet(c, "dDfnrsStvwW"));
-}
-
-// Returns true iff the given atom (specified by escaped and pattern)
-// matches ch. The result is undefined if the atom is invalid.
-bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
- if (escaped) { // "\\p" where p is pattern_char.
- switch (pattern_char) {
- case 'd': return IsAsciiDigit(ch);
- case 'D': return !IsAsciiDigit(ch);
- case 'f': return ch == '\f';
- case 'n': return ch == '\n';
- case 'r': return ch == '\r';
- case 's': return IsAsciiWhiteSpace(ch);
- case 'S': return !IsAsciiWhiteSpace(ch);
- case 't': return ch == '\t';
- case 'v': return ch == '\v';
- case 'w': return IsAsciiWordChar(ch);
- case 'W': return !IsAsciiWordChar(ch);
- }
- return IsAsciiPunct(pattern_char) && pattern_char == ch;
- }
-
- return (pattern_char == '.' && ch != '\n') || pattern_char == ch;
-}
-
-// Helper function used by ValidateRegex() to format error messages.
-std::string FormatRegexSyntaxError(const char* regex, int index) {
- return (Message() << "Syntax error at index " << index
- << " in simple regular expression \"" << regex << "\": ").GetString();
-}
-
-// Generates non-fatal failures and returns false if regex is invalid;
-// otherwise returns true.
-bool ValidateRegex(const char* regex) {
- if (regex == NULL) {
- // TODO(wan@google.com): fix the source file location in the
- // assertion failures to match where the regex is used in user
- // code.
- ADD_FAILURE() << "NULL is not a valid simple regular expression.";
- return false;
- }
-
- bool is_valid = true;
-
- // True iff ?, *, or + can follow the previous atom.
- bool prev_repeatable = false;
- for (int i = 0; regex[i]; i++) {
- if (regex[i] == '\\') { // An escape sequence
- i++;
- if (regex[i] == '\0') {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
- << "'\\' cannot appear at the end.";
- return false;
- }
-
- if (!IsValidEscape(regex[i])) {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
- << "invalid escape sequence \"\\" << regex[i] << "\".";
- is_valid = false;
- }
- prev_repeatable = true;
- } else { // Not an escape sequence.
- const char ch = regex[i];
-
- if (ch == '^' && i > 0) {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
- << "'^' can only appear at the beginning.";
- is_valid = false;
- } else if (ch == '$' && regex[i + 1] != '\0') {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
- << "'$' can only appear at the end.";
- is_valid = false;
- } else if (IsInSet(ch, "()[]{}|")) {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
- << "'" << ch << "' is unsupported.";
- is_valid = false;
- } else if (IsRepeat(ch) && !prev_repeatable) {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
- << "'" << ch << "' can only follow a repeatable token.";
- is_valid = false;
- }
-
- prev_repeatable = !IsInSet(ch, "^$?*+");
- }
- }
-
- return is_valid;
-}
-
-// Matches a repeated regex atom followed by a valid simple regular
-// expression. The regex atom is defined as c if escaped is false,
-// or \c otherwise. repeat is the repetition meta character (?, *,
-// or +). The behavior is undefined if str contains too many
-// characters to be indexable by size_t, in which case the test will
-// probably time out anyway. We are fine with this limitation as
-// std::string has it too.
-bool MatchRepetitionAndRegexAtHead(
- bool escaped, char c, char repeat, const char* regex,
- const char* str) {
- const size_t min_count = (repeat == '+') ? 1 : 0;
- const size_t max_count = (repeat == '?') ? 1 :
- static_cast<size_t>(-1) - 1;
- // We cannot call numeric_limits::max() as it conflicts with the
- // max() macro on Windows.
-
- for (size_t i = 0; i <= max_count; ++i) {
- // We know that the atom matches each of the first i characters in str.
- if (i >= min_count && MatchRegexAtHead(regex, str + i)) {
- // We have enough matches at the head, and the tail matches too.
- // Since we only care about *whether* the pattern matches str
- // (as opposed to *how* it matches), there is no need to find a
- // greedy match.
- return true;
- }
- if (str[i] == '\0' || !AtomMatchesChar(escaped, c, str[i]))
- return false;
- }
- return false;
-}
-
-// Returns true iff regex matches a prefix of str. regex must be a
-// valid simple regular expression and not start with "^", or the
-// result is undefined.
-bool MatchRegexAtHead(const char* regex, const char* str) {
- if (*regex == '\0') // An empty regex matches a prefix of anything.
- return true;
-
- // "$" only matches the end of a string. Note that regex being
- // valid guarantees that there's nothing after "$" in it.
- if (*regex == '$')
- return *str == '\0';
-
- // Is the first thing in regex an escape sequence?
- const bool escaped = *regex == '\\';
- if (escaped)
- ++regex;
- if (IsRepeat(regex[1])) {
- // MatchRepetitionAndRegexAtHead() calls MatchRegexAtHead(), so
- // here's an indirect recursion. It terminates as the regex gets
- // shorter in each recursion.
- return MatchRepetitionAndRegexAtHead(
- escaped, regex[0], regex[1], regex + 2, str);
- } else {
- // regex isn't empty, isn't "$", and doesn't start with a
- // repetition. We match the first atom of regex with the first
- // character of str and recurse.
- return (*str != '\0') && AtomMatchesChar(escaped, *regex, *str) &&
- MatchRegexAtHead(regex + 1, str + 1);
- }
-}
-
-// Returns true iff regex matches any substring of str. regex must be
-// a valid simple regular expression, or the result is undefined.
-//
-// The algorithm is recursive, but the recursion depth doesn't exceed
-// the regex length, so we won't need to worry about running out of
-// stack space normally. In rare cases the time complexity can be
-// exponential with respect to the regex length + the string length,
-// but usually it's must faster (often close to linear).
-bool MatchRegexAnywhere(const char* regex, const char* str) {
- if (regex == NULL || str == NULL)
- return false;
-
- if (*regex == '^')
- return MatchRegexAtHead(regex + 1, str);
-
- // A successful match can be anywhere in str.
- do {
- if (MatchRegexAtHead(regex, str))
- return true;
- } while (*str++ != '\0');
- return false;
-}
-
-// Implements the RE class.
-
-RE::~RE() {
- free(const_cast<char*>(pattern_));
- free(const_cast<char*>(full_pattern_));
-}
-
-// Returns true iff regular expression re matches the entire str.
-bool RE::FullMatch(const char* str, const RE& re) {
- return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_, str);
-}
-
-// Returns true iff regular expression re matches a substring of str
-// (including str itself).
-bool RE::PartialMatch(const char* str, const RE& re) {
- return re.is_valid_ && MatchRegexAnywhere(re.pattern_, str);
-}
-
-// Initializes an RE from its string representation.
-void RE::Init(const char* regex) {
- pattern_ = full_pattern_ = NULL;
- if (regex != NULL) {
- pattern_ = posix::StrDup(regex);
- }
-
- is_valid_ = ValidateRegex(regex);
- if (!is_valid_) {
- // No need to calculate the full pattern when the regex is invalid.
- return;
- }
-
- const size_t len = strlen(regex);
- // Reserves enough bytes to hold the regular expression used for a
- // full match: we need space to prepend a '^', append a '$', and
- // terminate the string with '\0'.
- char* buffer = static_cast<char*>(malloc(len + 3));
- full_pattern_ = buffer;
-
- if (*regex != '^')
- *buffer++ = '^'; // Makes sure full_pattern_ starts with '^'.
-
- // We don't use snprintf or strncpy, as they trigger a warning when
- // compiled with VC++ 8.0.
- memcpy(buffer, regex, len);
- buffer += len;
-
- if (len == 0 || regex[len - 1] != '$')
- *buffer++ = '$'; // Makes sure full_pattern_ ends with '$'.
-
- *buffer = '\0';
-}
-
-#endif // GTEST_USES_POSIX_RE
-
-const char kUnknownFile[] = "unknown file";
-
-// Formats a source file path and a line number as they would appear
-// in an error message from the compiler used to compile this code.
-GTEST_API_ ::std::string FormatFileLocation(const char* file, int line) {
- const std::string file_name(file == NULL ? kUnknownFile : file);
-
- if (line < 0) {
- return file_name + ":";
- }
-#ifdef _MSC_VER
- return file_name + "(" + StreamableToString(line) + "):";
-#else
- return file_name + ":" + StreamableToString(line) + ":";
-#endif // _MSC_VER
-}
-
-// Formats a file location for compiler-independent XML output.
-// Although this function is not platform dependent, we put it next to
-// FormatFileLocation in order to contrast the two functions.
-// Note that FormatCompilerIndependentFileLocation() does NOT append colon
-// to the file location it produces, unlike FormatFileLocation().
-GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(
- const char* file, int line) {
- const std::string file_name(file == NULL ? kUnknownFile : file);
-
- if (line < 0)
- return file_name;
- else
- return file_name + ":" + StreamableToString(line);
-}
-
-
-GTestLog::GTestLog(GTestLogSeverity severity, const char* file, int line)
- : severity_(severity) {
- const char* const marker =
- severity == GTEST_INFO ? "[ INFO ]" :
- severity == GTEST_WARNING ? "[WARNING]" :
- severity == GTEST_ERROR ? "[ ERROR ]" : "[ FATAL ]";
- GetStream() << ::std::endl << marker << " "
- << FormatFileLocation(file, line).c_str() << ": ";
-}
-
-// Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
-GTestLog::~GTestLog() {
- GetStream() << ::std::endl;
- if (severity_ == GTEST_FATAL) {
- fflush(stderr);
- posix::Abort();
- }
-}
-// Disable Microsoft deprecation warnings for POSIX functions called from
-// this class (creat, dup, dup2, and close)
-#ifdef _MSC_VER
-# pragma warning(push)
-# pragma warning(disable: 4996)
-#endif // _MSC_VER
-
-#if GTEST_HAS_STREAM_REDIRECTION
-
-// Object that captures an output stream (stdout/stderr).
-class CapturedStream {
- public:
- // The ctor redirects the stream to a temporary file.
- explicit CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
-# if GTEST_OS_WINDOWS
- char temp_dir_path[MAX_PATH + 1] = { '\0' }; // NOLINT
- char temp_file_path[MAX_PATH + 1] = { '\0' }; // NOLINT
-
- ::GetTempPathA(sizeof(temp_dir_path), temp_dir_path);
- const UINT success = ::GetTempFileNameA(temp_dir_path,
- "gtest_redir",
- 0, // Generate unique file name.
- temp_file_path);
- GTEST_CHECK_(success != 0)
- << "Unable to create a temporary file in " << temp_dir_path;
- const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE);
- GTEST_CHECK_(captured_fd != -1) << "Unable to open temporary file "
- << temp_file_path;
- filename_ = temp_file_path;
-# else
- // There's no guarantee that a test has write access to the current
- // directory, so we create the temporary file in the /tmp directory
- // instead. We use /tmp on most systems, and /sdcard on Android.
- // That's because Android doesn't have /tmp.
-# if GTEST_OS_LINUX_ANDROID
- // Note: Android applications are expected to call the framework's
- // Context.getExternalStorageDirectory() method through JNI to get
- // the location of the world-writable SD Card directory. However,
- // this requires a Context handle, which cannot be retrieved
- // globally from native code. Doing so also precludes running the
- // code as part of a regular standalone executable, which doesn't
- // run in a Dalvik process (e.g. when running it through 'adb shell').
- //
- // The location /sdcard is directly accessible from native code
- // and is the only location (unofficially) supported by the Android
- // team. It's generally a symlink to the real SD Card mount point
- // which can be /mnt/sdcard, /mnt/sdcard0, /system/media/sdcard, or
- // other OEM-customized locations. Never rely on these, and always
- // use /sdcard.
- char name_template[] = "/sdcard/gtest_captured_stream.XXXXXX";
-# else
- char name_template[] = "/tmp/captured_stream.XXXXXX";
-# endif // GTEST_OS_LINUX_ANDROID
- const int captured_fd = mkstemp(name_template);
- filename_ = name_template;
-# endif // GTEST_OS_WINDOWS
- fflush(NULL);
- dup2(captured_fd, fd_);
- close(captured_fd);
- }
-
- ~CapturedStream() {
- remove(filename_.c_str());
- }
-
- std::string GetCapturedString() {
- if (uncaptured_fd_ != -1) {
- // Restores the original stream.
- fflush(NULL);
- dup2(uncaptured_fd_, fd_);
- close(uncaptured_fd_);
- uncaptured_fd_ = -1;
- }
-
- FILE* const file = posix::FOpen(filename_.c_str(), "r");
- const std::string content = ReadEntireFile(file);
- posix::FClose(file);
- return content;
- }
-
- private:
- // Reads the entire content of a file as an std::string.
- static std::string ReadEntireFile(FILE* file);
-
- // Returns the size (in bytes) of a file.
- static size_t GetFileSize(FILE* file);
-
- const int fd_; // A stream to capture.
- int uncaptured_fd_;
- // Name of the temporary file holding the stderr output.
- ::std::string filename_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream);
-};
-
-// Returns the size (in bytes) of a file.
-size_t CapturedStream::GetFileSize(FILE* file) {
- fseek(file, 0, SEEK_END);
- return static_cast<size_t>(ftell(file));
-}
-
-// Reads the entire content of a file as a string.
-std::string CapturedStream::ReadEntireFile(FILE* file) {
- const size_t file_size = GetFileSize(file);
- char* const buffer = new char[file_size];
-
- size_t bytes_last_read = 0; // # of bytes read in the last fread()
- size_t bytes_read = 0; // # of bytes read so far
-
- fseek(file, 0, SEEK_SET);
-
- // Keeps reading the file until we cannot read further or the
- // pre-determined file size is reached.
- do {
- bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file);
- bytes_read += bytes_last_read;
- } while (bytes_last_read > 0 && bytes_read < file_size);
-
- const std::string content(buffer, bytes_read);
- delete[] buffer;
-
- return content;
-}
-
-# ifdef _MSC_VER
-# pragma warning(pop)
-# endif // _MSC_VER
-
-static CapturedStream* g_captured_stderr = NULL;
-static CapturedStream* g_captured_stdout = NULL;
-
-// Starts capturing an output stream (stdout/stderr).
-void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
- if (*stream != NULL) {
- GTEST_LOG_(FATAL) << "Only one " << stream_name
- << " capturer can exist at a time.";
- }
- *stream = new CapturedStream(fd);
-}
-
-// Stops capturing the output stream and returns the captured string.
-std::string GetCapturedStream(CapturedStream** captured_stream) {
- const std::string content = (*captured_stream)->GetCapturedString();
-
- delete *captured_stream;
- *captured_stream = NULL;
-
- return content;
-}
-
-// Starts capturing stdout.
-void CaptureStdout() {
- CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout);
-}
-
-// Starts capturing stderr.
-void CaptureStderr() {
- CaptureStream(kStdErrFileno, "stderr", &g_captured_stderr);
-}
-
-// Stops capturing stdout and returns the captured string.
-std::string GetCapturedStdout() {
- return GetCapturedStream(&g_captured_stdout);
-}
-
-// Stops capturing stderr and returns the captured string.
-std::string GetCapturedStderr() {
- return GetCapturedStream(&g_captured_stderr);
-}
-
-#endif // GTEST_HAS_STREAM_REDIRECTION
-
-#if GTEST_HAS_DEATH_TEST
-
-// A copy of all command line arguments. Set by InitGoogleTest().
-::std::vector<testing::internal::string> g_argvs;
-
-static const ::std::vector<testing::internal::string>* g_injected_test_argvs =
- NULL; // Owned.
-
-void SetInjectableArgvs(const ::std::vector<testing::internal::string>* argvs) {
- if (g_injected_test_argvs != argvs)
- delete g_injected_test_argvs;
- g_injected_test_argvs = argvs;
-}
-
-const ::std::vector<testing::internal::string>& GetInjectableArgvs() {
- if (g_injected_test_argvs != NULL) {
- return *g_injected_test_argvs;
- }
- return g_argvs;
-}
-#endif // GTEST_HAS_DEATH_TEST
-
-#if GTEST_OS_WINDOWS_MOBILE
-namespace posix {
-void Abort() {
- DebugBreak();
- TerminateProcess(GetCurrentProcess(), 1);
-}
-} // namespace posix
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-// Returns the name of the environment variable corresponding to the
-// given flag. For example, FlagToEnvVar("foo") will return
-// "GTEST_FOO" in the open-source version.
-static std::string FlagToEnvVar(const char* flag) {
- const std::string full_flag =
- (Message() << GTEST_FLAG_PREFIX_ << flag).GetString();
-
- Message env_var;
- for (size_t i = 0; i != full_flag.length(); i++) {
- env_var << ToUpper(full_flag.c_str()[i]);
- }
-
- return env_var.GetString();
-}
-
-// Parses 'str' for a 32-bit signed integer. If successful, writes
-// the result to *value and returns true; otherwise leaves *value
-// unchanged and returns false.
-bool ParseInt32(const Message& src_text, const char* str, Int32* value) {
- // Parses the environment variable as a decimal integer.
- char* end = NULL;
- const long long_value = strtol(str, &end, 10); // NOLINT
-
- // Has strtol() consumed all characters in the string?
- if (*end != '\0') {
- // No - an invalid character was encountered.
- Message msg;
- msg << "WARNING: " << src_text
- << " is expected to be a 32-bit integer, but actually"
- << " has value \"" << str << "\".\n";
- printf("%s", msg.GetString().c_str());
- fflush(stdout);
- return false;
- }
-
- // Is the parsed value in the range of an Int32?
- const Int32 result = static_cast<Int32>(long_value);
- if (long_value == LONG_MAX || long_value == LONG_MIN ||
- // The parsed value overflows as a long. (strtol() returns
- // LONG_MAX or LONG_MIN when the input overflows.)
- result != long_value
- // The parsed value overflows as an Int32.
- ) {
- Message msg;
- msg << "WARNING: " << src_text
- << " is expected to be a 32-bit integer, but actually"
- << " has value " << str << ", which overflows.\n";
- printf("%s", msg.GetString().c_str());
- fflush(stdout);
- return false;
- }
-
- *value = result;
- return true;
-}
-
-// Reads and returns the Boolean environment variable corresponding to
-// the given flag; if it's not set, returns default_value.
-//
-// The value is considered true iff it's not "0".
-bool BoolFromGTestEnv(const char* flag, bool default_value) {
- const std::string env_var = FlagToEnvVar(flag);
- const char* const string_value = posix::GetEnv(env_var.c_str());
- return string_value == NULL ?
- default_value : strcmp(string_value, "0") != 0;
-}
-
-// Reads and returns a 32-bit integer stored in the environment
-// variable corresponding to the given flag; if it isn't set or
-// doesn't represent a valid 32-bit integer, returns default_value.
-Int32 Int32FromGTestEnv(const char* flag, Int32 default_value) {
- const std::string env_var = FlagToEnvVar(flag);
- const char* const string_value = posix::GetEnv(env_var.c_str());
- if (string_value == NULL) {
- // The environment variable is not set.
- return default_value;
- }
-
- Int32 result = default_value;
- if (!ParseInt32(Message() << "Environment variable " << env_var,
- string_value, &result)) {
- printf("The default value %s is used.\n",
- (Message() << default_value).GetString().c_str());
- fflush(stdout);
- return default_value;
- }
-
- return result;
-}
-
-// Reads and returns the string environment variable corresponding to
-// the given flag; if it's not set, returns default_value.
-const char* StringFromGTestEnv(const char* flag, const char* default_value) {
- const std::string env_var = FlagToEnvVar(flag);
- const char* const value = posix::GetEnv(env_var.c_str());
- return value == NULL ? default_value : value;
-}
-
-} // namespace internal
-} // namespace testing
diff --git a/third_party/ntcore_2017/gmock/gtest/src/gtest-printers.cc b/third_party/ntcore_2017/gmock/gtest/src/gtest-printers.cc
deleted file mode 100644
index 75fa408..0000000
--- a/third_party/ntcore_2017/gmock/gtest/src/gtest-printers.cc
+++ /dev/null
@@ -1,363 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Test - The Google C++ Testing Framework
-//
-// This file implements a universal value printer that can print a
-// value of any type T:
-//
-// void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
-//
-// It uses the << operator when possible, and prints the bytes in the
-// object otherwise. A user can override its behavior for a class
-// type Foo by defining either operator<<(::std::ostream&, const Foo&)
-// or void PrintTo(const Foo&, ::std::ostream*) in the namespace that
-// defines Foo.
-
-#include "gtest/gtest-printers.h"
-#include <ctype.h>
-#include <stdio.h>
-#include <ostream> // NOLINT
-#include <string>
-#include "gtest/internal/gtest-port.h"
-
-namespace testing {
-
-namespace {
-
-using ::std::ostream;
-
-// Prints a segment of bytes in the given object.
-void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start,
- size_t count, ostream* os) {
- char text[5] = "";
- for (size_t i = 0; i != count; i++) {
- const size_t j = start + i;
- if (i != 0) {
- // Organizes the bytes into groups of 2 for easy parsing by
- // human.
- if ((j % 2) == 0)
- *os << ' ';
- else
- *os << '-';
- }
- GTEST_SNPRINTF_(text, sizeof(text), "%02X", obj_bytes[j]);
- *os << text;
- }
-}
-
-// Prints the bytes in the given value to the given ostream.
-void PrintBytesInObjectToImpl(const unsigned char* obj_bytes, size_t count,
- ostream* os) {
- // Tells the user how big the object is.
- *os << count << "-byte object <";
-
- const size_t kThreshold = 132;
- const size_t kChunkSize = 64;
- // If the object size is bigger than kThreshold, we'll have to omit
- // some details by printing only the first and the last kChunkSize
- // bytes.
- // TODO(wan): let the user control the threshold using a flag.
- if (count < kThreshold) {
- PrintByteSegmentInObjectTo(obj_bytes, 0, count, os);
- } else {
- PrintByteSegmentInObjectTo(obj_bytes, 0, kChunkSize, os);
- *os << " ... ";
- // Rounds up to 2-byte boundary.
- const size_t resume_pos = (count - kChunkSize + 1)/2*2;
- PrintByteSegmentInObjectTo(obj_bytes, resume_pos, count - resume_pos, os);
- }
- *os << ">";
-}
-
-} // namespace
-
-namespace internal2 {
-
-// Delegates to PrintBytesInObjectToImpl() to print the bytes in the
-// given object. The delegation simplifies the implementation, which
-// uses the << operator and thus is easier done outside of the
-// ::testing::internal namespace, which contains a << operator that
-// sometimes conflicts with the one in STL.
-void PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count,
- ostream* os) {
- PrintBytesInObjectToImpl(obj_bytes, count, os);
-}
-
-} // namespace internal2
-
-namespace internal {
-
-// Depending on the value of a char (or wchar_t), we print it in one
-// of three formats:
-// - as is if it's a printable ASCII (e.g. 'a', '2', ' '),
-// - as a hexidecimal escape sequence (e.g. '\x7F'), or
-// - as a special escape sequence (e.g. '\r', '\n').
-enum CharFormat {
- kAsIs,
- kHexEscape,
- kSpecialEscape
-};
-
-// Returns true if c is a printable ASCII character. We test the
-// value of c directly instead of calling isprint(), which is buggy on
-// Windows Mobile.
-inline bool IsPrintableAscii(wchar_t c) {
- return 0x20 <= c && c <= 0x7E;
-}
-
-// Prints a wide or narrow char c as a character literal without the
-// quotes, escaping it when necessary; returns how c was formatted.
-// The template argument UnsignedChar is the unsigned version of Char,
-// which is the type of c.
-template <typename UnsignedChar, typename Char>
-static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {
- switch (static_cast<wchar_t>(c)) {
- case L'\0':
- *os << "\\0";
- break;
- case L'\'':
- *os << "\\'";
- break;
- case L'\\':
- *os << "\\\\";
- break;
- case L'\a':
- *os << "\\a";
- break;
- case L'\b':
- *os << "\\b";
- break;
- case L'\f':
- *os << "\\f";
- break;
- case L'\n':
- *os << "\\n";
- break;
- case L'\r':
- *os << "\\r";
- break;
- case L'\t':
- *os << "\\t";
- break;
- case L'\v':
- *os << "\\v";
- break;
- default:
- if (IsPrintableAscii(c)) {
- *os << static_cast<char>(c);
- return kAsIs;
- } else {
- *os << "\\x" + String::FormatHexInt(static_cast<UnsignedChar>(c));
- return kHexEscape;
- }
- }
- return kSpecialEscape;
-}
-
-// Prints a wchar_t c as if it's part of a string literal, escaping it when
-// necessary; returns how c was formatted.
-static CharFormat PrintAsStringLiteralTo(wchar_t c, ostream* os) {
- switch (c) {
- case L'\'':
- *os << "'";
- return kAsIs;
- case L'"':
- *os << "\\\"";
- return kSpecialEscape;
- default:
- return PrintAsCharLiteralTo<wchar_t>(c, os);
- }
-}
-
-// Prints a char c as if it's part of a string literal, escaping it when
-// necessary; returns how c was formatted.
-static CharFormat PrintAsStringLiteralTo(char c, ostream* os) {
- return PrintAsStringLiteralTo(
- static_cast<wchar_t>(static_cast<unsigned char>(c)), os);
-}
-
-// Prints a wide or narrow character c and its code. '\0' is printed
-// as "'\\0'", other unprintable characters are also properly escaped
-// using the standard C++ escape sequence. The template argument
-// UnsignedChar is the unsigned version of Char, which is the type of c.
-template <typename UnsignedChar, typename Char>
-void PrintCharAndCodeTo(Char c, ostream* os) {
- // First, print c as a literal in the most readable form we can find.
- *os << ((sizeof(c) > 1) ? "L'" : "'");
- const CharFormat format = PrintAsCharLiteralTo<UnsignedChar>(c, os);
- *os << "'";
-
- // To aid user debugging, we also print c's code in decimal, unless
- // it's 0 (in which case c was printed as '\\0', making the code
- // obvious).
- if (c == 0)
- return;
- *os << " (" << static_cast<int>(c);
-
- // For more convenience, we print c's code again in hexidecimal,
- // unless c was already printed in the form '\x##' or the code is in
- // [1, 9].
- if (format == kHexEscape || (1 <= c && c <= 9)) {
- // Do nothing.
- } else {
- *os << ", 0x" << String::FormatHexInt(static_cast<UnsignedChar>(c));
- }
- *os << ")";
-}
-
-void PrintTo(unsigned char c, ::std::ostream* os) {
- PrintCharAndCodeTo<unsigned char>(c, os);
-}
-void PrintTo(signed char c, ::std::ostream* os) {
- PrintCharAndCodeTo<unsigned char>(c, os);
-}
-
-// Prints a wchar_t as a symbol if it is printable or as its internal
-// code otherwise and also as its code. L'\0' is printed as "L'\\0'".
-void PrintTo(wchar_t wc, ostream* os) {
- PrintCharAndCodeTo<wchar_t>(wc, os);
-}
-
-// Prints the given array of characters to the ostream. CharType must be either
-// char or wchar_t.
-// The array starts at begin, the length is len, it may include '\0' characters
-// and may not be NUL-terminated.
-template <typename CharType>
-static void PrintCharsAsStringTo(
- const CharType* begin, size_t len, ostream* os) {
- const char* const kQuoteBegin = sizeof(CharType) == 1 ? "\"" : "L\"";
- *os << kQuoteBegin;
- bool is_previous_hex = false;
- for (size_t index = 0; index < len; ++index) {
- const CharType cur = begin[index];
- if (is_previous_hex && IsXDigit(cur)) {
- // Previous character is of '\x..' form and this character can be
- // interpreted as another hexadecimal digit in its number. Break string to
- // disambiguate.
- *os << "\" " << kQuoteBegin;
- }
- is_previous_hex = PrintAsStringLiteralTo(cur, os) == kHexEscape;
- }
- *os << "\"";
-}
-
-// Prints a (const) char/wchar_t array of 'len' elements, starting at address
-// 'begin'. CharType must be either char or wchar_t.
-template <typename CharType>
-static void UniversalPrintCharArray(
- const CharType* begin, size_t len, ostream* os) {
- // The code
- // const char kFoo[] = "foo";
- // generates an array of 4, not 3, elements, with the last one being '\0'.
- //
- // Therefore when printing a char array, we don't print the last element if
- // it's '\0', such that the output matches the string literal as it's
- // written in the source code.
- if (len > 0 && begin[len - 1] == '\0') {
- PrintCharsAsStringTo(begin, len - 1, os);
- return;
- }
-
- // If, however, the last element in the array is not '\0', e.g.
- // const char kFoo[] = { 'f', 'o', 'o' };
- // we must print the entire array. We also print a message to indicate
- // that the array is not NUL-terminated.
- PrintCharsAsStringTo(begin, len, os);
- *os << " (no terminating NUL)";
-}
-
-// Prints a (const) char array of 'len' elements, starting at address 'begin'.
-void UniversalPrintArray(const char* begin, size_t len, ostream* os) {
- UniversalPrintCharArray(begin, len, os);
-}
-
-// Prints a (const) wchar_t array of 'len' elements, starting at address
-// 'begin'.
-void UniversalPrintArray(const wchar_t* begin, size_t len, ostream* os) {
- UniversalPrintCharArray(begin, len, os);
-}
-
-// Prints the given C string to the ostream.
-void PrintTo(const char* s, ostream* os) {
- if (s == NULL) {
- *os << "NULL";
- } else {
- *os << ImplicitCast_<const void*>(s) << " pointing to ";
- PrintCharsAsStringTo(s, strlen(s), os);
- }
-}
-
-// MSVC compiler can be configured to define whar_t as a typedef
-// of unsigned short. Defining an overload for const wchar_t* in that case
-// would cause pointers to unsigned shorts be printed as wide strings,
-// possibly accessing more memory than intended and causing invalid
-// memory accesses. MSVC defines _NATIVE_WCHAR_T_DEFINED symbol when
-// wchar_t is implemented as a native type.
-#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
-// Prints the given wide C string to the ostream.
-void PrintTo(const wchar_t* s, ostream* os) {
- if (s == NULL) {
- *os << "NULL";
- } else {
- *os << ImplicitCast_<const void*>(s) << " pointing to ";
- PrintCharsAsStringTo(s, wcslen(s), os);
- }
-}
-#endif // wchar_t is native
-
-// Prints a ::string object.
-#if GTEST_HAS_GLOBAL_STRING
-void PrintStringTo(const ::string& s, ostream* os) {
- PrintCharsAsStringTo(s.data(), s.size(), os);
-}
-#endif // GTEST_HAS_GLOBAL_STRING
-
-void PrintStringTo(const ::std::string& s, ostream* os) {
- PrintCharsAsStringTo(s.data(), s.size(), os);
-}
-
-// Prints a ::wstring object.
-#if GTEST_HAS_GLOBAL_WSTRING
-void PrintWideStringTo(const ::wstring& s, ostream* os) {
- PrintCharsAsStringTo(s.data(), s.size(), os);
-}
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-#if GTEST_HAS_STD_WSTRING
-void PrintWideStringTo(const ::std::wstring& s, ostream* os) {
- PrintCharsAsStringTo(s.data(), s.size(), os);
-}
-#endif // GTEST_HAS_STD_WSTRING
-
-} // namespace internal
-
-} // namespace testing
diff --git a/third_party/ntcore_2017/gmock/gtest/src/gtest-test-part.cc b/third_party/ntcore_2017/gmock/gtest/src/gtest-test-part.cc
deleted file mode 100644
index c60eef3..0000000
--- a/third_party/ntcore_2017/gmock/gtest/src/gtest-test-part.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: mheule@google.com (Markus Heule)
-//
-// The Google C++ Testing Framework (Google Test)
-
-#include "gtest/gtest-test-part.h"
-
-// Indicates that this translation unit is part of Google Test's
-// implementation. It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error. This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION_
-
-namespace testing {
-
-using internal::GetUnitTestImpl;
-
-// Gets the summary of the failure message by omitting the stack trace
-// in it.
-std::string TestPartResult::ExtractSummary(const char* message) {
- const char* const stack_trace = strstr(message, internal::kStackTraceMarker);
- return stack_trace == NULL ? message :
- std::string(message, stack_trace);
-}
-
-// Prints a TestPartResult object.
-std::ostream& operator<<(std::ostream& os, const TestPartResult& result) {
- return os
- << result.file_name() << ":" << result.line_number() << ": "
- << (result.type() == TestPartResult::kSuccess ? "Success" :
- result.type() == TestPartResult::kFatalFailure ? "Fatal failure" :
- "Non-fatal failure") << ":\n"
- << result.message() << std::endl;
-}
-
-// Appends a TestPartResult to the array.
-void TestPartResultArray::Append(const TestPartResult& result) {
- array_.push_back(result);
-}
-
-// Returns the TestPartResult at the given index (0-based).
-const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const {
- if (index < 0 || index >= size()) {
- printf("\nInvalid index (%d) into TestPartResultArray.\n", index);
- internal::posix::Abort();
- }
-
- return array_[index];
-}
-
-// Returns the number of TestPartResult objects in the array.
-int TestPartResultArray::size() const {
- return static_cast<int>(array_.size());
-}
-
-namespace internal {
-
-HasNewFatalFailureHelper::HasNewFatalFailureHelper()
- : has_new_fatal_failure_(false),
- original_reporter_(GetUnitTestImpl()->
- GetTestPartResultReporterForCurrentThread()) {
- GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(this);
-}
-
-HasNewFatalFailureHelper::~HasNewFatalFailureHelper() {
- GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(
- original_reporter_);
-}
-
-void HasNewFatalFailureHelper::ReportTestPartResult(
- const TestPartResult& result) {
- if (result.fatally_failed())
- has_new_fatal_failure_ = true;
- original_reporter_->ReportTestPartResult(result);
-}
-
-} // namespace internal
-
-} // namespace testing
diff --git a/third_party/ntcore_2017/gmock/gtest/src/gtest-typed-test.cc b/third_party/ntcore_2017/gmock/gtest/src/gtest-typed-test.cc
deleted file mode 100644
index f0079f4..0000000
--- a/third_party/ntcore_2017/gmock/gtest/src/gtest-typed-test.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#include "gtest/gtest-typed-test.h"
-#include "gtest/gtest.h"
-
-namespace testing {
-namespace internal {
-
-#if GTEST_HAS_TYPED_TEST_P
-
-// Skips to the first non-space char in str. Returns an empty string if str
-// contains only whitespace characters.
-static const char* SkipSpaces(const char* str) {
- while (IsSpace(*str))
- str++;
- return str;
-}
-
-// Verifies that registered_tests match the test names in
-// defined_test_names_; returns registered_tests if successful, or
-// aborts the program otherwise.
-const char* TypedTestCasePState::VerifyRegisteredTestNames(
- const char* file, int line, const char* registered_tests) {
- typedef ::std::set<const char*>::const_iterator DefinedTestIter;
- registered_ = true;
-
- // Skip initial whitespace in registered_tests since some
- // preprocessors prefix stringizied literals with whitespace.
- registered_tests = SkipSpaces(registered_tests);
-
- Message errors;
- ::std::set<std::string> tests;
- for (const char* names = registered_tests; names != NULL;
- names = SkipComma(names)) {
- const std::string name = GetPrefixUntilComma(names);
- if (tests.count(name) != 0) {
- errors << "Test " << name << " is listed more than once.\n";
- continue;
- }
-
- bool found = false;
- for (DefinedTestIter it = defined_test_names_.begin();
- it != defined_test_names_.end();
- ++it) {
- if (name == *it) {
- found = true;
- break;
- }
- }
-
- if (found) {
- tests.insert(name);
- } else {
- errors << "No test named " << name
- << " can be found in this test case.\n";
- }
- }
-
- for (DefinedTestIter it = defined_test_names_.begin();
- it != defined_test_names_.end();
- ++it) {
- if (tests.count(*it) == 0) {
- errors << "You forgot to list test " << *it << ".\n";
- }
- }
-
- const std::string& errors_str = errors.GetString();
- if (errors_str != "") {
- fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
- errors_str.c_str());
- fflush(stderr);
- posix::Abort();
- }
-
- return registered_tests;
-}
-
-#endif // GTEST_HAS_TYPED_TEST_P
-
-} // namespace internal
-} // namespace testing
diff --git a/third_party/ntcore_2017/gmock/gtest/src/gtest.cc b/third_party/ntcore_2017/gmock/gtest/src/gtest.cc
deleted file mode 100644
index 6de53dd..0000000
--- a/third_party/ntcore_2017/gmock/gtest/src/gtest.cc
+++ /dev/null
@@ -1,5015 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-
-#include "gtest/gtest.h"
-#include "gtest/gtest-spi.h"
-
-#include <ctype.h>
-#include <math.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include <algorithm>
-#include <iomanip>
-#include <limits>
-#include <ostream> // NOLINT
-#include <sstream>
-#include <vector>
-
-#if GTEST_OS_LINUX
-
-// TODO(kenton@google.com): Use autoconf to detect availability of
-// gettimeofday().
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-
-# include <fcntl.h> // NOLINT
-# include <limits.h> // NOLINT
-# include <sched.h> // NOLINT
-// Declares vsnprintf(). This header is not available on Windows.
-# include <strings.h> // NOLINT
-# include <sys/mman.h> // NOLINT
-# include <sys/time.h> // NOLINT
-# include <unistd.h> // NOLINT
-# include <string>
-
-#elif GTEST_OS_SYMBIAN
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-# include <sys/time.h> // NOLINT
-
-#elif GTEST_OS_ZOS
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-# include <sys/time.h> // NOLINT
-
-// On z/OS we additionally need strings.h for strcasecmp.
-# include <strings.h> // NOLINT
-
-#elif GTEST_OS_WINDOWS_MOBILE // We are on Windows CE.
-
-# include <windows.h> // NOLINT
-
-#elif GTEST_OS_WINDOWS // We are on Windows proper.
-
-# include <io.h> // NOLINT
-# include <sys/timeb.h> // NOLINT
-# include <sys/types.h> // NOLINT
-# include <sys/stat.h> // NOLINT
-
-# if GTEST_OS_WINDOWS_MINGW
-// MinGW has gettimeofday() but not _ftime64().
-// TODO(kenton@google.com): Use autoconf to detect availability of
-// gettimeofday().
-// TODO(kenton@google.com): There are other ways to get the time on
-// Windows, like GetTickCount() or GetSystemTimeAsFileTime(). MinGW
-// supports these. consider using them instead.
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-# include <sys/time.h> // NOLINT
-# endif // GTEST_OS_WINDOWS_MINGW
-
-// cpplint thinks that the header is already included, so we want to
-// silence it.
-# include <windows.h> // NOLINT
-
-#else
-
-// Assume other platforms have gettimeofday().
-// TODO(kenton@google.com): Use autoconf to detect availability of
-// gettimeofday().
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-
-// cpplint thinks that the header is already included, so we want to
-// silence it.
-# include <sys/time.h> // NOLINT
-# include <unistd.h> // NOLINT
-
-#endif // GTEST_OS_LINUX
-
-#if GTEST_HAS_EXCEPTIONS
-# include <stdexcept>
-#endif
-
-#if GTEST_CAN_STREAM_RESULTS_
-# include <arpa/inet.h> // NOLINT
-# include <netdb.h> // NOLINT
-#endif
-
-// Indicates that this translation unit is part of Google Test's
-// implementation. It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error. This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION_
-
-#if GTEST_OS_WINDOWS
-# define vsnprintf _vsnprintf
-#endif // GTEST_OS_WINDOWS
-
-namespace testing {
-
-using internal::CountIf;
-using internal::ForEach;
-using internal::GetElementOr;
-using internal::Shuffle;
-
-// Constants.
-
-// A test whose test case name or test name matches this filter is
-// disabled and not run.
-static const char kDisableTestFilter[] = "DISABLED_*:*/DISABLED_*";
-
-// A test case whose name matches this filter is considered a death
-// test case and will be run before test cases whose name doesn't
-// match this filter.
-static const char kDeathTestCaseFilter[] = "*DeathTest:*DeathTest/*";
-
-// A test filter that matches everything.
-static const char kUniversalFilter[] = "*";
-
-// The default output file for XML output.
-static const char kDefaultOutputFile[] = "test_detail.xml";
-
-// The environment variable name for the test shard index.
-static const char kTestShardIndex[] = "GTEST_SHARD_INDEX";
-// The environment variable name for the total number of test shards.
-static const char kTestTotalShards[] = "GTEST_TOTAL_SHARDS";
-// The environment variable name for the test shard status file.
-static const char kTestShardStatusFile[] = "GTEST_SHARD_STATUS_FILE";
-
-namespace internal {
-
-// The text used in failure messages to indicate the start of the
-// stack trace.
-const char kStackTraceMarker[] = "\nStack trace:\n";
-
-// g_help_flag is true iff the --help flag or an equivalent form is
-// specified on the command line.
-bool g_help_flag = false;
-
-} // namespace internal
-
-static const char* GetDefaultFilter() {
- return kUniversalFilter;
-}
-
-GTEST_DEFINE_bool_(
- also_run_disabled_tests,
- internal::BoolFromGTestEnv("also_run_disabled_tests", false),
- "Run disabled tests too, in addition to the tests normally being run.");
-
-GTEST_DEFINE_bool_(
- break_on_failure,
- internal::BoolFromGTestEnv("break_on_failure", false),
- "True iff a failed assertion should be a debugger break-point.");
-
-GTEST_DEFINE_bool_(
- catch_exceptions,
- internal::BoolFromGTestEnv("catch_exceptions", true),
- "True iff " GTEST_NAME_
- " should catch exceptions and treat them as test failures.");
-
-GTEST_DEFINE_string_(
- color,
- internal::StringFromGTestEnv("color", "auto"),
- "Whether to use colors in the output. Valid values: yes, no, "
- "and auto. 'auto' means to use colors if the output is "
- "being sent to a terminal and the TERM environment variable "
- "is set to a terminal type that supports colors.");
-
-GTEST_DEFINE_string_(
- filter,
- internal::StringFromGTestEnv("filter", GetDefaultFilter()),
- "A colon-separated list of glob (not regex) patterns "
- "for filtering the tests to run, optionally followed by a "
- "'-' and a : separated list of negative patterns (tests to "
- "exclude). A test is run if it matches one of the positive "
- "patterns and does not match any of the negative patterns.");
-
-GTEST_DEFINE_bool_(list_tests, false,
- "List all tests without running them.");
-
-GTEST_DEFINE_string_(
- output,
- internal::StringFromGTestEnv("output", ""),
- "A format (currently must be \"xml\"), optionally followed "
- "by a colon and an output file name or directory. A directory "
- "is indicated by a trailing pathname separator. "
- "Examples: \"xml:filename.xml\", \"xml::directoryname/\". "
- "If a directory is specified, output files will be created "
- "within that directory, with file-names based on the test "
- "executable's name and, if necessary, made unique by adding "
- "digits.");
-
-GTEST_DEFINE_bool_(
- print_time,
- internal::BoolFromGTestEnv("print_time", true),
- "True iff " GTEST_NAME_
- " should display elapsed time in text output.");
-
-GTEST_DEFINE_int32_(
- random_seed,
- internal::Int32FromGTestEnv("random_seed", 0),
- "Random number seed to use when shuffling test orders. Must be in range "
- "[1, 99999], or 0 to use a seed based on the current time.");
-
-GTEST_DEFINE_int32_(
- repeat,
- internal::Int32FromGTestEnv("repeat", 1),
- "How many times to repeat each test. Specify a negative number "
- "for repeating forever. Useful for shaking out flaky tests.");
-
-GTEST_DEFINE_bool_(
- show_internal_stack_frames, false,
- "True iff " GTEST_NAME_ " should include internal stack frames when "
- "printing test failure stack traces.");
-
-GTEST_DEFINE_bool_(
- shuffle,
- internal::BoolFromGTestEnv("shuffle", false),
- "True iff " GTEST_NAME_
- " should randomize tests' order on every run.");
-
-GTEST_DEFINE_int32_(
- stack_trace_depth,
- internal::Int32FromGTestEnv("stack_trace_depth", kMaxStackTraceDepth),
- "The maximum number of stack frames to print when an "
- "assertion fails. The valid range is 0 through 100, inclusive.");
-
-GTEST_DEFINE_string_(
- stream_result_to,
- internal::StringFromGTestEnv("stream_result_to", ""),
- "This flag specifies the host name and the port number on which to stream "
- "test results. Example: \"localhost:555\". The flag is effective only on "
- "Linux.");
-
-GTEST_DEFINE_bool_(
- throw_on_failure,
- internal::BoolFromGTestEnv("throw_on_failure", false),
- "When this flag is specified, a failed assertion will throw an exception "
- "if exceptions are enabled or exit the program with a non-zero code "
- "otherwise.");
-
-namespace internal {
-
-// Generates a random number from [0, range), using a Linear
-// Congruential Generator (LCG). Crashes if 'range' is 0 or greater
-// than kMaxRange.
-UInt32 Random::Generate(UInt32 range) {
- // These constants are the same as are used in glibc's rand(3).
- state_ = (1103515245U*state_ + 12345U) % kMaxRange;
-
- GTEST_CHECK_(range > 0)
- << "Cannot generate a number in the range [0, 0).";
- GTEST_CHECK_(range <= kMaxRange)
- << "Generation of a number in [0, " << range << ") was requested, "
- << "but this can only generate numbers in [0, " << kMaxRange << ").";
-
- // Converting via modulus introduces a bit of downward bias, but
- // it's simple, and a linear congruential generator isn't too good
- // to begin with.
- return state_ % range;
-}
-
-// GTestIsInitialized() returns true iff the user has initialized
-// Google Test. Useful for catching the user mistake of not initializing
-// Google Test before calling RUN_ALL_TESTS().
-//
-// A user must call testing::InitGoogleTest() to initialize Google
-// Test. g_init_gtest_count is set to the number of times
-// InitGoogleTest() has been called. We don't protect this variable
-// under a mutex as it is only accessed in the main thread.
-GTEST_API_ int g_init_gtest_count = 0;
-static bool GTestIsInitialized() { return g_init_gtest_count != 0; }
-
-// Iterates over a vector of TestCases, keeping a running sum of the
-// results of calling a given int-returning method on each.
-// Returns the sum.
-static int SumOverTestCaseList(const std::vector<TestCase*>& case_list,
- int (TestCase::*method)() const) {
- int sum = 0;
- for (size_t i = 0; i < case_list.size(); i++) {
- sum += (case_list[i]->*method)();
- }
- return sum;
-}
-
-// Returns true iff the test case passed.
-static bool TestCasePassed(const TestCase* test_case) {
- return test_case->should_run() && test_case->Passed();
-}
-
-// Returns true iff the test case failed.
-static bool TestCaseFailed(const TestCase* test_case) {
- return test_case->should_run() && test_case->Failed();
-}
-
-// Returns true iff test_case contains at least one test that should
-// run.
-static bool ShouldRunTestCase(const TestCase* test_case) {
- return test_case->should_run();
-}
-
-// AssertHelper constructor.
-AssertHelper::AssertHelper(TestPartResult::Type type,
- const char* file,
- int line,
- const char* message)
- : data_(new AssertHelperData(type, file, line, message)) {
-}
-
-AssertHelper::~AssertHelper() {
- delete data_;
-}
-
-// Message assignment, for assertion streaming support.
-void AssertHelper::operator=(const Message& message) const {
- UnitTest::GetInstance()->
- AddTestPartResult(data_->type, data_->file, data_->line,
- AppendUserMessage(data_->message, message),
- UnitTest::GetInstance()->impl()
- ->CurrentOsStackTraceExceptTop(1)
- // Skips the stack frame for this function itself.
- ); // NOLINT
-}
-
-// Mutex for linked pointers.
-GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);
-
-// Application pathname gotten in InitGoogleTest.
-std::string g_executable_path;
-
-// Returns the current application's name, removing directory path if that
-// is present.
-FilePath GetCurrentExecutableName() {
- FilePath result;
-
-#if GTEST_OS_WINDOWS
- result.Set(FilePath(g_executable_path).RemoveExtension("exe"));
-#else
- result.Set(FilePath(g_executable_path));
-#endif // GTEST_OS_WINDOWS
-
- return result.RemoveDirectoryName();
-}
-
-// Functions for processing the gtest_output flag.
-
-// Returns the output format, or "" for normal printed output.
-std::string UnitTestOptions::GetOutputFormat() {
- const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
- if (gtest_output_flag == NULL) return std::string("");
-
- const char* const colon = strchr(gtest_output_flag, ':');
- return (colon == NULL) ?
- std::string(gtest_output_flag) :
- std::string(gtest_output_flag, colon - gtest_output_flag);
-}
-
-// Returns the name of the requested output file, or the default if none
-// was explicitly specified.
-std::string UnitTestOptions::GetAbsolutePathToOutputFile() {
- const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
- if (gtest_output_flag == NULL)
- return "";
-
- const char* const colon = strchr(gtest_output_flag, ':');
- if (colon == NULL)
- return internal::FilePath::ConcatPaths(
- internal::FilePath(
- UnitTest::GetInstance()->original_working_dir()),
- internal::FilePath(kDefaultOutputFile)).string();
-
- internal::FilePath output_name(colon + 1);
- if (!output_name.IsAbsolutePath())
- // TODO(wan@google.com): on Windows \some\path is not an absolute
- // path (as its meaning depends on the current drive), yet the
- // following logic for turning it into an absolute path is wrong.
- // Fix it.
- output_name = internal::FilePath::ConcatPaths(
- internal::FilePath(UnitTest::GetInstance()->original_working_dir()),
- internal::FilePath(colon + 1));
-
- if (!output_name.IsDirectory())
- return output_name.string();
-
- internal::FilePath result(internal::FilePath::GenerateUniqueFileName(
- output_name, internal::GetCurrentExecutableName(),
- GetOutputFormat().c_str()));
- return result.string();
-}
-
-// Returns true iff the wildcard pattern matches the string. The
-// first ':' or '\0' character in pattern marks the end of it.
-//
-// This recursive algorithm isn't very efficient, but is clear and
-// works well enough for matching test names, which are short.
-bool UnitTestOptions::PatternMatchesString(const char *pattern,
- const char *str) {
- switch (*pattern) {
- case '\0':
- case ':': // Either ':' or '\0' marks the end of the pattern.
- return *str == '\0';
- case '?': // Matches any single character.
- return *str != '\0' && PatternMatchesString(pattern + 1, str + 1);
- case '*': // Matches any string (possibly empty) of characters.
- return (*str != '\0' && PatternMatchesString(pattern, str + 1)) ||
- PatternMatchesString(pattern + 1, str);
- default: // Non-special character. Matches itself.
- return *pattern == *str &&
- PatternMatchesString(pattern + 1, str + 1);
- }
-}
-
-bool UnitTestOptions::MatchesFilter(
- const std::string& name, const char* filter) {
- const char *cur_pattern = filter;
- for (;;) {
- if (PatternMatchesString(cur_pattern, name.c_str())) {
- return true;
- }
-
- // Finds the next pattern in the filter.
- cur_pattern = strchr(cur_pattern, ':');
-
- // Returns if no more pattern can be found.
- if (cur_pattern == NULL) {
- return false;
- }
-
- // Skips the pattern separater (the ':' character).
- cur_pattern++;
- }
-}
-
-// Returns true iff the user-specified filter matches the test case
-// name and the test name.
-bool UnitTestOptions::FilterMatchesTest(const std::string &test_case_name,
- const std::string &test_name) {
- const std::string& full_name = test_case_name + "." + test_name.c_str();
-
- // Split --gtest_filter at '-', if there is one, to separate into
- // positive filter and negative filter portions
- const char* const p = GTEST_FLAG(filter).c_str();
- const char* const dash = strchr(p, '-');
- std::string positive;
- std::string negative;
- if (dash == NULL) {
- positive = GTEST_FLAG(filter).c_str(); // Whole string is a positive filter
- negative = "";
- } else {
- positive = std::string(p, dash); // Everything up to the dash
- negative = std::string(dash + 1); // Everything after the dash
- if (positive.empty()) {
- // Treat '-test1' as the same as '*-test1'
- positive = kUniversalFilter;
- }
- }
-
- // A filter is a colon-separated list of patterns. It matches a
- // test if any pattern in it matches the test.
- return (MatchesFilter(full_name, positive.c_str()) &&
- !MatchesFilter(full_name, negative.c_str()));
-}
-
-#if GTEST_HAS_SEH
-// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
-// given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
-// This function is useful as an __except condition.
-int UnitTestOptions::GTestShouldProcessSEH(DWORD exception_code) {
- // Google Test should handle a SEH exception if:
- // 1. the user wants it to, AND
- // 2. this is not a breakpoint exception, AND
- // 3. this is not a C++ exception (VC++ implements them via SEH,
- // apparently).
- //
- // SEH exception code for C++ exceptions.
- // (see http://support.microsoft.com/kb/185294 for more information).
- const DWORD kCxxExceptionCode = 0xe06d7363;
-
- bool should_handle = true;
-
- if (!GTEST_FLAG(catch_exceptions))
- should_handle = false;
- else if (exception_code == EXCEPTION_BREAKPOINT)
- should_handle = false;
- else if (exception_code == kCxxExceptionCode)
- should_handle = false;
-
- return should_handle ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
-}
-#endif // GTEST_HAS_SEH
-
-} // namespace internal
-
-// The c'tor sets this object as the test part result reporter used by
-// Google Test. The 'result' parameter specifies where to report the
-// results. Intercepts only failures from the current thread.
-ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
- TestPartResultArray* result)
- : intercept_mode_(INTERCEPT_ONLY_CURRENT_THREAD),
- result_(result) {
- Init();
-}
-
-// The c'tor sets this object as the test part result reporter used by
-// Google Test. The 'result' parameter specifies where to report the
-// results.
-ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
- InterceptMode intercept_mode, TestPartResultArray* result)
- : intercept_mode_(intercept_mode),
- result_(result) {
- Init();
-}
-
-void ScopedFakeTestPartResultReporter::Init() {
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
- old_reporter_ = impl->GetGlobalTestPartResultReporter();
- impl->SetGlobalTestPartResultReporter(this);
- } else {
- old_reporter_ = impl->GetTestPartResultReporterForCurrentThread();
- impl->SetTestPartResultReporterForCurrentThread(this);
- }
-}
-
-// The d'tor restores the test part result reporter used by Google Test
-// before.
-ScopedFakeTestPartResultReporter::~ScopedFakeTestPartResultReporter() {
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
- impl->SetGlobalTestPartResultReporter(old_reporter_);
- } else {
- impl->SetTestPartResultReporterForCurrentThread(old_reporter_);
- }
-}
-
-// Increments the test part result count and remembers the result.
-// This method is from the TestPartResultReporterInterface interface.
-void ScopedFakeTestPartResultReporter::ReportTestPartResult(
- const TestPartResult& result) {
- result_->Append(result);
-}
-
-namespace internal {
-
-// Returns the type ID of ::testing::Test. We should always call this
-// instead of GetTypeId< ::testing::Test>() to get the type ID of
-// testing::Test. This is to work around a suspected linker bug when
-// using Google Test as a framework on Mac OS X. The bug causes
-// GetTypeId< ::testing::Test>() to return different values depending
-// on whether the call is from the Google Test framework itself or
-// from user test code. GetTestTypeId() is guaranteed to always
-// return the same value, as it always calls GetTypeId<>() from the
-// gtest.cc, which is within the Google Test framework.
-TypeId GetTestTypeId() {
- return GetTypeId<Test>();
-}
-
-// The value of GetTestTypeId() as seen from within the Google Test
-// library. This is solely for testing GetTestTypeId().
-extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId();
-
-// This predicate-formatter checks that 'results' contains a test part
-// failure of the given type and that the failure message contains the
-// given substring.
-AssertionResult HasOneFailure(const char* /* results_expr */,
- const char* /* type_expr */,
- const char* /* substr_expr */,
- const TestPartResultArray& results,
- TestPartResult::Type type,
- const string& substr) {
- const std::string expected(type == TestPartResult::kFatalFailure ?
- "1 fatal failure" :
- "1 non-fatal failure");
- Message msg;
- if (results.size() != 1) {
- msg << "Expected: " << expected << "\n"
- << " Actual: " << results.size() << " failures";
- for (int i = 0; i < results.size(); i++) {
- msg << "\n" << results.GetTestPartResult(i);
- }
- return AssertionFailure() << msg;
- }
-
- const TestPartResult& r = results.GetTestPartResult(0);
- if (r.type() != type) {
- return AssertionFailure() << "Expected: " << expected << "\n"
- << " Actual:\n"
- << r;
- }
-
- if (strstr(r.message(), substr.c_str()) == NULL) {
- return AssertionFailure() << "Expected: " << expected << " containing \""
- << substr << "\"\n"
- << " Actual:\n"
- << r;
- }
-
- return AssertionSuccess();
-}
-
-// The constructor of SingleFailureChecker remembers where to look up
-// test part results, what type of failure we expect, and what
-// substring the failure message should contain.
-SingleFailureChecker:: SingleFailureChecker(
- const TestPartResultArray* results,
- TestPartResult::Type type,
- const string& substr)
- : results_(results),
- type_(type),
- substr_(substr) {}
-
-// The destructor of SingleFailureChecker verifies that the given
-// TestPartResultArray contains exactly one failure that has the given
-// type and contains the given substring. If that's not the case, a
-// non-fatal failure will be generated.
-SingleFailureChecker::~SingleFailureChecker() {
- EXPECT_PRED_FORMAT3(HasOneFailure, *results_, type_, substr_);
-}
-
-DefaultGlobalTestPartResultReporter::DefaultGlobalTestPartResultReporter(
- UnitTestImpl* unit_test) : unit_test_(unit_test) {}
-
-void DefaultGlobalTestPartResultReporter::ReportTestPartResult(
- const TestPartResult& result) {
- unit_test_->current_test_result()->AddTestPartResult(result);
- unit_test_->listeners()->repeater()->OnTestPartResult(result);
-}
-
-DefaultPerThreadTestPartResultReporter::DefaultPerThreadTestPartResultReporter(
- UnitTestImpl* unit_test) : unit_test_(unit_test) {}
-
-void DefaultPerThreadTestPartResultReporter::ReportTestPartResult(
- const TestPartResult& result) {
- unit_test_->GetGlobalTestPartResultReporter()->ReportTestPartResult(result);
-}
-
-// Returns the global test part result reporter.
-TestPartResultReporterInterface*
-UnitTestImpl::GetGlobalTestPartResultReporter() {
- internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
- return global_test_part_result_repoter_;
-}
-
-// Sets the global test part result reporter.
-void UnitTestImpl::SetGlobalTestPartResultReporter(
- TestPartResultReporterInterface* reporter) {
- internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
- global_test_part_result_repoter_ = reporter;
-}
-
-// Returns the test part result reporter for the current thread.
-TestPartResultReporterInterface*
-UnitTestImpl::GetTestPartResultReporterForCurrentThread() {
- return per_thread_test_part_result_reporter_.get();
-}
-
-// Sets the test part result reporter for the current thread.
-void UnitTestImpl::SetTestPartResultReporterForCurrentThread(
- TestPartResultReporterInterface* reporter) {
- per_thread_test_part_result_reporter_.set(reporter);
-}
-
-// Gets the number of successful test cases.
-int UnitTestImpl::successful_test_case_count() const {
- return CountIf(test_cases_, TestCasePassed);
-}
-
-// Gets the number of failed test cases.
-int UnitTestImpl::failed_test_case_count() const {
- return CountIf(test_cases_, TestCaseFailed);
-}
-
-// Gets the number of all test cases.
-int UnitTestImpl::total_test_case_count() const {
- return static_cast<int>(test_cases_.size());
-}
-
-// Gets the number of all test cases that contain at least one test
-// that should run.
-int UnitTestImpl::test_case_to_run_count() const {
- return CountIf(test_cases_, ShouldRunTestCase);
-}
-
-// Gets the number of successful tests.
-int UnitTestImpl::successful_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::successful_test_count);
-}
-
-// Gets the number of failed tests.
-int UnitTestImpl::failed_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::failed_test_count);
-}
-
-// Gets the number of disabled tests that will be reported in the XML report.
-int UnitTestImpl::reportable_disabled_test_count() const {
- return SumOverTestCaseList(test_cases_,
- &TestCase::reportable_disabled_test_count);
-}
-
-// Gets the number of disabled tests.
-int UnitTestImpl::disabled_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::disabled_test_count);
-}
-
-// Gets the number of tests to be printed in the XML report.
-int UnitTestImpl::reportable_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::reportable_test_count);
-}
-
-// Gets the number of all tests.
-int UnitTestImpl::total_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::total_test_count);
-}
-
-// Gets the number of tests that should run.
-int UnitTestImpl::test_to_run_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::test_to_run_count);
-}
-
-// Returns the current OS stack trace as an std::string.
-//
-// The maximum number of stack frames to be included is specified by
-// the gtest_stack_trace_depth flag. The skip_count parameter
-// specifies the number of top frames to be skipped, which doesn't
-// count against the number of frames to be included.
-//
-// For example, if Foo() calls Bar(), which in turn calls
-// CurrentOsStackTraceExceptTop(1), Foo() will be included in the
-// trace but Bar() and CurrentOsStackTraceExceptTop() won't.
-std::string UnitTestImpl::CurrentOsStackTraceExceptTop(int skip_count) {
- (void)skip_count;
- return "";
-}
-
-// Returns the current time in milliseconds.
-TimeInMillis GetTimeInMillis() {
-#if GTEST_OS_WINDOWS_MOBILE || defined(__BORLANDC__)
- // Difference between 1970-01-01 and 1601-01-01 in milliseconds.
- // http://analogous.blogspot.com/2005/04/epoch.html
- const TimeInMillis kJavaEpochToWinFileTimeDelta =
- static_cast<TimeInMillis>(116444736UL) * 100000UL;
- const DWORD kTenthMicrosInMilliSecond = 10000;
-
- SYSTEMTIME now_systime;
- FILETIME now_filetime;
- ULARGE_INTEGER now_int64;
- // TODO(kenton@google.com): Shouldn't this just use
- // GetSystemTimeAsFileTime()?
- GetSystemTime(&now_systime);
- if (SystemTimeToFileTime(&now_systime, &now_filetime)) {
- now_int64.LowPart = now_filetime.dwLowDateTime;
- now_int64.HighPart = now_filetime.dwHighDateTime;
- now_int64.QuadPart = (now_int64.QuadPart / kTenthMicrosInMilliSecond) -
- kJavaEpochToWinFileTimeDelta;
- return now_int64.QuadPart;
- }
- return 0;
-#elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_
- __timeb64 now;
-
-# ifdef _MSC_VER
-
- // MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996
- // (deprecated function) there.
- // TODO(kenton@google.com): Use GetTickCount()? Or use
- // SystemTimeToFileTime()
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4996) // Temporarily disables warning 4996.
- _ftime64(&now);
-# pragma warning(pop) // Restores the warning state.
-# else
-
- _ftime64(&now);
-
-# endif // _MSC_VER
-
- return static_cast<TimeInMillis>(now.time) * 1000 + now.millitm;
-#elif GTEST_HAS_GETTIMEOFDAY_
- struct timeval now;
- gettimeofday(&now, NULL);
- return static_cast<TimeInMillis>(now.tv_sec) * 1000 + now.tv_usec / 1000;
-#else
-# error "Don't know how to get the current time on your system."
-#endif
-}
-
-// Utilities
-
-// class String.
-
-#if GTEST_OS_WINDOWS_MOBILE
-// Creates a UTF-16 wide string from the given ANSI string, allocating
-// memory using new. The caller is responsible for deleting the return
-// value using delete[]. Returns the wide string, or NULL if the
-// input is NULL.
-LPCWSTR String::AnsiToUtf16(const char* ansi) {
- if (!ansi) return NULL;
- const int length = strlen(ansi);
- const int unicode_length =
- MultiByteToWideChar(CP_ACP, 0, ansi, length,
- NULL, 0);
- WCHAR* unicode = new WCHAR[unicode_length + 1];
- MultiByteToWideChar(CP_ACP, 0, ansi, length,
- unicode, unicode_length);
- unicode[unicode_length] = 0;
- return unicode;
-}
-
-// Creates an ANSI string from the given wide string, allocating
-// memory using new. The caller is responsible for deleting the return
-// value using delete[]. Returns the ANSI string, or NULL if the
-// input is NULL.
-const char* String::Utf16ToAnsi(LPCWSTR utf16_str) {
- if (!utf16_str) return NULL;
- const int ansi_length =
- WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,
- NULL, 0, NULL, NULL);
- char* ansi = new char[ansi_length + 1];
- WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,
- ansi, ansi_length, NULL, NULL);
- ansi[ansi_length] = 0;
- return ansi;
-}
-
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-// Compares two C strings. Returns true iff they have the same content.
-//
-// Unlike strcmp(), this function can handle NULL argument(s). A NULL
-// C string is considered different to any non-NULL C string,
-// including the empty string.
-bool String::CStringEquals(const char * lhs, const char * rhs) {
- if ( lhs == NULL ) return rhs == NULL;
-
- if ( rhs == NULL ) return false;
-
- return strcmp(lhs, rhs) == 0;
-}
-
-#if GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
-
-// Converts an array of wide chars to a narrow string using the UTF-8
-// encoding, and streams the result to the given Message object.
-static void StreamWideCharsToMessage(const wchar_t* wstr, size_t length,
- Message* msg) {
- for (size_t i = 0; i != length; ) { // NOLINT
- if (wstr[i] != L'\0') {
- *msg << WideStringToUtf8(wstr + i, static_cast<int>(length - i));
- while (i != length && wstr[i] != L'\0')
- i++;
- } else {
- *msg << '\0';
- i++;
- }
- }
-}
-
-#endif // GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
-
-} // namespace internal
-
-// Constructs an empty Message.
-// We allocate the stringstream separately because otherwise each use of
-// ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's
-// stack frame leading to huge stack frames in some cases; gcc does not reuse
-// the stack space.
-Message::Message() : ss_(new ::std::stringstream) {
- // By default, we want there to be enough precision when printing
- // a double to a Message.
- *ss_ << std::setprecision(std::numeric_limits<double>::digits10 + 2);
-}
-
-// These two overloads allow streaming a wide C string to a Message
-// using the UTF-8 encoding.
-Message& Message::operator <<(const wchar_t* wide_c_str) {
- return *this << internal::String::ShowWideCString(wide_c_str);
-}
-Message& Message::operator <<(wchar_t* wide_c_str) {
- return *this << internal::String::ShowWideCString(wide_c_str);
-}
-
-#if GTEST_HAS_STD_WSTRING
-// Converts the given wide string to a narrow string using the UTF-8
-// encoding, and streams the result to this Message object.
-Message& Message::operator <<(const ::std::wstring& wstr) {
- internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);
- return *this;
-}
-#endif // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
-// Converts the given wide string to a narrow string using the UTF-8
-// encoding, and streams the result to this Message object.
-Message& Message::operator <<(const ::wstring& wstr) {
- internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);
- return *this;
-}
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-// Gets the text streamed to this object so far as an std::string.
-// Each '\0' character in the buffer is replaced with "\\0".
-std::string Message::GetString() const {
- return internal::StringStreamToString(ss_.get());
-}
-
-// AssertionResult constructors.
-// Used in EXPECT_TRUE/FALSE(assertion_result).
-AssertionResult::AssertionResult(const AssertionResult& other)
- : success_(other.success_),
- message_(other.message_.get() != NULL ?
- new ::std::string(*other.message_) :
- static_cast< ::std::string*>(NULL)) {
-}
-
-// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
-AssertionResult AssertionResult::operator!() const {
- AssertionResult negation(!success_);
- if (message_.get() != NULL)
- negation << *message_;
- return negation;
-}
-
-// Makes a successful assertion result.
-AssertionResult AssertionSuccess() {
- return AssertionResult(true);
-}
-
-// Makes a failed assertion result.
-AssertionResult AssertionFailure() {
- return AssertionResult(false);
-}
-
-// Makes a failed assertion result with the given failure message.
-// Deprecated; use AssertionFailure() << message.
-AssertionResult AssertionFailure(const Message& message) {
- return AssertionFailure() << message;
-}
-
-namespace internal {
-
-// Constructs and returns the message for an equality assertion
-// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
-//
-// The first four parameters are the expressions used in the assertion
-// and their values, as strings. For example, for ASSERT_EQ(foo, bar)
-// where foo is 5 and bar is 6, we have:
-//
-// expected_expression: "foo"
-// actual_expression: "bar"
-// expected_value: "5"
-// actual_value: "6"
-//
-// The ignoring_case parameter is true iff the assertion is a
-// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
-// be inserted into the message.
-AssertionResult EqFailure(const char* expected_expression,
- const char* actual_expression,
- const std::string& expected_value,
- const std::string& actual_value,
- bool ignoring_case) {
- Message msg;
- msg << "Value of: " << actual_expression;
- if (actual_value != actual_expression) {
- msg << "\n Actual: " << actual_value;
- }
-
- msg << "\nExpected: " << expected_expression;
- if (ignoring_case) {
- msg << " (ignoring case)";
- }
- if (expected_value != expected_expression) {
- msg << "\nWhich is: " << expected_value;
- }
-
- return AssertionFailure() << msg;
-}
-
-// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
-std::string GetBoolAssertionFailureMessage(
- const AssertionResult& assertion_result,
- const char* expression_text,
- const char* actual_predicate_value,
- const char* expected_predicate_value) {
- const char* actual_message = assertion_result.message();
- Message msg;
- msg << "Value of: " << expression_text
- << "\n Actual: " << actual_predicate_value;
- if (actual_message[0] != '\0')
- msg << " (" << actual_message << ")";
- msg << "\nExpected: " << expected_predicate_value;
- return msg.GetString();
-}
-
-// Helper function for implementing ASSERT_NEAR.
-AssertionResult DoubleNearPredFormat(const char* expr1,
- const char* expr2,
- const char* abs_error_expr,
- double val1,
- double val2,
- double abs_error) {
- const double diff = fabs(val1 - val2);
- if (diff <= abs_error) return AssertionSuccess();
-
- // TODO(wan): do not print the value of an expression if it's
- // already a literal.
- return AssertionFailure()
- << "The difference between " << expr1 << " and " << expr2
- << " is " << diff << ", which exceeds " << abs_error_expr << ", where\n"
- << expr1 << " evaluates to " << val1 << ",\n"
- << expr2 << " evaluates to " << val2 << ", and\n"
- << abs_error_expr << " evaluates to " << abs_error << ".";
-}
-
-
-// Helper template for implementing FloatLE() and DoubleLE().
-template <typename RawType>
-AssertionResult FloatingPointLE(const char* expr1,
- const char* expr2,
- RawType val1,
- RawType val2) {
- // Returns success if val1 is less than val2,
- if (val1 < val2) {
- return AssertionSuccess();
- }
-
- // or if val1 is almost equal to val2.
- const FloatingPoint<RawType> lhs(val1), rhs(val2);
- if (lhs.AlmostEquals(rhs)) {
- return AssertionSuccess();
- }
-
- // Note that the above two checks will both fail if either val1 or
- // val2 is NaN, as the IEEE floating-point standard requires that
- // any predicate involving a NaN must return false.
-
- ::std::stringstream val1_ss;
- val1_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << val1;
-
- ::std::stringstream val2_ss;
- val2_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << val2;
-
- return AssertionFailure()
- << "Expected: (" << expr1 << ") <= (" << expr2 << ")\n"
- << " Actual: " << StringStreamToString(&val1_ss) << " vs "
- << StringStreamToString(&val2_ss);
-}
-
-} // namespace internal
-
-// Asserts that val1 is less than, or almost equal to, val2. Fails
-// otherwise. In particular, it fails if either val1 or val2 is NaN.
-AssertionResult FloatLE(const char* expr1, const char* expr2,
- float val1, float val2) {
- return internal::FloatingPointLE<float>(expr1, expr2, val1, val2);
-}
-
-// Asserts that val1 is less than, or almost equal to, val2. Fails
-// otherwise. In particular, it fails if either val1 or val2 is NaN.
-AssertionResult DoubleLE(const char* expr1, const char* expr2,
- double val1, double val2) {
- return internal::FloatingPointLE<double>(expr1, expr2, val1, val2);
-}
-
-namespace internal {
-
-// The helper function for {ASSERT|EXPECT}_EQ with int or enum
-// arguments.
-AssertionResult CmpHelperEQ(const char* expected_expression,
- const char* actual_expression,
- BiggestInt expected,
- BiggestInt actual) {
- if (expected == actual) {
- return AssertionSuccess();
- }
-
- return EqFailure(expected_expression,
- actual_expression,
- FormatForComparisonFailureMessage(expected, actual),
- FormatForComparisonFailureMessage(actual, expected),
- false);
-}
-
-// A macro for implementing the helper functions needed to implement
-// ASSERT_?? and EXPECT_?? with integer or enum arguments. It is here
-// just to avoid copy-and-paste of similar code.
-#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
-AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
- BiggestInt val1, BiggestInt val2) {\
- if (val1 op val2) {\
- return AssertionSuccess();\
- } else {\
- return AssertionFailure() \
- << "Expected: (" << expr1 << ") " #op " (" << expr2\
- << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
- << " vs " << FormatForComparisonFailureMessage(val2, val1);\
- }\
-}
-
-// Implements the helper function for {ASSERT|EXPECT}_NE with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(NE, !=)
-// Implements the helper function for {ASSERT|EXPECT}_LE with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(LE, <=)
-// Implements the helper function for {ASSERT|EXPECT}_LT with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(LT, < )
-// Implements the helper function for {ASSERT|EXPECT}_GE with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(GE, >=)
-// Implements the helper function for {ASSERT|EXPECT}_GT with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(GT, > )
-
-#undef GTEST_IMPL_CMP_HELPER_
-
-// The helper function for {ASSERT|EXPECT}_STREQ.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual) {
- if (String::CStringEquals(expected, actual)) {
- return AssertionSuccess();
- }
-
- return EqFailure(expected_expression,
- actual_expression,
- PrintToString(expected),
- PrintToString(actual),
- false);
-}
-
-// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
-AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual) {
- if (String::CaseInsensitiveCStringEquals(expected, actual)) {
- return AssertionSuccess();
- }
-
- return EqFailure(expected_expression,
- actual_expression,
- PrintToString(expected),
- PrintToString(actual),
- true);
-}
-
-// The helper function for {ASSERT|EXPECT}_STRNE.
-AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2) {
- if (!String::CStringEquals(s1, s2)) {
- return AssertionSuccess();
- } else {
- return AssertionFailure() << "Expected: (" << s1_expression << ") != ("
- << s2_expression << "), actual: \""
- << s1 << "\" vs \"" << s2 << "\"";
- }
-}
-
-// The helper function for {ASSERT|EXPECT}_STRCASENE.
-AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2) {
- if (!String::CaseInsensitiveCStringEquals(s1, s2)) {
- return AssertionSuccess();
- } else {
- return AssertionFailure()
- << "Expected: (" << s1_expression << ") != ("
- << s2_expression << ") (ignoring case), actual: \""
- << s1 << "\" vs \"" << s2 << "\"";
- }
-}
-
-} // namespace internal
-
-namespace {
-
-// Helper functions for implementing IsSubString() and IsNotSubstring().
-
-// This group of overloaded functions return true iff needle is a
-// substring of haystack. NULL is considered a substring of itself
-// only.
-
-bool IsSubstringPred(const char* needle, const char* haystack) {
- if (needle == NULL || haystack == NULL)
- return needle == haystack;
-
- return strstr(haystack, needle) != NULL;
-}
-
-bool IsSubstringPred(const wchar_t* needle, const wchar_t* haystack) {
- if (needle == NULL || haystack == NULL)
- return needle == haystack;
-
- return wcsstr(haystack, needle) != NULL;
-}
-
-// StringType here can be either ::std::string or ::std::wstring.
-template <typename StringType>
-bool IsSubstringPred(const StringType& needle,
- const StringType& haystack) {
- return haystack.find(needle) != StringType::npos;
-}
-
-// This function implements either IsSubstring() or IsNotSubstring(),
-// depending on the value of the expected_to_be_substring parameter.
-// StringType here can be const char*, const wchar_t*, ::std::string,
-// or ::std::wstring.
-template <typename StringType>
-AssertionResult IsSubstringImpl(
- bool expected_to_be_substring,
- const char* needle_expr, const char* haystack_expr,
- const StringType& needle, const StringType& haystack) {
- if (IsSubstringPred(needle, haystack) == expected_to_be_substring)
- return AssertionSuccess();
-
- const bool is_wide_string = sizeof(needle[0]) > 1;
- const char* const begin_string_quote = is_wide_string ? "L\"" : "\"";
- return AssertionFailure()
- << "Value of: " << needle_expr << "\n"
- << " Actual: " << begin_string_quote << needle << "\"\n"
- << "Expected: " << (expected_to_be_substring ? "" : "not ")
- << "a substring of " << haystack_expr << "\n"
- << "Which is: " << begin_string_quote << haystack << "\"";
-}
-
-} // namespace
-
-// IsSubstring() and IsNotSubstring() check whether needle is a
-// substring of haystack (NULL is considered a substring of itself
-// only), and return an appropriate error message when they fail.
-
-AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const char* needle, const char* haystack) {
- return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const wchar_t* needle, const wchar_t* haystack) {
- return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const char* needle, const char* haystack) {
- return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const wchar_t* needle, const wchar_t* haystack) {
- return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::string& needle, const ::std::string& haystack) {
- return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::string& needle, const ::std::string& haystack) {
- return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-
-#if GTEST_HAS_STD_WSTRING
-AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::wstring& needle, const ::std::wstring& haystack) {
- return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::wstring& needle, const ::std::wstring& haystack) {
- return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-#endif // GTEST_HAS_STD_WSTRING
-
-namespace internal {
-
-#if GTEST_OS_WINDOWS
-
-namespace {
-
-// Helper function for IsHRESULT{SuccessFailure} predicates
-AssertionResult HRESULTFailureHelper(const char* expr,
- const char* expected,
- long hr) { // NOLINT
-# if GTEST_OS_WINDOWS_MOBILE
-
- // Windows CE doesn't support FormatMessage.
- const char error_text[] = "";
-
-# else
-
- // Looks up the human-readable system message for the HRESULT code
- // and since we're not passing any params to FormatMessage, we don't
- // want inserts expanded.
- const DWORD kFlags = FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS;
- const DWORD kBufSize = 4096;
- // Gets the system's human readable message string for this HRESULT.
- char error_text[kBufSize] = { '\0' };
- DWORD message_length = ::FormatMessageA(kFlags,
- 0, // no source, we're asking system
- hr, // the error
- 0, // no line width restrictions
- error_text, // output buffer
- kBufSize, // buf size
- NULL); // no arguments for inserts
- // Trims tailing white space (FormatMessage leaves a trailing CR-LF)
- for (; message_length && IsSpace(error_text[message_length - 1]);
- --message_length) {
- error_text[message_length - 1] = '\0';
- }
-
-# endif // GTEST_OS_WINDOWS_MOBILE
-
- const std::string error_hex("0x" + String::FormatHexInt(hr));
- return ::testing::AssertionFailure()
- << "Expected: " << expr << " " << expected << ".\n"
- << " Actual: " << error_hex << " " << error_text << "\n";
-}
-
-} // namespace
-
-AssertionResult IsHRESULTSuccess(const char* expr, long hr) { // NOLINT
- if (SUCCEEDED(hr)) {
- return AssertionSuccess();
- }
- return HRESULTFailureHelper(expr, "succeeds", hr);
-}
-
-AssertionResult IsHRESULTFailure(const char* expr, long hr) { // NOLINT
- if (FAILED(hr)) {
- return AssertionSuccess();
- }
- return HRESULTFailureHelper(expr, "fails", hr);
-}
-
-#endif // GTEST_OS_WINDOWS
-
-// Utility functions for encoding Unicode text (wide strings) in
-// UTF-8.
-
-// A Unicode code-point can have upto 21 bits, and is encoded in UTF-8
-// like this:
-//
-// Code-point length Encoding
-// 0 - 7 bits 0xxxxxxx
-// 8 - 11 bits 110xxxxx 10xxxxxx
-// 12 - 16 bits 1110xxxx 10xxxxxx 10xxxxxx
-// 17 - 21 bits 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
-
-// The maximum code-point a one-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint1 = (static_cast<UInt32>(1) << 7) - 1;
-
-// The maximum code-point a two-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint2 = (static_cast<UInt32>(1) << (5 + 6)) - 1;
-
-// The maximum code-point a three-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint3 = (static_cast<UInt32>(1) << (4 + 2*6)) - 1;
-
-// The maximum code-point a four-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint4 = (static_cast<UInt32>(1) << (3 + 3*6)) - 1;
-
-// Chops off the n lowest bits from a bit pattern. Returns the n
-// lowest bits. As a side effect, the original bit pattern will be
-// shifted to the right by n bits.
-inline UInt32 ChopLowBits(UInt32* bits, int n) {
- const UInt32 low_bits = *bits & ((static_cast<UInt32>(1) << n) - 1);
- *bits >>= n;
- return low_bits;
-}
-
-// Converts a Unicode code point to a narrow string in UTF-8 encoding.
-// code_point parameter is of type UInt32 because wchar_t may not be
-// wide enough to contain a code point.
-// If the code_point is not a valid Unicode code point
-// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted
-// to "(Invalid Unicode 0xXXXXXXXX)".
-std::string CodePointToUtf8(UInt32 code_point) {
- if (code_point > kMaxCodePoint4) {
- return "(Invalid Unicode 0x" + String::FormatHexInt(code_point) + ")";
- }
-
- char str[5]; // Big enough for the largest valid code point.
- if (code_point <= kMaxCodePoint1) {
- str[1] = '\0';
- str[0] = static_cast<char>(code_point); // 0xxxxxxx
- } else if (code_point <= kMaxCodePoint2) {
- str[2] = '\0';
- str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[0] = static_cast<char>(0xC0 | code_point); // 110xxxxx
- } else if (code_point <= kMaxCodePoint3) {
- str[3] = '\0';
- str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[0] = static_cast<char>(0xE0 | code_point); // 1110xxxx
- } else { // code_point <= kMaxCodePoint4
- str[4] = '\0';
- str[3] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[0] = static_cast<char>(0xF0 | code_point); // 11110xxx
- }
- return str;
-}
-
-// The following two functions only make sense if the the system
-// uses UTF-16 for wide string encoding. All supported systems
-// with 16 bit wchar_t (Windows, Cygwin, Symbian OS) do use UTF-16.
-
-// Determines if the arguments constitute UTF-16 surrogate pair
-// and thus should be combined into a single Unicode code point
-// using CreateCodePointFromUtf16SurrogatePair.
-inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {
- return sizeof(wchar_t) == 2 &&
- (first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00;
-}
-
-// Creates a Unicode code point from UTF16 surrogate pair.
-inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
- wchar_t second) {
- const UInt32 mask = (1 << 10) - 1;
- return (sizeof(wchar_t) == 2) ?
- (((first & mask) << 10) | (second & mask)) + 0x10000 :
- // This function should not be called when the condition is
- // false, but we provide a sensible default in case it is.
- static_cast<UInt32>(first);
-}
-
-// Converts a wide string to a narrow string in UTF-8 encoding.
-// The wide string is assumed to have the following encoding:
-// UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)
-// UTF-32 if sizeof(wchar_t) == 4 (on Linux)
-// Parameter str points to a null-terminated wide string.
-// Parameter num_chars may additionally limit the number
-// of wchar_t characters processed. -1 is used when the entire string
-// should be processed.
-// If the string contains code points that are not valid Unicode code points
-// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output
-// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
-// and contains invalid UTF-16 surrogate pairs, values in those pairs
-// will be encoded as individual Unicode characters from Basic Normal Plane.
-std::string WideStringToUtf8(const wchar_t* str, int num_chars) {
- if (num_chars == -1)
- num_chars = static_cast<int>(wcslen(str));
-
- ::std::stringstream stream;
- for (int i = 0; i < num_chars; ++i) {
- UInt32 unicode_code_point;
-
- if (str[i] == L'\0') {
- break;
- } else if (i + 1 < num_chars && IsUtf16SurrogatePair(str[i], str[i + 1])) {
- unicode_code_point = CreateCodePointFromUtf16SurrogatePair(str[i],
- str[i + 1]);
- i++;
- } else {
- unicode_code_point = static_cast<UInt32>(str[i]);
- }
-
- stream << CodePointToUtf8(unicode_code_point);
- }
- return StringStreamToString(&stream);
-}
-
-// Converts a wide C string to an std::string using the UTF-8 encoding.
-// NULL will be converted to "(null)".
-std::string String::ShowWideCString(const wchar_t * wide_c_str) {
- if (wide_c_str == NULL) return "(null)";
-
- return internal::WideStringToUtf8(wide_c_str, -1);
-}
-
-// Compares two wide C strings. Returns true iff they have the same
-// content.
-//
-// Unlike wcscmp(), this function can handle NULL argument(s). A NULL
-// C string is considered different to any non-NULL C string,
-// including the empty string.
-bool String::WideCStringEquals(const wchar_t * lhs, const wchar_t * rhs) {
- if (lhs == NULL) return rhs == NULL;
-
- if (rhs == NULL) return false;
-
- return wcscmp(lhs, rhs) == 0;
-}
-
-// Helper function for *_STREQ on wide strings.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const wchar_t* expected,
- const wchar_t* actual) {
- if (String::WideCStringEquals(expected, actual)) {
- return AssertionSuccess();
- }
-
- return EqFailure(expected_expression,
- actual_expression,
- PrintToString(expected),
- PrintToString(actual),
- false);
-}
-
-// Helper function for *_STRNE on wide strings.
-AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const wchar_t* s1,
- const wchar_t* s2) {
- if (!String::WideCStringEquals(s1, s2)) {
- return AssertionSuccess();
- }
-
- return AssertionFailure() << "Expected: (" << s1_expression << ") != ("
- << s2_expression << "), actual: "
- << PrintToString(s1)
- << " vs " << PrintToString(s2);
-}
-
-// Compares two C strings, ignoring case. Returns true iff they have
-// the same content.
-//
-// Unlike strcasecmp(), this function can handle NULL argument(s). A
-// NULL C string is considered different to any non-NULL C string,
-// including the empty string.
-bool String::CaseInsensitiveCStringEquals(const char * lhs, const char * rhs) {
- if (lhs == NULL)
- return rhs == NULL;
- if (rhs == NULL)
- return false;
- return posix::StrCaseCmp(lhs, rhs) == 0;
-}
-
- // Compares two wide C strings, ignoring case. Returns true iff they
- // have the same content.
- //
- // Unlike wcscasecmp(), this function can handle NULL argument(s).
- // A NULL C string is considered different to any non-NULL wide C string,
- // including the empty string.
- // NB: The implementations on different platforms slightly differ.
- // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
- // environment variable. On GNU platform this method uses wcscasecmp
- // which compares according to LC_CTYPE category of the current locale.
- // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
- // current locale.
-bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
- const wchar_t* rhs) {
- if (lhs == NULL) return rhs == NULL;
-
- if (rhs == NULL) return false;
-
-#if GTEST_OS_WINDOWS
- return _wcsicmp(lhs, rhs) == 0;
-#elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID
- return wcscasecmp(lhs, rhs) == 0;
-#else
- // Android, Mac OS X and Cygwin don't define wcscasecmp.
- // Other unknown OSes may not define it either.
- wint_t left, right;
- do {
- left = towlower(*lhs++);
- right = towlower(*rhs++);
- } while (left && left == right);
- return left == right;
-#endif // OS selector
-}
-
-// Returns true iff str ends with the given suffix, ignoring case.
-// Any string is considered to end with an empty suffix.
-bool String::EndsWithCaseInsensitive(
- const std::string& str, const std::string& suffix) {
- const size_t str_len = str.length();
- const size_t suffix_len = suffix.length();
- return (str_len >= suffix_len) &&
- CaseInsensitiveCStringEquals(str.c_str() + str_len - suffix_len,
- suffix.c_str());
-}
-
-// Formats an int value as "%02d".
-std::string String::FormatIntWidth2(int value) {
- std::stringstream ss;
- ss << std::setfill('0') << std::setw(2) << value;
- return ss.str();
-}
-
-// Formats an int value as "%X".
-std::string String::FormatHexInt(int value) {
- std::stringstream ss;
- ss << std::hex << std::uppercase << value;
- return ss.str();
-}
-
-// Formats a byte as "%02X".
-std::string String::FormatByte(unsigned char value) {
- std::stringstream ss;
- ss << std::setfill('0') << std::setw(2) << std::hex << std::uppercase
- << static_cast<unsigned int>(value);
- return ss.str();
-}
-
-// Converts the buffer in a stringstream to an std::string, converting NUL
-// bytes to "\\0" along the way.
-std::string StringStreamToString(::std::stringstream* ss) {
- const ::std::string& str = ss->str();
- const char* const start = str.c_str();
- const char* const end = start + str.length();
-
- std::string result;
- result.reserve(2 * (end - start));
- for (const char* ch = start; ch != end; ++ch) {
- if (*ch == '\0') {
- result += "\\0"; // Replaces NUL with "\\0";
- } else {
- result += *ch;
- }
- }
-
- return result;
-}
-
-// Appends the user-supplied message to the Google-Test-generated message.
-std::string AppendUserMessage(const std::string& gtest_msg,
- const Message& user_msg) {
- // Appends the user message if it's non-empty.
- const std::string user_msg_string = user_msg.GetString();
- if (user_msg_string.empty()) {
- return gtest_msg;
- }
-
- return gtest_msg + "\n" + user_msg_string;
-}
-
-} // namespace internal
-
-// class TestResult
-
-// Creates an empty TestResult.
-TestResult::TestResult()
- : death_test_count_(0),
- elapsed_time_(0) {
-}
-
-// D'tor.
-TestResult::~TestResult() {
-}
-
-// Returns the i-th test part result among all the results. i can
-// range from 0 to total_part_count() - 1. If i is not in that range,
-// aborts the program.
-const TestPartResult& TestResult::GetTestPartResult(int i) const {
- if (i < 0 || i >= total_part_count())
- internal::posix::Abort();
- return test_part_results_.at(i);
-}
-
-// Returns the i-th test property. i can range from 0 to
-// test_property_count() - 1. If i is not in that range, aborts the
-// program.
-const TestProperty& TestResult::GetTestProperty(int i) const {
- if (i < 0 || i >= test_property_count())
- internal::posix::Abort();
- return test_properties_.at(i);
-}
-
-// Clears the test part results.
-void TestResult::ClearTestPartResults() {
- test_part_results_.clear();
-}
-
-// Adds a test part result to the list.
-void TestResult::AddTestPartResult(const TestPartResult& test_part_result) {
- test_part_results_.push_back(test_part_result);
-}
-
-// Adds a test property to the list. If a property with the same key as the
-// supplied property is already represented, the value of this test_property
-// replaces the old value for that key.
-void TestResult::RecordProperty(const std::string& xml_element,
- const TestProperty& test_property) {
- if (!ValidateTestProperty(xml_element, test_property)) {
- return;
- }
- internal::MutexLock lock(&test_properites_mutex_);
- const std::vector<TestProperty>::iterator property_with_matching_key =
- std::find_if(test_properties_.begin(), test_properties_.end(),
- internal::TestPropertyKeyIs(test_property.key()));
- if (property_with_matching_key == test_properties_.end()) {
- test_properties_.push_back(test_property);
- return;
- }
- property_with_matching_key->SetValue(test_property.value());
-}
-
-// The list of reserved attributes used in the <testsuites> element of XML
-// output.
-static const char* const kReservedTestSuitesAttributes[] = {
- "disabled",
- "errors",
- "failures",
- "name",
- "random_seed",
- "tests",
- "time",
- "timestamp"
-};
-
-// The list of reserved attributes used in the <testsuite> element of XML
-// output.
-static const char* const kReservedTestSuiteAttributes[] = {
- "disabled",
- "errors",
- "failures",
- "name",
- "tests",
- "time"
-};
-
-// The list of reserved attributes used in the <testcase> element of XML output.
-static const char* const kReservedTestCaseAttributes[] = {
- "classname",
- "name",
- "status",
- "time",
- "type_param",
- "value_param"
-};
-
-template <int kSize>
-std::vector<std::string> ArrayAsVector(const char* const (&array)[kSize]) {
- return std::vector<std::string>(array, array + kSize);
-}
-
-static std::vector<std::string> GetReservedAttributesForElement(
- const std::string& xml_element) {
- if (xml_element == "testsuites") {
- return ArrayAsVector(kReservedTestSuitesAttributes);
- } else if (xml_element == "testsuite") {
- return ArrayAsVector(kReservedTestSuiteAttributes);
- } else if (xml_element == "testcase") {
- return ArrayAsVector(kReservedTestCaseAttributes);
- } else {
- GTEST_CHECK_(false) << "Unrecognized xml_element provided: " << xml_element;
- }
- // This code is unreachable but some compilers may not realizes that.
- return std::vector<std::string>();
-}
-
-static std::string FormatWordList(const std::vector<std::string>& words) {
- Message word_list;
- for (size_t i = 0; i < words.size(); ++i) {
- if (i > 0 && words.size() > 2) {
- word_list << ", ";
- }
- if (i == words.size() - 1) {
- word_list << "and ";
- }
- word_list << "'" << words[i] << "'";
- }
- return word_list.GetString();
-}
-
-bool ValidateTestPropertyName(const std::string& property_name,
- const std::vector<std::string>& reserved_names) {
- if (std::find(reserved_names.begin(), reserved_names.end(), property_name) !=
- reserved_names.end()) {
- ADD_FAILURE() << "Reserved key used in RecordProperty(): " << property_name
- << " (" << FormatWordList(reserved_names)
- << " are reserved by " << GTEST_NAME_ << ")";
- return false;
- }
- return true;
-}
-
-// Adds a failure if the key is a reserved attribute of the element named
-// xml_element. Returns true if the property is valid.
-bool TestResult::ValidateTestProperty(const std::string& xml_element,
- const TestProperty& test_property) {
- return ValidateTestPropertyName(test_property.key(),
- GetReservedAttributesForElement(xml_element));
-}
-
-// Clears the object.
-void TestResult::Clear() {
- test_part_results_.clear();
- test_properties_.clear();
- death_test_count_ = 0;
- elapsed_time_ = 0;
-}
-
-// Returns true iff the test failed.
-bool TestResult::Failed() const {
- for (int i = 0; i < total_part_count(); ++i) {
- if (GetTestPartResult(i).failed())
- return true;
- }
- return false;
-}
-
-// Returns true iff the test part fatally failed.
-static bool TestPartFatallyFailed(const TestPartResult& result) {
- return result.fatally_failed();
-}
-
-// Returns true iff the test fatally failed.
-bool TestResult::HasFatalFailure() const {
- return CountIf(test_part_results_, TestPartFatallyFailed) > 0;
-}
-
-// Returns true iff the test part non-fatally failed.
-static bool TestPartNonfatallyFailed(const TestPartResult& result) {
- return result.nonfatally_failed();
-}
-
-// Returns true iff the test has a non-fatal failure.
-bool TestResult::HasNonfatalFailure() const {
- return CountIf(test_part_results_, TestPartNonfatallyFailed) > 0;
-}
-
-// Gets the number of all test parts. This is the sum of the number
-// of successful test parts and the number of failed test parts.
-int TestResult::total_part_count() const {
- return static_cast<int>(test_part_results_.size());
-}
-
-// Returns the number of the test properties.
-int TestResult::test_property_count() const {
- return static_cast<int>(test_properties_.size());
-}
-
-// class Test
-
-// Creates a Test object.
-
-// The c'tor saves the values of all Google Test flags.
-Test::Test()
- : gtest_flag_saver_(new internal::GTestFlagSaver) {
-}
-
-// The d'tor restores the values of all Google Test flags.
-Test::~Test() {
- delete gtest_flag_saver_;
-}
-
-// Sets up the test fixture.
-//
-// A sub-class may override this.
-void Test::SetUp() {
-}
-
-// Tears down the test fixture.
-//
-// A sub-class may override this.
-void Test::TearDown() {
-}
-
-// Allows user supplied key value pairs to be recorded for later output.
-void Test::RecordProperty(const std::string& key, const std::string& value) {
- UnitTest::GetInstance()->RecordProperty(key, value);
-}
-
-// Allows user supplied key value pairs to be recorded for later output.
-void Test::RecordProperty(const std::string& key, int value) {
- Message value_message;
- value_message << value;
- RecordProperty(key, value_message.GetString().c_str());
-}
-
-namespace internal {
-
-void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
- const std::string& message) {
- // This function is a friend of UnitTest and as such has access to
- // AddTestPartResult.
- UnitTest::GetInstance()->AddTestPartResult(
- result_type,
- NULL, // No info about the source file where the exception occurred.
- -1, // We have no info on which line caused the exception.
- message,
- ""); // No stack trace, either.
-}
-
-} // namespace internal
-
-// Google Test requires all tests in the same test case to use the same test
-// fixture class. This function checks if the current test has the
-// same fixture class as the first test in the current test case. If
-// yes, it returns true; otherwise it generates a Google Test failure and
-// returns false.
-bool Test::HasSameFixtureClass() {
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- const TestCase* const test_case = impl->current_test_case();
-
- // Info about the first test in the current test case.
- const TestInfo* const first_test_info = test_case->test_info_list()[0];
- const internal::TypeId first_fixture_id = first_test_info->fixture_class_id_;
- const char* const first_test_name = first_test_info->name();
-
- // Info about the current test.
- const TestInfo* const this_test_info = impl->current_test_info();
- const internal::TypeId this_fixture_id = this_test_info->fixture_class_id_;
- const char* const this_test_name = this_test_info->name();
-
- if (this_fixture_id != first_fixture_id) {
- // Is the first test defined using TEST?
- const bool first_is_TEST = first_fixture_id == internal::GetTestTypeId();
- // Is this test defined using TEST?
- const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId();
-
- if (first_is_TEST || this_is_TEST) {
- // The user mixed TEST and TEST_F in this test case - we'll tell
- // him/her how to fix it.
-
- // Gets the name of the TEST and the name of the TEST_F. Note
- // that first_is_TEST and this_is_TEST cannot both be true, as
- // the fixture IDs are different for the two tests.
- const char* const TEST_name =
- first_is_TEST ? first_test_name : this_test_name;
- const char* const TEST_F_name =
- first_is_TEST ? this_test_name : first_test_name;
-
- ADD_FAILURE()
- << "All tests in the same test case must use the same test fixture\n"
- << "class, so mixing TEST_F and TEST in the same test case is\n"
- << "illegal. In test case " << this_test_info->test_case_name()
- << ",\n"
- << "test " << TEST_F_name << " is defined using TEST_F but\n"
- << "test " << TEST_name << " is defined using TEST. You probably\n"
- << "want to change the TEST to TEST_F or move it to another test\n"
- << "case.";
- } else {
- // The user defined two fixture classes with the same name in
- // two namespaces - we'll tell him/her how to fix it.
- ADD_FAILURE()
- << "All tests in the same test case must use the same test fixture\n"
- << "class. However, in test case "
- << this_test_info->test_case_name() << ",\n"
- << "you defined test " << first_test_name
- << " and test " << this_test_name << "\n"
- << "using two different test fixture classes. This can happen if\n"
- << "the two classes are from different namespaces or translation\n"
- << "units and have the same name. You should probably rename one\n"
- << "of the classes to put the tests into different test cases.";
- }
- return false;
- }
-
- return true;
-}
-
-#if GTEST_HAS_SEH
-
-// Adds an "exception thrown" fatal failure to the current test. This
-// function returns its result via an output parameter pointer because VC++
-// prohibits creation of objects with destructors on stack in functions
-// using __try (see error C2712).
-static std::string* FormatSehExceptionMessage(DWORD exception_code,
- const char* location) {
- Message message;
- message << "SEH exception with code 0x" << std::setbase(16) <<
- exception_code << std::setbase(10) << " thrown in " << location << ".";
-
- return new std::string(message.GetString());
-}
-
-#endif // GTEST_HAS_SEH
-
-namespace internal {
-
-#if GTEST_HAS_EXCEPTIONS
-
-// Adds an "exception thrown" fatal failure to the current test.
-static std::string FormatCxxExceptionMessage(const char* description,
- const char* location) {
- Message message;
- if (description != NULL) {
- message << "C++ exception with description \"" << description << "\"";
- } else {
- message << "Unknown C++ exception";
- }
- message << " thrown in " << location << ".";
-
- return message.GetString();
-}
-
-static std::string PrintTestPartResultToString(
- const TestPartResult& test_part_result);
-
-GoogleTestFailureException::GoogleTestFailureException(
- const TestPartResult& failure)
- : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {}
-
-#endif // GTEST_HAS_EXCEPTIONS
-
-// We put these helper functions in the internal namespace as IBM's xlC
-// compiler rejects the code if they were declared static.
-
-// Runs the given method and handles SEH exceptions it throws, when
-// SEH is supported; returns the 0-value for type Result in case of an
-// SEH exception. (Microsoft compilers cannot handle SEH and C++
-// exceptions in the same function. Therefore, we provide a separate
-// wrapper function for handling SEH exceptions.)
-template <class T, typename Result>
-Result HandleSehExceptionsInMethodIfSupported(
- T* object, Result (T::*method)(), const char* location) {
-#if GTEST_HAS_SEH
- __try {
- return (object->*method)();
- } __except (internal::UnitTestOptions::GTestShouldProcessSEH( // NOLINT
- GetExceptionCode())) {
- // We create the exception message on the heap because VC++ prohibits
- // creation of objects with destructors on stack in functions using __try
- // (see error C2712).
- std::string* exception_message = FormatSehExceptionMessage(
- GetExceptionCode(), location);
- internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure,
- *exception_message);
- delete exception_message;
- return static_cast<Result>(0);
- }
-#else
- (void)location;
- return (object->*method)();
-#endif // GTEST_HAS_SEH
-}
-
-// Runs the given method and catches and reports C++ and/or SEH-style
-// exceptions, if they are supported; returns the 0-value for type
-// Result in case of an SEH exception.
-template <class T, typename Result>
-Result HandleExceptionsInMethodIfSupported(
- T* object, Result (T::*method)(), const char* location) {
- // NOTE: The user code can affect the way in which Google Test handles
- // exceptions by setting GTEST_FLAG(catch_exceptions), but only before
- // RUN_ALL_TESTS() starts. It is technically possible to check the flag
- // after the exception is caught and either report or re-throw the
- // exception based on the flag's value:
- //
- // try {
- // // Perform the test method.
- // } catch (...) {
- // if (GTEST_FLAG(catch_exceptions))
- // // Report the exception as failure.
- // else
- // throw; // Re-throws the original exception.
- // }
- //
- // However, the purpose of this flag is to allow the program to drop into
- // the debugger when the exception is thrown. On most platforms, once the
- // control enters the catch block, the exception origin information is
- // lost and the debugger will stop the program at the point of the
- // re-throw in this function -- instead of at the point of the original
- // throw statement in the code under test. For this reason, we perform
- // the check early, sacrificing the ability to affect Google Test's
- // exception handling in the method where the exception is thrown.
- if (internal::GetUnitTestImpl()->catch_exceptions()) {
-#if GTEST_HAS_EXCEPTIONS
- try {
- return HandleSehExceptionsInMethodIfSupported(object, method, location);
- } catch (const internal::GoogleTestFailureException&) { // NOLINT
- // This exception type can only be thrown by a failed Google
- // Test assertion with the intention of letting another testing
- // framework catch it. Therefore we just re-throw it.
- throw;
- } catch (const std::exception& e) { // NOLINT
- internal::ReportFailureInUnknownLocation(
- TestPartResult::kFatalFailure,
- FormatCxxExceptionMessage(e.what(), location));
- } catch (...) { // NOLINT
- internal::ReportFailureInUnknownLocation(
- TestPartResult::kFatalFailure,
- FormatCxxExceptionMessage(NULL, location));
- }
- return static_cast<Result>(0);
-#else
- return HandleSehExceptionsInMethodIfSupported(object, method, location);
-#endif // GTEST_HAS_EXCEPTIONS
- } else {
- return (object->*method)();
- }
-}
-
-} // namespace internal
-
-// Runs the test and updates the test result.
-void Test::Run() {
- if (!HasSameFixtureClass()) return;
-
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, "SetUp()");
- // We will run the test only if SetUp() was successful.
- if (!HasFatalFailure()) {
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- this, &Test::TestBody, "the test body");
- }
-
- // However, we want to clean up as much as possible. Hence we will
- // always call TearDown(), even if SetUp() or the test body has
- // failed.
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- this, &Test::TearDown, "TearDown()");
-}
-
-// Returns true iff the current test has a fatal failure.
-bool Test::HasFatalFailure() {
- return internal::GetUnitTestImpl()->current_test_result()->HasFatalFailure();
-}
-
-// Returns true iff the current test has a non-fatal failure.
-bool Test::HasNonfatalFailure() {
- return internal::GetUnitTestImpl()->current_test_result()->
- HasNonfatalFailure();
-}
-
-// class TestInfo
-
-// Constructs a TestInfo object. It assumes ownership of the test factory
-// object.
-TestInfo::TestInfo(const std::string& a_test_case_name,
- const std::string& a_name,
- const char* a_type_param,
- const char* a_value_param,
- internal::TypeId fixture_class_id,
- internal::TestFactoryBase* factory)
- : test_case_name_(a_test_case_name),
- name_(a_name),
- type_param_(a_type_param ? new std::string(a_type_param) : NULL),
- value_param_(a_value_param ? new std::string(a_value_param) : NULL),
- fixture_class_id_(fixture_class_id),
- should_run_(false),
- is_disabled_(false),
- matches_filter_(false),
- factory_(factory),
- result_() {}
-
-// Destructs a TestInfo object.
-TestInfo::~TestInfo() { delete factory_; }
-
-namespace internal {
-
-// Creates a new TestInfo object and registers it with Google Test;
-// returns the created object.
-//
-// Arguments:
-//
-// test_case_name: name of the test case
-// name: name of the test
-// type_param: the name of the test's type parameter, or NULL if
-// this is not a typed or a type-parameterized test.
-// value_param: text representation of the test's value parameter,
-// or NULL if this is not a value-parameterized test.
-// fixture_class_id: ID of the test fixture class
-// set_up_tc: pointer to the function that sets up the test case
-// tear_down_tc: pointer to the function that tears down the test case
-// factory: pointer to the factory that creates a test object.
-// The newly created TestInfo instance will assume
-// ownership of the factory object.
-TestInfo* MakeAndRegisterTestInfo(
- const char* test_case_name,
- const char* name,
- const char* type_param,
- const char* value_param,
- TypeId fixture_class_id,
- SetUpTestCaseFunc set_up_tc,
- TearDownTestCaseFunc tear_down_tc,
- TestFactoryBase* factory) {
- TestInfo* const test_info =
- new TestInfo(test_case_name, name, type_param, value_param,
- fixture_class_id, factory);
- GetUnitTestImpl()->AddTestInfo(set_up_tc, tear_down_tc, test_info);
- return test_info;
-}
-
-#if GTEST_HAS_PARAM_TEST
-void ReportInvalidTestCaseType(const char* test_case_name,
- const char* file, int line) {
- Message errors;
- errors
- << "Attempted redefinition of test case " << test_case_name << ".\n"
- << "All tests in the same test case must use the same test fixture\n"
- << "class. However, in test case " << test_case_name << ", you tried\n"
- << "to define a test using a fixture class different from the one\n"
- << "used earlier. This can happen if the two fixture classes are\n"
- << "from different namespaces and have the same name. You should\n"
- << "probably rename one of the classes to put the tests into different\n"
- << "test cases.";
-
- fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
- errors.GetString().c_str());
-}
-#endif // GTEST_HAS_PARAM_TEST
-
-} // namespace internal
-
-namespace {
-
-// A predicate that checks the test name of a TestInfo against a known
-// value.
-//
-// This is used for implementation of the TestCase class only. We put
-// it in the anonymous namespace to prevent polluting the outer
-// namespace.
-//
-// TestNameIs is copyable.
-class TestNameIs {
- public:
- // Constructor.
- //
- // TestNameIs has NO default constructor.
- explicit TestNameIs(const char* name)
- : name_(name) {}
-
- // Returns true iff the test name of test_info matches name_.
- bool operator()(const TestInfo * test_info) const {
- return test_info && test_info->name() == name_;
- }
-
- private:
- std::string name_;
-};
-
-} // namespace
-
-namespace internal {
-
-// This method expands all parameterized tests registered with macros TEST_P
-// and INSTANTIATE_TEST_CASE_P into regular tests and registers those.
-// This will be done just once during the program runtime.
-void UnitTestImpl::RegisterParameterizedTests() {
-#if GTEST_HAS_PARAM_TEST
- if (!parameterized_tests_registered_) {
- parameterized_test_registry_.RegisterTests();
- parameterized_tests_registered_ = true;
- }
-#endif
-}
-
-} // namespace internal
-
-// Creates the test object, runs it, records its result, and then
-// deletes it.
-void TestInfo::Run() {
- if (!should_run_) return;
-
- // Tells UnitTest where to store test result.
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- impl->set_current_test_info(this);
-
- TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
-
- // Notifies the unit test event listeners that a test is about to start.
- repeater->OnTestStart(*this);
-
- const TimeInMillis start = internal::GetTimeInMillis();
-
- impl->os_stack_trace_getter()->UponLeavingGTest();
-
- // Creates the test object.
- Test* const test = internal::HandleExceptionsInMethodIfSupported(
- factory_, &internal::TestFactoryBase::CreateTest,
- "the test fixture's constructor");
-
- // Runs the test only if the test object was created and its
- // constructor didn't generate a fatal failure.
- if ((test != NULL) && !Test::HasFatalFailure()) {
- // This doesn't throw as all user code that can throw are wrapped into
- // exception handling code.
- test->Run();
- }
-
- // Deletes the test object.
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- test, &Test::DeleteSelf_, "the test fixture's destructor");
-
- result_.set_elapsed_time(internal::GetTimeInMillis() - start);
-
- // Notifies the unit test event listener that a test has just finished.
- repeater->OnTestEnd(*this);
-
- // Tells UnitTest to stop associating assertion results to this
- // test.
- impl->set_current_test_info(NULL);
-}
-
-// class TestCase
-
-// Gets the number of successful tests in this test case.
-int TestCase::successful_test_count() const {
- return CountIf(test_info_list_, TestPassed);
-}
-
-// Gets the number of failed tests in this test case.
-int TestCase::failed_test_count() const {
- return CountIf(test_info_list_, TestFailed);
-}
-
-// Gets the number of disabled tests that will be reported in the XML report.
-int TestCase::reportable_disabled_test_count() const {
- return CountIf(test_info_list_, TestReportableDisabled);
-}
-
-// Gets the number of disabled tests in this test case.
-int TestCase::disabled_test_count() const {
- return CountIf(test_info_list_, TestDisabled);
-}
-
-// Gets the number of tests to be printed in the XML report.
-int TestCase::reportable_test_count() const {
- return CountIf(test_info_list_, TestReportable);
-}
-
-// Get the number of tests in this test case that should run.
-int TestCase::test_to_run_count() const {
- return CountIf(test_info_list_, ShouldRunTest);
-}
-
-// Gets the number of all tests.
-int TestCase::total_test_count() const {
- return static_cast<int>(test_info_list_.size());
-}
-
-// Creates a TestCase with the given name.
-//
-// Arguments:
-//
-// name: name of the test case
-// a_type_param: the name of the test case's type parameter, or NULL if
-// this is not a typed or a type-parameterized test case.
-// set_up_tc: pointer to the function that sets up the test case
-// tear_down_tc: pointer to the function that tears down the test case
-TestCase::TestCase(const char* a_name, const char* a_type_param,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc)
- : name_(a_name),
- type_param_(a_type_param ? new std::string(a_type_param) : NULL),
- set_up_tc_(set_up_tc),
- tear_down_tc_(tear_down_tc),
- should_run_(false),
- elapsed_time_(0) {
-}
-
-// Destructor of TestCase.
-TestCase::~TestCase() {
- // Deletes every Test in the collection.
- ForEach(test_info_list_, internal::Delete<TestInfo>);
-}
-
-// Returns the i-th test among all the tests. i can range from 0 to
-// total_test_count() - 1. If i is not in that range, returns NULL.
-const TestInfo* TestCase::GetTestInfo(int i) const {
- const int index = GetElementOr(test_indices_, i, -1);
- return index < 0 ? NULL : test_info_list_[index];
-}
-
-// Returns the i-th test among all the tests. i can range from 0 to
-// total_test_count() - 1. If i is not in that range, returns NULL.
-TestInfo* TestCase::GetMutableTestInfo(int i) {
- const int index = GetElementOr(test_indices_, i, -1);
- return index < 0 ? NULL : test_info_list_[index];
-}
-
-// Adds a test to this test case. Will delete the test upon
-// destruction of the TestCase object.
-void TestCase::AddTestInfo(TestInfo * test_info) {
- test_info_list_.push_back(test_info);
- test_indices_.push_back(static_cast<int>(test_indices_.size()));
-}
-
-// Runs every test in this TestCase.
-void TestCase::Run() {
- if (!should_run_) return;
-
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- impl->set_current_test_case(this);
-
- TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
-
- repeater->OnTestCaseStart(*this);
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- this, &TestCase::RunSetUpTestCase, "SetUpTestCase()");
-
- const internal::TimeInMillis start = internal::GetTimeInMillis();
- for (int i = 0; i < total_test_count(); i++) {
- GetMutableTestInfo(i)->Run();
- }
- elapsed_time_ = internal::GetTimeInMillis() - start;
-
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- this, &TestCase::RunTearDownTestCase, "TearDownTestCase()");
-
- repeater->OnTestCaseEnd(*this);
- impl->set_current_test_case(NULL);
-}
-
-// Clears the results of all tests in this test case.
-void TestCase::ClearResult() {
- ad_hoc_test_result_.Clear();
- ForEach(test_info_list_, TestInfo::ClearTestResult);
-}
-
-// Shuffles the tests in this test case.
-void TestCase::ShuffleTests(internal::Random* random) {
- Shuffle(random, &test_indices_);
-}
-
-// Restores the test order to before the first shuffle.
-void TestCase::UnshuffleTests() {
- for (size_t i = 0; i < test_indices_.size(); i++) {
- test_indices_[i] = static_cast<int>(i);
- }
-}
-
-// Formats a countable noun. Depending on its quantity, either the
-// singular form or the plural form is used. e.g.
-//
-// FormatCountableNoun(1, "formula", "formuli") returns "1 formula".
-// FormatCountableNoun(5, "book", "books") returns "5 books".
-static std::string FormatCountableNoun(int count,
- const char * singular_form,
- const char * plural_form) {
- return internal::StreamableToString(count) + " " +
- (count == 1 ? singular_form : plural_form);
-}
-
-// Formats the count of tests.
-static std::string FormatTestCount(int test_count) {
- return FormatCountableNoun(test_count, "test", "tests");
-}
-
-// Formats the count of test cases.
-static std::string FormatTestCaseCount(int test_case_count) {
- return FormatCountableNoun(test_case_count, "test case", "test cases");
-}
-
-// Converts a TestPartResult::Type enum to human-friendly string
-// representation. Both kNonFatalFailure and kFatalFailure are translated
-// to "Failure", as the user usually doesn't care about the difference
-// between the two when viewing the test result.
-static const char * TestPartResultTypeToString(TestPartResult::Type type) {
- switch (type) {
- case TestPartResult::kSuccess:
- return "Success";
-
- case TestPartResult::kNonFatalFailure:
- case TestPartResult::kFatalFailure:
-#ifdef _MSC_VER
- return "error: ";
-#else
- return "Failure\n";
-#endif
- default:
- return "Unknown result type";
- }
-}
-
-namespace internal {
-
-// Prints a TestPartResult to an std::string.
-static std::string PrintTestPartResultToString(
- const TestPartResult& test_part_result) {
- return (Message()
- << internal::FormatFileLocation(test_part_result.file_name(),
- test_part_result.line_number())
- << " " << TestPartResultTypeToString(test_part_result.type())
- << test_part_result.message()).GetString();
-}
-
-// Prints a TestPartResult.
-static void PrintTestPartResult(const TestPartResult& test_part_result) {
- const std::string& result =
- PrintTestPartResultToString(test_part_result);
- printf("%s\n", result.c_str());
- fflush(stdout);
- // If the test program runs in Visual Studio or a debugger, the
- // following statements add the test part result message to the Output
- // window such that the user can double-click on it to jump to the
- // corresponding source code location; otherwise they do nothing.
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
- // We don't call OutputDebugString*() on Windows Mobile, as printing
- // to stdout is done by OutputDebugString() there already - we don't
- // want the same message printed twice.
- ::OutputDebugStringA(result.c_str());
- ::OutputDebugStringA("\n");
-#endif
-}
-
-// class PrettyUnitTestResultPrinter
-
-enum GTestColor {
- COLOR_DEFAULT,
- COLOR_RED,
- COLOR_GREEN,
- COLOR_YELLOW
-};
-
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
-
-// Returns the character attribute for the given color.
-WORD GetColorAttribute(GTestColor color) {
- switch (color) {
- case COLOR_RED: return FOREGROUND_RED;
- case COLOR_GREEN: return FOREGROUND_GREEN;
- case COLOR_YELLOW: return FOREGROUND_RED | FOREGROUND_GREEN;
- default: return 0;
- }
-}
-
-#else
-
-// Returns the ANSI color code for the given color. COLOR_DEFAULT is
-// an invalid input.
-const char* GetAnsiColorCode(GTestColor color) {
- switch (color) {
- case COLOR_RED: return "1";
- case COLOR_GREEN: return "2";
- case COLOR_YELLOW: return "3";
- default: return NULL;
- };
-}
-
-#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
-
-// Returns true iff Google Test should use colors in the output.
-bool ShouldUseColor(bool stdout_is_tty) {
- const char* const gtest_color = GTEST_FLAG(color).c_str();
-
- if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) {
-#if GTEST_OS_WINDOWS
- // On Windows the TERM variable is usually not set, but the
- // console there does support colors.
- return stdout_is_tty;
-#else
- // On non-Windows platforms, we rely on the TERM variable.
- const char* const term = posix::GetEnv("TERM");
- const bool term_supports_color =
- String::CStringEquals(term, "xterm") ||
- String::CStringEquals(term, "xterm-color") ||
- String::CStringEquals(term, "xterm-256color") ||
- String::CStringEquals(term, "screen") ||
- String::CStringEquals(term, "screen-256color") ||
- String::CStringEquals(term, "linux") ||
- String::CStringEquals(term, "cygwin");
- return stdout_is_tty && term_supports_color;
-#endif // GTEST_OS_WINDOWS
- }
-
- return String::CaseInsensitiveCStringEquals(gtest_color, "yes") ||
- String::CaseInsensitiveCStringEquals(gtest_color, "true") ||
- String::CaseInsensitiveCStringEquals(gtest_color, "t") ||
- String::CStringEquals(gtest_color, "1");
- // We take "yes", "true", "t", and "1" as meaning "yes". If the
- // value is neither one of these nor "auto", we treat it as "no" to
- // be conservative.
-}
-
-// Helpers for printing colored strings to stdout. Note that on Windows, we
-// cannot simply emit special characters and have the terminal change colors.
-// This routine must actually emit the characters rather than return a string
-// that would be colored when printed, as can be done on Linux.
-void ColoredPrintf(GTestColor color, const char* fmt, ...) {
- va_list args;
- va_start(args, fmt);
-
-#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS || GTEST_OS_IOS
- const bool use_color = false;
-#else
- static const bool in_color_mode =
- ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0);
- const bool use_color = in_color_mode && (color != COLOR_DEFAULT);
-#endif // GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS
- // The '!= 0' comparison is necessary to satisfy MSVC 7.1.
-
- if (!use_color) {
- vprintf(fmt, args);
- va_end(args);
- return;
- }
-
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
- const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
-
- // Gets the current text color.
- CONSOLE_SCREEN_BUFFER_INFO buffer_info;
- GetConsoleScreenBufferInfo(stdout_handle, &buffer_info);
- const WORD old_color_attrs = buffer_info.wAttributes;
-
- // We need to flush the stream buffers into the console before each
- // SetConsoleTextAttribute call lest it affect the text that is already
- // printed but has not yet reached the console.
- fflush(stdout);
- SetConsoleTextAttribute(stdout_handle,
- GetColorAttribute(color) | FOREGROUND_INTENSITY);
- vprintf(fmt, args);
-
- fflush(stdout);
- // Restores the text color.
- SetConsoleTextAttribute(stdout_handle, old_color_attrs);
-#else
- printf("\033[0;3%sm", GetAnsiColorCode(color));
- vprintf(fmt, args);
- printf("\033[m"); // Resets the terminal to default.
-#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
- va_end(args);
-}
-
-// Text printed in Google Test's text output and --gunit_list_tests
-// output to label the type parameter and value parameter for a test.
-static const char kTypeParamLabel[] = "TypeParam";
-static const char kValueParamLabel[] = "GetParam()";
-
-void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
- const char* const type_param = test_info.type_param();
- const char* const value_param = test_info.value_param();
-
- if (type_param != NULL || value_param != NULL) {
- printf(", where ");
- if (type_param != NULL) {
- printf("%s = %s", kTypeParamLabel, type_param);
- if (value_param != NULL)
- printf(" and ");
- }
- if (value_param != NULL) {
- printf("%s = %s", kValueParamLabel, value_param);
- }
- }
-}
-
-// This class implements the TestEventListener interface.
-//
-// Class PrettyUnitTestResultPrinter is copyable.
-class PrettyUnitTestResultPrinter : public TestEventListener {
- public:
- PrettyUnitTestResultPrinter() {}
- static void PrintTestName(const char * test_case, const char * test) {
- printf("%s.%s", test_case, test);
- }
-
- // The following methods override what's in the TestEventListener class.
- virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
- virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);
- virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
- virtual void OnTestCaseStart(const TestCase& test_case);
- virtual void OnTestStart(const TestInfo& test_info);
- virtual void OnTestPartResult(const TestPartResult& result);
- virtual void OnTestEnd(const TestInfo& test_info);
- virtual void OnTestCaseEnd(const TestCase& test_case);
- virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
- virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
- virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
-
- private:
- static void PrintFailedTests(const UnitTest& unit_test);
-};
-
- // Fired before each iteration of tests starts.
-void PrettyUnitTestResultPrinter::OnTestIterationStart(
- const UnitTest& unit_test, int iteration) {
- if (GTEST_FLAG(repeat) != 1)
- printf("\nRepeating all tests (iteration %d) . . .\n\n", iteration + 1);
-
- const char* const filter = GTEST_FLAG(filter).c_str();
-
- // Prints the filter if it's not *. This reminds the user that some
- // tests may be skipped.
- if (!String::CStringEquals(filter, kUniversalFilter)) {
- ColoredPrintf(COLOR_YELLOW,
- "Note: %s filter = %s\n", GTEST_NAME_, filter);
- }
-
- if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) {
- const Int32 shard_index = Int32FromEnvOrDie(kTestShardIndex, -1);
- ColoredPrintf(COLOR_YELLOW,
- "Note: This is test shard %d of %s.\n",
- static_cast<int>(shard_index) + 1,
- internal::posix::GetEnv(kTestTotalShards));
- }
-
- if (GTEST_FLAG(shuffle)) {
- ColoredPrintf(COLOR_YELLOW,
- "Note: Randomizing tests' orders with a seed of %d .\n",
- unit_test.random_seed());
- }
-
- ColoredPrintf(COLOR_GREEN, "[==========] ");
- printf("Running %s from %s.\n",
- FormatTestCount(unit_test.test_to_run_count()).c_str(),
- FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart(
- const UnitTest& /*unit_test*/) {
- ColoredPrintf(COLOR_GREEN, "[----------] ");
- printf("Global test environment set-up.\n");
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {
- const std::string counts =
- FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
- ColoredPrintf(COLOR_GREEN, "[----------] ");
- printf("%s from %s", counts.c_str(), test_case.name());
- if (test_case.type_param() == NULL) {
- printf("\n");
- } else {
- printf(", where %s = %s\n", kTypeParamLabel, test_case.type_param());
- }
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) {
- ColoredPrintf(COLOR_GREEN, "[ RUN ] ");
- PrintTestName(test_info.test_case_name(), test_info.name());
- printf("\n");
- fflush(stdout);
-}
-
-// Called after an assertion failure.
-void PrettyUnitTestResultPrinter::OnTestPartResult(
- const TestPartResult& result) {
- // If the test part succeeded, we don't need to do anything.
- if (result.type() == TestPartResult::kSuccess)
- return;
-
- // Print failure message from the assertion (e.g. expected this and got that).
- PrintTestPartResult(result);
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
- if (test_info.result()->Passed()) {
- ColoredPrintf(COLOR_GREEN, "[ OK ] ");
- } else {
- ColoredPrintf(COLOR_RED, "[ FAILED ] ");
- }
- PrintTestName(test_info.test_case_name(), test_info.name());
- if (test_info.result()->Failed())
- PrintFullTestCommentIfPresent(test_info);
-
- if (GTEST_FLAG(print_time)) {
- printf(" (%s ms)\n", internal::StreamableToString(
- test_info.result()->elapsed_time()).c_str());
- } else {
- printf("\n");
- }
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) {
- if (!GTEST_FLAG(print_time)) return;
-
- const std::string counts =
- FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
- ColoredPrintf(COLOR_GREEN, "[----------] ");
- printf("%s from %s (%s ms total)\n\n",
- counts.c_str(), test_case.name(),
- internal::StreamableToString(test_case.elapsed_time()).c_str());
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnEnvironmentsTearDownStart(
- const UnitTest& /*unit_test*/) {
- ColoredPrintf(COLOR_GREEN, "[----------] ");
- printf("Global test environment tear-down\n");
- fflush(stdout);
-}
-
-// Internal helper for printing the list of failed tests.
-void PrettyUnitTestResultPrinter::PrintFailedTests(const UnitTest& unit_test) {
- const int failed_test_count = unit_test.failed_test_count();
- if (failed_test_count == 0) {
- return;
- }
-
- for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
- const TestCase& test_case = *unit_test.GetTestCase(i);
- if (!test_case.should_run() || (test_case.failed_test_count() == 0)) {
- continue;
- }
- for (int j = 0; j < test_case.total_test_count(); ++j) {
- const TestInfo& test_info = *test_case.GetTestInfo(j);
- if (!test_info.should_run() || test_info.result()->Passed()) {
- continue;
- }
- ColoredPrintf(COLOR_RED, "[ FAILED ] ");
- printf("%s.%s", test_case.name(), test_info.name());
- PrintFullTestCommentIfPresent(test_info);
- printf("\n");
- }
- }
-}
-
-void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
- int /*iteration*/) {
- ColoredPrintf(COLOR_GREEN, "[==========] ");
- printf("%s from %s ran.",
- FormatTestCount(unit_test.test_to_run_count()).c_str(),
- FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());
- if (GTEST_FLAG(print_time)) {
- printf(" (%s ms total)",
- internal::StreamableToString(unit_test.elapsed_time()).c_str());
- }
- printf("\n");
- ColoredPrintf(COLOR_GREEN, "[ PASSED ] ");
- printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str());
-
- int num_failures = unit_test.failed_test_count();
- if (!unit_test.Passed()) {
- const int failed_test_count = unit_test.failed_test_count();
- ColoredPrintf(COLOR_RED, "[ FAILED ] ");
- printf("%s, listed below:\n", FormatTestCount(failed_test_count).c_str());
- PrintFailedTests(unit_test);
- printf("\n%2d FAILED %s\n", num_failures,
- num_failures == 1 ? "TEST" : "TESTS");
- }
-
- int num_disabled = unit_test.reportable_disabled_test_count();
- if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) {
- if (!num_failures) {
- printf("\n"); // Add a spacer if no FAILURE banner is displayed.
- }
- ColoredPrintf(COLOR_YELLOW,
- " YOU HAVE %d DISABLED %s\n\n",
- num_disabled,
- num_disabled == 1 ? "TEST" : "TESTS");
- }
- // Ensure that Google Test output is printed before, e.g., heapchecker output.
- fflush(stdout);
-}
-
-// End PrettyUnitTestResultPrinter
-
-// class TestEventRepeater
-//
-// This class forwards events to other event listeners.
-class TestEventRepeater : public TestEventListener {
- public:
- TestEventRepeater() : forwarding_enabled_(true) {}
- virtual ~TestEventRepeater();
- void Append(TestEventListener *listener);
- TestEventListener* Release(TestEventListener* listener);
-
- // Controls whether events will be forwarded to listeners_. Set to false
- // in death test child processes.
- bool forwarding_enabled() const { return forwarding_enabled_; }
- void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; }
-
- virtual void OnTestProgramStart(const UnitTest& unit_test);
- virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);
- virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test);
- virtual void OnTestCaseStart(const TestCase& test_case);
- virtual void OnTestStart(const TestInfo& test_info);
- virtual void OnTestPartResult(const TestPartResult& result);
- virtual void OnTestEnd(const TestInfo& test_info);
- virtual void OnTestCaseEnd(const TestCase& test_case);
- virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test);
- virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
- virtual void OnTestProgramEnd(const UnitTest& unit_test);
-
- private:
- // Controls whether events will be forwarded to listeners_. Set to false
- // in death test child processes.
- bool forwarding_enabled_;
- // The list of listeners that receive events.
- std::vector<TestEventListener*> listeners_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventRepeater);
-};
-
-TestEventRepeater::~TestEventRepeater() {
- ForEach(listeners_, Delete<TestEventListener>);
-}
-
-void TestEventRepeater::Append(TestEventListener *listener) {
- listeners_.push_back(listener);
-}
-
-// TODO(vladl@google.com): Factor the search functionality into Vector::Find.
-TestEventListener* TestEventRepeater::Release(TestEventListener *listener) {
- for (size_t i = 0; i < listeners_.size(); ++i) {
- if (listeners_[i] == listener) {
- listeners_.erase(listeners_.begin() + i);
- return listener;
- }
- }
-
- return NULL;
-}
-
-// Since most methods are very similar, use macros to reduce boilerplate.
-// This defines a member that forwards the call to all listeners.
-#define GTEST_REPEATER_METHOD_(Name, Type) \
-void TestEventRepeater::Name(const Type& parameter) { \
- if (forwarding_enabled_) { \
- for (size_t i = 0; i < listeners_.size(); i++) { \
- listeners_[i]->Name(parameter); \
- } \
- } \
-}
-// This defines a member that forwards the call to all listeners in reverse
-// order.
-#define GTEST_REVERSE_REPEATER_METHOD_(Name, Type) \
-void TestEventRepeater::Name(const Type& parameter) { \
- if (forwarding_enabled_) { \
- for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) { \
- listeners_[i]->Name(parameter); \
- } \
- } \
-}
-
-GTEST_REPEATER_METHOD_(OnTestProgramStart, UnitTest)
-GTEST_REPEATER_METHOD_(OnEnvironmentsSetUpStart, UnitTest)
-GTEST_REPEATER_METHOD_(OnTestCaseStart, TestCase)
-GTEST_REPEATER_METHOD_(OnTestStart, TestInfo)
-GTEST_REPEATER_METHOD_(OnTestPartResult, TestPartResult)
-GTEST_REPEATER_METHOD_(OnEnvironmentsTearDownStart, UnitTest)
-GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsSetUpEnd, UnitTest)
-GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsTearDownEnd, UnitTest)
-GTEST_REVERSE_REPEATER_METHOD_(OnTestEnd, TestInfo)
-GTEST_REVERSE_REPEATER_METHOD_(OnTestCaseEnd, TestCase)
-GTEST_REVERSE_REPEATER_METHOD_(OnTestProgramEnd, UnitTest)
-
-#undef GTEST_REPEATER_METHOD_
-#undef GTEST_REVERSE_REPEATER_METHOD_
-
-void TestEventRepeater::OnTestIterationStart(const UnitTest& unit_test,
- int iteration) {
- if (forwarding_enabled_) {
- for (size_t i = 0; i < listeners_.size(); i++) {
- listeners_[i]->OnTestIterationStart(unit_test, iteration);
- }
- }
-}
-
-void TestEventRepeater::OnTestIterationEnd(const UnitTest& unit_test,
- int iteration) {
- if (forwarding_enabled_) {
- for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) {
- listeners_[i]->OnTestIterationEnd(unit_test, iteration);
- }
- }
-}
-
-// End TestEventRepeater
-
-// This class generates an XML output file.
-class XmlUnitTestResultPrinter : public EmptyTestEventListener {
- public:
- explicit XmlUnitTestResultPrinter(const char* output_file);
-
- virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
-
- private:
- // Is c a whitespace character that is normalized to a space character
- // when it appears in an XML attribute value?
- static bool IsNormalizableWhitespace(char c) {
- return c == 0x9 || c == 0xA || c == 0xD;
- }
-
- // May c appear in a well-formed XML document?
- static bool IsValidXmlCharacter(char c) {
- return IsNormalizableWhitespace(c) || c >= 0x20;
- }
-
- // Returns an XML-escaped copy of the input string str. If
- // is_attribute is true, the text is meant to appear as an attribute
- // value, and normalizable whitespace is preserved by replacing it
- // with character references.
- static std::string EscapeXml(const std::string& str, bool is_attribute);
-
- // Returns the given string with all characters invalid in XML removed.
- static std::string RemoveInvalidXmlCharacters(const std::string& str);
-
- // Convenience wrapper around EscapeXml when str is an attribute value.
- static std::string EscapeXmlAttribute(const std::string& str) {
- return EscapeXml(str, true);
- }
-
- // Convenience wrapper around EscapeXml when str is not an attribute value.
- static std::string EscapeXmlText(const char* str) {
- return EscapeXml(str, false);
- }
-
- // Verifies that the given attribute belongs to the given element and
- // streams the attribute as XML.
- static void OutputXmlAttribute(std::ostream* stream,
- const std::string& element_name,
- const std::string& name,
- const std::string& value);
-
- // Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
- static void OutputXmlCDataSection(::std::ostream* stream, const char* data);
-
- // Streams an XML representation of a TestInfo object.
- static void OutputXmlTestInfo(::std::ostream* stream,
- const char* test_case_name,
- const TestInfo& test_info);
-
- // Prints an XML representation of a TestCase object
- static void PrintXmlTestCase(::std::ostream* stream,
- const TestCase& test_case);
-
- // Prints an XML summary of unit_test to output stream out.
- static void PrintXmlUnitTest(::std::ostream* stream,
- const UnitTest& unit_test);
-
- // Produces a string representing the test properties in a result as space
- // delimited XML attributes based on the property key="value" pairs.
- // When the std::string is not empty, it includes a space at the beginning,
- // to delimit this attribute from prior attributes.
- static std::string TestPropertiesAsXmlAttributes(const TestResult& result);
-
- // The output file.
- const std::string output_file_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter);
-};
-
-// Creates a new XmlUnitTestResultPrinter.
-XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)
- : output_file_(output_file) {
- if (output_file_.c_str() == NULL || output_file_.empty()) {
- fprintf(stderr, "XML output file may not be null\n");
- fflush(stderr);
- exit(EXIT_FAILURE);
- }
-}
-
-// Called after the unit test ends.
-void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
- int /*iteration*/) {
- FILE* xmlout = NULL;
- FilePath output_file(output_file_);
- FilePath output_dir(output_file.RemoveFileName());
-
- if (output_dir.CreateDirectoriesRecursively()) {
- xmlout = posix::FOpen(output_file_.c_str(), "w");
- }
- if (xmlout == NULL) {
- // TODO(wan): report the reason of the failure.
- //
- // We don't do it for now as:
- //
- // 1. There is no urgent need for it.
- // 2. It's a bit involved to make the errno variable thread-safe on
- // all three operating systems (Linux, Windows, and Mac OS).
- // 3. To interpret the meaning of errno in a thread-safe way,
- // we need the strerror_r() function, which is not available on
- // Windows.
- fprintf(stderr,
- "Unable to open file \"%s\"\n",
- output_file_.c_str());
- fflush(stderr);
- exit(EXIT_FAILURE);
- }
- std::stringstream stream;
- PrintXmlUnitTest(&stream, unit_test);
- fprintf(xmlout, "%s", StringStreamToString(&stream).c_str());
- fclose(xmlout);
-}
-
-// Returns an XML-escaped copy of the input string str. If is_attribute
-// is true, the text is meant to appear as an attribute value, and
-// normalizable whitespace is preserved by replacing it with character
-// references.
-//
-// Invalid XML characters in str, if any, are stripped from the output.
-// It is expected that most, if not all, of the text processed by this
-// module will consist of ordinary English text.
-// If this module is ever modified to produce version 1.1 XML output,
-// most invalid characters can be retained using character references.
-// TODO(wan): It might be nice to have a minimally invasive, human-readable
-// escaping scheme for invalid characters, rather than dropping them.
-std::string XmlUnitTestResultPrinter::EscapeXml(
- const std::string& str, bool is_attribute) {
- Message m;
-
- for (size_t i = 0; i < str.size(); ++i) {
- const char ch = str[i];
- switch (ch) {
- case '<':
- m << "<";
- break;
- case '>':
- m << ">";
- break;
- case '&':
- m << "&";
- break;
- case '\'':
- if (is_attribute)
- m << "'";
- else
- m << '\'';
- break;
- case '"':
- if (is_attribute)
- m << """;
- else
- m << '"';
- break;
- default:
- if (IsValidXmlCharacter(ch)) {
- if (is_attribute && IsNormalizableWhitespace(ch))
- m << "&#x" << String::FormatByte(static_cast<unsigned char>(ch))
- << ";";
- else
- m << ch;
- }
- break;
- }
- }
-
- return m.GetString();
-}
-
-// Returns the given string with all characters invalid in XML removed.
-// Currently invalid characters are dropped from the string. An
-// alternative is to replace them with certain characters such as . or ?.
-std::string XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(
- const std::string& str) {
- std::string output;
- output.reserve(str.size());
- for (std::string::const_iterator it = str.begin(); it != str.end(); ++it)
- if (IsValidXmlCharacter(*it))
- output.push_back(*it);
-
- return output;
-}
-
-// The following routines generate an XML representation of a UnitTest
-// object.
-//
-// This is how Google Test concepts map to the DTD:
-//
-// <testsuites name="AllTests"> <-- corresponds to a UnitTest object
-// <testsuite name="testcase-name"> <-- corresponds to a TestCase object
-// <testcase name="test-name"> <-- corresponds to a TestInfo object
-// <failure message="...">...</failure>
-// <failure message="...">...</failure>
-// <failure message="...">...</failure>
-// <-- individual assertion failures
-// </testcase>
-// </testsuite>
-// </testsuites>
-
-// Formats the given time in milliseconds as seconds.
-std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {
- ::std::stringstream ss;
- ss << ms/1000.0;
- return ss.str();
-}
-
-// Converts the given epoch time in milliseconds to a date string in the ISO
-// 8601 format, without the timezone information.
-std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {
- // Using non-reentrant version as localtime_r is not portable.
- time_t seconds = static_cast<time_t>(ms / 1000);
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4996) // Temporarily disables warning 4996
- // (function or variable may be unsafe).
- const struct tm* const time_struct = localtime(&seconds); // NOLINT
-# pragma warning(pop) // Restores the warning state again.
-#else
- const struct tm* const time_struct = localtime(&seconds); // NOLINT
-#endif
- if (time_struct == NULL)
- return ""; // Invalid ms value
-
- // YYYY-MM-DDThh:mm:ss
- return StreamableToString(time_struct->tm_year + 1900) + "-" +
- String::FormatIntWidth2(time_struct->tm_mon + 1) + "-" +
- String::FormatIntWidth2(time_struct->tm_mday) + "T" +
- String::FormatIntWidth2(time_struct->tm_hour) + ":" +
- String::FormatIntWidth2(time_struct->tm_min) + ":" +
- String::FormatIntWidth2(time_struct->tm_sec);
-}
-
-// Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
-void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream,
- const char* data) {
- const char* segment = data;
- *stream << "<![CDATA[";
- for (;;) {
- const char* const next_segment = strstr(segment, "]]>");
- if (next_segment != NULL) {
- stream->write(
- segment, static_cast<std::streamsize>(next_segment - segment));
- *stream << "]]>]]><![CDATA[";
- segment = next_segment + strlen("]]>");
- } else {
- *stream << segment;
- break;
- }
- }
- *stream << "]]>";
-}
-
-void XmlUnitTestResultPrinter::OutputXmlAttribute(
- std::ostream* stream,
- const std::string& element_name,
- const std::string& name,
- const std::string& value) {
- const std::vector<std::string>& allowed_names =
- GetReservedAttributesForElement(element_name);
-
- GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) !=
- allowed_names.end())
- << "Attribute " << name << " is not allowed for element <" << element_name
- << ">.";
-
- *stream << " " << name << "=\"" << EscapeXmlAttribute(value) << "\"";
-}
-
-// Prints an XML representation of a TestInfo object.
-// TODO(wan): There is also value in printing properties with the plain printer.
-void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
- const char* test_case_name,
- const TestInfo& test_info) {
- const TestResult& result = *test_info.result();
- const std::string kTestcase = "testcase";
-
- *stream << " <testcase";
- OutputXmlAttribute(stream, kTestcase, "name", test_info.name());
-
- if (test_info.value_param() != NULL) {
- OutputXmlAttribute(stream, kTestcase, "value_param",
- test_info.value_param());
- }
- if (test_info.type_param() != NULL) {
- OutputXmlAttribute(stream, kTestcase, "type_param", test_info.type_param());
- }
-
- OutputXmlAttribute(stream, kTestcase, "status",
- test_info.should_run() ? "run" : "notrun");
- OutputXmlAttribute(stream, kTestcase, "time",
- FormatTimeInMillisAsSeconds(result.elapsed_time()));
- OutputXmlAttribute(stream, kTestcase, "classname", test_case_name);
- *stream << TestPropertiesAsXmlAttributes(result);
-
- int failures = 0;
- for (int i = 0; i < result.total_part_count(); ++i) {
- const TestPartResult& part = result.GetTestPartResult(i);
- if (part.failed()) {
- if (++failures == 1) {
- *stream << ">\n";
- }
- const string location = internal::FormatCompilerIndependentFileLocation(
- part.file_name(), part.line_number());
- const string summary = location + "\n" + part.summary();
- *stream << " <failure message=\""
- << EscapeXmlAttribute(summary.c_str())
- << "\" type=\"\">";
- const string detail = location + "\n" + part.message();
- OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
- *stream << "</failure>\n";
- }
- }
-
- if (failures == 0)
- *stream << " />\n";
- else
- *stream << " </testcase>\n";
-}
-
-// Prints an XML representation of a TestCase object
-void XmlUnitTestResultPrinter::PrintXmlTestCase(std::ostream* stream,
- const TestCase& test_case) {
- const std::string kTestsuite = "testsuite";
- *stream << " <" << kTestsuite;
- OutputXmlAttribute(stream, kTestsuite, "name", test_case.name());
- OutputXmlAttribute(stream, kTestsuite, "tests",
- StreamableToString(test_case.reportable_test_count()));
- OutputXmlAttribute(stream, kTestsuite, "failures",
- StreamableToString(test_case.failed_test_count()));
- OutputXmlAttribute(
- stream, kTestsuite, "disabled",
- StreamableToString(test_case.reportable_disabled_test_count()));
- OutputXmlAttribute(stream, kTestsuite, "errors", "0");
- OutputXmlAttribute(stream, kTestsuite, "time",
- FormatTimeInMillisAsSeconds(test_case.elapsed_time()));
- *stream << TestPropertiesAsXmlAttributes(test_case.ad_hoc_test_result())
- << ">\n";
-
- for (int i = 0; i < test_case.total_test_count(); ++i) {
- if (test_case.GetTestInfo(i)->is_reportable())
- OutputXmlTestInfo(stream, test_case.name(), *test_case.GetTestInfo(i));
- }
- *stream << " </" << kTestsuite << ">\n";
-}
-
-// Prints an XML summary of unit_test to output stream out.
-void XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream* stream,
- const UnitTest& unit_test) {
- const std::string kTestsuites = "testsuites";
-
- *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
- *stream << "<" << kTestsuites;
-
- OutputXmlAttribute(stream, kTestsuites, "tests",
- StreamableToString(unit_test.reportable_test_count()));
- OutputXmlAttribute(stream, kTestsuites, "failures",
- StreamableToString(unit_test.failed_test_count()));
- OutputXmlAttribute(
- stream, kTestsuites, "disabled",
- StreamableToString(unit_test.reportable_disabled_test_count()));
- OutputXmlAttribute(stream, kTestsuites, "errors", "0");
- OutputXmlAttribute(
- stream, kTestsuites, "timestamp",
- FormatEpochTimeInMillisAsIso8601(unit_test.start_timestamp()));
- OutputXmlAttribute(stream, kTestsuites, "time",
- FormatTimeInMillisAsSeconds(unit_test.elapsed_time()));
-
- if (GTEST_FLAG(shuffle)) {
- OutputXmlAttribute(stream, kTestsuites, "random_seed",
- StreamableToString(unit_test.random_seed()));
- }
-
- *stream << TestPropertiesAsXmlAttributes(unit_test.ad_hoc_test_result());
-
- OutputXmlAttribute(stream, kTestsuites, "name", "AllTests");
- *stream << ">\n";
-
- for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
- if (unit_test.GetTestCase(i)->reportable_test_count() > 0)
- PrintXmlTestCase(stream, *unit_test.GetTestCase(i));
- }
- *stream << "</" << kTestsuites << ">\n";
-}
-
-// Produces a string representing the test properties in a result as space
-// delimited XML attributes based on the property key="value" pairs.
-std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(
- const TestResult& result) {
- Message attributes;
- for (int i = 0; i < result.test_property_count(); ++i) {
- const TestProperty& property = result.GetTestProperty(i);
- attributes << " " << property.key() << "="
- << "\"" << EscapeXmlAttribute(property.value()) << "\"";
- }
- return attributes.GetString();
-}
-
-// End XmlUnitTestResultPrinter
-
-#if GTEST_CAN_STREAM_RESULTS_
-
-// Checks if str contains '=', '&', '%' or '\n' characters. If yes,
-// replaces them by "%xx" where xx is their hexadecimal value. For
-// example, replaces "=" with "%3D". This algorithm is O(strlen(str))
-// in both time and space -- important as the input str may contain an
-// arbitrarily long test failure message and stack trace.
-string StreamingListener::UrlEncode(const char* str) {
- string result;
- result.reserve(strlen(str) + 1);
- for (char ch = *str; ch != '\0'; ch = *++str) {
- switch (ch) {
- case '%':
- case '=':
- case '&':
- case '\n':
- result.append("%" + String::FormatByte(static_cast<unsigned char>(ch)));
- break;
- default:
- result.push_back(ch);
- break;
- }
- }
- return result;
-}
-
-void StreamingListener::SocketWriter::MakeConnection() {
- GTEST_CHECK_(sockfd_ == -1)
- << "MakeConnection() can't be called when there is already a connection.";
-
- addrinfo hints;
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = AF_UNSPEC; // To allow both IPv4 and IPv6 addresses.
- hints.ai_socktype = SOCK_STREAM;
- addrinfo* servinfo = NULL;
-
- // Use the getaddrinfo() to get a linked list of IP addresses for
- // the given host name.
- const int error_num = getaddrinfo(
- host_name_.c_str(), port_num_.c_str(), &hints, &servinfo);
- if (error_num != 0) {
- GTEST_LOG_(WARNING) << "stream_result_to: getaddrinfo() failed: "
- << gai_strerror(error_num);
- }
-
- // Loop through all the results and connect to the first we can.
- for (addrinfo* cur_addr = servinfo; sockfd_ == -1 && cur_addr != NULL;
- cur_addr = cur_addr->ai_next) {
- sockfd_ = socket(
- cur_addr->ai_family, cur_addr->ai_socktype, cur_addr->ai_protocol);
- if (sockfd_ != -1) {
- // Connect the client socket to the server socket.
- if (connect(sockfd_, cur_addr->ai_addr, cur_addr->ai_addrlen) == -1) {
- close(sockfd_);
- sockfd_ = -1;
- }
- }
- }
-
- freeaddrinfo(servinfo); // all done with this structure
-
- if (sockfd_ == -1) {
- GTEST_LOG_(WARNING) << "stream_result_to: failed to connect to "
- << host_name_ << ":" << port_num_;
- }
-}
-
-// End of class Streaming Listener
-#endif // GTEST_CAN_STREAM_RESULTS__
-
-// Class ScopedTrace
-
-// Pushes the given source file location and message onto a per-thread
-// trace stack maintained by Google Test.
-ScopedTrace::ScopedTrace(const char* file, int line, const Message& message)
- GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
- TraceInfo trace;
- trace.file = file;
- trace.line = line;
- trace.message = message.GetString();
-
- UnitTest::GetInstance()->PushGTestTrace(trace);
-}
-
-// Pops the info pushed by the c'tor.
-ScopedTrace::~ScopedTrace()
- GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
- UnitTest::GetInstance()->PopGTestTrace();
-}
-
-
-// class OsStackTraceGetter
-
-// Returns the current OS stack trace as an std::string. Parameters:
-//
-// max_depth - the maximum number of stack frames to be included
-// in the trace.
-// skip_count - the number of top frames to be skipped; doesn't count
-// against max_depth.
-//
-string OsStackTraceGetter::CurrentStackTrace(int /* max_depth */,
- int /* skip_count */)
- GTEST_LOCK_EXCLUDED_(mutex_) {
- return "";
-}
-
-void OsStackTraceGetter::UponLeavingGTest()
- GTEST_LOCK_EXCLUDED_(mutex_) {
-}
-
-const char* const
-OsStackTraceGetter::kElidedFramesMarker =
- "... " GTEST_NAME_ " internal frames ...";
-
-// A helper class that creates the premature-exit file in its
-// constructor and deletes the file in its destructor.
-class ScopedPrematureExitFile {
- public:
- explicit ScopedPrematureExitFile(const char* premature_exit_filepath)
- : premature_exit_filepath_(premature_exit_filepath) {
- // If a path to the premature-exit file is specified...
- if (premature_exit_filepath != NULL && *premature_exit_filepath != '\0') {
- // create the file with a single "0" character in it. I/O
- // errors are ignored as there's nothing better we can do and we
- // don't want to fail the test because of this.
- FILE* pfile = posix::FOpen(premature_exit_filepath, "w");
- fwrite("0", 1, 1, pfile);
- fclose(pfile);
- }
- }
-
- ~ScopedPrematureExitFile() {
- if (premature_exit_filepath_ != NULL && *premature_exit_filepath_ != '\0') {
- remove(premature_exit_filepath_);
- }
- }
-
- private:
- const char* const premature_exit_filepath_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedPrematureExitFile);
-};
-
-} // namespace internal
-
-// class TestEventListeners
-
-TestEventListeners::TestEventListeners()
- : repeater_(new internal::TestEventRepeater()),
- default_result_printer_(NULL),
- default_xml_generator_(NULL) {
-}
-
-TestEventListeners::~TestEventListeners() { delete repeater_; }
-
-// Returns the standard listener responsible for the default console
-// output. Can be removed from the listeners list to shut down default
-// console output. Note that removing this object from the listener list
-// with Release transfers its ownership to the user.
-void TestEventListeners::Append(TestEventListener* listener) {
- repeater_->Append(listener);
-}
-
-// Removes the given event listener from the list and returns it. It then
-// becomes the caller's responsibility to delete the listener. Returns
-// NULL if the listener is not found in the list.
-TestEventListener* TestEventListeners::Release(TestEventListener* listener) {
- if (listener == default_result_printer_)
- default_result_printer_ = NULL;
- else if (listener == default_xml_generator_)
- default_xml_generator_ = NULL;
- return repeater_->Release(listener);
-}
-
-// Returns repeater that broadcasts the TestEventListener events to all
-// subscribers.
-TestEventListener* TestEventListeners::repeater() { return repeater_; }
-
-// Sets the default_result_printer attribute to the provided listener.
-// The listener is also added to the listener list and previous
-// default_result_printer is removed from it and deleted. The listener can
-// also be NULL in which case it will not be added to the list. Does
-// nothing if the previous and the current listener objects are the same.
-void TestEventListeners::SetDefaultResultPrinter(TestEventListener* listener) {
- if (default_result_printer_ != listener) {
- // It is an error to pass this method a listener that is already in the
- // list.
- delete Release(default_result_printer_);
- default_result_printer_ = listener;
- if (listener != NULL)
- Append(listener);
- }
-}
-
-// Sets the default_xml_generator attribute to the provided listener. The
-// listener is also added to the listener list and previous
-// default_xml_generator is removed from it and deleted. The listener can
-// also be NULL in which case it will not be added to the list. Does
-// nothing if the previous and the current listener objects are the same.
-void TestEventListeners::SetDefaultXmlGenerator(TestEventListener* listener) {
- if (default_xml_generator_ != listener) {
- // It is an error to pass this method a listener that is already in the
- // list.
- delete Release(default_xml_generator_);
- default_xml_generator_ = listener;
- if (listener != NULL)
- Append(listener);
- }
-}
-
-// Controls whether events will be forwarded by the repeater to the
-// listeners in the list.
-bool TestEventListeners::EventForwardingEnabled() const {
- return repeater_->forwarding_enabled();
-}
-
-void TestEventListeners::SuppressEventForwarding() {
- repeater_->set_forwarding_enabled(false);
-}
-
-// class UnitTest
-
-// Gets the singleton UnitTest object. The first time this method is
-// called, a UnitTest object is constructed and returned. Consecutive
-// calls will return the same object.
-//
-// We don't protect this under mutex_ as a user is not supposed to
-// call this before main() starts, from which point on the return
-// value will never change.
-UnitTest* UnitTest::GetInstance() {
- // When compiled with MSVC 7.1 in optimized mode, destroying the
- // UnitTest object upon exiting the program messes up the exit code,
- // causing successful tests to appear failed. We have to use a
- // different implementation in this case to bypass the compiler bug.
- // This implementation makes the compiler happy, at the cost of
- // leaking the UnitTest object.
-
- // CodeGear C++Builder insists on a public destructor for the
- // default implementation. Use this implementation to keep good OO
- // design with private destructor.
-
-#if (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)
- static UnitTest* const instance = new UnitTest;
- return instance;
-#else
- static UnitTest instance;
- return &instance;
-#endif // (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)
-}
-
-// Gets the number of successful test cases.
-int UnitTest::successful_test_case_count() const {
- return impl()->successful_test_case_count();
-}
-
-// Gets the number of failed test cases.
-int UnitTest::failed_test_case_count() const {
- return impl()->failed_test_case_count();
-}
-
-// Gets the number of all test cases.
-int UnitTest::total_test_case_count() const {
- return impl()->total_test_case_count();
-}
-
-// Gets the number of all test cases that contain at least one test
-// that should run.
-int UnitTest::test_case_to_run_count() const {
- return impl()->test_case_to_run_count();
-}
-
-// Gets the number of successful tests.
-int UnitTest::successful_test_count() const {
- return impl()->successful_test_count();
-}
-
-// Gets the number of failed tests.
-int UnitTest::failed_test_count() const { return impl()->failed_test_count(); }
-
-// Gets the number of disabled tests that will be reported in the XML report.
-int UnitTest::reportable_disabled_test_count() const {
- return impl()->reportable_disabled_test_count();
-}
-
-// Gets the number of disabled tests.
-int UnitTest::disabled_test_count() const {
- return impl()->disabled_test_count();
-}
-
-// Gets the number of tests to be printed in the XML report.
-int UnitTest::reportable_test_count() const {
- return impl()->reportable_test_count();
-}
-
-// Gets the number of all tests.
-int UnitTest::total_test_count() const { return impl()->total_test_count(); }
-
-// Gets the number of tests that should run.
-int UnitTest::test_to_run_count() const { return impl()->test_to_run_count(); }
-
-// Gets the time of the test program start, in ms from the start of the
-// UNIX epoch.
-internal::TimeInMillis UnitTest::start_timestamp() const {
- return impl()->start_timestamp();
-}
-
-// Gets the elapsed time, in milliseconds.
-internal::TimeInMillis UnitTest::elapsed_time() const {
- return impl()->elapsed_time();
-}
-
-// Returns true iff the unit test passed (i.e. all test cases passed).
-bool UnitTest::Passed() const { return impl()->Passed(); }
-
-// Returns true iff the unit test failed (i.e. some test case failed
-// or something outside of all tests failed).
-bool UnitTest::Failed() const { return impl()->Failed(); }
-
-// Gets the i-th test case among all the test cases. i can range from 0 to
-// total_test_case_count() - 1. If i is not in that range, returns NULL.
-const TestCase* UnitTest::GetTestCase(int i) const {
- return impl()->GetTestCase(i);
-}
-
-// Returns the TestResult containing information on test failures and
-// properties logged outside of individual test cases.
-const TestResult& UnitTest::ad_hoc_test_result() const {
- return *impl()->ad_hoc_test_result();
-}
-
-// Gets the i-th test case among all the test cases. i can range from 0 to
-// total_test_case_count() - 1. If i is not in that range, returns NULL.
-TestCase* UnitTest::GetMutableTestCase(int i) {
- return impl()->GetMutableTestCase(i);
-}
-
-// Returns the list of event listeners that can be used to track events
-// inside Google Test.
-TestEventListeners& UnitTest::listeners() {
- return *impl()->listeners();
-}
-
-// Registers and returns a global test environment. When a test
-// program is run, all global test environments will be set-up in the
-// order they were registered. After all tests in the program have
-// finished, all global test environments will be torn-down in the
-// *reverse* order they were registered.
-//
-// The UnitTest object takes ownership of the given environment.
-//
-// We don't protect this under mutex_, as we only support calling it
-// from the main thread.
-Environment* UnitTest::AddEnvironment(Environment* env) {
- if (env == NULL) {
- return NULL;
- }
-
- impl_->environments().push_back(env);
- return env;
-}
-
-// Adds a TestPartResult to the current TestResult object. All Google Test
-// assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call
-// this to report their results. The user code should use the
-// assertion macros instead of calling this directly.
-void UnitTest::AddTestPartResult(
- TestPartResult::Type result_type,
- const char* file_name,
- int line_number,
- const std::string& message,
- const std::string& os_stack_trace) GTEST_LOCK_EXCLUDED_(mutex_) {
- Message msg;
- msg << message;
-
- internal::MutexLock lock(&mutex_);
- if (impl_->gtest_trace_stack().size() > 0) {
- msg << "\n" << GTEST_NAME_ << " trace:";
-
- for (int i = static_cast<int>(impl_->gtest_trace_stack().size());
- i > 0; --i) {
- const internal::TraceInfo& trace = impl_->gtest_trace_stack()[i - 1];
- msg << "\n" << internal::FormatFileLocation(trace.file, trace.line)
- << " " << trace.message;
- }
- }
-
- if (os_stack_trace.c_str() != NULL && !os_stack_trace.empty()) {
- msg << internal::kStackTraceMarker << os_stack_trace;
- }
-
- const TestPartResult result =
- TestPartResult(result_type, file_name, line_number,
- msg.GetString().c_str());
- impl_->GetTestPartResultReporterForCurrentThread()->
- ReportTestPartResult(result);
-
- if (result_type != TestPartResult::kSuccess) {
- // gtest_break_on_failure takes precedence over
- // gtest_throw_on_failure. This allows a user to set the latter
- // in the code (perhaps in order to use Google Test assertions
- // with another testing framework) and specify the former on the
- // command line for debugging.
- if (GTEST_FLAG(break_on_failure)) {
-#if GTEST_OS_WINDOWS
- // Using DebugBreak on Windows allows gtest to still break into a debugger
- // when a failure happens and both the --gtest_break_on_failure and
- // the --gtest_catch_exceptions flags are specified.
- DebugBreak();
-#else
- // Dereference NULL through a volatile pointer to prevent the compiler
- // from removing. We use this rather than abort() or __builtin_trap() for
- // portability: Symbian doesn't implement abort() well, and some debuggers
- // don't correctly trap abort().
- *static_cast<volatile int*>(NULL) = 1;
-#endif // GTEST_OS_WINDOWS
- } else if (GTEST_FLAG(throw_on_failure)) {
-#if GTEST_HAS_EXCEPTIONS
- throw internal::GoogleTestFailureException(result);
-#else
- // We cannot call abort() as it generates a pop-up in debug mode
- // that cannot be suppressed in VC 7.1 or below.
- exit(1);
-#endif
- }
- }
-}
-
-// Adds a TestProperty to the current TestResult object when invoked from
-// inside a test, to current TestCase's ad_hoc_test_result_ when invoked
-// from SetUpTestCase or TearDownTestCase, or to the global property set
-// when invoked elsewhere. If the result already contains a property with
-// the same key, the value will be updated.
-void UnitTest::RecordProperty(const std::string& key,
- const std::string& value) {
- impl_->RecordProperty(TestProperty(key, value));
-}
-
-// Runs all tests in this UnitTest object and prints the result.
-// Returns 0 if successful, or 1 otherwise.
-//
-// We don't protect this under mutex_, as we only support calling it
-// from the main thread.
-int UnitTest::Run() {
- const bool in_death_test_child_process =
- internal::GTEST_FLAG(internal_run_death_test).length() > 0;
-
- // Google Test implements this protocol for catching that a test
- // program exits before returning control to Google Test:
- //
- // 1. Upon start, Google Test creates a file whose absolute path
- // is specified by the environment variable
- // TEST_PREMATURE_EXIT_FILE.
- // 2. When Google Test has finished its work, it deletes the file.
- //
- // This allows a test runner to set TEST_PREMATURE_EXIT_FILE before
- // running a Google-Test-based test program and check the existence
- // of the file at the end of the test execution to see if it has
- // exited prematurely.
-
- // If we are in the child process of a death test, don't
- // create/delete the premature exit file, as doing so is unnecessary
- // and will confuse the parent process. Otherwise, create/delete
- // the file upon entering/leaving this function. If the program
- // somehow exits before this function has a chance to return, the
- // premature-exit file will be left undeleted, causing a test runner
- // that understands the premature-exit-file protocol to report the
- // test as having failed.
- const internal::ScopedPrematureExitFile premature_exit_file(
- in_death_test_child_process ?
- NULL : internal::posix::GetEnv("TEST_PREMATURE_EXIT_FILE"));
-
- // Captures the value of GTEST_FLAG(catch_exceptions). This value will be
- // used for the duration of the program.
- impl()->set_catch_exceptions(GTEST_FLAG(catch_exceptions));
-
-#if GTEST_HAS_SEH
- // Either the user wants Google Test to catch exceptions thrown by the
- // tests or this is executing in the context of death test child
- // process. In either case the user does not want to see pop-up dialogs
- // about crashes - they are expected.
- if (impl()->catch_exceptions() || in_death_test_child_process) {
-# if !GTEST_OS_WINDOWS_MOBILE
- // SetErrorMode doesn't exist on CE.
- SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
- SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
-# endif // !GTEST_OS_WINDOWS_MOBILE
-
-# if (defined(_MSC_VER) || GTEST_OS_WINDOWS_MINGW) && !GTEST_OS_WINDOWS_MOBILE
- // Death test children can be terminated with _abort(). On Windows,
- // _abort() can show a dialog with a warning message. This forces the
- // abort message to go to stderr instead.
- _set_error_mode(_OUT_TO_STDERR);
-# endif
-
-# if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
- // In the debug version, Visual Studio pops up a separate dialog
- // offering a choice to debug the aborted program. We need to suppress
- // this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement
- // executed. Google Test will notify the user of any unexpected
- // failure via stderr.
- //
- // VC++ doesn't define _set_abort_behavior() prior to the version 8.0.
- // Users of prior VC versions shall suffer the agony and pain of
- // clicking through the countless debug dialogs.
- // TODO(vladl@google.com): find a way to suppress the abort dialog() in the
- // debug mode when compiled with VC 7.1 or lower.
- if (!GTEST_FLAG(break_on_failure))
- _set_abort_behavior(
- 0x0, // Clear the following flags:
- _WRITE_ABORT_MSG | _CALL_REPORTFAULT); // pop-up window, core dump.
-# endif
- }
-#endif // GTEST_HAS_SEH
-
- return internal::HandleExceptionsInMethodIfSupported(
- impl(),
- &internal::UnitTestImpl::RunAllTests,
- "auxiliary test code (environments or event listeners)") ? 0 : 1;
-}
-
-// Returns the working directory when the first TEST() or TEST_F() was
-// executed.
-const char* UnitTest::original_working_dir() const {
- return impl_->original_working_dir_.c_str();
-}
-
-// Returns the TestCase object for the test that's currently running,
-// or NULL if no test is running.
-const TestCase* UnitTest::current_test_case() const
- GTEST_LOCK_EXCLUDED_(mutex_) {
- internal::MutexLock lock(&mutex_);
- return impl_->current_test_case();
-}
-
-// Returns the TestInfo object for the test that's currently running,
-// or NULL if no test is running.
-const TestInfo* UnitTest::current_test_info() const
- GTEST_LOCK_EXCLUDED_(mutex_) {
- internal::MutexLock lock(&mutex_);
- return impl_->current_test_info();
-}
-
-// Returns the random seed used at the start of the current test run.
-int UnitTest::random_seed() const { return impl_->random_seed(); }
-
-#if GTEST_HAS_PARAM_TEST
-// Returns ParameterizedTestCaseRegistry object used to keep track of
-// value-parameterized tests and instantiate and register them.
-internal::ParameterizedTestCaseRegistry&
- UnitTest::parameterized_test_registry()
- GTEST_LOCK_EXCLUDED_(mutex_) {
- return impl_->parameterized_test_registry();
-}
-#endif // GTEST_HAS_PARAM_TEST
-
-// Creates an empty UnitTest.
-UnitTest::UnitTest() {
- impl_ = new internal::UnitTestImpl(this);
-}
-
-// Destructor of UnitTest.
-UnitTest::~UnitTest() {
- delete impl_;
-}
-
-// Pushes a trace defined by SCOPED_TRACE() on to the per-thread
-// Google Test trace stack.
-void UnitTest::PushGTestTrace(const internal::TraceInfo& trace)
- GTEST_LOCK_EXCLUDED_(mutex_) {
- internal::MutexLock lock(&mutex_);
- impl_->gtest_trace_stack().push_back(trace);
-}
-
-// Pops a trace from the per-thread Google Test trace stack.
-void UnitTest::PopGTestTrace()
- GTEST_LOCK_EXCLUDED_(mutex_) {
- internal::MutexLock lock(&mutex_);
- impl_->gtest_trace_stack().pop_back();
-}
-
-namespace internal {
-
-UnitTestImpl::UnitTestImpl(UnitTest* parent)
- : parent_(parent),
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4355) // Temporarily disables warning 4355
- // (using this in initializer).
- default_global_test_part_result_reporter_(this),
- default_per_thread_test_part_result_reporter_(this),
-# pragma warning(pop) // Restores the warning state again.
-#else
- default_global_test_part_result_reporter_(this),
- default_per_thread_test_part_result_reporter_(this),
-#endif // _MSC_VER
- global_test_part_result_repoter_(
- &default_global_test_part_result_reporter_),
- per_thread_test_part_result_reporter_(
- &default_per_thread_test_part_result_reporter_),
-#if GTEST_HAS_PARAM_TEST
- parameterized_test_registry_(),
- parameterized_tests_registered_(false),
-#endif // GTEST_HAS_PARAM_TEST
- last_death_test_case_(-1),
- current_test_case_(NULL),
- current_test_info_(NULL),
- ad_hoc_test_result_(),
- os_stack_trace_getter_(NULL),
- post_flag_parse_init_performed_(false),
- random_seed_(0), // Will be overridden by the flag before first use.
- random_(0), // Will be reseeded before first use.
- start_timestamp_(0),
- elapsed_time_(0),
-#if GTEST_HAS_DEATH_TEST
- death_test_factory_(new DefaultDeathTestFactory),
-#endif
- // Will be overridden by the flag before first use.
- catch_exceptions_(false) {
- listeners()->SetDefaultResultPrinter(new PrettyUnitTestResultPrinter);
-}
-
-UnitTestImpl::~UnitTestImpl() {
- // Deletes every TestCase.
- ForEach(test_cases_, internal::Delete<TestCase>);
-
- // Deletes every Environment.
- ForEach(environments_, internal::Delete<Environment>);
-
- delete os_stack_trace_getter_;
-}
-
-// Adds a TestProperty to the current TestResult object when invoked in a
-// context of a test, to current test case's ad_hoc_test_result when invoke
-// from SetUpTestCase/TearDownTestCase, or to the global property set
-// otherwise. If the result already contains a property with the same key,
-// the value will be updated.
-void UnitTestImpl::RecordProperty(const TestProperty& test_property) {
- std::string xml_element;
- TestResult* test_result; // TestResult appropriate for property recording.
-
- if (current_test_info_ != NULL) {
- xml_element = "testcase";
- test_result = &(current_test_info_->result_);
- } else if (current_test_case_ != NULL) {
- xml_element = "testsuite";
- test_result = &(current_test_case_->ad_hoc_test_result_);
- } else {
- xml_element = "testsuites";
- test_result = &ad_hoc_test_result_;
- }
- test_result->RecordProperty(xml_element, test_property);
-}
-
-#if GTEST_HAS_DEATH_TEST
-// Disables event forwarding if the control is currently in a death test
-// subprocess. Must not be called before InitGoogleTest.
-void UnitTestImpl::SuppressTestEventsIfInSubprocess() {
- if (internal_run_death_test_flag_.get() != NULL)
- listeners()->SuppressEventForwarding();
-}
-#endif // GTEST_HAS_DEATH_TEST
-
-// Initializes event listeners performing XML output as specified by
-// UnitTestOptions. Must not be called before InitGoogleTest.
-void UnitTestImpl::ConfigureXmlOutput() {
- const std::string& output_format = UnitTestOptions::GetOutputFormat();
- if (output_format == "xml") {
- listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter(
- UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));
- } else if (output_format != "") {
- printf("WARNING: unrecognized output format \"%s\" ignored.\n",
- output_format.c_str());
- fflush(stdout);
- }
-}
-
-#if GTEST_CAN_STREAM_RESULTS_
-// Initializes event listeners for streaming test results in string form.
-// Must not be called before InitGoogleTest.
-void UnitTestImpl::ConfigureStreamingOutput() {
- const std::string& target = GTEST_FLAG(stream_result_to);
- if (!target.empty()) {
- const size_t pos = target.find(':');
- if (pos != std::string::npos) {
- listeners()->Append(new StreamingListener(target.substr(0, pos),
- target.substr(pos+1)));
- } else {
- printf("WARNING: unrecognized streaming target \"%s\" ignored.\n",
- target.c_str());
- fflush(stdout);
- }
- }
-}
-#endif // GTEST_CAN_STREAM_RESULTS_
-
-// Performs initialization dependent upon flag values obtained in
-// ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to
-// ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest
-// this function is also called from RunAllTests. Since this function can be
-// called more than once, it has to be idempotent.
-void UnitTestImpl::PostFlagParsingInit() {
- // Ensures that this function does not execute more than once.
- if (!post_flag_parse_init_performed_) {
- post_flag_parse_init_performed_ = true;
-
-#if GTEST_HAS_DEATH_TEST
- InitDeathTestSubprocessControlInfo();
- SuppressTestEventsIfInSubprocess();
-#endif // GTEST_HAS_DEATH_TEST
-
- // Registers parameterized tests. This makes parameterized tests
- // available to the UnitTest reflection API without running
- // RUN_ALL_TESTS.
- RegisterParameterizedTests();
-
- // Configures listeners for XML output. This makes it possible for users
- // to shut down the default XML output before invoking RUN_ALL_TESTS.
- ConfigureXmlOutput();
-
-#if GTEST_CAN_STREAM_RESULTS_
- // Configures listeners for streaming test results to the specified server.
- ConfigureStreamingOutput();
-#endif // GTEST_CAN_STREAM_RESULTS_
- }
-}
-
-// A predicate that checks the name of a TestCase against a known
-// value.
-//
-// This is used for implementation of the UnitTest class only. We put
-// it in the anonymous namespace to prevent polluting the outer
-// namespace.
-//
-// TestCaseNameIs is copyable.
-class TestCaseNameIs {
- public:
- // Constructor.
- explicit TestCaseNameIs(const std::string& name)
- : name_(name) {}
-
- // Returns true iff the name of test_case matches name_.
- bool operator()(const TestCase* test_case) const {
- return test_case != NULL && strcmp(test_case->name(), name_.c_str()) == 0;
- }
-
- private:
- std::string name_;
-};
-
-// Finds and returns a TestCase with the given name. If one doesn't
-// exist, creates one and returns it. It's the CALLER'S
-// RESPONSIBILITY to ensure that this function is only called WHEN THE
-// TESTS ARE NOT SHUFFLED.
-//
-// Arguments:
-//
-// test_case_name: name of the test case
-// type_param: the name of the test case's type parameter, or NULL if
-// this is not a typed or a type-parameterized test case.
-// set_up_tc: pointer to the function that sets up the test case
-// tear_down_tc: pointer to the function that tears down the test case
-TestCase* UnitTestImpl::GetTestCase(const char* test_case_name,
- const char* type_param,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc) {
- // Can we find a TestCase with the given name?
- const std::vector<TestCase*>::const_iterator test_case =
- std::find_if(test_cases_.begin(), test_cases_.end(),
- TestCaseNameIs(test_case_name));
-
- if (test_case != test_cases_.end())
- return *test_case;
-
- // No. Let's create one.
- TestCase* const new_test_case =
- new TestCase(test_case_name, type_param, set_up_tc, tear_down_tc);
-
- // Is this a death test case?
- if (internal::UnitTestOptions::MatchesFilter(test_case_name,
- kDeathTestCaseFilter)) {
- // Yes. Inserts the test case after the last death test case
- // defined so far. This only works when the test cases haven't
- // been shuffled. Otherwise we may end up running a death test
- // after a non-death test.
- ++last_death_test_case_;
- test_cases_.insert(test_cases_.begin() + last_death_test_case_,
- new_test_case);
- } else {
- // No. Appends to the end of the list.
- test_cases_.push_back(new_test_case);
- }
-
- test_case_indices_.push_back(static_cast<int>(test_case_indices_.size()));
- return new_test_case;
-}
-
-// Helpers for setting up / tearing down the given environment. They
-// are for use in the ForEach() function.
-static void SetUpEnvironment(Environment* env) { env->SetUp(); }
-static void TearDownEnvironment(Environment* env) { env->TearDown(); }
-
-// Runs all tests in this UnitTest object, prints the result, and
-// returns true if all tests are successful. If any exception is
-// thrown during a test, the test is considered to be failed, but the
-// rest of the tests will still be run.
-//
-// When parameterized tests are enabled, it expands and registers
-// parameterized tests first in RegisterParameterizedTests().
-// All other functions called from RunAllTests() may safely assume that
-// parameterized tests are ready to be counted and run.
-bool UnitTestImpl::RunAllTests() {
- // Makes sure InitGoogleTest() was called.
- if (!GTestIsInitialized()) {
- printf("%s",
- "\nThis test program did NOT call ::testing::InitGoogleTest "
- "before calling RUN_ALL_TESTS(). Please fix it.\n");
- return false;
- }
-
- // Do not run any test if the --help flag was specified.
- if (g_help_flag)
- return true;
-
- // Repeats the call to the post-flag parsing initialization in case the
- // user didn't call InitGoogleTest.
- PostFlagParsingInit();
-
- // Even if sharding is not on, test runners may want to use the
- // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding
- // protocol.
- internal::WriteToShardStatusFileIfNeeded();
-
- // True iff we are in a subprocess for running a thread-safe-style
- // death test.
- bool in_subprocess_for_death_test = false;
-
-#if GTEST_HAS_DEATH_TEST
- in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL);
-#endif // GTEST_HAS_DEATH_TEST
-
- const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex,
- in_subprocess_for_death_test);
-
- // Compares the full test names with the filter to decide which
- // tests to run.
- const bool has_tests_to_run = FilterTests(should_shard
- ? HONOR_SHARDING_PROTOCOL
- : IGNORE_SHARDING_PROTOCOL) > 0;
-
- // Lists the tests and exits if the --gtest_list_tests flag was specified.
- if (GTEST_FLAG(list_tests)) {
- // This must be called *after* FilterTests() has been called.
- ListTestsMatchingFilter();
- return true;
- }
-
- random_seed_ = GTEST_FLAG(shuffle) ?
- GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0;
-
- // True iff at least one test has failed.
- bool failed = false;
-
- TestEventListener* repeater = listeners()->repeater();
-
- start_timestamp_ = GetTimeInMillis();
- repeater->OnTestProgramStart(*parent_);
-
- // How many times to repeat the tests? We don't want to repeat them
- // when we are inside the subprocess of a death test.
- const int repeat = in_subprocess_for_death_test ? 1 : GTEST_FLAG(repeat);
- // Repeats forever if the repeat count is negative.
- const bool forever = repeat < 0;
- for (int i = 0; forever || i != repeat; i++) {
- // We want to preserve failures generated by ad-hoc test
- // assertions executed before RUN_ALL_TESTS().
- ClearNonAdHocTestResult();
-
- const TimeInMillis start = GetTimeInMillis();
-
- // Shuffles test cases and tests if requested.
- if (has_tests_to_run && GTEST_FLAG(shuffle)) {
- random()->Reseed(random_seed_);
- // This should be done before calling OnTestIterationStart(),
- // such that a test event listener can see the actual test order
- // in the event.
- ShuffleTests();
- }
-
- // Tells the unit test event listeners that the tests are about to start.
- repeater->OnTestIterationStart(*parent_, i);
-
- // Runs each test case if there is at least one test to run.
- if (has_tests_to_run) {
- // Sets up all environments beforehand.
- repeater->OnEnvironmentsSetUpStart(*parent_);
- ForEach(environments_, SetUpEnvironment);
- repeater->OnEnvironmentsSetUpEnd(*parent_);
-
- // Runs the tests only if there was no fatal failure during global
- // set-up.
- if (!Test::HasFatalFailure()) {
- for (int test_index = 0; test_index < total_test_case_count();
- test_index++) {
- GetMutableTestCase(test_index)->Run();
- }
- }
-
- // Tears down all environments in reverse order afterwards.
- repeater->OnEnvironmentsTearDownStart(*parent_);
- std::for_each(environments_.rbegin(), environments_.rend(),
- TearDownEnvironment);
- repeater->OnEnvironmentsTearDownEnd(*parent_);
- }
-
- elapsed_time_ = GetTimeInMillis() - start;
-
- // Tells the unit test event listener that the tests have just finished.
- repeater->OnTestIterationEnd(*parent_, i);
-
- // Gets the result and clears it.
- if (!Passed()) {
- failed = true;
- }
-
- // Restores the original test order after the iteration. This
- // allows the user to quickly repro a failure that happens in the
- // N-th iteration without repeating the first (N - 1) iterations.
- // This is not enclosed in "if (GTEST_FLAG(shuffle)) { ... }", in
- // case the user somehow changes the value of the flag somewhere
- // (it's always safe to unshuffle the tests).
- UnshuffleTests();
-
- if (GTEST_FLAG(shuffle)) {
- // Picks a new random seed for each iteration.
- random_seed_ = GetNextRandomSeed(random_seed_);
- }
- }
-
- repeater->OnTestProgramEnd(*parent_);
-
- return !failed;
-}
-
-// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
-// if the variable is present. If a file already exists at this location, this
-// function will write over it. If the variable is present, but the file cannot
-// be created, prints an error and exits.
-void WriteToShardStatusFileIfNeeded() {
- const char* const test_shard_file = posix::GetEnv(kTestShardStatusFile);
- if (test_shard_file != NULL) {
- FILE* const file = posix::FOpen(test_shard_file, "w");
- if (file == NULL) {
- ColoredPrintf(COLOR_RED,
- "Could not write to the test shard status file \"%s\" "
- "specified by the %s environment variable.\n",
- test_shard_file, kTestShardStatusFile);
- fflush(stdout);
- exit(EXIT_FAILURE);
- }
- fclose(file);
- }
-}
-
-// Checks whether sharding is enabled by examining the relevant
-// environment variable values. If the variables are present,
-// but inconsistent (i.e., shard_index >= total_shards), prints
-// an error and exits. If in_subprocess_for_death_test, sharding is
-// disabled because it must only be applied to the original test
-// process. Otherwise, we could filter out death tests we intended to execute.
-bool ShouldShard(const char* total_shards_env,
- const char* shard_index_env,
- bool in_subprocess_for_death_test) {
- if (in_subprocess_for_death_test) {
- return false;
- }
-
- const Int32 total_shards = Int32FromEnvOrDie(total_shards_env, -1);
- const Int32 shard_index = Int32FromEnvOrDie(shard_index_env, -1);
-
- if (total_shards == -1 && shard_index == -1) {
- return false;
- } else if (total_shards == -1 && shard_index != -1) {
- const Message msg = Message()
- << "Invalid environment variables: you have "
- << kTestShardIndex << " = " << shard_index
- << ", but have left " << kTestTotalShards << " unset.\n";
- ColoredPrintf(COLOR_RED, msg.GetString().c_str());
- fflush(stdout);
- exit(EXIT_FAILURE);
- } else if (total_shards != -1 && shard_index == -1) {
- const Message msg = Message()
- << "Invalid environment variables: you have "
- << kTestTotalShards << " = " << total_shards
- << ", but have left " << kTestShardIndex << " unset.\n";
- ColoredPrintf(COLOR_RED, msg.GetString().c_str());
- fflush(stdout);
- exit(EXIT_FAILURE);
- } else if (shard_index < 0 || shard_index >= total_shards) {
- const Message msg = Message()
- << "Invalid environment variables: we require 0 <= "
- << kTestShardIndex << " < " << kTestTotalShards
- << ", but you have " << kTestShardIndex << "=" << shard_index
- << ", " << kTestTotalShards << "=" << total_shards << ".\n";
- ColoredPrintf(COLOR_RED, msg.GetString().c_str());
- fflush(stdout);
- exit(EXIT_FAILURE);
- }
-
- return total_shards > 1;
-}
-
-// Parses the environment variable var as an Int32. If it is unset,
-// returns default_val. If it is not an Int32, prints an error
-// and aborts.
-Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) {
- const char* str_val = posix::GetEnv(var);
- if (str_val == NULL) {
- return default_val;
- }
-
- Int32 result;
- if (!ParseInt32(Message() << "The value of environment variable " << var,
- str_val, &result)) {
- exit(EXIT_FAILURE);
- }
- return result;
-}
-
-// Given the total number of shards, the shard index, and the test id,
-// returns true iff the test should be run on this shard. The test id is
-// some arbitrary but unique non-negative integer assigned to each test
-// method. Assumes that 0 <= shard_index < total_shards.
-bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {
- return (test_id % total_shards) == shard_index;
-}
-
-// Compares the name of each test with the user-specified filter to
-// decide whether the test should be run, then records the result in
-// each TestCase and TestInfo object.
-// If shard_tests == true, further filters tests based on sharding
-// variables in the environment - see
-// http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide.
-// Returns the number of tests that should run.
-int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
- const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ?
- Int32FromEnvOrDie(kTestTotalShards, -1) : -1;
- const Int32 shard_index = shard_tests == HONOR_SHARDING_PROTOCOL ?
- Int32FromEnvOrDie(kTestShardIndex, -1) : -1;
-
- // num_runnable_tests are the number of tests that will
- // run across all shards (i.e., match filter and are not disabled).
- // num_selected_tests are the number of tests to be run on
- // this shard.
- int num_runnable_tests = 0;
- int num_selected_tests = 0;
- for (size_t i = 0; i < test_cases_.size(); i++) {
- TestCase* const test_case = test_cases_[i];
- const std::string &test_case_name = test_case->name();
- test_case->set_should_run(false);
-
- for (size_t j = 0; j < test_case->test_info_list().size(); j++) {
- TestInfo* const test_info = test_case->test_info_list()[j];
- const std::string test_name(test_info->name());
- // A test is disabled if test case name or test name matches
- // kDisableTestFilter.
- const bool is_disabled =
- internal::UnitTestOptions::MatchesFilter(test_case_name,
- kDisableTestFilter) ||
- internal::UnitTestOptions::MatchesFilter(test_name,
- kDisableTestFilter);
- test_info->is_disabled_ = is_disabled;
-
- const bool matches_filter =
- internal::UnitTestOptions::FilterMatchesTest(test_case_name,
- test_name);
- test_info->matches_filter_ = matches_filter;
-
- const bool is_runnable =
- (GTEST_FLAG(also_run_disabled_tests) || !is_disabled) &&
- matches_filter;
-
- const bool is_selected = is_runnable &&
- (shard_tests == IGNORE_SHARDING_PROTOCOL ||
- ShouldRunTestOnShard(total_shards, shard_index,
- num_runnable_tests));
-
- num_runnable_tests += is_runnable;
- num_selected_tests += is_selected;
-
- test_info->should_run_ = is_selected;
- test_case->set_should_run(test_case->should_run() || is_selected);
- }
- }
- return num_selected_tests;
-}
-
-// Prints the given C-string on a single line by replacing all '\n'
-// characters with string "\\n". If the output takes more than
-// max_length characters, only prints the first max_length characters
-// and "...".
-static void PrintOnOneLine(const char* str, int max_length) {
- if (str != NULL) {
- for (int i = 0; *str != '\0'; ++str) {
- if (i >= max_length) {
- printf("...");
- break;
- }
- if (*str == '\n') {
- printf("\\n");
- i += 2;
- } else {
- printf("%c", *str);
- ++i;
- }
- }
- }
-}
-
-// Prints the names of the tests matching the user-specified filter flag.
-void UnitTestImpl::ListTestsMatchingFilter() {
- // Print at most this many characters for each type/value parameter.
- const int kMaxParamLength = 250;
-
- for (size_t i = 0; i < test_cases_.size(); i++) {
- const TestCase* const test_case = test_cases_[i];
- bool printed_test_case_name = false;
-
- for (size_t j = 0; j < test_case->test_info_list().size(); j++) {
- const TestInfo* const test_info =
- test_case->test_info_list()[j];
- if (test_info->matches_filter_) {
- if (!printed_test_case_name) {
- printed_test_case_name = true;
- printf("%s.", test_case->name());
- if (test_case->type_param() != NULL) {
- printf(" # %s = ", kTypeParamLabel);
- // We print the type parameter on a single line to make
- // the output easy to parse by a program.
- PrintOnOneLine(test_case->type_param(), kMaxParamLength);
- }
- printf("\n");
- }
- printf(" %s", test_info->name());
- if (test_info->value_param() != NULL) {
- printf(" # %s = ", kValueParamLabel);
- // We print the value parameter on a single line to make the
- // output easy to parse by a program.
- PrintOnOneLine(test_info->value_param(), kMaxParamLength);
- }
- printf("\n");
- }
- }
- }
- fflush(stdout);
-}
-
-// Sets the OS stack trace getter.
-//
-// Does nothing if the input and the current OS stack trace getter are
-// the same; otherwise, deletes the old getter and makes the input the
-// current getter.
-void UnitTestImpl::set_os_stack_trace_getter(
- OsStackTraceGetterInterface* getter) {
- if (os_stack_trace_getter_ != getter) {
- delete os_stack_trace_getter_;
- os_stack_trace_getter_ = getter;
- }
-}
-
-// Returns the current OS stack trace getter if it is not NULL;
-// otherwise, creates an OsStackTraceGetter, makes it the current
-// getter, and returns it.
-OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
- if (os_stack_trace_getter_ == NULL) {
- os_stack_trace_getter_ = new OsStackTraceGetter;
- }
-
- return os_stack_trace_getter_;
-}
-
-// Returns the TestResult for the test that's currently running, or
-// the TestResult for the ad hoc test if no test is running.
-TestResult* UnitTestImpl::current_test_result() {
- return current_test_info_ ?
- &(current_test_info_->result_) : &ad_hoc_test_result_;
-}
-
-// Shuffles all test cases, and the tests within each test case,
-// making sure that death tests are still run first.
-void UnitTestImpl::ShuffleTests() {
- // Shuffles the death test cases.
- ShuffleRange(random(), 0, last_death_test_case_ + 1, &test_case_indices_);
-
- // Shuffles the non-death test cases.
- ShuffleRange(random(), last_death_test_case_ + 1,
- static_cast<int>(test_cases_.size()), &test_case_indices_);
-
- // Shuffles the tests inside each test case.
- for (size_t i = 0; i < test_cases_.size(); i++) {
- test_cases_[i]->ShuffleTests(random());
- }
-}
-
-// Restores the test cases and tests to their order before the first shuffle.
-void UnitTestImpl::UnshuffleTests() {
- for (size_t i = 0; i < test_cases_.size(); i++) {
- // Unshuffles the tests in each test case.
- test_cases_[i]->UnshuffleTests();
- // Resets the index of each test case.
- test_case_indices_[i] = static_cast<int>(i);
- }
-}
-
-// Returns the current OS stack trace as an std::string.
-//
-// The maximum number of stack frames to be included is specified by
-// the gtest_stack_trace_depth flag. The skip_count parameter
-// specifies the number of top frames to be skipped, which doesn't
-// count against the number of frames to be included.
-//
-// For example, if Foo() calls Bar(), which in turn calls
-// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
-// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
-std::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,
- int skip_count) {
- // We pass skip_count + 1 to skip this wrapper function in addition
- // to what the user really wants to skip.
- return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1);
-}
-
-// Used by the GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_ macro to
-// suppress unreachable code warnings.
-namespace {
-class ClassUniqueToAlwaysTrue {};
-}
-
-bool IsTrue(bool condition) { return condition; }
-
-bool AlwaysTrue() {
-#if GTEST_HAS_EXCEPTIONS
- // This condition is always false so AlwaysTrue() never actually throws,
- // but it makes the compiler think that it may throw.
- if (IsTrue(false))
- throw ClassUniqueToAlwaysTrue();
-#endif // GTEST_HAS_EXCEPTIONS
- return true;
-}
-
-// If *pstr starts with the given prefix, modifies *pstr to be right
-// past the prefix and returns true; otherwise leaves *pstr unchanged
-// and returns false. None of pstr, *pstr, and prefix can be NULL.
-bool SkipPrefix(const char* prefix, const char** pstr) {
- const size_t prefix_len = strlen(prefix);
- if (strncmp(*pstr, prefix, prefix_len) == 0) {
- *pstr += prefix_len;
- return true;
- }
- return false;
-}
-
-// Parses a string as a command line flag. The string should have
-// the format "--flag=value". When def_optional is true, the "=value"
-// part can be omitted.
-//
-// Returns the value of the flag, or NULL if the parsing failed.
-const char* ParseFlagValue(const char* str,
- const char* flag,
- bool def_optional) {
- // str and flag must not be NULL.
- if (str == NULL || flag == NULL) return NULL;
-
- // The flag must start with "--" followed by GTEST_FLAG_PREFIX_.
- const std::string flag_str = std::string("--") + GTEST_FLAG_PREFIX_ + flag;
- const size_t flag_len = flag_str.length();
- if (strncmp(str, flag_str.c_str(), flag_len) != 0) return NULL;
-
- // Skips the flag name.
- const char* flag_end = str + flag_len;
-
- // When def_optional is true, it's OK to not have a "=value" part.
- if (def_optional && (flag_end[0] == '\0')) {
- return flag_end;
- }
-
- // If def_optional is true and there are more characters after the
- // flag name, or if def_optional is false, there must be a '=' after
- // the flag name.
- if (flag_end[0] != '=') return NULL;
-
- // Returns the string after "=".
- return flag_end + 1;
-}
-
-// Parses a string for a bool flag, in the form of either
-// "--flag=value" or "--flag".
-//
-// In the former case, the value is taken as true as long as it does
-// not start with '0', 'f', or 'F'.
-//
-// In the latter case, the value is taken as true.
-//
-// On success, stores the value of the flag in *value, and returns
-// true. On failure, returns false without changing *value.
-bool ParseBoolFlag(const char* str, const char* flag, bool* value) {
- // Gets the value of the flag as a string.
- const char* const value_str = ParseFlagValue(str, flag, true);
-
- // Aborts if the parsing failed.
- if (value_str == NULL) return false;
-
- // Converts the string value to a bool.
- *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F');
- return true;
-}
-
-// Parses a string for an Int32 flag, in the form of
-// "--flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true. On failure, returns false without changing *value.
-bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
- // Gets the value of the flag as a string.
- const char* const value_str = ParseFlagValue(str, flag, false);
-
- // Aborts if the parsing failed.
- if (value_str == NULL) return false;
-
- // Sets *value to the value of the flag.
- return ParseInt32(Message() << "The value of flag --" << flag,
- value_str, value);
-}
-
-// Parses a string for a string flag, in the form of
-// "--flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true. On failure, returns false without changing *value.
-bool ParseStringFlag(const char* str, const char* flag, std::string* value) {
- // Gets the value of the flag as a string.
- const char* const value_str = ParseFlagValue(str, flag, false);
-
- // Aborts if the parsing failed.
- if (value_str == NULL) return false;
-
- // Sets *value to the value of the flag.
- *value = value_str;
- return true;
-}
-
-// Determines whether a string has a prefix that Google Test uses for its
-// flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_.
-// If Google Test detects that a command line flag has its prefix but is not
-// recognized, it will print its help message. Flags starting with
-// GTEST_INTERNAL_PREFIX_ followed by "internal_" are considered Google Test
-// internal flags and do not trigger the help message.
-static bool HasGoogleTestFlagPrefix(const char* str) {
- return (SkipPrefix("--", &str) ||
- SkipPrefix("-", &str) ||
- SkipPrefix("/", &str)) &&
- !SkipPrefix(GTEST_FLAG_PREFIX_ "internal_", &str) &&
- (SkipPrefix(GTEST_FLAG_PREFIX_, &str) ||
- SkipPrefix(GTEST_FLAG_PREFIX_DASH_, &str));
-}
-
-// Prints a string containing code-encoded text. The following escape
-// sequences can be used in the string to control the text color:
-//
-// @@ prints a single '@' character.
-// @R changes the color to red.
-// @G changes the color to green.
-// @Y changes the color to yellow.
-// @D changes to the default terminal text color.
-//
-// TODO(wan@google.com): Write tests for this once we add stdout
-// capturing to Google Test.
-static void PrintColorEncoded(const char* str) {
- GTestColor color = COLOR_DEFAULT; // The current color.
-
- // Conceptually, we split the string into segments divided by escape
- // sequences. Then we print one segment at a time. At the end of
- // each iteration, the str pointer advances to the beginning of the
- // next segment.
- for (;;) {
- const char* p = strchr(str, '@');
- if (p == NULL) {
- ColoredPrintf(color, "%s", str);
- return;
- }
-
- ColoredPrintf(color, "%s", std::string(str, p).c_str());
-
- const char ch = p[1];
- str = p + 2;
- if (ch == '@') {
- ColoredPrintf(color, "@");
- } else if (ch == 'D') {
- color = COLOR_DEFAULT;
- } else if (ch == 'R') {
- color = COLOR_RED;
- } else if (ch == 'G') {
- color = COLOR_GREEN;
- } else if (ch == 'Y') {
- color = COLOR_YELLOW;
- } else {
- --str;
- }
- }
-}
-
-static const char kColorEncodedHelpMessage[] =
-"This program contains tests written using " GTEST_NAME_ ". You can use the\n"
-"following command line flags to control its behavior:\n"
-"\n"
-"Test Selection:\n"
-" @G--" GTEST_FLAG_PREFIX_ "list_tests@D\n"
-" List the names of all tests instead of running them. The name of\n"
-" TEST(Foo, Bar) is \"Foo.Bar\".\n"
-" @G--" GTEST_FLAG_PREFIX_ "filter=@YPOSTIVE_PATTERNS"
- "[@G-@YNEGATIVE_PATTERNS]@D\n"
-" Run only the tests whose name matches one of the positive patterns but\n"
-" none of the negative patterns. '?' matches any single character; '*'\n"
-" matches any substring; ':' separates two patterns.\n"
-" @G--" GTEST_FLAG_PREFIX_ "also_run_disabled_tests@D\n"
-" Run all disabled tests too.\n"
-"\n"
-"Test Execution:\n"
-" @G--" GTEST_FLAG_PREFIX_ "repeat=@Y[COUNT]@D\n"
-" Run the tests repeatedly; use a negative count to repeat forever.\n"
-" @G--" GTEST_FLAG_PREFIX_ "shuffle@D\n"
-" Randomize tests' orders on every iteration.\n"
-" @G--" GTEST_FLAG_PREFIX_ "random_seed=@Y[NUMBER]@D\n"
-" Random number seed to use for shuffling test orders (between 1 and\n"
-" 99999, or 0 to use a seed based on the current time).\n"
-"\n"
-"Test Output:\n"
-" @G--" GTEST_FLAG_PREFIX_ "color=@Y(@Gyes@Y|@Gno@Y|@Gauto@Y)@D\n"
-" Enable/disable colored output. The default is @Gauto@D.\n"
-" -@G-" GTEST_FLAG_PREFIX_ "print_time=0@D\n"
-" Don't print the elapsed time of each test.\n"
-" @G--" GTEST_FLAG_PREFIX_ "output=xml@Y[@G:@YDIRECTORY_PATH@G"
- GTEST_PATH_SEP_ "@Y|@G:@YFILE_PATH]@D\n"
-" Generate an XML report in the given directory or with the given file\n"
-" name. @YFILE_PATH@D defaults to @Gtest_details.xml@D.\n"
-#if GTEST_CAN_STREAM_RESULTS_
-" @G--" GTEST_FLAG_PREFIX_ "stream_result_to=@YHOST@G:@YPORT@D\n"
-" Stream test results to the given server.\n"
-#endif // GTEST_CAN_STREAM_RESULTS_
-"\n"
-"Assertion Behavior:\n"
-#if GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
-" @G--" GTEST_FLAG_PREFIX_ "death_test_style=@Y(@Gfast@Y|@Gthreadsafe@Y)@D\n"
-" Set the default death test style.\n"
-#endif // GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
-" @G--" GTEST_FLAG_PREFIX_ "break_on_failure@D\n"
-" Turn assertion failures into debugger break-points.\n"
-" @G--" GTEST_FLAG_PREFIX_ "throw_on_failure@D\n"
-" Turn assertion failures into C++ exceptions.\n"
-" @G--" GTEST_FLAG_PREFIX_ "catch_exceptions=0@D\n"
-" Do not report exceptions as test failures. Instead, allow them\n"
-" to crash the program or throw a pop-up (on Windows).\n"
-"\n"
-"Except for @G--" GTEST_FLAG_PREFIX_ "list_tests@D, you can alternatively set "
- "the corresponding\n"
-"environment variable of a flag (all letters in upper-case). For example, to\n"
-"disable colored text output, you can either specify @G--" GTEST_FLAG_PREFIX_
- "color=no@D or set\n"
-"the @G" GTEST_FLAG_PREFIX_UPPER_ "COLOR@D environment variable to @Gno@D.\n"
-"\n"
-"For more information, please read the " GTEST_NAME_ " documentation at\n"
-"@G" GTEST_PROJECT_URL_ "@D. If you find a bug in " GTEST_NAME_ "\n"
-"(not one in your own code or tests), please report it to\n"
-"@G<" GTEST_DEV_EMAIL_ ">@D.\n";
-
-// Parses the command line for Google Test flags, without initializing
-// other parts of Google Test. The type parameter CharType can be
-// instantiated to either char or wchar_t.
-template <typename CharType>
-void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
- for (int i = 1; i < *argc; i++) {
- const std::string arg_string = StreamableToString(argv[i]);
- const char* const arg = arg_string.c_str();
-
- using internal::ParseBoolFlag;
- using internal::ParseInt32Flag;
- using internal::ParseStringFlag;
-
- // Do we see a Google Test flag?
- if (ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag,
- >EST_FLAG(also_run_disabled_tests)) ||
- ParseBoolFlag(arg, kBreakOnFailureFlag,
- >EST_FLAG(break_on_failure)) ||
- ParseBoolFlag(arg, kCatchExceptionsFlag,
- >EST_FLAG(catch_exceptions)) ||
- ParseStringFlag(arg, kColorFlag, >EST_FLAG(color)) ||
- ParseStringFlag(arg, kDeathTestStyleFlag,
- >EST_FLAG(death_test_style)) ||
- ParseBoolFlag(arg, kDeathTestUseFork,
- >EST_FLAG(death_test_use_fork)) ||
- ParseStringFlag(arg, kFilterFlag, >EST_FLAG(filter)) ||
- ParseStringFlag(arg, kInternalRunDeathTestFlag,
- >EST_FLAG(internal_run_death_test)) ||
- ParseBoolFlag(arg, kListTestsFlag, >EST_FLAG(list_tests)) ||
- ParseStringFlag(arg, kOutputFlag, >EST_FLAG(output)) ||
- ParseBoolFlag(arg, kPrintTimeFlag, >EST_FLAG(print_time)) ||
- ParseInt32Flag(arg, kRandomSeedFlag, >EST_FLAG(random_seed)) ||
- ParseInt32Flag(arg, kRepeatFlag, >EST_FLAG(repeat)) ||
- ParseBoolFlag(arg, kShuffleFlag, >EST_FLAG(shuffle)) ||
- ParseInt32Flag(arg, kStackTraceDepthFlag,
- >EST_FLAG(stack_trace_depth)) ||
- ParseStringFlag(arg, kStreamResultToFlag,
- >EST_FLAG(stream_result_to)) ||
- ParseBoolFlag(arg, kThrowOnFailureFlag,
- >EST_FLAG(throw_on_failure))
- ) {
- // Yes. Shift the remainder of the argv list left by one. Note
- // that argv has (*argc + 1) elements, the last one always being
- // NULL. The following loop moves the trailing NULL element as
- // well.
- for (int j = i; j != *argc; j++) {
- argv[j] = argv[j + 1];
- }
-
- // Decrements the argument count.
- (*argc)--;
-
- // We also need to decrement the iterator as we just removed
- // an element.
- i--;
- } else if (arg_string == "--help" || arg_string == "-h" ||
- arg_string == "-?" || arg_string == "/?" ||
- HasGoogleTestFlagPrefix(arg)) {
- // Both help flag and unrecognized Google Test flags (excluding
- // internal ones) trigger help display.
- g_help_flag = true;
- }
- }
-
- if (g_help_flag) {
- // We print the help here instead of in RUN_ALL_TESTS(), as the
- // latter may not be called at all if the user is using Google
- // Test with another testing framework.
- PrintColorEncoded(kColorEncodedHelpMessage);
- }
-}
-
-// Parses the command line for Google Test flags, without initializing
-// other parts of Google Test.
-void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
- ParseGoogleTestFlagsOnlyImpl(argc, argv);
-}
-void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {
- ParseGoogleTestFlagsOnlyImpl(argc, argv);
-}
-
-// The internal implementation of InitGoogleTest().
-//
-// The type parameter CharType can be instantiated to either char or
-// wchar_t.
-template <typename CharType>
-void InitGoogleTestImpl(int* argc, CharType** argv) {
- g_init_gtest_count++;
-
- // We don't want to run the initialization code twice.
- if (g_init_gtest_count != 1) return;
-
- if (*argc <= 0) return;
-
- internal::g_executable_path = internal::StreamableToString(argv[0]);
-
-#if GTEST_HAS_DEATH_TEST
-
- g_argvs.clear();
- for (int i = 0; i != *argc; i++) {
- g_argvs.push_back(StreamableToString(argv[i]));
- }
-
-#endif // GTEST_HAS_DEATH_TEST
-
- ParseGoogleTestFlagsOnly(argc, argv);
- GetUnitTestImpl()->PostFlagParsingInit();
-}
-
-} // namespace internal
-
-// Initializes Google Test. This must be called before calling
-// RUN_ALL_TESTS(). In particular, it parses a command line for the
-// flags that Google Test recognizes. Whenever a Google Test flag is
-// seen, it is removed from argv, and *argc is decremented.
-//
-// No value is returned. Instead, the Google Test flag variables are
-// updated.
-//
-// Calling the function for the second time has no user-visible effect.
-void InitGoogleTest(int* argc, char** argv) {
- internal::InitGoogleTestImpl(argc, argv);
-}
-
-// This overloaded version can be used in Windows programs compiled in
-// UNICODE mode.
-void InitGoogleTest(int* argc, wchar_t** argv) {
- internal::InitGoogleTestImpl(argc, argv);
-}
-
-} // namespace testing
diff --git a/third_party/ntcore_2017/gmock/gtest/src/gtest_main.cc b/third_party/ntcore_2017/gmock/gtest/src/gtest_main.cc
deleted file mode 100644
index f302822..0000000
--- a/third_party/ntcore_2017/gmock/gtest/src/gtest_main.cc
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include <stdio.h>
-
-#include "gtest/gtest.h"
-
-GTEST_API_ int main(int argc, char **argv) {
- printf("Running main() from gtest_main.cc\n");
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock-actions.h b/third_party/ntcore_2017/gmock/include/gmock/gmock-actions.h
deleted file mode 100644
index 7e9708e..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock-actions.h
+++ /dev/null
@@ -1,1078 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some commonly used actions.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
-
-#ifndef _WIN32_WCE
-# include <errno.h>
-#endif
-
-#include <algorithm>
-#include <string>
-
-#include "gmock/internal/gmock-internal-utils.h"
-#include "gmock/internal/gmock-port.h"
-
-namespace testing {
-
-// To implement an action Foo, define:
-// 1. a class FooAction that implements the ActionInterface interface, and
-// 2. a factory function that creates an Action object from a
-// const FooAction*.
-//
-// The two-level delegation design follows that of Matcher, providing
-// consistency for extension developers. It also eases ownership
-// management as Action objects can now be copied like plain values.
-
-namespace internal {
-
-template <typename F1, typename F2>
-class ActionAdaptor;
-
-// BuiltInDefaultValue<T>::Get() returns the "built-in" default
-// value for type T, which is NULL when T is a pointer type, 0 when T
-// is a numeric type, false when T is bool, or "" when T is string or
-// std::string. For any other type T, this value is undefined and the
-// function will abort the process.
-template <typename T>
-class BuiltInDefaultValue {
- public:
- // This function returns true iff type T has a built-in default value.
- static bool Exists() { return false; }
- static T Get() {
- Assert(false, __FILE__, __LINE__,
- "Default action undefined for the function return type.");
- return internal::Invalid<T>();
- // The above statement will never be reached, but is required in
- // order for this function to compile.
- }
-};
-
-// This partial specialization says that we use the same built-in
-// default value for T and const T.
-template <typename T>
-class BuiltInDefaultValue<const T> {
- public:
- static bool Exists() { return BuiltInDefaultValue<T>::Exists(); }
- static T Get() { return BuiltInDefaultValue<T>::Get(); }
-};
-
-// This partial specialization defines the default values for pointer
-// types.
-template <typename T>
-class BuiltInDefaultValue<T*> {
- public:
- static bool Exists() { return true; }
- static T* Get() { return NULL; }
-};
-
-// The following specializations define the default values for
-// specific types we care about.
-#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(type, value) \
- template <> \
- class BuiltInDefaultValue<type> { \
- public: \
- static bool Exists() { return true; } \
- static type Get() { return value; } \
- }
-
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(void, ); // NOLINT
-#if GTEST_HAS_GLOBAL_STRING
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::string, "");
-#endif // GTEST_HAS_GLOBAL_STRING
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::std::string, "");
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(bool, false);
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned char, '\0');
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed char, '\0');
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(char, '\0');
-
-// There's no need for a default action for signed wchar_t, as that
-// type is the same as wchar_t for gcc, and invalid for MSVC.
-//
-// There's also no need for a default action for unsigned wchar_t, as
-// that type is the same as unsigned int for gcc, and invalid for
-// MSVC.
-#if GMOCK_WCHAR_T_IS_NATIVE_
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(wchar_t, 0U); // NOLINT
-#endif
-
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned short, 0U); // NOLINT
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed short, 0); // NOLINT
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned int, 0U);
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed int, 0);
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long, 0UL); // NOLINT
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long, 0L); // NOLINT
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(UInt64, 0);
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(Int64, 0);
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(float, 0);
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(double, 0);
-
-#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_
-
-} // namespace internal
-
-// When an unexpected function call is encountered, Google Mock will
-// let it return a default value if the user has specified one for its
-// return type, or if the return type has a built-in default value;
-// otherwise Google Mock won't know what value to return and will have
-// to abort the process.
-//
-// The DefaultValue<T> class allows a user to specify the
-// default value for a type T that is both copyable and publicly
-// destructible (i.e. anything that can be used as a function return
-// type). The usage is:
-//
-// // Sets the default value for type T to be foo.
-// DefaultValue<T>::Set(foo);
-template <typename T>
-class DefaultValue {
- public:
- // Sets the default value for type T; requires T to be
- // copy-constructable and have a public destructor.
- static void Set(T x) {
- delete value_;
- value_ = new T(x);
- }
-
- // Unsets the default value for type T.
- static void Clear() {
- delete value_;
- value_ = NULL;
- }
-
- // Returns true iff the user has set the default value for type T.
- static bool IsSet() { return value_ != NULL; }
-
- // Returns true if T has a default return value set by the user or there
- // exists a built-in default value.
- static bool Exists() {
- return IsSet() || internal::BuiltInDefaultValue<T>::Exists();
- }
-
- // Returns the default value for type T if the user has set one;
- // otherwise returns the built-in default value if there is one;
- // otherwise aborts the process.
- static T Get() {
- return value_ == NULL ?
- internal::BuiltInDefaultValue<T>::Get() : *value_;
- }
-
- private:
- static const T* value_;
-};
-
-// This partial specialization allows a user to set default values for
-// reference types.
-template <typename T>
-class DefaultValue<T&> {
- public:
- // Sets the default value for type T&.
- static void Set(T& x) { // NOLINT
- address_ = &x;
- }
-
- // Unsets the default value for type T&.
- static void Clear() {
- address_ = NULL;
- }
-
- // Returns true iff the user has set the default value for type T&.
- static bool IsSet() { return address_ != NULL; }
-
- // Returns true if T has a default return value set by the user or there
- // exists a built-in default value.
- static bool Exists() {
- return IsSet() || internal::BuiltInDefaultValue<T&>::Exists();
- }
-
- // Returns the default value for type T& if the user has set one;
- // otherwise returns the built-in default value if there is one;
- // otherwise aborts the process.
- static T& Get() {
- return address_ == NULL ?
- internal::BuiltInDefaultValue<T&>::Get() : *address_;
- }
-
- private:
- static T* address_;
-};
-
-// This specialization allows DefaultValue<void>::Get() to
-// compile.
-template <>
-class DefaultValue<void> {
- public:
- static bool Exists() { return true; }
- static void Get() {}
-};
-
-// Points to the user-set default value for type T.
-template <typename T>
-const T* DefaultValue<T>::value_ = NULL;
-
-// Points to the user-set default value for type T&.
-template <typename T>
-T* DefaultValue<T&>::address_ = NULL;
-
-// Implement this interface to define an action for function type F.
-template <typename F>
-class ActionInterface {
- public:
- typedef typename internal::Function<F>::Result Result;
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- ActionInterface() {}
- virtual ~ActionInterface() {}
-
- // Performs the action. This method is not const, as in general an
- // action can have side effects and be stateful. For example, a
- // get-the-next-element-from-the-collection action will need to
- // remember the current element.
- virtual Result Perform(const ArgumentTuple& args) = 0;
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionInterface);
-};
-
-// An Action<F> is a copyable and IMMUTABLE (except by assignment)
-// object that represents an action to be taken when a mock function
-// of type F is called. The implementation of Action<T> is just a
-// linked_ptr to const ActionInterface<T>, so copying is fairly cheap.
-// Don't inherit from Action!
-//
-// You can view an object implementing ActionInterface<F> as a
-// concrete action (including its current state), and an Action<F>
-// object as a handle to it.
-template <typename F>
-class Action {
- public:
- typedef typename internal::Function<F>::Result Result;
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- // Constructs a null Action. Needed for storing Action objects in
- // STL containers.
- Action() : impl_(NULL) {}
-
- // Constructs an Action from its implementation. A NULL impl is
- // used to represent the "do-default" action.
- explicit Action(ActionInterface<F>* impl) : impl_(impl) {}
-
- // Copy constructor.
- Action(const Action& action) : impl_(action.impl_) {}
-
- // This constructor allows us to turn an Action<Func> object into an
- // Action<F>, as long as F's arguments can be implicitly converted
- // to Func's and Func's return type can be implicitly converted to
- // F's.
- template <typename Func>
- explicit Action(const Action<Func>& action);
-
- // Returns true iff this is the DoDefault() action.
- bool IsDoDefault() const { return impl_.get() == NULL; }
-
- // Performs the action. Note that this method is const even though
- // the corresponding method in ActionInterface is not. The reason
- // is that a const Action<F> means that it cannot be re-bound to
- // another concrete action, not that the concrete action it binds to
- // cannot change state. (Think of the difference between a const
- // pointer and a pointer to const.)
- Result Perform(const ArgumentTuple& args) const {
- internal::Assert(
- !IsDoDefault(), __FILE__, __LINE__,
- "You are using DoDefault() inside a composite action like "
- "DoAll() or WithArgs(). This is not supported for technical "
- "reasons. Please instead spell out the default action, or "
- "assign the default action to an Action variable and use "
- "the variable in various places.");
- return impl_->Perform(args);
- }
-
- private:
- template <typename F1, typename F2>
- friend class internal::ActionAdaptor;
-
- internal::linked_ptr<ActionInterface<F> > impl_;
-};
-
-// The PolymorphicAction class template makes it easy to implement a
-// polymorphic action (i.e. an action that can be used in mock
-// functions of than one type, e.g. Return()).
-//
-// To define a polymorphic action, a user first provides a COPYABLE
-// implementation class that has a Perform() method template:
-//
-// class FooAction {
-// public:
-// template <typename Result, typename ArgumentTuple>
-// Result Perform(const ArgumentTuple& args) const {
-// // Processes the arguments and returns a result, using
-// // tr1::get<N>(args) to get the N-th (0-based) argument in the tuple.
-// }
-// ...
-// };
-//
-// Then the user creates the polymorphic action using
-// MakePolymorphicAction(object) where object has type FooAction. See
-// the definition of Return(void) and SetArgumentPointee<N>(value) for
-// complete examples.
-template <typename Impl>
-class PolymorphicAction {
- public:
- explicit PolymorphicAction(const Impl& impl) : impl_(impl) {}
-
- template <typename F>
- operator Action<F>() const {
- return Action<F>(new MonomorphicImpl<F>(impl_));
- }
-
- private:
- template <typename F>
- class MonomorphicImpl : public ActionInterface<F> {
- public:
- typedef typename internal::Function<F>::Result Result;
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
-
- virtual Result Perform(const ArgumentTuple& args) {
- return impl_.template Perform<Result>(args);
- }
-
- private:
- Impl impl_;
-
- GTEST_DISALLOW_ASSIGN_(MonomorphicImpl);
- };
-
- Impl impl_;
-
- GTEST_DISALLOW_ASSIGN_(PolymorphicAction);
-};
-
-// Creates an Action from its implementation and returns it. The
-// created Action object owns the implementation.
-template <typename F>
-Action<F> MakeAction(ActionInterface<F>* impl) {
- return Action<F>(impl);
-}
-
-// Creates a polymorphic action from its implementation. This is
-// easier to use than the PolymorphicAction<Impl> constructor as it
-// doesn't require you to explicitly write the template argument, e.g.
-//
-// MakePolymorphicAction(foo);
-// vs
-// PolymorphicAction<TypeOfFoo>(foo);
-template <typename Impl>
-inline PolymorphicAction<Impl> MakePolymorphicAction(const Impl& impl) {
- return PolymorphicAction<Impl>(impl);
-}
-
-namespace internal {
-
-// Allows an Action<F2> object to pose as an Action<F1>, as long as F2
-// and F1 are compatible.
-template <typename F1, typename F2>
-class ActionAdaptor : public ActionInterface<F1> {
- public:
- typedef typename internal::Function<F1>::Result Result;
- typedef typename internal::Function<F1>::ArgumentTuple ArgumentTuple;
-
- explicit ActionAdaptor(const Action<F2>& from) : impl_(from.impl_) {}
-
- virtual Result Perform(const ArgumentTuple& args) {
- return impl_->Perform(args);
- }
-
- private:
- const internal::linked_ptr<ActionInterface<F2> > impl_;
-
- GTEST_DISALLOW_ASSIGN_(ActionAdaptor);
-};
-
-// Implements the polymorphic Return(x) action, which can be used in
-// any function that returns the type of x, regardless of the argument
-// types.
-//
-// Note: The value passed into Return must be converted into
-// Function<F>::Result when this action is cast to Action<F> rather than
-// when that action is performed. This is important in scenarios like
-//
-// MOCK_METHOD1(Method, T(U));
-// ...
-// {
-// Foo foo;
-// X x(&foo);
-// EXPECT_CALL(mock, Method(_)).WillOnce(Return(x));
-// }
-//
-// In the example above the variable x holds reference to foo which leaves
-// scope and gets destroyed. If copying X just copies a reference to foo,
-// that copy will be left with a hanging reference. If conversion to T
-// makes a copy of foo, the above code is safe. To support that scenario, we
-// need to make sure that the type conversion happens inside the EXPECT_CALL
-// statement, and conversion of the result of Return to Action<T(U)> is a
-// good place for that.
-//
-template <typename R>
-class ReturnAction {
- public:
- // Constructs a ReturnAction object from the value to be returned.
- // 'value' is passed by value instead of by const reference in order
- // to allow Return("string literal") to compile.
- explicit ReturnAction(R value) : value_(value) {}
-
- // This template type conversion operator allows Return(x) to be
- // used in ANY function that returns x's type.
- template <typename F>
- operator Action<F>() const {
- // Assert statement belongs here because this is the best place to verify
- // conditions on F. It produces the clearest error messages
- // in most compilers.
- // Impl really belongs in this scope as a local class but can't
- // because MSVC produces duplicate symbols in different translation units
- // in this case. Until MS fixes that bug we put Impl into the class scope
- // and put the typedef both here (for use in assert statement) and
- // in the Impl class. But both definitions must be the same.
- typedef typename Function<F>::Result Result;
- GTEST_COMPILE_ASSERT_(
- !internal::is_reference<Result>::value,
- use_ReturnRef_instead_of_Return_to_return_a_reference);
- return Action<F>(new Impl<F>(value_));
- }
-
- private:
- // Implements the Return(x) action for a particular function type F.
- template <typename F>
- class Impl : public ActionInterface<F> {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-
- // The implicit cast is necessary when Result has more than one
- // single-argument constructor (e.g. Result is std::vector<int>) and R
- // has a type conversion operator template. In that case, value_(value)
- // won't compile as the compiler doesn't known which constructor of
- // Result to call. ImplicitCast_ forces the compiler to convert R to
- // Result without considering explicit constructors, thus resolving the
- // ambiguity. value_ is then initialized using its copy constructor.
- explicit Impl(R value)
- : value_(::testing::internal::ImplicitCast_<Result>(value)) {}
-
- virtual Result Perform(const ArgumentTuple&) { return value_; }
-
- private:
- GTEST_COMPILE_ASSERT_(!internal::is_reference<Result>::value,
- Result_cannot_be_a_reference_type);
- Result value_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- R value_;
-
- GTEST_DISALLOW_ASSIGN_(ReturnAction);
-};
-
-// Implements the ReturnNull() action.
-class ReturnNullAction {
- public:
- // Allows ReturnNull() to be used in any pointer-returning function.
- template <typename Result, typename ArgumentTuple>
- static Result Perform(const ArgumentTuple&) {
- GTEST_COMPILE_ASSERT_(internal::is_pointer<Result>::value,
- ReturnNull_can_be_used_to_return_a_pointer_only);
- return NULL;
- }
-};
-
-// Implements the Return() action.
-class ReturnVoidAction {
- public:
- // Allows Return() to be used in any void-returning function.
- template <typename Result, typename ArgumentTuple>
- static void Perform(const ArgumentTuple&) {
- CompileAssertTypesEqual<void, Result>();
- }
-};
-
-// Implements the polymorphic ReturnRef(x) action, which can be used
-// in any function that returns a reference to the type of x,
-// regardless of the argument types.
-template <typename T>
-class ReturnRefAction {
- public:
- // Constructs a ReturnRefAction object from the reference to be returned.
- explicit ReturnRefAction(T& ref) : ref_(ref) {} // NOLINT
-
- // This template type conversion operator allows ReturnRef(x) to be
- // used in ANY function that returns a reference to x's type.
- template <typename F>
- operator Action<F>() const {
- typedef typename Function<F>::Result Result;
- // Asserts that the function return type is a reference. This
- // catches the user error of using ReturnRef(x) when Return(x)
- // should be used, and generates some helpful error message.
- GTEST_COMPILE_ASSERT_(internal::is_reference<Result>::value,
- use_Return_instead_of_ReturnRef_to_return_a_value);
- return Action<F>(new Impl<F>(ref_));
- }
-
- private:
- // Implements the ReturnRef(x) action for a particular function type F.
- template <typename F>
- class Impl : public ActionInterface<F> {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-
- explicit Impl(T& ref) : ref_(ref) {} // NOLINT
-
- virtual Result Perform(const ArgumentTuple&) {
- return ref_;
- }
-
- private:
- T& ref_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- T& ref_;
-
- GTEST_DISALLOW_ASSIGN_(ReturnRefAction);
-};
-
-// Implements the polymorphic ReturnRefOfCopy(x) action, which can be
-// used in any function that returns a reference to the type of x,
-// regardless of the argument types.
-template <typename T>
-class ReturnRefOfCopyAction {
- public:
- // Constructs a ReturnRefOfCopyAction object from the reference to
- // be returned.
- explicit ReturnRefOfCopyAction(const T& value) : value_(value) {} // NOLINT
-
- // This template type conversion operator allows ReturnRefOfCopy(x) to be
- // used in ANY function that returns a reference to x's type.
- template <typename F>
- operator Action<F>() const {
- typedef typename Function<F>::Result Result;
- // Asserts that the function return type is a reference. This
- // catches the user error of using ReturnRefOfCopy(x) when Return(x)
- // should be used, and generates some helpful error message.
- GTEST_COMPILE_ASSERT_(
- internal::is_reference<Result>::value,
- use_Return_instead_of_ReturnRefOfCopy_to_return_a_value);
- return Action<F>(new Impl<F>(value_));
- }
-
- private:
- // Implements the ReturnRefOfCopy(x) action for a particular function type F.
- template <typename F>
- class Impl : public ActionInterface<F> {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-
- explicit Impl(const T& value) : value_(value) {} // NOLINT
-
- virtual Result Perform(const ArgumentTuple&) {
- return value_;
- }
-
- private:
- T value_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- const T value_;
-
- GTEST_DISALLOW_ASSIGN_(ReturnRefOfCopyAction);
-};
-
-// Implements the polymorphic DoDefault() action.
-class DoDefaultAction {
- public:
- // This template type conversion operator allows DoDefault() to be
- // used in any function.
- template <typename F>
- operator Action<F>() const { return Action<F>(NULL); }
-};
-
-// Implements the Assign action to set a given pointer referent to a
-// particular value.
-template <typename T1, typename T2>
-class AssignAction {
- public:
- AssignAction(T1* ptr, T2 value) : ptr_(ptr), value_(value) {}
-
- template <typename Result, typename ArgumentTuple>
- void Perform(const ArgumentTuple& /* args */) const {
- *ptr_ = value_;
- }
-
- private:
- T1* const ptr_;
- const T2 value_;
-
- GTEST_DISALLOW_ASSIGN_(AssignAction);
-};
-
-#if !GTEST_OS_WINDOWS_MOBILE
-
-// Implements the SetErrnoAndReturn action to simulate return from
-// various system calls and libc functions.
-template <typename T>
-class SetErrnoAndReturnAction {
- public:
- SetErrnoAndReturnAction(int errno_value, T result)
- : errno_(errno_value),
- result_(result) {}
- template <typename Result, typename ArgumentTuple>
- Result Perform(const ArgumentTuple& /* args */) const {
- errno = errno_;
- return result_;
- }
-
- private:
- const int errno_;
- const T result_;
-
- GTEST_DISALLOW_ASSIGN_(SetErrnoAndReturnAction);
-};
-
-#endif // !GTEST_OS_WINDOWS_MOBILE
-
-// Implements the SetArgumentPointee<N>(x) action for any function
-// whose N-th argument (0-based) is a pointer to x's type. The
-// template parameter kIsProto is true iff type A is ProtocolMessage,
-// proto2::Message, or a sub-class of those.
-template <size_t N, typename A, bool kIsProto>
-class SetArgumentPointeeAction {
- public:
- // Constructs an action that sets the variable pointed to by the
- // N-th function argument to 'value'.
- explicit SetArgumentPointeeAction(const A& value) : value_(value) {}
-
- template <typename Result, typename ArgumentTuple>
- void Perform(const ArgumentTuple& args) const {
- CompileAssertTypesEqual<void, Result>();
- *::std::tr1::get<N>(args) = value_;
- }
-
- private:
- const A value_;
-
- GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction);
-};
-
-template <size_t N, typename Proto>
-class SetArgumentPointeeAction<N, Proto, true> {
- public:
- // Constructs an action that sets the variable pointed to by the
- // N-th function argument to 'proto'. Both ProtocolMessage and
- // proto2::Message have the CopyFrom() method, so the same
- // implementation works for both.
- explicit SetArgumentPointeeAction(const Proto& proto) : proto_(new Proto) {
- proto_->CopyFrom(proto);
- }
-
- template <typename Result, typename ArgumentTuple>
- void Perform(const ArgumentTuple& args) const {
- CompileAssertTypesEqual<void, Result>();
- ::std::tr1::get<N>(args)->CopyFrom(*proto_);
- }
-
- private:
- const internal::linked_ptr<Proto> proto_;
-
- GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction);
-};
-
-// Implements the InvokeWithoutArgs(f) action. The template argument
-// FunctionImpl is the implementation type of f, which can be either a
-// function pointer or a functor. InvokeWithoutArgs(f) can be used as an
-// Action<F> as long as f's type is compatible with F (i.e. f can be
-// assigned to a tr1::function<F>).
-template <typename FunctionImpl>
-class InvokeWithoutArgsAction {
- public:
- // The c'tor makes a copy of function_impl (either a function
- // pointer or a functor).
- explicit InvokeWithoutArgsAction(FunctionImpl function_impl)
- : function_impl_(function_impl) {}
-
- // Allows InvokeWithoutArgs(f) to be used as any action whose type is
- // compatible with f.
- template <typename Result, typename ArgumentTuple>
- Result Perform(const ArgumentTuple&) { return function_impl_(); }
-
- private:
- FunctionImpl function_impl_;
-
- GTEST_DISALLOW_ASSIGN_(InvokeWithoutArgsAction);
-};
-
-// Implements the InvokeWithoutArgs(object_ptr, &Class::Method) action.
-template <class Class, typename MethodPtr>
-class InvokeMethodWithoutArgsAction {
- public:
- InvokeMethodWithoutArgsAction(Class* obj_ptr, MethodPtr method_ptr)
- : obj_ptr_(obj_ptr), method_ptr_(method_ptr) {}
-
- template <typename Result, typename ArgumentTuple>
- Result Perform(const ArgumentTuple&) const {
- return (obj_ptr_->*method_ptr_)();
- }
-
- private:
- Class* const obj_ptr_;
- const MethodPtr method_ptr_;
-
- GTEST_DISALLOW_ASSIGN_(InvokeMethodWithoutArgsAction);
-};
-
-// Implements the IgnoreResult(action) action.
-template <typename A>
-class IgnoreResultAction {
- public:
- explicit IgnoreResultAction(const A& action) : action_(action) {}
-
- template <typename F>
- operator Action<F>() const {
- // Assert statement belongs here because this is the best place to verify
- // conditions on F. It produces the clearest error messages
- // in most compilers.
- // Impl really belongs in this scope as a local class but can't
- // because MSVC produces duplicate symbols in different translation units
- // in this case. Until MS fixes that bug we put Impl into the class scope
- // and put the typedef both here (for use in assert statement) and
- // in the Impl class. But both definitions must be the same.
- typedef typename internal::Function<F>::Result Result;
-
- // Asserts at compile time that F returns void.
- CompileAssertTypesEqual<void, Result>();
-
- return Action<F>(new Impl<F>(action_));
- }
-
- private:
- template <typename F>
- class Impl : public ActionInterface<F> {
- public:
- typedef typename internal::Function<F>::Result Result;
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- explicit Impl(const A& action) : action_(action) {}
-
- virtual void Perform(const ArgumentTuple& args) {
- // Performs the action and ignores its result.
- action_.Perform(args);
- }
-
- private:
- // Type OriginalFunction is the same as F except that its return
- // type is IgnoredValue.
- typedef typename internal::Function<F>::MakeResultIgnoredValue
- OriginalFunction;
-
- const Action<OriginalFunction> action_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- const A action_;
-
- GTEST_DISALLOW_ASSIGN_(IgnoreResultAction);
-};
-
-// A ReferenceWrapper<T> object represents a reference to type T,
-// which can be either const or not. It can be explicitly converted
-// from, and implicitly converted to, a T&. Unlike a reference,
-// ReferenceWrapper<T> can be copied and can survive template type
-// inference. This is used to support by-reference arguments in the
-// InvokeArgument<N>(...) action. The idea was from "reference
-// wrappers" in tr1, which we don't have in our source tree yet.
-template <typename T>
-class ReferenceWrapper {
- public:
- // Constructs a ReferenceWrapper<T> object from a T&.
- explicit ReferenceWrapper(T& l_value) : pointer_(&l_value) {} // NOLINT
-
- // Allows a ReferenceWrapper<T> object to be implicitly converted to
- // a T&.
- operator T&() const { return *pointer_; }
- private:
- T* pointer_;
-};
-
-// Allows the expression ByRef(x) to be printed as a reference to x.
-template <typename T>
-void PrintTo(const ReferenceWrapper<T>& ref, ::std::ostream* os) {
- T& value = ref;
- UniversalPrinter<T&>::Print(value, os);
-}
-
-// Does two actions sequentially. Used for implementing the DoAll(a1,
-// a2, ...) action.
-template <typename Action1, typename Action2>
-class DoBothAction {
- public:
- DoBothAction(Action1 action1, Action2 action2)
- : action1_(action1), action2_(action2) {}
-
- // This template type conversion operator allows DoAll(a1, ..., a_n)
- // to be used in ANY function of compatible type.
- template <typename F>
- operator Action<F>() const {
- return Action<F>(new Impl<F>(action1_, action2_));
- }
-
- private:
- // Implements the DoAll(...) action for a particular function type F.
- template <typename F>
- class Impl : public ActionInterface<F> {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
- typedef typename Function<F>::MakeResultVoid VoidResult;
-
- Impl(const Action<VoidResult>& action1, const Action<F>& action2)
- : action1_(action1), action2_(action2) {}
-
- virtual Result Perform(const ArgumentTuple& args) {
- action1_.Perform(args);
- return action2_.Perform(args);
- }
-
- private:
- const Action<VoidResult> action1_;
- const Action<F> action2_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- Action1 action1_;
- Action2 action2_;
-
- GTEST_DISALLOW_ASSIGN_(DoBothAction);
-};
-
-} // namespace internal
-
-// An Unused object can be implicitly constructed from ANY value.
-// This is handy when defining actions that ignore some or all of the
-// mock function arguments. For example, given
-//
-// MOCK_METHOD3(Foo, double(const string& label, double x, double y));
-// MOCK_METHOD3(Bar, double(int index, double x, double y));
-//
-// instead of
-//
-// double DistanceToOriginWithLabel(const string& label, double x, double y) {
-// return sqrt(x*x + y*y);
-// }
-// double DistanceToOriginWithIndex(int index, double x, double y) {
-// return sqrt(x*x + y*y);
-// }
-// ...
-// EXEPCT_CALL(mock, Foo("abc", _, _))
-// .WillOnce(Invoke(DistanceToOriginWithLabel));
-// EXEPCT_CALL(mock, Bar(5, _, _))
-// .WillOnce(Invoke(DistanceToOriginWithIndex));
-//
-// you could write
-//
-// // We can declare any uninteresting argument as Unused.
-// double DistanceToOrigin(Unused, double x, double y) {
-// return sqrt(x*x + y*y);
-// }
-// ...
-// EXEPCT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin));
-// EXEPCT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin));
-typedef internal::IgnoredValue Unused;
-
-// This constructor allows us to turn an Action<From> object into an
-// Action<To>, as long as To's arguments can be implicitly converted
-// to From's and From's return type cann be implicitly converted to
-// To's.
-template <typename To>
-template <typename From>
-Action<To>::Action(const Action<From>& from)
- : impl_(new internal::ActionAdaptor<To, From>(from)) {}
-
-// Creates an action that returns 'value'. 'value' is passed by value
-// instead of const reference - otherwise Return("string literal")
-// will trigger a compiler error about using array as initializer.
-template <typename R>
-internal::ReturnAction<R> Return(R value) {
- return internal::ReturnAction<R>(value);
-}
-
-// Creates an action that returns NULL.
-inline PolymorphicAction<internal::ReturnNullAction> ReturnNull() {
- return MakePolymorphicAction(internal::ReturnNullAction());
-}
-
-// Creates an action that returns from a void function.
-inline PolymorphicAction<internal::ReturnVoidAction> Return() {
- return MakePolymorphicAction(internal::ReturnVoidAction());
-}
-
-// Creates an action that returns the reference to a variable.
-template <typename R>
-inline internal::ReturnRefAction<R> ReturnRef(R& x) { // NOLINT
- return internal::ReturnRefAction<R>(x);
-}
-
-// Creates an action that returns the reference to a copy of the
-// argument. The copy is created when the action is constructed and
-// lives as long as the action.
-template <typename R>
-inline internal::ReturnRefOfCopyAction<R> ReturnRefOfCopy(const R& x) {
- return internal::ReturnRefOfCopyAction<R>(x);
-}
-
-// Creates an action that does the default action for the give mock function.
-inline internal::DoDefaultAction DoDefault() {
- return internal::DoDefaultAction();
-}
-
-// Creates an action that sets the variable pointed by the N-th
-// (0-based) function argument to 'value'.
-template <size_t N, typename T>
-PolymorphicAction<
- internal::SetArgumentPointeeAction<
- N, T, internal::IsAProtocolMessage<T>::value> >
-SetArgPointee(const T& x) {
- return MakePolymorphicAction(internal::SetArgumentPointeeAction<
- N, T, internal::IsAProtocolMessage<T>::value>(x));
-}
-
-#if !((GTEST_GCC_VER_ && GTEST_GCC_VER_ < 40000) || GTEST_OS_SYMBIAN)
-// This overload allows SetArgPointee() to accept a string literal.
-// GCC prior to the version 4.0 and Symbian C++ compiler cannot distinguish
-// this overload from the templated version and emit a compile error.
-template <size_t N>
-PolymorphicAction<
- internal::SetArgumentPointeeAction<N, const char*, false> >
-SetArgPointee(const char* p) {
- return MakePolymorphicAction(internal::SetArgumentPointeeAction<
- N, const char*, false>(p));
-}
-
-template <size_t N>
-PolymorphicAction<
- internal::SetArgumentPointeeAction<N, const wchar_t*, false> >
-SetArgPointee(const wchar_t* p) {
- return MakePolymorphicAction(internal::SetArgumentPointeeAction<
- N, const wchar_t*, false>(p));
-}
-#endif
-
-// The following version is DEPRECATED.
-template <size_t N, typename T>
-PolymorphicAction<
- internal::SetArgumentPointeeAction<
- N, T, internal::IsAProtocolMessage<T>::value> >
-SetArgumentPointee(const T& x) {
- return MakePolymorphicAction(internal::SetArgumentPointeeAction<
- N, T, internal::IsAProtocolMessage<T>::value>(x));
-}
-
-// Creates an action that sets a pointer referent to a given value.
-template <typename T1, typename T2>
-PolymorphicAction<internal::AssignAction<T1, T2> > Assign(T1* ptr, T2 val) {
- return MakePolymorphicAction(internal::AssignAction<T1, T2>(ptr, val));
-}
-
-#if !GTEST_OS_WINDOWS_MOBILE
-
-// Creates an action that sets errno and returns the appropriate error.
-template <typename T>
-PolymorphicAction<internal::SetErrnoAndReturnAction<T> >
-SetErrnoAndReturn(int errval, T result) {
- return MakePolymorphicAction(
- internal::SetErrnoAndReturnAction<T>(errval, result));
-}
-
-#endif // !GTEST_OS_WINDOWS_MOBILE
-
-// Various overloads for InvokeWithoutArgs().
-
-// Creates an action that invokes 'function_impl' with no argument.
-template <typename FunctionImpl>
-PolymorphicAction<internal::InvokeWithoutArgsAction<FunctionImpl> >
-InvokeWithoutArgs(FunctionImpl function_impl) {
- return MakePolymorphicAction(
- internal::InvokeWithoutArgsAction<FunctionImpl>(function_impl));
-}
-
-// Creates an action that invokes the given method on the given object
-// with no argument.
-template <class Class, typename MethodPtr>
-PolymorphicAction<internal::InvokeMethodWithoutArgsAction<Class, MethodPtr> >
-InvokeWithoutArgs(Class* obj_ptr, MethodPtr method_ptr) {
- return MakePolymorphicAction(
- internal::InvokeMethodWithoutArgsAction<Class, MethodPtr>(
- obj_ptr, method_ptr));
-}
-
-// Creates an action that performs an_action and throws away its
-// result. In other words, it changes the return type of an_action to
-// void. an_action MUST NOT return void, or the code won't compile.
-template <typename A>
-inline internal::IgnoreResultAction<A> IgnoreResult(const A& an_action) {
- return internal::IgnoreResultAction<A>(an_action);
-}
-
-// Creates a reference wrapper for the given L-value. If necessary,
-// you can explicitly specify the type of the reference. For example,
-// suppose 'derived' is an object of type Derived, ByRef(derived)
-// would wrap a Derived&. If you want to wrap a const Base& instead,
-// where Base is a base class of Derived, just write:
-//
-// ByRef<const Base>(derived)
-template <typename T>
-inline internal::ReferenceWrapper<T> ByRef(T& l_value) { // NOLINT
- return internal::ReferenceWrapper<T>(l_value);
-}
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock-cardinalities.h b/third_party/ntcore_2017/gmock/include/gmock/gmock-cardinalities.h
deleted file mode 100644
index fc315f9..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock-cardinalities.h
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some commonly used cardinalities. More
-// cardinalities can be defined by the user implementing the
-// CardinalityInterface interface if necessary.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
-
-#include <limits.h>
-#include <ostream> // NOLINT
-#include "gmock/internal/gmock-port.h"
-#include "gtest/gtest.h"
-
-namespace testing {
-
-// To implement a cardinality Foo, define:
-// 1. a class FooCardinality that implements the
-// CardinalityInterface interface, and
-// 2. a factory function that creates a Cardinality object from a
-// const FooCardinality*.
-//
-// The two-level delegation design follows that of Matcher, providing
-// consistency for extension developers. It also eases ownership
-// management as Cardinality objects can now be copied like plain values.
-
-// The implementation of a cardinality.
-class CardinalityInterface {
- public:
- virtual ~CardinalityInterface() {}
-
- // Conservative estimate on the lower/upper bound of the number of
- // calls allowed.
- virtual int ConservativeLowerBound() const { return 0; }
- virtual int ConservativeUpperBound() const { return INT_MAX; }
-
- // Returns true iff call_count calls will satisfy this cardinality.
- virtual bool IsSatisfiedByCallCount(int call_count) const = 0;
-
- // Returns true iff call_count calls will saturate this cardinality.
- virtual bool IsSaturatedByCallCount(int call_count) const = 0;
-
- // Describes self to an ostream.
- virtual void DescribeTo(::std::ostream* os) const = 0;
-};
-
-// A Cardinality is a copyable and IMMUTABLE (except by assignment)
-// object that specifies how many times a mock function is expected to
-// be called. The implementation of Cardinality is just a linked_ptr
-// to const CardinalityInterface, so copying is fairly cheap.
-// Don't inherit from Cardinality!
-class GTEST_API_ Cardinality {
- public:
- // Constructs a null cardinality. Needed for storing Cardinality
- // objects in STL containers.
- Cardinality() {}
-
- // Constructs a Cardinality from its implementation.
- explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {}
-
- // Conservative estimate on the lower/upper bound of the number of
- // calls allowed.
- int ConservativeLowerBound() const { return impl_->ConservativeLowerBound(); }
- int ConservativeUpperBound() const { return impl_->ConservativeUpperBound(); }
-
- // Returns true iff call_count calls will satisfy this cardinality.
- bool IsSatisfiedByCallCount(int call_count) const {
- return impl_->IsSatisfiedByCallCount(call_count);
- }
-
- // Returns true iff call_count calls will saturate this cardinality.
- bool IsSaturatedByCallCount(int call_count) const {
- return impl_->IsSaturatedByCallCount(call_count);
- }
-
- // Returns true iff call_count calls will over-saturate this
- // cardinality, i.e. exceed the maximum number of allowed calls.
- bool IsOverSaturatedByCallCount(int call_count) const {
- return impl_->IsSaturatedByCallCount(call_count) &&
- !impl_->IsSatisfiedByCallCount(call_count);
- }
-
- // Describes self to an ostream
- void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); }
-
- // Describes the given actual call count to an ostream.
- static void DescribeActualCallCountTo(int actual_call_count,
- ::std::ostream* os);
-
- private:
- internal::linked_ptr<const CardinalityInterface> impl_;
-};
-
-// Creates a cardinality that allows at least n calls.
-GTEST_API_ Cardinality AtLeast(int n);
-
-// Creates a cardinality that allows at most n calls.
-GTEST_API_ Cardinality AtMost(int n);
-
-// Creates a cardinality that allows any number of calls.
-GTEST_API_ Cardinality AnyNumber();
-
-// Creates a cardinality that allows between min and max calls.
-GTEST_API_ Cardinality Between(int min, int max);
-
-// Creates a cardinality that allows exactly n calls.
-GTEST_API_ Cardinality Exactly(int n);
-
-// Creates a cardinality from its implementation.
-inline Cardinality MakeCardinality(const CardinalityInterface* c) {
- return Cardinality(c);
-}
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-actions.h b/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-actions.h
deleted file mode 100644
index 2327393..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-actions.h
+++ /dev/null
@@ -1,2415 +0,0 @@
-// This file was GENERATED by a script. DO NOT EDIT BY HAND!!!
-
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some commonly used variadic actions.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
-
-#include "gmock/gmock-actions.h"
-#include "gmock/internal/gmock-port.h"
-
-namespace testing {
-namespace internal {
-
-// InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
-// function or method with the unpacked values, where F is a function
-// type that takes N arguments.
-template <typename Result, typename ArgumentTuple>
-class InvokeHelper;
-
-template <typename R>
-class InvokeHelper<R, ::std::tr1::tuple<> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tr1::tuple<>&) {
- return function();
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tr1::tuple<>&) {
- return (obj_ptr->*method_ptr)();
- }
-};
-
-template <typename R, typename A1>
-class InvokeHelper<R, ::std::tr1::tuple<A1> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tr1::tuple<A1>& args) {
- using ::std::tr1::get;
- return function(get<0>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tr1::tuple<A1>& args) {
- using ::std::tr1::get;
- return (obj_ptr->*method_ptr)(get<0>(args));
- }
-};
-
-template <typename R, typename A1, typename A2>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tr1::tuple<A1, A2>& args) {
- using ::std::tr1::get;
- return function(get<0>(args), get<1>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tr1::tuple<A1, A2>& args) {
- using ::std::tr1::get;
- return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tr1::tuple<A1, A2,
- A3>& args) {
- using ::std::tr1::get;
- return function(get<0>(args), get<1>(args), get<2>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tr1::tuple<A1, A2, A3>& args) {
- using ::std::tr1::get;
- return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3,
- A4>& args) {
- using ::std::tr1::get;
- return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tr1::tuple<A1, A2, A3, A4>& args) {
- using ::std::tr1::get;
- return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
- get<3>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
- A5>& args) {
- using ::std::tr1::get;
- return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
- get<4>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tr1::tuple<A1, A2, A3, A4, A5>& args) {
- using ::std::tr1::get;
- return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
- get<3>(args), get<4>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
- A5, A6>& args) {
- using ::std::tr1::get;
- return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
- get<4>(args), get<5>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6>& args) {
- using ::std::tr1::get;
- return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
- get<3>(args), get<4>(args), get<5>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
- A5, A6, A7>& args) {
- using ::std::tr1::get;
- return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
- get<4>(args), get<5>(args), get<6>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6,
- A7>& args) {
- using ::std::tr1::get;
- return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
- get<3>(args), get<4>(args), get<5>(args), get<6>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
- A5, A6, A7, A8>& args) {
- using ::std::tr1::get;
- return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
- get<4>(args), get<5>(args), get<6>(args), get<7>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7,
- A8>& args) {
- using ::std::tr1::get;
- return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
- get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
- A5, A6, A7, A8, A9>& args) {
- using ::std::tr1::get;
- return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
- get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
- A9>& args) {
- using ::std::tr1::get;
- return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
- get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args),
- get<8>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9,
- typename A10>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
- A10> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
- A5, A6, A7, A8, A9, A10>& args) {
- using ::std::tr1::get;
- return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
- get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
- get<9>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
- A9, A10>& args) {
- using ::std::tr1::get;
- return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
- get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args),
- get<8>(args), get<9>(args));
- }
-};
-
-// CallableHelper has static methods for invoking "callables",
-// i.e. function pointers and functors. It uses overloading to
-// provide a uniform interface for invoking different kinds of
-// callables. In particular, you can use:
-//
-// CallableHelper<R>::Call(callable, a1, a2, ..., an)
-//
-// to invoke an n-ary callable, where R is its return type. If an
-// argument, say a2, needs to be passed by reference, you should write
-// ByRef(a2) instead of a2 in the above expression.
-template <typename R>
-class CallableHelper {
- public:
- // Calls a nullary callable.
- template <typename Function>
- static R Call(Function function) { return function(); }
-
- // Calls a unary callable.
-
- // We deliberately pass a1 by value instead of const reference here
- // in case it is a C-string literal. If we had declared the
- // parameter as 'const A1& a1' and write Call(function, "Hi"), the
- // compiler would've thought A1 is 'char[3]', which causes trouble
- // when you need to copy a value of type A1. By declaring the
- // parameter as 'A1 a1', the compiler will correctly infer that A1
- // is 'const char*' when it sees Call(function, "Hi").
- //
- // Since this function is defined inline, the compiler can get rid
- // of the copying of the arguments. Therefore the performance won't
- // be hurt.
- template <typename Function, typename A1>
- static R Call(Function function, A1 a1) { return function(a1); }
-
- // Calls a binary callable.
- template <typename Function, typename A1, typename A2>
- static R Call(Function function, A1 a1, A2 a2) {
- return function(a1, a2);
- }
-
- // Calls a ternary callable.
- template <typename Function, typename A1, typename A2, typename A3>
- static R Call(Function function, A1 a1, A2 a2, A3 a3) {
- return function(a1, a2, a3);
- }
-
- // Calls a 4-ary callable.
- template <typename Function, typename A1, typename A2, typename A3,
- typename A4>
- static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4) {
- return function(a1, a2, a3, a4);
- }
-
- // Calls a 5-ary callable.
- template <typename Function, typename A1, typename A2, typename A3,
- typename A4, typename A5>
- static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
- return function(a1, a2, a3, a4, a5);
- }
-
- // Calls a 6-ary callable.
- template <typename Function, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6>
- static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
- return function(a1, a2, a3, a4, a5, a6);
- }
-
- // Calls a 7-ary callable.
- template <typename Function, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6, typename A7>
- static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
- A7 a7) {
- return function(a1, a2, a3, a4, a5, a6, a7);
- }
-
- // Calls a 8-ary callable.
- template <typename Function, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6, typename A7, typename A8>
- static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
- A7 a7, A8 a8) {
- return function(a1, a2, a3, a4, a5, a6, a7, a8);
- }
-
- // Calls a 9-ary callable.
- template <typename Function, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6, typename A7, typename A8,
- typename A9>
- static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
- A7 a7, A8 a8, A9 a9) {
- return function(a1, a2, a3, a4, a5, a6, a7, a8, a9);
- }
-
- // Calls a 10-ary callable.
- template <typename Function, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6, typename A7, typename A8,
- typename A9, typename A10>
- static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
- A7 a7, A8 a8, A9 a9, A10 a10) {
- return function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
- }
-}; // class CallableHelper
-
-// An INTERNAL macro for extracting the type of a tuple field. It's
-// subject to change without notice - DO NOT USE IN USER CODE!
-#define GMOCK_FIELD_(Tuple, N) \
- typename ::std::tr1::tuple_element<N, Tuple>::type
-
-// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the
-// type of an n-ary function whose i-th (1-based) argument type is the
-// k{i}-th (0-based) field of ArgumentTuple, which must be a tuple
-// type, and whose return type is Result. For example,
-// SelectArgs<int, ::std::tr1::tuple<bool, char, double, long>, 0, 3>::type
-// is int(bool, long).
-//
-// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args)
-// returns the selected fields (k1, k2, ..., k_n) of args as a tuple.
-// For example,
-// SelectArgs<int, ::std::tr1::tuple<bool, char, double>, 2, 0>::Select(
-// ::std::tr1::make_tuple(true, 'a', 2.5))
-// returns ::std::tr1::tuple (2.5, true).
-//
-// The numbers in list k1, k2, ..., k_n must be >= 0, where n can be
-// in the range [0, 10]. Duplicates are allowed and they don't have
-// to be in an ascending or descending order.
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
- int k4, int k5, int k6, int k7, int k8, int k9, int k10>
-class SelectArgs {
- public:
- typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
- GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
- GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
- GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
- GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9),
- GMOCK_FIELD_(ArgumentTuple, k10));
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- using ::std::tr1::get;
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
- get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
- get<k8>(args), get<k9>(args), get<k10>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple>
-class SelectArgs<Result, ArgumentTuple,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef Result type();
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& /* args */) {
- using ::std::tr1::get;
- return SelectedArgs();
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1>
-class SelectArgs<Result, ArgumentTuple,
- k1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1));
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- using ::std::tr1::get;
- return SelectedArgs(get<k1>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
- GMOCK_FIELD_(ArgumentTuple, k2));
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- using ::std::tr1::get;
- return SelectedArgs(get<k1>(args), get<k2>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
- GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3));
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- using ::std::tr1::get;
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
- int k4>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, k4, -1, -1, -1, -1, -1, -1> {
- public:
- typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
- GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
- GMOCK_FIELD_(ArgumentTuple, k4));
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- using ::std::tr1::get;
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
- get<k4>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
- int k4, int k5>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, k4, k5, -1, -1, -1, -1, -1> {
- public:
- typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
- GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
- GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5));
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- using ::std::tr1::get;
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
- get<k4>(args), get<k5>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
- int k4, int k5, int k6>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, k4, k5, k6, -1, -1, -1, -1> {
- public:
- typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
- GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
- GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
- GMOCK_FIELD_(ArgumentTuple, k6));
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- using ::std::tr1::get;
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
- get<k4>(args), get<k5>(args), get<k6>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
- int k4, int k5, int k6, int k7>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, k4, k5, k6, k7, -1, -1, -1> {
- public:
- typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
- GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
- GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
- GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7));
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- using ::std::tr1::get;
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
- get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
- int k4, int k5, int k6, int k7, int k8>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, k4, k5, k6, k7, k8, -1, -1> {
- public:
- typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
- GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
- GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
- GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
- GMOCK_FIELD_(ArgumentTuple, k8));
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- using ::std::tr1::get;
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
- get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
- get<k8>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
- int k4, int k5, int k6, int k7, int k8, int k9>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, k4, k5, k6, k7, k8, k9, -1> {
- public:
- typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
- GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
- GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
- GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
- GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9));
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- using ::std::tr1::get;
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
- get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
- get<k8>(args), get<k9>(args));
- }
-};
-
-#undef GMOCK_FIELD_
-
-// Implements the WithArgs action.
-template <typename InnerAction, int k1 = -1, int k2 = -1, int k3 = -1,
- int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
- int k9 = -1, int k10 = -1>
-class WithArgsAction {
- public:
- explicit WithArgsAction(const InnerAction& action) : action_(action) {}
-
- template <typename F>
- operator Action<F>() const { return MakeAction(new Impl<F>(action_)); }
-
- private:
- template <typename F>
- class Impl : public ActionInterface<F> {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-
- explicit Impl(const InnerAction& action) : action_(action) {}
-
- virtual Result Perform(const ArgumentTuple& args) {
- return action_.Perform(SelectArgs<Result, ArgumentTuple, k1, k2, k3, k4,
- k5, k6, k7, k8, k9, k10>::Select(args));
- }
-
- private:
- typedef typename SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, k4, k5, k6, k7, k8, k9, k10>::type InnerFunctionType;
-
- Action<InnerFunctionType> action_;
- };
-
- const InnerAction action_;
-
- GTEST_DISALLOW_ASSIGN_(WithArgsAction);
-};
-
-// A macro from the ACTION* family (defined later in this file)
-// defines an action that can be used in a mock function. Typically,
-// these actions only care about a subset of the arguments of the mock
-// function. For example, if such an action only uses the second
-// argument, it can be used in any mock function that takes >= 2
-// arguments where the type of the second argument is compatible.
-//
-// Therefore, the action implementation must be prepared to take more
-// arguments than it needs. The ExcessiveArg type is used to
-// represent those excessive arguments. In order to keep the compiler
-// error messages tractable, we define it in the testing namespace
-// instead of testing::internal. However, this is an INTERNAL TYPE
-// and subject to change without notice, so a user MUST NOT USE THIS
-// TYPE DIRECTLY.
-struct ExcessiveArg {};
-
-// A helper class needed for implementing the ACTION* macros.
-template <typename Result, class Impl>
-class ActionHelper {
- public:
- static Result Perform(Impl* impl, const ::std::tr1::tuple<>& args) {
- using ::std::tr1::get;
- return impl->template gmock_PerformImpl<>(args, ExcessiveArg(),
- ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0>
- static Result Perform(Impl* impl, const ::std::tr1::tuple<A0>& args) {
- using ::std::tr1::get;
- return impl->template gmock_PerformImpl<A0>(args, get<0>(args),
- ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1>
- static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1>& args) {
- using ::std::tr1::get;
- return impl->template gmock_PerformImpl<A0, A1>(args, get<0>(args),
- get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1, typename A2>
- static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2>& args) {
- using ::std::tr1::get;
- return impl->template gmock_PerformImpl<A0, A1, A2>(args, get<0>(args),
- get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1, typename A2, typename A3>
- static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2,
- A3>& args) {
- using ::std::tr1::get;
- return impl->template gmock_PerformImpl<A0, A1, A2, A3>(args, get<0>(args),
- get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(),
- ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1, typename A2, typename A3, typename A4>
- static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3,
- A4>& args) {
- using ::std::tr1::get;
- return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4>(args,
- get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
- ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1, typename A2, typename A3, typename A4,
- typename A5>
- static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
- A5>& args) {
- using ::std::tr1::get;
- return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5>(args,
- get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
- get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6>
- static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
- A5, A6>& args) {
- using ::std::tr1::get;
- return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6>(args,
- get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
- get<5>(args), get<6>(args), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7>
- static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
- A5, A6, A7>& args) {
- using ::std::tr1::get;
- return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6,
- A7>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
- get<4>(args), get<5>(args), get<6>(args), get<7>(args), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8>
- static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
- A5, A6, A7, A8>& args) {
- using ::std::tr1::get;
- return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7,
- A8>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
- get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9>
- static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
- A5, A6, A7, A8, A9>& args) {
- using ::std::tr1::get;
- return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, A8,
- A9>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
- get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
- get<9>(args));
- }
-};
-
-} // namespace internal
-
-// Various overloads for Invoke().
-
-// WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes
-// the selected arguments of the mock function to an_action and
-// performs it. It serves as an adaptor between actions with
-// different argument lists. C++ doesn't support default arguments for
-// function templates, so we have to overload it.
-template <int k1, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1>(action);
-}
-
-template <int k1, int k2, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2>(action);
-}
-
-template <int k1, int k2, int k3, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3>(action);
-}
-
-template <int k1, int k2, int k3, int k4, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3, k4>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7,
- typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6,
- k7>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
- typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7,
- k8>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
- int k9, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, k9>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
- k9>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
- int k9, int k10, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
- k9, k10>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
- k9, k10>(action);
-}
-
-// Creates an action that does actions a1, a2, ..., sequentially in
-// each invocation.
-template <typename Action1, typename Action2>
-inline internal::DoBothAction<Action1, Action2>
-DoAll(Action1 a1, Action2 a2) {
- return internal::DoBothAction<Action1, Action2>(a1, a2);
-}
-
-template <typename Action1, typename Action2, typename Action3>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- Action3> >
-DoAll(Action1 a1, Action2 a2, Action3 a3) {
- return DoAll(a1, DoAll(a2, a3));
-}
-
-template <typename Action1, typename Action2, typename Action3,
- typename Action4>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- internal::DoBothAction<Action3, Action4> > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4) {
- return DoAll(a1, DoAll(a2, a3, a4));
-}
-
-template <typename Action1, typename Action2, typename Action3,
- typename Action4, typename Action5>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- internal::DoBothAction<Action3, internal::DoBothAction<Action4,
- Action5> > > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5) {
- return DoAll(a1, DoAll(a2, a3, a4, a5));
-}
-
-template <typename Action1, typename Action2, typename Action3,
- typename Action4, typename Action5, typename Action6>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- internal::DoBothAction<Action3, internal::DoBothAction<Action4,
- internal::DoBothAction<Action5, Action6> > > > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6) {
- return DoAll(a1, DoAll(a2, a3, a4, a5, a6));
-}
-
-template <typename Action1, typename Action2, typename Action3,
- typename Action4, typename Action5, typename Action6, typename Action7>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- internal::DoBothAction<Action3, internal::DoBothAction<Action4,
- internal::DoBothAction<Action5, internal::DoBothAction<Action6,
- Action7> > > > > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
- Action7 a7) {
- return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7));
-}
-
-template <typename Action1, typename Action2, typename Action3,
- typename Action4, typename Action5, typename Action6, typename Action7,
- typename Action8>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- internal::DoBothAction<Action3, internal::DoBothAction<Action4,
- internal::DoBothAction<Action5, internal::DoBothAction<Action6,
- internal::DoBothAction<Action7, Action8> > > > > > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
- Action7 a7, Action8 a8) {
- return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8));
-}
-
-template <typename Action1, typename Action2, typename Action3,
- typename Action4, typename Action5, typename Action6, typename Action7,
- typename Action8, typename Action9>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- internal::DoBothAction<Action3, internal::DoBothAction<Action4,
- internal::DoBothAction<Action5, internal::DoBothAction<Action6,
- internal::DoBothAction<Action7, internal::DoBothAction<Action8,
- Action9> > > > > > > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
- Action7 a7, Action8 a8, Action9 a9) {
- return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9));
-}
-
-template <typename Action1, typename Action2, typename Action3,
- typename Action4, typename Action5, typename Action6, typename Action7,
- typename Action8, typename Action9, typename Action10>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- internal::DoBothAction<Action3, internal::DoBothAction<Action4,
- internal::DoBothAction<Action5, internal::DoBothAction<Action6,
- internal::DoBothAction<Action7, internal::DoBothAction<Action8,
- internal::DoBothAction<Action9, Action10> > > > > > > > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
- Action7 a7, Action8 a8, Action9 a9, Action10 a10) {
- return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9, a10));
-}
-
-} // namespace testing
-
-// The ACTION* family of macros can be used in a namespace scope to
-// define custom actions easily. The syntax:
-//
-// ACTION(name) { statements; }
-//
-// will define an action with the given name that executes the
-// statements. The value returned by the statements will be used as
-// the return value of the action. Inside the statements, you can
-// refer to the K-th (0-based) argument of the mock function by
-// 'argK', and refer to its type by 'argK_type'. For example:
-//
-// ACTION(IncrementArg1) {
-// arg1_type temp = arg1;
-// return ++(*temp);
-// }
-//
-// allows you to write
-//
-// ...WillOnce(IncrementArg1());
-//
-// You can also refer to the entire argument tuple and its type by
-// 'args' and 'args_type', and refer to the mock function type and its
-// return type by 'function_type' and 'return_type'.
-//
-// Note that you don't need to specify the types of the mock function
-// arguments. However rest assured that your code is still type-safe:
-// you'll get a compiler error if *arg1 doesn't support the ++
-// operator, or if the type of ++(*arg1) isn't compatible with the
-// mock function's return type, for example.
-//
-// Sometimes you'll want to parameterize the action. For that you can use
-// another macro:
-//
-// ACTION_P(name, param_name) { statements; }
-//
-// For example:
-//
-// ACTION_P(Add, n) { return arg0 + n; }
-//
-// will allow you to write:
-//
-// ...WillOnce(Add(5));
-//
-// Note that you don't need to provide the type of the parameter
-// either. If you need to reference the type of a parameter named
-// 'foo', you can write 'foo_type'. For example, in the body of
-// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type
-// of 'n'.
-//
-// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support
-// multi-parameter actions.
-//
-// For the purpose of typing, you can view
-//
-// ACTION_Pk(Foo, p1, ..., pk) { ... }
-//
-// as shorthand for
-//
-// template <typename p1_type, ..., typename pk_type>
-// FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... }
-//
-// In particular, you can provide the template type arguments
-// explicitly when invoking Foo(), as in Foo<long, bool>(5, false);
-// although usually you can rely on the compiler to infer the types
-// for you automatically. You can assign the result of expression
-// Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ...,
-// pk_type>. This can be useful when composing actions.
-//
-// You can also overload actions with different numbers of parameters:
-//
-// ACTION_P(Plus, a) { ... }
-// ACTION_P2(Plus, a, b) { ... }
-//
-// While it's tempting to always use the ACTION* macros when defining
-// a new action, you should also consider implementing ActionInterface
-// or using MakePolymorphicAction() instead, especially if you need to
-// use the action a lot. While these approaches require more work,
-// they give you more control on the types of the mock function
-// arguments and the action parameters, which in general leads to
-// better compiler error messages that pay off in the long run. They
-// also allow overloading actions based on parameter types (as opposed
-// to just based on the number of parameters).
-//
-// CAVEAT:
-//
-// ACTION*() can only be used in a namespace scope. The reason is
-// that C++ doesn't yet allow function-local types to be used to
-// instantiate templates. The up-coming C++0x standard will fix this.
-// Once that's done, we'll consider supporting using ACTION*() inside
-// a function.
-//
-// MORE INFORMATION:
-//
-// To learn more about using these macros, please search for 'ACTION'
-// on http://code.google.com/p/googlemock/wiki/CookBook.
-
-// An internal macro needed for implementing ACTION*().
-#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\
- const args_type& args GTEST_ATTRIBUTE_UNUSED_, \
- arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_, \
- arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_, \
- arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_, \
- arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_, \
- arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_, \
- arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_, \
- arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_, \
- arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_, \
- arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_, \
- arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_
-
-// Sometimes you want to give an action explicit template parameters
-// that cannot be inferred from its value parameters. ACTION() and
-// ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that
-// and can be viewed as an extension to ACTION() and ACTION_P*().
-//
-// The syntax:
-//
-// ACTION_TEMPLATE(ActionName,
-// HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m),
-// AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; }
-//
-// defines an action template that takes m explicit template
-// parameters and n value parameters. name_i is the name of the i-th
-// template parameter, and kind_i specifies whether it's a typename,
-// an integral constant, or a template. p_i is the name of the i-th
-// value parameter.
-//
-// Example:
-//
-// // DuplicateArg<k, T>(output) converts the k-th argument of the mock
-// // function to type T and copies it to *output.
-// ACTION_TEMPLATE(DuplicateArg,
-// HAS_2_TEMPLATE_PARAMS(int, k, typename, T),
-// AND_1_VALUE_PARAMS(output)) {
-// *output = T(std::tr1::get<k>(args));
-// }
-// ...
-// int n;
-// EXPECT_CALL(mock, Foo(_, _))
-// .WillOnce(DuplicateArg<1, unsigned char>(&n));
-//
-// To create an instance of an action template, write:
-//
-// ActionName<t1, ..., t_m>(v1, ..., v_n)
-//
-// where the ts are the template arguments and the vs are the value
-// arguments. The value argument types are inferred by the compiler.
-// If you want to explicitly specify the value argument types, you can
-// provide additional template arguments:
-//
-// ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n)
-//
-// where u_i is the desired type of v_i.
-//
-// ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the
-// number of value parameters, but not on the number of template
-// parameters. Without the restriction, the meaning of the following
-// is unclear:
-//
-// OverloadedAction<int, bool>(x);
-//
-// Are we using a single-template-parameter action where 'bool' refers
-// to the type of x, or are we using a two-template-parameter action
-// where the compiler is asked to infer the type of x?
-//
-// Implementation notes:
-//
-// GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and
-// GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for
-// implementing ACTION_TEMPLATE. The main trick we use is to create
-// new macro invocations when expanding a macro. For example, we have
-//
-// #define ACTION_TEMPLATE(name, template_params, value_params)
-// ... GMOCK_INTERNAL_DECL_##template_params ...
-//
-// which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...)
-// to expand to
-//
-// ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ...
-//
-// Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the
-// preprocessor will continue to expand it to
-//
-// ... typename T ...
-//
-// This technique conforms to the C++ standard and is portable. It
-// allows us to implement action templates using O(N) code, where N is
-// the maximum number of template/value parameters supported. Without
-// using it, we'd have to devote O(N^2) amount of code to implement all
-// combinations of m and n.
-
-// Declares the template parameters.
-#define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0
-#define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
- name1) kind0 name0, kind1 name1
-#define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
- kind2, name2) kind0 name0, kind1 name1, kind2 name2
-#define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
- kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \
- kind3 name3
-#define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
- kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \
- kind2 name2, kind3 name3, kind4 name4
-#define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
- kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \
- kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5
-#define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
- kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
- name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \
- kind5 name5, kind6 name6
-#define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
- kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
- kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \
- kind4 name4, kind5 name5, kind6 name6, kind7 name7
-#define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
- kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
- kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \
- kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \
- kind8 name8
-#define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
- name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
- name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \
- kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \
- kind6 name6, kind7 name7, kind8 name8, kind9 name9
-
-// Lists the template parameters.
-#define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0
-#define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
- name1) name0, name1
-#define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
- kind2, name2) name0, name1, name2
-#define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
- kind2, name2, kind3, name3) name0, name1, name2, name3
-#define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
- kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \
- name4
-#define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
- kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \
- name2, name3, name4, name5
-#define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
- kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
- name6) name0, name1, name2, name3, name4, name5, name6
-#define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
- kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
- kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7
-#define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
- kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
- kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \
- name6, name7, name8
-#define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
- name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
- name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \
- name3, name4, name5, name6, name7, name8, name9
-
-// Declares the types of value parameters.
-#define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS()
-#define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \
- typename p0##_type, typename p1##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \
- typename p0##_type, typename p1##_type, typename p2##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
- typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
- typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
- typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
- p6) , typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
- p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
- p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type, typename p8##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
- p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \
- typename p2##_type, typename p3##_type, typename p4##_type, \
- typename p5##_type, typename p6##_type, typename p7##_type, \
- typename p8##_type, typename p9##_type
-
-// Initializes the value parameters.
-#define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\
- ()
-#define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\
- (p0##_type gmock_p0) : p0(gmock_p0)
-#define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\
- (p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), p1(gmock_p1)
-#define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\
- (p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2)
-#define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\
- (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3)
-#define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\
- (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), \
- p2(gmock_p2), p3(gmock_p3), p4(gmock_p4)
-#define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\
- (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, \
- p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4), p5(gmock_p5)
-#define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\
- (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
- p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6)
-#define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\
- (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
- p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), \
- p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
- p7(gmock_p7)
-#define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
- p7, p8)\
- (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
- p6##_type gmock_p6, p7##_type gmock_p7, \
- p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
- p8(gmock_p8)
-#define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
- p7, p8, p9)\
- (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
- p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
- p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
- p8(gmock_p8), p9(gmock_p9)
-
-// Declares the fields for storing the value parameters.
-#define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS()
-#define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0;
-#define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \
- p1##_type p1;
-#define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \
- p1##_type p1; p2##_type p2;
-#define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \
- p1##_type p1; p2##_type p2; p3##_type p3;
-#define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
- p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4;
-#define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
- p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
- p5##_type p5;
-#define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
- p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
- p5##_type p5; p6##_type p6;
-#define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
- p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
- p5##_type p5; p6##_type p6; p7##_type p7;
-#define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
- p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
- p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8;
-#define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
- p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
- p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \
- p9##_type p9;
-
-// Lists the value parameters.
-#define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS()
-#define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0
-#define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1
-#define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2
-#define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3
-#define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \
- p2, p3, p4
-#define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \
- p1, p2, p3, p4, p5
-#define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
- p6) p0, p1, p2, p3, p4, p5, p6
-#define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
- p7) p0, p1, p2, p3, p4, p5, p6, p7
-#define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
- p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8
-#define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
- p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9
-
-// Lists the value parameter types.
-#define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS()
-#define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \
- p1##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \
- p1##_type, p2##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
- p0##_type, p1##_type, p2##_type, p3##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
- p0##_type, p1##_type, p2##_type, p3##_type, p4##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
- p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
- p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \
- p6##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
- p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type, p7##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
- p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type, p7##_type, p8##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
- p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type, p7##_type, p8##_type, p9##_type
-
-// Declares the value parameters.
-#define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS()
-#define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0
-#define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \
- p1##_type p1
-#define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \
- p1##_type p1, p2##_type p2
-#define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \
- p1##_type p1, p2##_type p2, p3##_type p3
-#define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
- p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4
-#define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
- p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
- p5##_type p5
-#define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
- p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
- p5##_type p5, p6##_type p6
-#define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
- p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
- p5##_type p5, p6##_type p6, p7##_type p7
-#define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
- p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
- p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8
-#define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
- p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
- p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
- p9##_type p9
-
-// The suffix of the class template implementing the action template.
-#define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS()
-#define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P
-#define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2
-#define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3
-#define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4
-#define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5
-#define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6
-#define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7
-#define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
- p7) P8
-#define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
- p7, p8) P9
-#define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
- p7, p8, p9) P10
-
-// The name of the class template implementing the action template.
-#define GMOCK_ACTION_CLASS_(name, value_params)\
- GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params)
-
-#define ACTION_TEMPLATE(name, template_params, value_params)\
- template <GMOCK_INTERNAL_DECL_##template_params\
- GMOCK_INTERNAL_DECL_TYPE_##value_params>\
- class GMOCK_ACTION_CLASS_(name, value_params) {\
- public:\
- GMOCK_ACTION_CLASS_(name, value_params)\
- GMOCK_INTERNAL_INIT_##value_params {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
- arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
- arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
- arg9_type arg9) const;\
- GMOCK_INTERNAL_DEFN_##value_params\
- private:\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(\
- new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
- }\
- GMOCK_INTERNAL_DEFN_##value_params\
- private:\
- GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\
- };\
- template <GMOCK_INTERNAL_DECL_##template_params\
- GMOCK_INTERNAL_DECL_TYPE_##value_params>\
- inline GMOCK_ACTION_CLASS_(name, value_params)<\
- GMOCK_INTERNAL_LIST_##template_params\
- GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\
- GMOCK_INTERNAL_DECL_##value_params) {\
- return GMOCK_ACTION_CLASS_(name, value_params)<\
- GMOCK_INTERNAL_LIST_##template_params\
- GMOCK_INTERNAL_LIST_TYPE_##value_params>(\
- GMOCK_INTERNAL_LIST_##value_params);\
- }\
- template <GMOCK_INTERNAL_DECL_##template_params\
- GMOCK_INTERNAL_DECL_TYPE_##value_params>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- GMOCK_ACTION_CLASS_(name, value_params)<\
- GMOCK_INTERNAL_LIST_##template_params\
- GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\
- gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION(name)\
- class name##Action {\
- public:\
- name##Action() {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- gmock_Impl() {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
- arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
- arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
- arg9_type arg9) const;\
- private:\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>());\
- }\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##Action);\
- };\
- inline name##Action name() {\
- return name##Action();\
- }\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##Action::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P(name, p0)\
- template <typename p0##_type>\
- class name##ActionP {\
- public:\
- name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- explicit gmock_Impl(p0##_type gmock_p0) : p0(gmock_p0) {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
- arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
- arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
- arg9_type arg9) const;\
- p0##_type p0;\
- private:\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(p0));\
- }\
- p0##_type p0;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##ActionP);\
- };\
- template <typename p0##_type>\
- inline name##ActionP<p0##_type> name(p0##_type p0) {\
- return name##ActionP<p0##_type>(p0);\
- }\
- template <typename p0##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P2(name, p0, p1)\
- template <typename p0##_type, typename p1##_type>\
- class name##ActionP2 {\
- public:\
- name##ActionP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
- p1(gmock_p1) {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
- p1(gmock_p1) {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
- arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
- arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
- arg9_type arg9) const;\
- p0##_type p0;\
- p1##_type p1;\
- private:\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\
- }\
- p0##_type p0;\
- p1##_type p1;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##ActionP2);\
- };\
- template <typename p0##_type, typename p1##_type>\
- inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \
- p1##_type p1) {\
- return name##ActionP2<p0##_type, p1##_type>(p0, p1);\
- }\
- template <typename p0##_type, typename p1##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P3(name, p0, p1, p2)\
- template <typename p0##_type, typename p1##_type, typename p2##_type>\
- class name##ActionP3 {\
- public:\
- name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
- arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
- arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
- arg9_type arg9) const;\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- private:\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##ActionP3);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type>\
- inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
- p1##_type p1, p2##_type p2) {\
- return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP3<p0##_type, p1##_type, \
- p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P4(name, p0, p1, p2, p3)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type>\
- class name##ActionP4 {\
- public:\
- name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \
- p2(gmock_p2), p3(gmock_p3) {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3) {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
- arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
- arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
- arg9_type arg9) const;\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- private:\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##ActionP4);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type>\
- inline name##ActionP4<p0##_type, p1##_type, p2##_type, \
- p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
- p3##_type p3) {\
- return name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, p1, \
- p2, p3);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP4<p0##_type, p1##_type, p2##_type, \
- p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P5(name, p0, p1, p2, p3, p4)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type>\
- class name##ActionP5 {\
- public:\
- name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2, p3##_type gmock_p3, \
- p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4) {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), \
- p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
- arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
- arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
- arg9_type arg9) const;\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- private:\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##ActionP5);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type>\
- inline name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
- p4##_type p4) {\
- return name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type>(p0, p1, p2, p3, p4);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type>\
- class name##ActionP6 {\
- public:\
- name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
- p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, \
- p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
- arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
- arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
- arg9_type arg9) const;\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- private:\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##ActionP6);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type>\
- inline name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
- p3##_type p3, p4##_type p4, p5##_type p5) {\
- return name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type>\
- class name##ActionP7 {\
- public:\
- name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
- p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \
- p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \
- p6(gmock_p6) {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
- p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
- arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
- arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
- arg9_type arg9) const;\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- private:\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
- p6));\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##ActionP7);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type>\
- inline name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \
- p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
- p6##_type p6) {\
- return name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type>\
- class name##ActionP8 {\
- public:\
- name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
- p5##_type gmock_p5, p6##_type gmock_p6, \
- p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
- p7(gmock_p7) {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
- p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), \
- p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), \
- p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
- arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
- arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
- arg9_type arg9) const;\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- p7##_type p7;\
- private:\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
- p6, p7));\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- p7##_type p7;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##ActionP8);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type>\
- inline name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \
- p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
- p6##_type p6, p7##_type p7) {\
- return name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
- p6, p7);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type, \
- p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type, typename p8##_type>\
- class name##ActionP9 {\
- public:\
- name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
- p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
- p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
- p8(gmock_p8) {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
- p6##_type gmock_p6, p7##_type gmock_p7, \
- p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
- p7(gmock_p7), p8(gmock_p8) {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
- arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
- arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
- arg9_type arg9) const;\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- p7##_type p7;\
- p8##_type p8;\
- private:\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
- p6, p7, p8));\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- p7##_type p7;\
- p8##_type p8;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##ActionP9);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type, typename p8##_type>\
- inline name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, \
- p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
- p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \
- p8##_type p8) {\
- return name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
- p3, p4, p5, p6, p7, p8);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type, typename p8##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type, p7##_type, \
- p8##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type, typename p8##_type, \
- typename p9##_type>\
- class name##ActionP10 {\
- public:\
- name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
- p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
- p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \
- p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
- p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
- p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
- p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
- p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
- arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
- arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
- arg9_type arg9) const;\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- p7##_type p7;\
- p8##_type p8;\
- p9##_type p9;\
- private:\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
- p6, p7, p8, p9));\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- p7##_type p7;\
- p8##_type p8;\
- p9##_type p9;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##ActionP10);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type, typename p8##_type, \
- typename p9##_type>\
- inline name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
- p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
- p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
- p9##_type p9) {\
- return name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
- p1, p2, p3, p4, p5, p6, p7, p8, p9);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type, typename p8##_type, \
- typename p9##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type, p7##_type, p8##_type, \
- p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-namespace testing {
-
-// The ACTION*() macros trigger warning C4100 (unreferenced formal
-// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
-// the macro definition, as the warnings are generated when the macro
-// is expanded and macro expansion cannot contain #pragma. Therefore
-// we suppress them here.
-#ifdef _MSC_VER
-# pragma warning(push)
-# pragma warning(disable:4100)
-#endif
-
-// Various overloads for InvokeArgument<N>().
-//
-// The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th
-// (0-based) argument, which must be a k-ary callable, of the mock
-// function, with arguments a1, a2, ..., a_k.
-//
-// Notes:
-//
-// 1. The arguments are passed by value by default. If you need to
-// pass an argument by reference, wrap it inside ByRef(). For
-// example,
-//
-// InvokeArgument<1>(5, string("Hello"), ByRef(foo))
-//
-// passes 5 and string("Hello") by value, and passes foo by
-// reference.
-//
-// 2. If the callable takes an argument by reference but ByRef() is
-// not used, it will receive the reference to a copy of the value,
-// instead of the original value. For example, when the 0-th
-// argument of the mock function takes a const string&, the action
-//
-// InvokeArgument<0>(string("Hello"))
-//
-// makes a copy of the temporary string("Hello") object and passes a
-// reference of the copy, instead of the original temporary object,
-// to the callable. This makes it easy for a user to define an
-// InvokeArgument action from temporary values and have it performed
-// later.
-
-ACTION_TEMPLATE(InvokeArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_0_VALUE_PARAMS()) {
- return internal::CallableHelper<return_type>::Call(
- ::std::tr1::get<k>(args));
-}
-
-ACTION_TEMPLATE(InvokeArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_1_VALUE_PARAMS(p0)) {
- return internal::CallableHelper<return_type>::Call(
- ::std::tr1::get<k>(args), p0);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_2_VALUE_PARAMS(p0, p1)) {
- return internal::CallableHelper<return_type>::Call(
- ::std::tr1::get<k>(args), p0, p1);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_3_VALUE_PARAMS(p0, p1, p2)) {
- return internal::CallableHelper<return_type>::Call(
- ::std::tr1::get<k>(args), p0, p1, p2);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
- return internal::CallableHelper<return_type>::Call(
- ::std::tr1::get<k>(args), p0, p1, p2, p3);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
- return internal::CallableHelper<return_type>::Call(
- ::std::tr1::get<k>(args), p0, p1, p2, p3, p4);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
- return internal::CallableHelper<return_type>::Call(
- ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
- return internal::CallableHelper<return_type>::Call(
- ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
- return internal::CallableHelper<return_type>::Call(
- ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
- return internal::CallableHelper<return_type>::Call(
- ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
- return internal::CallableHelper<return_type>::Call(
- ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
-}
-
-// Various overloads for ReturnNew<T>().
-//
-// The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new
-// instance of type T, constructed on the heap with constructor arguments
-// a1, a2, ..., and a_k. The caller assumes ownership of the returned value.
-ACTION_TEMPLATE(ReturnNew,
- HAS_1_TEMPLATE_PARAMS(typename, T),
- AND_0_VALUE_PARAMS()) {
- return new T();
-}
-
-ACTION_TEMPLATE(ReturnNew,
- HAS_1_TEMPLATE_PARAMS(typename, T),
- AND_1_VALUE_PARAMS(p0)) {
- return new T(p0);
-}
-
-ACTION_TEMPLATE(ReturnNew,
- HAS_1_TEMPLATE_PARAMS(typename, T),
- AND_2_VALUE_PARAMS(p0, p1)) {
- return new T(p0, p1);
-}
-
-ACTION_TEMPLATE(ReturnNew,
- HAS_1_TEMPLATE_PARAMS(typename, T),
- AND_3_VALUE_PARAMS(p0, p1, p2)) {
- return new T(p0, p1, p2);
-}
-
-ACTION_TEMPLATE(ReturnNew,
- HAS_1_TEMPLATE_PARAMS(typename, T),
- AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
- return new T(p0, p1, p2, p3);
-}
-
-ACTION_TEMPLATE(ReturnNew,
- HAS_1_TEMPLATE_PARAMS(typename, T),
- AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
- return new T(p0, p1, p2, p3, p4);
-}
-
-ACTION_TEMPLATE(ReturnNew,
- HAS_1_TEMPLATE_PARAMS(typename, T),
- AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
- return new T(p0, p1, p2, p3, p4, p5);
-}
-
-ACTION_TEMPLATE(ReturnNew,
- HAS_1_TEMPLATE_PARAMS(typename, T),
- AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
- return new T(p0, p1, p2, p3, p4, p5, p6);
-}
-
-ACTION_TEMPLATE(ReturnNew,
- HAS_1_TEMPLATE_PARAMS(typename, T),
- AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
- return new T(p0, p1, p2, p3, p4, p5, p6, p7);
-}
-
-ACTION_TEMPLATE(ReturnNew,
- HAS_1_TEMPLATE_PARAMS(typename, T),
- AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
- return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8);
-}
-
-ACTION_TEMPLATE(ReturnNew,
- HAS_1_TEMPLATE_PARAMS(typename, T),
- AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
- return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
-}
-
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-actions.h.pump b/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-actions.h.pump
deleted file mode 100644
index 8e2b573..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-actions.h.pump
+++ /dev/null
@@ -1,821 +0,0 @@
-$$ -*- mode: c++; -*-
-$$ This is a Pump source file. Please use Pump to convert it to
-$$ gmock-generated-actions.h.
-$$
-$var n = 10 $$ The maximum arity we support.
-$$}} This meta comment fixes auto-indentation in editors.
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some commonly used variadic actions.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
-
-#include "gmock/gmock-actions.h"
-#include "gmock/internal/gmock-port.h"
-
-namespace testing {
-namespace internal {
-
-// InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
-// function or method with the unpacked values, where F is a function
-// type that takes N arguments.
-template <typename Result, typename ArgumentTuple>
-class InvokeHelper;
-
-
-$range i 0..n
-$for i [[
-$range j 1..i
-$var types = [[$for j [[, typename A$j]]]]
-$var as = [[$for j, [[A$j]]]]
-$var args = [[$if i==0 [[]] $else [[ args]]]]
-$var import = [[$if i==0 [[]] $else [[
- using ::std::tr1::get;
-
-]]]]
-$var gets = [[$for j, [[get<$(j - 1)>(args)]]]]
-template <typename R$types>
-class InvokeHelper<R, ::std::tr1::tuple<$as> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::std::tr1::tuple<$as>&$args) {
-$import return function($gets);
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::std::tr1::tuple<$as>&$args) {
-$import return (obj_ptr->*method_ptr)($gets);
- }
-};
-
-
-]]
-// CallableHelper has static methods for invoking "callables",
-// i.e. function pointers and functors. It uses overloading to
-// provide a uniform interface for invoking different kinds of
-// callables. In particular, you can use:
-//
-// CallableHelper<R>::Call(callable, a1, a2, ..., an)
-//
-// to invoke an n-ary callable, where R is its return type. If an
-// argument, say a2, needs to be passed by reference, you should write
-// ByRef(a2) instead of a2 in the above expression.
-template <typename R>
-class CallableHelper {
- public:
- // Calls a nullary callable.
- template <typename Function>
- static R Call(Function function) { return function(); }
-
- // Calls a unary callable.
-
- // We deliberately pass a1 by value instead of const reference here
- // in case it is a C-string literal. If we had declared the
- // parameter as 'const A1& a1' and write Call(function, "Hi"), the
- // compiler would've thought A1 is 'char[3]', which causes trouble
- // when you need to copy a value of type A1. By declaring the
- // parameter as 'A1 a1', the compiler will correctly infer that A1
- // is 'const char*' when it sees Call(function, "Hi").
- //
- // Since this function is defined inline, the compiler can get rid
- // of the copying of the arguments. Therefore the performance won't
- // be hurt.
- template <typename Function, typename A1>
- static R Call(Function function, A1 a1) { return function(a1); }
-
-$range i 2..n
-$for i
-[[
-$var arity = [[$if i==2 [[binary]] $elif i==3 [[ternary]] $else [[$i-ary]]]]
-
- // Calls a $arity callable.
-
-$range j 1..i
-$var typename_As = [[$for j, [[typename A$j]]]]
-$var Aas = [[$for j, [[A$j a$j]]]]
-$var as = [[$for j, [[a$j]]]]
-$var typename_Ts = [[$for j, [[typename T$j]]]]
-$var Ts = [[$for j, [[T$j]]]]
- template <typename Function, $typename_As>
- static R Call(Function function, $Aas) {
- return function($as);
- }
-
-]]
-}; // class CallableHelper
-
-// An INTERNAL macro for extracting the type of a tuple field. It's
-// subject to change without notice - DO NOT USE IN USER CODE!
-#define GMOCK_FIELD_(Tuple, N) \
- typename ::std::tr1::tuple_element<N, Tuple>::type
-
-$range i 1..n
-
-// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the
-// type of an n-ary function whose i-th (1-based) argument type is the
-// k{i}-th (0-based) field of ArgumentTuple, which must be a tuple
-// type, and whose return type is Result. For example,
-// SelectArgs<int, ::std::tr1::tuple<bool, char, double, long>, 0, 3>::type
-// is int(bool, long).
-//
-// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args)
-// returns the selected fields (k1, k2, ..., k_n) of args as a tuple.
-// For example,
-// SelectArgs<int, ::std::tr1::tuple<bool, char, double>, 2, 0>::Select(
-// ::std::tr1::make_tuple(true, 'a', 2.5))
-// returns ::std::tr1::tuple (2.5, true).
-//
-// The numbers in list k1, k2, ..., k_n must be >= 0, where n can be
-// in the range [0, $n]. Duplicates are allowed and they don't have
-// to be in an ascending or descending order.
-
-template <typename Result, typename ArgumentTuple, $for i, [[int k$i]]>
-class SelectArgs {
- public:
- typedef Result type($for i, [[GMOCK_FIELD_(ArgumentTuple, k$i)]]);
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- using ::std::tr1::get;
- return SelectedArgs($for i, [[get<k$i>(args)]]);
- }
-};
-
-
-$for i [[
-$range j 1..n
-$range j1 1..i-1
-template <typename Result, typename ArgumentTuple$for j1[[, int k$j1]]>
-class SelectArgs<Result, ArgumentTuple,
- $for j, [[$if j <= i-1 [[k$j]] $else [[-1]]]]> {
- public:
- typedef Result type($for j1, [[GMOCK_FIELD_(ArgumentTuple, k$j1)]]);
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& [[]]
-$if i == 1 [[/* args */]] $else [[args]]) {
- using ::std::tr1::get;
- return SelectedArgs($for j1, [[get<k$j1>(args)]]);
- }
-};
-
-
-]]
-#undef GMOCK_FIELD_
-
-$var ks = [[$for i, [[k$i]]]]
-
-// Implements the WithArgs action.
-template <typename InnerAction, $for i, [[int k$i = -1]]>
-class WithArgsAction {
- public:
- explicit WithArgsAction(const InnerAction& action) : action_(action) {}
-
- template <typename F>
- operator Action<F>() const { return MakeAction(new Impl<F>(action_)); }
-
- private:
- template <typename F>
- class Impl : public ActionInterface<F> {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-
- explicit Impl(const InnerAction& action) : action_(action) {}
-
- virtual Result Perform(const ArgumentTuple& args) {
- return action_.Perform(SelectArgs<Result, ArgumentTuple, $ks>::Select(args));
- }
-
- private:
- typedef typename SelectArgs<Result, ArgumentTuple,
- $ks>::type InnerFunctionType;
-
- Action<InnerFunctionType> action_;
- };
-
- const InnerAction action_;
-
- GTEST_DISALLOW_ASSIGN_(WithArgsAction);
-};
-
-// A macro from the ACTION* family (defined later in this file)
-// defines an action that can be used in a mock function. Typically,
-// these actions only care about a subset of the arguments of the mock
-// function. For example, if such an action only uses the second
-// argument, it can be used in any mock function that takes >= 2
-// arguments where the type of the second argument is compatible.
-//
-// Therefore, the action implementation must be prepared to take more
-// arguments than it needs. The ExcessiveArg type is used to
-// represent those excessive arguments. In order to keep the compiler
-// error messages tractable, we define it in the testing namespace
-// instead of testing::internal. However, this is an INTERNAL TYPE
-// and subject to change without notice, so a user MUST NOT USE THIS
-// TYPE DIRECTLY.
-struct ExcessiveArg {};
-
-// A helper class needed for implementing the ACTION* macros.
-template <typename Result, class Impl>
-class ActionHelper {
- public:
-$range i 0..n
-$for i
-
-[[
-$var template = [[$if i==0 [[]] $else [[
-$range j 0..i-1
- template <$for j, [[typename A$j]]>
-]]]]
-$range j 0..i-1
-$var As = [[$for j, [[A$j]]]]
-$var as = [[$for j, [[get<$j>(args)]]]]
-$range k 1..n-i
-$var eas = [[$for k, [[ExcessiveArg()]]]]
-$var arg_list = [[$if (i==0) | (i==n) [[$as$eas]] $else [[$as, $eas]]]]
-$template
- static Result Perform(Impl* impl, const ::std::tr1::tuple<$As>& args) {
- using ::std::tr1::get;
- return impl->template gmock_PerformImpl<$As>(args, $arg_list);
- }
-
-]]
-};
-
-} // namespace internal
-
-// Various overloads for Invoke().
-
-// WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes
-// the selected arguments of the mock function to an_action and
-// performs it. It serves as an adaptor between actions with
-// different argument lists. C++ doesn't support default arguments for
-// function templates, so we have to overload it.
-
-$range i 1..n
-$for i [[
-$range j 1..i
-template <$for j [[int k$j, ]]typename InnerAction>
-inline internal::WithArgsAction<InnerAction$for j [[, k$j]]>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction$for j [[, k$j]]>(action);
-}
-
-
-]]
-// Creates an action that does actions a1, a2, ..., sequentially in
-// each invocation.
-$range i 2..n
-$for i [[
-$range j 2..i
-$var types = [[$for j, [[typename Action$j]]]]
-$var Aas = [[$for j [[, Action$j a$j]]]]
-
-template <typename Action1, $types>
-$range k 1..i-1
-
-inline $for k [[internal::DoBothAction<Action$k, ]]Action$i$for k [[>]]
-
-DoAll(Action1 a1$Aas) {
-$if i==2 [[
-
- return internal::DoBothAction<Action1, Action2>(a1, a2);
-]] $else [[
-$range j2 2..i
-
- return DoAll(a1, DoAll($for j2, [[a$j2]]));
-]]
-
-}
-
-]]
-
-} // namespace testing
-
-// The ACTION* family of macros can be used in a namespace scope to
-// define custom actions easily. The syntax:
-//
-// ACTION(name) { statements; }
-//
-// will define an action with the given name that executes the
-// statements. The value returned by the statements will be used as
-// the return value of the action. Inside the statements, you can
-// refer to the K-th (0-based) argument of the mock function by
-// 'argK', and refer to its type by 'argK_type'. For example:
-//
-// ACTION(IncrementArg1) {
-// arg1_type temp = arg1;
-// return ++(*temp);
-// }
-//
-// allows you to write
-//
-// ...WillOnce(IncrementArg1());
-//
-// You can also refer to the entire argument tuple and its type by
-// 'args' and 'args_type', and refer to the mock function type and its
-// return type by 'function_type' and 'return_type'.
-//
-// Note that you don't need to specify the types of the mock function
-// arguments. However rest assured that your code is still type-safe:
-// you'll get a compiler error if *arg1 doesn't support the ++
-// operator, or if the type of ++(*arg1) isn't compatible with the
-// mock function's return type, for example.
-//
-// Sometimes you'll want to parameterize the action. For that you can use
-// another macro:
-//
-// ACTION_P(name, param_name) { statements; }
-//
-// For example:
-//
-// ACTION_P(Add, n) { return arg0 + n; }
-//
-// will allow you to write:
-//
-// ...WillOnce(Add(5));
-//
-// Note that you don't need to provide the type of the parameter
-// either. If you need to reference the type of a parameter named
-// 'foo', you can write 'foo_type'. For example, in the body of
-// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type
-// of 'n'.
-//
-// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P$n to support
-// multi-parameter actions.
-//
-// For the purpose of typing, you can view
-//
-// ACTION_Pk(Foo, p1, ..., pk) { ... }
-//
-// as shorthand for
-//
-// template <typename p1_type, ..., typename pk_type>
-// FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... }
-//
-// In particular, you can provide the template type arguments
-// explicitly when invoking Foo(), as in Foo<long, bool>(5, false);
-// although usually you can rely on the compiler to infer the types
-// for you automatically. You can assign the result of expression
-// Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ...,
-// pk_type>. This can be useful when composing actions.
-//
-// You can also overload actions with different numbers of parameters:
-//
-// ACTION_P(Plus, a) { ... }
-// ACTION_P2(Plus, a, b) { ... }
-//
-// While it's tempting to always use the ACTION* macros when defining
-// a new action, you should also consider implementing ActionInterface
-// or using MakePolymorphicAction() instead, especially if you need to
-// use the action a lot. While these approaches require more work,
-// they give you more control on the types of the mock function
-// arguments and the action parameters, which in general leads to
-// better compiler error messages that pay off in the long run. They
-// also allow overloading actions based on parameter types (as opposed
-// to just based on the number of parameters).
-//
-// CAVEAT:
-//
-// ACTION*() can only be used in a namespace scope. The reason is
-// that C++ doesn't yet allow function-local types to be used to
-// instantiate templates. The up-coming C++0x standard will fix this.
-// Once that's done, we'll consider supporting using ACTION*() inside
-// a function.
-//
-// MORE INFORMATION:
-//
-// To learn more about using these macros, please search for 'ACTION'
-// on http://code.google.com/p/googlemock/wiki/CookBook.
-
-$range i 0..n
-$range k 0..n-1
-
-// An internal macro needed for implementing ACTION*().
-#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\
- const args_type& args GTEST_ATTRIBUTE_UNUSED_
-$for k [[, \
- arg$k[[]]_type arg$k GTEST_ATTRIBUTE_UNUSED_]]
-
-
-// Sometimes you want to give an action explicit template parameters
-// that cannot be inferred from its value parameters. ACTION() and
-// ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that
-// and can be viewed as an extension to ACTION() and ACTION_P*().
-//
-// The syntax:
-//
-// ACTION_TEMPLATE(ActionName,
-// HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m),
-// AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; }
-//
-// defines an action template that takes m explicit template
-// parameters and n value parameters. name_i is the name of the i-th
-// template parameter, and kind_i specifies whether it's a typename,
-// an integral constant, or a template. p_i is the name of the i-th
-// value parameter.
-//
-// Example:
-//
-// // DuplicateArg<k, T>(output) converts the k-th argument of the mock
-// // function to type T and copies it to *output.
-// ACTION_TEMPLATE(DuplicateArg,
-// HAS_2_TEMPLATE_PARAMS(int, k, typename, T),
-// AND_1_VALUE_PARAMS(output)) {
-// *output = T(std::tr1::get<k>(args));
-// }
-// ...
-// int n;
-// EXPECT_CALL(mock, Foo(_, _))
-// .WillOnce(DuplicateArg<1, unsigned char>(&n));
-//
-// To create an instance of an action template, write:
-//
-// ActionName<t1, ..., t_m>(v1, ..., v_n)
-//
-// where the ts are the template arguments and the vs are the value
-// arguments. The value argument types are inferred by the compiler.
-// If you want to explicitly specify the value argument types, you can
-// provide additional template arguments:
-//
-// ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n)
-//
-// where u_i is the desired type of v_i.
-//
-// ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the
-// number of value parameters, but not on the number of template
-// parameters. Without the restriction, the meaning of the following
-// is unclear:
-//
-// OverloadedAction<int, bool>(x);
-//
-// Are we using a single-template-parameter action where 'bool' refers
-// to the type of x, or are we using a two-template-parameter action
-// where the compiler is asked to infer the type of x?
-//
-// Implementation notes:
-//
-// GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and
-// GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for
-// implementing ACTION_TEMPLATE. The main trick we use is to create
-// new macro invocations when expanding a macro. For example, we have
-//
-// #define ACTION_TEMPLATE(name, template_params, value_params)
-// ... GMOCK_INTERNAL_DECL_##template_params ...
-//
-// which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...)
-// to expand to
-//
-// ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ...
-//
-// Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the
-// preprocessor will continue to expand it to
-//
-// ... typename T ...
-//
-// This technique conforms to the C++ standard and is portable. It
-// allows us to implement action templates using O(N) code, where N is
-// the maximum number of template/value parameters supported. Without
-// using it, we'd have to devote O(N^2) amount of code to implement all
-// combinations of m and n.
-
-// Declares the template parameters.
-
-$range j 1..n
-$for j [[
-$range m 0..j-1
-#define GMOCK_INTERNAL_DECL_HAS_$j[[]]
-_TEMPLATE_PARAMS($for m, [[kind$m, name$m]]) $for m, [[kind$m name$m]]
-
-
-]]
-
-// Lists the template parameters.
-
-$for j [[
-$range m 0..j-1
-#define GMOCK_INTERNAL_LIST_HAS_$j[[]]
-_TEMPLATE_PARAMS($for m, [[kind$m, name$m]]) $for m, [[name$m]]
-
-
-]]
-
-// Declares the types of value parameters.
-
-$for i [[
-$range j 0..i-1
-#define GMOCK_INTERNAL_DECL_TYPE_AND_$i[[]]
-_VALUE_PARAMS($for j, [[p$j]]) $for j [[, typename p$j##_type]]
-
-
-]]
-
-// Initializes the value parameters.
-
-$for i [[
-$range j 0..i-1
-#define GMOCK_INTERNAL_INIT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])\
- ($for j, [[p$j##_type gmock_p$j]])$if i>0 [[ : ]]$for j, [[p$j(gmock_p$j)]]
-
-
-]]
-
-// Declares the fields for storing the value parameters.
-
-$for i [[
-$range j 0..i-1
-#define GMOCK_INTERNAL_DEFN_AND_$i[[]]
-_VALUE_PARAMS($for j, [[p$j]]) $for j [[p$j##_type p$j; ]]
-
-
-]]
-
-// Lists the value parameters.
-
-$for i [[
-$range j 0..i-1
-#define GMOCK_INTERNAL_LIST_AND_$i[[]]
-_VALUE_PARAMS($for j, [[p$j]]) $for j, [[p$j]]
-
-
-]]
-
-// Lists the value parameter types.
-
-$for i [[
-$range j 0..i-1
-#define GMOCK_INTERNAL_LIST_TYPE_AND_$i[[]]
-_VALUE_PARAMS($for j, [[p$j]]) $for j [[, p$j##_type]]
-
-
-]]
-
-// Declares the value parameters.
-
-$for i [[
-$range j 0..i-1
-#define GMOCK_INTERNAL_DECL_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]]) [[]]
-$for j, [[p$j##_type p$j]]
-
-
-]]
-
-// The suffix of the class template implementing the action template.
-$for i [[
-
-
-$range j 0..i-1
-#define GMOCK_INTERNAL_COUNT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]]) [[]]
-$if i==1 [[P]] $elif i>=2 [[P$i]]
-]]
-
-
-// The name of the class template implementing the action template.
-#define GMOCK_ACTION_CLASS_(name, value_params)\
- GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params)
-
-$range k 0..n-1
-
-#define ACTION_TEMPLATE(name, template_params, value_params)\
- template <GMOCK_INTERNAL_DECL_##template_params\
- GMOCK_INTERNAL_DECL_TYPE_##value_params>\
- class GMOCK_ACTION_CLASS_(name, value_params) {\
- public:\
- GMOCK_ACTION_CLASS_(name, value_params)\
- GMOCK_INTERNAL_INIT_##value_params {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <$for k, [[typename arg$k[[]]_type]]>\
- return_type gmock_PerformImpl(const args_type& args[[]]
-$for k [[, arg$k[[]]_type arg$k]]) const;\
- GMOCK_INTERNAL_DEFN_##value_params\
- private:\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(\
- new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
- }\
- GMOCK_INTERNAL_DEFN_##value_params\
- private:\
- GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\
- };\
- template <GMOCK_INTERNAL_DECL_##template_params\
- GMOCK_INTERNAL_DECL_TYPE_##value_params>\
- inline GMOCK_ACTION_CLASS_(name, value_params)<\
- GMOCK_INTERNAL_LIST_##template_params\
- GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\
- GMOCK_INTERNAL_DECL_##value_params) {\
- return GMOCK_ACTION_CLASS_(name, value_params)<\
- GMOCK_INTERNAL_LIST_##template_params\
- GMOCK_INTERNAL_LIST_TYPE_##value_params>(\
- GMOCK_INTERNAL_LIST_##value_params);\
- }\
- template <GMOCK_INTERNAL_DECL_##template_params\
- GMOCK_INTERNAL_DECL_TYPE_##value_params>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- GMOCK_ACTION_CLASS_(name, value_params)<\
- GMOCK_INTERNAL_LIST_##template_params\
- GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\
- gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-$for i
-
-[[
-$var template = [[$if i==0 [[]] $else [[
-$range j 0..i-1
-
- template <$for j, [[typename p$j##_type]]>\
-]]]]
-$var class_name = [[name##Action[[$if i==0 [[]] $elif i==1 [[P]]
- $else [[P$i]]]]]]
-$range j 0..i-1
-$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]]
-$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]]
-$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]]
-$var param_field_decls = [[$for j
-[[
-
- p$j##_type p$j;\
-]]]]
-$var param_field_decls2 = [[$for j
-[[
-
- p$j##_type p$j;\
-]]]]
-$var params = [[$for j, [[p$j]]]]
-$var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]]
-$var typename_arg_types = [[$for k, [[typename arg$k[[]]_type]]]]
-$var arg_types_and_names = [[$for k, [[arg$k[[]]_type arg$k]]]]
-$var macro_name = [[$if i==0 [[ACTION]] $elif i==1 [[ACTION_P]]
- $else [[ACTION_P$i]]]]
-
-#define $macro_name(name$for j [[, p$j]])\$template
- class $class_name {\
- public:\
- $class_name($ctor_param_list)$inits {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- [[$if i==1 [[explicit ]]]]gmock_Impl($ctor_param_list)$inits {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <$typename_arg_types>\
- return_type gmock_PerformImpl(const args_type& args, [[]]
-$arg_types_and_names) const;\$param_field_decls
- private:\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>($params));\
- }\$param_field_decls2
- private:\
- GTEST_DISALLOW_ASSIGN_($class_name);\
- };\$template
- inline $class_name$param_types name($param_types_and_names) {\
- return $class_name$param_types($params);\
- }\$template
- template <typename F>\
- template <$typename_arg_types>\
- typename ::testing::internal::Function<F>::Result\
- $class_name$param_types::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-]]
-$$ } // This meta comment fixes auto-indentation in Emacs. It won't
-$$ // show up in the generated code.
-
-
-namespace testing {
-
-// The ACTION*() macros trigger warning C4100 (unreferenced formal
-// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
-// the macro definition, as the warnings are generated when the macro
-// is expanded and macro expansion cannot contain #pragma. Therefore
-// we suppress them here.
-#ifdef _MSC_VER
-# pragma warning(push)
-# pragma warning(disable:4100)
-#endif
-
-// Various overloads for InvokeArgument<N>().
-//
-// The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th
-// (0-based) argument, which must be a k-ary callable, of the mock
-// function, with arguments a1, a2, ..., a_k.
-//
-// Notes:
-//
-// 1. The arguments are passed by value by default. If you need to
-// pass an argument by reference, wrap it inside ByRef(). For
-// example,
-//
-// InvokeArgument<1>(5, string("Hello"), ByRef(foo))
-//
-// passes 5 and string("Hello") by value, and passes foo by
-// reference.
-//
-// 2. If the callable takes an argument by reference but ByRef() is
-// not used, it will receive the reference to a copy of the value,
-// instead of the original value. For example, when the 0-th
-// argument of the mock function takes a const string&, the action
-//
-// InvokeArgument<0>(string("Hello"))
-//
-// makes a copy of the temporary string("Hello") object and passes a
-// reference of the copy, instead of the original temporary object,
-// to the callable. This makes it easy for a user to define an
-// InvokeArgument action from temporary values and have it performed
-// later.
-
-$range i 0..n
-$for i [[
-$range j 0..i-1
-
-ACTION_TEMPLATE(InvokeArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])) {
- return internal::CallableHelper<return_type>::Call(
- ::std::tr1::get<k>(args)$for j [[, p$j]]);
-}
-
-]]
-
-// Various overloads for ReturnNew<T>().
-//
-// The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new
-// instance of type T, constructed on the heap with constructor arguments
-// a1, a2, ..., and a_k. The caller assumes ownership of the returned value.
-$range i 0..n
-$for i [[
-$range j 0..i-1
-$var ps = [[$for j, [[p$j]]]]
-
-ACTION_TEMPLATE(ReturnNew,
- HAS_1_TEMPLATE_PARAMS(typename, T),
- AND_$i[[]]_VALUE_PARAMS($ps)) {
- return new T($ps);
-}
-
-]]
-
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-function-mockers.h b/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-function-mockers.h
deleted file mode 100644
index 577fd9e..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-function-mockers.h
+++ /dev/null
@@ -1,991 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gmock-generated-function-mockers.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements function mockers of various arities.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
-
-#include "gmock/gmock-spec-builders.h"
-#include "gmock/internal/gmock-internal-utils.h"
-
-namespace testing {
-namespace internal {
-
-template <typename F>
-class FunctionMockerBase;
-
-// Note: class FunctionMocker really belongs to the ::testing
-// namespace. However if we define it in ::testing, MSVC will
-// complain when classes in ::testing::internal declare it as a
-// friend class template. To workaround this compiler bug, we define
-// FunctionMocker in ::testing::internal and import it into ::testing.
-template <typename F>
-class FunctionMocker;
-
-template <typename R>
-class FunctionMocker<R()> : public
- internal::FunctionMockerBase<R()> {
- public:
- typedef R F();
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With() {
- return this->current_spec();
- }
-
- R Invoke() {
- // Even though gcc and MSVC don't enforce it, 'this->' is required
- // by the C++ standard [14.6.4] here, as the base class type is
- // dependent on the template argument (and thus shouldn't be
- // looked into when resolving InvokeWith).
- return this->InvokeWith(ArgumentTuple());
- }
-};
-
-template <typename R, typename A1>
-class FunctionMocker<R(A1)> : public
- internal::FunctionMockerBase<R(A1)> {
- public:
- typedef R F(A1);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1) {
- this->current_spec().SetMatchers(::std::tr1::make_tuple(m1));
- return this->current_spec();
- }
-
- R Invoke(A1 a1) {
- // Even though gcc and MSVC don't enforce it, 'this->' is required
- // by the C++ standard [14.6.4] here, as the base class type is
- // dependent on the template argument (and thus shouldn't be
- // looked into when resolving InvokeWith).
- return this->InvokeWith(ArgumentTuple(a1));
- }
-};
-
-template <typename R, typename A1, typename A2>
-class FunctionMocker<R(A1, A2)> : public
- internal::FunctionMockerBase<R(A1, A2)> {
- public:
- typedef R F(A1, A2);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2) {
- this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2));
- return this->current_spec();
- }
-
- R Invoke(A1 a1, A2 a2) {
- // Even though gcc and MSVC don't enforce it, 'this->' is required
- // by the C++ standard [14.6.4] here, as the base class type is
- // dependent on the template argument (and thus shouldn't be
- // looked into when resolving InvokeWith).
- return this->InvokeWith(ArgumentTuple(a1, a2));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3>
-class FunctionMocker<R(A1, A2, A3)> : public
- internal::FunctionMockerBase<R(A1, A2, A3)> {
- public:
- typedef R F(A1, A2, A3);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3) {
- this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3));
- return this->current_spec();
- }
-
- R Invoke(A1 a1, A2 a2, A3 a3) {
- // Even though gcc and MSVC don't enforce it, 'this->' is required
- // by the C++ standard [14.6.4] here, as the base class type is
- // dependent on the template argument (and thus shouldn't be
- // looked into when resolving InvokeWith).
- return this->InvokeWith(ArgumentTuple(a1, a2, a3));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4>
-class FunctionMocker<R(A1, A2, A3, A4)> : public
- internal::FunctionMockerBase<R(A1, A2, A3, A4)> {
- public:
- typedef R F(A1, A2, A3, A4);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3, const Matcher<A4>& m4) {
- this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4));
- return this->current_spec();
- }
-
- R Invoke(A1 a1, A2 a2, A3 a3, A4 a4) {
- // Even though gcc and MSVC don't enforce it, 'this->' is required
- // by the C++ standard [14.6.4] here, as the base class type is
- // dependent on the template argument (and thus shouldn't be
- // looked into when resolving InvokeWith).
- return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5>
-class FunctionMocker<R(A1, A2, A3, A4, A5)> : public
- internal::FunctionMockerBase<R(A1, A2, A3, A4, A5)> {
- public:
- typedef R F(A1, A2, A3, A4, A5);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5) {
- this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4,
- m5));
- return this->current_spec();
- }
-
- R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
- // Even though gcc and MSVC don't enforce it, 'this->' is required
- // by the C++ standard [14.6.4] here, as the base class type is
- // dependent on the template argument (and thus shouldn't be
- // looked into when resolving InvokeWith).
- return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6)> : public
- internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6)> {
- public:
- typedef R F(A1, A2, A3, A4, A5, A6);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
- const Matcher<A6>& m6) {
- this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
- m6));
- return this->current_spec();
- }
-
- R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
- // Even though gcc and MSVC don't enforce it, 'this->' is required
- // by the C++ standard [14.6.4] here, as the base class type is
- // dependent on the template argument (and thus shouldn't be
- // looked into when resolving InvokeWith).
- return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7)> : public
- internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7)> {
- public:
- typedef R F(A1, A2, A3, A4, A5, A6, A7);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
- const Matcher<A6>& m6, const Matcher<A7>& m7) {
- this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
- m6, m7));
- return this->current_spec();
- }
-
- R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) {
- // Even though gcc and MSVC don't enforce it, 'this->' is required
- // by the C++ standard [14.6.4] here, as the base class type is
- // dependent on the template argument (and thus shouldn't be
- // looked into when resolving InvokeWith).
- return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8)> : public
- internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
- public:
- typedef R F(A1, A2, A3, A4, A5, A6, A7, A8);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
- const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8) {
- this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
- m6, m7, m8));
- return this->current_spec();
- }
-
- R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) {
- // Even though gcc and MSVC don't enforce it, 'this->' is required
- // by the C++ standard [14.6.4] here, as the base class type is
- // dependent on the template argument (and thus shouldn't be
- // looked into when resolving InvokeWith).
- return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> : public
- internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
- public:
- typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
- const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
- const Matcher<A9>& m9) {
- this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
- m6, m7, m8, m9));
- return this->current_spec();
- }
-
- R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) {
- // Even though gcc and MSVC don't enforce it, 'this->' is required
- // by the C++ standard [14.6.4] here, as the base class type is
- // dependent on the template argument (and thus shouldn't be
- // looked into when resolving InvokeWith).
- return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9,
- typename A10>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public
- internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> {
- public:
- typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
- const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
- const Matcher<A9>& m9, const Matcher<A10>& m10) {
- this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
- m6, m7, m8, m9, m10));
- return this->current_spec();
- }
-
- R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
- A10 a10) {
- // Even though gcc and MSVC don't enforce it, 'this->' is required
- // by the C++ standard [14.6.4] here, as the base class type is
- // dependent on the template argument (and thus shouldn't be
- // looked into when resolving InvokeWith).
- return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9,
- a10));
- }
-};
-
-} // namespace internal
-
-// The style guide prohibits "using" statements in a namespace scope
-// inside a header file. However, the FunctionMocker class template
-// is meant to be defined in the ::testing namespace. The following
-// line is just a trick for working around a bug in MSVC 8.0, which
-// cannot handle it if we define FunctionMocker in ::testing.
-using internal::FunctionMocker;
-
-// GMOCK_RESULT_(tn, F) expands to the result type of function type F.
-// We define this as a variadic macro in case F contains unprotected
-// commas (the same reason that we use variadic macros in other places
-// in this file).
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_RESULT_(tn, ...) \
- tn ::testing::internal::Function<__VA_ARGS__>::Result
-
-// The type of argument N of the given function type.
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_ARG_(tn, N, ...) \
- tn ::testing::internal::Function<__VA_ARGS__>::Argument##N
-
-// The matcher type for argument N of the given function type.
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_MATCHER_(tn, N, ...) \
- const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>&
-
-// The variable for mocking the given method.
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_MOCKER_(arity, constness, Method) \
- GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- ) constness { \
- GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 0), \
- this_method_does_not_take_0_arguments); \
- GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(0, constness, Method).Invoke(); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method() constness { \
- GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(0, constness, Method).With(); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
- GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 1), \
- this_method_does_not_take_1_argument); \
- GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(1, constness, Method).Invoke(gmock_a1); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
- GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
- GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 2), \
- this_method_does_not_take_2_arguments); \
- GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(2, constness, Method).Invoke(gmock_a1, gmock_a2); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
- GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
- GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 3), \
- this_method_does_not_take_3_arguments); \
- GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(3, constness, Method).Invoke(gmock_a1, gmock_a2, \
- gmock_a3); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
- GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \
- gmock_a3); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
- GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
- GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 4), \
- this_method_does_not_take_4_arguments); \
- GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(4, constness, Method).Invoke(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
- GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
- GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
- GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
- GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
- GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 5), \
- this_method_does_not_take_5_arguments); \
- GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(5, constness, Method).Invoke(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
- GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
- GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
- GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
- GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
- GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
- GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
- GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 6), \
- this_method_does_not_take_6_arguments); \
- GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(6, constness, Method).Invoke(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
- GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
- GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
- GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
- GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
- GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
- GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
- GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
- GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
- GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 7), \
- this_method_does_not_take_7_arguments); \
- GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(7, constness, Method).Invoke(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
- GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
- GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
- GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
- GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
- GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
- GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
- GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
- GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
- GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
- GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
- GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 8), \
- this_method_does_not_take_8_arguments); \
- GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(8, constness, Method).Invoke(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
- GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
- GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
- GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
- GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
- GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
- GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(8, constness, Method).With(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
- GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
- GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
- GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
- GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
- GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
- GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
- GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 9), \
- this_method_does_not_take_9_arguments); \
- GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(9, constness, Method).Invoke(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
- gmock_a9); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
- GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
- GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
- GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
- GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
- GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
- GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
- GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(9, constness, Method).With(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
- gmock_a9); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
- GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
- GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
- GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
- GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
- GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
- GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9, \
- GMOCK_ARG_(tn, 10, __VA_ARGS__) gmock_a10) constness { \
- GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 10), \
- this_method_does_not_take_10_arguments); \
- GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(10, constness, Method).Invoke(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
- gmock_a10); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
- GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
- GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
- GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
- GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
- GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
- GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
- GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
- GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \
- GMOCK_MATCHER_(tn, 10, \
- __VA_ARGS__) gmock_a10) constness { \
- GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(10, constness, Method).With(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
- gmock_a10); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \
- Method)
-
-#define MOCK_METHOD0(m, ...) GMOCK_METHOD0_(, , , m, __VA_ARGS__)
-#define MOCK_METHOD1(m, ...) GMOCK_METHOD1_(, , , m, __VA_ARGS__)
-#define MOCK_METHOD2(m, ...) GMOCK_METHOD2_(, , , m, __VA_ARGS__)
-#define MOCK_METHOD3(m, ...) GMOCK_METHOD3_(, , , m, __VA_ARGS__)
-#define MOCK_METHOD4(m, ...) GMOCK_METHOD4_(, , , m, __VA_ARGS__)
-#define MOCK_METHOD5(m, ...) GMOCK_METHOD5_(, , , m, __VA_ARGS__)
-#define MOCK_METHOD6(m, ...) GMOCK_METHOD6_(, , , m, __VA_ARGS__)
-#define MOCK_METHOD7(m, ...) GMOCK_METHOD7_(, , , m, __VA_ARGS__)
-#define MOCK_METHOD8(m, ...) GMOCK_METHOD8_(, , , m, __VA_ARGS__)
-#define MOCK_METHOD9(m, ...) GMOCK_METHOD9_(, , , m, __VA_ARGS__)
-#define MOCK_METHOD10(m, ...) GMOCK_METHOD10_(, , , m, __VA_ARGS__)
-
-#define MOCK_CONST_METHOD0(m, ...) GMOCK_METHOD0_(, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD1(m, ...) GMOCK_METHOD1_(, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD2(m, ...) GMOCK_METHOD2_(, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD3(m, ...) GMOCK_METHOD3_(, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD4(m, ...) GMOCK_METHOD4_(, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD5(m, ...) GMOCK_METHOD5_(, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD6(m, ...) GMOCK_METHOD6_(, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD7(m, ...) GMOCK_METHOD7_(, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD8(m, ...) GMOCK_METHOD8_(, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD9(m, ...) GMOCK_METHOD9_(, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD10(m, ...) GMOCK_METHOD10_(, const, , m, __VA_ARGS__)
-
-#define MOCK_METHOD0_T(m, ...) GMOCK_METHOD0_(typename, , , m, __VA_ARGS__)
-#define MOCK_METHOD1_T(m, ...) GMOCK_METHOD1_(typename, , , m, __VA_ARGS__)
-#define MOCK_METHOD2_T(m, ...) GMOCK_METHOD2_(typename, , , m, __VA_ARGS__)
-#define MOCK_METHOD3_T(m, ...) GMOCK_METHOD3_(typename, , , m, __VA_ARGS__)
-#define MOCK_METHOD4_T(m, ...) GMOCK_METHOD4_(typename, , , m, __VA_ARGS__)
-#define MOCK_METHOD5_T(m, ...) GMOCK_METHOD5_(typename, , , m, __VA_ARGS__)
-#define MOCK_METHOD6_T(m, ...) GMOCK_METHOD6_(typename, , , m, __VA_ARGS__)
-#define MOCK_METHOD7_T(m, ...) GMOCK_METHOD7_(typename, , , m, __VA_ARGS__)
-#define MOCK_METHOD8_T(m, ...) GMOCK_METHOD8_(typename, , , m, __VA_ARGS__)
-#define MOCK_METHOD9_T(m, ...) GMOCK_METHOD9_(typename, , , m, __VA_ARGS__)
-#define MOCK_METHOD10_T(m, ...) GMOCK_METHOD10_(typename, , , m, __VA_ARGS__)
-
-#define MOCK_CONST_METHOD0_T(m, ...) \
- GMOCK_METHOD0_(typename, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD1_T(m, ...) \
- GMOCK_METHOD1_(typename, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD2_T(m, ...) \
- GMOCK_METHOD2_(typename, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD3_T(m, ...) \
- GMOCK_METHOD3_(typename, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD4_T(m, ...) \
- GMOCK_METHOD4_(typename, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD5_T(m, ...) \
- GMOCK_METHOD5_(typename, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD6_T(m, ...) \
- GMOCK_METHOD6_(typename, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD7_T(m, ...) \
- GMOCK_METHOD7_(typename, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD8_T(m, ...) \
- GMOCK_METHOD8_(typename, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD9_T(m, ...) \
- GMOCK_METHOD9_(typename, const, , m, __VA_ARGS__)
-#define MOCK_CONST_METHOD10_T(m, ...) \
- GMOCK_METHOD10_(typename, const, , m, __VA_ARGS__)
-
-#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD0_(, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD1_(, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD2_(, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD3_(, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD4_(, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD5_(, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD6_(, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD7_(, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD8_(, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD9_(, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD10_(, , ct, m, __VA_ARGS__)
-
-#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD0_(, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD1_(, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD2_(, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD3_(, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD4_(, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD5_(, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD6_(, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD7_(, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD8_(, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD9_(, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD10_(, const, ct, m, __VA_ARGS__)
-
-#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD0_(typename, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD1_(typename, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD2_(typename, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD3_(typename, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD4_(typename, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD5_(typename, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD6_(typename, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD7_(typename, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD8_(typename, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD9_(typename, , ct, m, __VA_ARGS__)
-#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD10_(typename, , ct, m, __VA_ARGS__)
-
-#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD0_(typename, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD1_(typename, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD2_(typename, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD3_(typename, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD4_(typename, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD5_(typename, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD6_(typename, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD7_(typename, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD8_(typename, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD9_(typename, const, ct, m, __VA_ARGS__)
-#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD10_(typename, const, ct, m, __VA_ARGS__)
-
-// A MockFunction<F> class has one mock method whose type is F. It is
-// useful when you just want your test code to emit some messages and
-// have Google Mock verify the right messages are sent (and perhaps at
-// the right times). For example, if you are exercising code:
-//
-// Foo(1);
-// Foo(2);
-// Foo(3);
-//
-// and want to verify that Foo(1) and Foo(3) both invoke
-// mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write:
-//
-// TEST(FooTest, InvokesBarCorrectly) {
-// MyMock mock;
-// MockFunction<void(string check_point_name)> check;
-// {
-// InSequence s;
-//
-// EXPECT_CALL(mock, Bar("a"));
-// EXPECT_CALL(check, Call("1"));
-// EXPECT_CALL(check, Call("2"));
-// EXPECT_CALL(mock, Bar("a"));
-// }
-// Foo(1);
-// check.Call("1");
-// Foo(2);
-// check.Call("2");
-// Foo(3);
-// }
-//
-// The expectation spec says that the first Bar("a") must happen
-// before check point "1", the second Bar("a") must happen after check
-// point "2", and nothing should happen between the two check
-// points. The explicit check points make it easy to tell which
-// Bar("a") is called by which call to Foo().
-template <typename F>
-class MockFunction;
-
-template <typename R>
-class MockFunction<R()> {
- public:
- MockFunction() {}
-
- MOCK_METHOD0_T(Call, R());
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
-};
-
-template <typename R, typename A0>
-class MockFunction<R(A0)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD1_T(Call, R(A0));
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
-};
-
-template <typename R, typename A0, typename A1>
-class MockFunction<R(A0, A1)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD2_T(Call, R(A0, A1));
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
-};
-
-template <typename R, typename A0, typename A1, typename A2>
-class MockFunction<R(A0, A1, A2)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD3_T(Call, R(A0, A1, A2));
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
-};
-
-template <typename R, typename A0, typename A1, typename A2, typename A3>
-class MockFunction<R(A0, A1, A2, A3)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD4_T(Call, R(A0, A1, A2, A3));
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
-};
-
-template <typename R, typename A0, typename A1, typename A2, typename A3,
- typename A4>
-class MockFunction<R(A0, A1, A2, A3, A4)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4));
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
-};
-
-template <typename R, typename A0, typename A1, typename A2, typename A3,
- typename A4, typename A5>
-class MockFunction<R(A0, A1, A2, A3, A4, A5)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5));
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
-};
-
-template <typename R, typename A0, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6>
-class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6));
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
-};
-
-template <typename R, typename A0, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6, typename A7>
-class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7));
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
-};
-
-template <typename R, typename A0, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6, typename A7, typename A8>
-class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8));
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
-};
-
-template <typename R, typename A0, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6, typename A7, typename A8,
- typename A9>
-class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9));
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
-};
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-function-mockers.h.pump b/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-function-mockers.h.pump
deleted file mode 100644
index f050caf..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-function-mockers.h.pump
+++ /dev/null
@@ -1,265 +0,0 @@
-$$ -*- mode: c++; -*-
-$$ This is a Pump source file. Please use Pump to convert it to
-$$ gmock-generated-function-mockers.h.
-$$
-$var n = 10 $$ The maximum arity we support.
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements function mockers of various arities.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
-
-#include "gmock/gmock-spec-builders.h"
-#include "gmock/internal/gmock-internal-utils.h"
-
-namespace testing {
-namespace internal {
-
-template <typename F>
-class FunctionMockerBase;
-
-// Note: class FunctionMocker really belongs to the ::testing
-// namespace. However if we define it in ::testing, MSVC will
-// complain when classes in ::testing::internal declare it as a
-// friend class template. To workaround this compiler bug, we define
-// FunctionMocker in ::testing::internal and import it into ::testing.
-template <typename F>
-class FunctionMocker;
-
-
-$range i 0..n
-$for i [[
-$range j 1..i
-$var typename_As = [[$for j [[, typename A$j]]]]
-$var As = [[$for j, [[A$j]]]]
-$var as = [[$for j, [[a$j]]]]
-$var Aas = [[$for j, [[A$j a$j]]]]
-$var ms = [[$for j, [[m$j]]]]
-$var matchers = [[$for j, [[const Matcher<A$j>& m$j]]]]
-template <typename R$typename_As>
-class FunctionMocker<R($As)> : public
- internal::FunctionMockerBase<R($As)> {
- public:
- typedef R F($As);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With($matchers) {
-
-$if i >= 1 [[
- this->current_spec().SetMatchers(::std::tr1::make_tuple($ms));
-
-]]
- return this->current_spec();
- }
-
- R Invoke($Aas) {
- // Even though gcc and MSVC don't enforce it, 'this->' is required
- // by the C++ standard [14.6.4] here, as the base class type is
- // dependent on the template argument (and thus shouldn't be
- // looked into when resolving InvokeWith).
- return this->InvokeWith(ArgumentTuple($as));
- }
-};
-
-
-]]
-} // namespace internal
-
-// The style guide prohibits "using" statements in a namespace scope
-// inside a header file. However, the FunctionMocker class template
-// is meant to be defined in the ::testing namespace. The following
-// line is just a trick for working around a bug in MSVC 8.0, which
-// cannot handle it if we define FunctionMocker in ::testing.
-using internal::FunctionMocker;
-
-// GMOCK_RESULT_(tn, F) expands to the result type of function type F.
-// We define this as a variadic macro in case F contains unprotected
-// commas (the same reason that we use variadic macros in other places
-// in this file).
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_RESULT_(tn, ...) \
- tn ::testing::internal::Function<__VA_ARGS__>::Result
-
-// The type of argument N of the given function type.
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_ARG_(tn, N, ...) \
- tn ::testing::internal::Function<__VA_ARGS__>::Argument##N
-
-// The matcher type for argument N of the given function type.
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_MATCHER_(tn, N, ...) \
- const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>&
-
-// The variable for mocking the given method.
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_MOCKER_(arity, constness, Method) \
- GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
-
-
-$for i [[
-$range j 1..i
-$var arg_as = [[$for j, \
- [[GMOCK_ARG_(tn, $j, __VA_ARGS__) gmock_a$j]]]]
-$var as = [[$for j, [[gmock_a$j]]]]
-$var matcher_as = [[$for j, \
- [[GMOCK_MATCHER_(tn, $j, __VA_ARGS__) gmock_a$j]]]]
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- $arg_as) constness { \
- GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value == $i), \
- this_method_does_not_take_$i[[]]_argument[[$if i != 1 [[s]]]]); \
- GMOCK_MOCKER_($i, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_($i, constness, Method).Invoke($as); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method($matcher_as) constness { \
- GMOCK_MOCKER_($i, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_($i, constness, Method).With($as); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_($i, constness, Method)
-
-
-]]
-$for i [[
-#define MOCK_METHOD$i(m, ...) GMOCK_METHOD$i[[]]_(, , , m, __VA_ARGS__)
-
-]]
-
-
-$for i [[
-#define MOCK_CONST_METHOD$i(m, ...) GMOCK_METHOD$i[[]]_(, const, , m, __VA_ARGS__)
-
-]]
-
-
-$for i [[
-#define MOCK_METHOD$i[[]]_T(m, ...) GMOCK_METHOD$i[[]]_(typename, , , m, __VA_ARGS__)
-
-]]
-
-
-$for i [[
-#define MOCK_CONST_METHOD$i[[]]_T(m, ...) \
- GMOCK_METHOD$i[[]]_(typename, const, , m, __VA_ARGS__)
-
-]]
-
-
-$for i [[
-#define MOCK_METHOD$i[[]]_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD$i[[]]_(, , ct, m, __VA_ARGS__)
-
-]]
-
-
-$for i [[
-#define MOCK_CONST_METHOD$i[[]]_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD$i[[]]_(, const, ct, m, __VA_ARGS__)
-
-]]
-
-
-$for i [[
-#define MOCK_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD$i[[]]_(typename, , ct, m, __VA_ARGS__)
-
-]]
-
-
-$for i [[
-#define MOCK_CONST_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, ...) \
- GMOCK_METHOD$i[[]]_(typename, const, ct, m, __VA_ARGS__)
-
-]]
-
-// A MockFunction<F> class has one mock method whose type is F. It is
-// useful when you just want your test code to emit some messages and
-// have Google Mock verify the right messages are sent (and perhaps at
-// the right times). For example, if you are exercising code:
-//
-// Foo(1);
-// Foo(2);
-// Foo(3);
-//
-// and want to verify that Foo(1) and Foo(3) both invoke
-// mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write:
-//
-// TEST(FooTest, InvokesBarCorrectly) {
-// MyMock mock;
-// MockFunction<void(string check_point_name)> check;
-// {
-// InSequence s;
-//
-// EXPECT_CALL(mock, Bar("a"));
-// EXPECT_CALL(check, Call("1"));
-// EXPECT_CALL(check, Call("2"));
-// EXPECT_CALL(mock, Bar("a"));
-// }
-// Foo(1);
-// check.Call("1");
-// Foo(2);
-// check.Call("2");
-// Foo(3);
-// }
-//
-// The expectation spec says that the first Bar("a") must happen
-// before check point "1", the second Bar("a") must happen after check
-// point "2", and nothing should happen between the two check
-// points. The explicit check points make it easy to tell which
-// Bar("a") is called by which call to Foo().
-template <typename F>
-class MockFunction;
-
-
-$for i [[
-$range j 0..i-1
-template <typename R$for j [[, typename A$j]]>
-class MockFunction<R($for j, [[A$j]])> {
- public:
- MockFunction() {}
-
- MOCK_METHOD$i[[]]_T(Call, R($for j, [[A$j]]));
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
-};
-
-
-]]
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-matchers.h b/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-matchers.h
deleted file mode 100644
index b4c8571..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-matchers.h
+++ /dev/null
@@ -1,2190 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gmock-generated-matchers.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some commonly used variadic matchers.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
-
-#include <iterator>
-#include <sstream>
-#include <string>
-#include <vector>
-#include "gmock/gmock-matchers.h"
-
-namespace testing {
-namespace internal {
-
-// The type of the i-th (0-based) field of Tuple.
-#define GMOCK_FIELD_TYPE_(Tuple, i) \
- typename ::std::tr1::tuple_element<i, Tuple>::type
-
-// TupleFields<Tuple, k0, ..., kn> is for selecting fields from a
-// tuple of type Tuple. It has two members:
-//
-// type: a tuple type whose i-th field is the ki-th field of Tuple.
-// GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple.
-//
-// For example, in class TupleFields<tuple<bool, char, int>, 2, 0>, we have:
-//
-// type is tuple<int, bool>, and
-// GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true).
-
-template <class Tuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1,
- int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
- int k9 = -1>
-class TupleFields;
-
-// This generic version is used when there are 10 selectors.
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
- int k7, int k8, int k9>
-class TupleFields {
- public:
- typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
- GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
- GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
- GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8),
- GMOCK_FIELD_TYPE_(Tuple, k9)> type;
- static type GetSelectedFields(const Tuple& t) {
- using ::std::tr1::get;
- return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
- get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t), get<k9>(t));
- }
-};
-
-// The following specialization is used for 0 ~ 9 selectors.
-
-template <class Tuple>
-class TupleFields<Tuple, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef ::std::tr1::tuple<> type;
- static type GetSelectedFields(const Tuple& /* t */) {
- using ::std::tr1::get;
- return type();
- }
-};
-
-template <class Tuple, int k0>
-class TupleFields<Tuple, k0, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0)> type;
- static type GetSelectedFields(const Tuple& t) {
- using ::std::tr1::get;
- return type(get<k0>(t));
- }
-};
-
-template <class Tuple, int k0, int k1>
-class TupleFields<Tuple, k0, k1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1)> type;
- static type GetSelectedFields(const Tuple& t) {
- using ::std::tr1::get;
- return type(get<k0>(t), get<k1>(t));
- }
-};
-
-template <class Tuple, int k0, int k1, int k2>
-class TupleFields<Tuple, k0, k1, k2, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2)> type;
- static type GetSelectedFields(const Tuple& t) {
- using ::std::tr1::get;
- return type(get<k0>(t), get<k1>(t), get<k2>(t));
- }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3>
-class TupleFields<Tuple, k0, k1, k2, k3, -1, -1, -1, -1, -1, -1> {
- public:
- typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
- GMOCK_FIELD_TYPE_(Tuple, k3)> type;
- static type GetSelectedFields(const Tuple& t) {
- using ::std::tr1::get;
- return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t));
- }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, -1, -1, -1, -1, -1> {
- public:
- typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
- GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4)> type;
- static type GetSelectedFields(const Tuple& t) {
- using ::std::tr1::get;
- return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t));
- }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, -1, -1, -1, -1> {
- public:
- typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
- GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
- GMOCK_FIELD_TYPE_(Tuple, k5)> type;
- static type GetSelectedFields(const Tuple& t) {
- using ::std::tr1::get;
- return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
- get<k5>(t));
- }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, -1, -1, -1> {
- public:
- typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
- GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
- GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6)> type;
- static type GetSelectedFields(const Tuple& t) {
- using ::std::tr1::get;
- return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
- get<k5>(t), get<k6>(t));
- }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
- int k7>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, -1, -1> {
- public:
- typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
- GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
- GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
- GMOCK_FIELD_TYPE_(Tuple, k7)> type;
- static type GetSelectedFields(const Tuple& t) {
- using ::std::tr1::get;
- return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
- get<k5>(t), get<k6>(t), get<k7>(t));
- }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
- int k7, int k8>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, k8, -1> {
- public:
- typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
- GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
- GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
- GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8)> type;
- static type GetSelectedFields(const Tuple& t) {
- using ::std::tr1::get;
- return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
- get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t));
- }
-};
-
-#undef GMOCK_FIELD_TYPE_
-
-// Implements the Args() matcher.
-template <class ArgsTuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1,
- int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
- int k9 = -1>
-class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> {
- public:
- // ArgsTuple may have top-level const or reference modifiers.
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple;
- typedef typename internal::TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5,
- k6, k7, k8, k9>::type SelectedArgs;
- typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher;
-
- template <typename InnerMatcher>
- explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher)
- : inner_matcher_(SafeMatcherCast<const SelectedArgs&>(inner_matcher)) {}
-
- virtual bool MatchAndExplain(ArgsTuple args,
- MatchResultListener* listener) const {
- const SelectedArgs& selected_args = GetSelectedArgs(args);
- if (!listener->IsInterested())
- return inner_matcher_.Matches(selected_args);
-
- PrintIndices(listener->stream());
- *listener << "are " << PrintToString(selected_args);
-
- StringMatchResultListener inner_listener;
- const bool match = inner_matcher_.MatchAndExplain(selected_args,
- &inner_listener);
- PrintIfNotEmpty(inner_listener.str(), listener->stream());
- return match;
- }
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "are a tuple ";
- PrintIndices(os);
- inner_matcher_.DescribeTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "are a tuple ";
- PrintIndices(os);
- inner_matcher_.DescribeNegationTo(os);
- }
-
- private:
- static SelectedArgs GetSelectedArgs(ArgsTuple args) {
- return TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5, k6, k7, k8,
- k9>::GetSelectedFields(args);
- }
-
- // Prints the indices of the selected fields.
- static void PrintIndices(::std::ostream* os) {
- *os << "whose fields (";
- const int indices[10] = { k0, k1, k2, k3, k4, k5, k6, k7, k8, k9 };
- for (int i = 0; i < 10; i++) {
- if (indices[i] < 0)
- break;
-
- if (i >= 1)
- *os << ", ";
-
- *os << "#" << indices[i];
- }
- *os << ") ";
- }
-
- const MonomorphicInnerMatcher inner_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(ArgsMatcherImpl);
-};
-
-template <class InnerMatcher, int k0 = -1, int k1 = -1, int k2 = -1,
- int k3 = -1, int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1,
- int k8 = -1, int k9 = -1>
-class ArgsMatcher {
- public:
- explicit ArgsMatcher(const InnerMatcher& inner_matcher)
- : inner_matcher_(inner_matcher) {}
-
- template <typename ArgsTuple>
- operator Matcher<ArgsTuple>() const {
- return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, k0, k1, k2, k3, k4, k5,
- k6, k7, k8, k9>(inner_matcher_));
- }
-
- private:
- const InnerMatcher inner_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(ArgsMatcher);
-};
-
-// A set of metafunctions for computing the result type of AllOf.
-// AllOf(m1, ..., mN) returns
-// AllOfResultN<decltype(m1), ..., decltype(mN)>::type.
-
-// Although AllOf isn't defined for one argument, AllOfResult1 is defined
-// to simplify the implementation.
-template <typename M1>
-struct AllOfResult1 {
- typedef M1 type;
-};
-
-template <typename M1, typename M2>
-struct AllOfResult2 {
- typedef BothOfMatcher<
- typename AllOfResult1<M1>::type,
- typename AllOfResult1<M2>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3>
-struct AllOfResult3 {
- typedef BothOfMatcher<
- typename AllOfResult1<M1>::type,
- typename AllOfResult2<M2, M3>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4>
-struct AllOfResult4 {
- typedef BothOfMatcher<
- typename AllOfResult2<M1, M2>::type,
- typename AllOfResult2<M3, M4>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5>
-struct AllOfResult5 {
- typedef BothOfMatcher<
- typename AllOfResult2<M1, M2>::type,
- typename AllOfResult3<M3, M4, M5>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6>
-struct AllOfResult6 {
- typedef BothOfMatcher<
- typename AllOfResult3<M1, M2, M3>::type,
- typename AllOfResult3<M4, M5, M6>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7>
-struct AllOfResult7 {
- typedef BothOfMatcher<
- typename AllOfResult3<M1, M2, M3>::type,
- typename AllOfResult4<M4, M5, M6, M7>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8>
-struct AllOfResult8 {
- typedef BothOfMatcher<
- typename AllOfResult4<M1, M2, M3, M4>::type,
- typename AllOfResult4<M5, M6, M7, M8>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9>
-struct AllOfResult9 {
- typedef BothOfMatcher<
- typename AllOfResult4<M1, M2, M3, M4>::type,
- typename AllOfResult5<M5, M6, M7, M8, M9>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9, typename M10>
-struct AllOfResult10 {
- typedef BothOfMatcher<
- typename AllOfResult5<M1, M2, M3, M4, M5>::type,
- typename AllOfResult5<M6, M7, M8, M9, M10>::type
- > type;
-};
-
-// A set of metafunctions for computing the result type of AnyOf.
-// AnyOf(m1, ..., mN) returns
-// AnyOfResultN<decltype(m1), ..., decltype(mN)>::type.
-
-// Although AnyOf isn't defined for one argument, AnyOfResult1 is defined
-// to simplify the implementation.
-template <typename M1>
-struct AnyOfResult1 {
- typedef M1 type;
-};
-
-template <typename M1, typename M2>
-struct AnyOfResult2 {
- typedef EitherOfMatcher<
- typename AnyOfResult1<M1>::type,
- typename AnyOfResult1<M2>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3>
-struct AnyOfResult3 {
- typedef EitherOfMatcher<
- typename AnyOfResult1<M1>::type,
- typename AnyOfResult2<M2, M3>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4>
-struct AnyOfResult4 {
- typedef EitherOfMatcher<
- typename AnyOfResult2<M1, M2>::type,
- typename AnyOfResult2<M3, M4>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5>
-struct AnyOfResult5 {
- typedef EitherOfMatcher<
- typename AnyOfResult2<M1, M2>::type,
- typename AnyOfResult3<M3, M4, M5>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6>
-struct AnyOfResult6 {
- typedef EitherOfMatcher<
- typename AnyOfResult3<M1, M2, M3>::type,
- typename AnyOfResult3<M4, M5, M6>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7>
-struct AnyOfResult7 {
- typedef EitherOfMatcher<
- typename AnyOfResult3<M1, M2, M3>::type,
- typename AnyOfResult4<M4, M5, M6, M7>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8>
-struct AnyOfResult8 {
- typedef EitherOfMatcher<
- typename AnyOfResult4<M1, M2, M3, M4>::type,
- typename AnyOfResult4<M5, M6, M7, M8>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9>
-struct AnyOfResult9 {
- typedef EitherOfMatcher<
- typename AnyOfResult4<M1, M2, M3, M4>::type,
- typename AnyOfResult5<M5, M6, M7, M8, M9>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9, typename M10>
-struct AnyOfResult10 {
- typedef EitherOfMatcher<
- typename AnyOfResult5<M1, M2, M3, M4, M5>::type,
- typename AnyOfResult5<M6, M7, M8, M9, M10>::type
- > type;
-};
-
-} // namespace internal
-
-// Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected
-// fields of it matches a_matcher. C++ doesn't support default
-// arguments for function templates, so we have to overload it.
-template <typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher>(matcher);
-}
-
-template <int k1, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1>(matcher);
-}
-
-template <int k1, int k2, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2>(matcher);
-}
-
-template <int k1, int k2, int k3, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7,
- typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6,
- k7>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
- typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7,
- k8>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
- int k9, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8,
- k9>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
- int k9, int k10, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9,
- k10>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8,
- k9, k10>(matcher);
-}
-
-// ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with
-// n elements, where the i-th element in the container must
-// match the i-th argument in the list. Each argument of
-// ElementsAre() can be either a value or a matcher. We support up to
-// 10 arguments.
-//
-// The use of DecayArray in the implementation allows ElementsAre()
-// to accept string literals, whose type is const char[N], but we
-// want to treat them as const char*.
-//
-// NOTE: Since ElementsAre() cares about the order of the elements, it
-// must not be used with containers whose elements's order is
-// undefined (e.g. hash_map).
-
-inline internal::ElementsAreMatcher<
- std::tr1::tuple<> >
-ElementsAre() {
- typedef std::tr1::tuple<> Args;
- return internal::ElementsAreMatcher<Args>(Args());
-}
-
-template <typename T1>
-inline internal::ElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type> >
-ElementsAre(const T1& e1) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1));
-}
-
-template <typename T1, typename T2>
-inline internal::ElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type> >
-ElementsAre(const T1& e1, const T2& e2) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2));
-}
-
-template <typename T1, typename T2, typename T3>
-inline internal::ElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type> >
-ElementsAre(const T1& e1, const T2& e2, const T3& e3) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3));
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-inline internal::ElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type> >
-ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-inline internal::ElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type> >
-ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
- const T5& e5) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-inline internal::ElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type> >
-ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
- const T5& e5, const T6& e6) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-inline internal::ElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type> >
-ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
- const T5& e5, const T6& e6, const T7& e7) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-inline internal::ElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type> >
-ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
- const T5& e5, const T6& e6, const T7& e7, const T8& e8) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7,
- e8));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-inline internal::ElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::type> >
-ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
- const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7,
- e8, e9));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-inline internal::ElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::type,
- typename internal::DecayArray<T10>::type> >
-ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
- const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9,
- const T10& e10) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::type,
- typename internal::DecayArray<T10>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7,
- e8, e9, e10));
-}
-
-// UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension
-// that matches n elements in any order. We support up to n=10 arguments.
-
-inline internal::UnorderedElementsAreMatcher<
- std::tr1::tuple<> >
-UnorderedElementsAre() {
- typedef std::tr1::tuple<> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args());
-}
-
-template <typename T1>
-inline internal::UnorderedElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type> >
-UnorderedElementsAre(const T1& e1) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1));
-}
-
-template <typename T1, typename T2>
-inline internal::UnorderedElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type> >
-UnorderedElementsAre(const T1& e1, const T2& e2) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2));
-}
-
-template <typename T1, typename T2, typename T3>
-inline internal::UnorderedElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type> >
-UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3));
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-inline internal::UnorderedElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type> >
-UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-inline internal::UnorderedElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type> >
-UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
- const T5& e5) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-inline internal::UnorderedElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type> >
-UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
- const T5& e5, const T6& e6) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5,
- e6));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-inline internal::UnorderedElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type> >
-UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
- const T5& e5, const T6& e6, const T7& e7) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5,
- e6, e7));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-inline internal::UnorderedElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type> >
-UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
- const T5& e5, const T6& e6, const T7& e7, const T8& e8) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5,
- e6, e7, e8));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-inline internal::UnorderedElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::type> >
-UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
- const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5,
- e6, e7, e8, e9));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-inline internal::UnorderedElementsAreMatcher<
- std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::type,
- typename internal::DecayArray<T10>::type> >
-UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
- const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9,
- const T10& e10) {
- typedef std::tr1::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::type,
- typename internal::DecayArray<T10>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5,
- e6, e7, e8, e9, e10));
-}
-
-// AllOf(m1, m2, ..., mk) matches any value that matches all of the given
-// sub-matchers. AllOf is called fully qualified to prevent ADL from firing.
-
-template <typename M1, typename M2>
-inline typename internal::AllOfResult2<M1, M2>::type
-AllOf(M1 m1, M2 m2) {
- return typename internal::AllOfResult2<M1, M2>::type(
- m1,
- m2);
-}
-
-template <typename M1, typename M2, typename M3>
-inline typename internal::AllOfResult3<M1, M2, M3>::type
-AllOf(M1 m1, M2 m2, M3 m3) {
- return typename internal::AllOfResult3<M1, M2, M3>::type(
- m1,
- ::testing::AllOf(m2, m3));
-}
-
-template <typename M1, typename M2, typename M3, typename M4>
-inline typename internal::AllOfResult4<M1, M2, M3, M4>::type
-AllOf(M1 m1, M2 m2, M3 m3, M4 m4) {
- return typename internal::AllOfResult4<M1, M2, M3, M4>::type(
- ::testing::AllOf(m1, m2),
- ::testing::AllOf(m3, m4));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5>
-inline typename internal::AllOfResult5<M1, M2, M3, M4, M5>::type
-AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) {
- return typename internal::AllOfResult5<M1, M2, M3, M4, M5>::type(
- ::testing::AllOf(m1, m2),
- ::testing::AllOf(m3, m4, m5));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6>
-inline typename internal::AllOfResult6<M1, M2, M3, M4, M5, M6>::type
-AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) {
- return typename internal::AllOfResult6<M1, M2, M3, M4, M5, M6>::type(
- ::testing::AllOf(m1, m2, m3),
- ::testing::AllOf(m4, m5, m6));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7>
-inline typename internal::AllOfResult7<M1, M2, M3, M4, M5, M6, M7>::type
-AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) {
- return typename internal::AllOfResult7<M1, M2, M3, M4, M5, M6, M7>::type(
- ::testing::AllOf(m1, m2, m3),
- ::testing::AllOf(m4, m5, m6, m7));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8>
-inline typename internal::AllOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type
-AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) {
- return typename internal::AllOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type(
- ::testing::AllOf(m1, m2, m3, m4),
- ::testing::AllOf(m5, m6, m7, m8));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9>
-inline typename internal::AllOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, M9>::type
-AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) {
- return typename internal::AllOfResult9<M1, M2, M3, M4, M5, M6, M7, M8,
- M9>::type(
- ::testing::AllOf(m1, m2, m3, m4),
- ::testing::AllOf(m5, m6, m7, m8, m9));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9, typename M10>
-inline typename internal::AllOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9,
- M10>::type
-AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
- return typename internal::AllOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9,
- M10>::type(
- ::testing::AllOf(m1, m2, m3, m4, m5),
- ::testing::AllOf(m6, m7, m8, m9, m10));
-}
-
-// AnyOf(m1, m2, ..., mk) matches any value that matches any of the given
-// sub-matchers. AnyOf is called fully qualified to prevent ADL from firing.
-
-template <typename M1, typename M2>
-inline typename internal::AnyOfResult2<M1, M2>::type
-AnyOf(M1 m1, M2 m2) {
- return typename internal::AnyOfResult2<M1, M2>::type(
- m1,
- m2);
-}
-
-template <typename M1, typename M2, typename M3>
-inline typename internal::AnyOfResult3<M1, M2, M3>::type
-AnyOf(M1 m1, M2 m2, M3 m3) {
- return typename internal::AnyOfResult3<M1, M2, M3>::type(
- m1,
- ::testing::AnyOf(m2, m3));
-}
-
-template <typename M1, typename M2, typename M3, typename M4>
-inline typename internal::AnyOfResult4<M1, M2, M3, M4>::type
-AnyOf(M1 m1, M2 m2, M3 m3, M4 m4) {
- return typename internal::AnyOfResult4<M1, M2, M3, M4>::type(
- ::testing::AnyOf(m1, m2),
- ::testing::AnyOf(m3, m4));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5>
-inline typename internal::AnyOfResult5<M1, M2, M3, M4, M5>::type
-AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) {
- return typename internal::AnyOfResult5<M1, M2, M3, M4, M5>::type(
- ::testing::AnyOf(m1, m2),
- ::testing::AnyOf(m3, m4, m5));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6>
-inline typename internal::AnyOfResult6<M1, M2, M3, M4, M5, M6>::type
-AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) {
- return typename internal::AnyOfResult6<M1, M2, M3, M4, M5, M6>::type(
- ::testing::AnyOf(m1, m2, m3),
- ::testing::AnyOf(m4, m5, m6));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7>
-inline typename internal::AnyOfResult7<M1, M2, M3, M4, M5, M6, M7>::type
-AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) {
- return typename internal::AnyOfResult7<M1, M2, M3, M4, M5, M6, M7>::type(
- ::testing::AnyOf(m1, m2, m3),
- ::testing::AnyOf(m4, m5, m6, m7));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8>
-inline typename internal::AnyOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type
-AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) {
- return typename internal::AnyOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type(
- ::testing::AnyOf(m1, m2, m3, m4),
- ::testing::AnyOf(m5, m6, m7, m8));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9>
-inline typename internal::AnyOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, M9>::type
-AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) {
- return typename internal::AnyOfResult9<M1, M2, M3, M4, M5, M6, M7, M8,
- M9>::type(
- ::testing::AnyOf(m1, m2, m3, m4),
- ::testing::AnyOf(m5, m6, m7, m8, m9));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9, typename M10>
-inline typename internal::AnyOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9,
- M10>::type
-AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
- return typename internal::AnyOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9,
- M10>::type(
- ::testing::AnyOf(m1, m2, m3, m4, m5),
- ::testing::AnyOf(m6, m7, m8, m9, m10));
-}
-
-} // namespace testing
-
-
-// The MATCHER* family of macros can be used in a namespace scope to
-// define custom matchers easily.
-//
-// Basic Usage
-// ===========
-//
-// The syntax
-//
-// MATCHER(name, description_string) { statements; }
-//
-// defines a matcher with the given name that executes the statements,
-// which must return a bool to indicate if the match succeeds. Inside
-// the statements, you can refer to the value being matched by 'arg',
-// and refer to its type by 'arg_type'.
-//
-// The description string documents what the matcher does, and is used
-// to generate the failure message when the match fails. Since a
-// MATCHER() is usually defined in a header file shared by multiple
-// C++ source files, we require the description to be a C-string
-// literal to avoid possible side effects. It can be empty, in which
-// case we'll use the sequence of words in the matcher name as the
-// description.
-//
-// For example:
-//
-// MATCHER(IsEven, "") { return (arg % 2) == 0; }
-//
-// allows you to write
-//
-// // Expects mock_foo.Bar(n) to be called where n is even.
-// EXPECT_CALL(mock_foo, Bar(IsEven()));
-//
-// or,
-//
-// // Verifies that the value of some_expression is even.
-// EXPECT_THAT(some_expression, IsEven());
-//
-// If the above assertion fails, it will print something like:
-//
-// Value of: some_expression
-// Expected: is even
-// Actual: 7
-//
-// where the description "is even" is automatically calculated from the
-// matcher name IsEven.
-//
-// Argument Type
-// =============
-//
-// Note that the type of the value being matched (arg_type) is
-// determined by the context in which you use the matcher and is
-// supplied to you by the compiler, so you don't need to worry about
-// declaring it (nor can you). This allows the matcher to be
-// polymorphic. For example, IsEven() can be used to match any type
-// where the value of "(arg % 2) == 0" can be implicitly converted to
-// a bool. In the "Bar(IsEven())" example above, if method Bar()
-// takes an int, 'arg_type' will be int; if it takes an unsigned long,
-// 'arg_type' will be unsigned long; and so on.
-//
-// Parameterizing Matchers
-// =======================
-//
-// Sometimes you'll want to parameterize the matcher. For that you
-// can use another macro:
-//
-// MATCHER_P(name, param_name, description_string) { statements; }
-//
-// For example:
-//
-// MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; }
-//
-// will allow you to write:
-//
-// EXPECT_THAT(Blah("a"), HasAbsoluteValue(n));
-//
-// which may lead to this message (assuming n is 10):
-//
-// Value of: Blah("a")
-// Expected: has absolute value 10
-// Actual: -9
-//
-// Note that both the matcher description and its parameter are
-// printed, making the message human-friendly.
-//
-// In the matcher definition body, you can write 'foo_type' to
-// reference the type of a parameter named 'foo'. For example, in the
-// body of MATCHER_P(HasAbsoluteValue, value) above, you can write
-// 'value_type' to refer to the type of 'value'.
-//
-// We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P10 to
-// support multi-parameter matchers.
-//
-// Describing Parameterized Matchers
-// =================================
-//
-// The last argument to MATCHER*() is a string-typed expression. The
-// expression can reference all of the matcher's parameters and a
-// special bool-typed variable named 'negation'. When 'negation' is
-// false, the expression should evaluate to the matcher's description;
-// otherwise it should evaluate to the description of the negation of
-// the matcher. For example,
-//
-// using testing::PrintToString;
-//
-// MATCHER_P2(InClosedRange, low, hi,
-// string(negation ? "is not" : "is") + " in range [" +
-// PrintToString(low) + ", " + PrintToString(hi) + "]") {
-// return low <= arg && arg <= hi;
-// }
-// ...
-// EXPECT_THAT(3, InClosedRange(4, 6));
-// EXPECT_THAT(3, Not(InClosedRange(2, 4)));
-//
-// would generate two failures that contain the text:
-//
-// Expected: is in range [4, 6]
-// ...
-// Expected: is not in range [2, 4]
-//
-// If you specify "" as the description, the failure message will
-// contain the sequence of words in the matcher name followed by the
-// parameter values printed as a tuple. For example,
-//
-// MATCHER_P2(InClosedRange, low, hi, "") { ... }
-// ...
-// EXPECT_THAT(3, InClosedRange(4, 6));
-// EXPECT_THAT(3, Not(InClosedRange(2, 4)));
-//
-// would generate two failures that contain the text:
-//
-// Expected: in closed range (4, 6)
-// ...
-// Expected: not (in closed range (2, 4))
-//
-// Types of Matcher Parameters
-// ===========================
-//
-// For the purpose of typing, you can view
-//
-// MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... }
-//
-// as shorthand for
-//
-// template <typename p1_type, ..., typename pk_type>
-// FooMatcherPk<p1_type, ..., pk_type>
-// Foo(p1_type p1, ..., pk_type pk) { ... }
-//
-// When you write Foo(v1, ..., vk), the compiler infers the types of
-// the parameters v1, ..., and vk for you. If you are not happy with
-// the result of the type inference, you can specify the types by
-// explicitly instantiating the template, as in Foo<long, bool>(5,
-// false). As said earlier, you don't get to (or need to) specify
-// 'arg_type' as that's determined by the context in which the matcher
-// is used. You can assign the result of expression Foo(p1, ..., pk)
-// to a variable of type FooMatcherPk<p1_type, ..., pk_type>. This
-// can be useful when composing matchers.
-//
-// While you can instantiate a matcher template with reference types,
-// passing the parameters by pointer usually makes your code more
-// readable. If, however, you still want to pass a parameter by
-// reference, be aware that in the failure message generated by the
-// matcher you will see the value of the referenced object but not its
-// address.
-//
-// Explaining Match Results
-// ========================
-//
-// Sometimes the matcher description alone isn't enough to explain why
-// the match has failed or succeeded. For example, when expecting a
-// long string, it can be very helpful to also print the diff between
-// the expected string and the actual one. To achieve that, you can
-// optionally stream additional information to a special variable
-// named result_listener, whose type is a pointer to class
-// MatchResultListener:
-//
-// MATCHER_P(EqualsLongString, str, "") {
-// if (arg == str) return true;
-//
-// *result_listener << "the difference: "
-/// << DiffStrings(str, arg);
-// return false;
-// }
-//
-// Overloading Matchers
-// ====================
-//
-// You can overload matchers with different numbers of parameters:
-//
-// MATCHER_P(Blah, a, description_string1) { ... }
-// MATCHER_P2(Blah, a, b, description_string2) { ... }
-//
-// Caveats
-// =======
-//
-// When defining a new matcher, you should also consider implementing
-// MatcherInterface or using MakePolymorphicMatcher(). These
-// approaches require more work than the MATCHER* macros, but also
-// give you more control on the types of the value being matched and
-// the matcher parameters, which may leads to better compiler error
-// messages when the matcher is used wrong. They also allow
-// overloading matchers based on parameter types (as opposed to just
-// based on the number of parameters).
-//
-// MATCHER*() can only be used in a namespace scope. The reason is
-// that C++ doesn't yet allow function-local types to be used to
-// instantiate templates. The up-coming C++0x standard will fix this.
-// Once that's done, we'll consider supporting using MATCHER*() inside
-// a function.
-//
-// More Information
-// ================
-//
-// To learn more about using these macros, please search for 'MATCHER'
-// on http://code.google.com/p/googlemock/wiki/CookBook.
-
-#define MATCHER(name, description)\
- class name##Matcher {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- public:\
- gmock_Impl()\
- {}\
- virtual bool MatchAndExplain(\
- arg_type arg, ::testing::MatchResultListener* result_listener) const;\
- virtual void DescribeTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(false);\
- }\
- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(true);\
- }\
- private:\
- ::testing::internal::string FormatDescription(bool negation) const {\
- const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
- return gmock_description;\
- return ::testing::internal::FormatMatcherDescription(\
- negation, #name, \
- ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
- ::std::tr1::tuple<>()));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>());\
- }\
- name##Matcher() {\
- }\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##Matcher);\
- };\
- inline name##Matcher name() {\
- return name##Matcher();\
- }\
- template <typename arg_type>\
- bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P(name, p0, description)\
- template <typename p0##_type>\
- class name##MatcherP {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- public:\
- explicit gmock_Impl(p0##_type gmock_p0)\
- : p0(gmock_p0) {}\
- virtual bool MatchAndExplain(\
- arg_type arg, ::testing::MatchResultListener* result_listener) const;\
- virtual void DescribeTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(false);\
- }\
- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(true);\
- }\
- p0##_type p0;\
- private:\
- ::testing::internal::string FormatDescription(bool negation) const {\
- const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
- return gmock_description;\
- return ::testing::internal::FormatMatcherDescription(\
- negation, #name, \
- ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
- ::std::tr1::tuple<p0##_type>(p0)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(p0));\
- }\
- name##MatcherP(p0##_type gmock_p0) : p0(gmock_p0) {\
- }\
- p0##_type p0;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##MatcherP);\
- };\
- template <typename p0##_type>\
- inline name##MatcherP<p0##_type> name(p0##_type p0) {\
- return name##MatcherP<p0##_type>(p0);\
- }\
- template <typename p0##_type>\
- template <typename arg_type>\
- bool name##MatcherP<p0##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P2(name, p0, p1, description)\
- template <typename p0##_type, typename p1##_type>\
- class name##MatcherP2 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- public:\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\
- : p0(gmock_p0), p1(gmock_p1) {}\
- virtual bool MatchAndExplain(\
- arg_type arg, ::testing::MatchResultListener* result_listener) const;\
- virtual void DescribeTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(false);\
- }\
- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(true);\
- }\
- p0##_type p0;\
- p1##_type p1;\
- private:\
- ::testing::internal::string FormatDescription(bool negation) const {\
- const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
- return gmock_description;\
- return ::testing::internal::FormatMatcherDescription(\
- negation, #name, \
- ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
- ::std::tr1::tuple<p0##_type, p1##_type>(p0, p1)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(p0, p1));\
- }\
- name##MatcherP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
- p1(gmock_p1) {\
- }\
- p0##_type p0;\
- p1##_type p1;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##MatcherP2);\
- };\
- template <typename p0##_type, typename p1##_type>\
- inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \
- p1##_type p1) {\
- return name##MatcherP2<p0##_type, p1##_type>(p0, p1);\
- }\
- template <typename p0##_type, typename p1##_type>\
- template <typename arg_type>\
- bool name##MatcherP2<p0##_type, \
- p1##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P3(name, p0, p1, p2, description)\
- template <typename p0##_type, typename p1##_type, typename p2##_type>\
- class name##MatcherP3 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- public:\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\
- : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\
- virtual bool MatchAndExplain(\
- arg_type arg, ::testing::MatchResultListener* result_listener) const;\
- virtual void DescribeTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(false);\
- }\
- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(true);\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- private:\
- ::testing::internal::string FormatDescription(bool negation) const {\
- const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
- return gmock_description;\
- return ::testing::internal::FormatMatcherDescription(\
- negation, #name, \
- ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
- ::std::tr1::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \
- p2)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(p0, p1, p2));\
- }\
- name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##MatcherP3);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type>\
- inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
- p1##_type p1, p2##_type p2) {\
- return name##MatcherP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type>\
- template <typename arg_type>\
- bool name##MatcherP3<p0##_type, p1##_type, \
- p2##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P4(name, p0, p1, p2, p3, description)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type>\
- class name##MatcherP4 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- public:\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3)\
- : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3) {}\
- virtual bool MatchAndExplain(\
- arg_type arg, ::testing::MatchResultListener* result_listener) const;\
- virtual void DescribeTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(false);\
- }\
- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(true);\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- private:\
- ::testing::internal::string FormatDescription(bool negation) const {\
- const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
- return gmock_description;\
- return ::testing::internal::FormatMatcherDescription(\
- negation, #name, \
- ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
- ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, \
- p3##_type>(p0, p1, p2, p3)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(p0, p1, p2, p3));\
- }\
- name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \
- p2(gmock_p2), p3(gmock_p3) {\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##MatcherP4);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type>\
- inline name##MatcherP4<p0##_type, p1##_type, p2##_type, \
- p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
- p3##_type p3) {\
- return name##MatcherP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, \
- p1, p2, p3);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type>\
- template <typename arg_type>\
- bool name##MatcherP4<p0##_type, p1##_type, p2##_type, \
- p3##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P5(name, p0, p1, p2, p3, p4, description)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type>\
- class name##MatcherP5 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- public:\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4)\
- : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
- p4(gmock_p4) {}\
- virtual bool MatchAndExplain(\
- arg_type arg, ::testing::MatchResultListener* result_listener) const;\
- virtual void DescribeTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(false);\
- }\
- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(true);\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- private:\
- ::testing::internal::string FormatDescription(bool negation) const {\
- const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
- return gmock_description;\
- return ::testing::internal::FormatMatcherDescription(\
- negation, #name, \
- ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
- ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type>(p0, p1, p2, p3, p4)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(p0, p1, p2, p3, p4));\
- }\
- name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2, p3##_type gmock_p3, \
- p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4) {\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##MatcherP5);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type>\
- inline name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
- p4##_type p4) {\
- return name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type>(p0, p1, p2, p3, p4);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type>\
- template <typename arg_type>\
- bool name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type>\
- class name##MatcherP6 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- public:\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5)\
- : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
- p4(gmock_p4), p5(gmock_p5) {}\
- virtual bool MatchAndExplain(\
- arg_type arg, ::testing::MatchResultListener* result_listener) const;\
- virtual void DescribeTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(false);\
- }\
- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(true);\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- private:\
- ::testing::internal::string FormatDescription(bool negation) const {\
- const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
- return gmock_description;\
- return ::testing::internal::FormatMatcherDescription(\
- negation, #name, \
- ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
- ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5));\
- }\
- name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
- p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##MatcherP6);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type>\
- inline name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
- p3##_type p3, p4##_type p4, p5##_type p5) {\
- return name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type>\
- template <typename arg_type>\
- bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type>\
- class name##MatcherP7 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- public:\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
- p6##_type gmock_p6)\
- : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
- p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\
- virtual bool MatchAndExplain(\
- arg_type arg, ::testing::MatchResultListener* result_listener) const;\
- virtual void DescribeTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(false);\
- }\
- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(true);\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- private:\
- ::testing::internal::string FormatDescription(bool negation) const {\
- const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
- return gmock_description;\
- return ::testing::internal::FormatMatcherDescription(\
- negation, #name, \
- ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
- ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \
- p6)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6));\
- }\
- name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
- p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \
- p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \
- p6(gmock_p6) {\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##MatcherP7);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type>\
- inline name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \
- p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
- p6##_type p6) {\
- return name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type>\
- template <typename arg_type>\
- bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type>\
- class name##MatcherP8 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- public:\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
- p6##_type gmock_p6, p7##_type gmock_p7)\
- : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
- p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\
- virtual bool MatchAndExplain(\
- arg_type arg, ::testing::MatchResultListener* result_listener) const;\
- virtual void DescribeTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(false);\
- }\
- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(true);\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- p7##_type p7;\
- private:\
- ::testing::internal::string FormatDescription(bool negation) const {\
- const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
- return gmock_description;\
- return ::testing::internal::FormatMatcherDescription(\
- negation, #name, \
- ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
- ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \
- p3, p4, p5, p6, p7)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7));\
- }\
- name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
- p5##_type gmock_p5, p6##_type gmock_p6, \
- p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
- p7(gmock_p7) {\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- p7##_type p7;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##MatcherP8);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type>\
- inline name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \
- p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
- p6##_type p6, p7##_type p7) {\
- return name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
- p6, p7);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type>\
- template <typename arg_type>\
- bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type, \
- p7##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type, typename p8##_type>\
- class name##MatcherP9 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- public:\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
- p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\
- : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
- p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
- p8(gmock_p8) {}\
- virtual bool MatchAndExplain(\
- arg_type arg, ::testing::MatchResultListener* result_listener) const;\
- virtual void DescribeTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(false);\
- }\
- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(true);\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- p7##_type p7;\
- p8##_type p8;\
- private:\
- ::testing::internal::string FormatDescription(bool negation) const {\
- const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
- return gmock_description;\
- return ::testing::internal::FormatMatcherDescription(\
- negation, #name, \
- ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
- ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, \
- p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8));\
- }\
- name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
- p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
- p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
- p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
- p8(gmock_p8) {\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- p7##_type p7;\
- p8##_type p8;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##MatcherP9);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type, typename p8##_type>\
- inline name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, \
- p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
- p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \
- p8##_type p8) {\
- return name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
- p3, p4, p5, p6, p7, p8);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type, typename p8##_type>\
- template <typename arg_type>\
- bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type, p7##_type, \
- p8##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, description)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type, typename p8##_type, \
- typename p9##_type>\
- class name##MatcherP10 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- public:\
- gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
- p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
- p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
- p9##_type gmock_p9)\
- : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
- p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
- p8(gmock_p8), p9(gmock_p9) {}\
- virtual bool MatchAndExplain(\
- arg_type arg, ::testing::MatchResultListener* result_listener) const;\
- virtual void DescribeTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(false);\
- }\
- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(true);\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- p7##_type p7;\
- p8##_type p8;\
- p9##_type p9;\
- private:\
- ::testing::internal::string FormatDescription(bool negation) const {\
- const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
- return gmock_description;\
- return ::testing::internal::FormatMatcherDescription(\
- negation, #name, \
- ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
- ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
- p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9));\
- }\
- name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \
- p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
- p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
- p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \
- p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
- p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- p4##_type p4;\
- p5##_type p5;\
- p6##_type p6;\
- p7##_type p7;\
- p8##_type p8;\
- p9##_type p9;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##MatcherP10);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type, typename p8##_type, \
- typename p9##_type>\
- inline name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
- p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
- p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
- p9##_type p9) {\
- return name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
- p1, p2, p3, p4, p5, p6, p7, p8, p9);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type, typename p8##_type, \
- typename p9##_type>\
- template <typename arg_type>\
- bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
- p9##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-matchers.h.pump b/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-matchers.h.pump
deleted file mode 100644
index af02acb..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-matchers.h.pump
+++ /dev/null
@@ -1,674 +0,0 @@
-$$ -*- mode: c++; -*-
-$$ This is a Pump source file. Please use Pump to convert it to
-$$ gmock-generated-actions.h.
-$$
-$var n = 10 $$ The maximum arity we support.
-$$ }} This line fixes auto-indentation of the following code in Emacs.
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some commonly used variadic matchers.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
-
-#include <iterator>
-#include <sstream>
-#include <string>
-#include <vector>
-#include "gmock/gmock-matchers.h"
-
-namespace testing {
-namespace internal {
-
-$range i 0..n-1
-
-// The type of the i-th (0-based) field of Tuple.
-#define GMOCK_FIELD_TYPE_(Tuple, i) \
- typename ::std::tr1::tuple_element<i, Tuple>::type
-
-// TupleFields<Tuple, k0, ..., kn> is for selecting fields from a
-// tuple of type Tuple. It has two members:
-//
-// type: a tuple type whose i-th field is the ki-th field of Tuple.
-// GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple.
-//
-// For example, in class TupleFields<tuple<bool, char, int>, 2, 0>, we have:
-//
-// type is tuple<int, bool>, and
-// GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true).
-
-template <class Tuple$for i [[, int k$i = -1]]>
-class TupleFields;
-
-// This generic version is used when there are $n selectors.
-template <class Tuple$for i [[, int k$i]]>
-class TupleFields {
- public:
- typedef ::std::tr1::tuple<$for i, [[GMOCK_FIELD_TYPE_(Tuple, k$i)]]> type;
- static type GetSelectedFields(const Tuple& t) {
- using ::std::tr1::get;
- return type($for i, [[get<k$i>(t)]]);
- }
-};
-
-// The following specialization is used for 0 ~ $(n-1) selectors.
-
-$for i [[
-$$ }}}
-$range j 0..i-1
-$range k 0..n-1
-
-template <class Tuple$for j [[, int k$j]]>
-class TupleFields<Tuple, $for k, [[$if k < i [[k$k]] $else [[-1]]]]> {
- public:
- typedef ::std::tr1::tuple<$for j, [[GMOCK_FIELD_TYPE_(Tuple, k$j)]]> type;
- static type GetSelectedFields(const Tuple& $if i==0 [[/* t */]] $else [[t]]) {
- using ::std::tr1::get;
- return type($for j, [[get<k$j>(t)]]);
- }
-};
-
-]]
-
-#undef GMOCK_FIELD_TYPE_
-
-// Implements the Args() matcher.
-
-$var ks = [[$for i, [[k$i]]]]
-template <class ArgsTuple$for i [[, int k$i = -1]]>
-class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> {
- public:
- // ArgsTuple may have top-level const or reference modifiers.
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple;
- typedef typename internal::TupleFields<RawArgsTuple, $ks>::type SelectedArgs;
- typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher;
-
- template <typename InnerMatcher>
- explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher)
- : inner_matcher_(SafeMatcherCast<const SelectedArgs&>(inner_matcher)) {}
-
- virtual bool MatchAndExplain(ArgsTuple args,
- MatchResultListener* listener) const {
- const SelectedArgs& selected_args = GetSelectedArgs(args);
- if (!listener->IsInterested())
- return inner_matcher_.Matches(selected_args);
-
- PrintIndices(listener->stream());
- *listener << "are " << PrintToString(selected_args);
-
- StringMatchResultListener inner_listener;
- const bool match = inner_matcher_.MatchAndExplain(selected_args,
- &inner_listener);
- PrintIfNotEmpty(inner_listener.str(), listener->stream());
- return match;
- }
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "are a tuple ";
- PrintIndices(os);
- inner_matcher_.DescribeTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "are a tuple ";
- PrintIndices(os);
- inner_matcher_.DescribeNegationTo(os);
- }
-
- private:
- static SelectedArgs GetSelectedArgs(ArgsTuple args) {
- return TupleFields<RawArgsTuple, $ks>::GetSelectedFields(args);
- }
-
- // Prints the indices of the selected fields.
- static void PrintIndices(::std::ostream* os) {
- *os << "whose fields (";
- const int indices[$n] = { $ks };
- for (int i = 0; i < $n; i++) {
- if (indices[i] < 0)
- break;
-
- if (i >= 1)
- *os << ", ";
-
- *os << "#" << indices[i];
- }
- *os << ") ";
- }
-
- const MonomorphicInnerMatcher inner_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(ArgsMatcherImpl);
-};
-
-template <class InnerMatcher$for i [[, int k$i = -1]]>
-class ArgsMatcher {
- public:
- explicit ArgsMatcher(const InnerMatcher& inner_matcher)
- : inner_matcher_(inner_matcher) {}
-
- template <typename ArgsTuple>
- operator Matcher<ArgsTuple>() const {
- return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, $ks>(inner_matcher_));
- }
-
- private:
- const InnerMatcher inner_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(ArgsMatcher);
-};
-
-// A set of metafunctions for computing the result type of AllOf.
-// AllOf(m1, ..., mN) returns
-// AllOfResultN<decltype(m1), ..., decltype(mN)>::type.
-
-// Although AllOf isn't defined for one argument, AllOfResult1 is defined
-// to simplify the implementation.
-template <typename M1>
-struct AllOfResult1 {
- typedef M1 type;
-};
-
-$range i 1..n
-
-$range i 2..n
-$for i [[
-$range j 2..i
-$var m = i/2
-$range k 1..m
-$range t m+1..i
-
-template <typename M1$for j [[, typename M$j]]>
-struct AllOfResult$i {
- typedef BothOfMatcher<
- typename AllOfResult$m<$for k, [[M$k]]>::type,
- typename AllOfResult$(i-m)<$for t, [[M$t]]>::type
- > type;
-};
-
-]]
-
-// A set of metafunctions for computing the result type of AnyOf.
-// AnyOf(m1, ..., mN) returns
-// AnyOfResultN<decltype(m1), ..., decltype(mN)>::type.
-
-// Although AnyOf isn't defined for one argument, AnyOfResult1 is defined
-// to simplify the implementation.
-template <typename M1>
-struct AnyOfResult1 {
- typedef M1 type;
-};
-
-$range i 1..n
-
-$range i 2..n
-$for i [[
-$range j 2..i
-$var m = i/2
-$range k 1..m
-$range t m+1..i
-
-template <typename M1$for j [[, typename M$j]]>
-struct AnyOfResult$i {
- typedef EitherOfMatcher<
- typename AnyOfResult$m<$for k, [[M$k]]>::type,
- typename AnyOfResult$(i-m)<$for t, [[M$t]]>::type
- > type;
-};
-
-]]
-
-} // namespace internal
-
-// Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected
-// fields of it matches a_matcher. C++ doesn't support default
-// arguments for function templates, so we have to overload it.
-
-$range i 0..n
-$for i [[
-$range j 1..i
-template <$for j [[int k$j, ]]typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher$for j [[, k$j]]>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher$for j [[, k$j]]>(matcher);
-}
-
-
-]]
-// ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with
-// n elements, where the i-th element in the container must
-// match the i-th argument in the list. Each argument of
-// ElementsAre() can be either a value or a matcher. We support up to
-// $n arguments.
-//
-// The use of DecayArray in the implementation allows ElementsAre()
-// to accept string literals, whose type is const char[N], but we
-// want to treat them as const char*.
-//
-// NOTE: Since ElementsAre() cares about the order of the elements, it
-// must not be used with containers whose elements's order is
-// undefined (e.g. hash_map).
-
-$range i 0..n
-$for i [[
-
-$range j 1..i
-
-$if i>0 [[
-
-template <$for j, [[typename T$j]]>
-]]
-
-inline internal::ElementsAreMatcher<
- std::tr1::tuple<
-$for j, [[
-
- typename internal::DecayArray<T$j[[]]>::type]]> >
-ElementsAre($for j, [[const T$j& e$j]]) {
- typedef std::tr1::tuple<
-$for j, [[
-
- typename internal::DecayArray<T$j[[]]>::type]]> Args;
- return internal::ElementsAreMatcher<Args>(Args($for j, [[e$j]]));
-}
-
-]]
-
-// UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension
-// that matches n elements in any order. We support up to n=$n arguments.
-
-$range i 0..n
-$for i [[
-
-$range j 1..i
-
-$if i>0 [[
-
-template <$for j, [[typename T$j]]>
-]]
-
-inline internal::UnorderedElementsAreMatcher<
- std::tr1::tuple<
-$for j, [[
-
- typename internal::DecayArray<T$j[[]]>::type]]> >
-UnorderedElementsAre($for j, [[const T$j& e$j]]) {
- typedef std::tr1::tuple<
-$for j, [[
-
- typename internal::DecayArray<T$j[[]]>::type]]> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args($for j, [[e$j]]));
-}
-
-]]
-
-// AllOf(m1, m2, ..., mk) matches any value that matches all of the given
-// sub-matchers. AllOf is called fully qualified to prevent ADL from firing.
-
-$range i 2..n
-$for i [[
-$range j 1..i
-$var m = i/2
-$range k 1..m
-$range t m+1..i
-
-template <$for j, [[typename M$j]]>
-inline typename internal::AllOfResult$i<$for j, [[M$j]]>::type
-AllOf($for j, [[M$j m$j]]) {
- return typename internal::AllOfResult$i<$for j, [[M$j]]>::type(
- $if m == 1 [[m1]] $else [[::testing::AllOf($for k, [[m$k]])]],
- $if m+1 == i [[m$i]] $else [[::testing::AllOf($for t, [[m$t]])]]);
-}
-
-]]
-
-// AnyOf(m1, m2, ..., mk) matches any value that matches any of the given
-// sub-matchers. AnyOf is called fully qualified to prevent ADL from firing.
-
-$range i 2..n
-$for i [[
-$range j 1..i
-$var m = i/2
-$range k 1..m
-$range t m+1..i
-
-template <$for j, [[typename M$j]]>
-inline typename internal::AnyOfResult$i<$for j, [[M$j]]>::type
-AnyOf($for j, [[M$j m$j]]) {
- return typename internal::AnyOfResult$i<$for j, [[M$j]]>::type(
- $if m == 1 [[m1]] $else [[::testing::AnyOf($for k, [[m$k]])]],
- $if m+1 == i [[m$i]] $else [[::testing::AnyOf($for t, [[m$t]])]]);
-}
-
-]]
-
-} // namespace testing
-$$ } // This Pump meta comment fixes auto-indentation in Emacs. It will not
-$$ // show up in the generated code.
-
-
-// The MATCHER* family of macros can be used in a namespace scope to
-// define custom matchers easily.
-//
-// Basic Usage
-// ===========
-//
-// The syntax
-//
-// MATCHER(name, description_string) { statements; }
-//
-// defines a matcher with the given name that executes the statements,
-// which must return a bool to indicate if the match succeeds. Inside
-// the statements, you can refer to the value being matched by 'arg',
-// and refer to its type by 'arg_type'.
-//
-// The description string documents what the matcher does, and is used
-// to generate the failure message when the match fails. Since a
-// MATCHER() is usually defined in a header file shared by multiple
-// C++ source files, we require the description to be a C-string
-// literal to avoid possible side effects. It can be empty, in which
-// case we'll use the sequence of words in the matcher name as the
-// description.
-//
-// For example:
-//
-// MATCHER(IsEven, "") { return (arg % 2) == 0; }
-//
-// allows you to write
-//
-// // Expects mock_foo.Bar(n) to be called where n is even.
-// EXPECT_CALL(mock_foo, Bar(IsEven()));
-//
-// or,
-//
-// // Verifies that the value of some_expression is even.
-// EXPECT_THAT(some_expression, IsEven());
-//
-// If the above assertion fails, it will print something like:
-//
-// Value of: some_expression
-// Expected: is even
-// Actual: 7
-//
-// where the description "is even" is automatically calculated from the
-// matcher name IsEven.
-//
-// Argument Type
-// =============
-//
-// Note that the type of the value being matched (arg_type) is
-// determined by the context in which you use the matcher and is
-// supplied to you by the compiler, so you don't need to worry about
-// declaring it (nor can you). This allows the matcher to be
-// polymorphic. For example, IsEven() can be used to match any type
-// where the value of "(arg % 2) == 0" can be implicitly converted to
-// a bool. In the "Bar(IsEven())" example above, if method Bar()
-// takes an int, 'arg_type' will be int; if it takes an unsigned long,
-// 'arg_type' will be unsigned long; and so on.
-//
-// Parameterizing Matchers
-// =======================
-//
-// Sometimes you'll want to parameterize the matcher. For that you
-// can use another macro:
-//
-// MATCHER_P(name, param_name, description_string) { statements; }
-//
-// For example:
-//
-// MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; }
-//
-// will allow you to write:
-//
-// EXPECT_THAT(Blah("a"), HasAbsoluteValue(n));
-//
-// which may lead to this message (assuming n is 10):
-//
-// Value of: Blah("a")
-// Expected: has absolute value 10
-// Actual: -9
-//
-// Note that both the matcher description and its parameter are
-// printed, making the message human-friendly.
-//
-// In the matcher definition body, you can write 'foo_type' to
-// reference the type of a parameter named 'foo'. For example, in the
-// body of MATCHER_P(HasAbsoluteValue, value) above, you can write
-// 'value_type' to refer to the type of 'value'.
-//
-// We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P$n to
-// support multi-parameter matchers.
-//
-// Describing Parameterized Matchers
-// =================================
-//
-// The last argument to MATCHER*() is a string-typed expression. The
-// expression can reference all of the matcher's parameters and a
-// special bool-typed variable named 'negation'. When 'negation' is
-// false, the expression should evaluate to the matcher's description;
-// otherwise it should evaluate to the description of the negation of
-// the matcher. For example,
-//
-// using testing::PrintToString;
-//
-// MATCHER_P2(InClosedRange, low, hi,
-// string(negation ? "is not" : "is") + " in range [" +
-// PrintToString(low) + ", " + PrintToString(hi) + "]") {
-// return low <= arg && arg <= hi;
-// }
-// ...
-// EXPECT_THAT(3, InClosedRange(4, 6));
-// EXPECT_THAT(3, Not(InClosedRange(2, 4)));
-//
-// would generate two failures that contain the text:
-//
-// Expected: is in range [4, 6]
-// ...
-// Expected: is not in range [2, 4]
-//
-// If you specify "" as the description, the failure message will
-// contain the sequence of words in the matcher name followed by the
-// parameter values printed as a tuple. For example,
-//
-// MATCHER_P2(InClosedRange, low, hi, "") { ... }
-// ...
-// EXPECT_THAT(3, InClosedRange(4, 6));
-// EXPECT_THAT(3, Not(InClosedRange(2, 4)));
-//
-// would generate two failures that contain the text:
-//
-// Expected: in closed range (4, 6)
-// ...
-// Expected: not (in closed range (2, 4))
-//
-// Types of Matcher Parameters
-// ===========================
-//
-// For the purpose of typing, you can view
-//
-// MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... }
-//
-// as shorthand for
-//
-// template <typename p1_type, ..., typename pk_type>
-// FooMatcherPk<p1_type, ..., pk_type>
-// Foo(p1_type p1, ..., pk_type pk) { ... }
-//
-// When you write Foo(v1, ..., vk), the compiler infers the types of
-// the parameters v1, ..., and vk for you. If you are not happy with
-// the result of the type inference, you can specify the types by
-// explicitly instantiating the template, as in Foo<long, bool>(5,
-// false). As said earlier, you don't get to (or need to) specify
-// 'arg_type' as that's determined by the context in which the matcher
-// is used. You can assign the result of expression Foo(p1, ..., pk)
-// to a variable of type FooMatcherPk<p1_type, ..., pk_type>. This
-// can be useful when composing matchers.
-//
-// While you can instantiate a matcher template with reference types,
-// passing the parameters by pointer usually makes your code more
-// readable. If, however, you still want to pass a parameter by
-// reference, be aware that in the failure message generated by the
-// matcher you will see the value of the referenced object but not its
-// address.
-//
-// Explaining Match Results
-// ========================
-//
-// Sometimes the matcher description alone isn't enough to explain why
-// the match has failed or succeeded. For example, when expecting a
-// long string, it can be very helpful to also print the diff between
-// the expected string and the actual one. To achieve that, you can
-// optionally stream additional information to a special variable
-// named result_listener, whose type is a pointer to class
-// MatchResultListener:
-//
-// MATCHER_P(EqualsLongString, str, "") {
-// if (arg == str) return true;
-//
-// *result_listener << "the difference: "
-/// << DiffStrings(str, arg);
-// return false;
-// }
-//
-// Overloading Matchers
-// ====================
-//
-// You can overload matchers with different numbers of parameters:
-//
-// MATCHER_P(Blah, a, description_string1) { ... }
-// MATCHER_P2(Blah, a, b, description_string2) { ... }
-//
-// Caveats
-// =======
-//
-// When defining a new matcher, you should also consider implementing
-// MatcherInterface or using MakePolymorphicMatcher(). These
-// approaches require more work than the MATCHER* macros, but also
-// give you more control on the types of the value being matched and
-// the matcher parameters, which may leads to better compiler error
-// messages when the matcher is used wrong. They also allow
-// overloading matchers based on parameter types (as opposed to just
-// based on the number of parameters).
-//
-// MATCHER*() can only be used in a namespace scope. The reason is
-// that C++ doesn't yet allow function-local types to be used to
-// instantiate templates. The up-coming C++0x standard will fix this.
-// Once that's done, we'll consider supporting using MATCHER*() inside
-// a function.
-//
-// More Information
-// ================
-//
-// To learn more about using these macros, please search for 'MATCHER'
-// on http://code.google.com/p/googlemock/wiki/CookBook.
-
-$range i 0..n
-$for i
-
-[[
-$var macro_name = [[$if i==0 [[MATCHER]] $elif i==1 [[MATCHER_P]]
- $else [[MATCHER_P$i]]]]
-$var class_name = [[name##Matcher[[$if i==0 [[]] $elif i==1 [[P]]
- $else [[P$i]]]]]]
-$range j 0..i-1
-$var template = [[$if i==0 [[]] $else [[
-
- template <$for j, [[typename p$j##_type]]>\
-]]]]
-$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]]
-$var impl_ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]]
-$var impl_inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]]
-$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]]
-$var params = [[$for j, [[p$j]]]]
-$var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]]
-$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]]
-$var param_field_decls = [[$for j
-[[
-
- p$j##_type p$j;\
-]]]]
-$var param_field_decls2 = [[$for j
-[[
-
- p$j##_type p$j;\
-]]]]
-
-#define $macro_name(name$for j [[, p$j]], description)\$template
- class $class_name {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- public:\
- [[$if i==1 [[explicit ]]]]gmock_Impl($impl_ctor_param_list)\
- $impl_inits {}\
- virtual bool MatchAndExplain(\
- arg_type arg, ::testing::MatchResultListener* result_listener) const;\
- virtual void DescribeTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(false);\
- }\
- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
- *gmock_os << FormatDescription(true);\
- }\$param_field_decls
- private:\
- ::testing::internal::string FormatDescription(bool negation) const {\
- const ::testing::internal::string gmock_description = (description);\
- if (!gmock_description.empty())\
- return gmock_description;\
- return ::testing::internal::FormatMatcherDescription(\
- negation, #name, \
- ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
- ::std::tr1::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>($params));\
- }\
- $class_name($ctor_param_list)$inits {\
- }\$param_field_decls2
- private:\
- GTEST_DISALLOW_ASSIGN_($class_name);\
- };\$template
- inline $class_name$param_types name($param_types_and_names) {\
- return $class_name$param_types($params);\
- }\$template
- template <typename arg_type>\
- bool $class_name$param_types::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-]]
-
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-nice-strict.h b/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-nice-strict.h
deleted file mode 100644
index 4095f4d..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-nice-strict.h
+++ /dev/null
@@ -1,397 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gmock-generated-nice-strict.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Implements class templates NiceMock, NaggyMock, and StrictMock.
-//
-// Given a mock class MockFoo that is created using Google Mock,
-// NiceMock<MockFoo> is a subclass of MockFoo that allows
-// uninteresting calls (i.e. calls to mock methods that have no
-// EXPECT_CALL specs), NaggyMock<MockFoo> is a subclass of MockFoo
-// that prints a warning when an uninteresting call occurs, and
-// StrictMock<MockFoo> is a subclass of MockFoo that treats all
-// uninteresting calls as errors.
-//
-// Currently a mock is naggy by default, so MockFoo and
-// NaggyMock<MockFoo> behave like the same. However, we will soon
-// switch the default behavior of mocks to be nice, as that in general
-// leads to more maintainable tests. When that happens, MockFoo will
-// stop behaving like NaggyMock<MockFoo> and start behaving like
-// NiceMock<MockFoo>.
-//
-// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of
-// their respective base class, with up-to 10 arguments. Therefore
-// you can write NiceMock<MockFoo>(5, "a") to construct a nice mock
-// where MockFoo has a constructor that accepts (int, const char*),
-// for example.
-//
-// A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>,
-// and StrictMock<MockFoo> only works for mock methods defined using
-// the MOCK_METHOD* family of macros DIRECTLY in the MockFoo class.
-// If a mock method is defined in a base class of MockFoo, the "nice"
-// or "strict" modifier may not affect it, depending on the compiler.
-// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT
-// supported.
-//
-// Another known limitation is that the constructors of the base mock
-// cannot have arguments passed by non-const reference, which are
-// banned by the Google C++ style guide anyway.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
-
-#include "gmock/gmock-spec-builders.h"
-#include "gmock/internal/gmock-port.h"
-
-namespace testing {
-
-template <class MockClass>
-class NiceMock : public MockClass {
- public:
- // We don't factor out the constructor body to a common method, as
- // we have to avoid a possible clash with members of MockClass.
- NiceMock() {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- // C++ doesn't (yet) allow inheritance of constructors, so we have
- // to define it for each arity.
- template <typename A1>
- explicit NiceMock(const A1& a1) : MockClass(a1) {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
- template <typename A1, typename A2>
- NiceMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3>
- NiceMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4>
- NiceMock(const A1& a1, const A2& a2, const A3& a3,
- const A4& a4) : MockClass(a1, a2, a3, a4) {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5>
- NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5) : MockClass(a1, a2, a3, a4, a5) {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6>
- NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7>
- NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5,
- a6, a7) {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8>
- NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1,
- a2, a3, a4, a5, a6, a7, a8) {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9>
- NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6, const A7& a7, const A8& a8,
- const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9, typename A10>
- NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9,
- const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- virtual ~NiceMock() {
- ::testing::Mock::UnregisterCallReaction(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock);
-};
-
-template <class MockClass>
-class NaggyMock : public MockClass {
- public:
- // We don't factor out the constructor body to a common method, as
- // we have to avoid a possible clash with members of MockClass.
- NaggyMock() {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- // C++ doesn't (yet) allow inheritance of constructors, so we have
- // to define it for each arity.
- template <typename A1>
- explicit NaggyMock(const A1& a1) : MockClass(a1) {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
- template <typename A1, typename A2>
- NaggyMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3>
- NaggyMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4>
- NaggyMock(const A1& a1, const A2& a2, const A3& a3,
- const A4& a4) : MockClass(a1, a2, a3, a4) {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5>
- NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5) : MockClass(a1, a2, a3, a4, a5) {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6>
- NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7>
- NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5,
- a6, a7) {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8>
- NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1,
- a2, a3, a4, a5, a6, a7, a8) {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9>
- NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6, const A7& a7, const A8& a8,
- const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9, typename A10>
- NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9,
- const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- virtual ~NaggyMock() {
- ::testing::Mock::UnregisterCallReaction(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(NaggyMock);
-};
-
-template <class MockClass>
-class StrictMock : public MockClass {
- public:
- // We don't factor out the constructor body to a common method, as
- // we have to avoid a possible clash with members of MockClass.
- StrictMock() {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- // C++ doesn't (yet) allow inheritance of constructors, so we have
- // to define it for each arity.
- template <typename A1>
- explicit StrictMock(const A1& a1) : MockClass(a1) {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
- template <typename A1, typename A2>
- StrictMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3>
- StrictMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4>
- StrictMock(const A1& a1, const A2& a2, const A3& a3,
- const A4& a4) : MockClass(a1, a2, a3, a4) {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5>
- StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5) : MockClass(a1, a2, a3, a4, a5) {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6>
- StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7>
- StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5,
- a6, a7) {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8>
- StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1,
- a2, a3, a4, a5, a6, a7, a8) {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9>
- StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6, const A7& a7, const A8& a8,
- const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9, typename A10>
- StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
- const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9,
- const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- virtual ~StrictMock() {
- ::testing::Mock::UnregisterCallReaction(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(StrictMock);
-};
-
-// The following specializations catch some (relatively more common)
-// user errors of nesting nice and strict mocks. They do NOT catch
-// all possible errors.
-
-// These specializations are declared but not defined, as NiceMock,
-// NaggyMock, and StrictMock cannot be nested.
-
-template <typename MockClass>
-class NiceMock<NiceMock<MockClass> >;
-template <typename MockClass>
-class NiceMock<NaggyMock<MockClass> >;
-template <typename MockClass>
-class NiceMock<StrictMock<MockClass> >;
-
-template <typename MockClass>
-class NaggyMock<NiceMock<MockClass> >;
-template <typename MockClass>
-class NaggyMock<NaggyMock<MockClass> >;
-template <typename MockClass>
-class NaggyMock<StrictMock<MockClass> >;
-
-template <typename MockClass>
-class StrictMock<NiceMock<MockClass> >;
-template <typename MockClass>
-class StrictMock<NaggyMock<MockClass> >;
-template <typename MockClass>
-class StrictMock<StrictMock<MockClass> >;
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-nice-strict.h.pump b/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-nice-strict.h.pump
deleted file mode 100644
index 3ee1ce7..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock-generated-nice-strict.h.pump
+++ /dev/null
@@ -1,161 +0,0 @@
-$$ -*- mode: c++; -*-
-$$ This is a Pump source file. Please use Pump to convert it to
-$$ gmock-generated-nice-strict.h.
-$$
-$var n = 10 $$ The maximum arity we support.
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Implements class templates NiceMock, NaggyMock, and StrictMock.
-//
-// Given a mock class MockFoo that is created using Google Mock,
-// NiceMock<MockFoo> is a subclass of MockFoo that allows
-// uninteresting calls (i.e. calls to mock methods that have no
-// EXPECT_CALL specs), NaggyMock<MockFoo> is a subclass of MockFoo
-// that prints a warning when an uninteresting call occurs, and
-// StrictMock<MockFoo> is a subclass of MockFoo that treats all
-// uninteresting calls as errors.
-//
-// Currently a mock is naggy by default, so MockFoo and
-// NaggyMock<MockFoo> behave like the same. However, we will soon
-// switch the default behavior of mocks to be nice, as that in general
-// leads to more maintainable tests. When that happens, MockFoo will
-// stop behaving like NaggyMock<MockFoo> and start behaving like
-// NiceMock<MockFoo>.
-//
-// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of
-// their respective base class, with up-to $n arguments. Therefore
-// you can write NiceMock<MockFoo>(5, "a") to construct a nice mock
-// where MockFoo has a constructor that accepts (int, const char*),
-// for example.
-//
-// A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>,
-// and StrictMock<MockFoo> only works for mock methods defined using
-// the MOCK_METHOD* family of macros DIRECTLY in the MockFoo class.
-// If a mock method is defined in a base class of MockFoo, the "nice"
-// or "strict" modifier may not affect it, depending on the compiler.
-// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT
-// supported.
-//
-// Another known limitation is that the constructors of the base mock
-// cannot have arguments passed by non-const reference, which are
-// banned by the Google C++ style guide anyway.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
-
-#include "gmock/gmock-spec-builders.h"
-#include "gmock/internal/gmock-port.h"
-
-namespace testing {
-
-$range kind 0..2
-$for kind [[
-
-$var clazz=[[$if kind==0 [[NiceMock]]
- $elif kind==1 [[NaggyMock]]
- $else [[StrictMock]]]]
-
-$var method=[[$if kind==0 [[AllowUninterestingCalls]]
- $elif kind==1 [[WarnUninterestingCalls]]
- $else [[FailUninterestingCalls]]]]
-
-template <class MockClass>
-class $clazz : public MockClass {
- public:
- // We don't factor out the constructor body to a common method, as
- // we have to avoid a possible clash with members of MockClass.
- $clazz() {
- ::testing::Mock::$method(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- // C++ doesn't (yet) allow inheritance of constructors, so we have
- // to define it for each arity.
- template <typename A1>
- explicit $clazz(const A1& a1) : MockClass(a1) {
- ::testing::Mock::$method(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
-$range i 2..n
-$for i [[
-$range j 1..i
- template <$for j, [[typename A$j]]>
- $clazz($for j, [[const A$j& a$j]]) : MockClass($for j, [[a$j]]) {
- ::testing::Mock::$method(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
-
-]]
- virtual ~$clazz() {
- ::testing::Mock::UnregisterCallReaction(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_($clazz);
-};
-
-]]
-
-// The following specializations catch some (relatively more common)
-// user errors of nesting nice and strict mocks. They do NOT catch
-// all possible errors.
-
-// These specializations are declared but not defined, as NiceMock,
-// NaggyMock, and StrictMock cannot be nested.
-
-template <typename MockClass>
-class NiceMock<NiceMock<MockClass> >;
-template <typename MockClass>
-class NiceMock<NaggyMock<MockClass> >;
-template <typename MockClass>
-class NiceMock<StrictMock<MockClass> >;
-
-template <typename MockClass>
-class NaggyMock<NiceMock<MockClass> >;
-template <typename MockClass>
-class NaggyMock<NaggyMock<MockClass> >;
-template <typename MockClass>
-class NaggyMock<StrictMock<MockClass> >;
-
-template <typename MockClass>
-class StrictMock<NiceMock<MockClass> >;
-template <typename MockClass>
-class StrictMock<NaggyMock<MockClass> >;
-template <typename MockClass>
-class StrictMock<StrictMock<MockClass> >;
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock-matchers.h b/third_party/ntcore_2017/gmock/include/gmock/gmock-matchers.h
deleted file mode 100644
index 44055c9..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock-matchers.h
+++ /dev/null
@@ -1,3986 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some commonly used argument matchers. More
-// matchers can be defined by the user implementing the
-// MatcherInterface<T> interface if necessary.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
-
-#include <math.h>
-#include <algorithm>
-#include <iterator>
-#include <limits>
-#include <ostream> // NOLINT
-#include <sstream>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "gmock/internal/gmock-internal-utils.h"
-#include "gmock/internal/gmock-port.h"
-#include "gtest/gtest.h"
-
-#if GTEST_LANG_CXX11
-#include <initializer_list> // NOLINT -- must be after gtest.h
-#endif
-
-namespace testing {
-
-// To implement a matcher Foo for type T, define:
-// 1. a class FooMatcherImpl that implements the
-// MatcherInterface<T> interface, and
-// 2. a factory function that creates a Matcher<T> object from a
-// FooMatcherImpl*.
-//
-// The two-level delegation design makes it possible to allow a user
-// to write "v" instead of "Eq(v)" where a Matcher is expected, which
-// is impossible if we pass matchers by pointers. It also eases
-// ownership management as Matcher objects can now be copied like
-// plain values.
-
-// MatchResultListener is an abstract class. Its << operator can be
-// used by a matcher to explain why a value matches or doesn't match.
-//
-// TODO(wan@google.com): add method
-// bool InterestedInWhy(bool result) const;
-// to indicate whether the listener is interested in why the match
-// result is 'result'.
-class MatchResultListener {
- public:
- // Creates a listener object with the given underlying ostream. The
- // listener does not own the ostream, and does not dereference it
- // in the constructor or destructor.
- explicit MatchResultListener(::std::ostream* os) : stream_(os) {}
- virtual ~MatchResultListener() = 0; // Makes this class abstract.
-
- // Streams x to the underlying ostream; does nothing if the ostream
- // is NULL.
- template <typename T>
- MatchResultListener& operator<<(const T& x) {
- if (stream_ != NULL)
- *stream_ << x;
- return *this;
- }
-
- // Returns the underlying ostream.
- ::std::ostream* stream() { return stream_; }
-
- // Returns true iff the listener is interested in an explanation of
- // the match result. A matcher's MatchAndExplain() method can use
- // this information to avoid generating the explanation when no one
- // intends to hear it.
- bool IsInterested() const { return stream_ != NULL; }
-
- private:
- ::std::ostream* const stream_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener);
-};
-
-inline MatchResultListener::~MatchResultListener() {
-}
-
-// An instance of a subclass of this knows how to describe itself as a
-// matcher.
-class MatcherDescriberInterface {
- public:
- virtual ~MatcherDescriberInterface() {}
-
- // Describes this matcher to an ostream. The function should print
- // a verb phrase that describes the property a value matching this
- // matcher should have. The subject of the verb phrase is the value
- // being matched. For example, the DescribeTo() method of the Gt(7)
- // matcher prints "is greater than 7".
- virtual void DescribeTo(::std::ostream* os) const = 0;
-
- // Describes the negation of this matcher to an ostream. For
- // example, if the description of this matcher is "is greater than
- // 7", the negated description could be "is not greater than 7".
- // You are not required to override this when implementing
- // MatcherInterface, but it is highly advised so that your matcher
- // can produce good error messages.
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "not (";
- DescribeTo(os);
- *os << ")";
- }
-};
-
-// The implementation of a matcher.
-template <typename T>
-class MatcherInterface : public MatcherDescriberInterface {
- public:
- // Returns true iff the matcher matches x; also explains the match
- // result to 'listener' if necessary (see the next paragraph), in
- // the form of a non-restrictive relative clause ("which ...",
- // "whose ...", etc) that describes x. For example, the
- // MatchAndExplain() method of the Pointee(...) matcher should
- // generate an explanation like "which points to ...".
- //
- // Implementations of MatchAndExplain() should add an explanation of
- // the match result *if and only if* they can provide additional
- // information that's not already present (or not obvious) in the
- // print-out of x and the matcher's description. Whether the match
- // succeeds is not a factor in deciding whether an explanation is
- // needed, as sometimes the caller needs to print a failure message
- // when the match succeeds (e.g. when the matcher is used inside
- // Not()).
- //
- // For example, a "has at least 10 elements" matcher should explain
- // what the actual element count is, regardless of the match result,
- // as it is useful information to the reader; on the other hand, an
- // "is empty" matcher probably only needs to explain what the actual
- // size is when the match fails, as it's redundant to say that the
- // size is 0 when the value is already known to be empty.
- //
- // You should override this method when defining a new matcher.
- //
- // It's the responsibility of the caller (Google Mock) to guarantee
- // that 'listener' is not NULL. This helps to simplify a matcher's
- // implementation when it doesn't care about the performance, as it
- // can talk to 'listener' without checking its validity first.
- // However, in order to implement dummy listeners efficiently,
- // listener->stream() may be NULL.
- virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0;
-
- // Inherits these methods from MatcherDescriberInterface:
- // virtual void DescribeTo(::std::ostream* os) const = 0;
- // virtual void DescribeNegationTo(::std::ostream* os) const;
-};
-
-// A match result listener that stores the explanation in a string.
-class StringMatchResultListener : public MatchResultListener {
- public:
- StringMatchResultListener() : MatchResultListener(&ss_) {}
-
- // Returns the explanation accumulated so far.
- internal::string str() const { return ss_.str(); }
-
- // Clears the explanation accumulated so far.
- void Clear() { ss_.str(""); }
-
- private:
- ::std::stringstream ss_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(StringMatchResultListener);
-};
-
-namespace internal {
-
-// A match result listener that ignores the explanation.
-class DummyMatchResultListener : public MatchResultListener {
- public:
- DummyMatchResultListener() : MatchResultListener(NULL) {}
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener);
-};
-
-// A match result listener that forwards the explanation to a given
-// ostream. The difference between this and MatchResultListener is
-// that the former is concrete.
-class StreamMatchResultListener : public MatchResultListener {
- public:
- explicit StreamMatchResultListener(::std::ostream* os)
- : MatchResultListener(os) {}
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener);
-};
-
-// An internal class for implementing Matcher<T>, which will derive
-// from it. We put functionalities common to all Matcher<T>
-// specializations here to avoid code duplication.
-template <typename T>
-class MatcherBase {
- public:
- // Returns true iff the matcher matches x; also explains the match
- // result to 'listener'.
- bool MatchAndExplain(T x, MatchResultListener* listener) const {
- return impl_->MatchAndExplain(x, listener);
- }
-
- // Returns true iff this matcher matches x.
- bool Matches(T x) const {
- DummyMatchResultListener dummy;
- return MatchAndExplain(x, &dummy);
- }
-
- // Describes this matcher to an ostream.
- void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); }
-
- // Describes the negation of this matcher to an ostream.
- void DescribeNegationTo(::std::ostream* os) const {
- impl_->DescribeNegationTo(os);
- }
-
- // Explains why x matches, or doesn't match, the matcher.
- void ExplainMatchResultTo(T x, ::std::ostream* os) const {
- StreamMatchResultListener listener(os);
- MatchAndExplain(x, &listener);
- }
-
- // Returns the describer for this matcher object; retains ownership
- // of the describer, which is only guaranteed to be alive when
- // this matcher object is alive.
- const MatcherDescriberInterface* GetDescriber() const {
- return impl_.get();
- }
-
- protected:
- MatcherBase() {}
-
- // Constructs a matcher from its implementation.
- explicit MatcherBase(const MatcherInterface<T>* impl)
- : impl_(impl) {}
-
- virtual ~MatcherBase() {}
-
- private:
- // shared_ptr (util/gtl/shared_ptr.h) and linked_ptr have similar
- // interfaces. The former dynamically allocates a chunk of memory
- // to hold the reference count, while the latter tracks all
- // references using a circular linked list without allocating
- // memory. It has been observed that linked_ptr performs better in
- // typical scenarios. However, shared_ptr can out-perform
- // linked_ptr when there are many more uses of the copy constructor
- // than the default constructor.
- //
- // If performance becomes a problem, we should see if using
- // shared_ptr helps.
- ::testing::internal::linked_ptr<const MatcherInterface<T> > impl_;
-};
-
-} // namespace internal
-
-// A Matcher<T> is a copyable and IMMUTABLE (except by assignment)
-// object that can check whether a value of type T matches. The
-// implementation of Matcher<T> is just a linked_ptr to const
-// MatcherInterface<T>, so copying is fairly cheap. Don't inherit
-// from Matcher!
-template <typename T>
-class Matcher : public internal::MatcherBase<T> {
- public:
- // Constructs a null matcher. Needed for storing Matcher objects in STL
- // containers. A default-constructed matcher is not yet initialized. You
- // cannot use it until a valid value has been assigned to it.
- Matcher() {}
-
- // Constructs a matcher from its implementation.
- explicit Matcher(const MatcherInterface<T>* impl)
- : internal::MatcherBase<T>(impl) {}
-
- // Implicit constructor here allows people to write
- // EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes
- Matcher(T value); // NOLINT
-};
-
-// The following two specializations allow the user to write str
-// instead of Eq(str) and "foo" instead of Eq("foo") when a string
-// matcher is expected.
-template <>
-class GTEST_API_ Matcher<const internal::string&>
- : public internal::MatcherBase<const internal::string&> {
- public:
- Matcher() {}
-
- explicit Matcher(const MatcherInterface<const internal::string&>* impl)
- : internal::MatcherBase<const internal::string&>(impl) {}
-
- // Allows the user to write str instead of Eq(str) sometimes, where
- // str is a string object.
- Matcher(const internal::string& s); // NOLINT
-
- // Allows the user to write "foo" instead of Eq("foo") sometimes.
- Matcher(const char* s); // NOLINT
-};
-
-template <>
-class GTEST_API_ Matcher<internal::string>
- : public internal::MatcherBase<internal::string> {
- public:
- Matcher() {}
-
- explicit Matcher(const MatcherInterface<internal::string>* impl)
- : internal::MatcherBase<internal::string>(impl) {}
-
- // Allows the user to write str instead of Eq(str) sometimes, where
- // str is a string object.
- Matcher(const internal::string& s); // NOLINT
-
- // Allows the user to write "foo" instead of Eq("foo") sometimes.
- Matcher(const char* s); // NOLINT
-};
-
-#if GTEST_HAS_STRING_PIECE_
-// The following two specializations allow the user to write str
-// instead of Eq(str) and "foo" instead of Eq("foo") when a StringPiece
-// matcher is expected.
-template <>
-class GTEST_API_ Matcher<const StringPiece&>
- : public internal::MatcherBase<const StringPiece&> {
- public:
- Matcher() {}
-
- explicit Matcher(const MatcherInterface<const StringPiece&>* impl)
- : internal::MatcherBase<const StringPiece&>(impl) {}
-
- // Allows the user to write str instead of Eq(str) sometimes, where
- // str is a string object.
- Matcher(const internal::string& s); // NOLINT
-
- // Allows the user to write "foo" instead of Eq("foo") sometimes.
- Matcher(const char* s); // NOLINT
-
- // Allows the user to pass StringPieces directly.
- Matcher(StringPiece s); // NOLINT
-};
-
-template <>
-class GTEST_API_ Matcher<StringPiece>
- : public internal::MatcherBase<StringPiece> {
- public:
- Matcher() {}
-
- explicit Matcher(const MatcherInterface<StringPiece>* impl)
- : internal::MatcherBase<StringPiece>(impl) {}
-
- // Allows the user to write str instead of Eq(str) sometimes, where
- // str is a string object.
- Matcher(const internal::string& s); // NOLINT
-
- // Allows the user to write "foo" instead of Eq("foo") sometimes.
- Matcher(const char* s); // NOLINT
-
- // Allows the user to pass StringPieces directly.
- Matcher(StringPiece s); // NOLINT
-};
-#endif // GTEST_HAS_STRING_PIECE_
-
-// The PolymorphicMatcher class template makes it easy to implement a
-// polymorphic matcher (i.e. a matcher that can match values of more
-// than one type, e.g. Eq(n) and NotNull()).
-//
-// To define a polymorphic matcher, a user should provide an Impl
-// class that has a DescribeTo() method and a DescribeNegationTo()
-// method, and define a member function (or member function template)
-//
-// bool MatchAndExplain(const Value& value,
-// MatchResultListener* listener) const;
-//
-// See the definition of NotNull() for a complete example.
-template <class Impl>
-class PolymorphicMatcher {
- public:
- explicit PolymorphicMatcher(const Impl& an_impl) : impl_(an_impl) {}
-
- // Returns a mutable reference to the underlying matcher
- // implementation object.
- Impl& mutable_impl() { return impl_; }
-
- // Returns an immutable reference to the underlying matcher
- // implementation object.
- const Impl& impl() const { return impl_; }
-
- template <typename T>
- operator Matcher<T>() const {
- return Matcher<T>(new MonomorphicImpl<T>(impl_));
- }
-
- private:
- template <typename T>
- class MonomorphicImpl : public MatcherInterface<T> {
- public:
- explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- impl_.DescribeTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- impl_.DescribeNegationTo(os);
- }
-
- virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
- return impl_.MatchAndExplain(x, listener);
- }
-
- private:
- const Impl impl_;
-
- GTEST_DISALLOW_ASSIGN_(MonomorphicImpl);
- };
-
- Impl impl_;
-
- GTEST_DISALLOW_ASSIGN_(PolymorphicMatcher);
-};
-
-// Creates a matcher from its implementation. This is easier to use
-// than the Matcher<T> constructor as it doesn't require you to
-// explicitly write the template argument, e.g.
-//
-// MakeMatcher(foo);
-// vs
-// Matcher<const string&>(foo);
-template <typename T>
-inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) {
- return Matcher<T>(impl);
-}
-
-// Creates a polymorphic matcher from its implementation. This is
-// easier to use than the PolymorphicMatcher<Impl> constructor as it
-// doesn't require you to explicitly write the template argument, e.g.
-//
-// MakePolymorphicMatcher(foo);
-// vs
-// PolymorphicMatcher<TypeOfFoo>(foo);
-template <class Impl>
-inline PolymorphicMatcher<Impl> MakePolymorphicMatcher(const Impl& impl) {
- return PolymorphicMatcher<Impl>(impl);
-}
-
-// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION
-// and MUST NOT BE USED IN USER CODE!!!
-namespace internal {
-
-// The MatcherCastImpl class template is a helper for implementing
-// MatcherCast(). We need this helper in order to partially
-// specialize the implementation of MatcherCast() (C++ allows
-// class/struct templates to be partially specialized, but not
-// function templates.).
-
-// This general version is used when MatcherCast()'s argument is a
-// polymorphic matcher (i.e. something that can be converted to a
-// Matcher but is not one yet; for example, Eq(value)) or a value (for
-// example, "hello").
-template <typename T, typename M>
-class MatcherCastImpl {
- public:
- static Matcher<T> Cast(M polymorphic_matcher_or_value) {
- // M can be a polymorhic matcher, in which case we want to use
- // its conversion operator to create Matcher<T>. Or it can be a value
- // that should be passed to the Matcher<T>'s constructor.
- //
- // We can't call Matcher<T>(polymorphic_matcher_or_value) when M is a
- // polymorphic matcher because it'll be ambiguous if T has an implicit
- // constructor from M (this usually happens when T has an implicit
- // constructor from any type).
- //
- // It won't work to unconditionally implict_cast
- // polymorphic_matcher_or_value to Matcher<T> because it won't trigger
- // a user-defined conversion from M to T if one exists (assuming M is
- // a value).
- return CastImpl(
- polymorphic_matcher_or_value,
- BooleanConstant<
- internal::ImplicitlyConvertible<M, Matcher<T> >::value>());
- }
-
- private:
- static Matcher<T> CastImpl(M value, BooleanConstant<false>) {
- // M can't be implicitly converted to Matcher<T>, so M isn't a polymorphic
- // matcher. It must be a value then. Use direct initialization to create
- // a matcher.
- return Matcher<T>(ImplicitCast_<T>(value));
- }
-
- static Matcher<T> CastImpl(M polymorphic_matcher_or_value,
- BooleanConstant<true>) {
- // M is implicitly convertible to Matcher<T>, which means that either
- // M is a polymorhpic matcher or Matcher<T> has an implicit constructor
- // from M. In both cases using the implicit conversion will produce a
- // matcher.
- //
- // Even if T has an implicit constructor from M, it won't be called because
- // creating Matcher<T> would require a chain of two user-defined conversions
- // (first to create T from M and then to create Matcher<T> from T).
- return polymorphic_matcher_or_value;
- }
-};
-
-// This more specialized version is used when MatcherCast()'s argument
-// is already a Matcher. This only compiles when type T can be
-// statically converted to type U.
-template <typename T, typename U>
-class MatcherCastImpl<T, Matcher<U> > {
- public:
- static Matcher<T> Cast(const Matcher<U>& source_matcher) {
- return Matcher<T>(new Impl(source_matcher));
- }
-
- private:
- class Impl : public MatcherInterface<T> {
- public:
- explicit Impl(const Matcher<U>& source_matcher)
- : source_matcher_(source_matcher) {}
-
- // We delegate the matching logic to the source matcher.
- virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
- return source_matcher_.MatchAndExplain(static_cast<U>(x), listener);
- }
-
- virtual void DescribeTo(::std::ostream* os) const {
- source_matcher_.DescribeTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- source_matcher_.DescribeNegationTo(os);
- }
-
- private:
- const Matcher<U> source_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-};
-
-// This even more specialized version is used for efficiently casting
-// a matcher to its own type.
-template <typename T>
-class MatcherCastImpl<T, Matcher<T> > {
- public:
- static Matcher<T> Cast(const Matcher<T>& matcher) { return matcher; }
-};
-
-} // namespace internal
-
-// In order to be safe and clear, casting between different matcher
-// types is done explicitly via MatcherCast<T>(m), which takes a
-// matcher m and returns a Matcher<T>. It compiles only when T can be
-// statically converted to the argument type of m.
-template <typename T, typename M>
-inline Matcher<T> MatcherCast(M matcher) {
- return internal::MatcherCastImpl<T, M>::Cast(matcher);
-}
-
-// Implements SafeMatcherCast().
-//
-// We use an intermediate class to do the actual safe casting as Nokia's
-// Symbian compiler cannot decide between
-// template <T, M> ... (M) and
-// template <T, U> ... (const Matcher<U>&)
-// for function templates but can for member function templates.
-template <typename T>
-class SafeMatcherCastImpl {
- public:
- // This overload handles polymorphic matchers and values only since
- // monomorphic matchers are handled by the next one.
- template <typename M>
- static inline Matcher<T> Cast(M polymorphic_matcher_or_value) {
- return internal::MatcherCastImpl<T, M>::Cast(polymorphic_matcher_or_value);
- }
-
- // This overload handles monomorphic matchers.
- //
- // In general, if type T can be implicitly converted to type U, we can
- // safely convert a Matcher<U> to a Matcher<T> (i.e. Matcher is
- // contravariant): just keep a copy of the original Matcher<U>, convert the
- // argument from type T to U, and then pass it to the underlying Matcher<U>.
- // The only exception is when U is a reference and T is not, as the
- // underlying Matcher<U> may be interested in the argument's address, which
- // is not preserved in the conversion from T to U.
- template <typename U>
- static inline Matcher<T> Cast(const Matcher<U>& matcher) {
- // Enforce that T can be implicitly converted to U.
- GTEST_COMPILE_ASSERT_((internal::ImplicitlyConvertible<T, U>::value),
- T_must_be_implicitly_convertible_to_U);
- // Enforce that we are not converting a non-reference type T to a reference
- // type U.
- GTEST_COMPILE_ASSERT_(
- internal::is_reference<T>::value || !internal::is_reference<U>::value,
- cannot_convert_non_referentce_arg_to_reference);
- // In case both T and U are arithmetic types, enforce that the
- // conversion is not lossy.
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(T) RawT;
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(U) RawU;
- const bool kTIsOther = GMOCK_KIND_OF_(RawT) == internal::kOther;
- const bool kUIsOther = GMOCK_KIND_OF_(RawU) == internal::kOther;
- GTEST_COMPILE_ASSERT_(
- kTIsOther || kUIsOther ||
- (internal::LosslessArithmeticConvertible<RawT, RawU>::value),
- conversion_of_arithmetic_types_must_be_lossless);
- return MatcherCast<T>(matcher);
- }
-};
-
-template <typename T, typename M>
-inline Matcher<T> SafeMatcherCast(const M& polymorphic_matcher) {
- return SafeMatcherCastImpl<T>::Cast(polymorphic_matcher);
-}
-
-// A<T>() returns a matcher that matches any value of type T.
-template <typename T>
-Matcher<T> A();
-
-// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION
-// and MUST NOT BE USED IN USER CODE!!!
-namespace internal {
-
-// If the explanation is not empty, prints it to the ostream.
-inline void PrintIfNotEmpty(const internal::string& explanation,
- ::std::ostream* os) {
- if (explanation != "" && os != NULL) {
- *os << ", " << explanation;
- }
-}
-
-// Returns true if the given type name is easy to read by a human.
-// This is used to decide whether printing the type of a value might
-// be helpful.
-inline bool IsReadableTypeName(const string& type_name) {
- // We consider a type name readable if it's short or doesn't contain
- // a template or function type.
- return (type_name.length() <= 20 ||
- type_name.find_first_of("<(") == string::npos);
-}
-
-// Matches the value against the given matcher, prints the value and explains
-// the match result to the listener. Returns the match result.
-// 'listener' must not be NULL.
-// Value cannot be passed by const reference, because some matchers take a
-// non-const argument.
-template <typename Value, typename T>
-bool MatchPrintAndExplain(Value& value, const Matcher<T>& matcher,
- MatchResultListener* listener) {
- if (!listener->IsInterested()) {
- // If the listener is not interested, we do not need to construct the
- // inner explanation.
- return matcher.Matches(value);
- }
-
- StringMatchResultListener inner_listener;
- const bool match = matcher.MatchAndExplain(value, &inner_listener);
-
- UniversalPrint(value, listener->stream());
-#if GTEST_HAS_RTTI
- const string& type_name = GetTypeName<Value>();
- if (IsReadableTypeName(type_name))
- *listener->stream() << " (of type " << type_name << ")";
-#endif
- PrintIfNotEmpty(inner_listener.str(), listener->stream());
-
- return match;
-}
-
-// An internal helper class for doing compile-time loop on a tuple's
-// fields.
-template <size_t N>
-class TuplePrefix {
- public:
- // TuplePrefix<N>::Matches(matcher_tuple, value_tuple) returns true
- // iff the first N fields of matcher_tuple matches the first N
- // fields of value_tuple, respectively.
- template <typename MatcherTuple, typename ValueTuple>
- static bool Matches(const MatcherTuple& matcher_tuple,
- const ValueTuple& value_tuple) {
- using ::std::tr1::get;
- return TuplePrefix<N - 1>::Matches(matcher_tuple, value_tuple)
- && get<N - 1>(matcher_tuple).Matches(get<N - 1>(value_tuple));
- }
-
- // TuplePrefix<N>::ExplainMatchFailuresTo(matchers, values, os)
- // describes failures in matching the first N fields of matchers
- // against the first N fields of values. If there is no failure,
- // nothing will be streamed to os.
- template <typename MatcherTuple, typename ValueTuple>
- static void ExplainMatchFailuresTo(const MatcherTuple& matchers,
- const ValueTuple& values,
- ::std::ostream* os) {
- using ::std::tr1::tuple_element;
- using ::std::tr1::get;
-
- // First, describes failures in the first N - 1 fields.
- TuplePrefix<N - 1>::ExplainMatchFailuresTo(matchers, values, os);
-
- // Then describes the failure (if any) in the (N - 1)-th (0-based)
- // field.
- typename tuple_element<N - 1, MatcherTuple>::type matcher =
- get<N - 1>(matchers);
- typedef typename tuple_element<N - 1, ValueTuple>::type Value;
- Value value = get<N - 1>(values);
- StringMatchResultListener listener;
- if (!matcher.MatchAndExplain(value, &listener)) {
- // TODO(wan): include in the message the name of the parameter
- // as used in MOCK_METHOD*() when possible.
- *os << " Expected arg #" << N - 1 << ": ";
- get<N - 1>(matchers).DescribeTo(os);
- *os << "\n Actual: ";
- // We remove the reference in type Value to prevent the
- // universal printer from printing the address of value, which
- // isn't interesting to the user most of the time. The
- // matcher's MatchAndExplain() method handles the case when
- // the address is interesting.
- internal::UniversalPrint(value, os);
- PrintIfNotEmpty(listener.str(), os);
- *os << "\n";
- }
- }
-};
-
-// The base case.
-template <>
-class TuplePrefix<0> {
- public:
- template <typename MatcherTuple, typename ValueTuple>
- static bool Matches(const MatcherTuple& /* matcher_tuple */,
- const ValueTuple& /* value_tuple */) {
- return true;
- }
-
- template <typename MatcherTuple, typename ValueTuple>
- static void ExplainMatchFailuresTo(const MatcherTuple& /* matchers */,
- const ValueTuple& /* values */,
- ::std::ostream* /* os */) {}
-};
-
-// TupleMatches(matcher_tuple, value_tuple) returns true iff all
-// matchers in matcher_tuple match the corresponding fields in
-// value_tuple. It is a compiler error if matcher_tuple and
-// value_tuple have different number of fields or incompatible field
-// types.
-template <typename MatcherTuple, typename ValueTuple>
-bool TupleMatches(const MatcherTuple& matcher_tuple,
- const ValueTuple& value_tuple) {
- using ::std::tr1::tuple_size;
- // Makes sure that matcher_tuple and value_tuple have the same
- // number of fields.
- GTEST_COMPILE_ASSERT_(tuple_size<MatcherTuple>::value ==
- tuple_size<ValueTuple>::value,
- matcher_and_value_have_different_numbers_of_fields);
- return TuplePrefix<tuple_size<ValueTuple>::value>::
- Matches(matcher_tuple, value_tuple);
-}
-
-// Describes failures in matching matchers against values. If there
-// is no failure, nothing will be streamed to os.
-template <typename MatcherTuple, typename ValueTuple>
-void ExplainMatchFailureTupleTo(const MatcherTuple& matchers,
- const ValueTuple& values,
- ::std::ostream* os) {
- using ::std::tr1::tuple_size;
- TuplePrefix<tuple_size<MatcherTuple>::value>::ExplainMatchFailuresTo(
- matchers, values, os);
-}
-
-// TransformTupleValues and its helper.
-//
-// TransformTupleValuesHelper hides the internal machinery that
-// TransformTupleValues uses to implement a tuple traversal.
-template <typename Tuple, typename Func, typename OutIter>
-class TransformTupleValuesHelper {
- private:
- typedef typename ::std::tr1::tuple_size<Tuple> TupleSize;
-
- public:
- // For each member of tuple 't', taken in order, evaluates '*out++ = f(t)'.
- // Returns the final value of 'out' in case the caller needs it.
- static OutIter Run(Func f, const Tuple& t, OutIter out) {
- return IterateOverTuple<Tuple, TupleSize::value>()(f, t, out);
- }
-
- private:
- template <typename Tup, size_t kRemainingSize>
- struct IterateOverTuple {
- OutIter operator() (Func f, const Tup& t, OutIter out) const {
- *out++ = f(::std::tr1::get<TupleSize::value - kRemainingSize>(t));
- return IterateOverTuple<Tup, kRemainingSize - 1>()(f, t, out);
- }
- };
- template <typename Tup>
- struct IterateOverTuple<Tup, 0> {
- OutIter operator() (Func /* f */, const Tup& /* t */, OutIter out) const {
- return out;
- }
- };
-};
-
-// Successively invokes 'f(element)' on each element of the tuple 't',
-// appending each result to the 'out' iterator. Returns the final value
-// of 'out'.
-template <typename Tuple, typename Func, typename OutIter>
-OutIter TransformTupleValues(Func f, const Tuple& t, OutIter out) {
- return TransformTupleValuesHelper<Tuple, Func, OutIter>::Run(f, t, out);
-}
-
-// Implements A<T>().
-template <typename T>
-class AnyMatcherImpl : public MatcherInterface<T> {
- public:
- virtual bool MatchAndExplain(
- T /* x */, MatchResultListener* /* listener */) const { return true; }
- virtual void DescribeTo(::std::ostream* os) const { *os << "is anything"; }
- virtual void DescribeNegationTo(::std::ostream* os) const {
- // This is mostly for completeness' safe, as it's not very useful
- // to write Not(A<bool>()). However we cannot completely rule out
- // such a possibility, and it doesn't hurt to be prepared.
- *os << "never matches";
- }
-};
-
-// Implements _, a matcher that matches any value of any
-// type. This is a polymorphic matcher, so we need a template type
-// conversion operator to make it appearing as a Matcher<T> for any
-// type T.
-class AnythingMatcher {
- public:
- template <typename T>
- operator Matcher<T>() const { return A<T>(); }
-};
-
-// Implements a matcher that compares a given value with a
-// pre-supplied value using one of the ==, <=, <, etc, operators. The
-// two values being compared don't have to have the same type.
-//
-// The matcher defined here is polymorphic (for example, Eq(5) can be
-// used to match an int, a short, a double, etc). Therefore we use
-// a template type conversion operator in the implementation.
-//
-// We define this as a macro in order to eliminate duplicated source
-// code.
-//
-// The following template definition assumes that the Rhs parameter is
-// a "bare" type (i.e. neither 'const T' nor 'T&').
-#define GMOCK_IMPLEMENT_COMPARISON_MATCHER_( \
- name, op, relation, negated_relation) \
- template <typename Rhs> class name##Matcher { \
- public: \
- explicit name##Matcher(const Rhs& rhs) : rhs_(rhs) {} \
- template <typename Lhs> \
- operator Matcher<Lhs>() const { \
- return MakeMatcher(new Impl<Lhs>(rhs_)); \
- } \
- private: \
- template <typename Lhs> \
- class Impl : public MatcherInterface<Lhs> { \
- public: \
- explicit Impl(const Rhs& rhs) : rhs_(rhs) {} \
- virtual bool MatchAndExplain(\
- Lhs lhs, MatchResultListener* /* listener */) const { \
- return lhs op rhs_; \
- } \
- virtual void DescribeTo(::std::ostream* os) const { \
- *os << relation " "; \
- UniversalPrint(rhs_, os); \
- } \
- virtual void DescribeNegationTo(::std::ostream* os) const { \
- *os << negated_relation " "; \
- UniversalPrint(rhs_, os); \
- } \
- private: \
- Rhs rhs_; \
- GTEST_DISALLOW_ASSIGN_(Impl); \
- }; \
- Rhs rhs_; \
- GTEST_DISALLOW_ASSIGN_(name##Matcher); \
- }
-
-// Implements Eq(v), Ge(v), Gt(v), Le(v), Lt(v), and Ne(v)
-// respectively.
-GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Eq, ==, "is equal to", "isn't equal to");
-GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Ge, >=, "is >=", "isn't >=");
-GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Gt, >, "is >", "isn't >");
-GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Le, <=, "is <=", "isn't <=");
-GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Lt, <, "is <", "isn't <");
-GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Ne, !=, "isn't equal to", "is equal to");
-
-#undef GMOCK_IMPLEMENT_COMPARISON_MATCHER_
-
-// Implements the polymorphic IsNull() matcher, which matches any raw or smart
-// pointer that is NULL.
-class IsNullMatcher {
- public:
- template <typename Pointer>
- bool MatchAndExplain(const Pointer& p,
- MatchResultListener* /* listener */) const {
- return GetRawPointer(p) == NULL;
- }
-
- void DescribeTo(::std::ostream* os) const { *os << "is NULL"; }
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "isn't NULL";
- }
-};
-
-// Implements the polymorphic NotNull() matcher, which matches any raw or smart
-// pointer that is not NULL.
-class NotNullMatcher {
- public:
- template <typename Pointer>
- bool MatchAndExplain(const Pointer& p,
- MatchResultListener* /* listener */) const {
- return GetRawPointer(p) != NULL;
- }
-
- void DescribeTo(::std::ostream* os) const { *os << "isn't NULL"; }
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "is NULL";
- }
-};
-
-// Ref(variable) matches any argument that is a reference to
-// 'variable'. This matcher is polymorphic as it can match any
-// super type of the type of 'variable'.
-//
-// The RefMatcher template class implements Ref(variable). It can
-// only be instantiated with a reference type. This prevents a user
-// from mistakenly using Ref(x) to match a non-reference function
-// argument. For example, the following will righteously cause a
-// compiler error:
-//
-// int n;
-// Matcher<int> m1 = Ref(n); // This won't compile.
-// Matcher<int&> m2 = Ref(n); // This will compile.
-template <typename T>
-class RefMatcher;
-
-template <typename T>
-class RefMatcher<T&> {
- // Google Mock is a generic framework and thus needs to support
- // mocking any function types, including those that take non-const
- // reference arguments. Therefore the template parameter T (and
- // Super below) can be instantiated to either a const type or a
- // non-const type.
- public:
- // RefMatcher() takes a T& instead of const T&, as we want the
- // compiler to catch using Ref(const_value) as a matcher for a
- // non-const reference.
- explicit RefMatcher(T& x) : object_(x) {} // NOLINT
-
- template <typename Super>
- operator Matcher<Super&>() const {
- // By passing object_ (type T&) to Impl(), which expects a Super&,
- // we make sure that Super is a super type of T. In particular,
- // this catches using Ref(const_value) as a matcher for a
- // non-const reference, as you cannot implicitly convert a const
- // reference to a non-const reference.
- return MakeMatcher(new Impl<Super>(object_));
- }
-
- private:
- template <typename Super>
- class Impl : public MatcherInterface<Super&> {
- public:
- explicit Impl(Super& x) : object_(x) {} // NOLINT
-
- // MatchAndExplain() takes a Super& (as opposed to const Super&)
- // in order to match the interface MatcherInterface<Super&>.
- virtual bool MatchAndExplain(
- Super& x, MatchResultListener* listener) const {
- *listener << "which is located @" << static_cast<const void*>(&x);
- return &x == &object_;
- }
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "references the variable ";
- UniversalPrinter<Super&>::Print(object_, os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "does not reference the variable ";
- UniversalPrinter<Super&>::Print(object_, os);
- }
-
- private:
- const Super& object_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- T& object_;
-
- GTEST_DISALLOW_ASSIGN_(RefMatcher);
-};
-
-// Polymorphic helper functions for narrow and wide string matchers.
-inline bool CaseInsensitiveCStringEquals(const char* lhs, const char* rhs) {
- return String::CaseInsensitiveCStringEquals(lhs, rhs);
-}
-
-inline bool CaseInsensitiveCStringEquals(const wchar_t* lhs,
- const wchar_t* rhs) {
- return String::CaseInsensitiveWideCStringEquals(lhs, rhs);
-}
-
-// String comparison for narrow or wide strings that can have embedded NUL
-// characters.
-template <typename StringType>
-bool CaseInsensitiveStringEquals(const StringType& s1,
- const StringType& s2) {
- // Are the heads equal?
- if (!CaseInsensitiveCStringEquals(s1.c_str(), s2.c_str())) {
- return false;
- }
-
- // Skip the equal heads.
- const typename StringType::value_type nul = 0;
- const size_t i1 = s1.find(nul), i2 = s2.find(nul);
-
- // Are we at the end of either s1 or s2?
- if (i1 == StringType::npos || i2 == StringType::npos) {
- return i1 == i2;
- }
-
- // Are the tails equal?
- return CaseInsensitiveStringEquals(s1.substr(i1 + 1), s2.substr(i2 + 1));
-}
-
-// String matchers.
-
-// Implements equality-based string matchers like StrEq, StrCaseNe, and etc.
-template <typename StringType>
-class StrEqualityMatcher {
- public:
- StrEqualityMatcher(const StringType& str, bool expect_eq,
- bool case_sensitive)
- : string_(str), expect_eq_(expect_eq), case_sensitive_(case_sensitive) {}
-
- // Accepts pointer types, particularly:
- // const char*
- // char*
- // const wchar_t*
- // wchar_t*
- template <typename CharType>
- bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
- if (s == NULL) {
- return !expect_eq_;
- }
- return MatchAndExplain(StringType(s), listener);
- }
-
- // Matches anything that can convert to StringType.
- //
- // This is a template, not just a plain function with const StringType&,
- // because StringPiece has some interfering non-explicit constructors.
- template <typename MatcheeStringType>
- bool MatchAndExplain(const MatcheeStringType& s,
- MatchResultListener* /* listener */) const {
- const StringType& s2(s);
- const bool eq = case_sensitive_ ? s2 == string_ :
- CaseInsensitiveStringEquals(s2, string_);
- return expect_eq_ == eq;
- }
-
- void DescribeTo(::std::ostream* os) const {
- DescribeToHelper(expect_eq_, os);
- }
-
- void DescribeNegationTo(::std::ostream* os) const {
- DescribeToHelper(!expect_eq_, os);
- }
-
- private:
- void DescribeToHelper(bool expect_eq, ::std::ostream* os) const {
- *os << (expect_eq ? "is " : "isn't ");
- *os << "equal to ";
- if (!case_sensitive_) {
- *os << "(ignoring case) ";
- }
- UniversalPrint(string_, os);
- }
-
- const StringType string_;
- const bool expect_eq_;
- const bool case_sensitive_;
-
- GTEST_DISALLOW_ASSIGN_(StrEqualityMatcher);
-};
-
-// Implements the polymorphic HasSubstr(substring) matcher, which
-// can be used as a Matcher<T> as long as T can be converted to a
-// string.
-template <typename StringType>
-class HasSubstrMatcher {
- public:
- explicit HasSubstrMatcher(const StringType& substring)
- : substring_(substring) {}
-
- // Accepts pointer types, particularly:
- // const char*
- // char*
- // const wchar_t*
- // wchar_t*
- template <typename CharType>
- bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
- return s != NULL && MatchAndExplain(StringType(s), listener);
- }
-
- // Matches anything that can convert to StringType.
- //
- // This is a template, not just a plain function with const StringType&,
- // because StringPiece has some interfering non-explicit constructors.
- template <typename MatcheeStringType>
- bool MatchAndExplain(const MatcheeStringType& s,
- MatchResultListener* /* listener */) const {
- const StringType& s2(s);
- return s2.find(substring_) != StringType::npos;
- }
-
- // Describes what this matcher matches.
- void DescribeTo(::std::ostream* os) const {
- *os << "has substring ";
- UniversalPrint(substring_, os);
- }
-
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "has no substring ";
- UniversalPrint(substring_, os);
- }
-
- private:
- const StringType substring_;
-
- GTEST_DISALLOW_ASSIGN_(HasSubstrMatcher);
-};
-
-// Implements the polymorphic StartsWith(substring) matcher, which
-// can be used as a Matcher<T> as long as T can be converted to a
-// string.
-template <typename StringType>
-class StartsWithMatcher {
- public:
- explicit StartsWithMatcher(const StringType& prefix) : prefix_(prefix) {
- }
-
- // Accepts pointer types, particularly:
- // const char*
- // char*
- // const wchar_t*
- // wchar_t*
- template <typename CharType>
- bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
- return s != NULL && MatchAndExplain(StringType(s), listener);
- }
-
- // Matches anything that can convert to StringType.
- //
- // This is a template, not just a plain function with const StringType&,
- // because StringPiece has some interfering non-explicit constructors.
- template <typename MatcheeStringType>
- bool MatchAndExplain(const MatcheeStringType& s,
- MatchResultListener* /* listener */) const {
- const StringType& s2(s);
- return s2.length() >= prefix_.length() &&
- s2.substr(0, prefix_.length()) == prefix_;
- }
-
- void DescribeTo(::std::ostream* os) const {
- *os << "starts with ";
- UniversalPrint(prefix_, os);
- }
-
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "doesn't start with ";
- UniversalPrint(prefix_, os);
- }
-
- private:
- const StringType prefix_;
-
- GTEST_DISALLOW_ASSIGN_(StartsWithMatcher);
-};
-
-// Implements the polymorphic EndsWith(substring) matcher, which
-// can be used as a Matcher<T> as long as T can be converted to a
-// string.
-template <typename StringType>
-class EndsWithMatcher {
- public:
- explicit EndsWithMatcher(const StringType& suffix) : suffix_(suffix) {}
-
- // Accepts pointer types, particularly:
- // const char*
- // char*
- // const wchar_t*
- // wchar_t*
- template <typename CharType>
- bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
- return s != NULL && MatchAndExplain(StringType(s), listener);
- }
-
- // Matches anything that can convert to StringType.
- //
- // This is a template, not just a plain function with const StringType&,
- // because StringPiece has some interfering non-explicit constructors.
- template <typename MatcheeStringType>
- bool MatchAndExplain(const MatcheeStringType& s,
- MatchResultListener* /* listener */) const {
- const StringType& s2(s);
- return s2.length() >= suffix_.length() &&
- s2.substr(s2.length() - suffix_.length()) == suffix_;
- }
-
- void DescribeTo(::std::ostream* os) const {
- *os << "ends with ";
- UniversalPrint(suffix_, os);
- }
-
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "doesn't end with ";
- UniversalPrint(suffix_, os);
- }
-
- private:
- const StringType suffix_;
-
- GTEST_DISALLOW_ASSIGN_(EndsWithMatcher);
-};
-
-// Implements polymorphic matchers MatchesRegex(regex) and
-// ContainsRegex(regex), which can be used as a Matcher<T> as long as
-// T can be converted to a string.
-class MatchesRegexMatcher {
- public:
- MatchesRegexMatcher(const RE* regex, bool full_match)
- : regex_(regex), full_match_(full_match) {}
-
- // Accepts pointer types, particularly:
- // const char*
- // char*
- // const wchar_t*
- // wchar_t*
- template <typename CharType>
- bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
- return s != NULL && MatchAndExplain(internal::string(s), listener);
- }
-
- // Matches anything that can convert to internal::string.
- //
- // This is a template, not just a plain function with const internal::string&,
- // because StringPiece has some interfering non-explicit constructors.
- template <class MatcheeStringType>
- bool MatchAndExplain(const MatcheeStringType& s,
- MatchResultListener* /* listener */) const {
- const internal::string& s2(s);
- return full_match_ ? RE::FullMatch(s2, *regex_) :
- RE::PartialMatch(s2, *regex_);
- }
-
- void DescribeTo(::std::ostream* os) const {
- *os << (full_match_ ? "matches" : "contains")
- << " regular expression ";
- UniversalPrinter<internal::string>::Print(regex_->pattern(), os);
- }
-
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "doesn't " << (full_match_ ? "match" : "contain")
- << " regular expression ";
- UniversalPrinter<internal::string>::Print(regex_->pattern(), os);
- }
-
- private:
- const internal::linked_ptr<const RE> regex_;
- const bool full_match_;
-
- GTEST_DISALLOW_ASSIGN_(MatchesRegexMatcher);
-};
-
-// Implements a matcher that compares the two fields of a 2-tuple
-// using one of the ==, <=, <, etc, operators. The two fields being
-// compared don't have to have the same type.
-//
-// The matcher defined here is polymorphic (for example, Eq() can be
-// used to match a tuple<int, short>, a tuple<const long&, double>,
-// etc). Therefore we use a template type conversion operator in the
-// implementation.
-//
-// We define this as a macro in order to eliminate duplicated source
-// code.
-#define GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(name, op, relation) \
- class name##2Matcher { \
- public: \
- template <typename T1, typename T2> \
- operator Matcher< ::std::tr1::tuple<T1, T2> >() const { \
- return MakeMatcher(new Impl< ::std::tr1::tuple<T1, T2> >); \
- } \
- template <typename T1, typename T2> \
- operator Matcher<const ::std::tr1::tuple<T1, T2>&>() const { \
- return MakeMatcher(new Impl<const ::std::tr1::tuple<T1, T2>&>); \
- } \
- private: \
- template <typename Tuple> \
- class Impl : public MatcherInterface<Tuple> { \
- public: \
- virtual bool MatchAndExplain( \
- Tuple args, \
- MatchResultListener* /* listener */) const { \
- return ::std::tr1::get<0>(args) op ::std::tr1::get<1>(args); \
- } \
- virtual void DescribeTo(::std::ostream* os) const { \
- *os << "are " relation; \
- } \
- virtual void DescribeNegationTo(::std::ostream* os) const { \
- *os << "aren't " relation; \
- } \
- }; \
- }
-
-// Implements Eq(), Ge(), Gt(), Le(), Lt(), and Ne() respectively.
-GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Eq, ==, "an equal pair");
-GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(
- Ge, >=, "a pair where the first >= the second");
-GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(
- Gt, >, "a pair where the first > the second");
-GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(
- Le, <=, "a pair where the first <= the second");
-GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(
- Lt, <, "a pair where the first < the second");
-GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Ne, !=, "an unequal pair");
-
-#undef GMOCK_IMPLEMENT_COMPARISON2_MATCHER_
-
-// Implements the Not(...) matcher for a particular argument type T.
-// We do not nest it inside the NotMatcher class template, as that
-// will prevent different instantiations of NotMatcher from sharing
-// the same NotMatcherImpl<T> class.
-template <typename T>
-class NotMatcherImpl : public MatcherInterface<T> {
- public:
- explicit NotMatcherImpl(const Matcher<T>& matcher)
- : matcher_(matcher) {}
-
- virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
- return !matcher_.MatchAndExplain(x, listener);
- }
-
- virtual void DescribeTo(::std::ostream* os) const {
- matcher_.DescribeNegationTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- matcher_.DescribeTo(os);
- }
-
- private:
- const Matcher<T> matcher_;
-
- GTEST_DISALLOW_ASSIGN_(NotMatcherImpl);
-};
-
-// Implements the Not(m) matcher, which matches a value that doesn't
-// match matcher m.
-template <typename InnerMatcher>
-class NotMatcher {
- public:
- explicit NotMatcher(InnerMatcher matcher) : matcher_(matcher) {}
-
- // This template type conversion operator allows Not(m) to be used
- // to match any type m can match.
- template <typename T>
- operator Matcher<T>() const {
- return Matcher<T>(new NotMatcherImpl<T>(SafeMatcherCast<T>(matcher_)));
- }
-
- private:
- InnerMatcher matcher_;
-
- GTEST_DISALLOW_ASSIGN_(NotMatcher);
-};
-
-// Implements the AllOf(m1, m2) matcher for a particular argument type
-// T. We do not nest it inside the BothOfMatcher class template, as
-// that will prevent different instantiations of BothOfMatcher from
-// sharing the same BothOfMatcherImpl<T> class.
-template <typename T>
-class BothOfMatcherImpl : public MatcherInterface<T> {
- public:
- BothOfMatcherImpl(const Matcher<T>& matcher1, const Matcher<T>& matcher2)
- : matcher1_(matcher1), matcher2_(matcher2) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "(";
- matcher1_.DescribeTo(os);
- *os << ") and (";
- matcher2_.DescribeTo(os);
- *os << ")";
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "(";
- matcher1_.DescribeNegationTo(os);
- *os << ") or (";
- matcher2_.DescribeNegationTo(os);
- *os << ")";
- }
-
- virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
- // If either matcher1_ or matcher2_ doesn't match x, we only need
- // to explain why one of them fails.
- StringMatchResultListener listener1;
- if (!matcher1_.MatchAndExplain(x, &listener1)) {
- *listener << listener1.str();
- return false;
- }
-
- StringMatchResultListener listener2;
- if (!matcher2_.MatchAndExplain(x, &listener2)) {
- *listener << listener2.str();
- return false;
- }
-
- // Otherwise we need to explain why *both* of them match.
- const internal::string s1 = listener1.str();
- const internal::string s2 = listener2.str();
-
- if (s1 == "") {
- *listener << s2;
- } else {
- *listener << s1;
- if (s2 != "") {
- *listener << ", and " << s2;
- }
- }
- return true;
- }
-
- private:
- const Matcher<T> matcher1_;
- const Matcher<T> matcher2_;
-
- GTEST_DISALLOW_ASSIGN_(BothOfMatcherImpl);
-};
-
-#if GTEST_LANG_CXX11
-// MatcherList provides mechanisms for storing a variable number of matchers in
-// a list structure (ListType) and creating a combining matcher from such a
-// list.
-// The template is defined recursively using the following template paramters:
-// * kSize is the length of the MatcherList.
-// * Head is the type of the first matcher of the list.
-// * Tail denotes the types of the remaining matchers of the list.
-template <int kSize, typename Head, typename... Tail>
-struct MatcherList {
- typedef MatcherList<kSize - 1, Tail...> MatcherListTail;
- typedef ::std::pair<Head, typename MatcherListTail::ListType> ListType;
-
- // BuildList stores variadic type values in a nested pair structure.
- // Example:
- // MatcherList<3, int, string, float>::BuildList(5, "foo", 2.0) will return
- // the corresponding result of type pair<int, pair<string, float>>.
- static ListType BuildList(const Head& matcher, const Tail&... tail) {
- return ListType(matcher, MatcherListTail::BuildList(tail...));
- }
-
- // CreateMatcher<T> creates a Matcher<T> from a given list of matchers (built
- // by BuildList()). CombiningMatcher<T> is used to combine the matchers of the
- // list. CombiningMatcher<T> must implement MatcherInterface<T> and have a
- // constructor taking two Matcher<T>s as input.
- template <typename T, template <typename /* T */> class CombiningMatcher>
- static Matcher<T> CreateMatcher(const ListType& matchers) {
- return Matcher<T>(new CombiningMatcher<T>(
- SafeMatcherCast<T>(matchers.first),
- MatcherListTail::template CreateMatcher<T, CombiningMatcher>(
- matchers.second)));
- }
-};
-
-// The following defines the base case for the recursive definition of
-// MatcherList.
-template <typename Matcher1, typename Matcher2>
-struct MatcherList<2, Matcher1, Matcher2> {
- typedef ::std::pair<Matcher1, Matcher2> ListType;
-
- static ListType BuildList(const Matcher1& matcher1,
- const Matcher2& matcher2) {
- return ::std::pair<Matcher1, Matcher2>(matcher1, matcher2);
- }
-
- template <typename T, template <typename /* T */> class CombiningMatcher>
- static Matcher<T> CreateMatcher(const ListType& matchers) {
- return Matcher<T>(new CombiningMatcher<T>(
- SafeMatcherCast<T>(matchers.first),
- SafeMatcherCast<T>(matchers.second)));
- }
-};
-
-// VariadicMatcher is used for the variadic implementation of
-// AllOf(m_1, m_2, ...) and AnyOf(m_1, m_2, ...).
-// CombiningMatcher<T> is used to recursively combine the provided matchers
-// (of type Args...).
-template <template <typename T> class CombiningMatcher, typename... Args>
-class VariadicMatcher {
- public:
- VariadicMatcher(const Args&... matchers) // NOLINT
- : matchers_(MatcherListType::BuildList(matchers...)) {}
-
- // This template type conversion operator allows an
- // VariadicMatcher<Matcher1, Matcher2...> object to match any type that
- // all of the provided matchers (Matcher1, Matcher2, ...) can match.
- template <typename T>
- operator Matcher<T>() const {
- return MatcherListType::template CreateMatcher<T, CombiningMatcher>(
- matchers_);
- }
-
- private:
- typedef MatcherList<sizeof...(Args), Args...> MatcherListType;
-
- const typename MatcherListType::ListType matchers_;
-
- GTEST_DISALLOW_ASSIGN_(VariadicMatcher);
-};
-
-template <typename... Args>
-using AllOfMatcher = VariadicMatcher<BothOfMatcherImpl, Args...>;
-
-#endif // GTEST_LANG_CXX11
-
-// Used for implementing the AllOf(m_1, ..., m_n) matcher, which
-// matches a value that matches all of the matchers m_1, ..., and m_n.
-template <typename Matcher1, typename Matcher2>
-class BothOfMatcher {
- public:
- BothOfMatcher(Matcher1 matcher1, Matcher2 matcher2)
- : matcher1_(matcher1), matcher2_(matcher2) {}
-
- // This template type conversion operator allows a
- // BothOfMatcher<Matcher1, Matcher2> object to match any type that
- // both Matcher1 and Matcher2 can match.
- template <typename T>
- operator Matcher<T>() const {
- return Matcher<T>(new BothOfMatcherImpl<T>(SafeMatcherCast<T>(matcher1_),
- SafeMatcherCast<T>(matcher2_)));
- }
-
- private:
- Matcher1 matcher1_;
- Matcher2 matcher2_;
-
- GTEST_DISALLOW_ASSIGN_(BothOfMatcher);
-};
-
-// Implements the AnyOf(m1, m2) matcher for a particular argument type
-// T. We do not nest it inside the AnyOfMatcher class template, as
-// that will prevent different instantiations of AnyOfMatcher from
-// sharing the same EitherOfMatcherImpl<T> class.
-template <typename T>
-class EitherOfMatcherImpl : public MatcherInterface<T> {
- public:
- EitherOfMatcherImpl(const Matcher<T>& matcher1, const Matcher<T>& matcher2)
- : matcher1_(matcher1), matcher2_(matcher2) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "(";
- matcher1_.DescribeTo(os);
- *os << ") or (";
- matcher2_.DescribeTo(os);
- *os << ")";
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "(";
- matcher1_.DescribeNegationTo(os);
- *os << ") and (";
- matcher2_.DescribeNegationTo(os);
- *os << ")";
- }
-
- virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
- // If either matcher1_ or matcher2_ matches x, we just need to
- // explain why *one* of them matches.
- StringMatchResultListener listener1;
- if (matcher1_.MatchAndExplain(x, &listener1)) {
- *listener << listener1.str();
- return true;
- }
-
- StringMatchResultListener listener2;
- if (matcher2_.MatchAndExplain(x, &listener2)) {
- *listener << listener2.str();
- return true;
- }
-
- // Otherwise we need to explain why *both* of them fail.
- const internal::string s1 = listener1.str();
- const internal::string s2 = listener2.str();
-
- if (s1 == "") {
- *listener << s2;
- } else {
- *listener << s1;
- if (s2 != "") {
- *listener << ", and " << s2;
- }
- }
- return false;
- }
-
- private:
- const Matcher<T> matcher1_;
- const Matcher<T> matcher2_;
-
- GTEST_DISALLOW_ASSIGN_(EitherOfMatcherImpl);
-};
-
-#if GTEST_LANG_CXX11
-// AnyOfMatcher is used for the variadic implementation of AnyOf(m_1, m_2, ...).
-template <typename... Args>
-using AnyOfMatcher = VariadicMatcher<EitherOfMatcherImpl, Args...>;
-
-#endif // GTEST_LANG_CXX11
-
-// Used for implementing the AnyOf(m_1, ..., m_n) matcher, which
-// matches a value that matches at least one of the matchers m_1, ...,
-// and m_n.
-template <typename Matcher1, typename Matcher2>
-class EitherOfMatcher {
- public:
- EitherOfMatcher(Matcher1 matcher1, Matcher2 matcher2)
- : matcher1_(matcher1), matcher2_(matcher2) {}
-
- // This template type conversion operator allows a
- // EitherOfMatcher<Matcher1, Matcher2> object to match any type that
- // both Matcher1 and Matcher2 can match.
- template <typename T>
- operator Matcher<T>() const {
- return Matcher<T>(new EitherOfMatcherImpl<T>(
- SafeMatcherCast<T>(matcher1_), SafeMatcherCast<T>(matcher2_)));
- }
-
- private:
- Matcher1 matcher1_;
- Matcher2 matcher2_;
-
- GTEST_DISALLOW_ASSIGN_(EitherOfMatcher);
-};
-
-// Used for implementing Truly(pred), which turns a predicate into a
-// matcher.
-template <typename Predicate>
-class TrulyMatcher {
- public:
- explicit TrulyMatcher(Predicate pred) : predicate_(pred) {}
-
- // This method template allows Truly(pred) to be used as a matcher
- // for type T where T is the argument type of predicate 'pred'. The
- // argument is passed by reference as the predicate may be
- // interested in the address of the argument.
- template <typename T>
- bool MatchAndExplain(T& x, // NOLINT
- MatchResultListener* /* listener */) const {
- // Without the if-statement, MSVC sometimes warns about converting
- // a value to bool (warning 4800).
- //
- // We cannot write 'return !!predicate_(x);' as that doesn't work
- // when predicate_(x) returns a class convertible to bool but
- // having no operator!().
- if (predicate_(x))
- return true;
- return false;
- }
-
- void DescribeTo(::std::ostream* os) const {
- *os << "satisfies the given predicate";
- }
-
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "doesn't satisfy the given predicate";
- }
-
- private:
- Predicate predicate_;
-
- GTEST_DISALLOW_ASSIGN_(TrulyMatcher);
-};
-
-// Used for implementing Matches(matcher), which turns a matcher into
-// a predicate.
-template <typename M>
-class MatcherAsPredicate {
- public:
- explicit MatcherAsPredicate(M matcher) : matcher_(matcher) {}
-
- // This template operator() allows Matches(m) to be used as a
- // predicate on type T where m is a matcher on type T.
- //
- // The argument x is passed by reference instead of by value, as
- // some matcher may be interested in its address (e.g. as in
- // Matches(Ref(n))(x)).
- template <typename T>
- bool operator()(const T& x) const {
- // We let matcher_ commit to a particular type here instead of
- // when the MatcherAsPredicate object was constructed. This
- // allows us to write Matches(m) where m is a polymorphic matcher
- // (e.g. Eq(5)).
- //
- // If we write Matcher<T>(matcher_).Matches(x) here, it won't
- // compile when matcher_ has type Matcher<const T&>; if we write
- // Matcher<const T&>(matcher_).Matches(x) here, it won't compile
- // when matcher_ has type Matcher<T>; if we just write
- // matcher_.Matches(x), it won't compile when matcher_ is
- // polymorphic, e.g. Eq(5).
- //
- // MatcherCast<const T&>() is necessary for making the code work
- // in all of the above situations.
- return MatcherCast<const T&>(matcher_).Matches(x);
- }
-
- private:
- M matcher_;
-
- GTEST_DISALLOW_ASSIGN_(MatcherAsPredicate);
-};
-
-// For implementing ASSERT_THAT() and EXPECT_THAT(). The template
-// argument M must be a type that can be converted to a matcher.
-template <typename M>
-class PredicateFormatterFromMatcher {
- public:
- explicit PredicateFormatterFromMatcher(const M& m) : matcher_(m) {}
-
- // This template () operator allows a PredicateFormatterFromMatcher
- // object to act as a predicate-formatter suitable for using with
- // Google Test's EXPECT_PRED_FORMAT1() macro.
- template <typename T>
- AssertionResult operator()(const char* value_text, const T& x) const {
- // We convert matcher_ to a Matcher<const T&> *now* instead of
- // when the PredicateFormatterFromMatcher object was constructed,
- // as matcher_ may be polymorphic (e.g. NotNull()) and we won't
- // know which type to instantiate it to until we actually see the
- // type of x here.
- //
- // We write SafeMatcherCast<const T&>(matcher_) instead of
- // Matcher<const T&>(matcher_), as the latter won't compile when
- // matcher_ has type Matcher<T> (e.g. An<int>()).
- // We don't write MatcherCast<const T&> either, as that allows
- // potentially unsafe downcasting of the matcher argument.
- const Matcher<const T&> matcher = SafeMatcherCast<const T&>(matcher_);
- StringMatchResultListener listener;
- if (MatchPrintAndExplain(x, matcher, &listener))
- return AssertionSuccess();
-
- ::std::stringstream ss;
- ss << "Value of: " << value_text << "\n"
- << "Expected: ";
- matcher.DescribeTo(&ss);
- ss << "\n Actual: " << listener.str();
- return AssertionFailure() << ss.str();
- }
-
- private:
- const M matcher_;
-
- GTEST_DISALLOW_ASSIGN_(PredicateFormatterFromMatcher);
-};
-
-// A helper function for converting a matcher to a predicate-formatter
-// without the user needing to explicitly write the type. This is
-// used for implementing ASSERT_THAT() and EXPECT_THAT().
-template <typename M>
-inline PredicateFormatterFromMatcher<M>
-MakePredicateFormatterFromMatcher(const M& matcher) {
- return PredicateFormatterFromMatcher<M>(matcher);
-}
-
-// Implements the polymorphic floating point equality matcher, which matches
-// two float values using ULP-based approximation or, optionally, a
-// user-specified epsilon. The template is meant to be instantiated with
-// FloatType being either float or double.
-template <typename FloatType>
-class FloatingEqMatcher {
- public:
- // Constructor for FloatingEqMatcher.
- // The matcher's input will be compared with rhs. The matcher treats two
- // NANs as equal if nan_eq_nan is true. Otherwise, under IEEE standards,
- // equality comparisons between NANs will always return false. We specify a
- // negative max_abs_error_ term to indicate that ULP-based approximation will
- // be used for comparison.
- FloatingEqMatcher(FloatType rhs, bool nan_eq_nan) :
- rhs_(rhs), nan_eq_nan_(nan_eq_nan), max_abs_error_(-1) {
- }
-
- // Constructor that supports a user-specified max_abs_error that will be used
- // for comparison instead of ULP-based approximation. The max absolute
- // should be non-negative.
- FloatingEqMatcher(FloatType rhs, bool nan_eq_nan, FloatType max_abs_error) :
- rhs_(rhs), nan_eq_nan_(nan_eq_nan), max_abs_error_(max_abs_error) {
- GTEST_CHECK_(max_abs_error >= 0)
- << ", where max_abs_error is" << max_abs_error;
- }
-
- // Implements floating point equality matcher as a Matcher<T>.
- template <typename T>
- class Impl : public MatcherInterface<T> {
- public:
- Impl(FloatType rhs, bool nan_eq_nan, FloatType max_abs_error) :
- rhs_(rhs), nan_eq_nan_(nan_eq_nan), max_abs_error_(max_abs_error) {}
-
- virtual bool MatchAndExplain(T value,
- MatchResultListener* /* listener */) const {
- const FloatingPoint<FloatType> lhs(value), rhs(rhs_);
-
- // Compares NaNs first, if nan_eq_nan_ is true.
- if (lhs.is_nan() || rhs.is_nan()) {
- if (lhs.is_nan() && rhs.is_nan()) {
- return nan_eq_nan_;
- }
- // One is nan; the other is not nan.
- return false;
- }
- if (HasMaxAbsError()) {
- // We perform an equality check so that inf will match inf, regardless
- // of error bounds. If the result of value - rhs_ would result in
- // overflow or if either value is inf, the default result is infinity,
- // which should only match if max_abs_error_ is also infinity.
- return value == rhs_ || fabs(value - rhs_) <= max_abs_error_;
- } else {
- return lhs.AlmostEquals(rhs);
- }
- }
-
- virtual void DescribeTo(::std::ostream* os) const {
- // os->precision() returns the previously set precision, which we
- // store to restore the ostream to its original configuration
- // after outputting.
- const ::std::streamsize old_precision = os->precision(
- ::std::numeric_limits<FloatType>::digits10 + 2);
- if (FloatingPoint<FloatType>(rhs_).is_nan()) {
- if (nan_eq_nan_) {
- *os << "is NaN";
- } else {
- *os << "never matches";
- }
- } else {
- *os << "is approximately " << rhs_;
- if (HasMaxAbsError()) {
- *os << " (absolute error <= " << max_abs_error_ << ")";
- }
- }
- os->precision(old_precision);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- // As before, get original precision.
- const ::std::streamsize old_precision = os->precision(
- ::std::numeric_limits<FloatType>::digits10 + 2);
- if (FloatingPoint<FloatType>(rhs_).is_nan()) {
- if (nan_eq_nan_) {
- *os << "isn't NaN";
- } else {
- *os << "is anything";
- }
- } else {
- *os << "isn't approximately " << rhs_;
- if (HasMaxAbsError()) {
- *os << " (absolute error > " << max_abs_error_ << ")";
- }
- }
- // Restore original precision.
- os->precision(old_precision);
- }
-
- private:
- bool HasMaxAbsError() const {
- return max_abs_error_ >= 0;
- }
-
- const FloatType rhs_;
- const bool nan_eq_nan_;
- // max_abs_error will be used for value comparison when >= 0.
- const FloatType max_abs_error_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- // The following 3 type conversion operators allow FloatEq(rhs) and
- // NanSensitiveFloatEq(rhs) to be used as a Matcher<float>, a
- // Matcher<const float&>, or a Matcher<float&>, but nothing else.
- // (While Google's C++ coding style doesn't allow arguments passed
- // by non-const reference, we may see them in code not conforming to
- // the style. Therefore Google Mock needs to support them.)
- operator Matcher<FloatType>() const {
- return MakeMatcher(new Impl<FloatType>(rhs_, nan_eq_nan_, max_abs_error_));
- }
-
- operator Matcher<const FloatType&>() const {
- return MakeMatcher(
- new Impl<const FloatType&>(rhs_, nan_eq_nan_, max_abs_error_));
- }
-
- operator Matcher<FloatType&>() const {
- return MakeMatcher(new Impl<FloatType&>(rhs_, nan_eq_nan_, max_abs_error_));
- }
-
- private:
- const FloatType rhs_;
- const bool nan_eq_nan_;
- // max_abs_error will be used for value comparison when >= 0.
- const FloatType max_abs_error_;
-
- GTEST_DISALLOW_ASSIGN_(FloatingEqMatcher);
-};
-
-// Implements the Pointee(m) matcher for matching a pointer whose
-// pointee matches matcher m. The pointer can be either raw or smart.
-template <typename InnerMatcher>
-class PointeeMatcher {
- public:
- explicit PointeeMatcher(const InnerMatcher& matcher) : matcher_(matcher) {}
-
- // This type conversion operator template allows Pointee(m) to be
- // used as a matcher for any pointer type whose pointee type is
- // compatible with the inner matcher, where type Pointer can be
- // either a raw pointer or a smart pointer.
- //
- // The reason we do this instead of relying on
- // MakePolymorphicMatcher() is that the latter is not flexible
- // enough for implementing the DescribeTo() method of Pointee().
- template <typename Pointer>
- operator Matcher<Pointer>() const {
- return MakeMatcher(new Impl<Pointer>(matcher_));
- }
-
- private:
- // The monomorphic implementation that works for a particular pointer type.
- template <typename Pointer>
- class Impl : public MatcherInterface<Pointer> {
- public:
- typedef typename PointeeOf<GTEST_REMOVE_CONST_( // NOLINT
- GTEST_REMOVE_REFERENCE_(Pointer))>::type Pointee;
-
- explicit Impl(const InnerMatcher& matcher)
- : matcher_(MatcherCast<const Pointee&>(matcher)) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "points to a value that ";
- matcher_.DescribeTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "does not point to a value that ";
- matcher_.DescribeTo(os);
- }
-
- virtual bool MatchAndExplain(Pointer pointer,
- MatchResultListener* listener) const {
- if (GetRawPointer(pointer) == NULL)
- return false;
-
- *listener << "which points to ";
- return MatchPrintAndExplain(*pointer, matcher_, listener);
- }
-
- private:
- const Matcher<const Pointee&> matcher_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- const InnerMatcher matcher_;
-
- GTEST_DISALLOW_ASSIGN_(PointeeMatcher);
-};
-
-// Implements the Field() matcher for matching a field (i.e. member
-// variable) of an object.
-template <typename Class, typename FieldType>
-class FieldMatcher {
- public:
- FieldMatcher(FieldType Class::*field,
- const Matcher<const FieldType&>& matcher)
- : field_(field), matcher_(matcher) {}
-
- void DescribeTo(::std::ostream* os) const {
- *os << "is an object whose given field ";
- matcher_.DescribeTo(os);
- }
-
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "is an object whose given field ";
- matcher_.DescribeNegationTo(os);
- }
-
- template <typename T>
- bool MatchAndExplain(const T& value, MatchResultListener* listener) const {
- return MatchAndExplainImpl(
- typename ::testing::internal::
- is_pointer<GTEST_REMOVE_CONST_(T)>::type(),
- value, listener);
- }
-
- private:
- // The first argument of MatchAndExplainImpl() is needed to help
- // Symbian's C++ compiler choose which overload to use. Its type is
- // true_type iff the Field() matcher is used to match a pointer.
- bool MatchAndExplainImpl(false_type /* is_not_pointer */, const Class& obj,
- MatchResultListener* listener) const {
- *listener << "whose given field is ";
- return MatchPrintAndExplain(obj.*field_, matcher_, listener);
- }
-
- bool MatchAndExplainImpl(true_type /* is_pointer */, const Class* p,
- MatchResultListener* listener) const {
- if (p == NULL)
- return false;
-
- *listener << "which points to an object ";
- // Since *p has a field, it must be a class/struct/union type and
- // thus cannot be a pointer. Therefore we pass false_type() as
- // the first argument.
- return MatchAndExplainImpl(false_type(), *p, listener);
- }
-
- const FieldType Class::*field_;
- const Matcher<const FieldType&> matcher_;
-
- GTEST_DISALLOW_ASSIGN_(FieldMatcher);
-};
-
-// Implements the Property() matcher for matching a property
-// (i.e. return value of a getter method) of an object.
-template <typename Class, typename PropertyType>
-class PropertyMatcher {
- public:
- // The property may have a reference type, so 'const PropertyType&'
- // may cause double references and fail to compile. That's why we
- // need GTEST_REFERENCE_TO_CONST, which works regardless of
- // PropertyType being a reference or not.
- typedef GTEST_REFERENCE_TO_CONST_(PropertyType) RefToConstProperty;
-
- PropertyMatcher(PropertyType (Class::*property)() const,
- const Matcher<RefToConstProperty>& matcher)
- : property_(property), matcher_(matcher) {}
-
- void DescribeTo(::std::ostream* os) const {
- *os << "is an object whose given property ";
- matcher_.DescribeTo(os);
- }
-
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "is an object whose given property ";
- matcher_.DescribeNegationTo(os);
- }
-
- template <typename T>
- bool MatchAndExplain(const T&value, MatchResultListener* listener) const {
- return MatchAndExplainImpl(
- typename ::testing::internal::
- is_pointer<GTEST_REMOVE_CONST_(T)>::type(),
- value, listener);
- }
-
- private:
- // The first argument of MatchAndExplainImpl() is needed to help
- // Symbian's C++ compiler choose which overload to use. Its type is
- // true_type iff the Property() matcher is used to match a pointer.
- bool MatchAndExplainImpl(false_type /* is_not_pointer */, const Class& obj,
- MatchResultListener* listener) const {
- *listener << "whose given property is ";
- // Cannot pass the return value (for example, int) to MatchPrintAndExplain,
- // which takes a non-const reference as argument.
- RefToConstProperty result = (obj.*property_)();
- return MatchPrintAndExplain(result, matcher_, listener);
- }
-
- bool MatchAndExplainImpl(true_type /* is_pointer */, const Class* p,
- MatchResultListener* listener) const {
- if (p == NULL)
- return false;
-
- *listener << "which points to an object ";
- // Since *p has a property method, it must be a class/struct/union
- // type and thus cannot be a pointer. Therefore we pass
- // false_type() as the first argument.
- return MatchAndExplainImpl(false_type(), *p, listener);
- }
-
- PropertyType (Class::*property_)() const;
- const Matcher<RefToConstProperty> matcher_;
-
- GTEST_DISALLOW_ASSIGN_(PropertyMatcher);
-};
-
-// Type traits specifying various features of different functors for ResultOf.
-// The default template specifies features for functor objects.
-// Functor classes have to typedef argument_type and result_type
-// to be compatible with ResultOf.
-template <typename Functor>
-struct CallableTraits {
- typedef typename Functor::result_type ResultType;
- typedef Functor StorageType;
-
- static void CheckIsValid(Functor /* functor */) {}
- template <typename T>
- static ResultType Invoke(Functor f, T arg) { return f(arg); }
-};
-
-// Specialization for function pointers.
-template <typename ArgType, typename ResType>
-struct CallableTraits<ResType(*)(ArgType)> {
- typedef ResType ResultType;
- typedef ResType(*StorageType)(ArgType);
-
- static void CheckIsValid(ResType(*f)(ArgType)) {
- GTEST_CHECK_(f != NULL)
- << "NULL function pointer is passed into ResultOf().";
- }
- template <typename T>
- static ResType Invoke(ResType(*f)(ArgType), T arg) {
- return (*f)(arg);
- }
-};
-
-// Implements the ResultOf() matcher for matching a return value of a
-// unary function of an object.
-template <typename Callable>
-class ResultOfMatcher {
- public:
- typedef typename CallableTraits<Callable>::ResultType ResultType;
-
- ResultOfMatcher(Callable callable, const Matcher<ResultType>& matcher)
- : callable_(callable), matcher_(matcher) {
- CallableTraits<Callable>::CheckIsValid(callable_);
- }
-
- template <typename T>
- operator Matcher<T>() const {
- return Matcher<T>(new Impl<T>(callable_, matcher_));
- }
-
- private:
- typedef typename CallableTraits<Callable>::StorageType CallableStorageType;
-
- template <typename T>
- class Impl : public MatcherInterface<T> {
- public:
- Impl(CallableStorageType callable, const Matcher<ResultType>& matcher)
- : callable_(callable), matcher_(matcher) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "is mapped by the given callable to a value that ";
- matcher_.DescribeTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "is mapped by the given callable to a value that ";
- matcher_.DescribeNegationTo(os);
- }
-
- virtual bool MatchAndExplain(T obj, MatchResultListener* listener) const {
- *listener << "which is mapped by the given callable to ";
- // Cannot pass the return value (for example, int) to
- // MatchPrintAndExplain, which takes a non-const reference as argument.
- ResultType result =
- CallableTraits<Callable>::template Invoke<T>(callable_, obj);
- return MatchPrintAndExplain(result, matcher_, listener);
- }
-
- private:
- // Functors often define operator() as non-const method even though
- // they are actualy stateless. But we need to use them even when
- // 'this' is a const pointer. It's the user's responsibility not to
- // use stateful callables with ResultOf(), which does't guarantee
- // how many times the callable will be invoked.
- mutable CallableStorageType callable_;
- const Matcher<ResultType> matcher_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- }; // class Impl
-
- const CallableStorageType callable_;
- const Matcher<ResultType> matcher_;
-
- GTEST_DISALLOW_ASSIGN_(ResultOfMatcher);
-};
-
-// Implements a matcher that checks the size of an STL-style container.
-template <typename SizeMatcher>
-class SizeIsMatcher {
- public:
- explicit SizeIsMatcher(const SizeMatcher& size_matcher)
- : size_matcher_(size_matcher) {
- }
-
- template <typename Container>
- operator Matcher<Container>() const {
- return MakeMatcher(new Impl<Container>(size_matcher_));
- }
-
- template <typename Container>
- class Impl : public MatcherInterface<Container> {
- public:
- typedef internal::StlContainerView<
- GTEST_REMOVE_REFERENCE_AND_CONST_(Container)> ContainerView;
- typedef typename ContainerView::type::size_type SizeType;
- explicit Impl(const SizeMatcher& size_matcher)
- : size_matcher_(MatcherCast<SizeType>(size_matcher)) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "size ";
- size_matcher_.DescribeTo(os);
- }
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "size ";
- size_matcher_.DescribeNegationTo(os);
- }
-
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
- SizeType size = container.size();
- StringMatchResultListener size_listener;
- const bool result = size_matcher_.MatchAndExplain(size, &size_listener);
- *listener
- << "whose size " << size << (result ? " matches" : " doesn't match");
- PrintIfNotEmpty(size_listener.str(), listener->stream());
- return result;
- }
-
- private:
- const Matcher<SizeType> size_matcher_;
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- private:
- const SizeMatcher size_matcher_;
- GTEST_DISALLOW_ASSIGN_(SizeIsMatcher);
-};
-
-// Implements an equality matcher for any STL-style container whose elements
-// support ==. This matcher is like Eq(), but its failure explanations provide
-// more detailed information that is useful when the container is used as a set.
-// The failure message reports elements that are in one of the operands but not
-// the other. The failure messages do not report duplicate or out-of-order
-// elements in the containers (which don't properly matter to sets, but can
-// occur if the containers are vectors or lists, for example).
-//
-// Uses the container's const_iterator, value_type, operator ==,
-// begin(), and end().
-template <typename Container>
-class ContainerEqMatcher {
- public:
- typedef internal::StlContainerView<Container> View;
- typedef typename View::type StlContainer;
- typedef typename View::const_reference StlContainerReference;
-
- // We make a copy of rhs in case the elements in it are modified
- // after this matcher is created.
- explicit ContainerEqMatcher(const Container& rhs) : rhs_(View::Copy(rhs)) {
- // Makes sure the user doesn't instantiate this class template
- // with a const or reference type.
- (void)testing::StaticAssertTypeEq<Container,
- GTEST_REMOVE_REFERENCE_AND_CONST_(Container)>();
- }
-
- void DescribeTo(::std::ostream* os) const {
- *os << "equals ";
- UniversalPrint(rhs_, os);
- }
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "does not equal ";
- UniversalPrint(rhs_, os);
- }
-
- template <typename LhsContainer>
- bool MatchAndExplain(const LhsContainer& lhs,
- MatchResultListener* listener) const {
- // GTEST_REMOVE_CONST_() is needed to work around an MSVC 8.0 bug
- // that causes LhsContainer to be a const type sometimes.
- typedef internal::StlContainerView<GTEST_REMOVE_CONST_(LhsContainer)>
- LhsView;
- typedef typename LhsView::type LhsStlContainer;
- StlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
- if (lhs_stl_container == rhs_)
- return true;
-
- ::std::ostream* const os = listener->stream();
- if (os != NULL) {
- // Something is different. Check for extra values first.
- bool printed_header = false;
- for (typename LhsStlContainer::const_iterator it =
- lhs_stl_container.begin();
- it != lhs_stl_container.end(); ++it) {
- if (internal::ArrayAwareFind(rhs_.begin(), rhs_.end(), *it) ==
- rhs_.end()) {
- if (printed_header) {
- *os << ", ";
- } else {
- *os << "which has these unexpected elements: ";
- printed_header = true;
- }
- UniversalPrint(*it, os);
- }
- }
-
- // Now check for missing values.
- bool printed_header2 = false;
- for (typename StlContainer::const_iterator it = rhs_.begin();
- it != rhs_.end(); ++it) {
- if (internal::ArrayAwareFind(
- lhs_stl_container.begin(), lhs_stl_container.end(), *it) ==
- lhs_stl_container.end()) {
- if (printed_header2) {
- *os << ", ";
- } else {
- *os << (printed_header ? ",\nand" : "which")
- << " doesn't have these expected elements: ";
- printed_header2 = true;
- }
- UniversalPrint(*it, os);
- }
- }
- }
-
- return false;
- }
-
- private:
- const StlContainer rhs_;
-
- GTEST_DISALLOW_ASSIGN_(ContainerEqMatcher);
-};
-
-// A comparator functor that uses the < operator to compare two values.
-struct LessComparator {
- template <typename T, typename U>
- bool operator()(const T& lhs, const U& rhs) const { return lhs < rhs; }
-};
-
-// Implements WhenSortedBy(comparator, container_matcher).
-template <typename Comparator, typename ContainerMatcher>
-class WhenSortedByMatcher {
- public:
- WhenSortedByMatcher(const Comparator& comparator,
- const ContainerMatcher& matcher)
- : comparator_(comparator), matcher_(matcher) {}
-
- template <typename LhsContainer>
- operator Matcher<LhsContainer>() const {
- return MakeMatcher(new Impl<LhsContainer>(comparator_, matcher_));
- }
-
- template <typename LhsContainer>
- class Impl : public MatcherInterface<LhsContainer> {
- public:
- typedef internal::StlContainerView<
- GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView;
- typedef typename LhsView::type LhsStlContainer;
- typedef typename LhsView::const_reference LhsStlContainerReference;
- // Transforms std::pair<const Key, Value> into std::pair<Key, Value>
- // so that we can match associative containers.
- typedef typename RemoveConstFromKey<
- typename LhsStlContainer::value_type>::type LhsValue;
-
- Impl(const Comparator& comparator, const ContainerMatcher& matcher)
- : comparator_(comparator), matcher_(matcher) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "(when sorted) ";
- matcher_.DescribeTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "(when sorted) ";
- matcher_.DescribeNegationTo(os);
- }
-
- virtual bool MatchAndExplain(LhsContainer lhs,
- MatchResultListener* listener) const {
- LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
- ::std::vector<LhsValue> sorted_container(lhs_stl_container.begin(),
- lhs_stl_container.end());
- ::std::sort(
- sorted_container.begin(), sorted_container.end(), comparator_);
-
- if (!listener->IsInterested()) {
- // If the listener is not interested, we do not need to
- // construct the inner explanation.
- return matcher_.Matches(sorted_container);
- }
-
- *listener << "which is ";
- UniversalPrint(sorted_container, listener->stream());
- *listener << " when sorted";
-
- StringMatchResultListener inner_listener;
- const bool match = matcher_.MatchAndExplain(sorted_container,
- &inner_listener);
- PrintIfNotEmpty(inner_listener.str(), listener->stream());
- return match;
- }
-
- private:
- const Comparator comparator_;
- const Matcher<const ::std::vector<LhsValue>&> matcher_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl);
- };
-
- private:
- const Comparator comparator_;
- const ContainerMatcher matcher_;
-
- GTEST_DISALLOW_ASSIGN_(WhenSortedByMatcher);
-};
-
-// Implements Pointwise(tuple_matcher, rhs_container). tuple_matcher
-// must be able to be safely cast to Matcher<tuple<const T1&, const
-// T2&> >, where T1 and T2 are the types of elements in the LHS
-// container and the RHS container respectively.
-template <typename TupleMatcher, typename RhsContainer>
-class PointwiseMatcher {
- public:
- typedef internal::StlContainerView<RhsContainer> RhsView;
- typedef typename RhsView::type RhsStlContainer;
- typedef typename RhsStlContainer::value_type RhsValue;
-
- // Like ContainerEq, we make a copy of rhs in case the elements in
- // it are modified after this matcher is created.
- PointwiseMatcher(const TupleMatcher& tuple_matcher, const RhsContainer& rhs)
- : tuple_matcher_(tuple_matcher), rhs_(RhsView::Copy(rhs)) {
- // Makes sure the user doesn't instantiate this class template
- // with a const or reference type.
- (void)testing::StaticAssertTypeEq<RhsContainer,
- GTEST_REMOVE_REFERENCE_AND_CONST_(RhsContainer)>();
- }
-
- template <typename LhsContainer>
- operator Matcher<LhsContainer>() const {
- return MakeMatcher(new Impl<LhsContainer>(tuple_matcher_, rhs_));
- }
-
- template <typename LhsContainer>
- class Impl : public MatcherInterface<LhsContainer> {
- public:
- typedef internal::StlContainerView<
- GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView;
- typedef typename LhsView::type LhsStlContainer;
- typedef typename LhsView::const_reference LhsStlContainerReference;
- typedef typename LhsStlContainer::value_type LhsValue;
- // We pass the LHS value and the RHS value to the inner matcher by
- // reference, as they may be expensive to copy. We must use tuple
- // instead of pair here, as a pair cannot hold references (C++ 98,
- // 20.2.2 [lib.pairs]).
- typedef ::std::tr1::tuple<const LhsValue&, const RhsValue&> InnerMatcherArg;
-
- Impl(const TupleMatcher& tuple_matcher, const RhsStlContainer& rhs)
- // mono_tuple_matcher_ holds a monomorphic version of the tuple matcher.
- : mono_tuple_matcher_(SafeMatcherCast<InnerMatcherArg>(tuple_matcher)),
- rhs_(rhs) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "contains " << rhs_.size()
- << " values, where each value and its corresponding value in ";
- UniversalPrinter<RhsStlContainer>::Print(rhs_, os);
- *os << " ";
- mono_tuple_matcher_.DescribeTo(os);
- }
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "doesn't contain exactly " << rhs_.size()
- << " values, or contains a value x at some index i"
- << " where x and the i-th value of ";
- UniversalPrint(rhs_, os);
- *os << " ";
- mono_tuple_matcher_.DescribeNegationTo(os);
- }
-
- virtual bool MatchAndExplain(LhsContainer lhs,
- MatchResultListener* listener) const {
- LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
- const size_t actual_size = lhs_stl_container.size();
- if (actual_size != rhs_.size()) {
- *listener << "which contains " << actual_size << " values";
- return false;
- }
-
- typename LhsStlContainer::const_iterator left = lhs_stl_container.begin();
- typename RhsStlContainer::const_iterator right = rhs_.begin();
- for (size_t i = 0; i != actual_size; ++i, ++left, ++right) {
- const InnerMatcherArg value_pair(*left, *right);
-
- if (listener->IsInterested()) {
- StringMatchResultListener inner_listener;
- if (!mono_tuple_matcher_.MatchAndExplain(
- value_pair, &inner_listener)) {
- *listener << "where the value pair (";
- UniversalPrint(*left, listener->stream());
- *listener << ", ";
- UniversalPrint(*right, listener->stream());
- *listener << ") at index #" << i << " don't match";
- PrintIfNotEmpty(inner_listener.str(), listener->stream());
- return false;
- }
- } else {
- if (!mono_tuple_matcher_.Matches(value_pair))
- return false;
- }
- }
-
- return true;
- }
-
- private:
- const Matcher<InnerMatcherArg> mono_tuple_matcher_;
- const RhsStlContainer rhs_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- private:
- const TupleMatcher tuple_matcher_;
- const RhsStlContainer rhs_;
-
- GTEST_DISALLOW_ASSIGN_(PointwiseMatcher);
-};
-
-// Holds the logic common to ContainsMatcherImpl and EachMatcherImpl.
-template <typename Container>
-class QuantifierMatcherImpl : public MatcherInterface<Container> {
- public:
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
- typedef StlContainerView<RawContainer> View;
- typedef typename View::type StlContainer;
- typedef typename View::const_reference StlContainerReference;
- typedef typename StlContainer::value_type Element;
-
- template <typename InnerMatcher>
- explicit QuantifierMatcherImpl(InnerMatcher inner_matcher)
- : inner_matcher_(
- testing::SafeMatcherCast<const Element&>(inner_matcher)) {}
-
- // Checks whether:
- // * All elements in the container match, if all_elements_should_match.
- // * Any element in the container matches, if !all_elements_should_match.
- bool MatchAndExplainImpl(bool all_elements_should_match,
- Container container,
- MatchResultListener* listener) const {
- StlContainerReference stl_container = View::ConstReference(container);
- size_t i = 0;
- for (typename StlContainer::const_iterator it = stl_container.begin();
- it != stl_container.end(); ++it, ++i) {
- StringMatchResultListener inner_listener;
- const bool matches = inner_matcher_.MatchAndExplain(*it, &inner_listener);
-
- if (matches != all_elements_should_match) {
- *listener << "whose element #" << i
- << (matches ? " matches" : " doesn't match");
- PrintIfNotEmpty(inner_listener.str(), listener->stream());
- return !all_elements_should_match;
- }
- }
- return all_elements_should_match;
- }
-
- protected:
- const Matcher<const Element&> inner_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(QuantifierMatcherImpl);
-};
-
-// Implements Contains(element_matcher) for the given argument type Container.
-// Symmetric to EachMatcherImpl.
-template <typename Container>
-class ContainsMatcherImpl : public QuantifierMatcherImpl<Container> {
- public:
- template <typename InnerMatcher>
- explicit ContainsMatcherImpl(InnerMatcher inner_matcher)
- : QuantifierMatcherImpl<Container>(inner_matcher) {}
-
- // Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "contains at least one element that ";
- this->inner_matcher_.DescribeTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "doesn't contain any element that ";
- this->inner_matcher_.DescribeTo(os);
- }
-
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
- return this->MatchAndExplainImpl(false, container, listener);
- }
-
- private:
- GTEST_DISALLOW_ASSIGN_(ContainsMatcherImpl);
-};
-
-// Implements Each(element_matcher) for the given argument type Container.
-// Symmetric to ContainsMatcherImpl.
-template <typename Container>
-class EachMatcherImpl : public QuantifierMatcherImpl<Container> {
- public:
- template <typename InnerMatcher>
- explicit EachMatcherImpl(InnerMatcher inner_matcher)
- : QuantifierMatcherImpl<Container>(inner_matcher) {}
-
- // Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "only contains elements that ";
- this->inner_matcher_.DescribeTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "contains some element that ";
- this->inner_matcher_.DescribeNegationTo(os);
- }
-
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
- return this->MatchAndExplainImpl(true, container, listener);
- }
-
- private:
- GTEST_DISALLOW_ASSIGN_(EachMatcherImpl);
-};
-
-// Implements polymorphic Contains(element_matcher).
-template <typename M>
-class ContainsMatcher {
- public:
- explicit ContainsMatcher(M m) : inner_matcher_(m) {}
-
- template <typename Container>
- operator Matcher<Container>() const {
- return MakeMatcher(new ContainsMatcherImpl<Container>(inner_matcher_));
- }
-
- private:
- const M inner_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(ContainsMatcher);
-};
-
-// Implements polymorphic Each(element_matcher).
-template <typename M>
-class EachMatcher {
- public:
- explicit EachMatcher(M m) : inner_matcher_(m) {}
-
- template <typename Container>
- operator Matcher<Container>() const {
- return MakeMatcher(new EachMatcherImpl<Container>(inner_matcher_));
- }
-
- private:
- const M inner_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(EachMatcher);
-};
-
-// Implements Key(inner_matcher) for the given argument pair type.
-// Key(inner_matcher) matches an std::pair whose 'first' field matches
-// inner_matcher. For example, Contains(Key(Ge(5))) can be used to match an
-// std::map that contains at least one element whose key is >= 5.
-template <typename PairType>
-class KeyMatcherImpl : public MatcherInterface<PairType> {
- public:
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(PairType) RawPairType;
- typedef typename RawPairType::first_type KeyType;
-
- template <typename InnerMatcher>
- explicit KeyMatcherImpl(InnerMatcher inner_matcher)
- : inner_matcher_(
- testing::SafeMatcherCast<const KeyType&>(inner_matcher)) {
- }
-
- // Returns true iff 'key_value.first' (the key) matches the inner matcher.
- virtual bool MatchAndExplain(PairType key_value,
- MatchResultListener* listener) const {
- StringMatchResultListener inner_listener;
- const bool match = inner_matcher_.MatchAndExplain(key_value.first,
- &inner_listener);
- const internal::string explanation = inner_listener.str();
- if (explanation != "") {
- *listener << "whose first field is a value " << explanation;
- }
- return match;
- }
-
- // Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "has a key that ";
- inner_matcher_.DescribeTo(os);
- }
-
- // Describes what the negation of this matcher does.
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "doesn't have a key that ";
- inner_matcher_.DescribeTo(os);
- }
-
- private:
- const Matcher<const KeyType&> inner_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(KeyMatcherImpl);
-};
-
-// Implements polymorphic Key(matcher_for_key).
-template <typename M>
-class KeyMatcher {
- public:
- explicit KeyMatcher(M m) : matcher_for_key_(m) {}
-
- template <typename PairType>
- operator Matcher<PairType>() const {
- return MakeMatcher(new KeyMatcherImpl<PairType>(matcher_for_key_));
- }
-
- private:
- const M matcher_for_key_;
-
- GTEST_DISALLOW_ASSIGN_(KeyMatcher);
-};
-
-// Implements Pair(first_matcher, second_matcher) for the given argument pair
-// type with its two matchers. See Pair() function below.
-template <typename PairType>
-class PairMatcherImpl : public MatcherInterface<PairType> {
- public:
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(PairType) RawPairType;
- typedef typename RawPairType::first_type FirstType;
- typedef typename RawPairType::second_type SecondType;
-
- template <typename FirstMatcher, typename SecondMatcher>
- PairMatcherImpl(FirstMatcher first_matcher, SecondMatcher second_matcher)
- : first_matcher_(
- testing::SafeMatcherCast<const FirstType&>(first_matcher)),
- second_matcher_(
- testing::SafeMatcherCast<const SecondType&>(second_matcher)) {
- }
-
- // Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "has a first field that ";
- first_matcher_.DescribeTo(os);
- *os << ", and has a second field that ";
- second_matcher_.DescribeTo(os);
- }
-
- // Describes what the negation of this matcher does.
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "has a first field that ";
- first_matcher_.DescribeNegationTo(os);
- *os << ", or has a second field that ";
- second_matcher_.DescribeNegationTo(os);
- }
-
- // Returns true iff 'a_pair.first' matches first_matcher and 'a_pair.second'
- // matches second_matcher.
- virtual bool MatchAndExplain(PairType a_pair,
- MatchResultListener* listener) const {
- if (!listener->IsInterested()) {
- // If the listener is not interested, we don't need to construct the
- // explanation.
- return first_matcher_.Matches(a_pair.first) &&
- second_matcher_.Matches(a_pair.second);
- }
- StringMatchResultListener first_inner_listener;
- if (!first_matcher_.MatchAndExplain(a_pair.first,
- &first_inner_listener)) {
- *listener << "whose first field does not match";
- PrintIfNotEmpty(first_inner_listener.str(), listener->stream());
- return false;
- }
- StringMatchResultListener second_inner_listener;
- if (!second_matcher_.MatchAndExplain(a_pair.second,
- &second_inner_listener)) {
- *listener << "whose second field does not match";
- PrintIfNotEmpty(second_inner_listener.str(), listener->stream());
- return false;
- }
- ExplainSuccess(first_inner_listener.str(), second_inner_listener.str(),
- listener);
- return true;
- }
-
- private:
- void ExplainSuccess(const internal::string& first_explanation,
- const internal::string& second_explanation,
- MatchResultListener* listener) const {
- *listener << "whose both fields match";
- if (first_explanation != "") {
- *listener << ", where the first field is a value " << first_explanation;
- }
- if (second_explanation != "") {
- *listener << ", ";
- if (first_explanation != "") {
- *listener << "and ";
- } else {
- *listener << "where ";
- }
- *listener << "the second field is a value " << second_explanation;
- }
- }
-
- const Matcher<const FirstType&> first_matcher_;
- const Matcher<const SecondType&> second_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(PairMatcherImpl);
-};
-
-// Implements polymorphic Pair(first_matcher, second_matcher).
-template <typename FirstMatcher, typename SecondMatcher>
-class PairMatcher {
- public:
- PairMatcher(FirstMatcher first_matcher, SecondMatcher second_matcher)
- : first_matcher_(first_matcher), second_matcher_(second_matcher) {}
-
- template <typename PairType>
- operator Matcher<PairType> () const {
- return MakeMatcher(
- new PairMatcherImpl<PairType>(
- first_matcher_, second_matcher_));
- }
-
- private:
- const FirstMatcher first_matcher_;
- const SecondMatcher second_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(PairMatcher);
-};
-
-// Implements ElementsAre() and ElementsAreArray().
-template <typename Container>
-class ElementsAreMatcherImpl : public MatcherInterface<Container> {
- public:
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
- typedef internal::StlContainerView<RawContainer> View;
- typedef typename View::type StlContainer;
- typedef typename View::const_reference StlContainerReference;
- typedef typename StlContainer::value_type Element;
-
- // Constructs the matcher from a sequence of element values or
- // element matchers.
- template <typename InputIter>
- ElementsAreMatcherImpl(InputIter first, InputIter last) {
- while (first != last) {
- matchers_.push_back(MatcherCast<const Element&>(*first++));
- }
- }
-
- // Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
- if (count() == 0) {
- *os << "is empty";
- } else if (count() == 1) {
- *os << "has 1 element that ";
- matchers_[0].DescribeTo(os);
- } else {
- *os << "has " << Elements(count()) << " where\n";
- for (size_t i = 0; i != count(); ++i) {
- *os << "element #" << i << " ";
- matchers_[i].DescribeTo(os);
- if (i + 1 < count()) {
- *os << ",\n";
- }
- }
- }
- }
-
- // Describes what the negation of this matcher does.
- virtual void DescribeNegationTo(::std::ostream* os) const {
- if (count() == 0) {
- *os << "isn't empty";
- return;
- }
-
- *os << "doesn't have " << Elements(count()) << ", or\n";
- for (size_t i = 0; i != count(); ++i) {
- *os << "element #" << i << " ";
- matchers_[i].DescribeNegationTo(os);
- if (i + 1 < count()) {
- *os << ", or\n";
- }
- }
- }
-
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
- // To work with stream-like "containers", we must only walk
- // through the elements in one pass.
-
- const bool listener_interested = listener->IsInterested();
-
- // explanations[i] is the explanation of the element at index i.
- ::std::vector<internal::string> explanations(count());
- StlContainerReference stl_container = View::ConstReference(container);
- typename StlContainer::const_iterator it = stl_container.begin();
- size_t exam_pos = 0;
- bool mismatch_found = false; // Have we found a mismatched element yet?
-
- // Go through the elements and matchers in pairs, until we reach
- // the end of either the elements or the matchers, or until we find a
- // mismatch.
- for (; it != stl_container.end() && exam_pos != count(); ++it, ++exam_pos) {
- bool match; // Does the current element match the current matcher?
- if (listener_interested) {
- StringMatchResultListener s;
- match = matchers_[exam_pos].MatchAndExplain(*it, &s);
- explanations[exam_pos] = s.str();
- } else {
- match = matchers_[exam_pos].Matches(*it);
- }
-
- if (!match) {
- mismatch_found = true;
- break;
- }
- }
- // If mismatch_found is true, 'exam_pos' is the index of the mismatch.
-
- // Find how many elements the actual container has. We avoid
- // calling size() s.t. this code works for stream-like "containers"
- // that don't define size().
- size_t actual_count = exam_pos;
- for (; it != stl_container.end(); ++it) {
- ++actual_count;
- }
-
- if (actual_count != count()) {
- // The element count doesn't match. If the container is empty,
- // there's no need to explain anything as Google Mock already
- // prints the empty container. Otherwise we just need to show
- // how many elements there actually are.
- if (listener_interested && (actual_count != 0)) {
- *listener << "which has " << Elements(actual_count);
- }
- return false;
- }
-
- if (mismatch_found) {
- // The element count matches, but the exam_pos-th element doesn't match.
- if (listener_interested) {
- *listener << "whose element #" << exam_pos << " doesn't match";
- PrintIfNotEmpty(explanations[exam_pos], listener->stream());
- }
- return false;
- }
-
- // Every element matches its expectation. We need to explain why
- // (the obvious ones can be skipped).
- if (listener_interested) {
- bool reason_printed = false;
- for (size_t i = 0; i != count(); ++i) {
- const internal::string& s = explanations[i];
- if (!s.empty()) {
- if (reason_printed) {
- *listener << ",\nand ";
- }
- *listener << "whose element #" << i << " matches, " << s;
- reason_printed = true;
- }
- }
- }
- return true;
- }
-
- private:
- static Message Elements(size_t count) {
- return Message() << count << (count == 1 ? " element" : " elements");
- }
-
- size_t count() const { return matchers_.size(); }
-
- ::std::vector<Matcher<const Element&> > matchers_;
-
- GTEST_DISALLOW_ASSIGN_(ElementsAreMatcherImpl);
-};
-
-// Connectivity matrix of (elements X matchers), in element-major order.
-// Initially, there are no edges.
-// Use NextGraph() to iterate over all possible edge configurations.
-// Use Randomize() to generate a random edge configuration.
-class GTEST_API_ MatchMatrix {
- public:
- MatchMatrix(size_t num_elements, size_t num_matchers)
- : num_elements_(num_elements),
- num_matchers_(num_matchers),
- matched_(num_elements_* num_matchers_, 0) {
- }
-
- size_t LhsSize() const { return num_elements_; }
- size_t RhsSize() const { return num_matchers_; }
- bool HasEdge(size_t ilhs, size_t irhs) const {
- return matched_[SpaceIndex(ilhs, irhs)] == 1;
- }
- void SetEdge(size_t ilhs, size_t irhs, bool b) {
- matched_[SpaceIndex(ilhs, irhs)] = b ? 1 : 0;
- }
-
- // Treating the connectivity matrix as a (LhsSize()*RhsSize())-bit number,
- // adds 1 to that number; returns false if incrementing the graph left it
- // empty.
- bool NextGraph();
-
- void Randomize();
-
- string DebugString() const;
-
- private:
- size_t SpaceIndex(size_t ilhs, size_t irhs) const {
- return ilhs * num_matchers_ + irhs;
- }
-
- size_t num_elements_;
- size_t num_matchers_;
-
- // Each element is a char interpreted as bool. They are stored as a
- // flattened array in lhs-major order, use 'SpaceIndex()' to translate
- // a (ilhs, irhs) matrix coordinate into an offset.
- ::std::vector<char> matched_;
-};
-
-typedef ::std::pair<size_t, size_t> ElementMatcherPair;
-typedef ::std::vector<ElementMatcherPair> ElementMatcherPairs;
-
-// Returns a maximum bipartite matching for the specified graph 'g'.
-// The matching is represented as a vector of {element, matcher} pairs.
-GTEST_API_ ElementMatcherPairs
-FindMaxBipartiteMatching(const MatchMatrix& g);
-
-GTEST_API_ bool FindPairing(const MatchMatrix& matrix,
- MatchResultListener* listener);
-
-// Untyped base class for implementing UnorderedElementsAre. By
-// putting logic that's not specific to the element type here, we
-// reduce binary bloat and increase compilation speed.
-class GTEST_API_ UnorderedElementsAreMatcherImplBase {
- protected:
- // A vector of matcher describers, one for each element matcher.
- // Does not own the describers (and thus can be used only when the
- // element matchers are alive).
- typedef ::std::vector<const MatcherDescriberInterface*> MatcherDescriberVec;
-
- // Describes this UnorderedElementsAre matcher.
- void DescribeToImpl(::std::ostream* os) const;
-
- // Describes the negation of this UnorderedElementsAre matcher.
- void DescribeNegationToImpl(::std::ostream* os) const;
-
- bool VerifyAllElementsAndMatchersAreMatched(
- const ::std::vector<string>& element_printouts,
- const MatchMatrix& matrix,
- MatchResultListener* listener) const;
-
- MatcherDescriberVec& matcher_describers() {
- return matcher_describers_;
- }
-
- static Message Elements(size_t n) {
- return Message() << n << " element" << (n == 1 ? "" : "s");
- }
-
- private:
- MatcherDescriberVec matcher_describers_;
-
- GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcherImplBase);
-};
-
-// Implements unordered ElementsAre and unordered ElementsAreArray.
-template <typename Container>
-class UnorderedElementsAreMatcherImpl
- : public MatcherInterface<Container>,
- public UnorderedElementsAreMatcherImplBase {
- public:
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
- typedef internal::StlContainerView<RawContainer> View;
- typedef typename View::type StlContainer;
- typedef typename View::const_reference StlContainerReference;
- typedef typename StlContainer::const_iterator StlContainerConstIterator;
- typedef typename StlContainer::value_type Element;
-
- // Constructs the matcher from a sequence of element values or
- // element matchers.
- template <typename InputIter>
- UnorderedElementsAreMatcherImpl(InputIter first, InputIter last) {
- for (; first != last; ++first) {
- matchers_.push_back(MatcherCast<const Element&>(*first));
- matcher_describers().push_back(matchers_.back().GetDescriber());
- }
- }
-
- // Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
- return UnorderedElementsAreMatcherImplBase::DescribeToImpl(os);
- }
-
- // Describes what the negation of this matcher does.
- virtual void DescribeNegationTo(::std::ostream* os) const {
- return UnorderedElementsAreMatcherImplBase::DescribeNegationToImpl(os);
- }
-
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
- StlContainerReference stl_container = View::ConstReference(container);
- ::std::vector<string> element_printouts;
- MatchMatrix matrix = AnalyzeElements(stl_container.begin(),
- stl_container.end(),
- &element_printouts,
- listener);
-
- const size_t actual_count = matrix.LhsSize();
- if (actual_count == 0 && matchers_.empty()) {
- return true;
- }
- if (actual_count != matchers_.size()) {
- // The element count doesn't match. If the container is empty,
- // there's no need to explain anything as Google Mock already
- // prints the empty container. Otherwise we just need to show
- // how many elements there actually are.
- if (actual_count != 0 && listener->IsInterested()) {
- *listener << "which has " << Elements(actual_count);
- }
- return false;
- }
-
- return VerifyAllElementsAndMatchersAreMatched(element_printouts,
- matrix, listener) &&
- FindPairing(matrix, listener);
- }
-
- private:
- typedef ::std::vector<Matcher<const Element&> > MatcherVec;
-
- template <typename ElementIter>
- MatchMatrix AnalyzeElements(ElementIter elem_first, ElementIter elem_last,
- ::std::vector<string>* element_printouts,
- MatchResultListener* listener) const {
- element_printouts->clear();
- ::std::vector<char> did_match;
- size_t num_elements = 0;
- for (; elem_first != elem_last; ++num_elements, ++elem_first) {
- if (listener->IsInterested()) {
- element_printouts->push_back(PrintToString(*elem_first));
- }
- for (size_t irhs = 0; irhs != matchers_.size(); ++irhs) {
- did_match.push_back(Matches(matchers_[irhs])(*elem_first));
- }
- }
-
- MatchMatrix matrix(num_elements, matchers_.size());
- ::std::vector<char>::const_iterator did_match_iter = did_match.begin();
- for (size_t ilhs = 0; ilhs != num_elements; ++ilhs) {
- for (size_t irhs = 0; irhs != matchers_.size(); ++irhs) {
- matrix.SetEdge(ilhs, irhs, *did_match_iter++ != 0);
- }
- }
- return matrix;
- }
-
- MatcherVec matchers_;
-
- GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcherImpl);
-};
-
-// Functor for use in TransformTuple.
-// Performs MatcherCast<Target> on an input argument of any type.
-template <typename Target>
-struct CastAndAppendTransform {
- template <typename Arg>
- Matcher<Target> operator()(const Arg& a) const {
- return MatcherCast<Target>(a);
- }
-};
-
-// Implements UnorderedElementsAre.
-template <typename MatcherTuple>
-class UnorderedElementsAreMatcher {
- public:
- explicit UnorderedElementsAreMatcher(const MatcherTuple& args)
- : matchers_(args) {}
-
- template <typename Container>
- operator Matcher<Container>() const {
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
- typedef typename internal::StlContainerView<RawContainer>::type View;
- typedef typename View::value_type Element;
- typedef ::std::vector<Matcher<const Element&> > MatcherVec;
- MatcherVec matchers;
- matchers.reserve(::std::tr1::tuple_size<MatcherTuple>::value);
- TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_,
- ::std::back_inserter(matchers));
- return MakeMatcher(new UnorderedElementsAreMatcherImpl<Container>(
- matchers.begin(), matchers.end()));
- }
-
- private:
- const MatcherTuple matchers_;
- GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcher);
-};
-
-// Implements ElementsAre.
-template <typename MatcherTuple>
-class ElementsAreMatcher {
- public:
- explicit ElementsAreMatcher(const MatcherTuple& args) : matchers_(args) {}
-
- template <typename Container>
- operator Matcher<Container>() const {
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
- typedef typename internal::StlContainerView<RawContainer>::type View;
- typedef typename View::value_type Element;
- typedef ::std::vector<Matcher<const Element&> > MatcherVec;
- MatcherVec matchers;
- matchers.reserve(::std::tr1::tuple_size<MatcherTuple>::value);
- TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_,
- ::std::back_inserter(matchers));
- return MakeMatcher(new ElementsAreMatcherImpl<Container>(
- matchers.begin(), matchers.end()));
- }
-
- private:
- const MatcherTuple matchers_;
- GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher);
-};
-
-// Implements UnorderedElementsAreArray().
-template <typename T>
-class UnorderedElementsAreArrayMatcher {
- public:
- UnorderedElementsAreArrayMatcher() {}
-
- template <typename Iter>
- UnorderedElementsAreArrayMatcher(Iter first, Iter last)
- : matchers_(first, last) {}
-
- template <typename Container>
- operator Matcher<Container>() const {
- return MakeMatcher(
- new UnorderedElementsAreMatcherImpl<Container>(matchers_.begin(),
- matchers_.end()));
- }
-
- private:
- ::std::vector<T> matchers_;
-
- GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreArrayMatcher);
-};
-
-// Implements ElementsAreArray().
-template <typename T>
-class ElementsAreArrayMatcher {
- public:
- template <typename Iter>
- ElementsAreArrayMatcher(Iter first, Iter last) : matchers_(first, last) {}
-
- template <typename Container>
- operator Matcher<Container>() const {
- return MakeMatcher(new ElementsAreMatcherImpl<Container>(
- matchers_.begin(), matchers_.end()));
- }
-
- private:
- const ::std::vector<T> matchers_;
-
- GTEST_DISALLOW_ASSIGN_(ElementsAreArrayMatcher);
-};
-
-// Returns the description for a matcher defined using the MATCHER*()
-// macro where the user-supplied description string is "", if
-// 'negation' is false; otherwise returns the description of the
-// negation of the matcher. 'param_values' contains a list of strings
-// that are the print-out of the matcher's parameters.
-GTEST_API_ string FormatMatcherDescription(bool negation,
- const char* matcher_name,
- const Strings& param_values);
-
-} // namespace internal
-
-// ElementsAreArray(first, last)
-// ElementsAreArray(pointer, count)
-// ElementsAreArray(array)
-// ElementsAreArray(vector)
-// ElementsAreArray({ e1, e2, ..., en })
-//
-// The ElementsAreArray() functions are like ElementsAre(...), except
-// that they are given a homogeneous sequence rather than taking each
-// element as a function argument. The sequence can be specified as an
-// array, a pointer and count, a vector, an initializer list, or an
-// STL iterator range. In each of these cases, the underlying sequence
-// can be either a sequence of values or a sequence of matchers.
-//
-// All forms of ElementsAreArray() make a copy of the input matcher sequence.
-
-template <typename Iter>
-inline internal::ElementsAreArrayMatcher<
- typename ::std::iterator_traits<Iter>::value_type>
-ElementsAreArray(Iter first, Iter last) {
- typedef typename ::std::iterator_traits<Iter>::value_type T;
- return internal::ElementsAreArrayMatcher<T>(first, last);
-}
-
-template <typename T>
-inline internal::ElementsAreArrayMatcher<T> ElementsAreArray(
- const T* pointer, size_t count) {
- return ElementsAreArray(pointer, pointer + count);
-}
-
-template <typename T, size_t N>
-inline internal::ElementsAreArrayMatcher<T> ElementsAreArray(
- const T (&array)[N]) {
- return ElementsAreArray(array, N);
-}
-
-template <typename T, typename A>
-inline internal::ElementsAreArrayMatcher<T> ElementsAreArray(
- const ::std::vector<T, A>& vec) {
- return ElementsAreArray(vec.begin(), vec.end());
-}
-
-#if GTEST_LANG_CXX11
-template <typename T>
-inline internal::ElementsAreArrayMatcher<T>
-ElementsAreArray(::std::initializer_list<T> xs) {
- return ElementsAreArray(xs.begin(), xs.end());
-}
-#endif
-
-// UnorderedElementsAreArray(first, last)
-// UnorderedElementsAreArray(pointer, count)
-// UnorderedElementsAreArray(array)
-// UnorderedElementsAreArray(vector)
-// UnorderedElementsAreArray({ e1, e2, ..., en })
-//
-// The UnorderedElementsAreArray() functions are like
-// ElementsAreArray(...), but allow matching the elements in any order.
-template <typename Iter>
-inline internal::UnorderedElementsAreArrayMatcher<
- typename ::std::iterator_traits<Iter>::value_type>
-UnorderedElementsAreArray(Iter first, Iter last) {
- typedef typename ::std::iterator_traits<Iter>::value_type T;
- return internal::UnorderedElementsAreArrayMatcher<T>(first, last);
-}
-
-template <typename T>
-inline internal::UnorderedElementsAreArrayMatcher<T>
-UnorderedElementsAreArray(const T* pointer, size_t count) {
- return UnorderedElementsAreArray(pointer, pointer + count);
-}
-
-template <typename T, size_t N>
-inline internal::UnorderedElementsAreArrayMatcher<T>
-UnorderedElementsAreArray(const T (&array)[N]) {
- return UnorderedElementsAreArray(array, N);
-}
-
-template <typename T, typename A>
-inline internal::UnorderedElementsAreArrayMatcher<T>
-UnorderedElementsAreArray(const ::std::vector<T, A>& vec) {
- return UnorderedElementsAreArray(vec.begin(), vec.end());
-}
-
-#if GTEST_LANG_CXX11
-template <typename T>
-inline internal::UnorderedElementsAreArrayMatcher<T>
-UnorderedElementsAreArray(::std::initializer_list<T> xs) {
- return UnorderedElementsAreArray(xs.begin(), xs.end());
-}
-#endif
-
-// _ is a matcher that matches anything of any type.
-//
-// This definition is fine as:
-//
-// 1. The C++ standard permits using the name _ in a namespace that
-// is not the global namespace or ::std.
-// 2. The AnythingMatcher class has no data member or constructor,
-// so it's OK to create global variables of this type.
-// 3. c-style has approved of using _ in this case.
-const internal::AnythingMatcher _ = {};
-// Creates a matcher that matches any value of the given type T.
-template <typename T>
-inline Matcher<T> A() { return MakeMatcher(new internal::AnyMatcherImpl<T>()); }
-
-// Creates a matcher that matches any value of the given type T.
-template <typename T>
-inline Matcher<T> An() { return A<T>(); }
-
-// Creates a polymorphic matcher that matches anything equal to x.
-// Note: if the parameter of Eq() were declared as const T&, Eq("foo")
-// wouldn't compile.
-template <typename T>
-inline internal::EqMatcher<T> Eq(T x) { return internal::EqMatcher<T>(x); }
-
-// Constructs a Matcher<T> from a 'value' of type T. The constructed
-// matcher matches any value that's equal to 'value'.
-template <typename T>
-Matcher<T>::Matcher(T value) { *this = Eq(value); }
-
-// Creates a monomorphic matcher that matches anything with type Lhs
-// and equal to rhs. A user may need to use this instead of Eq(...)
-// in order to resolve an overloading ambiguity.
-//
-// TypedEq<T>(x) is just a convenient short-hand for Matcher<T>(Eq(x))
-// or Matcher<T>(x), but more readable than the latter.
-//
-// We could define similar monomorphic matchers for other comparison
-// operations (e.g. TypedLt, TypedGe, and etc), but decided not to do
-// it yet as those are used much less than Eq() in practice. A user
-// can always write Matcher<T>(Lt(5)) to be explicit about the type,
-// for example.
-template <typename Lhs, typename Rhs>
-inline Matcher<Lhs> TypedEq(const Rhs& rhs) { return Eq(rhs); }
-
-// Creates a polymorphic matcher that matches anything >= x.
-template <typename Rhs>
-inline internal::GeMatcher<Rhs> Ge(Rhs x) {
- return internal::GeMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches anything > x.
-template <typename Rhs>
-inline internal::GtMatcher<Rhs> Gt(Rhs x) {
- return internal::GtMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches anything <= x.
-template <typename Rhs>
-inline internal::LeMatcher<Rhs> Le(Rhs x) {
- return internal::LeMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches anything < x.
-template <typename Rhs>
-inline internal::LtMatcher<Rhs> Lt(Rhs x) {
- return internal::LtMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches anything != x.
-template <typename Rhs>
-inline internal::NeMatcher<Rhs> Ne(Rhs x) {
- return internal::NeMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches any NULL pointer.
-inline PolymorphicMatcher<internal::IsNullMatcher > IsNull() {
- return MakePolymorphicMatcher(internal::IsNullMatcher());
-}
-
-// Creates a polymorphic matcher that matches any non-NULL pointer.
-// This is convenient as Not(NULL) doesn't compile (the compiler
-// thinks that that expression is comparing a pointer with an integer).
-inline PolymorphicMatcher<internal::NotNullMatcher > NotNull() {
- return MakePolymorphicMatcher(internal::NotNullMatcher());
-}
-
-// Creates a polymorphic matcher that matches any argument that
-// references variable x.
-template <typename T>
-inline internal::RefMatcher<T&> Ref(T& x) { // NOLINT
- return internal::RefMatcher<T&>(x);
-}
-
-// Creates a matcher that matches any double argument approximately
-// equal to rhs, where two NANs are considered unequal.
-inline internal::FloatingEqMatcher<double> DoubleEq(double rhs) {
- return internal::FloatingEqMatcher<double>(rhs, false);
-}
-
-// Creates a matcher that matches any double argument approximately
-// equal to rhs, including NaN values when rhs is NaN.
-inline internal::FloatingEqMatcher<double> NanSensitiveDoubleEq(double rhs) {
- return internal::FloatingEqMatcher<double>(rhs, true);
-}
-
-// Creates a matcher that matches any double argument approximately equal to
-// rhs, up to the specified max absolute error bound, where two NANs are
-// considered unequal. The max absolute error bound must be non-negative.
-inline internal::FloatingEqMatcher<double> DoubleNear(
- double rhs, double max_abs_error) {
- return internal::FloatingEqMatcher<double>(rhs, false, max_abs_error);
-}
-
-// Creates a matcher that matches any double argument approximately equal to
-// rhs, up to the specified max absolute error bound, including NaN values when
-// rhs is NaN. The max absolute error bound must be non-negative.
-inline internal::FloatingEqMatcher<double> NanSensitiveDoubleNear(
- double rhs, double max_abs_error) {
- return internal::FloatingEqMatcher<double>(rhs, true, max_abs_error);
-}
-
-// Creates a matcher that matches any float argument approximately
-// equal to rhs, where two NANs are considered unequal.
-inline internal::FloatingEqMatcher<float> FloatEq(float rhs) {
- return internal::FloatingEqMatcher<float>(rhs, false);
-}
-
-// Creates a matcher that matches any float argument approximately
-// equal to rhs, including NaN values when rhs is NaN.
-inline internal::FloatingEqMatcher<float> NanSensitiveFloatEq(float rhs) {
- return internal::FloatingEqMatcher<float>(rhs, true);
-}
-
-// Creates a matcher that matches any float argument approximately equal to
-// rhs, up to the specified max absolute error bound, where two NANs are
-// considered unequal. The max absolute error bound must be non-negative.
-inline internal::FloatingEqMatcher<float> FloatNear(
- float rhs, float max_abs_error) {
- return internal::FloatingEqMatcher<float>(rhs, false, max_abs_error);
-}
-
-// Creates a matcher that matches any float argument approximately equal to
-// rhs, up to the specified max absolute error bound, including NaN values when
-// rhs is NaN. The max absolute error bound must be non-negative.
-inline internal::FloatingEqMatcher<float> NanSensitiveFloatNear(
- float rhs, float max_abs_error) {
- return internal::FloatingEqMatcher<float>(rhs, true, max_abs_error);
-}
-
-// Creates a matcher that matches a pointer (raw or smart) that points
-// to a value that matches inner_matcher.
-template <typename InnerMatcher>
-inline internal::PointeeMatcher<InnerMatcher> Pointee(
- const InnerMatcher& inner_matcher) {
- return internal::PointeeMatcher<InnerMatcher>(inner_matcher);
-}
-
-// Creates a matcher that matches an object whose given field matches
-// 'matcher'. For example,
-// Field(&Foo::number, Ge(5))
-// matches a Foo object x iff x.number >= 5.
-template <typename Class, typename FieldType, typename FieldMatcher>
-inline PolymorphicMatcher<
- internal::FieldMatcher<Class, FieldType> > Field(
- FieldType Class::*field, const FieldMatcher& matcher) {
- return MakePolymorphicMatcher(
- internal::FieldMatcher<Class, FieldType>(
- field, MatcherCast<const FieldType&>(matcher)));
- // The call to MatcherCast() is required for supporting inner
- // matchers of compatible types. For example, it allows
- // Field(&Foo::bar, m)
- // to compile where bar is an int32 and m is a matcher for int64.
-}
-
-// Creates a matcher that matches an object whose given property
-// matches 'matcher'. For example,
-// Property(&Foo::str, StartsWith("hi"))
-// matches a Foo object x iff x.str() starts with "hi".
-template <typename Class, typename PropertyType, typename PropertyMatcher>
-inline PolymorphicMatcher<
- internal::PropertyMatcher<Class, PropertyType> > Property(
- PropertyType (Class::*property)() const, const PropertyMatcher& matcher) {
- return MakePolymorphicMatcher(
- internal::PropertyMatcher<Class, PropertyType>(
- property,
- MatcherCast<GTEST_REFERENCE_TO_CONST_(PropertyType)>(matcher)));
- // The call to MatcherCast() is required for supporting inner
- // matchers of compatible types. For example, it allows
- // Property(&Foo::bar, m)
- // to compile where bar() returns an int32 and m is a matcher for int64.
-}
-
-// Creates a matcher that matches an object iff the result of applying
-// a callable to x matches 'matcher'.
-// For example,
-// ResultOf(f, StartsWith("hi"))
-// matches a Foo object x iff f(x) starts with "hi".
-// callable parameter can be a function, function pointer, or a functor.
-// Callable has to satisfy the following conditions:
-// * It is required to keep no state affecting the results of
-// the calls on it and make no assumptions about how many calls
-// will be made. Any state it keeps must be protected from the
-// concurrent access.
-// * If it is a function object, it has to define type result_type.
-// We recommend deriving your functor classes from std::unary_function.
-template <typename Callable, typename ResultOfMatcher>
-internal::ResultOfMatcher<Callable> ResultOf(
- Callable callable, const ResultOfMatcher& matcher) {
- return internal::ResultOfMatcher<Callable>(
- callable,
- MatcherCast<typename internal::CallableTraits<Callable>::ResultType>(
- matcher));
- // The call to MatcherCast() is required for supporting inner
- // matchers of compatible types. For example, it allows
- // ResultOf(Function, m)
- // to compile where Function() returns an int32 and m is a matcher for int64.
-}
-
-// String matchers.
-
-// Matches a string equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> >
- StrEq(const internal::string& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>(
- str, true, true));
-}
-
-// Matches a string not equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> >
- StrNe(const internal::string& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>(
- str, false, true));
-}
-
-// Matches a string equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> >
- StrCaseEq(const internal::string& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>(
- str, true, false));
-}
-
-// Matches a string not equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> >
- StrCaseNe(const internal::string& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>(
- str, false, false));
-}
-
-// Creates a matcher that matches any string, std::string, or C string
-// that contains the given substring.
-inline PolymorphicMatcher<internal::HasSubstrMatcher<internal::string> >
- HasSubstr(const internal::string& substring) {
- return MakePolymorphicMatcher(internal::HasSubstrMatcher<internal::string>(
- substring));
-}
-
-// Matches a string that starts with 'prefix' (case-sensitive).
-inline PolymorphicMatcher<internal::StartsWithMatcher<internal::string> >
- StartsWith(const internal::string& prefix) {
- return MakePolymorphicMatcher(internal::StartsWithMatcher<internal::string>(
- prefix));
-}
-
-// Matches a string that ends with 'suffix' (case-sensitive).
-inline PolymorphicMatcher<internal::EndsWithMatcher<internal::string> >
- EndsWith(const internal::string& suffix) {
- return MakePolymorphicMatcher(internal::EndsWithMatcher<internal::string>(
- suffix));
-}
-
-// Matches a string that fully matches regular expression 'regex'.
-// The matcher takes ownership of 'regex'.
-inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
- const internal::RE* regex) {
- return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
-}
-inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
- const internal::string& regex) {
- return MatchesRegex(new internal::RE(regex));
-}
-
-// Matches a string that contains regular expression 'regex'.
-// The matcher takes ownership of 'regex'.
-inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
- const internal::RE* regex) {
- return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
-}
-inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
- const internal::string& regex) {
- return ContainsRegex(new internal::RE(regex));
-}
-
-#if GTEST_HAS_GLOBAL_WSTRING || GTEST_HAS_STD_WSTRING
-// Wide string matchers.
-
-// Matches a string equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> >
- StrEq(const internal::wstring& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>(
- str, true, true));
-}
-
-// Matches a string not equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> >
- StrNe(const internal::wstring& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>(
- str, false, true));
-}
-
-// Matches a string equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> >
- StrCaseEq(const internal::wstring& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>(
- str, true, false));
-}
-
-// Matches a string not equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> >
- StrCaseNe(const internal::wstring& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>(
- str, false, false));
-}
-
-// Creates a matcher that matches any wstring, std::wstring, or C wide string
-// that contains the given substring.
-inline PolymorphicMatcher<internal::HasSubstrMatcher<internal::wstring> >
- HasSubstr(const internal::wstring& substring) {
- return MakePolymorphicMatcher(internal::HasSubstrMatcher<internal::wstring>(
- substring));
-}
-
-// Matches a string that starts with 'prefix' (case-sensitive).
-inline PolymorphicMatcher<internal::StartsWithMatcher<internal::wstring> >
- StartsWith(const internal::wstring& prefix) {
- return MakePolymorphicMatcher(internal::StartsWithMatcher<internal::wstring>(
- prefix));
-}
-
-// Matches a string that ends with 'suffix' (case-sensitive).
-inline PolymorphicMatcher<internal::EndsWithMatcher<internal::wstring> >
- EndsWith(const internal::wstring& suffix) {
- return MakePolymorphicMatcher(internal::EndsWithMatcher<internal::wstring>(
- suffix));
-}
-
-#endif // GTEST_HAS_GLOBAL_WSTRING || GTEST_HAS_STD_WSTRING
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field == the second field.
-inline internal::Eq2Matcher Eq() { return internal::Eq2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field >= the second field.
-inline internal::Ge2Matcher Ge() { return internal::Ge2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field > the second field.
-inline internal::Gt2Matcher Gt() { return internal::Gt2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field <= the second field.
-inline internal::Le2Matcher Le() { return internal::Le2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field < the second field.
-inline internal::Lt2Matcher Lt() { return internal::Lt2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field != the second field.
-inline internal::Ne2Matcher Ne() { return internal::Ne2Matcher(); }
-
-// Creates a matcher that matches any value of type T that m doesn't
-// match.
-template <typename InnerMatcher>
-inline internal::NotMatcher<InnerMatcher> Not(InnerMatcher m) {
- return internal::NotMatcher<InnerMatcher>(m);
-}
-
-// Returns a matcher that matches anything that satisfies the given
-// predicate. The predicate can be any unary function or functor
-// whose return type can be implicitly converted to bool.
-template <typename Predicate>
-inline PolymorphicMatcher<internal::TrulyMatcher<Predicate> >
-Truly(Predicate pred) {
- return MakePolymorphicMatcher(internal::TrulyMatcher<Predicate>(pred));
-}
-
-// Returns a matcher that matches the container size. The container must
-// support both size() and size_type which all STL-like containers provide.
-// Note that the parameter 'size' can be a value of type size_type as well as
-// matcher. For instance:
-// EXPECT_THAT(container, SizeIs(2)); // Checks container has 2 elements.
-// EXPECT_THAT(container, SizeIs(Le(2)); // Checks container has at most 2.
-template <typename SizeMatcher>
-inline internal::SizeIsMatcher<SizeMatcher>
-SizeIs(const SizeMatcher& size_matcher) {
- return internal::SizeIsMatcher<SizeMatcher>(size_matcher);
-}
-
-// Returns a matcher that matches an equal container.
-// This matcher behaves like Eq(), but in the event of mismatch lists the
-// values that are included in one container but not the other. (Duplicate
-// values and order differences are not explained.)
-template <typename Container>
-inline PolymorphicMatcher<internal::ContainerEqMatcher< // NOLINT
- GTEST_REMOVE_CONST_(Container)> >
- ContainerEq(const Container& rhs) {
- // This following line is for working around a bug in MSVC 8.0,
- // which causes Container to be a const type sometimes.
- typedef GTEST_REMOVE_CONST_(Container) RawContainer;
- return MakePolymorphicMatcher(
- internal::ContainerEqMatcher<RawContainer>(rhs));
-}
-
-// Returns a matcher that matches a container that, when sorted using
-// the given comparator, matches container_matcher.
-template <typename Comparator, typename ContainerMatcher>
-inline internal::WhenSortedByMatcher<Comparator, ContainerMatcher>
-WhenSortedBy(const Comparator& comparator,
- const ContainerMatcher& container_matcher) {
- return internal::WhenSortedByMatcher<Comparator, ContainerMatcher>(
- comparator, container_matcher);
-}
-
-// Returns a matcher that matches a container that, when sorted using
-// the < operator, matches container_matcher.
-template <typename ContainerMatcher>
-inline internal::WhenSortedByMatcher<internal::LessComparator, ContainerMatcher>
-WhenSorted(const ContainerMatcher& container_matcher) {
- return
- internal::WhenSortedByMatcher<internal::LessComparator, ContainerMatcher>(
- internal::LessComparator(), container_matcher);
-}
-
-// Matches an STL-style container or a native array that contains the
-// same number of elements as in rhs, where its i-th element and rhs's
-// i-th element (as a pair) satisfy the given pair matcher, for all i.
-// TupleMatcher must be able to be safely cast to Matcher<tuple<const
-// T1&, const T2&> >, where T1 and T2 are the types of elements in the
-// LHS container and the RHS container respectively.
-template <typename TupleMatcher, typename Container>
-inline internal::PointwiseMatcher<TupleMatcher,
- GTEST_REMOVE_CONST_(Container)>
-Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) {
- // This following line is for working around a bug in MSVC 8.0,
- // which causes Container to be a const type sometimes.
- typedef GTEST_REMOVE_CONST_(Container) RawContainer;
- return internal::PointwiseMatcher<TupleMatcher, RawContainer>(
- tuple_matcher, rhs);
-}
-
-// Matches an STL-style container or a native array that contains at
-// least one element matching the given value or matcher.
-//
-// Examples:
-// ::std::set<int> page_ids;
-// page_ids.insert(3);
-// page_ids.insert(1);
-// EXPECT_THAT(page_ids, Contains(1));
-// EXPECT_THAT(page_ids, Contains(Gt(2)));
-// EXPECT_THAT(page_ids, Not(Contains(4)));
-//
-// ::std::map<int, size_t> page_lengths;
-// page_lengths[1] = 100;
-// EXPECT_THAT(page_lengths,
-// Contains(::std::pair<const int, size_t>(1, 100)));
-//
-// const char* user_ids[] = { "joe", "mike", "tom" };
-// EXPECT_THAT(user_ids, Contains(Eq(::std::string("tom"))));
-template <typename M>
-inline internal::ContainsMatcher<M> Contains(M matcher) {
- return internal::ContainsMatcher<M>(matcher);
-}
-
-// Matches an STL-style container or a native array that contains only
-// elements matching the given value or matcher.
-//
-// Each(m) is semantically equivalent to Not(Contains(Not(m))). Only
-// the messages are different.
-//
-// Examples:
-// ::std::set<int> page_ids;
-// // Each(m) matches an empty container, regardless of what m is.
-// EXPECT_THAT(page_ids, Each(Eq(1)));
-// EXPECT_THAT(page_ids, Each(Eq(77)));
-//
-// page_ids.insert(3);
-// EXPECT_THAT(page_ids, Each(Gt(0)));
-// EXPECT_THAT(page_ids, Not(Each(Gt(4))));
-// page_ids.insert(1);
-// EXPECT_THAT(page_ids, Not(Each(Lt(2))));
-//
-// ::std::map<int, size_t> page_lengths;
-// page_lengths[1] = 100;
-// page_lengths[2] = 200;
-// page_lengths[3] = 300;
-// EXPECT_THAT(page_lengths, Not(Each(Pair(1, 100))));
-// EXPECT_THAT(page_lengths, Each(Key(Le(3))));
-//
-// const char* user_ids[] = { "joe", "mike", "tom" };
-// EXPECT_THAT(user_ids, Not(Each(Eq(::std::string("tom")))));
-template <typename M>
-inline internal::EachMatcher<M> Each(M matcher) {
- return internal::EachMatcher<M>(matcher);
-}
-
-// Key(inner_matcher) matches an std::pair whose 'first' field matches
-// inner_matcher. For example, Contains(Key(Ge(5))) can be used to match an
-// std::map that contains at least one element whose key is >= 5.
-template <typename M>
-inline internal::KeyMatcher<M> Key(M inner_matcher) {
- return internal::KeyMatcher<M>(inner_matcher);
-}
-
-// Pair(first_matcher, second_matcher) matches a std::pair whose 'first' field
-// matches first_matcher and whose 'second' field matches second_matcher. For
-// example, EXPECT_THAT(map_type, ElementsAre(Pair(Ge(5), "foo"))) can be used
-// to match a std::map<int, string> that contains exactly one element whose key
-// is >= 5 and whose value equals "foo".
-template <typename FirstMatcher, typename SecondMatcher>
-inline internal::PairMatcher<FirstMatcher, SecondMatcher>
-Pair(FirstMatcher first_matcher, SecondMatcher second_matcher) {
- return internal::PairMatcher<FirstMatcher, SecondMatcher>(
- first_matcher, second_matcher);
-}
-
-// Returns a predicate that is satisfied by anything that matches the
-// given matcher.
-template <typename M>
-inline internal::MatcherAsPredicate<M> Matches(M matcher) {
- return internal::MatcherAsPredicate<M>(matcher);
-}
-
-// Returns true iff the value matches the matcher.
-template <typename T, typename M>
-inline bool Value(const T& value, M matcher) {
- return testing::Matches(matcher)(value);
-}
-
-// Matches the value against the given matcher and explains the match
-// result to listener.
-template <typename T, typename M>
-inline bool ExplainMatchResult(
- M matcher, const T& value, MatchResultListener* listener) {
- return SafeMatcherCast<const T&>(matcher).MatchAndExplain(value, listener);
-}
-
-#if GTEST_LANG_CXX11
-// Define variadic matcher versions. They are overloaded in
-// gmock-generated-matchers.h for the cases supported by pre C++11 compilers.
-template <typename... Args>
-inline internal::AllOfMatcher<Args...> AllOf(const Args&... matchers) {
- return internal::AllOfMatcher<Args...>(matchers...);
-}
-
-template <typename... Args>
-inline internal::AnyOfMatcher<Args...> AnyOf(const Args&... matchers) {
- return internal::AnyOfMatcher<Args...>(matchers...);
-}
-
-#endif // GTEST_LANG_CXX11
-
-// AllArgs(m) is a synonym of m. This is useful in
-//
-// EXPECT_CALL(foo, Bar(_, _)).With(AllArgs(Eq()));
-//
-// which is easier to read than
-//
-// EXPECT_CALL(foo, Bar(_, _)).With(Eq());
-template <typename InnerMatcher>
-inline InnerMatcher AllArgs(const InnerMatcher& matcher) { return matcher; }
-
-// These macros allow using matchers to check values in Google Test
-// tests. ASSERT_THAT(value, matcher) and EXPECT_THAT(value, matcher)
-// succeed iff the value matches the matcher. If the assertion fails,
-// the value and the description of the matcher will be printed.
-#define ASSERT_THAT(value, matcher) ASSERT_PRED_FORMAT1(\
- ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value)
-#define EXPECT_THAT(value, matcher) EXPECT_PRED_FORMAT1(\
- ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value)
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock-more-actions.h b/third_party/ntcore_2017/gmock/include/gmock/gmock-more-actions.h
deleted file mode 100644
index fc5e5ca..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock-more-actions.h
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some actions that depend on gmock-generated-actions.h.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
-
-#include <algorithm>
-
-#include "gmock/gmock-generated-actions.h"
-
-namespace testing {
-namespace internal {
-
-// Implements the Invoke(f) action. The template argument
-// FunctionImpl is the implementation type of f, which can be either a
-// function pointer or a functor. Invoke(f) can be used as an
-// Action<F> as long as f's type is compatible with F (i.e. f can be
-// assigned to a tr1::function<F>).
-template <typename FunctionImpl>
-class InvokeAction {
- public:
- // The c'tor makes a copy of function_impl (either a function
- // pointer or a functor).
- explicit InvokeAction(FunctionImpl function_impl)
- : function_impl_(function_impl) {}
-
- template <typename Result, typename ArgumentTuple>
- Result Perform(const ArgumentTuple& args) {
- return InvokeHelper<Result, ArgumentTuple>::Invoke(function_impl_, args);
- }
-
- private:
- FunctionImpl function_impl_;
-
- GTEST_DISALLOW_ASSIGN_(InvokeAction);
-};
-
-// Implements the Invoke(object_ptr, &Class::Method) action.
-template <class Class, typename MethodPtr>
-class InvokeMethodAction {
- public:
- InvokeMethodAction(Class* obj_ptr, MethodPtr method_ptr)
- : obj_ptr_(obj_ptr), method_ptr_(method_ptr) {}
-
- template <typename Result, typename ArgumentTuple>
- Result Perform(const ArgumentTuple& args) const {
- return InvokeHelper<Result, ArgumentTuple>::InvokeMethod(
- obj_ptr_, method_ptr_, args);
- }
-
- private:
- Class* const obj_ptr_;
- const MethodPtr method_ptr_;
-
- GTEST_DISALLOW_ASSIGN_(InvokeMethodAction);
-};
-
-} // namespace internal
-
-// Various overloads for Invoke().
-
-// Creates an action that invokes 'function_impl' with the mock
-// function's arguments.
-template <typename FunctionImpl>
-PolymorphicAction<internal::InvokeAction<FunctionImpl> > Invoke(
- FunctionImpl function_impl) {
- return MakePolymorphicAction(
- internal::InvokeAction<FunctionImpl>(function_impl));
-}
-
-// Creates an action that invokes the given method on the given object
-// with the mock function's arguments.
-template <class Class, typename MethodPtr>
-PolymorphicAction<internal::InvokeMethodAction<Class, MethodPtr> > Invoke(
- Class* obj_ptr, MethodPtr method_ptr) {
- return MakePolymorphicAction(
- internal::InvokeMethodAction<Class, MethodPtr>(obj_ptr, method_ptr));
-}
-
-// WithoutArgs(inner_action) can be used in a mock function with a
-// non-empty argument list to perform inner_action, which takes no
-// argument. In other words, it adapts an action accepting no
-// argument to one that accepts (and ignores) arguments.
-template <typename InnerAction>
-inline internal::WithArgsAction<InnerAction>
-WithoutArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction>(action);
-}
-
-// WithArg<k>(an_action) creates an action that passes the k-th
-// (0-based) argument of the mock function to an_action and performs
-// it. It adapts an action accepting one argument to one that accepts
-// multiple arguments. For convenience, we also provide
-// WithArgs<k>(an_action) (defined below) as a synonym.
-template <int k, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k>
-WithArg(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k>(action);
-}
-
-// The ACTION*() macros trigger warning C4100 (unreferenced formal
-// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
-// the macro definition, as the warnings are generated when the macro
-// is expanded and macro expansion cannot contain #pragma. Therefore
-// we suppress them here.
-#ifdef _MSC_VER
-# pragma warning(push)
-# pragma warning(disable:4100)
-#endif
-
-// Action ReturnArg<k>() returns the k-th argument of the mock function.
-ACTION_TEMPLATE(ReturnArg,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_0_VALUE_PARAMS()) {
- return std::tr1::get<k>(args);
-}
-
-// Action SaveArg<k>(pointer) saves the k-th (0-based) argument of the
-// mock function to *pointer.
-ACTION_TEMPLATE(SaveArg,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_1_VALUE_PARAMS(pointer)) {
- *pointer = ::std::tr1::get<k>(args);
-}
-
-// Action SaveArgPointee<k>(pointer) saves the value pointed to
-// by the k-th (0-based) argument of the mock function to *pointer.
-ACTION_TEMPLATE(SaveArgPointee,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_1_VALUE_PARAMS(pointer)) {
- *pointer = *::std::tr1::get<k>(args);
-}
-
-// Action SetArgReferee<k>(value) assigns 'value' to the variable
-// referenced by the k-th (0-based) argument of the mock function.
-ACTION_TEMPLATE(SetArgReferee,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_1_VALUE_PARAMS(value)) {
- typedef typename ::std::tr1::tuple_element<k, args_type>::type argk_type;
- // Ensures that argument #k is a reference. If you get a compiler
- // error on the next line, you are using SetArgReferee<k>(value) in
- // a mock function whose k-th (0-based) argument is not a reference.
- GTEST_COMPILE_ASSERT_(internal::is_reference<argk_type>::value,
- SetArgReferee_must_be_used_with_a_reference_argument);
- ::std::tr1::get<k>(args) = value;
-}
-
-// Action SetArrayArgument<k>(first, last) copies the elements in
-// source range [first, last) to the array pointed to by the k-th
-// (0-based) argument, which can be either a pointer or an
-// iterator. The action does not take ownership of the elements in the
-// source range.
-ACTION_TEMPLATE(SetArrayArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_2_VALUE_PARAMS(first, last)) {
- // Microsoft compiler deprecates ::std::copy, so we want to suppress warning
- // 4996 (Function call with parameters that may be unsafe) there.
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4996) // Temporarily disables warning 4996.
-#endif
- ::std::copy(first, last, ::std::tr1::get<k>(args));
-#ifdef _MSC_VER
-# pragma warning(pop) // Restores the warning state.
-#endif
-}
-
-// Action DeleteArg<k>() deletes the k-th (0-based) argument of the mock
-// function.
-ACTION_TEMPLATE(DeleteArg,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_0_VALUE_PARAMS()) {
- delete ::std::tr1::get<k>(args);
-}
-
-// This action returns the value pointed to by 'pointer'.
-ACTION_P(ReturnPointee, pointer) { return *pointer; }
-
-// Action Throw(exception) can be used in a mock function of any type
-// to throw the given exception. Any copyable value can be thrown.
-#if GTEST_HAS_EXCEPTIONS
-
-// Suppresses the 'unreachable code' warning that VC generates in opt modes.
-# ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4702) // Temporarily disables warning 4702.
-# endif
-ACTION_P(Throw, exception) { throw exception; }
-# ifdef _MSC_VER
-# pragma warning(pop) // Restores the warning state.
-# endif
-
-#endif // GTEST_HAS_EXCEPTIONS
-
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock-more-matchers.h b/third_party/ntcore_2017/gmock/include/gmock/gmock-more-matchers.h
deleted file mode 100644
index 3db899f..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock-more-matchers.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2013, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: marcus.boerger@google.com (Marcus Boerger)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some matchers that depend on gmock-generated-matchers.h.
-//
-// Note that tests are implemented in gmock-matchers_test.cc rather than
-// gmock-more-matchers-test.cc.
-
-#ifndef GMOCK_GMOCK_MORE_MATCHERS_H_
-#define GMOCK_GMOCK_MORE_MATCHERS_H_
-
-#include "gmock/gmock-generated-matchers.h"
-
-namespace testing {
-
-// Defines a matcher that matches an empty container. The container must
-// support both size() and empty(), which all STL-like containers provide.
-MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") {
- if (arg.empty()) {
- return true;
- }
- *result_listener << "whose size is " << arg.size();
- return false;
-}
-
-} // namespace testing
-
-#endif // GMOCK_GMOCK_MORE_MATCHERS_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock-spec-builders.h b/third_party/ntcore_2017/gmock/include/gmock/gmock-spec-builders.h
deleted file mode 100644
index 312fbe8..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock-spec-builders.h
+++ /dev/null
@@ -1,1791 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements the ON_CALL() and EXPECT_CALL() macros.
-//
-// A user can use the ON_CALL() macro to specify the default action of
-// a mock method. The syntax is:
-//
-// ON_CALL(mock_object, Method(argument-matchers))
-// .With(multi-argument-matcher)
-// .WillByDefault(action);
-//
-// where the .With() clause is optional.
-//
-// A user can use the EXPECT_CALL() macro to specify an expectation on
-// a mock method. The syntax is:
-//
-// EXPECT_CALL(mock_object, Method(argument-matchers))
-// .With(multi-argument-matchers)
-// .Times(cardinality)
-// .InSequence(sequences)
-// .After(expectations)
-// .WillOnce(action)
-// .WillRepeatedly(action)
-// .RetiresOnSaturation();
-//
-// where all clauses are optional, and .InSequence()/.After()/
-// .WillOnce() can appear any number of times.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
-
-#include <map>
-#include <set>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#if GTEST_HAS_EXCEPTIONS
-# include <stdexcept> // NOLINT
-#endif
-
-#include "gmock/gmock-actions.h"
-#include "gmock/gmock-cardinalities.h"
-#include "gmock/gmock-matchers.h"
-#include "gmock/internal/gmock-internal-utils.h"
-#include "gmock/internal/gmock-port.h"
-#include "gtest/gtest.h"
-
-namespace testing {
-
-// An abstract handle of an expectation.
-class Expectation;
-
-// A set of expectation handles.
-class ExpectationSet;
-
-// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION
-// and MUST NOT BE USED IN USER CODE!!!
-namespace internal {
-
-// Implements a mock function.
-template <typename F> class FunctionMocker;
-
-// Base class for expectations.
-class ExpectationBase;
-
-// Implements an expectation.
-template <typename F> class TypedExpectation;
-
-// Helper class for testing the Expectation class template.
-class ExpectationTester;
-
-// Base class for function mockers.
-template <typename F> class FunctionMockerBase;
-
-// Protects the mock object registry (in class Mock), all function
-// mockers, and all expectations.
-//
-// The reason we don't use more fine-grained protection is: when a
-// mock function Foo() is called, it needs to consult its expectations
-// to see which one should be picked. If another thread is allowed to
-// call a mock function (either Foo() or a different one) at the same
-// time, it could affect the "retired" attributes of Foo()'s
-// expectations when InSequence() is used, and thus affect which
-// expectation gets picked. Therefore, we sequence all mock function
-// calls to ensure the integrity of the mock objects' states.
-GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex);
-
-// Untyped base class for ActionResultHolder<R>.
-class UntypedActionResultHolderBase;
-
-// Abstract base class of FunctionMockerBase. This is the
-// type-agnostic part of the function mocker interface. Its pure
-// virtual methods are implemented by FunctionMockerBase.
-class GTEST_API_ UntypedFunctionMockerBase {
- public:
- UntypedFunctionMockerBase();
- virtual ~UntypedFunctionMockerBase();
-
- // Verifies that all expectations on this mock function have been
- // satisfied. Reports one or more Google Test non-fatal failures
- // and returns false if not.
- bool VerifyAndClearExpectationsLocked()
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
-
- // Clears the ON_CALL()s set on this mock function.
- virtual void ClearDefaultActionsLocked()
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) = 0;
-
- // In all of the following Untyped* functions, it's the caller's
- // responsibility to guarantee the correctness of the arguments'
- // types.
-
- // Performs the default action with the given arguments and returns
- // the action's result. The call description string will be used in
- // the error message to describe the call in the case the default
- // action fails.
- // L = *
- virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
- const void* untyped_args,
- const string& call_description) const = 0;
-
- // Performs the given action with the given arguments and returns
- // the action's result.
- // L = *
- virtual UntypedActionResultHolderBase* UntypedPerformAction(
- const void* untyped_action,
- const void* untyped_args) const = 0;
-
- // Writes a message that the call is uninteresting (i.e. neither
- // explicitly expected nor explicitly unexpected) to the given
- // ostream.
- virtual void UntypedDescribeUninterestingCall(
- const void* untyped_args,
- ::std::ostream* os) const
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0;
-
- // Returns the expectation that matches the given function arguments
- // (or NULL is there's no match); when a match is found,
- // untyped_action is set to point to the action that should be
- // performed (or NULL if the action is "do default"), and
- // is_excessive is modified to indicate whether the call exceeds the
- // expected number.
- virtual const ExpectationBase* UntypedFindMatchingExpectation(
- const void* untyped_args,
- const void** untyped_action, bool* is_excessive,
- ::std::ostream* what, ::std::ostream* why)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0;
-
- // Prints the given function arguments to the ostream.
- virtual void UntypedPrintArgs(const void* untyped_args,
- ::std::ostream* os) const = 0;
-
- // Sets the mock object this mock method belongs to, and registers
- // this information in the global mock registry. Will be called
- // whenever an EXPECT_CALL() or ON_CALL() is executed on this mock
- // method.
- // TODO(wan@google.com): rename to SetAndRegisterOwner().
- void RegisterOwner(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
-
- // Sets the mock object this mock method belongs to, and sets the
- // name of the mock function. Will be called upon each invocation
- // of this mock function.
- void SetOwnerAndName(const void* mock_obj, const char* name)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
-
- // Returns the mock object this mock method belongs to. Must be
- // called after RegisterOwner() or SetOwnerAndName() has been
- // called.
- const void* MockObject() const
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
-
- // Returns the name of this mock method. Must be called after
- // SetOwnerAndName() has been called.
- const char* Name() const
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
-
- // Returns the result of invoking this mock function with the given
- // arguments. This function can be safely called from multiple
- // threads concurrently. The caller is responsible for deleting the
- // result.
- const UntypedActionResultHolderBase* UntypedInvokeWith(
- const void* untyped_args)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
-
- protected:
- typedef std::vector<const void*> UntypedOnCallSpecs;
-
- typedef std::vector<internal::linked_ptr<ExpectationBase> >
- UntypedExpectations;
-
- // Returns an Expectation object that references and co-owns exp,
- // which must be an expectation on this mock function.
- Expectation GetHandleOf(ExpectationBase* exp);
-
- // Address of the mock object this mock method belongs to. Only
- // valid after this mock method has been called or
- // ON_CALL/EXPECT_CALL has been invoked on it.
- const void* mock_obj_; // Protected by g_gmock_mutex.
-
- // Name of the function being mocked. Only valid after this mock
- // method has been called.
- const char* name_; // Protected by g_gmock_mutex.
-
- // All default action specs for this function mocker.
- UntypedOnCallSpecs untyped_on_call_specs_;
-
- // All expectations for this function mocker.
- UntypedExpectations untyped_expectations_;
-}; // class UntypedFunctionMockerBase
-
-// Untyped base class for OnCallSpec<F>.
-class UntypedOnCallSpecBase {
- public:
- // The arguments are the location of the ON_CALL() statement.
- UntypedOnCallSpecBase(const char* a_file, int a_line)
- : file_(a_file), line_(a_line), last_clause_(kNone) {}
-
- // Where in the source file was the default action spec defined?
- const char* file() const { return file_; }
- int line() const { return line_; }
-
- protected:
- // Gives each clause in the ON_CALL() statement a name.
- enum Clause {
- // Do not change the order of the enum members! The run-time
- // syntax checking relies on it.
- kNone,
- kWith,
- kWillByDefault
- };
-
- // Asserts that the ON_CALL() statement has a certain property.
- void AssertSpecProperty(bool property, const string& failure_message) const {
- Assert(property, file_, line_, failure_message);
- }
-
- // Expects that the ON_CALL() statement has a certain property.
- void ExpectSpecProperty(bool property, const string& failure_message) const {
- Expect(property, file_, line_, failure_message);
- }
-
- const char* file_;
- int line_;
-
- // The last clause in the ON_CALL() statement as seen so far.
- // Initially kNone and changes as the statement is parsed.
- Clause last_clause_;
-}; // class UntypedOnCallSpecBase
-
-// This template class implements an ON_CALL spec.
-template <typename F>
-class OnCallSpec : public UntypedOnCallSpecBase {
- public:
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
- typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
-
- // Constructs an OnCallSpec object from the information inside
- // the parenthesis of an ON_CALL() statement.
- OnCallSpec(const char* a_file, int a_line,
- const ArgumentMatcherTuple& matchers)
- : UntypedOnCallSpecBase(a_file, a_line),
- matchers_(matchers),
- // By default, extra_matcher_ should match anything. However,
- // we cannot initialize it with _ as that triggers a compiler
- // bug in Symbian's C++ compiler (cannot decide between two
- // overloaded constructors of Matcher<const ArgumentTuple&>).
- extra_matcher_(A<const ArgumentTuple&>()) {
- }
-
- // Implements the .With() clause.
- OnCallSpec& With(const Matcher<const ArgumentTuple&>& m) {
- // Makes sure this is called at most once.
- ExpectSpecProperty(last_clause_ < kWith,
- ".With() cannot appear "
- "more than once in an ON_CALL().");
- last_clause_ = kWith;
-
- extra_matcher_ = m;
- return *this;
- }
-
- // Implements the .WillByDefault() clause.
- OnCallSpec& WillByDefault(const Action<F>& action) {
- ExpectSpecProperty(last_clause_ < kWillByDefault,
- ".WillByDefault() must appear "
- "exactly once in an ON_CALL().");
- last_clause_ = kWillByDefault;
-
- ExpectSpecProperty(!action.IsDoDefault(),
- "DoDefault() cannot be used in ON_CALL().");
- action_ = action;
- return *this;
- }
-
- // Returns true iff the given arguments match the matchers.
- bool Matches(const ArgumentTuple& args) const {
- return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
- }
-
- // Returns the action specified by the user.
- const Action<F>& GetAction() const {
- AssertSpecProperty(last_clause_ == kWillByDefault,
- ".WillByDefault() must appear exactly "
- "once in an ON_CALL().");
- return action_;
- }
-
- private:
- // The information in statement
- //
- // ON_CALL(mock_object, Method(matchers))
- // .With(multi-argument-matcher)
- // .WillByDefault(action);
- //
- // is recorded in the data members like this:
- //
- // source file that contains the statement => file_
- // line number of the statement => line_
- // matchers => matchers_
- // multi-argument-matcher => extra_matcher_
- // action => action_
- ArgumentMatcherTuple matchers_;
- Matcher<const ArgumentTuple&> extra_matcher_;
- Action<F> action_;
-}; // class OnCallSpec
-
-// Possible reactions on uninteresting calls.
-enum CallReaction {
- kAllow,
- kWarn,
- kFail,
- kDefault = kWarn // By default, warn about uninteresting calls.
-};
-
-} // namespace internal
-
-// Utilities for manipulating mock objects.
-class GTEST_API_ Mock {
- public:
- // The following public methods can be called concurrently.
-
- // Tells Google Mock to ignore mock_obj when checking for leaked
- // mock objects.
- static void AllowLeak(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Verifies and clears all expectations on the given mock object.
- // If the expectations aren't satisfied, generates one or more
- // Google Test non-fatal failures and returns false.
- static bool VerifyAndClearExpectations(void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Verifies all expectations on the given mock object and clears its
- // default actions and expectations. Returns true iff the
- // verification was successful.
- static bool VerifyAndClear(void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- private:
- friend class internal::UntypedFunctionMockerBase;
-
- // Needed for a function mocker to register itself (so that we know
- // how to clear a mock object).
- template <typename F>
- friend class internal::FunctionMockerBase;
-
- template <typename M>
- friend class NiceMock;
-
- template <typename M>
- friend class NaggyMock;
-
- template <typename M>
- friend class StrictMock;
-
- // Tells Google Mock to allow uninteresting calls on the given mock
- // object.
- static void AllowUninterestingCalls(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Tells Google Mock to warn the user about uninteresting calls on
- // the given mock object.
- static void WarnUninterestingCalls(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Tells Google Mock to fail uninteresting calls on the given mock
- // object.
- static void FailUninterestingCalls(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Tells Google Mock the given mock object is being destroyed and
- // its entry in the call-reaction table should be removed.
- static void UnregisterCallReaction(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Returns the reaction Google Mock will have on uninteresting calls
- // made on the given mock object.
- static internal::CallReaction GetReactionOnUninterestingCalls(
- const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Verifies that all expectations on the given mock object have been
- // satisfied. Reports one or more Google Test non-fatal failures
- // and returns false if not.
- static bool VerifyAndClearExpectationsLocked(void* mock_obj)
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
-
- // Clears all ON_CALL()s set on the given mock object.
- static void ClearDefaultActionsLocked(void* mock_obj)
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
-
- // Registers a mock object and a mock method it owns.
- static void Register(
- const void* mock_obj,
- internal::UntypedFunctionMockerBase* mocker)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Tells Google Mock where in the source code mock_obj is used in an
- // ON_CALL or EXPECT_CALL. In case mock_obj is leaked, this
- // information helps the user identify which object it is.
- static void RegisterUseByOnCallOrExpectCall(
- const void* mock_obj, const char* file, int line)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Unregisters a mock method; removes the owning mock object from
- // the registry when the last mock method associated with it has
- // been unregistered. This is called only in the destructor of
- // FunctionMockerBase.
- static void UnregisterLocked(internal::UntypedFunctionMockerBase* mocker)
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
-}; // class Mock
-
-// An abstract handle of an expectation. Useful in the .After()
-// clause of EXPECT_CALL() for setting the (partial) order of
-// expectations. The syntax:
-//
-// Expectation e1 = EXPECT_CALL(...)...;
-// EXPECT_CALL(...).After(e1)...;
-//
-// sets two expectations where the latter can only be matched after
-// the former has been satisfied.
-//
-// Notes:
-// - This class is copyable and has value semantics.
-// - Constness is shallow: a const Expectation object itself cannot
-// be modified, but the mutable methods of the ExpectationBase
-// object it references can be called via expectation_base().
-// - The constructors and destructor are defined out-of-line because
-// the Symbian WINSCW compiler wants to otherwise instantiate them
-// when it sees this class definition, at which point it doesn't have
-// ExpectationBase available yet, leading to incorrect destruction
-// in the linked_ptr (or compilation errors if using a checking
-// linked_ptr).
-class GTEST_API_ Expectation {
- public:
- // Constructs a null object that doesn't reference any expectation.
- Expectation();
-
- ~Expectation();
-
- // This single-argument ctor must not be explicit, in order to support the
- // Expectation e = EXPECT_CALL(...);
- // syntax.
- //
- // A TypedExpectation object stores its pre-requisites as
- // Expectation objects, and needs to call the non-const Retire()
- // method on the ExpectationBase objects they reference. Therefore
- // Expectation must receive a *non-const* reference to the
- // ExpectationBase object.
- Expectation(internal::ExpectationBase& exp); // NOLINT
-
- // The compiler-generated copy ctor and operator= work exactly as
- // intended, so we don't need to define our own.
-
- // Returns true iff rhs references the same expectation as this object does.
- bool operator==(const Expectation& rhs) const {
- return expectation_base_ == rhs.expectation_base_;
- }
-
- bool operator!=(const Expectation& rhs) const { return !(*this == rhs); }
-
- private:
- friend class ExpectationSet;
- friend class Sequence;
- friend class ::testing::internal::ExpectationBase;
- friend class ::testing::internal::UntypedFunctionMockerBase;
-
- template <typename F>
- friend class ::testing::internal::FunctionMockerBase;
-
- template <typename F>
- friend class ::testing::internal::TypedExpectation;
-
- // This comparator is needed for putting Expectation objects into a set.
- class Less {
- public:
- bool operator()(const Expectation& lhs, const Expectation& rhs) const {
- return lhs.expectation_base_.get() < rhs.expectation_base_.get();
- }
- };
-
- typedef ::std::set<Expectation, Less> Set;
-
- Expectation(
- const internal::linked_ptr<internal::ExpectationBase>& expectation_base);
-
- // Returns the expectation this object references.
- const internal::linked_ptr<internal::ExpectationBase>&
- expectation_base() const {
- return expectation_base_;
- }
-
- // A linked_ptr that co-owns the expectation this handle references.
- internal::linked_ptr<internal::ExpectationBase> expectation_base_;
-};
-
-// A set of expectation handles. Useful in the .After() clause of
-// EXPECT_CALL() for setting the (partial) order of expectations. The
-// syntax:
-//
-// ExpectationSet es;
-// es += EXPECT_CALL(...)...;
-// es += EXPECT_CALL(...)...;
-// EXPECT_CALL(...).After(es)...;
-//
-// sets three expectations where the last one can only be matched
-// after the first two have both been satisfied.
-//
-// This class is copyable and has value semantics.
-class ExpectationSet {
- public:
- // A bidirectional iterator that can read a const element in the set.
- typedef Expectation::Set::const_iterator const_iterator;
-
- // An object stored in the set. This is an alias of Expectation.
- typedef Expectation::Set::value_type value_type;
-
- // Constructs an empty set.
- ExpectationSet() {}
-
- // This single-argument ctor must not be explicit, in order to support the
- // ExpectationSet es = EXPECT_CALL(...);
- // syntax.
- ExpectationSet(internal::ExpectationBase& exp) { // NOLINT
- *this += Expectation(exp);
- }
-
- // This single-argument ctor implements implicit conversion from
- // Expectation and thus must not be explicit. This allows either an
- // Expectation or an ExpectationSet to be used in .After().
- ExpectationSet(const Expectation& e) { // NOLINT
- *this += e;
- }
-
- // The compiler-generator ctor and operator= works exactly as
- // intended, so we don't need to define our own.
-
- // Returns true iff rhs contains the same set of Expectation objects
- // as this does.
- bool operator==(const ExpectationSet& rhs) const {
- return expectations_ == rhs.expectations_;
- }
-
- bool operator!=(const ExpectationSet& rhs) const { return !(*this == rhs); }
-
- // Implements the syntax
- // expectation_set += EXPECT_CALL(...);
- ExpectationSet& operator+=(const Expectation& e) {
- expectations_.insert(e);
- return *this;
- }
-
- int size() const { return static_cast<int>(expectations_.size()); }
-
- const_iterator begin() const { return expectations_.begin(); }
- const_iterator end() const { return expectations_.end(); }
-
- private:
- Expectation::Set expectations_;
-};
-
-
-// Sequence objects are used by a user to specify the relative order
-// in which the expectations should match. They are copyable (we rely
-// on the compiler-defined copy constructor and assignment operator).
-class GTEST_API_ Sequence {
- public:
- // Constructs an empty sequence.
- Sequence() : last_expectation_(new Expectation) {}
-
- // Adds an expectation to this sequence. The caller must ensure
- // that no other thread is accessing this Sequence object.
- void AddExpectation(const Expectation& expectation) const;
-
- private:
- // The last expectation in this sequence. We use a linked_ptr here
- // because Sequence objects are copyable and we want the copies to
- // be aliases. The linked_ptr allows the copies to co-own and share
- // the same Expectation object.
- internal::linked_ptr<Expectation> last_expectation_;
-}; // class Sequence
-
-// An object of this type causes all EXPECT_CALL() statements
-// encountered in its scope to be put in an anonymous sequence. The
-// work is done in the constructor and destructor. You should only
-// create an InSequence object on the stack.
-//
-// The sole purpose for this class is to support easy definition of
-// sequential expectations, e.g.
-//
-// {
-// InSequence dummy; // The name of the object doesn't matter.
-//
-// // The following expectations must match in the order they appear.
-// EXPECT_CALL(a, Bar())...;
-// EXPECT_CALL(a, Baz())...;
-// ...
-// EXPECT_CALL(b, Xyz())...;
-// }
-//
-// You can create InSequence objects in multiple threads, as long as
-// they are used to affect different mock objects. The idea is that
-// each thread can create and set up its own mocks as if it's the only
-// thread. However, for clarity of your tests we recommend you to set
-// up mocks in the main thread unless you have a good reason not to do
-// so.
-class GTEST_API_ InSequence {
- public:
- InSequence();
- ~InSequence();
- private:
- bool sequence_created_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(InSequence); // NOLINT
-} GTEST_ATTRIBUTE_UNUSED_;
-
-namespace internal {
-
-// Points to the implicit sequence introduced by a living InSequence
-// object (if any) in the current thread or NULL.
-GTEST_API_ extern ThreadLocal<Sequence*> g_gmock_implicit_sequence;
-
-// Base class for implementing expectations.
-//
-// There are two reasons for having a type-agnostic base class for
-// Expectation:
-//
-// 1. We need to store collections of expectations of different
-// types (e.g. all pre-requisites of a particular expectation, all
-// expectations in a sequence). Therefore these expectation objects
-// must share a common base class.
-//
-// 2. We can avoid binary code bloat by moving methods not depending
-// on the template argument of Expectation to the base class.
-//
-// This class is internal and mustn't be used by user code directly.
-class GTEST_API_ ExpectationBase {
- public:
- // source_text is the EXPECT_CALL(...) source that created this Expectation.
- ExpectationBase(const char* file, int line, const string& source_text);
-
- virtual ~ExpectationBase();
-
- // Where in the source file was the expectation spec defined?
- const char* file() const { return file_; }
- int line() const { return line_; }
- const char* source_text() const { return source_text_.c_str(); }
- // Returns the cardinality specified in the expectation spec.
- const Cardinality& cardinality() const { return cardinality_; }
-
- // Describes the source file location of this expectation.
- void DescribeLocationTo(::std::ostream* os) const {
- *os << FormatFileLocation(file(), line()) << " ";
- }
-
- // Describes how many times a function call matching this
- // expectation has occurred.
- void DescribeCallCountTo(::std::ostream* os) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
-
- // If this mock method has an extra matcher (i.e. .With(matcher)),
- // describes it to the ostream.
- virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) = 0;
-
- protected:
- friend class ::testing::Expectation;
- friend class UntypedFunctionMockerBase;
-
- enum Clause {
- // Don't change the order of the enum members!
- kNone,
- kWith,
- kTimes,
- kInSequence,
- kAfter,
- kWillOnce,
- kWillRepeatedly,
- kRetiresOnSaturation
- };
-
- typedef std::vector<const void*> UntypedActions;
-
- // Returns an Expectation object that references and co-owns this
- // expectation.
- virtual Expectation GetHandle() = 0;
-
- // Asserts that the EXPECT_CALL() statement has the given property.
- void AssertSpecProperty(bool property, const string& failure_message) const {
- Assert(property, file_, line_, failure_message);
- }
-
- // Expects that the EXPECT_CALL() statement has the given property.
- void ExpectSpecProperty(bool property, const string& failure_message) const {
- Expect(property, file_, line_, failure_message);
- }
-
- // Explicitly specifies the cardinality of this expectation. Used
- // by the subclasses to implement the .Times() clause.
- void SpecifyCardinality(const Cardinality& cardinality);
-
- // Returns true iff the user specified the cardinality explicitly
- // using a .Times().
- bool cardinality_specified() const { return cardinality_specified_; }
-
- // Sets the cardinality of this expectation spec.
- void set_cardinality(const Cardinality& a_cardinality) {
- cardinality_ = a_cardinality;
- }
-
- // The following group of methods should only be called after the
- // EXPECT_CALL() statement, and only when g_gmock_mutex is held by
- // the current thread.
-
- // Retires all pre-requisites of this expectation.
- void RetireAllPreRequisites()
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
-
- // Returns true iff this expectation is retired.
- bool is_retired() const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- return retired_;
- }
-
- // Retires this expectation.
- void Retire()
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- retired_ = true;
- }
-
- // Returns true iff this expectation is satisfied.
- bool IsSatisfied() const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- return cardinality().IsSatisfiedByCallCount(call_count_);
- }
-
- // Returns true iff this expectation is saturated.
- bool IsSaturated() const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- return cardinality().IsSaturatedByCallCount(call_count_);
- }
-
- // Returns true iff this expectation is over-saturated.
- bool IsOverSaturated() const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- return cardinality().IsOverSaturatedByCallCount(call_count_);
- }
-
- // Returns true iff all pre-requisites of this expectation are satisfied.
- bool AllPrerequisitesAreSatisfied() const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
-
- // Adds unsatisfied pre-requisites of this expectation to 'result'.
- void FindUnsatisfiedPrerequisites(ExpectationSet* result) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
-
- // Returns the number this expectation has been invoked.
- int call_count() const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- return call_count_;
- }
-
- // Increments the number this expectation has been invoked.
- void IncrementCallCount()
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- call_count_++;
- }
-
- // Checks the action count (i.e. the number of WillOnce() and
- // WillRepeatedly() clauses) against the cardinality if this hasn't
- // been done before. Prints a warning if there are too many or too
- // few actions.
- void CheckActionCountIfNotDone() const
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- friend class ::testing::Sequence;
- friend class ::testing::internal::ExpectationTester;
-
- template <typename Function>
- friend class TypedExpectation;
-
- // Implements the .Times() clause.
- void UntypedTimes(const Cardinality& a_cardinality);
-
- // This group of fields are part of the spec and won't change after
- // an EXPECT_CALL() statement finishes.
- const char* file_; // The file that contains the expectation.
- int line_; // The line number of the expectation.
- const string source_text_; // The EXPECT_CALL(...) source text.
- // True iff the cardinality is specified explicitly.
- bool cardinality_specified_;
- Cardinality cardinality_; // The cardinality of the expectation.
- // The immediate pre-requisites (i.e. expectations that must be
- // satisfied before this expectation can be matched) of this
- // expectation. We use linked_ptr in the set because we want an
- // Expectation object to be co-owned by its FunctionMocker and its
- // successors. This allows multiple mock objects to be deleted at
- // different times.
- ExpectationSet immediate_prerequisites_;
-
- // This group of fields are the current state of the expectation,
- // and can change as the mock function is called.
- int call_count_; // How many times this expectation has been invoked.
- bool retired_; // True iff this expectation has retired.
- UntypedActions untyped_actions_;
- bool extra_matcher_specified_;
- bool repeated_action_specified_; // True if a WillRepeatedly() was specified.
- bool retires_on_saturation_;
- Clause last_clause_;
- mutable bool action_count_checked_; // Under mutex_.
- mutable Mutex mutex_; // Protects action_count_checked_.
-
- GTEST_DISALLOW_ASSIGN_(ExpectationBase);
-}; // class ExpectationBase
-
-// Impements an expectation for the given function type.
-template <typename F>
-class TypedExpectation : public ExpectationBase {
- public:
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
- typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
- typedef typename Function<F>::Result Result;
-
- TypedExpectation(FunctionMockerBase<F>* owner,
- const char* a_file, int a_line, const string& a_source_text,
- const ArgumentMatcherTuple& m)
- : ExpectationBase(a_file, a_line, a_source_text),
- owner_(owner),
- matchers_(m),
- // By default, extra_matcher_ should match anything. However,
- // we cannot initialize it with _ as that triggers a compiler
- // bug in Symbian's C++ compiler (cannot decide between two
- // overloaded constructors of Matcher<const ArgumentTuple&>).
- extra_matcher_(A<const ArgumentTuple&>()),
- repeated_action_(DoDefault()) {}
-
- virtual ~TypedExpectation() {
- // Check the validity of the action count if it hasn't been done
- // yet (for example, if the expectation was never used).
- CheckActionCountIfNotDone();
- for (UntypedActions::const_iterator it = untyped_actions_.begin();
- it != untyped_actions_.end(); ++it) {
- delete static_cast<const Action<F>*>(*it);
- }
- }
-
- // Implements the .With() clause.
- TypedExpectation& With(const Matcher<const ArgumentTuple&>& m) {
- if (last_clause_ == kWith) {
- ExpectSpecProperty(false,
- ".With() cannot appear "
- "more than once in an EXPECT_CALL().");
- } else {
- ExpectSpecProperty(last_clause_ < kWith,
- ".With() must be the first "
- "clause in an EXPECT_CALL().");
- }
- last_clause_ = kWith;
-
- extra_matcher_ = m;
- extra_matcher_specified_ = true;
- return *this;
- }
-
- // Implements the .Times() clause.
- TypedExpectation& Times(const Cardinality& a_cardinality) {
- ExpectationBase::UntypedTimes(a_cardinality);
- return *this;
- }
-
- // Implements the .Times() clause.
- TypedExpectation& Times(int n) {
- return Times(Exactly(n));
- }
-
- // Implements the .InSequence() clause.
- TypedExpectation& InSequence(const Sequence& s) {
- ExpectSpecProperty(last_clause_ <= kInSequence,
- ".InSequence() cannot appear after .After(),"
- " .WillOnce(), .WillRepeatedly(), or "
- ".RetiresOnSaturation().");
- last_clause_ = kInSequence;
-
- s.AddExpectation(GetHandle());
- return *this;
- }
- TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2) {
- return InSequence(s1).InSequence(s2);
- }
- TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
- const Sequence& s3) {
- return InSequence(s1, s2).InSequence(s3);
- }
- TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
- const Sequence& s3, const Sequence& s4) {
- return InSequence(s1, s2, s3).InSequence(s4);
- }
- TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
- const Sequence& s3, const Sequence& s4,
- const Sequence& s5) {
- return InSequence(s1, s2, s3, s4).InSequence(s5);
- }
-
- // Implements that .After() clause.
- TypedExpectation& After(const ExpectationSet& s) {
- ExpectSpecProperty(last_clause_ <= kAfter,
- ".After() cannot appear after .WillOnce(),"
- " .WillRepeatedly(), or "
- ".RetiresOnSaturation().");
- last_clause_ = kAfter;
-
- for (ExpectationSet::const_iterator it = s.begin(); it != s.end(); ++it) {
- immediate_prerequisites_ += *it;
- }
- return *this;
- }
- TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2) {
- return After(s1).After(s2);
- }
- TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
- const ExpectationSet& s3) {
- return After(s1, s2).After(s3);
- }
- TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
- const ExpectationSet& s3, const ExpectationSet& s4) {
- return After(s1, s2, s3).After(s4);
- }
- TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
- const ExpectationSet& s3, const ExpectationSet& s4,
- const ExpectationSet& s5) {
- return After(s1, s2, s3, s4).After(s5);
- }
-
- // Implements the .WillOnce() clause.
- TypedExpectation& WillOnce(const Action<F>& action) {
- ExpectSpecProperty(last_clause_ <= kWillOnce,
- ".WillOnce() cannot appear after "
- ".WillRepeatedly() or .RetiresOnSaturation().");
- last_clause_ = kWillOnce;
-
- untyped_actions_.push_back(new Action<F>(action));
- if (!cardinality_specified()) {
- set_cardinality(Exactly(static_cast<int>(untyped_actions_.size())));
- }
- return *this;
- }
-
- // Implements the .WillRepeatedly() clause.
- TypedExpectation& WillRepeatedly(const Action<F>& action) {
- if (last_clause_ == kWillRepeatedly) {
- ExpectSpecProperty(false,
- ".WillRepeatedly() cannot appear "
- "more than once in an EXPECT_CALL().");
- } else {
- ExpectSpecProperty(last_clause_ < kWillRepeatedly,
- ".WillRepeatedly() cannot appear "
- "after .RetiresOnSaturation().");
- }
- last_clause_ = kWillRepeatedly;
- repeated_action_specified_ = true;
-
- repeated_action_ = action;
- if (!cardinality_specified()) {
- set_cardinality(AtLeast(static_cast<int>(untyped_actions_.size())));
- }
-
- // Now that no more action clauses can be specified, we check
- // whether their count makes sense.
- CheckActionCountIfNotDone();
- return *this;
- }
-
- // Implements the .RetiresOnSaturation() clause.
- TypedExpectation& RetiresOnSaturation() {
- ExpectSpecProperty(last_clause_ < kRetiresOnSaturation,
- ".RetiresOnSaturation() cannot appear "
- "more than once.");
- last_clause_ = kRetiresOnSaturation;
- retires_on_saturation_ = true;
-
- // Now that no more action clauses can be specified, we check
- // whether their count makes sense.
- CheckActionCountIfNotDone();
- return *this;
- }
-
- // Returns the matchers for the arguments as specified inside the
- // EXPECT_CALL() macro.
- const ArgumentMatcherTuple& matchers() const {
- return matchers_;
- }
-
- // Returns the matcher specified by the .With() clause.
- const Matcher<const ArgumentTuple&>& extra_matcher() const {
- return extra_matcher_;
- }
-
- // Returns the action specified by the .WillRepeatedly() clause.
- const Action<F>& repeated_action() const { return repeated_action_; }
-
- // If this mock method has an extra matcher (i.e. .With(matcher)),
- // describes it to the ostream.
- virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) {
- if (extra_matcher_specified_) {
- *os << " Expected args: ";
- extra_matcher_.DescribeTo(os);
- *os << "\n";
- }
- }
-
- private:
- template <typename Function>
- friend class FunctionMockerBase;
-
- // Returns an Expectation object that references and co-owns this
- // expectation.
- virtual Expectation GetHandle() {
- return owner_->GetHandleOf(this);
- }
-
- // The following methods will be called only after the EXPECT_CALL()
- // statement finishes and when the current thread holds
- // g_gmock_mutex.
-
- // Returns true iff this expectation matches the given arguments.
- bool Matches(const ArgumentTuple& args) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
- }
-
- // Returns true iff this expectation should handle the given arguments.
- bool ShouldHandleArguments(const ArgumentTuple& args) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
-
- // In case the action count wasn't checked when the expectation
- // was defined (e.g. if this expectation has no WillRepeatedly()
- // or RetiresOnSaturation() clause), we check it when the
- // expectation is used for the first time.
- CheckActionCountIfNotDone();
- return !is_retired() && AllPrerequisitesAreSatisfied() && Matches(args);
- }
-
- // Describes the result of matching the arguments against this
- // expectation to the given ostream.
- void ExplainMatchResultTo(
- const ArgumentTuple& args,
- ::std::ostream* os) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
-
- if (is_retired()) {
- *os << " Expected: the expectation is active\n"
- << " Actual: it is retired\n";
- } else if (!Matches(args)) {
- if (!TupleMatches(matchers_, args)) {
- ExplainMatchFailureTupleTo(matchers_, args, os);
- }
- StringMatchResultListener listener;
- if (!extra_matcher_.MatchAndExplain(args, &listener)) {
- *os << " Expected args: ";
- extra_matcher_.DescribeTo(os);
- *os << "\n Actual: don't match";
-
- internal::PrintIfNotEmpty(listener.str(), os);
- *os << "\n";
- }
- } else if (!AllPrerequisitesAreSatisfied()) {
- *os << " Expected: all pre-requisites are satisfied\n"
- << " Actual: the following immediate pre-requisites "
- << "are not satisfied:\n";
- ExpectationSet unsatisfied_prereqs;
- FindUnsatisfiedPrerequisites(&unsatisfied_prereqs);
- int i = 0;
- for (ExpectationSet::const_iterator it = unsatisfied_prereqs.begin();
- it != unsatisfied_prereqs.end(); ++it) {
- it->expectation_base()->DescribeLocationTo(os);
- *os << "pre-requisite #" << i++ << "\n";
- }
- *os << " (end of pre-requisites)\n";
- } else {
- // This line is here just for completeness' sake. It will never
- // be executed as currently the ExplainMatchResultTo() function
- // is called only when the mock function call does NOT match the
- // expectation.
- *os << "The call matches the expectation.\n";
- }
- }
-
- // Returns the action that should be taken for the current invocation.
- const Action<F>& GetCurrentAction(
- const FunctionMockerBase<F>* mocker,
- const ArgumentTuple& args) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- const int count = call_count();
- Assert(count >= 1, __FILE__, __LINE__,
- "call_count() is <= 0 when GetCurrentAction() is "
- "called - this should never happen.");
-
- const int action_count = static_cast<int>(untyped_actions_.size());
- if (action_count > 0 && !repeated_action_specified_ &&
- count > action_count) {
- // If there is at least one WillOnce() and no WillRepeatedly(),
- // we warn the user when the WillOnce() clauses ran out.
- ::std::stringstream ss;
- DescribeLocationTo(&ss);
- ss << "Actions ran out in " << source_text() << "...\n"
- << "Called " << count << " times, but only "
- << action_count << " WillOnce()"
- << (action_count == 1 ? " is" : "s are") << " specified - ";
- mocker->DescribeDefaultActionTo(args, &ss);
- Log(kWarning, ss.str(), 1);
- }
-
- return count <= action_count ?
- *static_cast<const Action<F>*>(untyped_actions_[count - 1]) :
- repeated_action();
- }
-
- // Given the arguments of a mock function call, if the call will
- // over-saturate this expectation, returns the default action;
- // otherwise, returns the next action in this expectation. Also
- // describes *what* happened to 'what', and explains *why* Google
- // Mock does it to 'why'. This method is not const as it calls
- // IncrementCallCount(). A return value of NULL means the default
- // action.
- const Action<F>* GetActionForArguments(
- const FunctionMockerBase<F>* mocker,
- const ArgumentTuple& args,
- ::std::ostream* what,
- ::std::ostream* why)
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- if (IsSaturated()) {
- // We have an excessive call.
- IncrementCallCount();
- *what << "Mock function called more times than expected - ";
- mocker->DescribeDefaultActionTo(args, what);
- DescribeCallCountTo(why);
-
- // TODO(wan@google.com): allow the user to control whether
- // unexpected calls should fail immediately or continue using a
- // flag --gmock_unexpected_calls_are_fatal.
- return NULL;
- }
-
- IncrementCallCount();
- RetireAllPreRequisites();
-
- if (retires_on_saturation_ && IsSaturated()) {
- Retire();
- }
-
- // Must be done after IncrementCount()!
- *what << "Mock function call matches " << source_text() <<"...\n";
- return &(GetCurrentAction(mocker, args));
- }
-
- // All the fields below won't change once the EXPECT_CALL()
- // statement finishes.
- FunctionMockerBase<F>* const owner_;
- ArgumentMatcherTuple matchers_;
- Matcher<const ArgumentTuple&> extra_matcher_;
- Action<F> repeated_action_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TypedExpectation);
-}; // class TypedExpectation
-
-// A MockSpec object is used by ON_CALL() or EXPECT_CALL() for
-// specifying the default behavior of, or expectation on, a mock
-// function.
-
-// Note: class MockSpec really belongs to the ::testing namespace.
-// However if we define it in ::testing, MSVC will complain when
-// classes in ::testing::internal declare it as a friend class
-// template. To workaround this compiler bug, we define MockSpec in
-// ::testing::internal and import it into ::testing.
-
-// Logs a message including file and line number information.
-GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity,
- const char* file, int line,
- const string& message);
-
-template <typename F>
-class MockSpec {
- public:
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
- typedef typename internal::Function<F>::ArgumentMatcherTuple
- ArgumentMatcherTuple;
-
- // Constructs a MockSpec object, given the function mocker object
- // that the spec is associated with.
- explicit MockSpec(internal::FunctionMockerBase<F>* function_mocker)
- : function_mocker_(function_mocker) {}
-
- // Adds a new default action spec to the function mocker and returns
- // the newly created spec.
- internal::OnCallSpec<F>& InternalDefaultActionSetAt(
- const char* file, int line, const char* obj, const char* call) {
- LogWithLocation(internal::kInfo, file, line,
- string("ON_CALL(") + obj + ", " + call + ") invoked");
- return function_mocker_->AddNewOnCallSpec(file, line, matchers_);
- }
-
- // Adds a new expectation spec to the function mocker and returns
- // the newly created spec.
- internal::TypedExpectation<F>& InternalExpectedAt(
- const char* file, int line, const char* obj, const char* call) {
- const string source_text(string("EXPECT_CALL(") + obj + ", " + call + ")");
- LogWithLocation(internal::kInfo, file, line, source_text + " invoked");
- return function_mocker_->AddNewExpectation(
- file, line, source_text, matchers_);
- }
-
- private:
- template <typename Function>
- friend class internal::FunctionMocker;
-
- void SetMatchers(const ArgumentMatcherTuple& matchers) {
- matchers_ = matchers;
- }
-
- // The function mocker that owns this spec.
- internal::FunctionMockerBase<F>* const function_mocker_;
- // The argument matchers specified in the spec.
- ArgumentMatcherTuple matchers_;
-
- GTEST_DISALLOW_ASSIGN_(MockSpec);
-}; // class MockSpec
-
-// MSVC warns about using 'this' in base member initializer list, so
-// we need to temporarily disable the warning. We have to do it for
-// the entire class to suppress the warning, even though it's about
-// the constructor only.
-
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4355) // Temporarily disables warning 4355.
-#endif // _MSV_VER
-
-// C++ treats the void type specially. For example, you cannot define
-// a void-typed variable or pass a void value to a function.
-// ActionResultHolder<T> holds a value of type T, where T must be a
-// copyable type or void (T doesn't need to be default-constructable).
-// It hides the syntactic difference between void and other types, and
-// is used to unify the code for invoking both void-returning and
-// non-void-returning mock functions.
-
-// Untyped base class for ActionResultHolder<T>.
-class UntypedActionResultHolderBase {
- public:
- virtual ~UntypedActionResultHolderBase() {}
-
- // Prints the held value as an action's result to os.
- virtual void PrintAsActionResult(::std::ostream* os) const = 0;
-};
-
-// This generic definition is used when T is not void.
-template <typename T>
-class ActionResultHolder : public UntypedActionResultHolderBase {
- public:
- explicit ActionResultHolder(T a_value) : value_(a_value) {}
-
- // The compiler-generated copy constructor and assignment operator
- // are exactly what we need, so we don't need to define them.
-
- // Returns the held value and deletes this object.
- T GetValueAndDelete() const {
- T retval(value_);
- delete this;
- return retval;
- }
-
- // Prints the held value as an action's result to os.
- virtual void PrintAsActionResult(::std::ostream* os) const {
- *os << "\n Returns: ";
- // T may be a reference type, so we don't use UniversalPrint().
- UniversalPrinter<T>::Print(value_, os);
- }
-
- // Performs the given mock function's default action and returns the
- // result in a new-ed ActionResultHolder.
- template <typename F>
- static ActionResultHolder* PerformDefaultAction(
- const FunctionMockerBase<F>* func_mocker,
- const typename Function<F>::ArgumentTuple& args,
- const string& call_description) {
- return new ActionResultHolder(
- func_mocker->PerformDefaultAction(args, call_description));
- }
-
- // Performs the given action and returns the result in a new-ed
- // ActionResultHolder.
- template <typename F>
- static ActionResultHolder*
- PerformAction(const Action<F>& action,
- const typename Function<F>::ArgumentTuple& args) {
- return new ActionResultHolder(action.Perform(args));
- }
-
- private:
- T value_;
-
- // T could be a reference type, so = isn't supported.
- GTEST_DISALLOW_ASSIGN_(ActionResultHolder);
-};
-
-// Specialization for T = void.
-template <>
-class ActionResultHolder<void> : public UntypedActionResultHolderBase {
- public:
- void GetValueAndDelete() const { delete this; }
-
- virtual void PrintAsActionResult(::std::ostream* /* os */) const {}
-
- // Performs the given mock function's default action and returns NULL;
- template <typename F>
- static ActionResultHolder* PerformDefaultAction(
- const FunctionMockerBase<F>* func_mocker,
- const typename Function<F>::ArgumentTuple& args,
- const string& call_description) {
- func_mocker->PerformDefaultAction(args, call_description);
- return NULL;
- }
-
- // Performs the given action and returns NULL.
- template <typename F>
- static ActionResultHolder* PerformAction(
- const Action<F>& action,
- const typename Function<F>::ArgumentTuple& args) {
- action.Perform(args);
- return NULL;
- }
-};
-
-// The base of the function mocker class for the given function type.
-// We put the methods in this class instead of its child to avoid code
-// bloat.
-template <typename F>
-class FunctionMockerBase : public UntypedFunctionMockerBase {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
- typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
-
- FunctionMockerBase() : current_spec_(this) {}
-
- // The destructor verifies that all expectations on this mock
- // function have been satisfied. If not, it will report Google Test
- // non-fatal failures for the violations.
- virtual ~FunctionMockerBase()
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- MutexLock l(&g_gmock_mutex);
- VerifyAndClearExpectationsLocked();
- Mock::UnregisterLocked(this);
- ClearDefaultActionsLocked();
- }
-
- // Returns the ON_CALL spec that matches this mock function with the
- // given arguments; returns NULL if no matching ON_CALL is found.
- // L = *
- const OnCallSpec<F>* FindOnCallSpec(
- const ArgumentTuple& args) const {
- for (UntypedOnCallSpecs::const_reverse_iterator it
- = untyped_on_call_specs_.rbegin();
- it != untyped_on_call_specs_.rend(); ++it) {
- const OnCallSpec<F>* spec = static_cast<const OnCallSpec<F>*>(*it);
- if (spec->Matches(args))
- return spec;
- }
-
- return NULL;
- }
-
- // Performs the default action of this mock function on the given
- // arguments and returns the result. Asserts (or throws if
- // exceptions are enabled) with a helpful call descrption if there
- // is no valid return value. This method doesn't depend on the
- // mutable state of this object, and thus can be called concurrently
- // without locking.
- // L = *
- Result PerformDefaultAction(const ArgumentTuple& args,
- const string& call_description) const {
- const OnCallSpec<F>* const spec =
- this->FindOnCallSpec(args);
- if (spec != NULL) {
- return spec->GetAction().Perform(args);
- }
- const string message = call_description +
- "\n The mock function has no default action "
- "set, and its return type has no default value set.";
-#if GTEST_HAS_EXCEPTIONS
- if (!DefaultValue<Result>::Exists()) {
- throw std::runtime_error(message);
- }
-#else
- Assert(DefaultValue<Result>::Exists(), "", -1, message);
-#endif
- return DefaultValue<Result>::Get();
- }
-
- // Performs the default action with the given arguments and returns
- // the action's result. The call description string will be used in
- // the error message to describe the call in the case the default
- // action fails. The caller is responsible for deleting the result.
- // L = *
- virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
- const void* untyped_args, // must point to an ArgumentTuple
- const string& call_description) const {
- const ArgumentTuple& args =
- *static_cast<const ArgumentTuple*>(untyped_args);
- return ResultHolder::PerformDefaultAction(this, args, call_description);
- }
-
- // Performs the given action with the given arguments and returns
- // the action's result. The caller is responsible for deleting the
- // result.
- // L = *
- virtual UntypedActionResultHolderBase* UntypedPerformAction(
- const void* untyped_action, const void* untyped_args) const {
- // Make a copy of the action before performing it, in case the
- // action deletes the mock object (and thus deletes itself).
- const Action<F> action = *static_cast<const Action<F>*>(untyped_action);
- const ArgumentTuple& args =
- *static_cast<const ArgumentTuple*>(untyped_args);
- return ResultHolder::PerformAction(action, args);
- }
-
- // Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked():
- // clears the ON_CALL()s set on this mock function.
- virtual void ClearDefaultActionsLocked()
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
-
- // Deleting our default actions may trigger other mock objects to be
- // deleted, for example if an action contains a reference counted smart
- // pointer to that mock object, and that is the last reference. So if we
- // delete our actions within the context of the global mutex we may deadlock
- // when this method is called again. Instead, make a copy of the set of
- // actions to delete, clear our set within the mutex, and then delete the
- // actions outside of the mutex.
- UntypedOnCallSpecs specs_to_delete;
- untyped_on_call_specs_.swap(specs_to_delete);
-
- g_gmock_mutex.Unlock();
- for (UntypedOnCallSpecs::const_iterator it =
- specs_to_delete.begin();
- it != specs_to_delete.end(); ++it) {
- delete static_cast<const OnCallSpec<F>*>(*it);
- }
-
- // Lock the mutex again, since the caller expects it to be locked when we
- // return.
- g_gmock_mutex.Lock();
- }
-
- protected:
- template <typename Function>
- friend class MockSpec;
-
- typedef ActionResultHolder<Result> ResultHolder;
-
- // Returns the result of invoking this mock function with the given
- // arguments. This function can be safely called from multiple
- // threads concurrently.
- Result InvokeWith(const ArgumentTuple& args)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- return static_cast<const ResultHolder*>(
- this->UntypedInvokeWith(&args))->GetValueAndDelete();
- }
-
- // Adds and returns a default action spec for this mock function.
- OnCallSpec<F>& AddNewOnCallSpec(
- const char* file, int line,
- const ArgumentMatcherTuple& m)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
- OnCallSpec<F>* const on_call_spec = new OnCallSpec<F>(file, line, m);
- untyped_on_call_specs_.push_back(on_call_spec);
- return *on_call_spec;
- }
-
- // Adds and returns an expectation spec for this mock function.
- TypedExpectation<F>& AddNewExpectation(
- const char* file,
- int line,
- const string& source_text,
- const ArgumentMatcherTuple& m)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
- TypedExpectation<F>* const expectation =
- new TypedExpectation<F>(this, file, line, source_text, m);
- const linked_ptr<ExpectationBase> untyped_expectation(expectation);
- untyped_expectations_.push_back(untyped_expectation);
-
- // Adds this expectation into the implicit sequence if there is one.
- Sequence* const implicit_sequence = g_gmock_implicit_sequence.get();
- if (implicit_sequence != NULL) {
- implicit_sequence->AddExpectation(Expectation(untyped_expectation));
- }
-
- return *expectation;
- }
-
- // The current spec (either default action spec or expectation spec)
- // being described on this function mocker.
- MockSpec<F>& current_spec() { return current_spec_; }
-
- private:
- template <typename Func> friend class TypedExpectation;
-
- // Some utilities needed for implementing UntypedInvokeWith().
-
- // Describes what default action will be performed for the given
- // arguments.
- // L = *
- void DescribeDefaultActionTo(const ArgumentTuple& args,
- ::std::ostream* os) const {
- const OnCallSpec<F>* const spec = FindOnCallSpec(args);
-
- if (spec == NULL) {
- *os << (internal::type_equals<Result, void>::value ?
- "returning directly.\n" :
- "returning default value.\n");
- } else {
- *os << "taking default action specified at:\n"
- << FormatFileLocation(spec->file(), spec->line()) << "\n";
- }
- }
-
- // Writes a message that the call is uninteresting (i.e. neither
- // explicitly expected nor explicitly unexpected) to the given
- // ostream.
- virtual void UntypedDescribeUninterestingCall(
- const void* untyped_args,
- ::std::ostream* os) const
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- const ArgumentTuple& args =
- *static_cast<const ArgumentTuple*>(untyped_args);
- *os << "Uninteresting mock function call - ";
- DescribeDefaultActionTo(args, os);
- *os << " Function call: " << Name();
- UniversalPrint(args, os);
- }
-
- // Returns the expectation that matches the given function arguments
- // (or NULL is there's no match); when a match is found,
- // untyped_action is set to point to the action that should be
- // performed (or NULL if the action is "do default"), and
- // is_excessive is modified to indicate whether the call exceeds the
- // expected number.
- //
- // Critical section: We must find the matching expectation and the
- // corresponding action that needs to be taken in an ATOMIC
- // transaction. Otherwise another thread may call this mock
- // method in the middle and mess up the state.
- //
- // However, performing the action has to be left out of the critical
- // section. The reason is that we have no control on what the
- // action does (it can invoke an arbitrary user function or even a
- // mock function) and excessive locking could cause a dead lock.
- virtual const ExpectationBase* UntypedFindMatchingExpectation(
- const void* untyped_args,
- const void** untyped_action, bool* is_excessive,
- ::std::ostream* what, ::std::ostream* why)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- const ArgumentTuple& args =
- *static_cast<const ArgumentTuple*>(untyped_args);
- MutexLock l(&g_gmock_mutex);
- TypedExpectation<F>* exp = this->FindMatchingExpectationLocked(args);
- if (exp == NULL) { // A match wasn't found.
- this->FormatUnexpectedCallMessageLocked(args, what, why);
- return NULL;
- }
-
- // This line must be done before calling GetActionForArguments(),
- // which will increment the call count for *exp and thus affect
- // its saturation status.
- *is_excessive = exp->IsSaturated();
- const Action<F>* action = exp->GetActionForArguments(this, args, what, why);
- if (action != NULL && action->IsDoDefault())
- action = NULL; // Normalize "do default" to NULL.
- *untyped_action = action;
- return exp;
- }
-
- // Prints the given function arguments to the ostream.
- virtual void UntypedPrintArgs(const void* untyped_args,
- ::std::ostream* os) const {
- const ArgumentTuple& args =
- *static_cast<const ArgumentTuple*>(untyped_args);
- UniversalPrint(args, os);
- }
-
- // Returns the expectation that matches the arguments, or NULL if no
- // expectation matches them.
- TypedExpectation<F>* FindMatchingExpectationLocked(
- const ArgumentTuple& args) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- for (typename UntypedExpectations::const_reverse_iterator it =
- untyped_expectations_.rbegin();
- it != untyped_expectations_.rend(); ++it) {
- TypedExpectation<F>* const exp =
- static_cast<TypedExpectation<F>*>(it->get());
- if (exp->ShouldHandleArguments(args)) {
- return exp;
- }
- }
- return NULL;
- }
-
- // Returns a message that the arguments don't match any expectation.
- void FormatUnexpectedCallMessageLocked(
- const ArgumentTuple& args,
- ::std::ostream* os,
- ::std::ostream* why) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- *os << "\nUnexpected mock function call - ";
- DescribeDefaultActionTo(args, os);
- PrintTriedExpectationsLocked(args, why);
- }
-
- // Prints a list of expectations that have been tried against the
- // current mock function call.
- void PrintTriedExpectationsLocked(
- const ArgumentTuple& args,
- ::std::ostream* why) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- const int count = static_cast<int>(untyped_expectations_.size());
- *why << "Google Mock tried the following " << count << " "
- << (count == 1 ? "expectation, but it didn't match" :
- "expectations, but none matched")
- << ":\n";
- for (int i = 0; i < count; i++) {
- TypedExpectation<F>* const expectation =
- static_cast<TypedExpectation<F>*>(untyped_expectations_[i].get());
- *why << "\n";
- expectation->DescribeLocationTo(why);
- if (count > 1) {
- *why << "tried expectation #" << i << ": ";
- }
- *why << expectation->source_text() << "...\n";
- expectation->ExplainMatchResultTo(args, why);
- expectation->DescribeCallCountTo(why);
- }
- }
-
- // The current spec (either default action spec or expectation spec)
- // being described on this function mocker.
- MockSpec<F> current_spec_;
-
- // There is no generally useful and implementable semantics of
- // copying a mock object, so copying a mock is usually a user error.
- // Thus we disallow copying function mockers. If the user really
- // wants to copy a mock object, he should implement his own copy
- // operation, for example:
- //
- // class MockFoo : public Foo {
- // public:
- // // Defines a copy constructor explicitly.
- // MockFoo(const MockFoo& src) {}
- // ...
- // };
- GTEST_DISALLOW_COPY_AND_ASSIGN_(FunctionMockerBase);
-}; // class FunctionMockerBase
-
-#ifdef _MSC_VER
-# pragma warning(pop) // Restores the warning state.
-#endif // _MSV_VER
-
-// Implements methods of FunctionMockerBase.
-
-// Verifies that all expectations on this mock function have been
-// satisfied. Reports one or more Google Test non-fatal failures and
-// returns false if not.
-
-// Reports an uninteresting call (whose description is in msg) in the
-// manner specified by 'reaction'.
-void ReportUninterestingCall(CallReaction reaction, const string& msg);
-
-} // namespace internal
-
-// The style guide prohibits "using" statements in a namespace scope
-// inside a header file. However, the MockSpec class template is
-// meant to be defined in the ::testing namespace. The following line
-// is just a trick for working around a bug in MSVC 8.0, which cannot
-// handle it if we define MockSpec in ::testing.
-using internal::MockSpec;
-
-// Const(x) is a convenient function for obtaining a const reference
-// to x. This is useful for setting expectations on an overloaded
-// const mock method, e.g.
-//
-// class MockFoo : public FooInterface {
-// public:
-// MOCK_METHOD0(Bar, int());
-// MOCK_CONST_METHOD0(Bar, int&());
-// };
-//
-// MockFoo foo;
-// // Expects a call to non-const MockFoo::Bar().
-// EXPECT_CALL(foo, Bar());
-// // Expects a call to const MockFoo::Bar().
-// EXPECT_CALL(Const(foo), Bar());
-template <typename T>
-inline const T& Const(const T& x) { return x; }
-
-// Constructs an Expectation object that references and co-owns exp.
-inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT
- : expectation_base_(exp.GetHandle().expectation_base()) {}
-
-} // namespace testing
-
-// A separate macro is required to avoid compile errors when the name
-// of the method used in call is a result of macro expansion.
-// See CompilesWithMethodNameExpandedFromMacro tests in
-// internal/gmock-spec-builders_test.cc for more details.
-#define GMOCK_ON_CALL_IMPL_(obj, call) \
- ((obj).gmock_##call).InternalDefaultActionSetAt(__FILE__, __LINE__, \
- #obj, #call)
-#define ON_CALL(obj, call) GMOCK_ON_CALL_IMPL_(obj, call)
-
-#define GMOCK_EXPECT_CALL_IMPL_(obj, call) \
- ((obj).gmock_##call).InternalExpectedAt(__FILE__, __LINE__, #obj, #call)
-#define EXPECT_CALL(obj, call) GMOCK_EXPECT_CALL_IMPL_(obj, call)
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/gmock.h b/third_party/ntcore_2017/gmock/include/gmock/gmock.h
deleted file mode 100644
index 6735c71..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/gmock.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This is the main header file a user should include.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_H_
-
-// This file implements the following syntax:
-//
-// ON_CALL(mock_object.Method(...))
-// .With(...) ?
-// .WillByDefault(...);
-//
-// where With() is optional and WillByDefault() must appear exactly
-// once.
-//
-// EXPECT_CALL(mock_object.Method(...))
-// .With(...) ?
-// .Times(...) ?
-// .InSequence(...) *
-// .WillOnce(...) *
-// .WillRepeatedly(...) ?
-// .RetiresOnSaturation() ? ;
-//
-// where all clauses are optional and WillOnce() can be repeated.
-
-#include "gmock/gmock-actions.h"
-#include "gmock/gmock-cardinalities.h"
-#include "gmock/gmock-generated-actions.h"
-#include "gmock/gmock-generated-function-mockers.h"
-#include "gmock/gmock-generated-nice-strict.h"
-#include "gmock/gmock-generated-matchers.h"
-#include "gmock/gmock-matchers.h"
-#include "gmock/gmock-more-actions.h"
-#include "gmock/gmock-more-matchers.h"
-#include "gmock/internal/gmock-internal-utils.h"
-
-namespace testing {
-
-// Declares Google Mock flags that we want a user to use programmatically.
-GMOCK_DECLARE_bool_(catch_leaked_mocks);
-GMOCK_DECLARE_string_(verbose);
-
-// Initializes Google Mock. This must be called before running the
-// tests. In particular, it parses the command line for the flags
-// that Google Mock recognizes. Whenever a Google Mock flag is seen,
-// it is removed from argv, and *argc is decremented.
-//
-// No value is returned. Instead, the Google Mock flag variables are
-// updated.
-//
-// Since Google Test is needed for Google Mock to work, this function
-// also initializes Google Test and parses its flags, if that hasn't
-// been done.
-GTEST_API_ void InitGoogleMock(int* argc, char** argv);
-
-// This overloaded version can be used in Windows programs compiled in
-// UNICODE mode.
-GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv);
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/internal/gmock-generated-internal-utils.h b/third_party/ntcore_2017/gmock/include/gmock/internal/gmock-generated-internal-utils.h
deleted file mode 100644
index 0225845..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/internal/gmock-generated-internal-utils.h
+++ /dev/null
@@ -1,279 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gmock-generated-internal-utils.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file contains template meta-programming utility classes needed
-// for implementing Google Mock.
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
-
-#include "gmock/internal/gmock-port.h"
-
-namespace testing {
-
-template <typename T>
-class Matcher;
-
-namespace internal {
-
-// An IgnoredValue object can be implicitly constructed from ANY value.
-// This is used in implementing the IgnoreResult(a) action.
-class IgnoredValue {
- public:
- // This constructor template allows any value to be implicitly
- // converted to IgnoredValue. The object has no data member and
- // doesn't try to remember anything about the argument. We
- // deliberately omit the 'explicit' keyword in order to allow the
- // conversion to be implicit.
- template <typename T>
- IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
-};
-
-// MatcherTuple<T>::type is a tuple type where each field is a Matcher
-// for the corresponding field in tuple type T.
-template <typename Tuple>
-struct MatcherTuple;
-
-template <>
-struct MatcherTuple< ::std::tr1::tuple<> > {
- typedef ::std::tr1::tuple< > type;
-};
-
-template <typename A1>
-struct MatcherTuple< ::std::tr1::tuple<A1> > {
- typedef ::std::tr1::tuple<Matcher<A1> > type;
-};
-
-template <typename A1, typename A2>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2> > {
- typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2> > type;
-};
-
-template <typename A1, typename A2, typename A3>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3> > {
- typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4> > {
- typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>,
- Matcher<A4> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5> > {
- typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6> > {
- typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7> > {
- typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6>, Matcher<A7> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
- typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
- typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9, typename A10>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
- A10> > {
- typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9>,
- Matcher<A10> > type;
-};
-
-// Template struct Function<F>, where F must be a function type, contains
-// the following typedefs:
-//
-// Result: the function's return type.
-// ArgumentN: the type of the N-th argument, where N starts with 1.
-// ArgumentTuple: the tuple type consisting of all parameters of F.
-// ArgumentMatcherTuple: the tuple type consisting of Matchers for all
-// parameters of F.
-// MakeResultVoid: the function type obtained by substituting void
-// for the return type of F.
-// MakeResultIgnoredValue:
-// the function type obtained by substituting Something
-// for the return type of F.
-template <typename F>
-struct Function;
-
-template <typename R>
-struct Function<R()> {
- typedef R Result;
- typedef ::std::tr1::tuple<> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid();
- typedef IgnoredValue MakeResultIgnoredValue();
-};
-
-template <typename R, typename A1>
-struct Function<R(A1)>
- : Function<R()> {
- typedef A1 Argument1;
- typedef ::std::tr1::tuple<A1> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1);
- typedef IgnoredValue MakeResultIgnoredValue(A1);
-};
-
-template <typename R, typename A1, typename A2>
-struct Function<R(A1, A2)>
- : Function<R(A1)> {
- typedef A2 Argument2;
- typedef ::std::tr1::tuple<A1, A2> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2);
-};
-
-template <typename R, typename A1, typename A2, typename A3>
-struct Function<R(A1, A2, A3)>
- : Function<R(A1, A2)> {
- typedef A3 Argument3;
- typedef ::std::tr1::tuple<A1, A2, A3> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4>
-struct Function<R(A1, A2, A3, A4)>
- : Function<R(A1, A2, A3)> {
- typedef A4 Argument4;
- typedef ::std::tr1::tuple<A1, A2, A3, A4> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5>
-struct Function<R(A1, A2, A3, A4, A5)>
- : Function<R(A1, A2, A3, A4)> {
- typedef A5 Argument5;
- typedef ::std::tr1::tuple<A1, A2, A3, A4, A5> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6>
-struct Function<R(A1, A2, A3, A4, A5, A6)>
- : Function<R(A1, A2, A3, A4, A5)> {
- typedef A6 Argument6;
- typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7)>
- : Function<R(A1, A2, A3, A4, A5, A6)> {
- typedef A7 Argument7;
- typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8)>
- : Function<R(A1, A2, A3, A4, A5, A6, A7)> {
- typedef A8 Argument8;
- typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
- : Function<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
- typedef A9 Argument9;
- typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
- A9);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9,
- typename A10>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
- : Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
- typedef A10 Argument10;
- typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
- A10> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
- A9, A10);
-};
-
-} // namespace internal
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/internal/gmock-generated-internal-utils.h.pump b/third_party/ntcore_2017/gmock/include/gmock/internal/gmock-generated-internal-utils.h.pump
deleted file mode 100644
index e7ecc8b..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/internal/gmock-generated-internal-utils.h.pump
+++ /dev/null
@@ -1,136 +0,0 @@
-$$ -*- mode: c++; -*-
-$$ This is a Pump source file. Please use Pump to convert it to
-$$ gmock-generated-function-mockers.h.
-$$
-$var n = 10 $$ The maximum arity we support.
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file contains template meta-programming utility classes needed
-// for implementing Google Mock.
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
-
-#include "gmock/internal/gmock-port.h"
-
-namespace testing {
-
-template <typename T>
-class Matcher;
-
-namespace internal {
-
-// An IgnoredValue object can be implicitly constructed from ANY value.
-// This is used in implementing the IgnoreResult(a) action.
-class IgnoredValue {
- public:
- // This constructor template allows any value to be implicitly
- // converted to IgnoredValue. The object has no data member and
- // doesn't try to remember anything about the argument. We
- // deliberately omit the 'explicit' keyword in order to allow the
- // conversion to be implicit.
- template <typename T>
- IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
-};
-
-// MatcherTuple<T>::type is a tuple type where each field is a Matcher
-// for the corresponding field in tuple type T.
-template <typename Tuple>
-struct MatcherTuple;
-
-
-$range i 0..n
-$for i [[
-$range j 1..i
-$var typename_As = [[$for j, [[typename A$j]]]]
-$var As = [[$for j, [[A$j]]]]
-$var matcher_As = [[$for j, [[Matcher<A$j>]]]]
-template <$typename_As>
-struct MatcherTuple< ::std::tr1::tuple<$As> > {
- typedef ::std::tr1::tuple<$matcher_As > type;
-};
-
-
-]]
-// Template struct Function<F>, where F must be a function type, contains
-// the following typedefs:
-//
-// Result: the function's return type.
-// ArgumentN: the type of the N-th argument, where N starts with 1.
-// ArgumentTuple: the tuple type consisting of all parameters of F.
-// ArgumentMatcherTuple: the tuple type consisting of Matchers for all
-// parameters of F.
-// MakeResultVoid: the function type obtained by substituting void
-// for the return type of F.
-// MakeResultIgnoredValue:
-// the function type obtained by substituting Something
-// for the return type of F.
-template <typename F>
-struct Function;
-
-template <typename R>
-struct Function<R()> {
- typedef R Result;
- typedef ::std::tr1::tuple<> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid();
- typedef IgnoredValue MakeResultIgnoredValue();
-};
-
-
-$range i 1..n
-$for i [[
-$range j 1..i
-$var typename_As = [[$for j [[, typename A$j]]]]
-$var As = [[$for j, [[A$j]]]]
-$var matcher_As = [[$for j, [[Matcher<A$j>]]]]
-$range k 1..i-1
-$var prev_As = [[$for k, [[A$k]]]]
-template <typename R$typename_As>
-struct Function<R($As)>
- : Function<R($prev_As)> {
- typedef A$i Argument$i;
- typedef ::std::tr1::tuple<$As> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid($As);
- typedef IgnoredValue MakeResultIgnoredValue($As);
-};
-
-
-]]
-} // namespace internal
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/internal/gmock-internal-utils.h b/third_party/ntcore_2017/gmock/include/gmock/internal/gmock-internal-utils.h
deleted file mode 100644
index e12b7d7..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/internal/gmock-internal-utils.h
+++ /dev/null
@@ -1,498 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file defines some utilities useful for implementing Google
-// Mock. They are subject to change without notice, so please DO NOT
-// USE THEM IN USER CODE.
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
-
-#include <stdio.h>
-#include <ostream> // NOLINT
-#include <string>
-
-#include "gmock/internal/gmock-generated-internal-utils.h"
-#include "gmock/internal/gmock-port.h"
-#include "gtest/gtest.h"
-
-namespace testing {
-namespace internal {
-
-// Converts an identifier name to a space-separated list of lower-case
-// words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is
-// treated as one word. For example, both "FooBar123" and
-// "foo_bar_123" are converted to "foo bar 123".
-GTEST_API_ string ConvertIdentifierNameToWords(const char* id_name);
-
-// PointeeOf<Pointer>::type is the type of a value pointed to by a
-// Pointer, which can be either a smart pointer or a raw pointer. The
-// following default implementation is for the case where Pointer is a
-// smart pointer.
-template <typename Pointer>
-struct PointeeOf {
- // Smart pointer classes define type element_type as the type of
- // their pointees.
- typedef typename Pointer::element_type type;
-};
-// This specialization is for the raw pointer case.
-template <typename T>
-struct PointeeOf<T*> { typedef T type; }; // NOLINT
-
-// GetRawPointer(p) returns the raw pointer underlying p when p is a
-// smart pointer, or returns p itself when p is already a raw pointer.
-// The following default implementation is for the smart pointer case.
-template <typename Pointer>
-inline const typename Pointer::element_type* GetRawPointer(const Pointer& p) {
- return p.get();
-}
-// This overloaded version is for the raw pointer case.
-template <typename Element>
-inline Element* GetRawPointer(Element* p) { return p; }
-
-// This comparator allows linked_ptr to be stored in sets.
-template <typename T>
-struct LinkedPtrLessThan {
- bool operator()(const ::testing::internal::linked_ptr<T>& lhs,
- const ::testing::internal::linked_ptr<T>& rhs) const {
- return lhs.get() < rhs.get();
- }
-};
-
-// Symbian compilation can be done with wchar_t being either a native
-// type or a typedef. Using Google Mock with OpenC without wchar_t
-// should require the definition of _STLP_NO_WCHAR_T.
-//
-// MSVC treats wchar_t as a native type usually, but treats it as the
-// same as unsigned short when the compiler option /Zc:wchar_t- is
-// specified. It defines _NATIVE_WCHAR_T_DEFINED symbol when wchar_t
-// is a native type.
-#if (GTEST_OS_SYMBIAN && defined(_STLP_NO_WCHAR_T)) || \
- (defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED))
-// wchar_t is a typedef.
-#else
-# define GMOCK_WCHAR_T_IS_NATIVE_ 1
-#endif
-
-// signed wchar_t and unsigned wchar_t are NOT in the C++ standard.
-// Using them is a bad practice and not portable. So DON'T use them.
-//
-// Still, Google Mock is designed to work even if the user uses signed
-// wchar_t or unsigned wchar_t (obviously, assuming the compiler
-// supports them).
-//
-// To gcc,
-// wchar_t == signed wchar_t != unsigned wchar_t == unsigned int
-#ifdef __GNUC__
-// signed/unsigned wchar_t are valid types.
-# define GMOCK_HAS_SIGNED_WCHAR_T_ 1
-#endif
-
-// In what follows, we use the term "kind" to indicate whether a type
-// is bool, an integer type (excluding bool), a floating-point type,
-// or none of them. This categorization is useful for determining
-// when a matcher argument type can be safely converted to another
-// type in the implementation of SafeMatcherCast.
-enum TypeKind {
- kBool, kInteger, kFloatingPoint, kOther
-};
-
-// KindOf<T>::value is the kind of type T.
-template <typename T> struct KindOf {
- enum { value = kOther }; // The default kind.
-};
-
-// This macro declares that the kind of 'type' is 'kind'.
-#define GMOCK_DECLARE_KIND_(type, kind) \
- template <> struct KindOf<type> { enum { value = kind }; }
-
-GMOCK_DECLARE_KIND_(bool, kBool);
-
-// All standard integer types.
-GMOCK_DECLARE_KIND_(char, kInteger);
-GMOCK_DECLARE_KIND_(signed char, kInteger);
-GMOCK_DECLARE_KIND_(unsigned char, kInteger);
-GMOCK_DECLARE_KIND_(short, kInteger); // NOLINT
-GMOCK_DECLARE_KIND_(unsigned short, kInteger); // NOLINT
-GMOCK_DECLARE_KIND_(int, kInteger);
-GMOCK_DECLARE_KIND_(unsigned int, kInteger);
-GMOCK_DECLARE_KIND_(long, kInteger); // NOLINT
-GMOCK_DECLARE_KIND_(unsigned long, kInteger); // NOLINT
-
-#if GMOCK_WCHAR_T_IS_NATIVE_
-GMOCK_DECLARE_KIND_(wchar_t, kInteger);
-#endif
-
-// Non-standard integer types.
-GMOCK_DECLARE_KIND_(Int64, kInteger);
-GMOCK_DECLARE_KIND_(UInt64, kInteger);
-
-// All standard floating-point types.
-GMOCK_DECLARE_KIND_(float, kFloatingPoint);
-GMOCK_DECLARE_KIND_(double, kFloatingPoint);
-GMOCK_DECLARE_KIND_(long double, kFloatingPoint);
-
-#undef GMOCK_DECLARE_KIND_
-
-// Evaluates to the kind of 'type'.
-#define GMOCK_KIND_OF_(type) \
- static_cast< ::testing::internal::TypeKind>( \
- ::testing::internal::KindOf<type>::value)
-
-// Evaluates to true iff integer type T is signed.
-#define GMOCK_IS_SIGNED_(T) (static_cast<T>(-1) < 0)
-
-// LosslessArithmeticConvertibleImpl<kFromKind, From, kToKind, To>::value
-// is true iff arithmetic type From can be losslessly converted to
-// arithmetic type To.
-//
-// It's the user's responsibility to ensure that both From and To are
-// raw (i.e. has no CV modifier, is not a pointer, and is not a
-// reference) built-in arithmetic types, kFromKind is the kind of
-// From, and kToKind is the kind of To; the value is
-// implementation-defined when the above pre-condition is violated.
-template <TypeKind kFromKind, typename From, TypeKind kToKind, typename To>
-struct LosslessArithmeticConvertibleImpl : public false_type {};
-
-// Converting bool to bool is lossless.
-template <>
-struct LosslessArithmeticConvertibleImpl<kBool, bool, kBool, bool>
- : public true_type {}; // NOLINT
-
-// Converting bool to any integer type is lossless.
-template <typename To>
-struct LosslessArithmeticConvertibleImpl<kBool, bool, kInteger, To>
- : public true_type {}; // NOLINT
-
-// Converting bool to any floating-point type is lossless.
-template <typename To>
-struct LosslessArithmeticConvertibleImpl<kBool, bool, kFloatingPoint, To>
- : public true_type {}; // NOLINT
-
-// Converting an integer to bool is lossy.
-template <typename From>
-struct LosslessArithmeticConvertibleImpl<kInteger, From, kBool, bool>
- : public false_type {}; // NOLINT
-
-// Converting an integer to another non-bool integer is lossless iff
-// the target type's range encloses the source type's range.
-template <typename From, typename To>
-struct LosslessArithmeticConvertibleImpl<kInteger, From, kInteger, To>
- : public bool_constant<
- // When converting from a smaller size to a larger size, we are
- // fine as long as we are not converting from signed to unsigned.
- ((sizeof(From) < sizeof(To)) &&
- (!GMOCK_IS_SIGNED_(From) || GMOCK_IS_SIGNED_(To))) ||
- // When converting between the same size, the signedness must match.
- ((sizeof(From) == sizeof(To)) &&
- (GMOCK_IS_SIGNED_(From) == GMOCK_IS_SIGNED_(To)))> {}; // NOLINT
-
-#undef GMOCK_IS_SIGNED_
-
-// Converting an integer to a floating-point type may be lossy, since
-// the format of a floating-point number is implementation-defined.
-template <typename From, typename To>
-struct LosslessArithmeticConvertibleImpl<kInteger, From, kFloatingPoint, To>
- : public false_type {}; // NOLINT
-
-// Converting a floating-point to bool is lossy.
-template <typename From>
-struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kBool, bool>
- : public false_type {}; // NOLINT
-
-// Converting a floating-point to an integer is lossy.
-template <typename From, typename To>
-struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kInteger, To>
- : public false_type {}; // NOLINT
-
-// Converting a floating-point to another floating-point is lossless
-// iff the target type is at least as big as the source type.
-template <typename From, typename To>
-struct LosslessArithmeticConvertibleImpl<
- kFloatingPoint, From, kFloatingPoint, To>
- : public bool_constant<sizeof(From) <= sizeof(To)> {}; // NOLINT
-
-// LosslessArithmeticConvertible<From, To>::value is true iff arithmetic
-// type From can be losslessly converted to arithmetic type To.
-//
-// It's the user's responsibility to ensure that both From and To are
-// raw (i.e. has no CV modifier, is not a pointer, and is not a
-// reference) built-in arithmetic types; the value is
-// implementation-defined when the above pre-condition is violated.
-template <typename From, typename To>
-struct LosslessArithmeticConvertible
- : public LosslessArithmeticConvertibleImpl<
- GMOCK_KIND_OF_(From), From, GMOCK_KIND_OF_(To), To> {}; // NOLINT
-
-// This interface knows how to report a Google Mock failure (either
-// non-fatal or fatal).
-class FailureReporterInterface {
- public:
- // The type of a failure (either non-fatal or fatal).
- enum FailureType {
- kNonfatal, kFatal
- };
-
- virtual ~FailureReporterInterface() {}
-
- // Reports a failure that occurred at the given source file location.
- virtual void ReportFailure(FailureType type, const char* file, int line,
- const string& message) = 0;
-};
-
-// Returns the failure reporter used by Google Mock.
-GTEST_API_ FailureReporterInterface* GetFailureReporter();
-
-// Asserts that condition is true; aborts the process with the given
-// message if condition is false. We cannot use LOG(FATAL) or CHECK()
-// as Google Mock might be used to mock the log sink itself. We
-// inline this function to prevent it from showing up in the stack
-// trace.
-inline void Assert(bool condition, const char* file, int line,
- const string& msg) {
- if (!condition) {
- GetFailureReporter()->ReportFailure(FailureReporterInterface::kFatal,
- file, line, msg);
- }
-}
-inline void Assert(bool condition, const char* file, int line) {
- Assert(condition, file, line, "Assertion failed.");
-}
-
-// Verifies that condition is true; generates a non-fatal failure if
-// condition is false.
-inline void Expect(bool condition, const char* file, int line,
- const string& msg) {
- if (!condition) {
- GetFailureReporter()->ReportFailure(FailureReporterInterface::kNonfatal,
- file, line, msg);
- }
-}
-inline void Expect(bool condition, const char* file, int line) {
- Expect(condition, file, line, "Expectation failed.");
-}
-
-// Severity level of a log.
-enum LogSeverity {
- kInfo = 0,
- kWarning = 1
-};
-
-// Valid values for the --gmock_verbose flag.
-
-// All logs (informational and warnings) are printed.
-const char kInfoVerbosity[] = "info";
-// Only warnings are printed.
-const char kWarningVerbosity[] = "warning";
-// No logs are printed.
-const char kErrorVerbosity[] = "error";
-
-// Returns true iff a log with the given severity is visible according
-// to the --gmock_verbose flag.
-GTEST_API_ bool LogIsVisible(LogSeverity severity);
-
-// Prints the given message to stdout iff 'severity' >= the level
-// specified by the --gmock_verbose flag. If stack_frames_to_skip >=
-// 0, also prints the stack trace excluding the top
-// stack_frames_to_skip frames. In opt mode, any positive
-// stack_frames_to_skip is treated as 0, since we don't know which
-// function calls will be inlined by the compiler and need to be
-// conservative.
-GTEST_API_ void Log(LogSeverity severity,
- const string& message,
- int stack_frames_to_skip);
-
-// TODO(wan@google.com): group all type utilities together.
-
-// Type traits.
-
-// is_reference<T>::value is non-zero iff T is a reference type.
-template <typename T> struct is_reference : public false_type {};
-template <typename T> struct is_reference<T&> : public true_type {};
-
-// type_equals<T1, T2>::value is non-zero iff T1 and T2 are the same type.
-template <typename T1, typename T2> struct type_equals : public false_type {};
-template <typename T> struct type_equals<T, T> : public true_type {};
-
-// remove_reference<T>::type removes the reference from type T, if any.
-template <typename T> struct remove_reference { typedef T type; }; // NOLINT
-template <typename T> struct remove_reference<T&> { typedef T type; }; // NOLINT
-
-// DecayArray<T>::type turns an array type U[N] to const U* and preserves
-// other types. Useful for saving a copy of a function argument.
-template <typename T> struct DecayArray { typedef T type; }; // NOLINT
-template <typename T, size_t N> struct DecayArray<T[N]> {
- typedef const T* type;
-};
-// Sometimes people use arrays whose size is not available at the use site
-// (e.g. extern const char kNamePrefix[]). This specialization covers that
-// case.
-template <typename T> struct DecayArray<T[]> {
- typedef const T* type;
-};
-
-// Invalid<T>() returns an invalid value of type T. This is useful
-// when a value of type T is needed for compilation, but the statement
-// will not really be executed (or we don't care if the statement
-// crashes).
-template <typename T>
-inline T Invalid() {
- return const_cast<typename remove_reference<T>::type&>(
- *static_cast<volatile typename remove_reference<T>::type*>(NULL));
-}
-template <>
-inline void Invalid<void>() {}
-
-// Given a raw type (i.e. having no top-level reference or const
-// modifier) RawContainer that's either an STL-style container or a
-// native array, class StlContainerView<RawContainer> has the
-// following members:
-//
-// - type is a type that provides an STL-style container view to
-// (i.e. implements the STL container concept for) RawContainer;
-// - const_reference is a type that provides a reference to a const
-// RawContainer;
-// - ConstReference(raw_container) returns a const reference to an STL-style
-// container view to raw_container, which is a RawContainer.
-// - Copy(raw_container) returns an STL-style container view of a
-// copy of raw_container, which is a RawContainer.
-//
-// This generic version is used when RawContainer itself is already an
-// STL-style container.
-template <class RawContainer>
-class StlContainerView {
- public:
- typedef RawContainer type;
- typedef const type& const_reference;
-
- static const_reference ConstReference(const RawContainer& container) {
- // Ensures that RawContainer is not a const type.
- testing::StaticAssertTypeEq<RawContainer,
- GTEST_REMOVE_CONST_(RawContainer)>();
- return container;
- }
- static type Copy(const RawContainer& container) { return container; }
-};
-
-// This specialization is used when RawContainer is a native array type.
-template <typename Element, size_t N>
-class StlContainerView<Element[N]> {
- public:
- typedef GTEST_REMOVE_CONST_(Element) RawElement;
- typedef internal::NativeArray<RawElement> type;
- // NativeArray<T> can represent a native array either by value or by
- // reference (selected by a constructor argument), so 'const type'
- // can be used to reference a const native array. We cannot
- // 'typedef const type& const_reference' here, as that would mean
- // ConstReference() has to return a reference to a local variable.
- typedef const type const_reference;
-
- static const_reference ConstReference(const Element (&array)[N]) {
- // Ensures that Element is not a const type.
- testing::StaticAssertTypeEq<Element, RawElement>();
-#if GTEST_OS_SYMBIAN
- // The Nokia Symbian compiler confuses itself in template instantiation
- // for this call without the cast to Element*:
- // function call '[testing::internal::NativeArray<char *>].NativeArray(
- // {lval} const char *[4], long, testing::internal::RelationToSource)'
- // does not match
- // 'testing::internal::NativeArray<char *>::NativeArray(
- // char *const *, unsigned int, testing::internal::RelationToSource)'
- // (instantiating: 'testing::internal::ContainsMatcherImpl
- // <const char * (&)[4]>::Matches(const char * (&)[4]) const')
- // (instantiating: 'testing::internal::StlContainerView<char *[4]>::
- // ConstReference(const char * (&)[4])')
- // (and though the N parameter type is mismatched in the above explicit
- // conversion of it doesn't help - only the conversion of the array).
- return type(const_cast<Element*>(&array[0]), N, kReference);
-#else
- return type(array, N, kReference);
-#endif // GTEST_OS_SYMBIAN
- }
- static type Copy(const Element (&array)[N]) {
-#if GTEST_OS_SYMBIAN
- return type(const_cast<Element*>(&array[0]), N, kCopy);
-#else
- return type(array, N, kCopy);
-#endif // GTEST_OS_SYMBIAN
- }
-};
-
-// This specialization is used when RawContainer is a native array
-// represented as a (pointer, size) tuple.
-template <typename ElementPointer, typename Size>
-class StlContainerView< ::std::tr1::tuple<ElementPointer, Size> > {
- public:
- typedef GTEST_REMOVE_CONST_(
- typename internal::PointeeOf<ElementPointer>::type) RawElement;
- typedef internal::NativeArray<RawElement> type;
- typedef const type const_reference;
-
- static const_reference ConstReference(
- const ::std::tr1::tuple<ElementPointer, Size>& array) {
- using ::std::tr1::get;
- return type(get<0>(array), get<1>(array), kReference);
- }
- static type Copy(const ::std::tr1::tuple<ElementPointer, Size>& array) {
- using ::std::tr1::get;
- return type(get<0>(array), get<1>(array), kCopy);
- }
-};
-
-// The following specialization prevents the user from instantiating
-// StlContainer with a reference type.
-template <typename T> class StlContainerView<T&>;
-
-// A type transform to remove constness from the first part of a pair.
-// Pairs like that are used as the value_type of associative containers,
-// and this transform produces a similar but assignable pair.
-template <typename T>
-struct RemoveConstFromKey {
- typedef T type;
-};
-
-// Partially specialized to remove constness from std::pair<const K, V>.
-template <typename K, typename V>
-struct RemoveConstFromKey<std::pair<const K, V> > {
- typedef std::pair<K, V> type;
-};
-
-// Mapping from booleans to types. Similar to boost::bool_<kValue> and
-// std::integral_constant<bool, kValue>.
-template <bool kValue>
-struct BooleanConstant {};
-
-} // namespace internal
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
diff --git a/third_party/ntcore_2017/gmock/include/gmock/internal/gmock-port.h b/third_party/ntcore_2017/gmock/include/gmock/internal/gmock-port.h
deleted file mode 100644
index b6c5c7f..0000000
--- a/third_party/ntcore_2017/gmock/include/gmock/internal/gmock-port.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: vadimb@google.com (Vadim Berman)
-//
-// Low-level types and utilities for porting Google Mock to various
-// platforms. They are subject to change without notice. DO NOT USE
-// THEM IN USER CODE.
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
-
-#include <assert.h>
-#include <stdlib.h>
-#include <iostream>
-
-// Most of the types needed for porting Google Mock are also required
-// for Google Test and are defined in gtest-port.h.
-#include "gtest/internal/gtest-linked_ptr.h"
-#include "gtest/internal/gtest-port.h"
-
-// To avoid conditional compilation everywhere, we make it
-// gmock-port.h's responsibility to #include the header implementing
-// tr1/tuple. gmock-port.h does this via gtest-port.h, which is
-// guaranteed to pull in the tuple header.
-
-// For MS Visual C++, check the compiler version. At least VS 2003 is
-// required to compile Google Mock.
-#if defined(_MSC_VER) && _MSC_VER < 1310
-# error "At least Visual C++ 2003 (7.1) is required to compile Google Mock."
-#endif
-
-// Macro for referencing flags. This is public as we want the user to
-// use this syntax to reference Google Mock flags.
-#define GMOCK_FLAG(name) FLAGS_gmock_##name
-
-// Macros for declaring flags.
-#define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name)
-#define GMOCK_DECLARE_int32_(name) \
- extern GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name)
-#define GMOCK_DECLARE_string_(name) \
- extern GTEST_API_ ::std::string GMOCK_FLAG(name)
-
-// Macros for defining flags.
-#define GMOCK_DEFINE_bool_(name, default_val, doc) \
- GTEST_API_ bool GMOCK_FLAG(name) = (default_val)
-#define GMOCK_DEFINE_int32_(name, default_val, doc) \
- GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) = (default_val)
-#define GMOCK_DEFINE_string_(name, default_val, doc) \
- GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val)
-
-#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
diff --git a/third_party/ntcore_2017/gmock/src/gmock-all.cc b/third_party/ntcore_2017/gmock/src/gmock-all.cc
deleted file mode 100644
index 7aebce7..0000000
--- a/third_party/ntcore_2017/gmock/src/gmock-all.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// Google C++ Mocking Framework (Google Mock)
-//
-// This file #includes all Google Mock implementation .cc files. The
-// purpose is to allow a user to build Google Mock by compiling this
-// file alone.
-
-// This line ensures that gmock.h can be compiled on its own, even
-// when it's fused.
-#include "gmock/gmock.h"
-
-// The following lines pull in the real gmock *.cc files.
-#include "src/gmock-cardinalities.cc"
-#include "src/gmock-internal-utils.cc"
-#include "src/gmock-matchers.cc"
-#include "src/gmock-spec-builders.cc"
-#include "src/gmock.cc"
diff --git a/third_party/ntcore_2017/gmock/src/gmock-cardinalities.cc b/third_party/ntcore_2017/gmock/src/gmock-cardinalities.cc
deleted file mode 100644
index 50ec728..0000000
--- a/third_party/ntcore_2017/gmock/src/gmock-cardinalities.cc
+++ /dev/null
@@ -1,156 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements cardinalities.
-
-#include "gmock/gmock-cardinalities.h"
-
-#include <limits.h>
-#include <ostream> // NOLINT
-#include <sstream>
-#include <string>
-#include "gmock/internal/gmock-internal-utils.h"
-#include "gtest/gtest.h"
-
-namespace testing {
-
-namespace {
-
-// Implements the Between(m, n) cardinality.
-class BetweenCardinalityImpl : public CardinalityInterface {
- public:
- BetweenCardinalityImpl(int min, int max)
- : min_(min >= 0 ? min : 0),
- max_(max >= min_ ? max : min_) {
- std::stringstream ss;
- if (min < 0) {
- ss << "The invocation lower bound must be >= 0, "
- << "but is actually " << min << ".";
- internal::Expect(false, __FILE__, __LINE__, ss.str());
- } else if (max < 0) {
- ss << "The invocation upper bound must be >= 0, "
- << "but is actually " << max << ".";
- internal::Expect(false, __FILE__, __LINE__, ss.str());
- } else if (min > max) {
- ss << "The invocation upper bound (" << max
- << ") must be >= the invocation lower bound (" << min
- << ").";
- internal::Expect(false, __FILE__, __LINE__, ss.str());
- }
- }
-
- // Conservative estimate on the lower/upper bound of the number of
- // calls allowed.
- virtual int ConservativeLowerBound() const { return min_; }
- virtual int ConservativeUpperBound() const { return max_; }
-
- virtual bool IsSatisfiedByCallCount(int call_count) const {
- return min_ <= call_count && call_count <= max_;
- }
-
- virtual bool IsSaturatedByCallCount(int call_count) const {
- return call_count >= max_;
- }
-
- virtual void DescribeTo(::std::ostream* os) const;
-
- private:
- const int min_;
- const int max_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(BetweenCardinalityImpl);
-};
-
-// Formats "n times" in a human-friendly way.
-inline internal::string FormatTimes(int n) {
- if (n == 1) {
- return "once";
- } else if (n == 2) {
- return "twice";
- } else {
- std::stringstream ss;
- ss << n << " times";
- return ss.str();
- }
-}
-
-// Describes the Between(m, n) cardinality in human-friendly text.
-void BetweenCardinalityImpl::DescribeTo(::std::ostream* os) const {
- if (min_ == 0) {
- if (max_ == 0) {
- *os << "never called";
- } else if (max_ == INT_MAX) {
- *os << "called any number of times";
- } else {
- *os << "called at most " << FormatTimes(max_);
- }
- } else if (min_ == max_) {
- *os << "called " << FormatTimes(min_);
- } else if (max_ == INT_MAX) {
- *os << "called at least " << FormatTimes(min_);
- } else {
- // 0 < min_ < max_ < INT_MAX
- *os << "called between " << min_ << " and " << max_ << " times";
- }
-}
-
-} // Unnamed namespace
-
-// Describes the given call count to an ostream.
-void Cardinality::DescribeActualCallCountTo(int actual_call_count,
- ::std::ostream* os) {
- if (actual_call_count > 0) {
- *os << "called " << FormatTimes(actual_call_count);
- } else {
- *os << "never called";
- }
-}
-
-// Creates a cardinality that allows at least n calls.
-GTEST_API_ Cardinality AtLeast(int n) { return Between(n, INT_MAX); }
-
-// Creates a cardinality that allows at most n calls.
-GTEST_API_ Cardinality AtMost(int n) { return Between(0, n); }
-
-// Creates a cardinality that allows any number of calls.
-GTEST_API_ Cardinality AnyNumber() { return AtLeast(0); }
-
-// Creates a cardinality that allows between min and max calls.
-GTEST_API_ Cardinality Between(int min, int max) {
- return Cardinality(new BetweenCardinalityImpl(min, max));
-}
-
-// Creates a cardinality that allows exactly n calls.
-GTEST_API_ Cardinality Exactly(int n) { return Between(n, n); }
-
-} // namespace testing
diff --git a/third_party/ntcore_2017/gmock/src/gmock-internal-utils.cc b/third_party/ntcore_2017/gmock/src/gmock-internal-utils.cc
deleted file mode 100644
index fb53080..0000000
--- a/third_party/ntcore_2017/gmock/src/gmock-internal-utils.cc
+++ /dev/null
@@ -1,174 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file defines some utilities useful for implementing Google
-// Mock. They are subject to change without notice, so please DO NOT
-// USE THEM IN USER CODE.
-
-#include "gmock/internal/gmock-internal-utils.h"
-
-#include <ctype.h>
-#include <ostream> // NOLINT
-#include <string>
-#include "gmock/gmock.h"
-#include "gmock/internal/gmock-port.h"
-#include "gtest/gtest.h"
-
-namespace testing {
-namespace internal {
-
-// Converts an identifier name to a space-separated list of lower-case
-// words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is
-// treated as one word. For example, both "FooBar123" and
-// "foo_bar_123" are converted to "foo bar 123".
-GTEST_API_ string ConvertIdentifierNameToWords(const char* id_name) {
- string result;
- char prev_char = '\0';
- for (const char* p = id_name; *p != '\0'; prev_char = *(p++)) {
- // We don't care about the current locale as the input is
- // guaranteed to be a valid C++ identifier name.
- const bool starts_new_word = IsUpper(*p) ||
- (!IsAlpha(prev_char) && IsLower(*p)) ||
- (!IsDigit(prev_char) && IsDigit(*p));
-
- if (IsAlNum(*p)) {
- if (starts_new_word && result != "")
- result += ' ';
- result += ToLower(*p);
- }
- }
- return result;
-}
-
-// This class reports Google Mock failures as Google Test failures. A
-// user can define another class in a similar fashion if he intends to
-// use Google Mock with a testing framework other than Google Test.
-class GoogleTestFailureReporter : public FailureReporterInterface {
- public:
- virtual void ReportFailure(FailureType type, const char* file, int line,
- const string& message) {
- AssertHelper(type == kFatal ?
- TestPartResult::kFatalFailure :
- TestPartResult::kNonFatalFailure,
- file,
- line,
- message.c_str()) = Message();
- if (type == kFatal) {
- posix::Abort();
- }
- }
-};
-
-// Returns the global failure reporter. Will create a
-// GoogleTestFailureReporter and return it the first time called.
-GTEST_API_ FailureReporterInterface* GetFailureReporter() {
- // Points to the global failure reporter used by Google Mock. gcc
- // guarantees that the following use of failure_reporter is
- // thread-safe. We may need to add additional synchronization to
- // protect failure_reporter if we port Google Mock to other
- // compilers.
- static FailureReporterInterface* const failure_reporter =
- new GoogleTestFailureReporter();
- return failure_reporter;
-}
-
-// Protects global resources (stdout in particular) used by Log().
-static GTEST_DEFINE_STATIC_MUTEX_(g_log_mutex);
-
-// Returns true iff a log with the given severity is visible according
-// to the --gmock_verbose flag.
-GTEST_API_ bool LogIsVisible(LogSeverity severity) {
- if (GMOCK_FLAG(verbose) == kInfoVerbosity) {
- // Always show the log if --gmock_verbose=info.
- return true;
- } else if (GMOCK_FLAG(verbose) == kErrorVerbosity) {
- // Always hide it if --gmock_verbose=error.
- return false;
- } else {
- // If --gmock_verbose is neither "info" nor "error", we treat it
- // as "warning" (its default value).
- return severity == kWarning;
- }
-}
-
-// Prints the given message to stdout iff 'severity' >= the level
-// specified by the --gmock_verbose flag. If stack_frames_to_skip >=
-// 0, also prints the stack trace excluding the top
-// stack_frames_to_skip frames. In opt mode, any positive
-// stack_frames_to_skip is treated as 0, since we don't know which
-// function calls will be inlined by the compiler and need to be
-// conservative.
-GTEST_API_ void Log(LogSeverity severity,
- const string& message,
- int stack_frames_to_skip) {
- if (!LogIsVisible(severity))
- return;
-
- // Ensures that logs from different threads don't interleave.
- MutexLock l(&g_log_mutex);
-
- // "using ::std::cout;" doesn't work with Symbian's STLport, where cout is a
- // macro.
-
- if (severity == kWarning) {
- // Prints a GMOCK WARNING marker to make the warnings easily searchable.
- std::cout << "\nGMOCK WARNING:";
- }
- // Pre-pends a new-line to message if it doesn't start with one.
- if (message.empty() || message[0] != '\n') {
- std::cout << "\n";
- }
- std::cout << message;
- if (stack_frames_to_skip >= 0) {
-#ifdef NDEBUG
- // In opt mode, we have to be conservative and skip no stack frame.
- const int actual_to_skip = 0;
-#else
- // In dbg mode, we can do what the caller tell us to do (plus one
- // for skipping this function's stack frame).
- const int actual_to_skip = stack_frames_to_skip + 1;
-#endif // NDEBUG
-
- // Appends a new-line to message if it doesn't end with one.
- if (!message.empty() && *message.rbegin() != '\n') {
- std::cout << "\n";
- }
- std::cout << "Stack trace:\n"
- << ::testing::internal::GetCurrentOsStackTraceExceptTop(
- ::testing::UnitTest::GetInstance(), actual_to_skip);
- }
- std::cout << ::std::flush;
-}
-
-} // namespace internal
-} // namespace testing
diff --git a/third_party/ntcore_2017/gmock/src/gmock-matchers.cc b/third_party/ntcore_2017/gmock/src/gmock-matchers.cc
deleted file mode 100644
index 9ed29ab..0000000
--- a/third_party/ntcore_2017/gmock/src/gmock-matchers.cc
+++ /dev/null
@@ -1,498 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements Matcher<const string&>, Matcher<string>, and
-// utilities for defining matchers.
-
-#include "gmock/gmock-matchers.h"
-#include "gmock/gmock-generated-matchers.h"
-
-#include <string.h>
-#include <sstream>
-#include <string>
-
-namespace testing {
-
-// Constructs a matcher that matches a const string& whose value is
-// equal to s.
-Matcher<const internal::string&>::Matcher(const internal::string& s) {
- *this = Eq(s);
-}
-
-// Constructs a matcher that matches a const string& whose value is
-// equal to s.
-Matcher<const internal::string&>::Matcher(const char* s) {
- *this = Eq(internal::string(s));
-}
-
-// Constructs a matcher that matches a string whose value is equal to s.
-Matcher<internal::string>::Matcher(const internal::string& s) { *this = Eq(s); }
-
-// Constructs a matcher that matches a string whose value is equal to s.
-Matcher<internal::string>::Matcher(const char* s) {
- *this = Eq(internal::string(s));
-}
-
-#if GTEST_HAS_STRING_PIECE_
-// Constructs a matcher that matches a const StringPiece& whose value is
-// equal to s.
-Matcher<const StringPiece&>::Matcher(const internal::string& s) {
- *this = Eq(s);
-}
-
-// Constructs a matcher that matches a const StringPiece& whose value is
-// equal to s.
-Matcher<const StringPiece&>::Matcher(const char* s) {
- *this = Eq(internal::string(s));
-}
-
-// Constructs a matcher that matches a const StringPiece& whose value is
-// equal to s.
-Matcher<const StringPiece&>::Matcher(StringPiece s) {
- *this = Eq(s.ToString());
-}
-
-// Constructs a matcher that matches a StringPiece whose value is equal to s.
-Matcher<StringPiece>::Matcher(const internal::string& s) {
- *this = Eq(s);
-}
-
-// Constructs a matcher that matches a StringPiece whose value is equal to s.
-Matcher<StringPiece>::Matcher(const char* s) {
- *this = Eq(internal::string(s));
-}
-
-// Constructs a matcher that matches a StringPiece whose value is equal to s.
-Matcher<StringPiece>::Matcher(StringPiece s) {
- *this = Eq(s.ToString());
-}
-#endif // GTEST_HAS_STRING_PIECE_
-
-namespace internal {
-
-// Joins a vector of strings as if they are fields of a tuple; returns
-// the joined string.
-GTEST_API_ string JoinAsTuple(const Strings& fields) {
- switch (fields.size()) {
- case 0:
- return "";
- case 1:
- return fields[0];
- default:
- string result = "(" + fields[0];
- for (size_t i = 1; i < fields.size(); i++) {
- result += ", ";
- result += fields[i];
- }
- result += ")";
- return result;
- }
-}
-
-// Returns the description for a matcher defined using the MATCHER*()
-// macro where the user-supplied description string is "", if
-// 'negation' is false; otherwise returns the description of the
-// negation of the matcher. 'param_values' contains a list of strings
-// that are the print-out of the matcher's parameters.
-GTEST_API_ string FormatMatcherDescription(bool negation,
- const char* matcher_name,
- const Strings& param_values) {
- string result = ConvertIdentifierNameToWords(matcher_name);
- if (param_values.size() >= 1)
- result += " " + JoinAsTuple(param_values);
- return negation ? "not (" + result + ")" : result;
-}
-
-// FindMaxBipartiteMatching and its helper class.
-//
-// Uses the well-known Ford-Fulkerson max flow method to find a maximum
-// bipartite matching. Flow is considered to be from left to right.
-// There is an implicit source node that is connected to all of the left
-// nodes, and an implicit sink node that is connected to all of the
-// right nodes. All edges have unit capacity.
-//
-// Neither the flow graph nor the residual flow graph are represented
-// explicitly. Instead, they are implied by the information in 'graph' and
-// a vector<int> called 'left_' whose elements are initialized to the
-// value kUnused. This represents the initial state of the algorithm,
-// where the flow graph is empty, and the residual flow graph has the
-// following edges:
-// - An edge from source to each left_ node
-// - An edge from each right_ node to sink
-// - An edge from each left_ node to each right_ node, if the
-// corresponding edge exists in 'graph'.
-//
-// When the TryAugment() method adds a flow, it sets left_[l] = r for some
-// nodes l and r. This induces the following changes:
-// - The edges (source, l), (l, r), and (r, sink) are added to the
-// flow graph.
-// - The same three edges are removed from the residual flow graph.
-// - The reverse edges (l, source), (r, l), and (sink, r) are added
-// to the residual flow graph, which is a directional graph
-// representing unused flow capacity.
-//
-// When the method augments a flow (moving left_[l] from some r1 to some
-// other r2), this can be thought of as "undoing" the above steps with
-// respect to r1 and "redoing" them with respect to r2.
-//
-// It bears repeating that the flow graph and residual flow graph are
-// never represented explicitly, but can be derived by looking at the
-// information in 'graph' and in left_.
-//
-// As an optimization, there is a second vector<int> called right_ which
-// does not provide any new information. Instead, it enables more
-// efficient queries about edges entering or leaving the right-side nodes
-// of the flow or residual flow graphs. The following invariants are
-// maintained:
-//
-// left[l] == kUnused or right[left[l]] == l
-// right[r] == kUnused or left[right[r]] == r
-//
-// . [ source ] .
-// . ||| .
-// . ||| .
-// . ||\--> left[0]=1 ---\ right[0]=-1 ----\ .
-// . || | | .
-// . |\---> left[1]=-1 \--> right[1]=0 ---\| .
-// . | || .
-// . \----> left[2]=2 ------> right[2]=2 --\|| .
-// . ||| .
-// . elements matchers vvv .
-// . [ sink ] .
-//
-// See Also:
-// [1] Cormen, et al (2001). "Section 26.2: The Ford–Fulkerson method".
-// "Introduction to Algorithms (Second ed.)", pp. 651–664.
-// [2] "Ford–Fulkerson algorithm", Wikipedia,
-// 'http://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algorithm'
-class MaxBipartiteMatchState {
- public:
- explicit MaxBipartiteMatchState(const MatchMatrix& graph)
- : graph_(&graph),
- left_(graph_->LhsSize(), kUnused),
- right_(graph_->RhsSize(), kUnused) {
- }
-
- // Returns the edges of a maximal match, each in the form {left, right}.
- ElementMatcherPairs Compute() {
- // 'seen' is used for path finding { 0: unseen, 1: seen }.
- ::std::vector<char> seen;
- // Searches the residual flow graph for a path from each left node to
- // the sink in the residual flow graph, and if one is found, add flow
- // to the graph. It's okay to search through the left nodes once. The
- // edge from the implicit source node to each previously-visited left
- // node will have flow if that left node has any path to the sink
- // whatsoever. Subsequent augmentations can only add flow to the
- // network, and cannot take away that previous flow unit from the source.
- // Since the source-to-left edge can only carry one flow unit (or,
- // each element can be matched to only one matcher), there is no need
- // to visit the left nodes more than once looking for augmented paths.
- // The flow is known to be possible or impossible by looking at the
- // node once.
- for (size_t ilhs = 0; ilhs < graph_->LhsSize(); ++ilhs) {
- // Reset the path-marking vector and try to find a path from
- // source to sink starting at the left_[ilhs] node.
- GTEST_CHECK_(left_[ilhs] == kUnused)
- << "ilhs: " << ilhs << ", left_[ilhs]: " << left_[ilhs];
- // 'seen' initialized to 'graph_->RhsSize()' copies of 0.
- seen.assign(graph_->RhsSize(), 0);
- TryAugment(ilhs, &seen);
- }
- ElementMatcherPairs result;
- for (size_t ilhs = 0; ilhs < left_.size(); ++ilhs) {
- size_t irhs = left_[ilhs];
- if (irhs == kUnused) continue;
- result.push_back(ElementMatcherPair(ilhs, irhs));
- }
- return result;
- }
-
- private:
- static const size_t kUnused = static_cast<size_t>(-1);
-
- // Perform a depth-first search from left node ilhs to the sink. If a
- // path is found, flow is added to the network by linking the left and
- // right vector elements corresponding each segment of the path.
- // Returns true if a path to sink was found, which means that a unit of
- // flow was added to the network. The 'seen' vector elements correspond
- // to right nodes and are marked to eliminate cycles from the search.
- //
- // Left nodes will only be explored at most once because they
- // are accessible from at most one right node in the residual flow
- // graph.
- //
- // Note that left_[ilhs] is the only element of left_ that TryAugment will
- // potentially transition from kUnused to another value. Any other
- // left_ element holding kUnused before TryAugment will be holding it
- // when TryAugment returns.
- //
- bool TryAugment(size_t ilhs, ::std::vector<char>* seen) {
- for (size_t irhs = 0; irhs < graph_->RhsSize(); ++irhs) {
- if ((*seen)[irhs])
- continue;
- if (!graph_->HasEdge(ilhs, irhs))
- continue;
- // There's an available edge from ilhs to irhs.
- (*seen)[irhs] = 1;
- // Next a search is performed to determine whether
- // this edge is a dead end or leads to the sink.
- //
- // right_[irhs] == kUnused means that there is residual flow from
- // right node irhs to the sink, so we can use that to finish this
- // flow path and return success.
- //
- // Otherwise there is residual flow to some ilhs. We push flow
- // along that path and call ourselves recursively to see if this
- // ultimately leads to sink.
- if (right_[irhs] == kUnused || TryAugment(right_[irhs], seen)) {
- // Add flow from left_[ilhs] to right_[irhs].
- left_[ilhs] = irhs;
- right_[irhs] = ilhs;
- return true;
- }
- }
- return false;
- }
-
- const MatchMatrix* graph_; // not owned
- // Each element of the left_ vector represents a left hand side node
- // (i.e. an element) and each element of right_ is a right hand side
- // node (i.e. a matcher). The values in the left_ vector indicate
- // outflow from that node to a node on the the right_ side. The values
- // in the right_ indicate inflow, and specify which left_ node is
- // feeding that right_ node, if any. For example, left_[3] == 1 means
- // there's a flow from element #3 to matcher #1. Such a flow would also
- // be redundantly represented in the right_ vector as right_[1] == 3.
- // Elements of left_ and right_ are either kUnused or mutually
- // referent. Mutually referent means that left_[right_[i]] = i and
- // right_[left_[i]] = i.
- ::std::vector<size_t> left_;
- ::std::vector<size_t> right_;
-
- GTEST_DISALLOW_ASSIGN_(MaxBipartiteMatchState);
-};
-
-const size_t MaxBipartiteMatchState::kUnused;
-
-GTEST_API_ ElementMatcherPairs
-FindMaxBipartiteMatching(const MatchMatrix& g) {
- return MaxBipartiteMatchState(g).Compute();
-}
-
-static void LogElementMatcherPairVec(const ElementMatcherPairs& pairs,
- ::std::ostream* stream) {
- typedef ElementMatcherPairs::const_iterator Iter;
- ::std::ostream& os = *stream;
- os << "{";
- const char *sep = "";
- for (Iter it = pairs.begin(); it != pairs.end(); ++it) {
- os << sep << "\n ("
- << "element #" << it->first << ", "
- << "matcher #" << it->second << ")";
- sep = ",";
- }
- os << "\n}";
-}
-
-// Tries to find a pairing, and explains the result.
-GTEST_API_ bool FindPairing(const MatchMatrix& matrix,
- MatchResultListener* listener) {
- ElementMatcherPairs matches = FindMaxBipartiteMatching(matrix);
-
- size_t max_flow = matches.size();
- bool result = (max_flow == matrix.RhsSize());
-
- if (!result) {
- if (listener->IsInterested()) {
- *listener << "where no permutation of the elements can "
- "satisfy all matchers, and the closest match is "
- << max_flow << " of " << matrix.RhsSize()
- << " matchers with the pairings:\n";
- LogElementMatcherPairVec(matches, listener->stream());
- }
- return false;
- }
-
- if (matches.size() > 1) {
- if (listener->IsInterested()) {
- const char *sep = "where:\n";
- for (size_t mi = 0; mi < matches.size(); ++mi) {
- *listener << sep << " - element #" << matches[mi].first
- << " is matched by matcher #" << matches[mi].second;
- sep = ",\n";
- }
- }
- }
- return true;
-}
-
-bool MatchMatrix::NextGraph() {
- for (size_t ilhs = 0; ilhs < LhsSize(); ++ilhs) {
- for (size_t irhs = 0; irhs < RhsSize(); ++irhs) {
- char& b = matched_[SpaceIndex(ilhs, irhs)];
- if (!b) {
- b = 1;
- return true;
- }
- b = 0;
- }
- }
- return false;
-}
-
-void MatchMatrix::Randomize() {
- for (size_t ilhs = 0; ilhs < LhsSize(); ++ilhs) {
- for (size_t irhs = 0; irhs < RhsSize(); ++irhs) {
- char& b = matched_[SpaceIndex(ilhs, irhs)];
- b = static_cast<char>(rand() & 1); // NOLINT
- }
- }
-}
-
-string MatchMatrix::DebugString() const {
- ::std::stringstream ss;
- const char *sep = "";
- for (size_t i = 0; i < LhsSize(); ++i) {
- ss << sep;
- for (size_t j = 0; j < RhsSize(); ++j) {
- ss << HasEdge(i, j);
- }
- sep = ";";
- }
- return ss.str();
-}
-
-void UnorderedElementsAreMatcherImplBase::DescribeToImpl(
- ::std::ostream* os) const {
- if (matcher_describers_.empty()) {
- *os << "is empty";
- return;
- }
- if (matcher_describers_.size() == 1) {
- *os << "has " << Elements(1) << " and that element ";
- matcher_describers_[0]->DescribeTo(os);
- return;
- }
- *os << "has " << Elements(matcher_describers_.size())
- << " and there exists some permutation of elements such that:\n";
- const char* sep = "";
- for (size_t i = 0; i != matcher_describers_.size(); ++i) {
- *os << sep << " - element #" << i << " ";
- matcher_describers_[i]->DescribeTo(os);
- sep = ", and\n";
- }
-}
-
-void UnorderedElementsAreMatcherImplBase::DescribeNegationToImpl(
- ::std::ostream* os) const {
- if (matcher_describers_.empty()) {
- *os << "isn't empty";
- return;
- }
- if (matcher_describers_.size() == 1) {
- *os << "doesn't have " << Elements(1)
- << ", or has " << Elements(1) << " that ";
- matcher_describers_[0]->DescribeNegationTo(os);
- return;
- }
- *os << "doesn't have " << Elements(matcher_describers_.size())
- << ", or there exists no permutation of elements such that:\n";
- const char* sep = "";
- for (size_t i = 0; i != matcher_describers_.size(); ++i) {
- *os << sep << " - element #" << i << " ";
- matcher_describers_[i]->DescribeTo(os);
- sep = ", and\n";
- }
-}
-
-// Checks that all matchers match at least one element, and that all
-// elements match at least one matcher. This enables faster matching
-// and better error reporting.
-// Returns false, writing an explanation to 'listener', if and only
-// if the success criteria are not met.
-bool UnorderedElementsAreMatcherImplBase::
-VerifyAllElementsAndMatchersAreMatched(
- const ::std::vector<string>& element_printouts,
- const MatchMatrix& matrix,
- MatchResultListener* listener) const {
- bool result = true;
- ::std::vector<char> element_matched(matrix.LhsSize(), 0);
- ::std::vector<char> matcher_matched(matrix.RhsSize(), 0);
-
- for (size_t ilhs = 0; ilhs < matrix.LhsSize(); ilhs++) {
- for (size_t irhs = 0; irhs < matrix.RhsSize(); irhs++) {
- char matched = matrix.HasEdge(ilhs, irhs);
- element_matched[ilhs] |= matched;
- matcher_matched[irhs] |= matched;
- }
- }
-
- {
- const char* sep =
- "where the following matchers don't match any elements:\n";
- for (size_t mi = 0; mi < matcher_matched.size(); ++mi) {
- if (matcher_matched[mi])
- continue;
- result = false;
- if (listener->IsInterested()) {
- *listener << sep << "matcher #" << mi << ": ";
- matcher_describers_[mi]->DescribeTo(listener->stream());
- sep = ",\n";
- }
- }
- }
-
- {
- const char* sep =
- "where the following elements don't match any matchers:\n";
- const char* outer_sep = "";
- if (!result) {
- outer_sep = "\nand ";
- }
- for (size_t ei = 0; ei < element_matched.size(); ++ei) {
- if (element_matched[ei])
- continue;
- result = false;
- if (listener->IsInterested()) {
- *listener << outer_sep << sep << "element #" << ei << ": "
- << element_printouts[ei];
- sep = ",\n";
- outer_sep = "";
- }
- }
- }
- return result;
-}
-
-} // namespace internal
-} // namespace testing
diff --git a/third_party/ntcore_2017/gmock/src/gmock-spec-builders.cc b/third_party/ntcore_2017/gmock/src/gmock-spec-builders.cc
deleted file mode 100644
index abaae3a..0000000
--- a/third_party/ntcore_2017/gmock/src/gmock-spec-builders.cc
+++ /dev/null
@@ -1,813 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements the spec builder syntax (ON_CALL and
-// EXPECT_CALL).
-
-#include "gmock/gmock-spec-builders.h"
-
-#include <stdlib.h>
-#include <iostream> // NOLINT
-#include <map>
-#include <set>
-#include <string>
-#include "gmock/gmock.h"
-#include "gtest/gtest.h"
-
-#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC
-# include <unistd.h> // NOLINT
-#endif
-
-namespace testing {
-namespace internal {
-
-// Protects the mock object registry (in class Mock), all function
-// mockers, and all expectations.
-GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_gmock_mutex);
-
-// Logs a message including file and line number information.
-GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity,
- const char* file, int line,
- const string& message) {
- ::std::ostringstream s;
- s << file << ":" << line << ": " << message << ::std::endl;
- Log(severity, s.str(), 0);
-}
-
-// Constructs an ExpectationBase object.
-ExpectationBase::ExpectationBase(const char* a_file,
- int a_line,
- const string& a_source_text)
- : file_(a_file),
- line_(a_line),
- source_text_(a_source_text),
- cardinality_specified_(false),
- cardinality_(Exactly(1)),
- call_count_(0),
- retired_(false),
- extra_matcher_specified_(false),
- repeated_action_specified_(false),
- retires_on_saturation_(false),
- last_clause_(kNone),
- action_count_checked_(false) {}
-
-// Destructs an ExpectationBase object.
-ExpectationBase::~ExpectationBase() {}
-
-// Explicitly specifies the cardinality of this expectation. Used by
-// the subclasses to implement the .Times() clause.
-void ExpectationBase::SpecifyCardinality(const Cardinality& a_cardinality) {
- cardinality_specified_ = true;
- cardinality_ = a_cardinality;
-}
-
-// Retires all pre-requisites of this expectation.
-void ExpectationBase::RetireAllPreRequisites()
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- if (is_retired()) {
- // We can take this short-cut as we never retire an expectation
- // until we have retired all its pre-requisites.
- return;
- }
-
- for (ExpectationSet::const_iterator it = immediate_prerequisites_.begin();
- it != immediate_prerequisites_.end(); ++it) {
- ExpectationBase* const prerequisite = it->expectation_base().get();
- if (!prerequisite->is_retired()) {
- prerequisite->RetireAllPreRequisites();
- prerequisite->Retire();
- }
- }
-}
-
-// Returns true iff all pre-requisites of this expectation have been
-// satisfied.
-bool ExpectationBase::AllPrerequisitesAreSatisfied() const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- for (ExpectationSet::const_iterator it = immediate_prerequisites_.begin();
- it != immediate_prerequisites_.end(); ++it) {
- if (!(it->expectation_base()->IsSatisfied()) ||
- !(it->expectation_base()->AllPrerequisitesAreSatisfied()))
- return false;
- }
- return true;
-}
-
-// Adds unsatisfied pre-requisites of this expectation to 'result'.
-void ExpectationBase::FindUnsatisfiedPrerequisites(ExpectationSet* result) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- for (ExpectationSet::const_iterator it = immediate_prerequisites_.begin();
- it != immediate_prerequisites_.end(); ++it) {
- if (it->expectation_base()->IsSatisfied()) {
- // If *it is satisfied and has a call count of 0, some of its
- // pre-requisites may not be satisfied yet.
- if (it->expectation_base()->call_count_ == 0) {
- it->expectation_base()->FindUnsatisfiedPrerequisites(result);
- }
- } else {
- // Now that we know *it is unsatisfied, we are not so interested
- // in whether its pre-requisites are satisfied. Therefore we
- // don't recursively call FindUnsatisfiedPrerequisites() here.
- *result += *it;
- }
- }
-}
-
-// Describes how many times a function call matching this
-// expectation has occurred.
-void ExpectationBase::DescribeCallCountTo(::std::ostream* os) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
-
- // Describes how many times the function is expected to be called.
- *os << " Expected: to be ";
- cardinality().DescribeTo(os);
- *os << "\n Actual: ";
- Cardinality::DescribeActualCallCountTo(call_count(), os);
-
- // Describes the state of the expectation (e.g. is it satisfied?
- // is it active?).
- *os << " - " << (IsOverSaturated() ? "over-saturated" :
- IsSaturated() ? "saturated" :
- IsSatisfied() ? "satisfied" : "unsatisfied")
- << " and "
- << (is_retired() ? "retired" : "active");
-}
-
-// Checks the action count (i.e. the number of WillOnce() and
-// WillRepeatedly() clauses) against the cardinality if this hasn't
-// been done before. Prints a warning if there are too many or too
-// few actions.
-void ExpectationBase::CheckActionCountIfNotDone() const
- GTEST_LOCK_EXCLUDED_(mutex_) {
- bool should_check = false;
- {
- MutexLock l(&mutex_);
- if (!action_count_checked_) {
- action_count_checked_ = true;
- should_check = true;
- }
- }
-
- if (should_check) {
- if (!cardinality_specified_) {
- // The cardinality was inferred - no need to check the action
- // count against it.
- return;
- }
-
- // The cardinality was explicitly specified.
- const int action_count = static_cast<int>(untyped_actions_.size());
- const int upper_bound = cardinality().ConservativeUpperBound();
- const int lower_bound = cardinality().ConservativeLowerBound();
- bool too_many; // True if there are too many actions, or false
- // if there are too few.
- if (action_count > upper_bound ||
- (action_count == upper_bound && repeated_action_specified_)) {
- too_many = true;
- } else if (0 < action_count && action_count < lower_bound &&
- !repeated_action_specified_) {
- too_many = false;
- } else {
- return;
- }
-
- ::std::stringstream ss;
- DescribeLocationTo(&ss);
- ss << "Too " << (too_many ? "many" : "few")
- << " actions specified in " << source_text() << "...\n"
- << "Expected to be ";
- cardinality().DescribeTo(&ss);
- ss << ", but has " << (too_many ? "" : "only ")
- << action_count << " WillOnce()"
- << (action_count == 1 ? "" : "s");
- if (repeated_action_specified_) {
- ss << " and a WillRepeatedly()";
- }
- ss << ".";
- Log(kWarning, ss.str(), -1); // -1 means "don't print stack trace".
- }
-}
-
-// Implements the .Times() clause.
-void ExpectationBase::UntypedTimes(const Cardinality& a_cardinality) {
- if (last_clause_ == kTimes) {
- ExpectSpecProperty(false,
- ".Times() cannot appear "
- "more than once in an EXPECT_CALL().");
- } else {
- ExpectSpecProperty(last_clause_ < kTimes,
- ".Times() cannot appear after "
- ".InSequence(), .WillOnce(), .WillRepeatedly(), "
- "or .RetiresOnSaturation().");
- }
- last_clause_ = kTimes;
-
- SpecifyCardinality(a_cardinality);
-}
-
-// Points to the implicit sequence introduced by a living InSequence
-// object (if any) in the current thread or NULL.
-GTEST_API_ ThreadLocal<Sequence*> g_gmock_implicit_sequence;
-
-// Reports an uninteresting call (whose description is in msg) in the
-// manner specified by 'reaction'.
-void ReportUninterestingCall(CallReaction reaction, const string& msg) {
- switch (reaction) {
- case kAllow:
- Log(kInfo, msg, 3);
- break;
- case kWarn:
- Log(kWarning, msg, 3);
- break;
- default: // FAIL
- Expect(false, NULL, -1, msg);
- }
-}
-
-UntypedFunctionMockerBase::UntypedFunctionMockerBase()
- : mock_obj_(NULL), name_("") {}
-
-UntypedFunctionMockerBase::~UntypedFunctionMockerBase() {}
-
-// Sets the mock object this mock method belongs to, and registers
-// this information in the global mock registry. Will be called
-// whenever an EXPECT_CALL() or ON_CALL() is executed on this mock
-// method.
-void UntypedFunctionMockerBase::RegisterOwner(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- {
- MutexLock l(&g_gmock_mutex);
- mock_obj_ = mock_obj;
- }
- Mock::Register(mock_obj, this);
-}
-
-// Sets the mock object this mock method belongs to, and sets the name
-// of the mock function. Will be called upon each invocation of this
-// mock function.
-void UntypedFunctionMockerBase::SetOwnerAndName(const void* mock_obj,
- const char* name)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- // We protect name_ under g_gmock_mutex in case this mock function
- // is called from two threads concurrently.
- MutexLock l(&g_gmock_mutex);
- mock_obj_ = mock_obj;
- name_ = name;
-}
-
-// Returns the name of the function being mocked. Must be called
-// after RegisterOwner() or SetOwnerAndName() has been called.
-const void* UntypedFunctionMockerBase::MockObject() const
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- const void* mock_obj;
- {
- // We protect mock_obj_ under g_gmock_mutex in case this mock
- // function is called from two threads concurrently.
- MutexLock l(&g_gmock_mutex);
- Assert(mock_obj_ != NULL, __FILE__, __LINE__,
- "MockObject() must not be called before RegisterOwner() or "
- "SetOwnerAndName() has been called.");
- mock_obj = mock_obj_;
- }
- return mock_obj;
-}
-
-// Returns the name of this mock method. Must be called after
-// SetOwnerAndName() has been called.
-const char* UntypedFunctionMockerBase::Name() const
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- const char* name;
- {
- // We protect name_ under g_gmock_mutex in case this mock
- // function is called from two threads concurrently.
- MutexLock l(&g_gmock_mutex);
- Assert(name_ != NULL, __FILE__, __LINE__,
- "Name() must not be called before SetOwnerAndName() has "
- "been called.");
- name = name_;
- }
- return name;
-}
-
-// Calculates the result of invoking this mock function with the given
-// arguments, prints it, and returns it. The caller is responsible
-// for deleting the result.
-const UntypedActionResultHolderBase*
-UntypedFunctionMockerBase::UntypedInvokeWith(const void* const untyped_args)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- if (untyped_expectations_.size() == 0) {
- // No expectation is set on this mock method - we have an
- // uninteresting call.
-
- // We must get Google Mock's reaction on uninteresting calls
- // made on this mock object BEFORE performing the action,
- // because the action may DELETE the mock object and make the
- // following expression meaningless.
- const CallReaction reaction =
- Mock::GetReactionOnUninterestingCalls(MockObject());
-
- // True iff we need to print this call's arguments and return
- // value. This definition must be kept in sync with
- // the behavior of ReportUninterestingCall().
- const bool need_to_report_uninteresting_call =
- // If the user allows this uninteresting call, we print it
- // only when he wants informational messages.
- reaction == kAllow ? LogIsVisible(kInfo) :
- // If the user wants this to be a warning, we print it only
- // when he wants to see warnings.
- reaction == kWarn ? LogIsVisible(kWarning) :
- // Otherwise, the user wants this to be an error, and we
- // should always print detailed information in the error.
- true;
-
- if (!need_to_report_uninteresting_call) {
- // Perform the action without printing the call information.
- return this->UntypedPerformDefaultAction(untyped_args, "");
- }
-
- // Warns about the uninteresting call.
- ::std::stringstream ss;
- this->UntypedDescribeUninterestingCall(untyped_args, &ss);
-
- // Calculates the function result.
- const UntypedActionResultHolderBase* const result =
- this->UntypedPerformDefaultAction(untyped_args, ss.str());
-
- // Prints the function result.
- if (result != NULL)
- result->PrintAsActionResult(&ss);
-
- ReportUninterestingCall(reaction, ss.str());
- return result;
- }
-
- bool is_excessive = false;
- ::std::stringstream ss;
- ::std::stringstream why;
- ::std::stringstream loc;
- const void* untyped_action = NULL;
-
- // The UntypedFindMatchingExpectation() function acquires and
- // releases g_gmock_mutex.
- const ExpectationBase* const untyped_expectation =
- this->UntypedFindMatchingExpectation(
- untyped_args, &untyped_action, &is_excessive,
- &ss, &why);
- const bool found = untyped_expectation != NULL;
-
- // True iff we need to print the call's arguments and return value.
- // This definition must be kept in sync with the uses of Expect()
- // and Log() in this function.
- const bool need_to_report_call =
- !found || is_excessive || LogIsVisible(kInfo);
- if (!need_to_report_call) {
- // Perform the action without printing the call information.
- return
- untyped_action == NULL ?
- this->UntypedPerformDefaultAction(untyped_args, "") :
- this->UntypedPerformAction(untyped_action, untyped_args);
- }
-
- ss << " Function call: " << Name();
- this->UntypedPrintArgs(untyped_args, &ss);
-
- // In case the action deletes a piece of the expectation, we
- // generate the message beforehand.
- if (found && !is_excessive) {
- untyped_expectation->DescribeLocationTo(&loc);
- }
-
- const UntypedActionResultHolderBase* const result =
- untyped_action == NULL ?
- this->UntypedPerformDefaultAction(untyped_args, ss.str()) :
- this->UntypedPerformAction(untyped_action, untyped_args);
- if (result != NULL)
- result->PrintAsActionResult(&ss);
- ss << "\n" << why.str();
-
- if (!found) {
- // No expectation matches this call - reports a failure.
- Expect(false, NULL, -1, ss.str());
- } else if (is_excessive) {
- // We had an upper-bound violation and the failure message is in ss.
- Expect(false, untyped_expectation->file(),
- untyped_expectation->line(), ss.str());
- } else {
- // We had an expected call and the matching expectation is
- // described in ss.
- Log(kInfo, loc.str() + ss.str(), 2);
- }
-
- return result;
-}
-
-// Returns an Expectation object that references and co-owns exp,
-// which must be an expectation on this mock function.
-Expectation UntypedFunctionMockerBase::GetHandleOf(ExpectationBase* exp) {
- for (UntypedExpectations::const_iterator it =
- untyped_expectations_.begin();
- it != untyped_expectations_.end(); ++it) {
- if (it->get() == exp) {
- return Expectation(*it);
- }
- }
-
- Assert(false, __FILE__, __LINE__, "Cannot find expectation.");
- return Expectation();
- // The above statement is just to make the code compile, and will
- // never be executed.
-}
-
-// Verifies that all expectations on this mock function have been
-// satisfied. Reports one or more Google Test non-fatal failures
-// and returns false if not.
-bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked()
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- bool expectations_met = true;
- for (UntypedExpectations::const_iterator it =
- untyped_expectations_.begin();
- it != untyped_expectations_.end(); ++it) {
- ExpectationBase* const untyped_expectation = it->get();
- if (untyped_expectation->IsOverSaturated()) {
- // There was an upper-bound violation. Since the error was
- // already reported when it occurred, there is no need to do
- // anything here.
- expectations_met = false;
- } else if (!untyped_expectation->IsSatisfied()) {
- expectations_met = false;
- ::std::stringstream ss;
- ss << "Actual function call count doesn't match "
- << untyped_expectation->source_text() << "...\n";
- // No need to show the source file location of the expectation
- // in the description, as the Expect() call that follows already
- // takes care of it.
- untyped_expectation->MaybeDescribeExtraMatcherTo(&ss);
- untyped_expectation->DescribeCallCountTo(&ss);
- Expect(false, untyped_expectation->file(),
- untyped_expectation->line(), ss.str());
- }
- }
-
- // Deleting our expectations may trigger other mock objects to be deleted, for
- // example if an action contains a reference counted smart pointer to that
- // mock object, and that is the last reference. So if we delete our
- // expectations within the context of the global mutex we may deadlock when
- // this method is called again. Instead, make a copy of the set of
- // expectations to delete, clear our set within the mutex, and then clear the
- // copied set outside of it.
- UntypedExpectations expectations_to_delete;
- untyped_expectations_.swap(expectations_to_delete);
-
- g_gmock_mutex.Unlock();
- expectations_to_delete.clear();
- g_gmock_mutex.Lock();
-
- return expectations_met;
-}
-
-} // namespace internal
-
-// Class Mock.
-
-namespace {
-
-typedef std::set<internal::UntypedFunctionMockerBase*> FunctionMockers;
-
-// The current state of a mock object. Such information is needed for
-// detecting leaked mock objects and explicitly verifying a mock's
-// expectations.
-struct MockObjectState {
- MockObjectState()
- : first_used_file(NULL), first_used_line(-1), leakable(false) {}
-
- // Where in the source file an ON_CALL or EXPECT_CALL is first
- // invoked on this mock object.
- const char* first_used_file;
- int first_used_line;
- ::std::string first_used_test_case;
- ::std::string first_used_test;
- bool leakable; // true iff it's OK to leak the object.
- FunctionMockers function_mockers; // All registered methods of the object.
-};
-
-// A global registry holding the state of all mock objects that are
-// alive. A mock object is added to this registry the first time
-// Mock::AllowLeak(), ON_CALL(), or EXPECT_CALL() is called on it. It
-// is removed from the registry in the mock object's destructor.
-class MockObjectRegistry {
- public:
- // Maps a mock object (identified by its address) to its state.
- typedef std::map<const void*, MockObjectState> StateMap;
-
- // This destructor will be called when a program exits, after all
- // tests in it have been run. By then, there should be no mock
- // object alive. Therefore we report any living object as test
- // failure, unless the user explicitly asked us to ignore it.
- ~MockObjectRegistry() {
- // "using ::std::cout;" doesn't work with Symbian's STLport, where cout is
- // a macro.
-
- if (!GMOCK_FLAG(catch_leaked_mocks))
- return;
-
- int leaked_count = 0;
- for (StateMap::const_iterator it = states_.begin(); it != states_.end();
- ++it) {
- if (it->second.leakable) // The user said it's fine to leak this object.
- continue;
-
- // TODO(wan@google.com): Print the type of the leaked object.
- // This can help the user identify the leaked object.
- std::cout << "\n";
- const MockObjectState& state = it->second;
- std::cout << internal::FormatFileLocation(state.first_used_file,
- state.first_used_line);
- std::cout << " ERROR: this mock object";
- if (state.first_used_test != "") {
- std::cout << " (used in test " << state.first_used_test_case << "."
- << state.first_used_test << ")";
- }
- std::cout << " should be deleted but never is. Its address is @"
- << it->first << ".";
- leaked_count++;
- }
- if (leaked_count > 0) {
- std::cout << "\nERROR: " << leaked_count
- << " leaked mock " << (leaked_count == 1 ? "object" : "objects")
- << " found at program exit.\n";
- std::cout.flush();
- ::std::cerr.flush();
- // RUN_ALL_TESTS() has already returned when this destructor is
- // called. Therefore we cannot use the normal Google Test
- // failure reporting mechanism.
- _exit(1); // We cannot call exit() as it is not reentrant and
- // may already have been called.
- }
- }
-
- StateMap& states() { return states_; }
-
- private:
- StateMap states_;
-};
-
-// Protected by g_gmock_mutex.
-MockObjectRegistry g_mock_object_registry;
-
-// Maps a mock object to the reaction Google Mock should have when an
-// uninteresting method is called. Protected by g_gmock_mutex.
-std::map<const void*, internal::CallReaction> g_uninteresting_call_reaction;
-
-// Sets the reaction Google Mock should have when an uninteresting
-// method of the given mock object is called.
-void SetReactionOnUninterestingCalls(const void* mock_obj,
- internal::CallReaction reaction)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
- internal::MutexLock l(&internal::g_gmock_mutex);
- g_uninteresting_call_reaction[mock_obj] = reaction;
-}
-
-} // namespace
-
-// Tells Google Mock to allow uninteresting calls on the given mock
-// object.
-void Mock::AllowUninterestingCalls(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
- SetReactionOnUninterestingCalls(mock_obj, internal::kAllow);
-}
-
-// Tells Google Mock to warn the user about uninteresting calls on the
-// given mock object.
-void Mock::WarnUninterestingCalls(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
- SetReactionOnUninterestingCalls(mock_obj, internal::kWarn);
-}
-
-// Tells Google Mock to fail uninteresting calls on the given mock
-// object.
-void Mock::FailUninterestingCalls(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
- SetReactionOnUninterestingCalls(mock_obj, internal::kFail);
-}
-
-// Tells Google Mock the given mock object is being destroyed and its
-// entry in the call-reaction table should be removed.
-void Mock::UnregisterCallReaction(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
- internal::MutexLock l(&internal::g_gmock_mutex);
- g_uninteresting_call_reaction.erase(mock_obj);
-}
-
-// Returns the reaction Google Mock will have on uninteresting calls
-// made on the given mock object.
-internal::CallReaction Mock::GetReactionOnUninterestingCalls(
- const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
- internal::MutexLock l(&internal::g_gmock_mutex);
- return (g_uninteresting_call_reaction.count(mock_obj) == 0) ?
- internal::kDefault : g_uninteresting_call_reaction[mock_obj];
-}
-
-// Tells Google Mock to ignore mock_obj when checking for leaked mock
-// objects.
-void Mock::AllowLeak(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
- internal::MutexLock l(&internal::g_gmock_mutex);
- g_mock_object_registry.states()[mock_obj].leakable = true;
-}
-
-// Verifies and clears all expectations on the given mock object. If
-// the expectations aren't satisfied, generates one or more Google
-// Test non-fatal failures and returns false.
-bool Mock::VerifyAndClearExpectations(void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
- internal::MutexLock l(&internal::g_gmock_mutex);
- return VerifyAndClearExpectationsLocked(mock_obj);
-}
-
-// Verifies all expectations on the given mock object and clears its
-// default actions and expectations. Returns true iff the
-// verification was successful.
-bool Mock::VerifyAndClear(void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
- internal::MutexLock l(&internal::g_gmock_mutex);
- ClearDefaultActionsLocked(mock_obj);
- return VerifyAndClearExpectationsLocked(mock_obj);
-}
-
-// Verifies and clears all expectations on the given mock object. If
-// the expectations aren't satisfied, generates one or more Google
-// Test non-fatal failures and returns false.
-bool Mock::VerifyAndClearExpectationsLocked(void* mock_obj)
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex) {
- internal::g_gmock_mutex.AssertHeld();
- if (g_mock_object_registry.states().count(mock_obj) == 0) {
- // No EXPECT_CALL() was set on the given mock object.
- return true;
- }
-
- // Verifies and clears the expectations on each mock method in the
- // given mock object.
- bool expectations_met = true;
- FunctionMockers& mockers =
- g_mock_object_registry.states()[mock_obj].function_mockers;
- for (FunctionMockers::const_iterator it = mockers.begin();
- it != mockers.end(); ++it) {
- if (!(*it)->VerifyAndClearExpectationsLocked()) {
- expectations_met = false;
- }
- }
-
- // We don't clear the content of mockers, as they may still be
- // needed by ClearDefaultActionsLocked().
- return expectations_met;
-}
-
-// Registers a mock object and a mock method it owns.
-void Mock::Register(const void* mock_obj,
- internal::UntypedFunctionMockerBase* mocker)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
- internal::MutexLock l(&internal::g_gmock_mutex);
- g_mock_object_registry.states()[mock_obj].function_mockers.insert(mocker);
-}
-
-// Tells Google Mock where in the source code mock_obj is used in an
-// ON_CALL or EXPECT_CALL. In case mock_obj is leaked, this
-// information helps the user identify which object it is.
-void Mock::RegisterUseByOnCallOrExpectCall(const void* mock_obj,
- const char* file, int line)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
- internal::MutexLock l(&internal::g_gmock_mutex);
- MockObjectState& state = g_mock_object_registry.states()[mock_obj];
- if (state.first_used_file == NULL) {
- state.first_used_file = file;
- state.first_used_line = line;
- const TestInfo* const test_info =
- UnitTest::GetInstance()->current_test_info();
- if (test_info != NULL) {
- // TODO(wan@google.com): record the test case name when the
- // ON_CALL or EXPECT_CALL is invoked from SetUpTestCase() or
- // TearDownTestCase().
- state.first_used_test_case = test_info->test_case_name();
- state.first_used_test = test_info->name();
- }
- }
-}
-
-// Unregisters a mock method; removes the owning mock object from the
-// registry when the last mock method associated with it has been
-// unregistered. This is called only in the destructor of
-// FunctionMockerBase.
-void Mock::UnregisterLocked(internal::UntypedFunctionMockerBase* mocker)
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex) {
- internal::g_gmock_mutex.AssertHeld();
- for (MockObjectRegistry::StateMap::iterator it =
- g_mock_object_registry.states().begin();
- it != g_mock_object_registry.states().end(); ++it) {
- FunctionMockers& mockers = it->second.function_mockers;
- if (mockers.erase(mocker) > 0) {
- // mocker was in mockers and has been just removed.
- if (mockers.empty()) {
- g_mock_object_registry.states().erase(it);
- }
- return;
- }
- }
-}
-
-// Clears all ON_CALL()s set on the given mock object.
-void Mock::ClearDefaultActionsLocked(void* mock_obj)
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex) {
- internal::g_gmock_mutex.AssertHeld();
-
- if (g_mock_object_registry.states().count(mock_obj) == 0) {
- // No ON_CALL() was set on the given mock object.
- return;
- }
-
- // Clears the default actions for each mock method in the given mock
- // object.
- FunctionMockers& mockers =
- g_mock_object_registry.states()[mock_obj].function_mockers;
- for (FunctionMockers::const_iterator it = mockers.begin();
- it != mockers.end(); ++it) {
- (*it)->ClearDefaultActionsLocked();
- }
-
- // We don't clear the content of mockers, as they may still be
- // needed by VerifyAndClearExpectationsLocked().
-}
-
-Expectation::Expectation() {}
-
-Expectation::Expectation(
- const internal::linked_ptr<internal::ExpectationBase>& an_expectation_base)
- : expectation_base_(an_expectation_base) {}
-
-Expectation::~Expectation() {}
-
-// Adds an expectation to a sequence.
-void Sequence::AddExpectation(const Expectation& expectation) const {
- if (*last_expectation_ != expectation) {
- if (last_expectation_->expectation_base() != NULL) {
- expectation.expectation_base()->immediate_prerequisites_
- += *last_expectation_;
- }
- *last_expectation_ = expectation;
- }
-}
-
-// Creates the implicit sequence if there isn't one.
-InSequence::InSequence() {
- if (internal::g_gmock_implicit_sequence.get() == NULL) {
- internal::g_gmock_implicit_sequence.set(new Sequence);
- sequence_created_ = true;
- } else {
- sequence_created_ = false;
- }
-}
-
-// Deletes the implicit sequence if it was created by the constructor
-// of this object.
-InSequence::~InSequence() {
- if (sequence_created_) {
- delete internal::g_gmock_implicit_sequence.get();
- internal::g_gmock_implicit_sequence.set(NULL);
- }
-}
-
-} // namespace testing
diff --git a/third_party/ntcore_2017/gmock/src/gmock.cc b/third_party/ntcore_2017/gmock/src/gmock.cc
deleted file mode 100644
index 1c06985..0000000
--- a/third_party/ntcore_2017/gmock/src/gmock.cc
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#include "gmock/gmock.h"
-#include "gmock/internal/gmock-port.h"
-
-namespace testing {
-
-// TODO(wan@google.com): support using environment variables to
-// control the flag values, like what Google Test does.
-
-GMOCK_DEFINE_bool_(catch_leaked_mocks, true,
- "true iff Google Mock should report leaked mock objects "
- "as failures.");
-
-GMOCK_DEFINE_string_(verbose, internal::kWarningVerbosity,
- "Controls how verbose Google Mock's output is."
- " Valid values:\n"
- " info - prints all messages.\n"
- " warning - prints warnings and errors.\n"
- " error - prints errors only.");
-
-namespace internal {
-
-// Parses a string as a command line flag. The string should have the
-// format "--gmock_flag=value". When def_optional is true, the
-// "=value" part can be omitted.
-//
-// Returns the value of the flag, or NULL if the parsing failed.
-static const char* ParseGoogleMockFlagValue(const char* str,
- const char* flag,
- bool def_optional) {
- // str and flag must not be NULL.
- if (str == NULL || flag == NULL) return NULL;
-
- // The flag must start with "--gmock_".
- const std::string flag_str = std::string("--gmock_") + flag;
- const size_t flag_len = flag_str.length();
- if (strncmp(str, flag_str.c_str(), flag_len) != 0) return NULL;
-
- // Skips the flag name.
- const char* flag_end = str + flag_len;
-
- // When def_optional is true, it's OK to not have a "=value" part.
- if (def_optional && (flag_end[0] == '\0')) {
- return flag_end;
- }
-
- // If def_optional is true and there are more characters after the
- // flag name, or if def_optional is false, there must be a '=' after
- // the flag name.
- if (flag_end[0] != '=') return NULL;
-
- // Returns the string after "=".
- return flag_end + 1;
-}
-
-// Parses a string for a Google Mock bool flag, in the form of
-// "--gmock_flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true. On failure, returns false without changing *value.
-static bool ParseGoogleMockBoolFlag(const char* str, const char* flag,
- bool* value) {
- // Gets the value of the flag as a string.
- const char* const value_str = ParseGoogleMockFlagValue(str, flag, true);
-
- // Aborts if the parsing failed.
- if (value_str == NULL) return false;
-
- // Converts the string value to a bool.
- *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F');
- return true;
-}
-
-// Parses a string for a Google Mock string flag, in the form of
-// "--gmock_flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true. On failure, returns false without changing *value.
-static bool ParseGoogleMockStringFlag(const char* str, const char* flag,
- std::string* value) {
- // Gets the value of the flag as a string.
- const char* const value_str = ParseGoogleMockFlagValue(str, flag, false);
-
- // Aborts if the parsing failed.
- if (value_str == NULL) return false;
-
- // Sets *value to the value of the flag.
- *value = value_str;
- return true;
-}
-
-// The internal implementation of InitGoogleMock().
-//
-// The type parameter CharType can be instantiated to either char or
-// wchar_t.
-template <typename CharType>
-void InitGoogleMockImpl(int* argc, CharType** argv) {
- // Makes sure Google Test is initialized. InitGoogleTest() is
- // idempotent, so it's fine if the user has already called it.
- InitGoogleTest(argc, argv);
- if (*argc <= 0) return;
-
- for (int i = 1; i != *argc; i++) {
- const std::string arg_string = StreamableToString(argv[i]);
- const char* const arg = arg_string.c_str();
-
- // Do we see a Google Mock flag?
- if (ParseGoogleMockBoolFlag(arg, "catch_leaked_mocks",
- &GMOCK_FLAG(catch_leaked_mocks)) ||
- ParseGoogleMockStringFlag(arg, "verbose", &GMOCK_FLAG(verbose))) {
- // Yes. Shift the remainder of the argv list left by one. Note
- // that argv has (*argc + 1) elements, the last one always being
- // NULL. The following loop moves the trailing NULL element as
- // well.
- for (int j = i; j != *argc; j++) {
- argv[j] = argv[j + 1];
- }
-
- // Decrements the argument count.
- (*argc)--;
-
- // We also need to decrement the iterator as we just removed
- // an element.
- i--;
- }
- }
-}
-
-} // namespace internal
-
-// Initializes Google Mock. This must be called before running the
-// tests. In particular, it parses a command line for the flags that
-// Google Mock recognizes. Whenever a Google Mock flag is seen, it is
-// removed from argv, and *argc is decremented.
-//
-// No value is returned. Instead, the Google Mock flag variables are
-// updated.
-//
-// Since Google Test is needed for Google Mock to work, this function
-// also initializes Google Test and parses its flags, if that hasn't
-// been done.
-GTEST_API_ void InitGoogleMock(int* argc, char** argv) {
- internal::InitGoogleMockImpl(argc, argv);
-}
-
-// This overloaded version can be used in Windows programs compiled in
-// UNICODE mode.
-GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv) {
- internal::InitGoogleMockImpl(argc, argv);
-}
-
-} // namespace testing
diff --git a/third_party/ntcore_2017/gmock/src/gmock_main.cc b/third_party/ntcore_2017/gmock/src/gmock_main.cc
deleted file mode 100644
index bd5be03..0000000
--- a/third_party/ntcore_2017/gmock/src/gmock_main.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#include <iostream>
-#include "gmock/gmock.h"
-#include "gtest/gtest.h"
-
-// MS C++ compiler/linker has a bug on Windows (not on Windows CE), which
-// causes a link error when _tmain is defined in a static library and UNICODE
-// is enabled. For this reason instead of _tmain, main function is used on
-// Windows. See the following link to track the current status of this bug:
-// http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=394464 // NOLINT
-#if GTEST_OS_WINDOWS_MOBILE
-# include <tchar.h> // NOLINT
-
-GTEST_API_ int _tmain(int argc, TCHAR** argv) {
-#else
-GTEST_API_ int main(int argc, char** argv) {
-#endif // GTEST_OS_WINDOWS_MOBILE
- std::cout << "Running main() from gmock_main.cc\n";
- // Since Google Mock depends on Google Test, InitGoogleMock() is
- // also responsible for initializing Google Test. Therefore there's
- // no need for calling testing::InitGoogleTest() separately.
- testing::InitGoogleMock(&argc, argv);
- return RUN_ALL_TESTS();
-}
diff --git a/third_party/ntcore_2017/gradle/wrapper/gradle-wrapper.jar b/third_party/ntcore_2017/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index a27e727..0000000
--- a/third_party/ntcore_2017/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/third_party/ntcore_2017/gradle/wrapper/gradle-wrapper.properties b/third_party/ntcore_2017/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index f1f921c..0000000
--- a/third_party/ntcore_2017/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Jan 04 18:53:29 PST 2017
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip
diff --git a/third_party/ntcore_2017/gradlew b/third_party/ntcore_2017/gradlew
deleted file mode 100755
index 4453cce..0000000
--- a/third_party/ntcore_2017/gradlew
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env sh
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Escape application args
-save ( ) {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=$(save "$@")
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
-fi
-
-exec "$JAVACMD" "$@"
diff --git a/third_party/ntcore_2017/gradlew.bat b/third_party/ntcore_2017/gradlew.bat
deleted file mode 100644
index e95643d..0000000
--- a/third_party/ntcore_2017/gradlew.bat
+++ /dev/null
@@ -1,84 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/third_party/ntcore_2017/include/networktables/NetworkTable.h b/third_party/ntcore_2017/include/networktables/NetworkTable.h
deleted file mode 100644
index 8923916..0000000
--- a/third_party/ntcore_2017/include/networktables/NetworkTable.h
+++ /dev/null
@@ -1,567 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NETWORKTABLE_H_
-#define NETWORKTABLE_H_
-
-#include <functional>
-#include <mutex>
-#include <vector>
-
-#include "tables/ITable.h"
-
-/**
- * A network table that knows its subtable path.
- */
-class NetworkTable : public ITable {
- private:
- struct private_init {};
-
- std::string m_path;
- std::mutex m_mutex;
- typedef std::pair<ITableListener*, unsigned int> Listener;
- std::vector<Listener> m_listeners;
-
- static std::vector<std::string> s_ip_addresses;
- static std::string s_persistent_filename;
- static bool s_client;
- static bool s_enable_ds;
- static bool s_running;
- static unsigned int s_port;
-
- public:
- NetworkTable(llvm::StringRef path, const private_init&);
- virtual ~NetworkTable();
-
- /**
- * The path separator for sub-tables and keys
- *
- */
- static const char PATH_SEPARATOR_CHAR;
-
- /**
- * @throws IOException
- */
- static void Initialize();
- static void Shutdown();
-
- /**
- * set that network tables should be a client
- * This must be called before initialize or GetTable
- */
- static void SetClientMode();
-
- /**
- * set that network tables should be a server
- * This must be called before initialize or GetTable
- */
- static void SetServerMode();
-
- /**
- * set the team the robot is configured for (this will set the mdns address
- * that network tables will connect to in client mode)
- * This must be called before initialize or GetTable
- * @param team the team number
- */
- static void SetTeam(int team);
-
- /**
- * @param address the adress that network tables will connect to in client
- * mode
- */
- static void SetIPAddress(llvm::StringRef address);
-
- /**
- * @param addresses the addresses that network tables will connect to in
- * client mode (in round robin order)
- */
- static void SetIPAddress(llvm::ArrayRef<std::string> addresses);
-
- /**
- * @param port the port number that network tables will connect to in client
- * mode or listen to in server mode
- */
- static void SetPort(unsigned int port);
-
- /**
- * @param enabled whether to enable the connection to the local DS to get
- * the robot IP address (defaults to enabled)
- */
- static void SetDSClientEnabled(bool enabled);
-
- /**
- * Sets the persistent filename.
- * @param filename the filename that the network tables server uses for
- * automatic loading and saving of persistent values
- */
- static void SetPersistentFilename(llvm::StringRef filename);
-
- /**
- * Sets the network identity.
- * This is provided in the connection info on the remote end.
- * @param name identity
- */
- static void SetNetworkIdentity(llvm::StringRef name);
-
- /**
- * Deletes ALL keys in ALL subtables. Use with caution!
- */
- static void GlobalDeleteAll();
-
- /**
- * Flushes all updated values immediately to the network.
- * Note: This is rate-limited to protect the network from flooding.
- * This is primarily useful for synchronizing network updates with
- * user code.
- */
- static void Flush();
-
- /**
- * Set the periodic update rate.
- *
- * @param interval update interval in seconds (range 0.01 to 1.0)
- */
- static void SetUpdateRate(double interval);
-
- /**
- * Saves persistent keys to a file. The server does this automatically.
- *
- * @param filename file name
- * @return Error (or nullptr).
- */
- static const char* SavePersistent(llvm::StringRef filename);
-
- /**
- * Loads persistent keys from a file. The server does this automatically.
- *
- * @param filename file name
- * @param warn callback function called for warnings
- * @return Error (or nullptr).
- */
- static const char* LoadPersistent(
- llvm::StringRef filename,
- std::function<void(size_t line, const char* msg)> warn);
-
- /**
- * Gets the table with the specified key. If the table does not exist, a new
- * table will be created.<br>
- * This will automatically initialize network tables if it has not been
- * already.
- *
- * @param key
- * the key name
- * @return the network table requested
- */
- static std::shared_ptr<NetworkTable> GetTable(llvm::StringRef key);
-
- void AddTableListener(ITableListener* listener) override;
- void AddTableListener(ITableListener* listener,
- bool immediateNotify) override;
- void AddTableListenerEx(ITableListener* listener,
- unsigned int flags) override;
- void AddTableListener(llvm::StringRef key, ITableListener* listener,
- bool immediateNotify) override;
- void AddTableListenerEx(llvm::StringRef key, ITableListener* listener,
- unsigned int flags) override;
- void AddSubTableListener(ITableListener* listener) override;
- void AddSubTableListener(ITableListener* listener, bool localNotify) override;
- void RemoveTableListener(ITableListener* listener) override;
-
- /**
- * Returns the table at the specified key. If there is no table at the
- * specified key, it will create a new table
- *
- * @param key
- * the key name
- * @return the networktable to be returned
- */
- std::shared_ptr<ITable> GetSubTable(llvm::StringRef key) const override;
-
- /**
- * Determines whether the given key is in this table.
- *
- * @param key the key to search for
- * @return true if the table as a value assigned to the given key
- */
- bool ContainsKey(llvm::StringRef key) const override;
-
- /**
- * Determines whether there exists a non-empty subtable for this key
- * in this table.
- *
- * @param key the key to search for
- * @return true if there is a subtable with the key which contains at least
- * one key/subtable of its own
- */
- bool ContainsSubTable(llvm::StringRef key) const override;
-
- /**
- * @param types bitmask of types; 0 is treated as a "don't care".
- * @return keys currently in the table
- */
- std::vector<std::string> GetKeys(int types = 0) const override;
-
- /**
- * @return subtables currently in the table
- */
- std::vector<std::string> GetSubTables() const override;
-
- /**
- * Makes a key's value persistent through program restarts.
- *
- * @param key the key to make persistent
- */
- void SetPersistent(llvm::StringRef key) override;
-
- /**
- * Stop making a key's value persistent through program restarts.
- * The key cannot be null.
- *
- * @param key the key name
- */
- void ClearPersistent(llvm::StringRef key) override;
-
- /**
- * Returns whether the value is persistent through program restarts.
- * The key cannot be null.
- *
- * @param key the key name
- */
- bool IsPersistent(llvm::StringRef key) const override;
-
- /**
- * Sets flags on the specified key in this table. The key can
- * not be null.
- *
- * @param key the key name
- * @param flags the flags to set (bitmask)
- */
- void SetFlags(llvm::StringRef key, unsigned int flags) override;
-
- /**
- * Clears flags on the specified key in this table. The key can
- * not be null.
- *
- * @param key the key name
- * @param flags the flags to clear (bitmask)
- */
- void ClearFlags(llvm::StringRef key, unsigned int flags) override;
-
- /**
- * Returns the flags for the specified key.
- *
- * @param key the key name
- * @return the flags, or 0 if the key is not defined
- */
- unsigned int GetFlags(llvm::StringRef key) const override;
-
- /**
- * Deletes the specified key in this table.
- *
- * @param key the key name
- */
- void Delete(llvm::StringRef key) override;
-
- /**
- * Put a number in the table
- *
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- bool PutNumber(llvm::StringRef key, double value) override;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultNumber(llvm::StringRef key,
- double defaultValue) override;
-
- /**
- * Gets the number associated with the given name.
- *
- * @param key the key to look up
- * @return the value associated with the given key
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method.
- */
- WPI_DEPRECATED(
- "Raises an exception if key not found; "
- "use GetNumber(StringRef key, double defaultValue) instead")
- virtual double GetNumber(llvm::StringRef key) const override;
-
- /**
- * Gets the number associated with the given name.
- *
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- */
- virtual double GetNumber(llvm::StringRef key,
- double defaultValue) const override;
-
- /**
- * Put a string in the table
- *
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- virtual bool PutString(llvm::StringRef key, llvm::StringRef value) override;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultString(llvm::StringRef key,
- llvm::StringRef defaultValue) override;
-
- /**
- * Gets the string associated with the given name.
- *
- * @param key the key to look up
- * @return the value associated with the given key
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method.
- */
- WPI_DEPRECATED(
- "Raises an exception if key not found; "
- "use GetString(StringRef key, StringRef defaultValue) instead")
- virtual std::string GetString(llvm::StringRef key) const override;
-
- /**
- * Gets the string associated with the given name. If the key does not
- * exist or is of different type, it will return the default value.
- *
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- */
- virtual std::string GetString(llvm::StringRef key,
- llvm::StringRef defaultValue) const override;
-
- /**
- * Put a boolean in the table
- *
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- virtual bool PutBoolean(llvm::StringRef key, bool value) override;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultBoolean(llvm::StringRef key,
- bool defaultValue) override;
-
- /**
- * Gets the boolean associated with the given name.
- *
- * @param key the key to look up
- * @return the value associated with the given key
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method.
- */
- WPI_DEPRECATED(
- "Raises an exception if key not found; "
- "use GetBoolean(StringRef key, bool defaultValue) instead")
- virtual bool GetBoolean(llvm::StringRef key) const override;
-
- /**
- * Gets the boolean associated with the given name. If the key does not
- * exist or is of different type, it will return the default value.
- *
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- */
- virtual bool GetBoolean(llvm::StringRef key,
- bool defaultValue) const override;
-
- /**
- * Put a boolean array in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- *
- * @note The array must be of int's rather than of bool's because
- * std::vector<bool> is special-cased in C++. 0 is false, any
- * non-zero value is true.
- */
- virtual bool PutBooleanArray(llvm::StringRef key,
- llvm::ArrayRef<int> value) override;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultBooleanArray(
- llvm::StringRef key, llvm::ArrayRef<int> defaultValue) override;
-
- /**
- * Returns the boolean array the key maps to. If the key does not exist or is
- * of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- *
- * @note This makes a copy of the array. If the overhead of this is a
- * concern, use GetValue() instead.
- *
- * @note The returned array is std::vector<int> instead of std::vector<bool>
- * because std::vector<bool> is special-cased in C++. 0 is false, any
- * non-zero value is true.
- */
- virtual std::vector<int> GetBooleanArray(
- llvm::StringRef key, llvm::ArrayRef<int> defaultValue) const override;
-
- /**
- * Put a number array in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- virtual bool PutNumberArray(llvm::StringRef key,
- llvm::ArrayRef<double> value) override;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultNumberArray(
- llvm::StringRef key, llvm::ArrayRef<double> defaultValue) override;
-
- /**
- * Returns the number array the key maps to. If the key does not exist or is
- * of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- *
- * @note This makes a copy of the array. If the overhead of this is a
- * concern, use GetValue() instead.
- */
- virtual std::vector<double> GetNumberArray(
- llvm::StringRef key, llvm::ArrayRef<double> defaultValue) const override;
-
- /**
- * Put a string array in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- virtual bool PutStringArray(llvm::StringRef key,
- llvm::ArrayRef<std::string> value) override;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultStringArray(
- llvm::StringRef key, llvm::ArrayRef<std::string> defaultValue) override;
-
- /**
- * Returns the string array the key maps to. If the key does not exist or is
- * of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- *
- * @note This makes a copy of the array. If the overhead of this is a
- * concern, use GetValue() instead.
- */
- virtual std::vector<std::string> GetStringArray(
- llvm::StringRef key,
- llvm::ArrayRef<std::string> defaultValue) const override;
-
- /**
- * Put a raw value (byte array) in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- virtual bool PutRaw(llvm::StringRef key, llvm::StringRef value) override;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultRaw(llvm::StringRef key,
- llvm::StringRef defaultValue) override;
-
- /**
- * Returns the raw value (byte array) the key maps to. If the key does not
- * exist or is of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- *
- * @note This makes a copy of the raw contents. If the overhead of this is a
- * concern, use GetValue() instead.
- */
- virtual std::string GetRaw(llvm::StringRef key,
- llvm::StringRef defaultValue) const override;
-
- /**
- * Put a value in the table
- *
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- bool PutValue(llvm::StringRef key, std::shared_ptr<nt::Value> value) override;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultValue(
- llvm::StringRef key, std::shared_ptr<nt::Value> defaultValue) override;
-
- /**
- * Gets the value associated with a key as an object
- *
- * @param key the key of the value to look up
- * @return the value associated with the given key, or nullptr if the key
- * does not exist
- */
- std::shared_ptr<nt::Value> GetValue(llvm::StringRef key) const override;
-};
-
-#endif // NETWORKTABLE_H_
diff --git a/third_party/ntcore_2017/include/nt_Value.h b/third_party/ntcore_2017/include/nt_Value.h
deleted file mode 100644
index a5c1304..0000000
--- a/third_party/ntcore_2017/include/nt_Value.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NT_VALUE_H_
-#define NT_VALUE_H_
-
-#include <cassert>
-#include <memory>
-#include <string>
-#include <type_traits>
-#include <vector>
-
-#include "llvm/ArrayRef.h"
-#include "llvm/StringRef.h"
-
-#include "ntcore_c.h"
-
-namespace nt {
-
-using llvm::ArrayRef;
-using llvm::StringRef;
-
-/** NetworkTables Entry Value */
-class Value {
- struct private_init {};
-
- public:
- Value();
- Value(NT_Type type, const private_init&);
- ~Value();
-
- NT_Type type() const { return m_val.type; }
- const NT_Value& value() const { return m_val; }
- unsigned long long last_change() const { return m_val.last_change; }
-
- /*
- * Type Checkers
- */
- bool IsBoolean() const { return m_val.type == NT_BOOLEAN; }
- bool IsDouble() const { return m_val.type == NT_DOUBLE; }
- bool IsString() const { return m_val.type == NT_STRING; }
- bool IsRaw() const { return m_val.type == NT_RAW; }
- bool IsRpc() const { return m_val.type == NT_RPC; }
- bool IsBooleanArray() const { return m_val.type == NT_BOOLEAN_ARRAY; }
- bool IsDoubleArray() const { return m_val.type == NT_DOUBLE_ARRAY; }
- bool IsStringArray() const { return m_val.type == NT_STRING_ARRAY; }
-
- /*
- * Type-Safe Getters
- */
- bool GetBoolean() const {
- assert(m_val.type == NT_BOOLEAN);
- return m_val.data.v_boolean != 0;
- }
- double GetDouble() const {
- assert(m_val.type == NT_DOUBLE);
- return m_val.data.v_double;
- }
- StringRef GetString() const {
- assert(m_val.type == NT_STRING);
- return m_string;
- }
- StringRef GetRaw() const {
- assert(m_val.type == NT_RAW);
- return m_string;
- }
- StringRef GetRpc() const {
- assert(m_val.type == NT_RPC);
- return m_string;
- }
- ArrayRef<int> GetBooleanArray() const {
- assert(m_val.type == NT_BOOLEAN_ARRAY);
- return ArrayRef<int>(m_val.data.arr_boolean.arr,
- m_val.data.arr_boolean.size);
- }
- ArrayRef<double> GetDoubleArray() const {
- assert(m_val.type == NT_DOUBLE_ARRAY);
- return ArrayRef<double>(m_val.data.arr_double.arr,
- m_val.data.arr_double.size);
- }
- ArrayRef<std::string> GetStringArray() const {
- assert(m_val.type == NT_STRING_ARRAY);
- return m_string_array;
- }
-
- static std::shared_ptr<Value> MakeBoolean(bool value) {
- auto val = std::make_shared<Value>(NT_BOOLEAN, private_init());
- val->m_val.data.v_boolean = value;
- return val;
- }
- static std::shared_ptr<Value> MakeDouble(double value) {
- auto val = std::make_shared<Value>(NT_DOUBLE, private_init());
- val->m_val.data.v_double = value;
- return val;
- }
- static std::shared_ptr<Value> MakeString(StringRef value) {
- auto val = std::make_shared<Value>(NT_STRING, private_init());
- val->m_string = value;
- val->m_val.data.v_string.str = const_cast<char*>(val->m_string.c_str());
- val->m_val.data.v_string.len = val->m_string.size();
- return val;
- }
-#ifdef _MSC_VER
- template <typename T,
- typename = std::enable_if_t<std::is_same<T, std::string>>>
-#else
- template <typename T,
- typename std::enable_if<std::is_same<T, std::string>::value>::type>
-#endif
- static std::shared_ptr<Value> MakeString(T&& value) {
- auto val = std::make_shared<Value>(NT_STRING, private_init());
- val->m_string = std::move(value);
- val->m_val.data.v_string.str = const_cast<char*>(val->m_string.c_str());
- val->m_val.data.v_string.len = val->m_string.size();
- return val;
- }
- static std::shared_ptr<Value> MakeRaw(StringRef value) {
- auto val = std::make_shared<Value>(NT_RAW, private_init());
- val->m_string = value;
- val->m_val.data.v_raw.str = const_cast<char*>(val->m_string.c_str());
- val->m_val.data.v_raw.len = val->m_string.size();
- return val;
- }
-#ifdef _MSC_VER
- template <typename T,
- typename = std::enable_if_t<std::is_same<T, std::string>>>
-#else
- template <typename T,
- typename std::enable_if<std::is_same<T, std::string>::value>::type>
-#endif
- static std::shared_ptr<Value> MakeRaw(T&& value) {
- auto val = std::make_shared<Value>(NT_RAW, private_init());
- val->m_string = std::move(value);
- val->m_val.data.v_raw.str = const_cast<char*>(val->m_string.c_str());
- val->m_val.data.v_raw.len = val->m_string.size();
- return val;
- }
- static std::shared_ptr<Value> MakeRpc(StringRef value) {
- auto val = std::make_shared<Value>(NT_RPC, private_init());
- val->m_string = value;
- val->m_val.data.v_raw.str = const_cast<char*>(val->m_string.c_str());
- val->m_val.data.v_raw.len = val->m_string.size();
- return val;
- }
- template <typename T>
- static std::shared_ptr<Value> MakeRpc(T&& value) {
- auto val = std::make_shared<Value>(NT_RPC, private_init());
- val->m_string = std::move(value);
- val->m_val.data.v_raw.str = const_cast<char*>(val->m_string.c_str());
- val->m_val.data.v_raw.len = val->m_string.size();
- return val;
- }
-
- static std::shared_ptr<Value> MakeBooleanArray(ArrayRef<int> value);
- static std::shared_ptr<Value> MakeDoubleArray(ArrayRef<double> value);
- static std::shared_ptr<Value> MakeStringArray(ArrayRef<std::string> value);
-
- // Note: This function moves the values out of the vector.
- static std::shared_ptr<Value> MakeStringArray(
- std::vector<std::string>&& value);
-
- Value(const Value&) = delete;
- Value& operator=(const Value&) = delete;
- friend bool operator==(const Value& lhs, const Value& rhs);
-
- private:
- NT_Value m_val;
- std::string m_string;
- std::vector<std::string> m_string_array;
-};
-
-bool operator==(const Value& lhs, const Value& rhs);
-inline bool operator!=(const Value& lhs, const Value& rhs) {
- return !(lhs == rhs);
-}
-
-} // namespace nt
-
-#endif // NT_VALUE_H_
diff --git a/third_party/ntcore_2017/include/ntcore.h b/third_party/ntcore_2017/include/ntcore.h
deleted file mode 100644
index 43e74a7..0000000
--- a/third_party/ntcore_2017/include/ntcore.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NTCORE_H_
-#define NTCORE_H_
-
-/* C API */
-#include "ntcore_c.h"
-
-#ifdef __cplusplus
-/* C++ API */
-#include "ntcore_cpp.h"
-#endif /* __cplusplus */
-
-#endif /* NTCORE_H_ */
diff --git a/third_party/ntcore_2017/include/ntcore_c.h b/third_party/ntcore_2017/include/ntcore_c.h
deleted file mode 100644
index 0744e4a..0000000
--- a/third_party/ntcore_2017/include/ntcore_c.h
+++ /dev/null
@@ -1,1062 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NTCORE_C_H_
-#define NTCORE_C_H_
-
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Default network tables port number */
-#define NT_DEFAULT_PORT 1735
-
-/** NetworkTables data types. */
-enum NT_Type {
- NT_UNASSIGNED = 0,
- NT_BOOLEAN = 0x01,
- NT_DOUBLE = 0x02,
- NT_STRING = 0x04,
- NT_RAW = 0x08,
- NT_BOOLEAN_ARRAY = 0x10,
- NT_DOUBLE_ARRAY = 0x20,
- NT_STRING_ARRAY = 0x40,
- NT_RPC = 0x80
-};
-
-/** NetworkTables entry flags. */
-enum NT_EntryFlags { NT_PERSISTENT = 0x01 };
-
-/** NetworkTables logging levels. */
-enum NT_LogLevel {
- NT_LOG_CRITICAL = 50,
- NT_LOG_ERROR = 40,
- NT_LOG_WARNING = 30,
- NT_LOG_INFO = 20,
- NT_LOG_DEBUG = 10,
- NT_LOG_DEBUG1 = 9,
- NT_LOG_DEBUG2 = 8,
- NT_LOG_DEBUG3 = 7,
- NT_LOG_DEBUG4 = 6
-};
-
-/** NetworkTables notififier kinds. */
-enum NT_NotifyKind {
- NT_NOTIFY_NONE = 0,
- NT_NOTIFY_IMMEDIATE = 0x01, /* initial listener addition */
- NT_NOTIFY_LOCAL = 0x02, /* changed locally */
- NT_NOTIFY_NEW = 0x04, /* newly created entry */
- NT_NOTIFY_DELETE = 0x08, /* deleted */
- NT_NOTIFY_UPDATE = 0x10, /* value changed */
- NT_NOTIFY_FLAGS = 0x20 /* flags changed */
-};
-
-/*
- * Structures
- */
-
-/** A NetworkTables string. */
-struct NT_String {
- /** String contents (UTF-8).
- * The string is NOT required to be zero-terminated.
- * When returned by the library, this is zero-terminated and allocated with
- * malloc().
- */
- char* str;
-
- /** Length of the string in bytes. If the string happens to be zero
- * terminated, this does not include the zero-termination.
- */
- size_t len;
-};
-
-/** NetworkTables Entry Value. Note this is a typed union. */
-struct NT_Value {
- enum NT_Type type;
- unsigned long long last_change;
- union {
- int v_boolean;
- double v_double;
- struct NT_String v_string;
- struct NT_String v_raw;
- struct {
- int* arr;
- size_t size;
- } arr_boolean;
- struct {
- double* arr;
- size_t size;
- } arr_double;
- struct {
- struct NT_String* arr;
- size_t size;
- } arr_string;
- } data;
-};
-
-/** NetworkTables Entry Information */
-struct NT_EntryInfo {
- /** Entry name */
- struct NT_String name;
-
- /** Entry type */
- enum NT_Type type;
-
- /** Entry flags */
- unsigned int flags;
-
- /** Timestamp of last change to entry (type or value). */
- unsigned long long last_change;
-};
-
-/** NetworkTables Connection Information */
-struct NT_ConnectionInfo {
- struct NT_String remote_id;
- struct NT_String remote_ip;
- unsigned int remote_port;
- unsigned long long last_update;
- unsigned int protocol_version;
-};
-
-/** NetworkTables RPC Parameter Definition */
-struct NT_RpcParamDef {
- struct NT_String name;
- struct NT_Value def_value;
-};
-
-/** NetworkTables RPC Result Definition */
-struct NT_RpcResultDef {
- struct NT_String name;
- enum NT_Type type;
-};
-
-/** NetworkTables RPC Definition */
-struct NT_RpcDefinition {
- unsigned int version;
- struct NT_String name;
- size_t num_params;
- NT_RpcParamDef* params;
- size_t num_results;
- NT_RpcResultDef* results;
-};
-
-/** NetworkTables RPC Call Data */
-struct NT_RpcCallInfo {
- unsigned int rpc_id;
- unsigned int call_uid;
- struct NT_String name;
- struct NT_String params;
-};
-
-/*
- * Table Functions
- */
-
-/** Get Entry Value.
- * Returns copy of current entry value.
- * Note that one of the type options is "unassigned".
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param value storage for returned entry value
- *
- * It is the caller's responsibility to free value once it's no longer
- * needed (the utility function NT_DisposeValue() is useful for this
- * purpose).
- */
-void NT_GetEntryValue(const char* name, size_t name_len,
- struct NT_Value* value);
-
-/** Set Default Entry Value.
- * Returns copy of current entry value if it exists.
- * Otherwise, sets passed in value, and returns set value.
- * Note that one of the type options is "unassigned".
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param default_value value to be set if name does not exist
- * @return 0 on error (value not set), 1 on success
- */
-int NT_SetDefaultEntryValue(const char* name, size_t name_len,
- const struct NT_Value* default_value);
-
-/** Set Entry Value.
- * Sets new entry value. If type of new value differs from the type of the
- * currently stored entry, returns error and does not update value.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param value new entry value
- * @return 0 on error (type mismatch), 1 on success
- */
-int NT_SetEntryValue(const char* name, size_t name_len,
- const struct NT_Value* value);
-
-/** Set Entry Type and Value.
- * Sets new entry value. If type of new value differs from the type of the
- * currently stored entry, the currently stored entry type is overridden
- * (generally this will generate an Entry Assignment message).
- *
- * This is NOT the preferred method to update a value; generally
- * NT_SetEntryValue() should be used instead, with appropriate error handling.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param value new entry value
- */
-void NT_SetEntryTypeValue(const char* name, size_t name_len,
- const struct NT_Value* value);
-
-/** Set Entry Flags.
- */
-void NT_SetEntryFlags(const char* name, size_t name_len, unsigned int flags);
-
-/** Get Entry Flags.
- */
-unsigned int NT_GetEntryFlags(const char* name, size_t name_len);
-
-/** Delete Entry.
- * Deletes an entry. This is a new feature in version 3.0 of the protocol,
- * so this may not have an effect if any other node in the network is not
- * version 3.0 or newer.
- *
- * Note: NT_GetConnections() can be used to determine the protocol version
- * of direct remote connection(s), but this is not sufficient to determine
- * if all nodes in the network are version 3.0 or newer.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- */
-void NT_DeleteEntry(const char* name, size_t name_len);
-
-/** Delete All Entries.
- * Deletes ALL table entries. This is a new feature in version 3.0 of the
- * so this may not have an effect if any other node in the network is not
- * version 3.0 or newer.
- *
- * Note: NT_GetConnections() can be used to determine the protocol version
- * of direct remote connection(s), but this is not sufficient to determine
- * if all nodes in the network are version 3.0 or newer.
- */
-void NT_DeleteAllEntries(void);
-
-/** Get Entry Information.
- * Returns an array of entry information (name, entry type,
- * and timestamp of last change to type/value). The results are optionally
- * filtered by string prefix and entry type to only return a subset of all
- * entries.
- *
- * @param prefix entry name required prefix; only entries whose name
- * starts with this string are returned
- * @param prefix_len length of prefix in bytes
- * @param types bitmask of NT_Type values; 0 is treated specially
- * as a "don't care"
- * @param count output parameter; set to length of returned array
- * @return Array of entry information.
- */
-struct NT_EntryInfo* NT_GetEntryInfo(const char* prefix, size_t prefix_len,
- unsigned int types, size_t* count);
-
-/** Flush Entries.
- * Forces an immediate flush of all local entry changes to network.
- * Normally this is done on a regularly scheduled interval (see
- * NT_SetUpdateRate()).
- *
- * Note: flushes are rate limited to avoid excessive network traffic. If
- * the time between calls is too short, the flush will occur after the minimum
- * time elapses (rather than immediately).
- */
-void NT_Flush(void);
-
-/*
- * Callback Creation Functions
- */
-
-void NT_SetListenerOnStart(void (*on_start)(void* data), void* data);
-void NT_SetListenerOnExit(void (*on_exit)(void* data), void* data);
-
-typedef void (*NT_EntryListenerCallback)(unsigned int uid, void* data,
- const char* name, size_t name_len,
- const struct NT_Value* value,
- unsigned int flags);
-
-typedef void (*NT_ConnectionListenerCallback)(
- unsigned int uid, void* data, int connected,
- const struct NT_ConnectionInfo* conn);
-
-unsigned int NT_AddEntryListener(const char* prefix, size_t prefix_len,
- void* data, NT_EntryListenerCallback callback,
- unsigned int flags);
-void NT_RemoveEntryListener(unsigned int entry_listener_uid);
-unsigned int NT_AddConnectionListener(void* data,
- NT_ConnectionListenerCallback callback,
- int immediate_notify);
-void NT_RemoveConnectionListener(unsigned int conn_listener_uid);
-
-int NT_NotifierDestroyed();
-
-/*
- * Remote Procedure Call Functions
- */
-
-void NT_SetRpcServerOnStart(void (*on_start)(void* data), void* data);
-void NT_SetRpcServerOnExit(void (*on_exit)(void* data), void* data);
-
-typedef char* (*NT_RpcCallback)(void* data, const char* name, size_t name_len,
- const char* params, size_t params_len,
- size_t* results_len,
- const struct NT_ConnectionInfo* conn_info);
-
-void NT_CreateRpc(const char* name, size_t name_len, const char* def,
- size_t def_len, void* data, NT_RpcCallback callback);
-void NT_CreatePolledRpc(const char* name, size_t name_len, const char* def,
- size_t def_len);
-
-int NT_PollRpc(int blocking, struct NT_RpcCallInfo* call_info);
-int NT_PollRpcTimeout(int blocking, double time_out,
- struct NT_RpcCallInfo* call_info);
-void NT_PostRpcResponse(unsigned int rpc_id, unsigned int call_uid,
- const char* result, size_t result_len);
-
-unsigned int NT_CallRpc(const char* name, size_t name_len, const char* params,
- size_t params_len);
-char* NT_GetRpcResult(int blocking, unsigned int call_uid, size_t* result_len);
-char* NT_GetRpcResultTimeout(int blocking, unsigned int call_uid,
- double time_out, size_t* result_len);
-void NT_CancelBlockingRpcResult(unsigned int call_uid);
-
-char* NT_PackRpcDefinition(const struct NT_RpcDefinition* def,
- size_t* packed_len);
-int NT_UnpackRpcDefinition(const char* packed, size_t packed_len,
- struct NT_RpcDefinition* def);
-char* NT_PackRpcValues(const struct NT_Value** values, size_t values_len,
- size_t* packed_len);
-struct NT_Value** NT_UnpackRpcValues(const char* packed, size_t packed_len,
- const NT_Type* types, size_t types_len);
-
-/*
- * Client/Server Functions
- */
-void NT_SetNetworkIdentity(const char* name, size_t name_len);
-
-/** Start Server
- * Starts a server using the specified filename, listening address, and port.
- *
- * @param persist_filename the name of the persist file to use (UTF-8 string,
- * null terminated)
- * @param listen_address the address to listen on, or null to listen on any
- * address. (UTF-8 string, null terminated)
- * @param port port to communicate over.
- */
-void NT_StartServer(const char* persist_filename, const char* listen_address,
- unsigned int port);
-
-/** Stop Server
- * Stops the server if it is running.
- */
-void NT_StopServer(void);
-
-/** Starts Client
- * Starts a client. Use NT_SetServer to set the server name and port.
- */
-void NT_StartClientNone(void);
-
-/** Starts Client
- * Starts a client using the specified server and port
- *
- * @param server_name server name (UTF-8 string, null terminated)
- * @param port port to communicate over
- *
- */
-void NT_StartClient(const char* server_name, unsigned int port);
-
-/** Starts Client
- * Starts a client using the specified (server, port) combinations. The
- * client will attempt to connect to each server in round robin fashion.
- *
- * @param count length of the server_names and ports arrays
- * @param server_names array of server names (each a UTF-8 string, null
- * terminated)
- * @param ports array of ports to communicate over (one for each server)
- *
- */
-void NT_StartClientMulti(size_t count, const char** server_names,
- const unsigned int* ports);
-
-/** Stop Client
- * Stops the client if it is running.
- */
-void NT_StopClient(void);
-
-/** Sets server address for client (without restarting client).
- *
- * @param server_name server name (UTF-8 string, null terminated)
- * @param port port to communicate over
- *
- */
-void NT_SetServer(const char* server_name, unsigned int port);
-
-/** Sets server addresses for client (without restarting client).
- * The client will attempt to connect to each server in round robin fashion.
- *
- * @param count length of the server_names and ports arrays
- * @param server_names array of server names (each a UTF-8 string, null
- * terminated)
- * @param ports array of ports to communicate over (one for each server)
- *
- */
-void NT_SetServerMulti(size_t count, const char** server_names,
- const unsigned int* ports);
-
-/** Starts requesting server address from Driver Station.
- * This connects to the Driver Station running on localhost to obtain the
- * server IP address.
- *
- * @param port server port to use in combination with IP from DS
- */
-void NT_StartDSClient(unsigned int port);
-
-/** Stops requesting server address from Driver Station. */
-void NT_StopDSClient(void);
-
-/** Stop Rpc Server
- * Stops the Rpc server if it is running.
- */
-void NT_StopRpcServer(void);
-
-/** Stop Notifier
- * Stops the Notifier (Entry and Connection Listener) thread if it is running.
- */
-void NT_StopNotifier(void);
-
-/** Set Update Rate
- * Sets the update rate of the table
- *
- * @param interval the interval to update the table at (in seconds)
- *
- */
-void NT_SetUpdateRate(double interval);
-
-/** Get Connections
- * Gets an array of all the connections in the table.
- *
- * @param count returns the number of elements in the array
- * @return an array containing all the connections.
- *
- * It is the caller's responsibility to free the array. The
- * NT_DisposeConnectionInfoArray function is useful for this purpose.
- */
-struct NT_ConnectionInfo* NT_GetConnections(size_t* count);
-
-/*
- * Persistent Functions
- */
-/* return error string, or NULL if successful */
-const char* NT_SavePersistent(const char* filename);
-const char* NT_LoadPersistent(const char* filename,
- void (*warn)(size_t line, const char* msg));
-
-/*
- * Utility Functions
- */
-
-/* frees value memory */
-void NT_DisposeValue(struct NT_Value* value);
-
-/* sets type to unassigned and clears rest of struct */
-void NT_InitValue(struct NT_Value* value);
-
-/* frees string memory */
-void NT_DisposeString(struct NT_String* str);
-
-/* sets length to zero and pointer to null */
-void NT_InitString(struct NT_String* str);
-
-/* Gets the type for the specified key, or unassigned if non existent. */
-enum NT_Type NT_GetType(const char* name, size_t name_len);
-
-/** Dispose Connection Info Array
- * Disposes a connection info array
- *
- * @param arr pointer to the array to dispose
- * @param count number of elements in the array
- *
- */
-void NT_DisposeConnectionInfoArray(struct NT_ConnectionInfo* arr, size_t count);
-
-/** Dispose Entry Info Array
- * Disposes an entry info array
- *
- * @param arr pointer to the array to dispose
- * @param count number of elements in the array
- *
- */
-void NT_DisposeEntryInfoArray(struct NT_EntryInfo* arr, size_t count);
-
-/** Dispose Rpc Definition
- * Disposes a Rpc Definition structure
- *
- * @param def pointer to the struct to dispose
- *
- */
-void NT_DisposeRpcDefinition(struct NT_RpcDefinition* def);
-
-/** Dispose Rpc Call Info
- * Disposes a Rpc Call Info structure
- *
- * @param def pointer to the struct to dispose
- *
- */
-void NT_DisposeRpcCallInfo(struct NT_RpcCallInfo* call_info);
-
-/* timestamp */
-unsigned long long NT_Now(void);
-
-/* logging */
-typedef void (*NT_LogFunc)(unsigned int level, const char* file,
- unsigned int line, const char* msg);
-void NT_SetLogger(NT_LogFunc func, unsigned int min_level);
-
-/*
- * Interop Utility Functions
- */
-
-/* Memory Allocators */
-
-/** Allocate Character Array
- * Allocates an array of chars.
- * Note that the size is the number of elements, and not the
- * specific number of bytes to allocate. That is calculated internally.
- *
- * @param size the number of elements the array will contain
- * @return the allocated char array
- *
- * After use, the array should be freed using the NT_FreeCharArray()
- * function.
- */
-char* NT_AllocateCharArray(size_t size);
-
-/** Allocate Boolean Array
- * Allocates an array of booleans.
- * Note that the size is the number of elements, and not the
- * specific number of bytes to allocate. That is calculated internally.
- *
- * @param size the number of elements the array will contain
- * @return the allocated boolean array
- *
- * After use, the array should be freed using the NT_FreeBooleanArray()
- * function.
- */
-int* NT_AllocateBooleanArray(size_t size);
-
-/** Allocate Double Array
- * Allocates an array of doubles.
- * Note that the size is the number of elements, and not the
- * specific number of bytes to allocate. That is calculated internally.
- *
- * @param size the number of elements the array will contain
- * @return the allocated double array
- *
- * After use, the array should be freed using the NT_FreeDoubleArray()
- * function.
- */
-double* NT_AllocateDoubleArray(size_t size);
-
-/** Allocate NT_String Array
- * Allocates an array of NT_Strings.
- * Note that the size is the number of elements, and not the
- * specific number of bytes to allocate. That is calculated internally.
- *
- * @param size the number of elements the array will contain
- * @return the allocated NT_String array
- *
- * After use, the array should be freed using the NT_FreeStringArray()
- * function.
- */
-struct NT_String* NT_AllocateStringArray(size_t size);
-
-/** Free Char Array
- * Frees an array of chars.
- *
- * @param v_boolean pointer to the char array to free
- */
-void NT_FreeCharArray(char* v_char);
-
-/** Free Double Array
- * Frees an array of doubles.
- *
- * @param v_boolean pointer to the double array to free
- */
-void NT_FreeDoubleArray(double* v_double);
-
-/** Free Boolean Array
- * Frees an array of booleans.
- *
- * @param v_boolean pointer to the boolean array to free
- */
-void NT_FreeBooleanArray(int* v_boolean);
-
-/** Free String Array
- * Frees an array of NT_Strings.
- *
- * @param v_string pointer to the string array to free
- * @param arr_size size of the string array to free
- *
- * Note that the individual NT_Strings in the array should NOT be
- * freed before calling this. This function will free all the strings
- * individually.
- */
-void NT_FreeStringArray(struct NT_String* v_string, size_t arr_size);
-
-/** Get Value Type
- * Returns the type of an NT_Value struct.
- * Note that one of the type options is "unassigned".
- *
- * @param value The NT_Value struct to get the type from.
- * @return The type of the value, or unassigned if null.
- */
-enum NT_Type NT_GetValueType(const struct NT_Value* value);
-
-/** Get Value Boolean
- * Returns the boolean from the NT_Value.
- * If the NT_Value is null, or is assigned to a different type, returns 0.
- *
- * @param value NT_Value struct to get the boolean from
- * @param last_change returns time in ms since the last change in the value
- * @param v_boolean returns the boolean assigned to the name
- * @return 1 if successful, or 0 if value is null or not a boolean
- */
-int NT_GetValueBoolean(const struct NT_Value* value,
- unsigned long long* last_change, int* v_boolean);
-
-/** Get Value Double
- * Returns the double from the NT_Value.
- * If the NT_Value is null, or is assigned to a different type, returns 0.
- *
- * @param value NT_Value struct to get the double from
- * @param last_change returns time in ms since the last change in the value
- * @param v_double returns the boolean assigned to the name
- * @return 1 if successful, or 0 if value is null or not a double
- */
-int NT_GetValueDouble(const struct NT_Value* value,
- unsigned long long* last_change, double* v_double);
-
-/** Get Value String
- * Returns a copy of the string from the NT_Value.
- * If the NT_Value is null, or is assigned to a different type, returns 0.
- *
- * @param value NT_Value struct to get the string from
- * @param last_change returns time in ms since the last change in the value
- * @param str_len returns the length of the string
- * @return pointer to the string (UTF-8), or null if error
- *
- * It is the caller's responsibility to free the string once its no longer
- * needed. The NT_FreeCharArray() function is useful for this purpose. The
- * returned string is a copy of the string in the value, and must be freed
- * separately.
- */
-char* NT_GetValueString(const struct NT_Value* value,
- unsigned long long* last_change, size_t* str_len);
-
-/** Get Value Raw
- * Returns a copy of the raw value from the NT_Value.
- * If the NT_Value is null, or is assigned to a different type, returns null.
- *
- * @param value NT_Value struct to get the string from
- * @param last_change returns time in ms since the last change in the value
- * @param raw_len returns the length of the string
- * @return pointer to the raw value (UTF-8), or null if error
- *
- * It is the caller's responsibility to free the raw value once its no longer
- * needed. The NT_FreeCharArray() function is useful for this purpose. The
- * returned string is a copy of the string in the value, and must be freed
- * separately.
- */
-char* NT_GetValueRaw(const struct NT_Value* value,
- unsigned long long* last_change, size_t* raw_len);
-
-/** Get Value Boolean Array
- * Returns a copy of the boolean array from the NT_Value.
- * If the NT_Value is null, or is assigned to a different type, returns null.
- *
- * @param value NT_Value struct to get the boolean array from
- * @param last_change returns time in ms since the last change in the value
- * @param arr_size returns the number of elements in the array
- * @return pointer to the boolean array, or null if error
- *
- * It is the caller's responsibility to free the array once its no longer
- * needed. The NT_FreeBooleanArray() function is useful for this purpose.
- * The returned array is a copy of the array in the value, and must be
- * freed separately.
- */
-int* NT_GetValueBooleanArray(const struct NT_Value* value,
- unsigned long long* last_change, size_t* arr_size);
-
-/** Get Value Double Array
- * Returns a copy of the double array from the NT_Value.
- * If the NT_Value is null, or is assigned to a different type, returns null.
- *
- * @param value NT_Value struct to get the double array from
- * @param last_change returns time in ms since the last change in the value
- * @param arr_size returns the number of elements in the array
- * @return pointer to the double array, or null if error
- *
- * It is the caller's responsibility to free the array once its no longer
- * needed. The NT_FreeDoubleArray() function is useful for this purpose.
- * The returned array is a copy of the array in the value, and must be
- * freed separately.
- */
-double* NT_GetValueDoubleArray(const struct NT_Value* value,
- unsigned long long* last_change,
- size_t* arr_size);
-
-/** Get Value String Array
- * Returns a copy of the NT_String array from the NT_Value.
- * If the NT_Value is null, or is assigned to a different type, returns null.
- *
- * @param value NT_Value struct to get the NT_String array from
- * @param last_change returns time in ms since the last change in the value
- * @param arr_size returns the number of elements in the array
- * @return pointer to the NT_String array, or null if error
- *
- * It is the caller's responsibility to free the array once its no longer
- * needed. The NT_FreeStringArray() function is useful for this purpose.
- * The returned array is a copy of the array in the value, and must be
- * freed seperately. Note that the individual NT_Strings should not be freed,
- * but the entire array should be freed at once. The NT_FreeStringArray()
- * function will free all the NT_Strings.
- */
-NT_String* NT_GetValueStringArray(const struct NT_Value* value,
- unsigned long long* last_change,
- size_t* arr_size);
-
-/** Get Entry Boolean
- * Returns the boolean currently assigned to the entry name.
- * If the entry name is not currently assigned, or is assigned to a
- * different type, returns 0.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param last_change returns time in ms since the last change in the value
- * @param v_boolean returns the boolean assigned to the name
- * @return 1 if successful, or 0 if value is unassigned or not a
- * boolean
- */
-int NT_GetEntryBoolean(const char* name, size_t name_len,
- unsigned long long* last_change, int* v_boolean);
-
-/** Get Entry Double
- * Returns the double currently assigned to the entry name.
- * If the entry name is not currently assigned, or is assigned to a
- * different type, returns 0.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param last_change returns time in ms since the last change in the value
- * @param v_double returns the double assigned to the name
- * @return 1 if successful, or 0 if value is unassigned or not a
- * double
- */
-int NT_GetEntryDouble(const char* name, size_t name_len,
- unsigned long long* last_change, double* v_double);
-
-/** Get Entry String
- * Returns a copy of the string assigned to the entry name.
- * If the entry name is not currently assigned, or is assigned to a
- * different type, returns null.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param last_change returns time in ms since the last change in the value
- * @param str_len returns the length of the string
- * @return pointer to the string (UTF-8), or null if error
- *
- * It is the caller's responsibility to free the string once its no longer
- * needed. The NT_FreeCharArray() function is useful for this purpose.
- */
-char* NT_GetEntryString(const char* name, size_t name_len,
- unsigned long long* last_change, size_t* str_len);
-
-/** Get Entry Raw
- * Returns a copy of the raw value assigned to the entry name.
- * If the entry name is not currently assigned, or is assigned to a
- * different type, returns null.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param last_change returns time in ms since the last change in the value
- * @param raw_len returns the length of the string
- * @return pointer to the raw value (UTF-8), or null if error
- *
- * It is the caller's responsibility to free the raw value once its no longer
- * needed. The NT_FreeCharArray() function is useful for this purpose.
- */
-char* NT_GetEntryRaw(const char* name, size_t name_len,
- unsigned long long* last_change, size_t* raw_len);
-
-/** Get Entry Boolean Array
- * Returns a copy of the boolean array assigned to the entry name.
- * If the entry name is not currently assigned, or is assigned to a
- * different type, returns null.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param last_change returns time in ms since the last change in the value
- * @param arr_size returns the number of elements in the array
- * @return pointer to the boolean array, or null if error
- *
- * It is the caller's responsibility to free the array once its no longer
- * needed. The NT_FreeBooleanArray() function is useful for this purpose.
- */
-int* NT_GetEntryBooleanArray(const char* name, size_t name_len,
- unsigned long long* last_change, size_t* arr_size);
-
-/** Get Entry Double Array
- * Returns a copy of the double array assigned to the entry name.
- * If the entry name is not currently assigned, or is assigned to a
- * different type, returns null.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param last_change returns time in ms since the last change in the value
- * @param arr_size returns the number of elements in the array
- * @return pointer to the double array, or null if error
- *
- * It is the caller's responsibility to free the array once its no longer
- * needed. The NT_FreeDoubleArray() function is useful for this purpose.
- */
-double* NT_GetEntryDoubleArray(const char* name, size_t name_len,
- unsigned long long* last_change,
- size_t* arr_size);
-
-/** Get Entry String Array
- * Returns a copy of the NT_String array assigned to the entry name.
- * If the entry name is not currently assigned, or is assigned to a
- * different type, returns null.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param last_change returns time in ms since the last change in the value
- * @param arr_size returns the number of elements in the array
- * @return pointer to the NT_String array, or null if error
- *
- * It is the caller's responsibility to free the array once its no longer
- * needed. The NT_FreeStringArray() function is useful for this purpose. Note
- * that the individual NT_Strings should not be freed, but the entire array
- * should be freed at once. The NT_FreeStringArray() function will free all the
- * NT_Strings.
- */
-NT_String* NT_GetEntryStringArray(const char* name, size_t name_len,
- unsigned long long* last_change,
- size_t* arr_size);
-
-/* Set Default Values */
-
-/** Set Default Entry Boolean.
- * Sets the default for the specified key to be a boolean.
- * If key exists with same type, does not set value. Otherwise
- * sets value to the default.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param default_boolean value to be set if name does not exist
- * @return 0 on error (value not set), 1 on success
- */
-int NT_SetDefaultEntryBoolean(const char* name, size_t name_len,
- int default_boolean);
-
-/** Set Default Entry Double.
- * Sets the default for the specified key.
- * If key exists with same type, does not set value. Otherwise
- * sets value to the default.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param default_double value to be set if name does not exist
- * @return 0 on error (value not set), 1 on success
- */
-int NT_SetDefaultEntryDouble(const char* name, size_t name_len,
- double default_double);
-
-/** Set Default Entry String.
- * Sets the default for the specified key.
- * If key exists with same type, does not set value. Otherwise
- * sets value to the default.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param default_value value to be set if name does not exist
- * @param default_len length of value
- * @return 0 on error (value not set), 1 on success
- */
-int NT_SetDefaultEntryString(const char* name, size_t name_len,
- const char* default_value, size_t default_len);
-
-/** Set Default Entry Raw.
- * Sets the default for the specified key.
- * If key exists with same type, does not set value. Otherwise
- * sets value to the default.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param default_value value to be set if name does not exist
- * @param default_len length of value array
- * @return 0 on error (value not set), 1 on success
- */
-int NT_SetDefaultEntryRaw(const char* name, size_t name_len,
- const char* default_value, size_t default_len);
-
-/** Set Default Entry Boolean Array.
- * Sets the default for the specified key.
- * If key exists with same type, does not set value. Otherwise
- * sets value to the default.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param default_value value to be set if name does not exist
- * @param default_size size of value array
- * @return 0 on error (value not set), 1 on success
- */
-int NT_SetDefaultEntryBooleanArray(const char* name, size_t name_len,
- const int* default_value,
- size_t default_size);
-
-/** Set Default Entry Double Array.
- * Sets the default for the specified key.
- * If key exists with same type, does not set value. Otherwise
- * sets value to the default.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param default_value value to be set if name does not exist
- * @param default_size size of value array
- * @return 0 on error (value not set), 1 on success
- */
-int NT_SetDefaultEntryDoubleArray(const char* name, size_t name_len,
- const double* default_value,
- size_t default_size);
-
-/** Set Default Entry String Array.
- * Sets the default for the specified key.
- * If key exists with same type, does not set value. Otherwise
- * sets value to the default.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param default_value value to be set if name does not exist
- * @param default_size size of value array
- * @return 0 on error (value not set), 1 on success
- */
-int NT_SetDefaultEntryStringArray(const char* name, size_t name_len,
- const struct NT_String* default_value,
- size_t default_size);
-
-/* Entry Value Setters */
-
-/** Set Entry Boolean
- * Sets an entry boolean. If the entry name is not currently assigned to a
- * boolean, returns error unless the force parameter is set.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param v_boolean boolean value to set
- * @param force 1 to force the entry to get overwritten, otherwise 0
- * @return 0 on error (type mismatch), 1 on success
- */
-int NT_SetEntryBoolean(const char* name, size_t name_len, int v_boolean,
- int force);
-
-/** Set Entry Double
- * Sets an entry double. If the entry name is not currently assigned to a
- * double, returns error unless the force parameter is set.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param v_double double value to set
- * @param force 1 to force the entry to get overwritten, otherwise 0
- * @return 0 on error (type mismatch), 1 on success
- */
-int NT_SetEntryDouble(const char* name, size_t name_len, double v_double,
- int force);
-
-/** Set Entry String
- * Sets an entry string. If the entry name is not currently assigned to a
- * string, returns error unless the force parameter is set.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param str string to set (UTF-8 string)
- * @param str_len length of string to write in bytes
- * @param force 1 to force the entry to get overwritten, otherwise 0
- * @return 0 on error (type mismatch), 1 on success
- */
-int NT_SetEntryString(const char* name, size_t name_len, const char* str,
- size_t str_len, int force);
-
-/** Set Entry Raw
- * Sets the raw value of an entry. If the entry name is not currently assigned
- * to a raw value, returns error unless the force parameter is set.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param raw raw string to set (UTF-8 string)
- * @param raw_len length of raw string to write in bytes
- * @param force 1 to force the entry to get overwritten, otherwise 0
- * @return 0 on error (type mismatch), 1 on success
- */
-int NT_SetEntryRaw(const char* name, size_t name_len, const char* raw,
- size_t raw_len, int force);
-
-/** Set Entry Boolean Array
- * Sets an entry boolean array. If the entry name is not currently assigned to
- * a boolean array, returns error unless the force parameter is set.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param arr boolean array to write
- * @param size number of elements in the array
- * @param force 1 to force the entry to get overwritten, otherwise 0
- * @return 0 on error (type mismatch), 1 on success
- */
-int NT_SetEntryBooleanArray(const char* name, size_t name_len, const int* arr,
- size_t size, int force);
-
-/** Set Entry Double Array
- * Sets an entry double array. If the entry name is not currently assigned to
- * a double array, returns error unless the force parameter is set.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param arr double array to write
- * @param size number of elements in the array
- * @param force 1 to force the entry to get overwritten, otherwise 0
- * @return 0 on error (type mismatch), 1 on success
- */
-int NT_SetEntryDoubleArray(const char* name, size_t name_len, const double* arr,
- size_t size, int force);
-
-/** Set Entry String Array
- * Sets an entry string array. If the entry name is not currently assigned to
- * a string array, returns error unless the force parameter is set.
- *
- * @param name entry name (UTF-8 string)
- * @param name_len length of name in bytes
- * @param arr NT_String array to write
- * @param size number of elements in the array
- * @param force 1 to force the entry to get overwritten, otherwise 0
- * @return 0 on error (type mismatch), 1 on success
- */
-int NT_SetEntryStringArray(const char* name, size_t name_len,
- const struct NT_String* arr, size_t size, int force);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NTCORE_C_H_ */
diff --git a/third_party/ntcore_2017/include/ntcore_cpp.h b/third_party/ntcore_2017/include/ntcore_cpp.h
deleted file mode 100644
index 67928f7..0000000
--- a/third_party/ntcore_2017/include/ntcore_cpp.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NTCORE_CPP_H_
-#define NTCORE_CPP_H_
-
-#include <cassert>
-#include <functional>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "llvm/ArrayRef.h"
-#include "llvm/StringRef.h"
-
-#include "nt_Value.h"
-
-namespace nt {
-
-using llvm::ArrayRef;
-using llvm::StringRef;
-
-/** NetworkTables Entry Information */
-struct EntryInfo {
- /** Entry name */
- std::string name;
-
- /** Entry type */
- NT_Type type;
-
- /** Entry flags */
- unsigned int flags;
-
- /** Timestamp of last change to entry (type or value). */
- unsigned long long last_change;
-};
-
-/** NetworkTables Connection Information */
-struct ConnectionInfo {
- std::string remote_id;
- std::string remote_ip;
- unsigned int remote_port;
- unsigned long long last_update;
- unsigned int protocol_version;
-};
-
-/** NetworkTables RPC Parameter Definition */
-struct RpcParamDef {
- RpcParamDef() = default;
- RpcParamDef(StringRef name_, std::shared_ptr<Value> def_value_)
- : name(name_), def_value(def_value_) {}
-
- std::string name;
- std::shared_ptr<Value> def_value;
-};
-
-/** NetworkTables RPC Result Definition */
-struct RpcResultDef {
- RpcResultDef() = default;
- RpcResultDef(StringRef name_, NT_Type type_) : name(name_), type(type_) {}
-
- std::string name;
- NT_Type type;
-};
-
-/** NetworkTables RPC Definition */
-struct RpcDefinition {
- unsigned int version;
- std::string name;
- std::vector<RpcParamDef> params;
- std::vector<RpcResultDef> results;
-};
-
-/** NetworkTables RPC Call Data */
-struct RpcCallInfo {
- unsigned int rpc_id;
- unsigned int call_uid;
- std::string name;
- std::string params;
-};
-
-/*
- * Table Functions
- */
-
-/** Get Entry Value.
- * Returns copy of current entry value.
- * Note that one of the type options is "unassigned".
- *
- * @param name entry name (UTF-8 string)
- * @return entry value
- */
-std::shared_ptr<Value> GetEntryValue(StringRef name);
-
-/** Set Default Entry Value
- * Returns copy of current entry value if it exists.
- * Otherwise, sets passed in value, and returns set value.
- * Note that one of the type options is "unassigned".
- *
- * @param name entry name (UTF-8 string)
- * @param value value to be set if name does not exist
- * @return False on error (value not set), True on success
- */
-bool SetDefaultEntryValue(StringRef name, std::shared_ptr<Value> value);
-
-/** Set Entry Value.
- * Sets new entry value. If type of new value differs from the type of the
- * currently stored entry, returns error and does not update value.
- *
- * @param name entry name (UTF-8 string)
- * @param value new entry value
- * @return False on error (type mismatch), True on success
- */
-bool SetEntryValue(StringRef name, std::shared_ptr<Value> value);
-
-/** Set Entry Type and Value.
- * Sets new entry value. If type of new value differs from the type of the
- * currently stored entry, the currently stored entry type is overridden
- * (generally this will generate an Entry Assignment message).
- *
- * This is NOT the preferred method to update a value; generally
- * SetEntryValue() should be used instead, with appropriate error handling.
- *
- * @param name entry name (UTF-8 string)
- * @param value new entry value
- */
-void SetEntryTypeValue(StringRef name, std::shared_ptr<Value> value);
-
-/** Set Entry Flags.
- */
-void SetEntryFlags(StringRef name, unsigned int flags);
-
-/** Get Entry Flags.
- */
-unsigned int GetEntryFlags(StringRef name);
-
-/** Delete Entry.
- * Deletes an entry. This is a new feature in version 3.0 of the protocol,
- * so this may not have an effect if any other node in the network is not
- * version 3.0 or newer.
- *
- * Note: GetConnections() can be used to determine the protocol version
- * of direct remote connection(s), but this is not sufficient to determine
- * if all nodes in the network are version 3.0 or newer.
- *
- * @param name entry name (UTF-8 string)
- */
-void DeleteEntry(StringRef name);
-
-/** Delete All Entries.
- * Deletes ALL table entries. This is a new feature in version 3.0 of the
- * so this may not have an effect if any other node in the network is not
- * version 3.0 or newer.
- *
- * Note: GetConnections() can be used to determine the protocol version
- * of direct remote connection(s), but this is not sufficient to determine
- * if all nodes in the network are version 3.0 or newer.
- */
-void DeleteAllEntries();
-
-/** Get Entry Information.
- * Returns an array of entry information (name, entry type,
- * and timestamp of last change to type/value). The results are optionally
- * filtered by string prefix and entry type to only return a subset of all
- * entries.
- *
- * @param prefix entry name required prefix; only entries whose name
- * starts with this string are returned
- * @param types bitmask of NT_Type values; 0 is treated specially
- * as a "don't care"
- * @return Array of entry information.
- */
-std::vector<EntryInfo> GetEntryInfo(StringRef prefix, unsigned int types);
-
-/** Flush Entries.
- * Forces an immediate flush of all local entry changes to network.
- * Normally this is done on a regularly scheduled interval (see
- * NT_SetUpdateRate()).
- *
- * Note: flushes are rate limited to avoid excessive network traffic. If
- * the time between calls is too short, the flush will occur after the minimum
- * time elapses (rather than immediately).
- */
-void Flush();
-
-/*
- * Callback Creation Functions
- */
-
-void SetListenerOnStart(std::function<void()> on_start);
-void SetListenerOnExit(std::function<void()> on_exit);
-
-typedef std::function<void(unsigned int uid, StringRef name,
- std::shared_ptr<Value> value, unsigned int flags)>
- EntryListenerCallback;
-
-typedef std::function<void(unsigned int uid, bool connected,
- const ConnectionInfo& conn)>
- ConnectionListenerCallback;
-
-unsigned int AddEntryListener(StringRef prefix, EntryListenerCallback callback,
- unsigned int flags);
-void RemoveEntryListener(unsigned int entry_listener_uid);
-unsigned int AddConnectionListener(ConnectionListenerCallback callback,
- bool immediate_notify);
-void RemoveConnectionListener(unsigned int conn_listener_uid);
-
-bool NotifierDestroyed();
-
-/*
- * Remote Procedure Call Functions
- */
-
-#if defined(_MSC_VER) && _MSC_VER < 1900
-const double kTimeout_Indefinite = -1;
-#else
-constexpr double kTimeout_Indefinite = -1;
-#endif
-
-void SetRpcServerOnStart(std::function<void()> on_start);
-void SetRpcServerOnExit(std::function<void()> on_exit);
-
-typedef std::function<std::string(StringRef name, StringRef params,
- const ConnectionInfo& conn_info)>
- RpcCallback;
-
-void CreateRpc(StringRef name, StringRef def, RpcCallback callback);
-void CreatePolledRpc(StringRef name, StringRef def);
-
-bool PollRpc(bool blocking, RpcCallInfo* call_info);
-bool PollRpc(bool blocking, double time_out, RpcCallInfo* call_info);
-void PostRpcResponse(unsigned int rpc_id, unsigned int call_uid,
- StringRef result);
-
-unsigned int CallRpc(StringRef name, StringRef params);
-bool GetRpcResult(bool blocking, unsigned int call_uid, std::string* result);
-bool GetRpcResult(bool blocking, unsigned int call_uid, double time_out,
- std::string* result);
-void CancelBlockingRpcResult(unsigned int call_uid);
-
-std::string PackRpcDefinition(const RpcDefinition& def);
-bool UnpackRpcDefinition(StringRef packed, RpcDefinition* def);
-std::string PackRpcValues(ArrayRef<std::shared_ptr<Value>> values);
-std::vector<std::shared_ptr<Value>> UnpackRpcValues(StringRef packed,
- ArrayRef<NT_Type> types);
-
-/*
- * Client/Server Functions
- */
-void SetNetworkIdentity(StringRef name);
-void StartServer(StringRef persist_filename, const char* listen_address,
- unsigned int port);
-void StopServer();
-void StartClient();
-void StartClient(const char* server_name, unsigned int port);
-void StartClient(ArrayRef<std::pair<StringRef, unsigned int>> servers);
-void StopClient();
-void SetServer(const char* server_name, unsigned int port);
-void SetServer(ArrayRef<std::pair<StringRef, unsigned int>> servers);
-void StartDSClient(unsigned int port);
-void StopDSClient();
-void StopRpcServer();
-void StopNotifier();
-void SetUpdateRate(double interval);
-std::vector<ConnectionInfo> GetConnections();
-
-/*
- * Persistent Functions
- */
-/* return error string, or nullptr if successful */
-const char* SavePersistent(StringRef filename);
-const char* LoadPersistent(
- StringRef filename, std::function<void(size_t line, const char* msg)> warn);
-
-/*
- * Utility Functions
- */
-
-/* timestamp */
-unsigned long long Now();
-
-/* logging */
-typedef std::function<void(unsigned int level, const char* file,
- unsigned int line, const char* msg)>
- LogFunc;
-void SetLogger(LogFunc func, unsigned int min_level);
-
-} // namespace nt
-
-#endif /* NTCORE_CPP_H_ */
diff --git a/third_party/ntcore_2017/include/ntcore_test.h b/third_party/ntcore_2017/include/ntcore_test.h
deleted file mode 100644
index 08e0fa6..0000000
--- a/third_party/ntcore_2017/include/ntcore_test.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NTCORE_TEST_H_
-#define NTCORE_TEST_H_
-
-#include "ntcore.h"
-
-// Functions in this header are to be used only for testing
-
-extern "C" {
-struct NT_String* NT_GetStringForTesting(const char* string, int* struct_size);
-// No need for free as one already exists in main library
-
-struct NT_EntryInfo* NT_GetEntryInfoForTesting(const char* name,
- enum NT_Type type,
- unsigned int flags,
- unsigned long long last_change,
- int* struct_size);
-
-void NT_FreeEntryInfoForTesting(struct NT_EntryInfo* info);
-
-struct NT_ConnectionInfo* NT_GetConnectionInfoForTesting(
- const char* remote_id, const char* remote_ip, unsigned int remote_port,
- unsigned long long last_update, unsigned int protocol_version,
- int* struct_size);
-
-void NT_FreeConnectionInfoForTesting(struct NT_ConnectionInfo* info);
-
-struct NT_Value* NT_GetValueBooleanForTesting(unsigned long long last_change,
- int val, int* struct_size);
-
-struct NT_Value* NT_GetValueDoubleForTesting(unsigned long long last_change,
- double val, int* struct_size);
-
-struct NT_Value* NT_GetValueStringForTesting(unsigned long long last_change,
- const char* str, int* struct_size);
-
-struct NT_Value* NT_GetValueRawForTesting(unsigned long long last_change,
- const char* raw, int raw_len,
- int* struct_size);
-
-struct NT_Value* NT_GetValueBooleanArrayForTesting(
- unsigned long long last_change, const int* arr, size_t array_len,
- int* struct_size);
-
-struct NT_Value* NT_GetValueDoubleArrayForTesting(
- unsigned long long last_change, const double* arr, size_t array_len,
- int* struct_size);
-
-struct NT_Value* NT_GetValueStringArrayForTesting(
- unsigned long long last_change, const struct NT_String* arr,
- size_t array_len, int* struct_size);
-// No need for free as one already exists in the main library
-
-struct NT_RpcParamDef* NT_GetRpcParamDefForTesting(const char* name,
- const struct NT_Value* val,
- int* struct_size);
-
-void NT_FreeRpcParamDefForTesting(struct NT_RpcParamDef* def);
-
-struct NT_RpcResultDef* NT_GetRpcResultsDefForTesting(const char* name,
- enum NT_Type type,
- int* struct_size);
-
-void NT_FreeRpcResultsDefForTesting(struct NT_RpcResultDef* def);
-
-struct NT_RpcDefinition* NT_GetRpcDefinitionForTesting(
- unsigned int version, const char* name, size_t num_params,
- const struct NT_RpcParamDef* params, size_t num_results,
- const struct NT_RpcResultDef* results, int* struct_size);
-// No need for free as one already exists in the main library
-
-struct NT_RpcCallInfo* NT_GetRpcCallInfoForTesting(
- unsigned int rpc_id, unsigned int call_uid, const char* name,
- const char* params, size_t params_len, int* struct_size);
-// No need for free as one already exists in the main library
-}
-
-#endif /* NTCORE_TEST_H_ */
diff --git a/third_party/ntcore_2017/include/tables/ITable.h b/third_party/ntcore_2017/include/tables/ITable.h
deleted file mode 100644
index 1f94321..0000000
--- a/third_party/ntcore_2017/include/tables/ITable.h
+++ /dev/null
@@ -1,487 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef ITABLE_H_
-#define ITABLE_H_
-
-#include <memory>
-
-#include "llvm/StringRef.h"
-#include "nt_Value.h"
-#include "support/deprecated.h"
-
-class ITableListener;
-
-/**
- * A table whose values can be read and written to
- */
-class ITable {
- public:
- /**
- * Determines whether the given key is in this table.
- *
- * @param key the key to search for
- * @return true if the table as a value assigned to the given key
- */
- virtual bool ContainsKey(llvm::StringRef key) const = 0;
-
- /**
- * Determines whether there exists a non-empty subtable for this key
- * in this table.
- *
- * @param key the key to search for
- * @return true if there is a subtable with the key which contains at least
- * one key/subtable of its own
- */
- virtual bool ContainsSubTable(llvm::StringRef key) const = 0;
-
- /**
- * Gets the subtable in this table for the given name.
- *
- * @param key the name of the table relative to this one
- * @return a sub table relative to this one
- */
- virtual std::shared_ptr<ITable> GetSubTable(llvm::StringRef key) const = 0;
-
- /**
- * @param types bitmask of types; 0 is treated as a "don't care".
- * @return keys currently in the table
- */
- virtual std::vector<std::string> GetKeys(int types = 0) const = 0;
-
- /**
- * @return subtables currently in the table
- */
- virtual std::vector<std::string> GetSubTables() const = 0;
-
- /**
- * Makes a key's value persistent through program restarts.
- *
- * @param key the key to make persistent
- */
- virtual void SetPersistent(llvm::StringRef key) = 0;
-
- /**
- * Stop making a key's value persistent through program restarts.
- * The key cannot be null.
- *
- * @param key the key name
- */
- virtual void ClearPersistent(llvm::StringRef key) = 0;
-
- /**
- * Returns whether the value is persistent through program restarts.
- * The key cannot be null.
- *
- * @param key the key name
- */
- virtual bool IsPersistent(llvm::StringRef key) const = 0;
-
- /**
- * Sets flags on the specified key in this table. The key can
- * not be null.
- *
- * @param key the key name
- * @param flags the flags to set (bitmask)
- */
- virtual void SetFlags(llvm::StringRef key, unsigned int flags) = 0;
-
- /**
- * Clears flags on the specified key in this table. The key can
- * not be null.
- *
- * @param key the key name
- * @param flags the flags to clear (bitmask)
- */
- virtual void ClearFlags(llvm::StringRef key, unsigned int flags) = 0;
-
- /**
- * Returns the flags for the specified key.
- *
- * @param key the key name
- * @return the flags, or 0 if the key is not defined
- */
- virtual unsigned int GetFlags(llvm::StringRef key) const = 0;
-
- /**
- * Deletes the specified key in this table.
- *
- * @param key the key name
- */
- virtual void Delete(llvm::StringRef key) = 0;
-
- /**
- * Gets the value associated with a key as an object
- *
- * @param key the key of the value to look up
- * @return the value associated with the given key, or nullptr if the key
- * does not exist
- */
- virtual std::shared_ptr<nt::Value> GetValue(llvm::StringRef key) const = 0;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultValue(llvm::StringRef key,
- std::shared_ptr<nt::Value> defaultValue) = 0;
-
- /**
- * Put a value in the table
- *
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- virtual bool PutValue(llvm::StringRef key,
- std::shared_ptr<nt::Value> value) = 0;
-
- /**
- * Put a number in the table
- *
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- virtual bool PutNumber(llvm::StringRef key, double value) = 0;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultNumber(llvm::StringRef key, double defaultValue) = 0;
-
- /**
- * Gets the number associated with the given name.
- *
- * @param key the key to look up
- * @return the value associated with the given key
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method.
- */
- WPI_DEPRECATED(
- "Raises an exception if key not found; "
- "use GetNumber(StringRef key, double defaultValue) instead")
- virtual double GetNumber(llvm::StringRef key) const = 0;
-
- /**
- * Gets the number associated with the given name.
- *
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- */
- virtual double GetNumber(llvm::StringRef key, double defaultValue) const = 0;
-
- /**
- * Put a string in the table
- *
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- virtual bool PutString(llvm::StringRef key, llvm::StringRef value) = 0;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultString(llvm::StringRef key,
- llvm::StringRef defaultValue) = 0;
-
- /**
- * Gets the string associated with the given name.
- *
- * @param key the key to look up
- * @return the value associated with the given key
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method.
- */
- WPI_DEPRECATED(
- "Raises an exception if key not found; "
- "use GetString(StringRef key, StringRef defaultValue) instead")
- virtual std::string GetString(llvm::StringRef key) const = 0;
-
- /**
- * Gets the string associated with the given name. If the key does not
- * exist or is of different type, it will return the default value.
- *
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- *
- * @note This makes a copy of the string. If the overhead of this is a
- * concern, use GetValue() instead.
- */
- virtual std::string GetString(llvm::StringRef key,
- llvm::StringRef defaultValue) const = 0;
-
- /**
- * Put a boolean in the table
- *
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- virtual bool PutBoolean(llvm::StringRef key, bool value) = 0;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultBoolean(llvm::StringRef key, bool defaultValue) = 0;
-
- /**
- * Gets the boolean associated with the given name.
- *
- * @param key the key to look up
- * @return the value associated with the given key
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method.
- */
- WPI_DEPRECATED(
- "Raises an exception if key not found; "
- "use GetBoolean(StringRef key, bool defaultValue) instead")
- virtual bool GetBoolean(llvm::StringRef key) const = 0;
-
- /**
- * Gets the boolean associated with the given name. If the key does not
- * exist or is of different type, it will return the default value.
- *
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- */
- virtual bool GetBoolean(llvm::StringRef key, bool defaultValue) const = 0;
-
- /**
- * Put a boolean array in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- *
- * @note The array must be of int's rather than of bool's because
- * std::vector<bool> is special-cased in C++. 0 is false, any
- * non-zero value is true.
- */
- virtual bool PutBooleanArray(llvm::StringRef key,
- llvm::ArrayRef<int> value) = 0;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultBooleanArray(llvm::StringRef key,
- llvm::ArrayRef<int> defaultValue) = 0;
-
- /**
- * Returns the boolean array the key maps to. If the key does not exist or is
- * of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- *
- * @note This makes a copy of the array. If the overhead of this is a
- * concern, use GetValue() instead.
- *
- * @note The returned array is std::vector<int> instead of std::vector<bool>
- * because std::vector<bool> is special-cased in C++. 0 is false, any
- * non-zero value is true.
- */
- virtual std::vector<int> GetBooleanArray(
- llvm::StringRef key, llvm::ArrayRef<int> defaultValue) const = 0;
-
- /**
- * Put a number array in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- virtual bool PutNumberArray(llvm::StringRef key,
- llvm::ArrayRef<double> value) = 0;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultNumberArray(llvm::StringRef key,
- llvm::ArrayRef<double> defaultValue) = 0;
-
- /**
- * Returns the number array the key maps to. If the key does not exist or is
- * of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- *
- * @note This makes a copy of the array. If the overhead of this is a
- * concern, use GetValue() instead.
- */
- virtual std::vector<double> GetNumberArray(
- llvm::StringRef key, llvm::ArrayRef<double> defaultValue) const = 0;
-
- /**
- * Put a string array in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- virtual bool PutStringArray(llvm::StringRef key,
- llvm::ArrayRef<std::string> value) = 0;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultStringArray(
- llvm::StringRef key, llvm::ArrayRef<std::string> defaultValue) = 0;
-
- /**
- * Returns the string array the key maps to. If the key does not exist or is
- * of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- *
- * @note This makes a copy of the array. If the overhead of this is a
- * concern, use GetValue() instead.
- */
- virtual std::vector<std::string> GetStringArray(
- llvm::StringRef key, llvm::ArrayRef<std::string> defaultValue) const = 0;
-
- /**
- * Put a raw value (byte array) in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- virtual bool PutRaw(llvm::StringRef key, llvm::StringRef value) = 0;
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doesn't exist.
- * @returns False if the table key exists with a different type
- */
- virtual bool SetDefaultRaw(llvm::StringRef key,
- llvm::StringRef defaultValue) = 0;
-
- /**
- * Returns the raw value (byte array) the key maps to. If the key does not
- * exist or is of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- *
- * @note This makes a copy of the raw contents. If the overhead of this is a
- * concern, use GetValue() instead.
- */
- virtual std::string GetRaw(llvm::StringRef key,
- llvm::StringRef defaultValue) const = 0;
-
- /**
- * Add a listener for changes to the table
- *
- * @param listener the listener to add
- */
- virtual void AddTableListener(ITableListener* listener) = 0;
-
- /**
- * Add a listener for changes to the table
- *
- * @param listener the listener to add
- * @param immediateNotify if true then this listener will be notified of all
- * current entries (marked as new)
- */
- virtual void AddTableListener(ITableListener* listener,
- bool immediateNotify) = 0;
-
- /**
- * Add a listener for changes to the table
- *
- * @param listener the listener to add
- * @param immediateNotify if true then this listener will be notified of all
- * current entries (marked as new)
- * @param flags bitmask of NT_NotifyKind specifying desired notifications
- */
- virtual void AddTableListenerEx(ITableListener* listener,
- unsigned int flags) = 0;
-
- /**
- * Add a listener for changes to a specific key the table
- *
- * @param key the key to listen for
- * @param listener the listener to add
- * @param immediateNotify if true then this listener will be notified of all
- * current entries (marked as new)
- */
- virtual void AddTableListener(llvm::StringRef key, ITableListener* listener,
- bool immediateNotify) = 0;
-
- /**
- * Add a listener for changes to a specific key the table
- *
- * @param key the key to listen for
- * @param listener the listener to add
- * @param immediateNotify if true then this listener will be notified of all
- * current entries (marked as new)
- * @param flags bitmask of NT_NotifyKind specifying desired notifications
- */
- virtual void AddTableListenerEx(llvm::StringRef key, ITableListener* listener,
- unsigned int flags) = 0;
-
- /**
- * This will immediately notify the listener of all current sub tables
- * @param listener the listener to add
- */
- virtual void AddSubTableListener(ITableListener* listener) = 0;
-
- /**
- * This will immediately notify the listener of all current sub tables
- * @param listener the listener to add
- * @param localNotify if true then this listener will be notified of all
- * local changes in addition to all remote changes
- */
- virtual void AddSubTableListener(ITableListener* listener,
- bool localNotify) = 0;
-
- /**
- * Remove a listener from receiving table events
- *
- * @param listener the listener to be removed
- */
- virtual void RemoveTableListener(ITableListener* listener) = 0;
-};
-
-#endif // ITABLE_H_
diff --git a/third_party/ntcore_2017/include/tables/ITableListener.h b/third_party/ntcore_2017/include/tables/ITableListener.h
deleted file mode 100644
index 76e0715..0000000
--- a/third_party/ntcore_2017/include/tables/ITableListener.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * ITableListener.h
- */
-
-#ifndef ITABLELISTENER_H_
-#define ITABLELISTENER_H_
-
-#include <memory>
-
-#include "llvm/StringRef.h"
-#include "nt_Value.h"
-
-class ITable;
-
-/**
- * A listener that listens to changes in values in a {@link ITable}
- */
-class ITableListener {
- public:
- virtual ~ITableListener() = default;
- /**
- * Called when a key-value pair is changed in a {@link ITable}
- * @param source the table the key-value pair exists in
- * @param key the key associated with the value that changed
- * @param value the new value
- * @param isNew true if the key did not previously exist in the table,
- * otherwise it is false
- */
- virtual void ValueChanged(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value, bool isNew) = 0;
-
- /**
- * Extended version of ValueChanged. Called when a key-value pair is
- * changed in a {@link ITable}. The default implementation simply calls
- * ValueChanged(). If this is overridden, ValueChanged() will not be called.
- * @param source the table the key-value pair exists in
- * @param key the key associated with the value that changed
- * @param value the new value
- * @param flags update flags; for example, NT_NOTIFY_NEW if the key did not
- * previously exist in the table
- */
- virtual void ValueChangedEx(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value,
- unsigned int flags);
-};
-
-#endif /* ITABLELISTENER_H_ */
diff --git a/third_party/ntcore_2017/include/tables/TableKeyNotDefinedException.h b/third_party/ntcore_2017/include/tables/TableKeyNotDefinedException.h
deleted file mode 100644
index d65bcf2..0000000
--- a/third_party/ntcore_2017/include/tables/TableKeyNotDefinedException.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef TABLEKEYNOTDEFINEDEXCEPTION_H_
-#define TABLEKEYNOTDEFINEDEXCEPTION_H_
-
-#include <exception>
-#include "llvm/StringRef.h"
-
-#if defined(_MSC_VER)
-#define NT_NOEXCEPT throw()
-#else
-#define NT_NOEXCEPT noexcept
-#endif
-
-/**
- * An exception thrown when the lookup a a key-value fails in a {@link ITable}
- */
-class TableKeyNotDefinedException : public std::exception {
- public:
- /**
- * @param key the key that was not defined in the table
- */
- TableKeyNotDefinedException(llvm::StringRef key);
- ~TableKeyNotDefinedException() NT_NOEXCEPT;
- const char* what() const NT_NOEXCEPT override;
-
- private:
- std::string msg;
-};
-
-#endif // TABLEKEYNOTDEFINEDEXCEPTION_H_
diff --git a/third_party/ntcore_2017/java/arm-linux/LICENSE b/third_party/ntcore_2017/java/arm-linux/LICENSE
deleted file mode 100644
index b40a0f4..0000000
--- a/third_party/ntcore_2017/java/arm-linux/LICENSE
+++ /dev/null
@@ -1,347 +0,0 @@
-The GNU General Public License (GPL)
-
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Everyone is permitted to copy and distribute verbatim copies of this license
-document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your freedom to share
-and change it. By contrast, the GNU General Public License is intended to
-guarantee your freedom to share and change free software--to make sure the
-software is free for all its users. This General Public License applies to
-most of the Free Software Foundation's software and to any other program whose
-authors commit to using it. (Some other Free Software Foundation software is
-covered by the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not price. Our
-General Public Licenses are designed to make sure that you have the freedom to
-distribute copies of free software (and charge for this service if you wish),
-that you receive source code or can get it if you want it, that you can change
-the software or use pieces of it in new free programs; and that you know you
-can do these things.
-
-To protect your rights, we need to make restrictions that forbid anyone to deny
-you these rights or to ask you to surrender the rights. These restrictions
-translate to certain responsibilities for you if you distribute copies of the
-software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether gratis or for
-a fee, you must give the recipients all the rights that you have. You must
-make sure that they, too, receive or can get the source code. And you must
-show them these terms so they know their rights.
-
-We protect your rights with two steps: (1) copyright the software, and (2)
-offer you this license which gives you legal permission to copy, distribute
-and/or modify the software.
-
-Also, for each author's protection and ours, we want to make certain that
-everyone understands that there is no warranty for this free software. If the
-software is modified by someone else and passed on, we want its recipients to
-know that what they have is not the original, so that any problems introduced
-by others will not reflect on the original authors' reputations.
-
-Finally, any free program is threatened constantly by software patents. We
-wish to avoid the danger that redistributors of a free program will
-individually obtain patent licenses, in effect making the program proprietary.
-To prevent this, we have made it clear that any patent must be licensed for
-everyone's free use or not licensed at all.
-
-The precise terms and conditions for copying, distribution and modification
-follow.
-
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains a notice
-placed by the copyright holder saying it may be distributed under the terms of
-this General Public License. The "Program", below, refers to any such program
-or work, and a "work based on the Program" means either the Program or any
-derivative work under copyright law: that is to say, a work containing the
-Program or a portion of it, either verbatim or with modifications and/or
-translated into another language. (Hereinafter, translation is included
-without limitation in the term "modification".) Each licensee is addressed as
-"you".
-
-Activities other than copying, distribution and modification are not covered by
-this License; they are outside its scope. The act of running the Program is
-not restricted, and the output from the Program is covered only if its contents
-constitute a work based on the Program (independent of having been made by
-running the Program). Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's source code as
-you receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice and
-disclaimer of warranty; keep intact all the notices that refer to this License
-and to the absence of any warranty; and give any other recipients of the
-Program a copy of this License along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and you may
-at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion of it, thus
-forming a work based on the Program, and copy and distribute such modifications
-or work under the terms of Section 1 above, provided that you also meet all of
-these conditions:
-
- a) You must cause the modified files to carry prominent notices stating
- that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in whole or
- in part contains or is derived from the Program or any part thereof, to be
- licensed as a whole at no charge to all third parties under the terms of
- this License.
-
- c) If the modified program normally reads commands interactively when run,
- you must cause it, when started running for such interactive use in the
- most ordinary way, to print or display an announcement including an
- appropriate copyright notice and a notice that there is no warranty (or
- else, saying that you provide a warranty) and that users may redistribute
- the program under these conditions, and telling the user how to view a copy
- of this License. (Exception: if the Program itself is interactive but does
- not normally print such an announcement, your work based on the Program is
- not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If identifiable
-sections of that work are not derived from the Program, and can be reasonably
-considered independent and separate works in themselves, then this License, and
-its terms, do not apply to those sections when you distribute them as separate
-works. But when you distribute the same sections as part of a whole which is a
-work based on the Program, the distribution of the whole must be on the terms
-of this License, whose permissions for other licensees extend to the entire
-whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest your
-rights to work written entirely by you; rather, the intent is to exercise the
-right to control the distribution of derivative or collective works based on
-the Program.
-
-In addition, mere aggregation of another work not based on the Program with the
-Program (or with a work based on the Program) on a volume of a storage or
-distribution medium does not bring the other work under the scope of this
-License.
-
-3. You may copy and distribute the Program (or a work based on it, under
-Section 2) in object code or executable form under the terms of Sections 1 and
-2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable source
- code, which must be distributed under the terms of Sections 1 and 2 above
- on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three years, to
- give any third party, for a charge no more than your cost of physically
- performing source distribution, a complete machine-readable copy of the
- corresponding source code, to be distributed under the terms of Sections 1
- and 2 above on a medium customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer to
- distribute corresponding source code. (This alternative is allowed only
- for noncommercial distribution and only if you received the program in
- object code or executable form with such an offer, in accord with
- Subsection b above.)
-
-The source code for a work means the preferred form of the work for making
-modifications to it. For an executable work, complete source code means all
-the source code for all modules it contains, plus any associated interface
-definition files, plus the scripts used to control compilation and installation
-of the executable. However, as a special exception, the source code
-distributed need not include anything that is normally distributed (in either
-source or binary form) with the major components (compiler, kernel, and so on)
-of the operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the source
-code from the same place counts as distribution of the source code, even though
-third parties are not compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program except as
-expressly provided under this License. Any attempt otherwise to copy, modify,
-sublicense or distribute the Program is void, and will automatically terminate
-your rights under this License. However, parties who have received copies, or
-rights, from you under this License will not have their licenses terminated so
-long as such parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not signed it.
-However, nothing else grants you permission to modify or distribute the Program
-or its derivative works. These actions are prohibited by law if you do not
-accept this License. Therefore, by modifying or distributing the Program (or
-any work based on the Program), you indicate your acceptance of this License to
-do so, and all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the Program),
-the recipient automatically receives a license from the original licensor to
-copy, distribute or modify the Program subject to these terms and conditions.
-You may not impose any further restrictions on the recipients' exercise of the
-rights granted herein. You are not responsible for enforcing compliance by
-third parties to this License.
-
-7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues), conditions
-are imposed on you (whether by court order, agreement or otherwise) that
-contradict the conditions of this License, they do not excuse you from the
-conditions of this License. If you cannot distribute so as to satisfy
-simultaneously your obligations under this License and any other pertinent
-obligations, then as a consequence you may not distribute the Program at all.
-For example, if a patent license would not permit royalty-free redistribution
-of the Program by all those who receive copies directly or indirectly through
-you, then the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply and
-the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any patents or
-other property right claims or to contest validity of any such claims; this
-section has the sole purpose of protecting the integrity of the free software
-distribution system, which is implemented by public license practices. Many
-people have made generous contributions to the wide range of software
-distributed through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing to
-distribute software through any other system and a licensee cannot impose that
-choice.
-
-This section is intended to make thoroughly clear what is believed to be a
-consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in certain
-countries either by patents or by copyrighted interfaces, the original
-copyright holder who places the Program under this License may add an explicit
-geographical distribution limitation excluding those countries, so that
-distribution is permitted only in or among countries not thus excluded. In
-such case, this License incorporates the limitation as if written in the body
-of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions of the
-General Public License from time to time. Such new versions will be similar in
-spirit to the present version, but may differ in detail to address new problems
-or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any later
-version", you have the option of following the terms and conditions either of
-that version or of any later version published by the Free Software Foundation.
-If the Program does not specify a version number of this License, you may
-choose any version ever published by the Free Software Foundation.
-
-10. If you wish to incorporate parts of the Program into other free programs
-whose distribution conditions are different, write to the author to ask for
-permission. For software which is copyrighted by the Free Software Foundation,
-write to the Free Software Foundation; we sometimes make exceptions for this.
-Our decision will be guided by the two goals of preserving the free status of
-all derivatives of our free software and of promoting the sharing and reuse of
-software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
-THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
-STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
-PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
-PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
-YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
-ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
-PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
-INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
-BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
-OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-END OF TERMS AND CONDITIONS
-
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest possible
-use to the public, the best way to achieve this is to make it free software
-which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest to attach
-them to the start of each source file to most effectively convey the exclusion
-of warranty; and each file should have at least the "copyright" line and a
-pointer to where the full notice is found.
-
- One line to give the program's name and a brief idea of what it does.
-
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc., 59
- Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this when it
-starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
- with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free
- software, and you are welcome to redistribute it under certain conditions;
- type 'show c' for details.
-
-The hypothetical commands 'show w' and 'show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may be
-called something other than 'show w' and 'show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your school,
-if any, to sign a "copyright disclaimer" for the program, if necessary. Here
-is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- 'Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- signature of Ty Coon, 1 April 1989
-
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General Public
-License instead of this License.
-
-
-"CLASSPATH" EXCEPTION TO THE GPL
-
-Certain source files distributed by Oracle America and/or its affiliates are
-subject to the following clarification and special exception to the GPL, but
-only where Oracle has expressly included in the particular source file's header
-the words "Oracle designates this particular file as subject to the "Classpath"
-exception as provided by Oracle in the LICENSE file that accompanied this code."
-
- Linking this library statically or dynamically with other modules is making
- a combined work based on this library. Thus, the terms and conditions of
- the GNU General Public License cover the whole combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent modules,
- and to copy and distribute the resulting executable under terms of your
- choice, provided that you also meet, for each linked independent module,
- the terms and conditions of the license of that module. An independent
- module is a module which is not derived from or based on this library. If
- you modify this library, you may extend this exception to your version of
- the library, but you are not obligated to do so. If you do not wish to do
- so, delete this exception statement from your version.
diff --git a/third_party/ntcore_2017/java/arm-linux/jni.h b/third_party/ntcore_2017/java/arm-linux/jni.h
deleted file mode 100644
index 2e83cb7..0000000
--- a/third_party/ntcore_2017/java/arm-linux/jni.h
+++ /dev/null
@@ -1,1960 +0,0 @@
-/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * We used part of Netscape's Java Runtime Interface (JRI) as the starting
- * point of our design and implementation.
- */
-
-/******************************************************************************
- * Java Runtime Interface
- * Copyright (c) 1996 Netscape Communications Corporation. All rights reserved.
- *****************************************************************************/
-
-#ifndef _JAVASOFT_JNI_H_
-#define _JAVASOFT_JNI_H_
-
-#include <stdio.h>
-#include <stdarg.h>
-
-/* jni_md.h contains the machine-dependent typedefs for jbyte, jint
- and jlong */
-
-#include "jni_md.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * JNI Types
- */
-
-#ifndef JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H
-
-typedef unsigned char jboolean;
-typedef unsigned short jchar;
-typedef short jshort;
-typedef float jfloat;
-typedef double jdouble;
-
-typedef jint jsize;
-
-#ifdef __cplusplus
-
-class _jobject {};
-class _jclass : public _jobject {};
-class _jthrowable : public _jobject {};
-class _jstring : public _jobject {};
-class _jarray : public _jobject {};
-class _jbooleanArray : public _jarray {};
-class _jbyteArray : public _jarray {};
-class _jcharArray : public _jarray {};
-class _jshortArray : public _jarray {};
-class _jintArray : public _jarray {};
-class _jlongArray : public _jarray {};
-class _jfloatArray : public _jarray {};
-class _jdoubleArray : public _jarray {};
-class _jobjectArray : public _jarray {};
-
-typedef _jobject *jobject;
-typedef _jclass *jclass;
-typedef _jthrowable *jthrowable;
-typedef _jstring *jstring;
-typedef _jarray *jarray;
-typedef _jbooleanArray *jbooleanArray;
-typedef _jbyteArray *jbyteArray;
-typedef _jcharArray *jcharArray;
-typedef _jshortArray *jshortArray;
-typedef _jintArray *jintArray;
-typedef _jlongArray *jlongArray;
-typedef _jfloatArray *jfloatArray;
-typedef _jdoubleArray *jdoubleArray;
-typedef _jobjectArray *jobjectArray;
-
-#else
-
-struct _jobject;
-
-typedef struct _jobject *jobject;
-typedef jobject jclass;
-typedef jobject jthrowable;
-typedef jobject jstring;
-typedef jobject jarray;
-typedef jarray jbooleanArray;
-typedef jarray jbyteArray;
-typedef jarray jcharArray;
-typedef jarray jshortArray;
-typedef jarray jintArray;
-typedef jarray jlongArray;
-typedef jarray jfloatArray;
-typedef jarray jdoubleArray;
-typedef jarray jobjectArray;
-
-#endif
-
-typedef jobject jweak;
-
-typedef union jvalue {
- jboolean z;
- jbyte b;
- jchar c;
- jshort s;
- jint i;
- jlong j;
- jfloat f;
- jdouble d;
- jobject l;
-} jvalue;
-
-struct _jfieldID;
-typedef struct _jfieldID *jfieldID;
-
-struct _jmethodID;
-typedef struct _jmethodID *jmethodID;
-
-/* Return values from jobjectRefType */
-typedef enum _jobjectType {
- JNIInvalidRefType = 0,
- JNILocalRefType = 1,
- JNIGlobalRefType = 2,
- JNIWeakGlobalRefType = 3
-} jobjectRefType;
-
-
-#endif /* JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H */
-
-/*
- * jboolean constants
- */
-
-#define JNI_FALSE 0
-#define JNI_TRUE 1
-
-/*
- * possible return values for JNI functions.
- */
-
-#define JNI_OK 0 /* success */
-#define JNI_ERR (-1) /* unknown error */
-#define JNI_EDETACHED (-2) /* thread detached from the VM */
-#define JNI_EVERSION (-3) /* JNI version error */
-#define JNI_ENOMEM (-4) /* not enough memory */
-#define JNI_EEXIST (-5) /* VM already created */
-#define JNI_EINVAL (-6) /* invalid arguments */
-
-/*
- * used in ReleaseScalarArrayElements
- */
-
-#define JNI_COMMIT 1
-#define JNI_ABORT 2
-
-/*
- * used in RegisterNatives to describe native method name, signature,
- * and function pointer.
- */
-
-typedef struct {
- char *name;
- char *signature;
- void *fnPtr;
-} JNINativeMethod;
-
-/*
- * JNI Native Method Interface.
- */
-
-struct JNINativeInterface_;
-
-struct JNIEnv_;
-
-#ifdef __cplusplus
-typedef JNIEnv_ JNIEnv;
-#else
-typedef const struct JNINativeInterface_ *JNIEnv;
-#endif
-
-/*
- * JNI Invocation Interface.
- */
-
-struct JNIInvokeInterface_;
-
-struct JavaVM_;
-
-#ifdef __cplusplus
-typedef JavaVM_ JavaVM;
-#else
-typedef const struct JNIInvokeInterface_ *JavaVM;
-#endif
-
-struct JNINativeInterface_ {
- void *reserved0;
- void *reserved1;
- void *reserved2;
-
- void *reserved3;
- jint (JNICALL *GetVersion)(JNIEnv *env);
-
- jclass (JNICALL *DefineClass)
- (JNIEnv *env, const char *name, jobject loader, const jbyte *buf,
- jsize len);
- jclass (JNICALL *FindClass)
- (JNIEnv *env, const char *name);
-
- jmethodID (JNICALL *FromReflectedMethod)
- (JNIEnv *env, jobject method);
- jfieldID (JNICALL *FromReflectedField)
- (JNIEnv *env, jobject field);
-
- jobject (JNICALL *ToReflectedMethod)
- (JNIEnv *env, jclass cls, jmethodID methodID, jboolean isStatic);
-
- jclass (JNICALL *GetSuperclass)
- (JNIEnv *env, jclass sub);
- jboolean (JNICALL *IsAssignableFrom)
- (JNIEnv *env, jclass sub, jclass sup);
-
- jobject (JNICALL *ToReflectedField)
- (JNIEnv *env, jclass cls, jfieldID fieldID, jboolean isStatic);
-
- jint (JNICALL *Throw)
- (JNIEnv *env, jthrowable obj);
- jint (JNICALL *ThrowNew)
- (JNIEnv *env, jclass clazz, const char *msg);
- jthrowable (JNICALL *ExceptionOccurred)
- (JNIEnv *env);
- void (JNICALL *ExceptionDescribe)
- (JNIEnv *env);
- void (JNICALL *ExceptionClear)
- (JNIEnv *env);
- void (JNICALL *FatalError)
- (JNIEnv *env, const char *msg);
-
- jint (JNICALL *PushLocalFrame)
- (JNIEnv *env, jint capacity);
- jobject (JNICALL *PopLocalFrame)
- (JNIEnv *env, jobject result);
-
- jobject (JNICALL *NewGlobalRef)
- (JNIEnv *env, jobject lobj);
- void (JNICALL *DeleteGlobalRef)
- (JNIEnv *env, jobject gref);
- void (JNICALL *DeleteLocalRef)
- (JNIEnv *env, jobject obj);
- jboolean (JNICALL *IsSameObject)
- (JNIEnv *env, jobject obj1, jobject obj2);
- jobject (JNICALL *NewLocalRef)
- (JNIEnv *env, jobject ref);
- jint (JNICALL *EnsureLocalCapacity)
- (JNIEnv *env, jint capacity);
-
- jobject (JNICALL *AllocObject)
- (JNIEnv *env, jclass clazz);
- jobject (JNICALL *NewObject)
- (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
- jobject (JNICALL *NewObjectV)
- (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
- jobject (JNICALL *NewObjectA)
- (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
-
- jclass (JNICALL *GetObjectClass)
- (JNIEnv *env, jobject obj);
- jboolean (JNICALL *IsInstanceOf)
- (JNIEnv *env, jobject obj, jclass clazz);
-
- jmethodID (JNICALL *GetMethodID)
- (JNIEnv *env, jclass clazz, const char *name, const char *sig);
-
- jobject (JNICALL *CallObjectMethod)
- (JNIEnv *env, jobject obj, jmethodID methodID, ...);
- jobject (JNICALL *CallObjectMethodV)
- (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
- jobject (JNICALL *CallObjectMethodA)
- (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
-
- jboolean (JNICALL *CallBooleanMethod)
- (JNIEnv *env, jobject obj, jmethodID methodID, ...);
- jboolean (JNICALL *CallBooleanMethodV)
- (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
- jboolean (JNICALL *CallBooleanMethodA)
- (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
-
- jbyte (JNICALL *CallByteMethod)
- (JNIEnv *env, jobject obj, jmethodID methodID, ...);
- jbyte (JNICALL *CallByteMethodV)
- (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
- jbyte (JNICALL *CallByteMethodA)
- (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
-
- jchar (JNICALL *CallCharMethod)
- (JNIEnv *env, jobject obj, jmethodID methodID, ...);
- jchar (JNICALL *CallCharMethodV)
- (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
- jchar (JNICALL *CallCharMethodA)
- (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
-
- jshort (JNICALL *CallShortMethod)
- (JNIEnv *env, jobject obj, jmethodID methodID, ...);
- jshort (JNICALL *CallShortMethodV)
- (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
- jshort (JNICALL *CallShortMethodA)
- (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
-
- jint (JNICALL *CallIntMethod)
- (JNIEnv *env, jobject obj, jmethodID methodID, ...);
- jint (JNICALL *CallIntMethodV)
- (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
- jint (JNICALL *CallIntMethodA)
- (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
-
- jlong (JNICALL *CallLongMethod)
- (JNIEnv *env, jobject obj, jmethodID methodID, ...);
- jlong (JNICALL *CallLongMethodV)
- (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
- jlong (JNICALL *CallLongMethodA)
- (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
-
- jfloat (JNICALL *CallFloatMethod)
- (JNIEnv *env, jobject obj, jmethodID methodID, ...);
- jfloat (JNICALL *CallFloatMethodV)
- (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
- jfloat (JNICALL *CallFloatMethodA)
- (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
-
- jdouble (JNICALL *CallDoubleMethod)
- (JNIEnv *env, jobject obj, jmethodID methodID, ...);
- jdouble (JNICALL *CallDoubleMethodV)
- (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
- jdouble (JNICALL *CallDoubleMethodA)
- (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
-
- void (JNICALL *CallVoidMethod)
- (JNIEnv *env, jobject obj, jmethodID methodID, ...);
- void (JNICALL *CallVoidMethodV)
- (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
- void (JNICALL *CallVoidMethodA)
- (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
-
- jobject (JNICALL *CallNonvirtualObjectMethod)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
- jobject (JNICALL *CallNonvirtualObjectMethodV)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- va_list args);
- jobject (JNICALL *CallNonvirtualObjectMethodA)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- const jvalue * args);
-
- jboolean (JNICALL *CallNonvirtualBooleanMethod)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
- jboolean (JNICALL *CallNonvirtualBooleanMethodV)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- va_list args);
- jboolean (JNICALL *CallNonvirtualBooleanMethodA)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- const jvalue * args);
-
- jbyte (JNICALL *CallNonvirtualByteMethod)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
- jbyte (JNICALL *CallNonvirtualByteMethodV)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- va_list args);
- jbyte (JNICALL *CallNonvirtualByteMethodA)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- const jvalue *args);
-
- jchar (JNICALL *CallNonvirtualCharMethod)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
- jchar (JNICALL *CallNonvirtualCharMethodV)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- va_list args);
- jchar (JNICALL *CallNonvirtualCharMethodA)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- const jvalue *args);
-
- jshort (JNICALL *CallNonvirtualShortMethod)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
- jshort (JNICALL *CallNonvirtualShortMethodV)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- va_list args);
- jshort (JNICALL *CallNonvirtualShortMethodA)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- const jvalue *args);
-
- jint (JNICALL *CallNonvirtualIntMethod)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
- jint (JNICALL *CallNonvirtualIntMethodV)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- va_list args);
- jint (JNICALL *CallNonvirtualIntMethodA)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- const jvalue *args);
-
- jlong (JNICALL *CallNonvirtualLongMethod)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
- jlong (JNICALL *CallNonvirtualLongMethodV)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- va_list args);
- jlong (JNICALL *CallNonvirtualLongMethodA)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- const jvalue *args);
-
- jfloat (JNICALL *CallNonvirtualFloatMethod)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
- jfloat (JNICALL *CallNonvirtualFloatMethodV)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- va_list args);
- jfloat (JNICALL *CallNonvirtualFloatMethodA)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- const jvalue *args);
-
- jdouble (JNICALL *CallNonvirtualDoubleMethod)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
- jdouble (JNICALL *CallNonvirtualDoubleMethodV)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- va_list args);
- jdouble (JNICALL *CallNonvirtualDoubleMethodA)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- const jvalue *args);
-
- void (JNICALL *CallNonvirtualVoidMethod)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
- void (JNICALL *CallNonvirtualVoidMethodV)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- va_list args);
- void (JNICALL *CallNonvirtualVoidMethodA)
- (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
- const jvalue * args);
-
- jfieldID (JNICALL *GetFieldID)
- (JNIEnv *env, jclass clazz, const char *name, const char *sig);
-
- jobject (JNICALL *GetObjectField)
- (JNIEnv *env, jobject obj, jfieldID fieldID);
- jboolean (JNICALL *GetBooleanField)
- (JNIEnv *env, jobject obj, jfieldID fieldID);
- jbyte (JNICALL *GetByteField)
- (JNIEnv *env, jobject obj, jfieldID fieldID);
- jchar (JNICALL *GetCharField)
- (JNIEnv *env, jobject obj, jfieldID fieldID);
- jshort (JNICALL *GetShortField)
- (JNIEnv *env, jobject obj, jfieldID fieldID);
- jint (JNICALL *GetIntField)
- (JNIEnv *env, jobject obj, jfieldID fieldID);
- jlong (JNICALL *GetLongField)
- (JNIEnv *env, jobject obj, jfieldID fieldID);
- jfloat (JNICALL *GetFloatField)
- (JNIEnv *env, jobject obj, jfieldID fieldID);
- jdouble (JNICALL *GetDoubleField)
- (JNIEnv *env, jobject obj, jfieldID fieldID);
-
- void (JNICALL *SetObjectField)
- (JNIEnv *env, jobject obj, jfieldID fieldID, jobject val);
- void (JNICALL *SetBooleanField)
- (JNIEnv *env, jobject obj, jfieldID fieldID, jboolean val);
- void (JNICALL *SetByteField)
- (JNIEnv *env, jobject obj, jfieldID fieldID, jbyte val);
- void (JNICALL *SetCharField)
- (JNIEnv *env, jobject obj, jfieldID fieldID, jchar val);
- void (JNICALL *SetShortField)
- (JNIEnv *env, jobject obj, jfieldID fieldID, jshort val);
- void (JNICALL *SetIntField)
- (JNIEnv *env, jobject obj, jfieldID fieldID, jint val);
- void (JNICALL *SetLongField)
- (JNIEnv *env, jobject obj, jfieldID fieldID, jlong val);
- void (JNICALL *SetFloatField)
- (JNIEnv *env, jobject obj, jfieldID fieldID, jfloat val);
- void (JNICALL *SetDoubleField)
- (JNIEnv *env, jobject obj, jfieldID fieldID, jdouble val);
-
- jmethodID (JNICALL *GetStaticMethodID)
- (JNIEnv *env, jclass clazz, const char *name, const char *sig);
-
- jobject (JNICALL *CallStaticObjectMethod)
- (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
- jobject (JNICALL *CallStaticObjectMethodV)
- (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
- jobject (JNICALL *CallStaticObjectMethodA)
- (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
-
- jboolean (JNICALL *CallStaticBooleanMethod)
- (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
- jboolean (JNICALL *CallStaticBooleanMethodV)
- (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
- jboolean (JNICALL *CallStaticBooleanMethodA)
- (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
-
- jbyte (JNICALL *CallStaticByteMethod)
- (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
- jbyte (JNICALL *CallStaticByteMethodV)
- (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
- jbyte (JNICALL *CallStaticByteMethodA)
- (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
-
- jchar (JNICALL *CallStaticCharMethod)
- (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
- jchar (JNICALL *CallStaticCharMethodV)
- (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
- jchar (JNICALL *CallStaticCharMethodA)
- (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
-
- jshort (JNICALL *CallStaticShortMethod)
- (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
- jshort (JNICALL *CallStaticShortMethodV)
- (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
- jshort (JNICALL *CallStaticShortMethodA)
- (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
-
- jint (JNICALL *CallStaticIntMethod)
- (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
- jint (JNICALL *CallStaticIntMethodV)
- (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
- jint (JNICALL *CallStaticIntMethodA)
- (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
-
- jlong (JNICALL *CallStaticLongMethod)
- (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
- jlong (JNICALL *CallStaticLongMethodV)
- (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
- jlong (JNICALL *CallStaticLongMethodA)
- (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
-
- jfloat (JNICALL *CallStaticFloatMethod)
- (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
- jfloat (JNICALL *CallStaticFloatMethodV)
- (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
- jfloat (JNICALL *CallStaticFloatMethodA)
- (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
-
- jdouble (JNICALL *CallStaticDoubleMethod)
- (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
- jdouble (JNICALL *CallStaticDoubleMethodV)
- (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
- jdouble (JNICALL *CallStaticDoubleMethodA)
- (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
-
- void (JNICALL *CallStaticVoidMethod)
- (JNIEnv *env, jclass cls, jmethodID methodID, ...);
- void (JNICALL *CallStaticVoidMethodV)
- (JNIEnv *env, jclass cls, jmethodID methodID, va_list args);
- void (JNICALL *CallStaticVoidMethodA)
- (JNIEnv *env, jclass cls, jmethodID methodID, const jvalue * args);
-
- jfieldID (JNICALL *GetStaticFieldID)
- (JNIEnv *env, jclass clazz, const char *name, const char *sig);
- jobject (JNICALL *GetStaticObjectField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID);
- jboolean (JNICALL *GetStaticBooleanField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID);
- jbyte (JNICALL *GetStaticByteField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID);
- jchar (JNICALL *GetStaticCharField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID);
- jshort (JNICALL *GetStaticShortField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID);
- jint (JNICALL *GetStaticIntField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID);
- jlong (JNICALL *GetStaticLongField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID);
- jfloat (JNICALL *GetStaticFloatField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID);
- jdouble (JNICALL *GetStaticDoubleField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID);
-
- void (JNICALL *SetStaticObjectField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID, jobject value);
- void (JNICALL *SetStaticBooleanField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID, jboolean value);
- void (JNICALL *SetStaticByteField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID, jbyte value);
- void (JNICALL *SetStaticCharField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID, jchar value);
- void (JNICALL *SetStaticShortField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID, jshort value);
- void (JNICALL *SetStaticIntField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID, jint value);
- void (JNICALL *SetStaticLongField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID, jlong value);
- void (JNICALL *SetStaticFloatField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID, jfloat value);
- void (JNICALL *SetStaticDoubleField)
- (JNIEnv *env, jclass clazz, jfieldID fieldID, jdouble value);
-
- jstring (JNICALL *NewString)
- (JNIEnv *env, const jchar *unicode, jsize len);
- jsize (JNICALL *GetStringLength)
- (JNIEnv *env, jstring str);
- const jchar *(JNICALL *GetStringChars)
- (JNIEnv *env, jstring str, jboolean *isCopy);
- void (JNICALL *ReleaseStringChars)
- (JNIEnv *env, jstring str, const jchar *chars);
-
- jstring (JNICALL *NewStringUTF)
- (JNIEnv *env, const char *utf);
- jsize (JNICALL *GetStringUTFLength)
- (JNIEnv *env, jstring str);
- const char* (JNICALL *GetStringUTFChars)
- (JNIEnv *env, jstring str, jboolean *isCopy);
- void (JNICALL *ReleaseStringUTFChars)
- (JNIEnv *env, jstring str, const char* chars);
-
-
- jsize (JNICALL *GetArrayLength)
- (JNIEnv *env, jarray array);
-
- jobjectArray (JNICALL *NewObjectArray)
- (JNIEnv *env, jsize len, jclass clazz, jobject init);
- jobject (JNICALL *GetObjectArrayElement)
- (JNIEnv *env, jobjectArray array, jsize index);
- void (JNICALL *SetObjectArrayElement)
- (JNIEnv *env, jobjectArray array, jsize index, jobject val);
-
- jbooleanArray (JNICALL *NewBooleanArray)
- (JNIEnv *env, jsize len);
- jbyteArray (JNICALL *NewByteArray)
- (JNIEnv *env, jsize len);
- jcharArray (JNICALL *NewCharArray)
- (JNIEnv *env, jsize len);
- jshortArray (JNICALL *NewShortArray)
- (JNIEnv *env, jsize len);
- jintArray (JNICALL *NewIntArray)
- (JNIEnv *env, jsize len);
- jlongArray (JNICALL *NewLongArray)
- (JNIEnv *env, jsize len);
- jfloatArray (JNICALL *NewFloatArray)
- (JNIEnv *env, jsize len);
- jdoubleArray (JNICALL *NewDoubleArray)
- (JNIEnv *env, jsize len);
-
- jboolean * (JNICALL *GetBooleanArrayElements)
- (JNIEnv *env, jbooleanArray array, jboolean *isCopy);
- jbyte * (JNICALL *GetByteArrayElements)
- (JNIEnv *env, jbyteArray array, jboolean *isCopy);
- jchar * (JNICALL *GetCharArrayElements)
- (JNIEnv *env, jcharArray array, jboolean *isCopy);
- jshort * (JNICALL *GetShortArrayElements)
- (JNIEnv *env, jshortArray array, jboolean *isCopy);
- jint * (JNICALL *GetIntArrayElements)
- (JNIEnv *env, jintArray array, jboolean *isCopy);
- jlong * (JNICALL *GetLongArrayElements)
- (JNIEnv *env, jlongArray array, jboolean *isCopy);
- jfloat * (JNICALL *GetFloatArrayElements)
- (JNIEnv *env, jfloatArray array, jboolean *isCopy);
- jdouble * (JNICALL *GetDoubleArrayElements)
- (JNIEnv *env, jdoubleArray array, jboolean *isCopy);
-
- void (JNICALL *ReleaseBooleanArrayElements)
- (JNIEnv *env, jbooleanArray array, jboolean *elems, jint mode);
- void (JNICALL *ReleaseByteArrayElements)
- (JNIEnv *env, jbyteArray array, jbyte *elems, jint mode);
- void (JNICALL *ReleaseCharArrayElements)
- (JNIEnv *env, jcharArray array, jchar *elems, jint mode);
- void (JNICALL *ReleaseShortArrayElements)
- (JNIEnv *env, jshortArray array, jshort *elems, jint mode);
- void (JNICALL *ReleaseIntArrayElements)
- (JNIEnv *env, jintArray array, jint *elems, jint mode);
- void (JNICALL *ReleaseLongArrayElements)
- (JNIEnv *env, jlongArray array, jlong *elems, jint mode);
- void (JNICALL *ReleaseFloatArrayElements)
- (JNIEnv *env, jfloatArray array, jfloat *elems, jint mode);
- void (JNICALL *ReleaseDoubleArrayElements)
- (JNIEnv *env, jdoubleArray array, jdouble *elems, jint mode);
-
- void (JNICALL *GetBooleanArrayRegion)
- (JNIEnv *env, jbooleanArray array, jsize start, jsize l, jboolean *buf);
- void (JNICALL *GetByteArrayRegion)
- (JNIEnv *env, jbyteArray array, jsize start, jsize len, jbyte *buf);
- void (JNICALL *GetCharArrayRegion)
- (JNIEnv *env, jcharArray array, jsize start, jsize len, jchar *buf);
- void (JNICALL *GetShortArrayRegion)
- (JNIEnv *env, jshortArray array, jsize start, jsize len, jshort *buf);
- void (JNICALL *GetIntArrayRegion)
- (JNIEnv *env, jintArray array, jsize start, jsize len, jint *buf);
- void (JNICALL *GetLongArrayRegion)
- (JNIEnv *env, jlongArray array, jsize start, jsize len, jlong *buf);
- void (JNICALL *GetFloatArrayRegion)
- (JNIEnv *env, jfloatArray array, jsize start, jsize len, jfloat *buf);
- void (JNICALL *GetDoubleArrayRegion)
- (JNIEnv *env, jdoubleArray array, jsize start, jsize len, jdouble *buf);
-
- void (JNICALL *SetBooleanArrayRegion)
- (JNIEnv *env, jbooleanArray array, jsize start, jsize l, const jboolean *buf);
- void (JNICALL *SetByteArrayRegion)
- (JNIEnv *env, jbyteArray array, jsize start, jsize len, const jbyte *buf);
- void (JNICALL *SetCharArrayRegion)
- (JNIEnv *env, jcharArray array, jsize start, jsize len, const jchar *buf);
- void (JNICALL *SetShortArrayRegion)
- (JNIEnv *env, jshortArray array, jsize start, jsize len, const jshort *buf);
- void (JNICALL *SetIntArrayRegion)
- (JNIEnv *env, jintArray array, jsize start, jsize len, const jint *buf);
- void (JNICALL *SetLongArrayRegion)
- (JNIEnv *env, jlongArray array, jsize start, jsize len, const jlong *buf);
- void (JNICALL *SetFloatArrayRegion)
- (JNIEnv *env, jfloatArray array, jsize start, jsize len, const jfloat *buf);
- void (JNICALL *SetDoubleArrayRegion)
- (JNIEnv *env, jdoubleArray array, jsize start, jsize len, const jdouble *buf);
-
- jint (JNICALL *RegisterNatives)
- (JNIEnv *env, jclass clazz, const JNINativeMethod *methods,
- jint nMethods);
- jint (JNICALL *UnregisterNatives)
- (JNIEnv *env, jclass clazz);
-
- jint (JNICALL *MonitorEnter)
- (JNIEnv *env, jobject obj);
- jint (JNICALL *MonitorExit)
- (JNIEnv *env, jobject obj);
-
- jint (JNICALL *GetJavaVM)
- (JNIEnv *env, JavaVM **vm);
-
- void (JNICALL *GetStringRegion)
- (JNIEnv *env, jstring str, jsize start, jsize len, jchar *buf);
- void (JNICALL *GetStringUTFRegion)
- (JNIEnv *env, jstring str, jsize start, jsize len, char *buf);
-
- void * (JNICALL *GetPrimitiveArrayCritical)
- (JNIEnv *env, jarray array, jboolean *isCopy);
- void (JNICALL *ReleasePrimitiveArrayCritical)
- (JNIEnv *env, jarray array, void *carray, jint mode);
-
- const jchar * (JNICALL *GetStringCritical)
- (JNIEnv *env, jstring string, jboolean *isCopy);
- void (JNICALL *ReleaseStringCritical)
- (JNIEnv *env, jstring string, const jchar *cstring);
-
- jweak (JNICALL *NewWeakGlobalRef)
- (JNIEnv *env, jobject obj);
- void (JNICALL *DeleteWeakGlobalRef)
- (JNIEnv *env, jweak ref);
-
- jboolean (JNICALL *ExceptionCheck)
- (JNIEnv *env);
-
- jobject (JNICALL *NewDirectByteBuffer)
- (JNIEnv* env, void* address, jlong capacity);
- void* (JNICALL *GetDirectBufferAddress)
- (JNIEnv* env, jobject buf);
- jlong (JNICALL *GetDirectBufferCapacity)
- (JNIEnv* env, jobject buf);
-
- /* New JNI 1.6 Features */
-
- jobjectRefType (JNICALL *GetObjectRefType)
- (JNIEnv* env, jobject obj);
-};
-
-/*
- * We use inlined functions for C++ so that programmers can write:
- *
- * env->FindClass("java/lang/String")
- *
- * in C++ rather than:
- *
- * (*env)->FindClass(env, "java/lang/String")
- *
- * in C.
- */
-
-struct JNIEnv_ {
- const struct JNINativeInterface_ *functions;
-#ifdef __cplusplus
-
- jint GetVersion() {
- return functions->GetVersion(this);
- }
- jclass DefineClass(const char *name, jobject loader, const jbyte *buf,
- jsize len) {
- return functions->DefineClass(this, name, loader, buf, len);
- }
- jclass FindClass(const char *name) {
- return functions->FindClass(this, name);
- }
- jmethodID FromReflectedMethod(jobject method) {
- return functions->FromReflectedMethod(this,method);
- }
- jfieldID FromReflectedField(jobject field) {
- return functions->FromReflectedField(this,field);
- }
-
- jobject ToReflectedMethod(jclass cls, jmethodID methodID, jboolean isStatic) {
- return functions->ToReflectedMethod(this, cls, methodID, isStatic);
- }
-
- jclass GetSuperclass(jclass sub) {
- return functions->GetSuperclass(this, sub);
- }
- jboolean IsAssignableFrom(jclass sub, jclass sup) {
- return functions->IsAssignableFrom(this, sub, sup);
- }
-
- jobject ToReflectedField(jclass cls, jfieldID fieldID, jboolean isStatic) {
- return functions->ToReflectedField(this,cls,fieldID,isStatic);
- }
-
- jint Throw(jthrowable obj) {
- return functions->Throw(this, obj);
- }
- jint ThrowNew(jclass clazz, const char *msg) {
- return functions->ThrowNew(this, clazz, msg);
- }
- jthrowable ExceptionOccurred() {
- return functions->ExceptionOccurred(this);
- }
- void ExceptionDescribe() {
- functions->ExceptionDescribe(this);
- }
- void ExceptionClear() {
- functions->ExceptionClear(this);
- }
- void FatalError(const char *msg) {
- functions->FatalError(this, msg);
- }
-
- jint PushLocalFrame(jint capacity) {
- return functions->PushLocalFrame(this,capacity);
- }
- jobject PopLocalFrame(jobject result) {
- return functions->PopLocalFrame(this,result);
- }
-
- jobject NewGlobalRef(jobject lobj) {
- return functions->NewGlobalRef(this,lobj);
- }
- void DeleteGlobalRef(jobject gref) {
- functions->DeleteGlobalRef(this,gref);
- }
- void DeleteLocalRef(jobject obj) {
- functions->DeleteLocalRef(this, obj);
- }
-
- jboolean IsSameObject(jobject obj1, jobject obj2) {
- return functions->IsSameObject(this,obj1,obj2);
- }
-
- jobject NewLocalRef(jobject ref) {
- return functions->NewLocalRef(this,ref);
- }
- jint EnsureLocalCapacity(jint capacity) {
- return functions->EnsureLocalCapacity(this,capacity);
- }
-
- jobject AllocObject(jclass clazz) {
- return functions->AllocObject(this,clazz);
- }
- jobject NewObject(jclass clazz, jmethodID methodID, ...) {
- va_list args;
- jobject result;
- va_start(args, methodID);
- result = functions->NewObjectV(this,clazz,methodID,args);
- va_end(args);
- return result;
- }
- jobject NewObjectV(jclass clazz, jmethodID methodID,
- va_list args) {
- return functions->NewObjectV(this,clazz,methodID,args);
- }
- jobject NewObjectA(jclass clazz, jmethodID methodID,
- const jvalue *args) {
- return functions->NewObjectA(this,clazz,methodID,args);
- }
-
- jclass GetObjectClass(jobject obj) {
- return functions->GetObjectClass(this,obj);
- }
- jboolean IsInstanceOf(jobject obj, jclass clazz) {
- return functions->IsInstanceOf(this,obj,clazz);
- }
-
- jmethodID GetMethodID(jclass clazz, const char *name,
- const char *sig) {
- return functions->GetMethodID(this,clazz,name,sig);
- }
-
- jobject CallObjectMethod(jobject obj, jmethodID methodID, ...) {
- va_list args;
- jobject result;
- va_start(args,methodID);
- result = functions->CallObjectMethodV(this,obj,methodID,args);
- va_end(args);
- return result;
- }
- jobject CallObjectMethodV(jobject obj, jmethodID methodID,
- va_list args) {
- return functions->CallObjectMethodV(this,obj,methodID,args);
- }
- jobject CallObjectMethodA(jobject obj, jmethodID methodID,
- const jvalue * args) {
- return functions->CallObjectMethodA(this,obj,methodID,args);
- }
-
- jboolean CallBooleanMethod(jobject obj,
- jmethodID methodID, ...) {
- va_list args;
- jboolean result;
- va_start(args,methodID);
- result = functions->CallBooleanMethodV(this,obj,methodID,args);
- va_end(args);
- return result;
- }
- jboolean CallBooleanMethodV(jobject obj, jmethodID methodID,
- va_list args) {
- return functions->CallBooleanMethodV(this,obj,methodID,args);
- }
- jboolean CallBooleanMethodA(jobject obj, jmethodID methodID,
- const jvalue * args) {
- return functions->CallBooleanMethodA(this,obj,methodID, args);
- }
-
- jbyte CallByteMethod(jobject obj, jmethodID methodID, ...) {
- va_list args;
- jbyte result;
- va_start(args,methodID);
- result = functions->CallByteMethodV(this,obj,methodID,args);
- va_end(args);
- return result;
- }
- jbyte CallByteMethodV(jobject obj, jmethodID methodID,
- va_list args) {
- return functions->CallByteMethodV(this,obj,methodID,args);
- }
- jbyte CallByteMethodA(jobject obj, jmethodID methodID,
- const jvalue * args) {
- return functions->CallByteMethodA(this,obj,methodID,args);
- }
-
- jchar CallCharMethod(jobject obj, jmethodID methodID, ...) {
- va_list args;
- jchar result;
- va_start(args,methodID);
- result = functions->CallCharMethodV(this,obj,methodID,args);
- va_end(args);
- return result;
- }
- jchar CallCharMethodV(jobject obj, jmethodID methodID,
- va_list args) {
- return functions->CallCharMethodV(this,obj,methodID,args);
- }
- jchar CallCharMethodA(jobject obj, jmethodID methodID,
- const jvalue * args) {
- return functions->CallCharMethodA(this,obj,methodID,args);
- }
-
- jshort CallShortMethod(jobject obj, jmethodID methodID, ...) {
- va_list args;
- jshort result;
- va_start(args,methodID);
- result = functions->CallShortMethodV(this,obj,methodID,args);
- va_end(args);
- return result;
- }
- jshort CallShortMethodV(jobject obj, jmethodID methodID,
- va_list args) {
- return functions->CallShortMethodV(this,obj,methodID,args);
- }
- jshort CallShortMethodA(jobject obj, jmethodID methodID,
- const jvalue * args) {
- return functions->CallShortMethodA(this,obj,methodID,args);
- }
-
- jint CallIntMethod(jobject obj, jmethodID methodID, ...) {
- va_list args;
- jint result;
- va_start(args,methodID);
- result = functions->CallIntMethodV(this,obj,methodID,args);
- va_end(args);
- return result;
- }
- jint CallIntMethodV(jobject obj, jmethodID methodID,
- va_list args) {
- return functions->CallIntMethodV(this,obj,methodID,args);
- }
- jint CallIntMethodA(jobject obj, jmethodID methodID,
- const jvalue * args) {
- return functions->CallIntMethodA(this,obj,methodID,args);
- }
-
- jlong CallLongMethod(jobject obj, jmethodID methodID, ...) {
- va_list args;
- jlong result;
- va_start(args,methodID);
- result = functions->CallLongMethodV(this,obj,methodID,args);
- va_end(args);
- return result;
- }
- jlong CallLongMethodV(jobject obj, jmethodID methodID,
- va_list args) {
- return functions->CallLongMethodV(this,obj,methodID,args);
- }
- jlong CallLongMethodA(jobject obj, jmethodID methodID,
- const jvalue * args) {
- return functions->CallLongMethodA(this,obj,methodID,args);
- }
-
- jfloat CallFloatMethod(jobject obj, jmethodID methodID, ...) {
- va_list args;
- jfloat result;
- va_start(args,methodID);
- result = functions->CallFloatMethodV(this,obj,methodID,args);
- va_end(args);
- return result;
- }
- jfloat CallFloatMethodV(jobject obj, jmethodID methodID,
- va_list args) {
- return functions->CallFloatMethodV(this,obj,methodID,args);
- }
- jfloat CallFloatMethodA(jobject obj, jmethodID methodID,
- const jvalue * args) {
- return functions->CallFloatMethodA(this,obj,methodID,args);
- }
-
- jdouble CallDoubleMethod(jobject obj, jmethodID methodID, ...) {
- va_list args;
- jdouble result;
- va_start(args,methodID);
- result = functions->CallDoubleMethodV(this,obj,methodID,args);
- va_end(args);
- return result;
- }
- jdouble CallDoubleMethodV(jobject obj, jmethodID methodID,
- va_list args) {
- return functions->CallDoubleMethodV(this,obj,methodID,args);
- }
- jdouble CallDoubleMethodA(jobject obj, jmethodID methodID,
- const jvalue * args) {
- return functions->CallDoubleMethodA(this,obj,methodID,args);
- }
-
- void CallVoidMethod(jobject obj, jmethodID methodID, ...) {
- va_list args;
- va_start(args,methodID);
- functions->CallVoidMethodV(this,obj,methodID,args);
- va_end(args);
- }
- void CallVoidMethodV(jobject obj, jmethodID methodID,
- va_list args) {
- functions->CallVoidMethodV(this,obj,methodID,args);
- }
- void CallVoidMethodA(jobject obj, jmethodID methodID,
- const jvalue * args) {
- functions->CallVoidMethodA(this,obj,methodID,args);
- }
-
- jobject CallNonvirtualObjectMethod(jobject obj, jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jobject result;
- va_start(args,methodID);
- result = functions->CallNonvirtualObjectMethodV(this,obj,clazz,
- methodID,args);
- va_end(args);
- return result;
- }
- jobject CallNonvirtualObjectMethodV(jobject obj, jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallNonvirtualObjectMethodV(this,obj,clazz,
- methodID,args);
- }
- jobject CallNonvirtualObjectMethodA(jobject obj, jclass clazz,
- jmethodID methodID, const jvalue * args) {
- return functions->CallNonvirtualObjectMethodA(this,obj,clazz,
- methodID,args);
- }
-
- jboolean CallNonvirtualBooleanMethod(jobject obj, jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jboolean result;
- va_start(args,methodID);
- result = functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
- methodID,args);
- va_end(args);
- return result;
- }
- jboolean CallNonvirtualBooleanMethodV(jobject obj, jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
- methodID,args);
- }
- jboolean CallNonvirtualBooleanMethodA(jobject obj, jclass clazz,
- jmethodID methodID, const jvalue * args) {
- return functions->CallNonvirtualBooleanMethodA(this,obj,clazz,
- methodID, args);
- }
-
- jbyte CallNonvirtualByteMethod(jobject obj, jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jbyte result;
- va_start(args,methodID);
- result = functions->CallNonvirtualByteMethodV(this,obj,clazz,
- methodID,args);
- va_end(args);
- return result;
- }
- jbyte CallNonvirtualByteMethodV(jobject obj, jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallNonvirtualByteMethodV(this,obj,clazz,
- methodID,args);
- }
- jbyte CallNonvirtualByteMethodA(jobject obj, jclass clazz,
- jmethodID methodID, const jvalue * args) {
- return functions->CallNonvirtualByteMethodA(this,obj,clazz,
- methodID,args);
- }
-
- jchar CallNonvirtualCharMethod(jobject obj, jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jchar result;
- va_start(args,methodID);
- result = functions->CallNonvirtualCharMethodV(this,obj,clazz,
- methodID,args);
- va_end(args);
- return result;
- }
- jchar CallNonvirtualCharMethodV(jobject obj, jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallNonvirtualCharMethodV(this,obj,clazz,
- methodID,args);
- }
- jchar CallNonvirtualCharMethodA(jobject obj, jclass clazz,
- jmethodID methodID, const jvalue * args) {
- return functions->CallNonvirtualCharMethodA(this,obj,clazz,
- methodID,args);
- }
-
- jshort CallNonvirtualShortMethod(jobject obj, jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jshort result;
- va_start(args,methodID);
- result = functions->CallNonvirtualShortMethodV(this,obj,clazz,
- methodID,args);
- va_end(args);
- return result;
- }
- jshort CallNonvirtualShortMethodV(jobject obj, jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallNonvirtualShortMethodV(this,obj,clazz,
- methodID,args);
- }
- jshort CallNonvirtualShortMethodA(jobject obj, jclass clazz,
- jmethodID methodID, const jvalue * args) {
- return functions->CallNonvirtualShortMethodA(this,obj,clazz,
- methodID,args);
- }
-
- jint CallNonvirtualIntMethod(jobject obj, jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jint result;
- va_start(args,methodID);
- result = functions->CallNonvirtualIntMethodV(this,obj,clazz,
- methodID,args);
- va_end(args);
- return result;
- }
- jint CallNonvirtualIntMethodV(jobject obj, jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallNonvirtualIntMethodV(this,obj,clazz,
- methodID,args);
- }
- jint CallNonvirtualIntMethodA(jobject obj, jclass clazz,
- jmethodID methodID, const jvalue * args) {
- return functions->CallNonvirtualIntMethodA(this,obj,clazz,
- methodID,args);
- }
-
- jlong CallNonvirtualLongMethod(jobject obj, jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jlong result;
- va_start(args,methodID);
- result = functions->CallNonvirtualLongMethodV(this,obj,clazz,
- methodID,args);
- va_end(args);
- return result;
- }
- jlong CallNonvirtualLongMethodV(jobject obj, jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallNonvirtualLongMethodV(this,obj,clazz,
- methodID,args);
- }
- jlong CallNonvirtualLongMethodA(jobject obj, jclass clazz,
- jmethodID methodID, const jvalue * args) {
- return functions->CallNonvirtualLongMethodA(this,obj,clazz,
- methodID,args);
- }
-
- jfloat CallNonvirtualFloatMethod(jobject obj, jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jfloat result;
- va_start(args,methodID);
- result = functions->CallNonvirtualFloatMethodV(this,obj,clazz,
- methodID,args);
- va_end(args);
- return result;
- }
- jfloat CallNonvirtualFloatMethodV(jobject obj, jclass clazz,
- jmethodID methodID,
- va_list args) {
- return functions->CallNonvirtualFloatMethodV(this,obj,clazz,
- methodID,args);
- }
- jfloat CallNonvirtualFloatMethodA(jobject obj, jclass clazz,
- jmethodID methodID,
- const jvalue * args) {
- return functions->CallNonvirtualFloatMethodA(this,obj,clazz,
- methodID,args);
- }
-
- jdouble CallNonvirtualDoubleMethod(jobject obj, jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jdouble result;
- va_start(args,methodID);
- result = functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
- methodID,args);
- va_end(args);
- return result;
- }
- jdouble CallNonvirtualDoubleMethodV(jobject obj, jclass clazz,
- jmethodID methodID,
- va_list args) {
- return functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
- methodID,args);
- }
- jdouble CallNonvirtualDoubleMethodA(jobject obj, jclass clazz,
- jmethodID methodID,
- const jvalue * args) {
- return functions->CallNonvirtualDoubleMethodA(this,obj,clazz,
- methodID,args);
- }
-
- void CallNonvirtualVoidMethod(jobject obj, jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- va_start(args,methodID);
- functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
- va_end(args);
- }
- void CallNonvirtualVoidMethodV(jobject obj, jclass clazz,
- jmethodID methodID,
- va_list args) {
- functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
- }
- void CallNonvirtualVoidMethodA(jobject obj, jclass clazz,
- jmethodID methodID,
- const jvalue * args) {
- functions->CallNonvirtualVoidMethodA(this,obj,clazz,methodID,args);
- }
-
- jfieldID GetFieldID(jclass clazz, const char *name,
- const char *sig) {
- return functions->GetFieldID(this,clazz,name,sig);
- }
-
- jobject GetObjectField(jobject obj, jfieldID fieldID) {
- return functions->GetObjectField(this,obj,fieldID);
- }
- jboolean GetBooleanField(jobject obj, jfieldID fieldID) {
- return functions->GetBooleanField(this,obj,fieldID);
- }
- jbyte GetByteField(jobject obj, jfieldID fieldID) {
- return functions->GetByteField(this,obj,fieldID);
- }
- jchar GetCharField(jobject obj, jfieldID fieldID) {
- return functions->GetCharField(this,obj,fieldID);
- }
- jshort GetShortField(jobject obj, jfieldID fieldID) {
- return functions->GetShortField(this,obj,fieldID);
- }
- jint GetIntField(jobject obj, jfieldID fieldID) {
- return functions->GetIntField(this,obj,fieldID);
- }
- jlong GetLongField(jobject obj, jfieldID fieldID) {
- return functions->GetLongField(this,obj,fieldID);
- }
- jfloat GetFloatField(jobject obj, jfieldID fieldID) {
- return functions->GetFloatField(this,obj,fieldID);
- }
- jdouble GetDoubleField(jobject obj, jfieldID fieldID) {
- return functions->GetDoubleField(this,obj,fieldID);
- }
-
- void SetObjectField(jobject obj, jfieldID fieldID, jobject val) {
- functions->SetObjectField(this,obj,fieldID,val);
- }
- void SetBooleanField(jobject obj, jfieldID fieldID,
- jboolean val) {
- functions->SetBooleanField(this,obj,fieldID,val);
- }
- void SetByteField(jobject obj, jfieldID fieldID,
- jbyte val) {
- functions->SetByteField(this,obj,fieldID,val);
- }
- void SetCharField(jobject obj, jfieldID fieldID,
- jchar val) {
- functions->SetCharField(this,obj,fieldID,val);
- }
- void SetShortField(jobject obj, jfieldID fieldID,
- jshort val) {
- functions->SetShortField(this,obj,fieldID,val);
- }
- void SetIntField(jobject obj, jfieldID fieldID,
- jint val) {
- functions->SetIntField(this,obj,fieldID,val);
- }
- void SetLongField(jobject obj, jfieldID fieldID,
- jlong val) {
- functions->SetLongField(this,obj,fieldID,val);
- }
- void SetFloatField(jobject obj, jfieldID fieldID,
- jfloat val) {
- functions->SetFloatField(this,obj,fieldID,val);
- }
- void SetDoubleField(jobject obj, jfieldID fieldID,
- jdouble val) {
- functions->SetDoubleField(this,obj,fieldID,val);
- }
-
- jmethodID GetStaticMethodID(jclass clazz, const char *name,
- const char *sig) {
- return functions->GetStaticMethodID(this,clazz,name,sig);
- }
-
- jobject CallStaticObjectMethod(jclass clazz, jmethodID methodID,
- ...) {
- va_list args;
- jobject result;
- va_start(args,methodID);
- result = functions->CallStaticObjectMethodV(this,clazz,methodID,args);
- va_end(args);
- return result;
- }
- jobject CallStaticObjectMethodV(jclass clazz, jmethodID methodID,
- va_list args) {
- return functions->CallStaticObjectMethodV(this,clazz,methodID,args);
- }
- jobject CallStaticObjectMethodA(jclass clazz, jmethodID methodID,
- const jvalue *args) {
- return functions->CallStaticObjectMethodA(this,clazz,methodID,args);
- }
-
- jboolean CallStaticBooleanMethod(jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jboolean result;
- va_start(args,methodID);
- result = functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
- va_end(args);
- return result;
- }
- jboolean CallStaticBooleanMethodV(jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
- }
- jboolean CallStaticBooleanMethodA(jclass clazz,
- jmethodID methodID, const jvalue *args) {
- return functions->CallStaticBooleanMethodA(this,clazz,methodID,args);
- }
-
- jbyte CallStaticByteMethod(jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jbyte result;
- va_start(args,methodID);
- result = functions->CallStaticByteMethodV(this,clazz,methodID,args);
- va_end(args);
- return result;
- }
- jbyte CallStaticByteMethodV(jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallStaticByteMethodV(this,clazz,methodID,args);
- }
- jbyte CallStaticByteMethodA(jclass clazz,
- jmethodID methodID, const jvalue *args) {
- return functions->CallStaticByteMethodA(this,clazz,methodID,args);
- }
-
- jchar CallStaticCharMethod(jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jchar result;
- va_start(args,methodID);
- result = functions->CallStaticCharMethodV(this,clazz,methodID,args);
- va_end(args);
- return result;
- }
- jchar CallStaticCharMethodV(jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallStaticCharMethodV(this,clazz,methodID,args);
- }
- jchar CallStaticCharMethodA(jclass clazz,
- jmethodID methodID, const jvalue *args) {
- return functions->CallStaticCharMethodA(this,clazz,methodID,args);
- }
-
- jshort CallStaticShortMethod(jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jshort result;
- va_start(args,methodID);
- result = functions->CallStaticShortMethodV(this,clazz,methodID,args);
- va_end(args);
- return result;
- }
- jshort CallStaticShortMethodV(jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallStaticShortMethodV(this,clazz,methodID,args);
- }
- jshort CallStaticShortMethodA(jclass clazz,
- jmethodID methodID, const jvalue *args) {
- return functions->CallStaticShortMethodA(this,clazz,methodID,args);
- }
-
- jint CallStaticIntMethod(jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jint result;
- va_start(args,methodID);
- result = functions->CallStaticIntMethodV(this,clazz,methodID,args);
- va_end(args);
- return result;
- }
- jint CallStaticIntMethodV(jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallStaticIntMethodV(this,clazz,methodID,args);
- }
- jint CallStaticIntMethodA(jclass clazz,
- jmethodID methodID, const jvalue *args) {
- return functions->CallStaticIntMethodA(this,clazz,methodID,args);
- }
-
- jlong CallStaticLongMethod(jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jlong result;
- va_start(args,methodID);
- result = functions->CallStaticLongMethodV(this,clazz,methodID,args);
- va_end(args);
- return result;
- }
- jlong CallStaticLongMethodV(jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallStaticLongMethodV(this,clazz,methodID,args);
- }
- jlong CallStaticLongMethodA(jclass clazz,
- jmethodID methodID, const jvalue *args) {
- return functions->CallStaticLongMethodA(this,clazz,methodID,args);
- }
-
- jfloat CallStaticFloatMethod(jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jfloat result;
- va_start(args,methodID);
- result = functions->CallStaticFloatMethodV(this,clazz,methodID,args);
- va_end(args);
- return result;
- }
- jfloat CallStaticFloatMethodV(jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallStaticFloatMethodV(this,clazz,methodID,args);
- }
- jfloat CallStaticFloatMethodA(jclass clazz,
- jmethodID methodID, const jvalue *args) {
- return functions->CallStaticFloatMethodA(this,clazz,methodID,args);
- }
-
- jdouble CallStaticDoubleMethod(jclass clazz,
- jmethodID methodID, ...) {
- va_list args;
- jdouble result;
- va_start(args,methodID);
- result = functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
- va_end(args);
- return result;
- }
- jdouble CallStaticDoubleMethodV(jclass clazz,
- jmethodID methodID, va_list args) {
- return functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
- }
- jdouble CallStaticDoubleMethodA(jclass clazz,
- jmethodID methodID, const jvalue *args) {
- return functions->CallStaticDoubleMethodA(this,clazz,methodID,args);
- }
-
- void CallStaticVoidMethod(jclass cls, jmethodID methodID, ...) {
- va_list args;
- va_start(args,methodID);
- functions->CallStaticVoidMethodV(this,cls,methodID,args);
- va_end(args);
- }
- void CallStaticVoidMethodV(jclass cls, jmethodID methodID,
- va_list args) {
- functions->CallStaticVoidMethodV(this,cls,methodID,args);
- }
- void CallStaticVoidMethodA(jclass cls, jmethodID methodID,
- const jvalue * args) {
- functions->CallStaticVoidMethodA(this,cls,methodID,args);
- }
-
- jfieldID GetStaticFieldID(jclass clazz, const char *name,
- const char *sig) {
- return functions->GetStaticFieldID(this,clazz,name,sig);
- }
- jobject GetStaticObjectField(jclass clazz, jfieldID fieldID) {
- return functions->GetStaticObjectField(this,clazz,fieldID);
- }
- jboolean GetStaticBooleanField(jclass clazz, jfieldID fieldID) {
- return functions->GetStaticBooleanField(this,clazz,fieldID);
- }
- jbyte GetStaticByteField(jclass clazz, jfieldID fieldID) {
- return functions->GetStaticByteField(this,clazz,fieldID);
- }
- jchar GetStaticCharField(jclass clazz, jfieldID fieldID) {
- return functions->GetStaticCharField(this,clazz,fieldID);
- }
- jshort GetStaticShortField(jclass clazz, jfieldID fieldID) {
- return functions->GetStaticShortField(this,clazz,fieldID);
- }
- jint GetStaticIntField(jclass clazz, jfieldID fieldID) {
- return functions->GetStaticIntField(this,clazz,fieldID);
- }
- jlong GetStaticLongField(jclass clazz, jfieldID fieldID) {
- return functions->GetStaticLongField(this,clazz,fieldID);
- }
- jfloat GetStaticFloatField(jclass clazz, jfieldID fieldID) {
- return functions->GetStaticFloatField(this,clazz,fieldID);
- }
- jdouble GetStaticDoubleField(jclass clazz, jfieldID fieldID) {
- return functions->GetStaticDoubleField(this,clazz,fieldID);
- }
-
- void SetStaticObjectField(jclass clazz, jfieldID fieldID,
- jobject value) {
- functions->SetStaticObjectField(this,clazz,fieldID,value);
- }
- void SetStaticBooleanField(jclass clazz, jfieldID fieldID,
- jboolean value) {
- functions->SetStaticBooleanField(this,clazz,fieldID,value);
- }
- void SetStaticByteField(jclass clazz, jfieldID fieldID,
- jbyte value) {
- functions->SetStaticByteField(this,clazz,fieldID,value);
- }
- void SetStaticCharField(jclass clazz, jfieldID fieldID,
- jchar value) {
- functions->SetStaticCharField(this,clazz,fieldID,value);
- }
- void SetStaticShortField(jclass clazz, jfieldID fieldID,
- jshort value) {
- functions->SetStaticShortField(this,clazz,fieldID,value);
- }
- void SetStaticIntField(jclass clazz, jfieldID fieldID,
- jint value) {
- functions->SetStaticIntField(this,clazz,fieldID,value);
- }
- void SetStaticLongField(jclass clazz, jfieldID fieldID,
- jlong value) {
- functions->SetStaticLongField(this,clazz,fieldID,value);
- }
- void SetStaticFloatField(jclass clazz, jfieldID fieldID,
- jfloat value) {
- functions->SetStaticFloatField(this,clazz,fieldID,value);
- }
- void SetStaticDoubleField(jclass clazz, jfieldID fieldID,
- jdouble value) {
- functions->SetStaticDoubleField(this,clazz,fieldID,value);
- }
-
- jstring NewString(const jchar *unicode, jsize len) {
- return functions->NewString(this,unicode,len);
- }
- jsize GetStringLength(jstring str) {
- return functions->GetStringLength(this,str);
- }
- const jchar *GetStringChars(jstring str, jboolean *isCopy) {
- return functions->GetStringChars(this,str,isCopy);
- }
- void ReleaseStringChars(jstring str, const jchar *chars) {
- functions->ReleaseStringChars(this,str,chars);
- }
-
- jstring NewStringUTF(const char *utf) {
- return functions->NewStringUTF(this,utf);
- }
- jsize GetStringUTFLength(jstring str) {
- return functions->GetStringUTFLength(this,str);
- }
- const char* GetStringUTFChars(jstring str, jboolean *isCopy) {
- return functions->GetStringUTFChars(this,str,isCopy);
- }
- void ReleaseStringUTFChars(jstring str, const char* chars) {
- functions->ReleaseStringUTFChars(this,str,chars);
- }
-
- jsize GetArrayLength(jarray array) {
- return functions->GetArrayLength(this,array);
- }
-
- jobjectArray NewObjectArray(jsize len, jclass clazz,
- jobject init) {
- return functions->NewObjectArray(this,len,clazz,init);
- }
- jobject GetObjectArrayElement(jobjectArray array, jsize index) {
- return functions->GetObjectArrayElement(this,array,index);
- }
- void SetObjectArrayElement(jobjectArray array, jsize index,
- jobject val) {
- functions->SetObjectArrayElement(this,array,index,val);
- }
-
- jbooleanArray NewBooleanArray(jsize len) {
- return functions->NewBooleanArray(this,len);
- }
- jbyteArray NewByteArray(jsize len) {
- return functions->NewByteArray(this,len);
- }
- jcharArray NewCharArray(jsize len) {
- return functions->NewCharArray(this,len);
- }
- jshortArray NewShortArray(jsize len) {
- return functions->NewShortArray(this,len);
- }
- jintArray NewIntArray(jsize len) {
- return functions->NewIntArray(this,len);
- }
- jlongArray NewLongArray(jsize len) {
- return functions->NewLongArray(this,len);
- }
- jfloatArray NewFloatArray(jsize len) {
- return functions->NewFloatArray(this,len);
- }
- jdoubleArray NewDoubleArray(jsize len) {
- return functions->NewDoubleArray(this,len);
- }
-
- jboolean * GetBooleanArrayElements(jbooleanArray array, jboolean *isCopy) {
- return functions->GetBooleanArrayElements(this,array,isCopy);
- }
- jbyte * GetByteArrayElements(jbyteArray array, jboolean *isCopy) {
- return functions->GetByteArrayElements(this,array,isCopy);
- }
- jchar * GetCharArrayElements(jcharArray array, jboolean *isCopy) {
- return functions->GetCharArrayElements(this,array,isCopy);
- }
- jshort * GetShortArrayElements(jshortArray array, jboolean *isCopy) {
- return functions->GetShortArrayElements(this,array,isCopy);
- }
- jint * GetIntArrayElements(jintArray array, jboolean *isCopy) {
- return functions->GetIntArrayElements(this,array,isCopy);
- }
- jlong * GetLongArrayElements(jlongArray array, jboolean *isCopy) {
- return functions->GetLongArrayElements(this,array,isCopy);
- }
- jfloat * GetFloatArrayElements(jfloatArray array, jboolean *isCopy) {
- return functions->GetFloatArrayElements(this,array,isCopy);
- }
- jdouble * GetDoubleArrayElements(jdoubleArray array, jboolean *isCopy) {
- return functions->GetDoubleArrayElements(this,array,isCopy);
- }
-
- void ReleaseBooleanArrayElements(jbooleanArray array,
- jboolean *elems,
- jint mode) {
- functions->ReleaseBooleanArrayElements(this,array,elems,mode);
- }
- void ReleaseByteArrayElements(jbyteArray array,
- jbyte *elems,
- jint mode) {
- functions->ReleaseByteArrayElements(this,array,elems,mode);
- }
- void ReleaseCharArrayElements(jcharArray array,
- jchar *elems,
- jint mode) {
- functions->ReleaseCharArrayElements(this,array,elems,mode);
- }
- void ReleaseShortArrayElements(jshortArray array,
- jshort *elems,
- jint mode) {
- functions->ReleaseShortArrayElements(this,array,elems,mode);
- }
- void ReleaseIntArrayElements(jintArray array,
- jint *elems,
- jint mode) {
- functions->ReleaseIntArrayElements(this,array,elems,mode);
- }
- void ReleaseLongArrayElements(jlongArray array,
- jlong *elems,
- jint mode) {
- functions->ReleaseLongArrayElements(this,array,elems,mode);
- }
- void ReleaseFloatArrayElements(jfloatArray array,
- jfloat *elems,
- jint mode) {
- functions->ReleaseFloatArrayElements(this,array,elems,mode);
- }
- void ReleaseDoubleArrayElements(jdoubleArray array,
- jdouble *elems,
- jint mode) {
- functions->ReleaseDoubleArrayElements(this,array,elems,mode);
- }
-
- void GetBooleanArrayRegion(jbooleanArray array,
- jsize start, jsize len, jboolean *buf) {
- functions->GetBooleanArrayRegion(this,array,start,len,buf);
- }
- void GetByteArrayRegion(jbyteArray array,
- jsize start, jsize len, jbyte *buf) {
- functions->GetByteArrayRegion(this,array,start,len,buf);
- }
- void GetCharArrayRegion(jcharArray array,
- jsize start, jsize len, jchar *buf) {
- functions->GetCharArrayRegion(this,array,start,len,buf);
- }
- void GetShortArrayRegion(jshortArray array,
- jsize start, jsize len, jshort *buf) {
- functions->GetShortArrayRegion(this,array,start,len,buf);
- }
- void GetIntArrayRegion(jintArray array,
- jsize start, jsize len, jint *buf) {
- functions->GetIntArrayRegion(this,array,start,len,buf);
- }
- void GetLongArrayRegion(jlongArray array,
- jsize start, jsize len, jlong *buf) {
- functions->GetLongArrayRegion(this,array,start,len,buf);
- }
- void GetFloatArrayRegion(jfloatArray array,
- jsize start, jsize len, jfloat *buf) {
- functions->GetFloatArrayRegion(this,array,start,len,buf);
- }
- void GetDoubleArrayRegion(jdoubleArray array,
- jsize start, jsize len, jdouble *buf) {
- functions->GetDoubleArrayRegion(this,array,start,len,buf);
- }
-
- void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len,
- const jboolean *buf) {
- functions->SetBooleanArrayRegion(this,array,start,len,buf);
- }
- void SetByteArrayRegion(jbyteArray array, jsize start, jsize len,
- const jbyte *buf) {
- functions->SetByteArrayRegion(this,array,start,len,buf);
- }
- void SetCharArrayRegion(jcharArray array, jsize start, jsize len,
- const jchar *buf) {
- functions->SetCharArrayRegion(this,array,start,len,buf);
- }
- void SetShortArrayRegion(jshortArray array, jsize start, jsize len,
- const jshort *buf) {
- functions->SetShortArrayRegion(this,array,start,len,buf);
- }
- void SetIntArrayRegion(jintArray array, jsize start, jsize len,
- const jint *buf) {
- functions->SetIntArrayRegion(this,array,start,len,buf);
- }
- void SetLongArrayRegion(jlongArray array, jsize start, jsize len,
- const jlong *buf) {
- functions->SetLongArrayRegion(this,array,start,len,buf);
- }
- void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len,
- const jfloat *buf) {
- functions->SetFloatArrayRegion(this,array,start,len,buf);
- }
- void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len,
- const jdouble *buf) {
- functions->SetDoubleArrayRegion(this,array,start,len,buf);
- }
-
- jint RegisterNatives(jclass clazz, const JNINativeMethod *methods,
- jint nMethods) {
- return functions->RegisterNatives(this,clazz,methods,nMethods);
- }
- jint UnregisterNatives(jclass clazz) {
- return functions->UnregisterNatives(this,clazz);
- }
-
- jint MonitorEnter(jobject obj) {
- return functions->MonitorEnter(this,obj);
- }
- jint MonitorExit(jobject obj) {
- return functions->MonitorExit(this,obj);
- }
-
- jint GetJavaVM(JavaVM **vm) {
- return functions->GetJavaVM(this,vm);
- }
-
- void GetStringRegion(jstring str, jsize start, jsize len, jchar *buf) {
- functions->GetStringRegion(this,str,start,len,buf);
- }
- void GetStringUTFRegion(jstring str, jsize start, jsize len, char *buf) {
- functions->GetStringUTFRegion(this,str,start,len,buf);
- }
-
- void * GetPrimitiveArrayCritical(jarray array, jboolean *isCopy) {
- return functions->GetPrimitiveArrayCritical(this,array,isCopy);
- }
- void ReleasePrimitiveArrayCritical(jarray array, void *carray, jint mode) {
- functions->ReleasePrimitiveArrayCritical(this,array,carray,mode);
- }
-
- const jchar * GetStringCritical(jstring string, jboolean *isCopy) {
- return functions->GetStringCritical(this,string,isCopy);
- }
- void ReleaseStringCritical(jstring string, const jchar *cstring) {
- functions->ReleaseStringCritical(this,string,cstring);
- }
-
- jweak NewWeakGlobalRef(jobject obj) {
- return functions->NewWeakGlobalRef(this,obj);
- }
- void DeleteWeakGlobalRef(jweak ref) {
- functions->DeleteWeakGlobalRef(this,ref);
- }
-
- jboolean ExceptionCheck() {
- return functions->ExceptionCheck(this);
- }
-
- jobject NewDirectByteBuffer(void* address, jlong capacity) {
- return functions->NewDirectByteBuffer(this, address, capacity);
- }
- void* GetDirectBufferAddress(jobject buf) {
- return functions->GetDirectBufferAddress(this, buf);
- }
- jlong GetDirectBufferCapacity(jobject buf) {
- return functions->GetDirectBufferCapacity(this, buf);
- }
- jobjectRefType GetObjectRefType(jobject obj) {
- return functions->GetObjectRefType(this, obj);
- }
-
-#endif /* __cplusplus */
-};
-
-typedef struct JavaVMOption {
- char *optionString;
- void *extraInfo;
-} JavaVMOption;
-
-typedef struct JavaVMInitArgs {
- jint version;
-
- jint nOptions;
- JavaVMOption *options;
- jboolean ignoreUnrecognized;
-} JavaVMInitArgs;
-
-typedef struct JavaVMAttachArgs {
- jint version;
-
- char *name;
- jobject group;
-} JavaVMAttachArgs;
-
-/* These will be VM-specific. */
-
-#define JDK1_2
-#define JDK1_4
-
-/* End VM-specific. */
-
-struct JNIInvokeInterface_ {
- void *reserved0;
- void *reserved1;
- void *reserved2;
-
- jint (JNICALL *DestroyJavaVM)(JavaVM *vm);
-
- jint (JNICALL *AttachCurrentThread)(JavaVM *vm, void **penv, void *args);
-
- jint (JNICALL *DetachCurrentThread)(JavaVM *vm);
-
- jint (JNICALL *GetEnv)(JavaVM *vm, void **penv, jint version);
-
- jint (JNICALL *AttachCurrentThreadAsDaemon)(JavaVM *vm, void **penv, void *args);
-};
-
-struct JavaVM_ {
- const struct JNIInvokeInterface_ *functions;
-#ifdef __cplusplus
-
- jint DestroyJavaVM() {
- return functions->DestroyJavaVM(this);
- }
- jint AttachCurrentThread(void **penv, void *args) {
- return functions->AttachCurrentThread(this, penv, args);
- }
- jint DetachCurrentThread() {
- return functions->DetachCurrentThread(this);
- }
-
- jint GetEnv(void **penv, jint version) {
- return functions->GetEnv(this, penv, version);
- }
- jint AttachCurrentThreadAsDaemon(void **penv, void *args) {
- return functions->AttachCurrentThreadAsDaemon(this, penv, args);
- }
-#endif
-};
-
-#ifdef _JNI_IMPLEMENTATION_
-#define _JNI_IMPORT_OR_EXPORT_ JNIEXPORT
-#else
-#define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT
-#endif
-_JNI_IMPORT_OR_EXPORT_ jint JNICALL
-JNI_GetDefaultJavaVMInitArgs(void *args);
-
-_JNI_IMPORT_OR_EXPORT_ jint JNICALL
-JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args);
-
-_JNI_IMPORT_OR_EXPORT_ jint JNICALL
-JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *);
-
-/* Defined by native libraries. */
-JNIEXPORT jint JNICALL
-JNI_OnLoad(JavaVM *vm, void *reserved);
-
-JNIEXPORT void JNICALL
-JNI_OnUnload(JavaVM *vm, void *reserved);
-
-#define JNI_VERSION_1_1 0x00010001
-#define JNI_VERSION_1_2 0x00010002
-#define JNI_VERSION_1_4 0x00010004
-#define JNI_VERSION_1_6 0x00010006
-#define JNI_VERSION_1_8 0x00010008
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif /* __cplusplus */
-
-#endif /* !_JAVASOFT_JNI_H_ */
diff --git a/third_party/ntcore_2017/java/arm-linux/linux/jni_md.h b/third_party/ntcore_2017/java/arm-linux/linux/jni_md.h
deleted file mode 100644
index 80eedf3..0000000
--- a/third_party/ntcore_2017/java/arm-linux/linux/jni_md.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef _JAVASOFT_JNI_MD_H_
-#define _JAVASOFT_JNI_MD_H_
-
-#ifndef __has_attribute
- #define __has_attribute(x) 0
-#endif
-#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility)
- #define JNIEXPORT __attribute__((visibility("default")))
- #define JNIIMPORT __attribute__((visibility("default")))
-#else
- #define JNIEXPORT
- #define JNIIMPORT
-#endif
-
-#define JNICALL
-
-typedef int jint;
-#ifdef _LP64 /* 64-bit Solaris */
-typedef long jlong;
-#else
-typedef long long jlong;
-#endif
-
-typedef signed char jbyte;
-
-#endif /* !_JAVASOFT_JNI_MD_H_ */
diff --git a/third_party/ntcore_2017/java/java.gradle b/third_party/ntcore_2017/java/java.gradle
deleted file mode 100644
index 2ca3bfc..0000000
--- a/third_party/ntcore_2017/java/java.gradle
+++ /dev/null
@@ -1,180 +0,0 @@
-import org.gradle.internal.os.OperatingSystem
-
-apply plugin: 'java'
-apply plugin: 'net.ltgt.errorprone'
-
-repositories {
- mavenCentral()
-}
-
-configurations.errorprone {
- resolutionStrategy.force 'com.google.errorprone:error_prone_core:2.0.9'
-}
-
-def generatedJNIHeaderLoc = "${buildDir}/include"
-
-sourceSets {
- main {
- java {
- srcDirs = ["${rootDir}/java/src"]
- }
- }
-}
-
-jar {
- description = 'Generates NetworkTables jar, with the JNI shared libraries embedded'
- baseName = 'ntcore'
- if (project.isArm && project.hasProperty('compilerPrefix')
- && project.hasProperty('armSuffix')) {
- classifier = "${buildPlatform}${project.armSuffix}"
- } else {
- classifier = "${buildPlatform}"
- }
- duplicatesStrategy = 'exclude'
-
- dependsOn { classes }
- model {
- binaries {
- withType(SharedLibraryBinarySpec) { binary ->
- // Only include the native file if not cross compiling to the roboRIO
- if (!project.isArm || project.hasProperty('compilerPrefix'))
- from(file(binary.sharedLibraryFile)) {
- into getPlatformPath(binary)
- }
- }
- }
- }
-}
-
-project.tasks.whenTaskAdded { task ->
- if (isArm) {
- if (task.name == 'ntcoreSharedLibrary') jar.dependsOn task
- } else {
- if (task.name == 'ntcoreX64SharedLibrary' || task.name == 'ntcoreX86SharedLibrary')
- jar.dependsOn task
- }
-}
-
-task networktablesJavaSource(type: Jar, dependsOn: classes) {
- description = 'Generates the source jar for NetworkTables java'
- group = 'WPILib'
- baseName = 'ntcore'
- classifier = "sources"
- duplicatesStrategy = 'exclude'
-
- from sourceSets.main.allJava
-}
-
-task networktablesJavadoc(type: Jar, dependsOn: javadoc) {
- description = 'Generates the javadoc jar for NetworkTables java'
- group = 'WPILib'
- baseName = 'ntcore'
- classifier = "javadoc"
- duplicatesStrategy = 'exclude'
-
- from javadoc.destinationDir
-}
-
-build.dependsOn networktablesJavaSource
-build.dependsOn networktablesJavadoc
-
-/**
- * Generates the JNI headers
- */
-task jniHeadersNetworkTables {
- description = 'Generates JNI headers from edu.wpi.first.wpilibj.networktables.*'
- group = 'WPILib'
- def outputFolder = file(generatedJNIHeaderLoc)
- inputs.files sourceSets.main.output
- outputs.file outputFolder
- doLast {
- outputFolder.mkdirs()
- exec {
- executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah')
- args '-d', outputFolder
- args '-classpath', sourceSets.main.output.classesDir
- args 'edu.wpi.first.wpilibj.networktables.NetworkTablesJNI'
- }
- }
-}
-
-ext.getNativeJNISymbols = {
- def symbolsList = []
-
- jniHeadersNetworkTables.outputs.files.each {
- FileTree tree = fileTree(dir: it)
- tree.each { File file ->
- file.eachLine { line ->
- if (line.trim()) {
- if (line.startsWith("JNIEXPORT ") && line.contains('JNICALL')) {
- def (p1, p2) = line.split('JNICALL').collect { it.trim() }
- // p2 is our JNI call
- symbolsList << p2
- }
- }
- }
- }
- }
-
- return symbolsList
-}
-
-clean {
- delete generatedJNIHeaderLoc
-}
-
-compileJava {
- options.compilerArgs << '-Xlint:unchecked'
-}
-
-javadoc {
- options.addStringOption('Xdoclint:none', '-quiet')
-}
-
-// This creates a lambda that the main build.gradle can access, which sets up the JNI includes for the
-// target build platform. This lambda is exposed as a property in the main build.gradle.
-ext.setupJniIncludes = { binaries ->
- def platformSpecificIncludeFlag = { loc, cppCompiler ->
- if (OperatingSystem.current().isWindows()) {
- cppCompiler.args "/I$loc"
- } else {
- cppCompiler.args '-I', loc
- }
- }
- binaries.all {
- tasks.withType(CppCompile) {
- if (buildPlatform == 'arm') {
- cppCompiler.args '-I', file("${rootDir}/java/arm-linux").absolutePath
- cppCompiler.args '-I', file("${rootDir}/java/arm-linux/linux").absolutePath
- } else {
- def jdkLocation = org.gradle.internal.jvm.Jvm.current().javaHome
- platformSpecificIncludeFlag("${jdkLocation}/include", cppCompiler)
-
- if (targetPlatform.operatingSystem.macOsX) {
- platformSpecificIncludeFlag("${jdkLocation}/include/darwin", cppCompiler)
- } else if (targetPlatform.operatingSystem.linux) {
- platformSpecificIncludeFlag("${jdkLocation}/include/linux", cppCompiler)
- } else if (targetPlatform.operatingSystem.windows) {
- platformSpecificIncludeFlag("${jdkLocation}/include/win32", cppCompiler)
- } else if (targetPlatform.operatingSystem.freeBSD) {
- platformSpecificIncludeFlag("${jdkLocation}/include/freebsd", cppCompiler)
- } else if (file("$jdkLocation/include/darwin").exists()) {
- // TODO: As of Gradle 2.8, targetPlatform.operatingSystem.macOsX returns false
- // on El Capitan. We therefore manually test for the darwin folder and include it
- // if it exists
- platformSpecificIncludeFlag("${jdkLocation}/include/darwin", cppCompiler)
- }
- }
-
- jniHeadersNetworkTables.outputs.files.each { file ->
- if (buildPlatform == 'arm') {
- cppCompiler.args '-I', file.getPath()
- } else {
- platformSpecificIncludeFlag(file.getPath(), cppCompiler)
- }
- }
-
- dependsOn jniHeadersNetworkTables
- }
- }
-}
diff --git a/third_party/ntcore_2017/java/lib/NetworkTablesJNI.cpp b/third_party/ntcore_2017/java/lib/NetworkTablesJNI.cpp
deleted file mode 100644
index 62d37f1..0000000
--- a/third_party/ntcore_2017/java/lib/NetworkTablesJNI.cpp
+++ /dev/null
@@ -1,1738 +0,0 @@
-#include <jni.h>
-#include <atomic>
-#include <cassert>
-#include <condition_variable>
-#include <mutex>
-#include <sstream>
-#include <queue>
-#include <thread>
-
-#include "edu_wpi_first_wpilibj_networktables_NetworkTablesJNI.h"
-#include "ntcore.h"
-#include "support/atomic_static.h"
-#include "support/jni_util.h"
-#include "support/SafeThread.h"
-#include "llvm/ConvertUTF.h"
-#include "llvm/SmallString.h"
-#include "llvm/SmallVector.h"
-
-using namespace wpi::java;
-
-//
-// Globals and load/unload
-//
-
-// Used for callback.
-static JavaVM *jvm = nullptr;
-static JClass booleanCls;
-static JClass doubleCls;
-static JClass connectionInfoCls;
-static JClass entryInfoCls;
-static JException keyNotDefinedEx;
-static JException persistentEx;
-static JException illegalArgEx;
-static JException nullPointerEx;
-// Thread-attached environment for listener callbacks.
-static JNIEnv *listenerEnv = nullptr;
-
-static void ListenerOnStart() {
- if (!jvm) return;
- JNIEnv *env;
- JavaVMAttachArgs args;
- args.version = JNI_VERSION_1_2;
- args.name = const_cast<char*>("NTListener");
- args.group = nullptr;
- if (jvm->AttachCurrentThreadAsDaemon(reinterpret_cast<void **>(&env),
- &args) != JNI_OK)
- return;
- if (!env || !env->functions) return;
- listenerEnv = env;
-}
-
-static void ListenerOnExit() {
- listenerEnv = nullptr;
- if (!jvm) return;
- jvm->DetachCurrentThread();
-}
-
-extern "C" {
-
-JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
- jvm = vm;
-
- JNIEnv *env;
- if (vm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6) != JNI_OK)
- return JNI_ERR;
-
- // Cache references to classes
- booleanCls = JClass(env, "java/lang/Boolean");
- if (!booleanCls) return JNI_ERR;
-
- doubleCls = JClass(env, "java/lang/Double");
- if (!doubleCls) return JNI_ERR;
-
- connectionInfoCls =
- JClass(env, "edu/wpi/first/wpilibj/networktables/ConnectionInfo");
- if (!connectionInfoCls) return JNI_ERR;
-
- entryInfoCls = JClass(env, "edu/wpi/first/wpilibj/networktables/EntryInfo");
- if (!entryInfoCls) return JNI_ERR;
-
- keyNotDefinedEx = JException(
- env, "edu/wpi/first/wpilibj/networktables/NetworkTableKeyNotDefined");
- if (!keyNotDefinedEx) return JNI_ERR;
-
- persistentEx = JException(
- env, "edu/wpi/first/wpilibj/networktables/PersistentException");
- if (!persistentEx) return JNI_ERR;
-
- illegalArgEx = JException(env, "java/lang/IllegalArgumentException");
- if (!illegalArgEx) return JNI_ERR;
-
- nullPointerEx = JException(env, "java/lang/NullPointerException");
- if (!nullPointerEx) return JNI_ERR;
-
- // Initial configuration of listener start/exit
- nt::SetListenerOnStart(ListenerOnStart);
- nt::SetListenerOnExit(ListenerOnExit);
-
- return JNI_VERSION_1_6;
-}
-
-JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) {
- JNIEnv *env;
- if (vm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6) != JNI_OK)
- return;
- // Delete global references
- booleanCls.free(env);
- doubleCls.free(env);
- connectionInfoCls.free(env);
- entryInfoCls.free(env);
- keyNotDefinedEx.free(env);
- persistentEx.free(env);
- illegalArgEx.free(env);
- nullPointerEx.free(env);
- jvm = nullptr;
-}
-
-} // extern "C"
-
-//
-// Helper class to create and clean up a global reference
-//
-template <typename T>
-class JGlobal {
- public:
- JGlobal(JNIEnv *env, T obj)
- : m_obj(static_cast<T>(env->NewGlobalRef(obj))) {}
- ~JGlobal() {
- if (!jvm || nt::NotifierDestroyed()) return;
- JNIEnv *env;
- bool attached = false;
- // don't attach and de-attach if already attached to a thread.
- if (jvm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6) ==
- JNI_EDETACHED) {
- if (jvm->AttachCurrentThread(reinterpret_cast<void **>(&env), nullptr) !=
- JNI_OK)
- return;
- attached = true;
- }
- if (!env || !env->functions) return;
- env->DeleteGlobalRef(m_obj);
- if (attached) jvm->DetachCurrentThread();
- }
- operator T() { return m_obj; }
- T obj() { return m_obj; }
-
- private:
- T m_obj;
-};
-
-//
-// Helper class to create and clean up a weak global reference
-//
-template <typename T>
-class JWeakGlobal {
- public:
- JWeakGlobal(JNIEnv *env, T obj)
- : m_obj(static_cast<T>(env->NewWeakGlobalRef(obj))) {}
- ~JWeakGlobal() {
- if (!jvm || nt::NotifierDestroyed()) return;
- JNIEnv *env;
- bool attached = false;
- // don't attach and de-attach if already attached to a thread.
- if (jvm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6) ==
- JNI_EDETACHED) {
- if (jvm->AttachCurrentThread(reinterpret_cast<void **>(&env), nullptr) !=
- JNI_OK)
- return;
- attached = true;
- }
- if (!env || !env->functions) return;
- env->DeleteWeakGlobalRef(m_obj);
- if (attached) jvm->DetachCurrentThread();
- }
- JLocal<T> obj(JNIEnv *env) {
- return JLocal<T>{env, env->NewLocalRef(m_obj)};
- }
-
- private:
- T m_obj;
-};
-
-//
-// Conversions from Java objects to C++
-//
-
-inline std::shared_ptr<nt::Value> FromJavaRaw(JNIEnv *env, jbyteArray jarr) {
- CriticalJByteArrayRef ref{env, jarr};
- if (!ref) return nullptr;
- return nt::Value::MakeRaw(ref);
-}
-
-inline std::shared_ptr<nt::Value> FromJavaRawBB(JNIEnv *env, jobject jbb,
- int len) {
- JByteArrayRef ref{env, jbb, len};
- if (!ref) return nullptr;
- return nt::Value::MakeRaw(ref.str());
-}
-
-inline std::shared_ptr<nt::Value> FromJavaRpc(JNIEnv *env, jbyteArray jarr) {
- CriticalJByteArrayRef ref{env, jarr};
- if (!ref) return nullptr;
- return nt::Value::MakeRpc(ref.str());
-}
-
-std::shared_ptr<nt::Value> FromJavaBooleanArray(JNIEnv *env,
- jbooleanArray jarr) {
- CriticalJBooleanArrayRef ref{env, jarr};
- if (!ref) return nullptr;
- llvm::ArrayRef<jboolean> elements{ref};
- size_t len = elements.size();
- std::vector<int> arr;
- arr.reserve(len);
- for (size_t i = 0; i < len; ++i) arr.push_back(elements[i]);
- return nt::Value::MakeBooleanArray(arr);
-}
-
-std::shared_ptr<nt::Value> FromJavaDoubleArray(JNIEnv *env, jdoubleArray jarr) {
- CriticalJDoubleArrayRef ref{env, jarr};
- if (!ref) return nullptr;
- return nt::Value::MakeDoubleArray(ref);
-}
-
-std::shared_ptr<nt::Value> FromJavaStringArray(JNIEnv *env, jobjectArray jarr) {
- size_t len = env->GetArrayLength(jarr);
- std::vector<std::string> arr;
- arr.reserve(len);
- for (size_t i = 0; i < len; ++i) {
- JLocal<jstring> elem{
- env, static_cast<jstring>(env->GetObjectArrayElement(jarr, i))};
- if (!elem) return nullptr;
- arr.push_back(JStringRef{env, elem}.str());
- }
- return nt::Value::MakeStringArray(std::move(arr));
-}
-
-//
-// Conversions from C++ to Java objects
-//
-
-static jobject MakeJObject(JNIEnv *env, const nt::Value& value) {
- static jmethodID booleanConstructor = nullptr;
- static jmethodID doubleConstructor = nullptr;
- if (!booleanConstructor)
- booleanConstructor = env->GetMethodID(booleanCls, "<init>", "(Z)V");
- if (!doubleConstructor)
- doubleConstructor = env->GetMethodID(doubleCls, "<init>", "(D)V");
-
- switch (value.type()) {
- case NT_BOOLEAN:
- return env->NewObject(booleanCls, booleanConstructor,
- (jboolean)(value.GetBoolean() ? 1 : 0));
- case NT_DOUBLE:
- return env->NewObject(doubleCls, doubleConstructor,
- (jdouble)value.GetDouble());
- case NT_STRING:
- return MakeJString(env, value.GetString());
- case NT_RAW:
- return MakeJByteArray(env, value.GetRaw());
- case NT_BOOLEAN_ARRAY:
- return MakeJBooleanArray(env, value.GetBooleanArray());
- case NT_DOUBLE_ARRAY:
- return MakeJDoubleArray(env, value.GetDoubleArray());
- case NT_STRING_ARRAY:
- return MakeJStringArray(env, value.GetStringArray());
- case NT_RPC:
- return MakeJByteArray(env, value.GetRpc());
- default:
- return nullptr;
- }
-}
-
-static jobject MakeJObject(JNIEnv *env, const nt::ConnectionInfo &info) {
- static jmethodID constructor =
- env->GetMethodID(connectionInfoCls, "<init>",
- "(Ljava/lang/String;Ljava/lang/String;IJI)V");
- JLocal<jstring> remote_id{env, MakeJString(env, info.remote_id)};
- JLocal<jstring> remote_ip{env, MakeJString(env, info.remote_ip)};
- return env->NewObject(connectionInfoCls, constructor, remote_id.obj(),
- remote_ip.obj(), (jint)info.remote_port,
- (jlong)info.last_update, (jint)info.protocol_version);
-}
-
-static jobject MakeJObject(JNIEnv *env, const nt::EntryInfo &info) {
- static jmethodID constructor =
- env->GetMethodID(entryInfoCls, "<init>", "(Ljava/lang/String;IIJ)V");
- JLocal<jstring> name{env, MakeJString(env, info.name)};
- return env->NewObject(entryInfoCls, constructor, name.obj(), (jint)info.type,
- (jint)info.flags, (jlong)info.last_change);
-}
-
-extern "C" {
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: containsKey
- * Signature: (Ljava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_containsKey
- (JNIEnv *env, jclass, jstring key)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val) return false;
- return true;
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getType
- * Signature: (Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getType
- (JNIEnv *env, jclass, jstring key)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return 0;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val) return NT_UNASSIGNED;
- return val->type();
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: putBoolean
- * Signature: (Ljava/lang/String;Z)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putBoolean
- (JNIEnv *env, jclass, jstring key, jboolean value)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- return nt::SetEntryValue(JStringRef{env, key},
- nt::Value::MakeBoolean(value != JNI_FALSE));
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: putDouble
- * Signature: (Ljava/lang/String;D)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putDouble
- (JNIEnv *env, jclass, jstring key, jdouble value)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- return nt::SetEntryValue(JStringRef{env, key},
- nt::Value::MakeDouble(value));
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: putString
- * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putString
- (JNIEnv *env, jclass, jstring key, jstring value)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- if (!value) {
- nullPointerEx.Throw(env, "value cannot be null");
- return false;
- }
- return nt::SetEntryValue(JStringRef{env, key},
- nt::Value::MakeString(JStringRef{env, value}));
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: putRaw
- * Signature: (Ljava/lang/String;[B)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putRaw__Ljava_lang_String_2_3B
- (JNIEnv *env, jclass, jstring key, jbyteArray value)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- if (!value) {
- nullPointerEx.Throw(env, "value cannot be null");
- return false;
- }
- auto v = FromJavaRaw(env, value);
- if (!v) return false;
- return nt::SetEntryValue(JStringRef{env, key}, v);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: putRaw
- * Signature: (Ljava/lang/String;Ljava/nio/ByteBuffer;I)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putRaw__Ljava_lang_String_2Ljava_nio_ByteBuffer_2I
- (JNIEnv *env, jclass, jstring key, jobject value, jint len)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- if (!value) {
- nullPointerEx.Throw(env, "value cannot be null");
- return false;
- }
- auto v = FromJavaRawBB(env, value, len);
- if (!v) return false;
- return nt::SetEntryValue(JStringRef{env, key}, v);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: putBooleanArray
- * Signature: (Ljava/lang/String;[Z)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putBooleanArray
- (JNIEnv *env, jclass, jstring key, jbooleanArray value)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- if (!value) {
- nullPointerEx.Throw(env, "value cannot be null");
- return false;
- }
- auto v = FromJavaBooleanArray(env, value);
- if (!v) return false;
- return nt::SetEntryValue(JStringRef{env, key}, v);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: putDoubleArray
- * Signature: (Ljava/lang/String;[D)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putDoubleArray
- (JNIEnv *env, jclass, jstring key, jdoubleArray value)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- if (!value) {
- nullPointerEx.Throw(env, "value cannot be null");
- return false;
- }
- auto v = FromJavaDoubleArray(env, value);
- if (!v) return false;
- return nt::SetEntryValue(JStringRef{env, key}, v);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: putStringArray
- * Signature: (Ljava/lang/String;[Ljava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putStringArray
- (JNIEnv *env, jclass, jstring key, jobjectArray value)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- if (!value) {
- nullPointerEx.Throw(env, "value cannot be null");
- return false;
- }
- auto v = FromJavaStringArray(env, value);
- if (!v) return false;
- return nt::SetEntryValue(JStringRef{env, key}, v);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: forcePutBoolean
- * Signature: (Ljava/lang/String;Z)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutBoolean
- (JNIEnv *env, jclass, jstring key, jboolean value)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return;
- }
- nt::SetEntryTypeValue(JStringRef{env, key},
- nt::Value::MakeBoolean(value != JNI_FALSE));
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: forcePutDouble
- * Signature: (Ljava/lang/String;D)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutDouble
- (JNIEnv *env, jclass, jstring key, jdouble value)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return;
- }
- nt::SetEntryTypeValue(JStringRef{env, key}, nt::Value::MakeDouble(value));
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: forcePutString
- * Signature: (Ljava/lang/String;Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutString
- (JNIEnv *env, jclass, jstring key, jstring value)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return;
- }
- if (!value) {
- nullPointerEx.Throw(env, "value cannot be null");
- return;
- }
- nt::SetEntryTypeValue(JStringRef{env, key},
- nt::Value::MakeString(JStringRef{env, value}));
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: forcePutRaw
- * Signature: (Ljava/lang/String;[B)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutRaw__Ljava_lang_String_2_3B
- (JNIEnv *env, jclass, jstring key, jbyteArray value)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return;
- }
- if (!value) {
- nullPointerEx.Throw(env, "value cannot be null");
- return;
- }
- auto v = FromJavaRaw(env, value);
- if (!v) return;
- nt::SetEntryTypeValue(JStringRef{env, key}, v);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: forcePutRaw
- * Signature: (Ljava/lang/String;Ljava/nio/ByteBuffer;I)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutRaw__Ljava_lang_String_2Ljava_nio_ByteBuffer_2I
- (JNIEnv *env, jclass, jstring key, jobject value, jint len)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return;
- }
- if (!value) {
- nullPointerEx.Throw(env, "value cannot be null");
- return;
- }
- auto v = FromJavaRawBB(env, value, len);
- if (!v) return;
- nt::SetEntryTypeValue(JStringRef{env, key}, v);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: forcePutBooleanArray
- * Signature: (Ljava/lang/String;[Z)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutBooleanArray
- (JNIEnv *env, jclass, jstring key, jbooleanArray value)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return;
- }
- if (!value) {
- nullPointerEx.Throw(env, "value cannot be null");
- return;
- }
- auto v = FromJavaBooleanArray(env, value);
- if (!v) return;
- nt::SetEntryTypeValue(JStringRef{env, key}, v);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: forcePutDoubleArray
- * Signature: (Ljava/lang/String;[D)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutDoubleArray
- (JNIEnv *env, jclass, jstring key, jdoubleArray value)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return;
- }
- if (!value) {
- nullPointerEx.Throw(env, "value cannot be null");
- return;
- }
- auto v = FromJavaDoubleArray(env, value);
- if (!v) return;
- nt::SetEntryTypeValue(JStringRef{env, key}, v);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: forcePutStringArray
- * Signature: (Ljava/lang/String;[Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutStringArray
- (JNIEnv *env, jclass, jstring key, jobjectArray value)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return;
- }
- if (!value) {
- nullPointerEx.Throw(env, "value cannot be null");
- return;
- }
- auto v = FromJavaStringArray(env, value);
- if (!v) return;
- nt::SetEntryTypeValue(JStringRef{env, key}, v);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getValue
- * Signature: (Ljava/lang/String;)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getValue__Ljava_lang_String_2
- (JNIEnv *env, jclass, jstring key)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return nullptr;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val) {
- keyNotDefinedEx.Throw(env, key);
- return nullptr;
- }
- return MakeJObject(env, *val);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getBoolean
- * Signature: (Ljava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBoolean__Ljava_lang_String_2
- (JNIEnv *env, jclass, jstring key)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsBoolean()) {
- keyNotDefinedEx.Throw(env, key);
- return false;
- }
- return val->GetBoolean();
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getDouble
- * Signature: (Ljava/lang/String;)D
- */
-JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDouble__Ljava_lang_String_2
- (JNIEnv *env, jclass, jstring key)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return 0;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsDouble()) {
- keyNotDefinedEx.Throw(env, key);
- return 0;
- }
- return val->GetDouble();
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getString
- * Signature: (Ljava/lang/String;)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getString__Ljava_lang_String_2
- (JNIEnv *env, jclass, jstring key)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return nullptr;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsString()) {
- keyNotDefinedEx.Throw(env, key);
- return nullptr;
- }
- return MakeJString(env, val->GetString());
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getRaw
- * Signature: (Ljava/lang/String;)[B
- */
-JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRaw__Ljava_lang_String_2
- (JNIEnv *env, jclass, jstring key)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return nullptr;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsRaw()) {
- keyNotDefinedEx.Throw(env, key);
- return nullptr;
- }
- return MakeJByteArray(env, val->GetRaw());
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getBooleanArray
- * Signature: (Ljava/lang/String;)[Z
- */
-JNIEXPORT jbooleanArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBooleanArray__Ljava_lang_String_2
- (JNIEnv *env, jclass, jstring key)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return nullptr;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsBooleanArray()) {
- keyNotDefinedEx.Throw(env, key);
- return nullptr;
- }
- return MakeJBooleanArray(env, val->GetBooleanArray());
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getDoubleArray
- * Signature: (Ljava/lang/String;)[D
- */
-JNIEXPORT jdoubleArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDoubleArray__Ljava_lang_String_2
- (JNIEnv *env, jclass, jstring key)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return nullptr;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsDoubleArray()) {
- keyNotDefinedEx.Throw(env, key);
- return nullptr;
- }
- return MakeJDoubleArray(env, val->GetDoubleArray());
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getStringArray
- * Signature: (Ljava/lang/String;)[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getStringArray__Ljava_lang_String_2
- (JNIEnv *env, jclass, jstring key)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return nullptr;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsStringArray()) {
- keyNotDefinedEx.Throw(env, key);
- return nullptr;
- }
- return MakeJStringArray(env, val->GetStringArray());
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getValue
- * Signature: (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getValue__Ljava_lang_String_2Ljava_lang_Object_2
- (JNIEnv *env, jclass, jstring key, jobject defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return nullptr;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val) return defaultValue;
- return MakeJObject(env, *val);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getBoolean
- * Signature: (Ljava/lang/String;Z)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBoolean__Ljava_lang_String_2Z
- (JNIEnv *env, jclass, jstring key, jboolean defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsBoolean()) return defaultValue;
- return val->GetBoolean();
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getDouble
- * Signature: (Ljava/lang/String;D)D
- */
-JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDouble__Ljava_lang_String_2D
- (JNIEnv *env, jclass, jstring key, jdouble defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return 0;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsDouble()) return defaultValue;
- return val->GetDouble();
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getString
- * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getString__Ljava_lang_String_2Ljava_lang_String_2
- (JNIEnv *env, jclass, jstring key, jstring defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return nullptr;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsString()) return defaultValue;
- return MakeJString(env, val->GetString());
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getRaw
- * Signature: (Ljava/lang/String;[B)[B
- */
-JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRaw__Ljava_lang_String_2_3B
- (JNIEnv *env, jclass, jstring key, jbyteArray defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return nullptr;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsRaw()) return defaultValue;
- return MakeJByteArray(env, val->GetRaw());
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getBooleanArray
- * Signature: (Ljava/lang/String;[Z)[Z
- */
-JNIEXPORT jbooleanArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBooleanArray__Ljava_lang_String_2_3Z
- (JNIEnv *env, jclass, jstring key, jbooleanArray defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return nullptr;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsBooleanArray()) return defaultValue;
- return MakeJBooleanArray(env, val->GetBooleanArray());
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getDoubleArray
- * Signature: (Ljava/lang/String;[D)[D
- */
-JNIEXPORT jdoubleArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDoubleArray__Ljava_lang_String_2_3D
- (JNIEnv *env, jclass, jstring key, jdoubleArray defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return nullptr;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsDoubleArray()) return defaultValue;
- return MakeJDoubleArray(env, val->GetDoubleArray());
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getStringArray
- * Signature: (Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getStringArray__Ljava_lang_String_2_3Ljava_lang_String_2
- (JNIEnv *env, jclass, jstring key, jobjectArray defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return nullptr;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsStringArray()) return defaultValue;
- return MakeJStringArray(env, val->GetStringArray());
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: setDefaultBoolean
- * Signature: (Ljava/lang/String;Z)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultBoolean
- (JNIEnv *env, jclass, jstring key, jboolean defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- return nt::SetDefaultEntryValue(JStringRef{env, key},
- nt::Value::MakeBoolean(defaultValue != JNI_FALSE));
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: setDefaultDouble
- * Signature: (Ljava/lang/String;D)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultDouble
- (JNIEnv *env, jclass, jstring key, jdouble defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return 0;
- }
- return nt::SetDefaultEntryValue(JStringRef{env, key},
- nt::Value::MakeDouble(defaultValue));
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: setDefaultString
- * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultString
- (JNIEnv *env, jclass, jstring key, jstring defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- if (!defaultValue) {
- nullPointerEx.Throw(env, "defaultValue cannot be null");
- return false;
- }
- return nt::SetDefaultEntryValue(
- JStringRef{env, key},
- nt::Value::MakeString(JStringRef{env, defaultValue}));
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: setDefaultRaw
- * Signature: (Ljava/lang/String;[B)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultRaw
- (JNIEnv *env, jclass, jstring key, jbyteArray defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- if (!defaultValue) {
- nullPointerEx.Throw(env, "defaultValue cannot be null");
- return false;
- }
- auto v = FromJavaRaw(env, defaultValue);
- return nt::SetDefaultEntryValue(JStringRef{env, key}, v);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: setDefaultBooleanArray
- * Signature: (Ljava/lang/String;[Z)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultBooleanArray
- (JNIEnv *env, jclass, jstring key, jbooleanArray defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- if (!defaultValue) {
- nullPointerEx.Throw(env, "defaultValue cannot be null");
- return false;
- }
- auto v = FromJavaBooleanArray(env, defaultValue);
- return nt::SetDefaultEntryValue(JStringRef{env, key}, v);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: setDefaultDoubleArray
- * Signature: (Ljava/lang/String;[D)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultDoubleArray
- (JNIEnv *env, jclass, jstring key, jdoubleArray defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- if (!defaultValue) {
- nullPointerEx.Throw(env, "defaultValue cannot be null");
- return false;
- }
- auto v = FromJavaDoubleArray(env, defaultValue);
- return nt::SetDefaultEntryValue(JStringRef{env, key}, v);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: setDefaultStringArray
- * Signature: (Ljava/lang/String;[Ljava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultStringArray
- (JNIEnv *env, jclass, jstring key, jobjectArray defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return false;
- }
- if (!defaultValue) {
- nullPointerEx.Throw(env, "defaultValue cannot be null");
- return false;
- }
- auto v = FromJavaStringArray(env, defaultValue);
- return nt::SetDefaultEntryValue(JStringRef{env, key}, v);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: setEntryFlags
- * Signature: (Ljava/lang/String;I)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setEntryFlags
- (JNIEnv *env, jclass, jstring key, jint flags)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return;
- }
- nt::SetEntryFlags(JStringRef{env, key}, flags);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getEntryFlags
- * Signature: (Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getEntryFlags
- (JNIEnv *env, jclass, jstring key)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return 0;
- }
- return nt::GetEntryFlags(JStringRef{env, key});
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: deleteEntry
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_deleteEntry
- (JNIEnv *env, jclass, jstring key)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return;
- }
- nt::DeleteEntry(JStringRef{env, key});
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: deleteAllEntries
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_deleteAllEntries
- (JNIEnv *, jclass)
-{
- nt::DeleteAllEntries();
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getEntries
- * Signature: (Ljava/lang/String;I)[Ledu/wpi/first/wpilibj/networktables/EntryInfo;
- */
-JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getEntries
- (JNIEnv *env, jclass, jstring prefix, jint types)
-{
- if (!prefix) {
- nullPointerEx.Throw(env, "prefix cannot be null");
- return nullptr;
- }
- auto arr = nt::GetEntryInfo(JStringRef{env, prefix}, types);
- jobjectArray jarr = env->NewObjectArray(arr.size(), entryInfoCls, nullptr);
- if (!jarr) return nullptr;
- for (size_t i = 0; i < arr.size(); ++i) {
- JLocal<jobject> jelem{env, MakeJObject(env, arr[i])};
- env->SetObjectArrayElement(jarr, i, jelem);
- }
- return jarr;
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: flush
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_flush
- (JNIEnv *, jclass)
-{
- nt::Flush();
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: addEntryListener
- * Signature: (Ljava/lang/String;Ledu/wpi/first/wpilibj/networktables/NetworkTablesJNI/EntryListenerFunction;Z)I
- */
-JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_addEntryListener
- (JNIEnv *envouter, jclass, jstring prefix, jobject listener, jint flags)
-{
- if (!prefix) {
- nullPointerEx.Throw(envouter, "prefix cannot be null");
- return 0;
- }
- if (!listener) {
- nullPointerEx.Throw(envouter, "listener cannot be null");
- return 0;
- }
-
- // the shared pointer to the weak global will keep it around until the
- // entry listener is destroyed
- auto listener_global =
- std::make_shared<JGlobal<jobject>>(envouter, listener);
-
- // cls is a temporary here; cannot be used within callback functor
- jclass cls = envouter->GetObjectClass(listener);
- if (!cls) return 0;
-
- // method ids, on the other hand, are safe to retain
- jmethodID mid = envouter->GetMethodID(
- cls, "apply", "(ILjava/lang/String;Ljava/lang/Object;I)V");
- if (!mid) return 0;
-
- return nt::AddEntryListener(
- JStringRef{envouter, prefix},
- [=](unsigned int uid, nt::StringRef name,
- std::shared_ptr<nt::Value> value, unsigned int flags_) {
- JNIEnv *env = listenerEnv;
- if (!env || !env->functions) return;
-
- // get the handler
- auto handler = listener_global->obj();
-
- // convert the value into the appropriate Java type
- JLocal<jobject> jobj{env, MakeJObject(env, *value)};
- if (env->ExceptionCheck()) {
- env->ExceptionDescribe();
- env->ExceptionClear();
- return;
- }
- if (!jobj) return;
-
- JLocal<jstring> jname{env, MakeJString(env, name)};
- env->CallVoidMethod(handler, mid, (jint)uid, jname.obj(), jobj.obj(),
- (jint)(flags_));
- if (env->ExceptionCheck()) {
- env->ExceptionDescribe();
- env->ExceptionClear();
- }
- },
- flags);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: removeEntryListener
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_removeEntryListener
- (JNIEnv *, jclass, jint entryListenerUid)
-{
- nt::RemoveEntryListener(entryListenerUid);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: addConnectionListener
- * Signature: (Ledu/wpi/first/wpilibj/networktables/NetworkTablesJNI/ConnectionListenerFunction;Z)I
- */
-JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_addConnectionListener
- (JNIEnv *envouter, jclass, jobject listener, jboolean immediateNotify)
-{
- if (!listener) {
- nullPointerEx.Throw(envouter, "listener cannot be null");
- return 0;
- }
-
- // the shared pointer to the weak global will keep it around until the
- // entry listener is destroyed
- auto listener_global =
- std::make_shared<JGlobal<jobject>>(envouter, listener);
-
- // cls is a temporary here; cannot be used within callback functor
- jclass cls = envouter->GetObjectClass(listener);
- if (!cls) return 0;
-
- // method ids, on the other hand, are safe to retain
- jmethodID mid = envouter->GetMethodID(
- cls, "apply", "(IZLedu/wpi/first/wpilibj/networktables/ConnectionInfo;)V");
- if (!mid) return 0;
-
- return nt::AddConnectionListener(
- [=](unsigned int uid, bool connected, const nt::ConnectionInfo& conn) {
- JNIEnv *env = listenerEnv;
- if (!env || !env->functions) return;
-
- // get the handler
- auto handler = listener_global->obj();
- //if (!handler) goto done; // can happen due to weak reference
-
- // convert into the appropriate Java type
- JLocal<jobject> jobj{env, MakeJObject(env, conn)};
- if (env->ExceptionCheck()) {
- env->ExceptionDescribe();
- env->ExceptionClear();
- return;
- }
- if (!jobj) return;
-
- env->CallVoidMethod(handler, mid, (jint)uid,
- (jboolean)(connected ? 1 : 0), jobj.obj());
- if (env->ExceptionCheck()) {
- env->ExceptionDescribe();
- env->ExceptionClear();
- }
- },
- immediateNotify != JNI_FALSE);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: removeConnectionListener
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_removeConnectionListener
- (JNIEnv *, jclass, jint connListenerUid)
-{
- nt::RemoveConnectionListener(connListenerUid);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getRpc
- * Signature: (Ljava/lang/String;)[B
- */
-JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRpc__Ljava_lang_String_2
- (JNIEnv *env, jclass, jstring key)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return nullptr;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsRpc()) {
- keyNotDefinedEx.Throw(env, key);
- return nullptr;
- }
- return MakeJByteArray(env, val->GetRpc());
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getRpc
- * Signature: (Ljava/lang/String;[B)[B
- */
-JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRpc__Ljava_lang_String_2_3B
- (JNIEnv *env, jclass, jstring key, jbyteArray defaultValue)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return nullptr;
- }
- if (!defaultValue) {
- nullPointerEx.Throw(env, "defaultValue cannot be null");
- return nullptr;
- }
- auto val = nt::GetEntryValue(JStringRef{env, key});
- if (!val || !val->IsRpc()) return defaultValue;
- return MakeJByteArray(env, val->GetRpc());
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: callRpc
- * Signature: (Ljava/lang/String;[B)I
- */
-JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_callRpc__Ljava_lang_String_2_3B
- (JNIEnv *env, jclass, jstring key, jbyteArray params)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return 0;
- }
- if (!params) {
- nullPointerEx.Throw(env, "params cannot be null");
- return 0;
- }
- return nt::CallRpc(JStringRef{env, key}, JByteArrayRef{env, params});
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: callRpc
- * Signature: (Ljava/lang/String;Ljava/nio/ByteBuffer;I)I
- */
-JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_callRpc__Ljava_lang_String_2Ljava_nio_ByteBuffer_2I
- (JNIEnv *env, jclass, jstring key, jobject params, jint params_len)
-{
- if (!key) {
- nullPointerEx.Throw(env, "key cannot be null");
- return 0;
- }
- if (!params) {
- nullPointerEx.Throw(env, "params cannot be null");
- return 0;
- }
- return nt::CallRpc(JStringRef{env, key},
- JByteArrayRef{env, params, params_len});
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: setNetworkIdentity
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setNetworkIdentity
- (JNIEnv *env, jclass, jstring name)
-{
- if (!name) {
- nullPointerEx.Throw(env, "name cannot be null");
- return;
- }
- nt::SetNetworkIdentity(JStringRef{env, name});
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: startServer
- * Signature: (Ljava/lang/String;Ljava/lang/String;I)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_startServer
- (JNIEnv *env, jclass, jstring persistFilename, jstring listenAddress,
- jint port)
-{
- if (!persistFilename) {
- nullPointerEx.Throw(env, "persistFilename cannot be null");
- return;
- }
- if (!listenAddress) {
- nullPointerEx.Throw(env, "listenAddress cannot be null");
- return;
- }
- nt::StartServer(JStringRef{env, persistFilename},
- JStringRef{env, listenAddress}.c_str(), port);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: stopServer
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_stopServer
- (JNIEnv *, jclass)
-{
- nt::StopServer();
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: startClient
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_startClient__
- (JNIEnv *env, jclass)
-{
- nt::StartClient();
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: startClient
- * Signature: (Ljava/lang/String;I)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_startClient__Ljava_lang_String_2I
- (JNIEnv *env, jclass, jstring serverName, jint port)
-{
- if (!serverName) {
- nullPointerEx.Throw(env, "serverName cannot be null");
- return;
- }
- nt::StartClient(JStringRef{env, serverName}.c_str(), port);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: startClient
- * Signature: ([Ljava/lang/String;[I)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_startClient___3Ljava_lang_String_2_3I
- (JNIEnv *env, jclass, jobjectArray serverNames, jintArray ports)
-{
- if (!serverNames) {
- nullPointerEx.Throw(env, "serverNames cannot be null");
- return;
- }
- if (!ports) {
- nullPointerEx.Throw(env, "ports cannot be null");
- return;
- }
- int len = env->GetArrayLength(serverNames);
- if (len != env->GetArrayLength(ports)) {
- illegalArgEx.Throw(env,
- "serverNames and ports arrays must be the same size");
- return;
- }
- jint* portInts = env->GetIntArrayElements(ports, nullptr);
- if (!portInts) return;
-
- std::vector<std::string> names;
- std::vector<std::pair<nt::StringRef, unsigned int>> servers;
- names.reserve(len);
- servers.reserve(len);
- for (int i = 0; i < len; ++i) {
- JLocal<jstring> elem{
- env, static_cast<jstring>(env->GetObjectArrayElement(serverNames, i))};
- if (!elem) {
- nullPointerEx.Throw(env, "null string in serverNames");
- return;
- }
- names.emplace_back(JStringRef{env, elem}.str());
- servers.emplace_back(std::make_pair(nt::StringRef(names.back()),
- portInts[i]));
- }
- env->ReleaseIntArrayElements(ports, portInts, JNI_ABORT);
- nt::StartClient(servers);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: stopClient
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_stopClient
- (JNIEnv *, jclass)
-{
- nt::StopClient();
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: setServer
- * Signature: (Ljava/lang/String;I)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setServer__Ljava_lang_String_2I
- (JNIEnv *env, jclass, jstring serverName, jint port)
-{
- if (!serverName) {
- nullPointerEx.Throw(env, "serverName cannot be null");
- return;
- }
- nt::SetServer(JStringRef{env, serverName}.c_str(), port);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: setServer
- * Signature: ([Ljava/lang/String;[I)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setServer___3Ljava_lang_String_2_3I
- (JNIEnv *env, jclass, jobjectArray serverNames, jintArray ports)
-{
- if (!serverNames) {
- nullPointerEx.Throw(env, "serverNames cannot be null");
- return;
- }
- if (!ports) {
- nullPointerEx.Throw(env, "ports cannot be null");
- return;
- }
- int len = env->GetArrayLength(serverNames);
- if (len != env->GetArrayLength(ports)) {
- illegalArgEx.Throw(env,
- "serverNames and ports arrays must be the same size");
- return;
- }
- jint* portInts = env->GetIntArrayElements(ports, nullptr);
- if (!portInts) return;
-
- std::vector<std::string> names;
- std::vector<std::pair<nt::StringRef, unsigned int>> servers;
- names.reserve(len);
- servers.reserve(len);
- for (int i = 0; i < len; ++i) {
- JLocal<jstring> elem{
- env, static_cast<jstring>(env->GetObjectArrayElement(serverNames, i))};
- if (!elem) {
- nullPointerEx.Throw(env, "null string in serverNames");
- return;
- }
- names.emplace_back(JStringRef{env, elem}.str());
- servers.emplace_back(std::make_pair(nt::StringRef(names.back()),
- portInts[i]));
- }
- env->ReleaseIntArrayElements(ports, portInts, JNI_ABORT);
- nt::SetServer(servers);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: startDSClient
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_startDSClient
- (JNIEnv *env, jclass, jint port)
-{
- nt::StartDSClient(port);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: stopDSClient
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_stopDSClient
- (JNIEnv *env, jclass)
-{
- nt::StopDSClient();
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: setUpdateRate
- * Signature: (D)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setUpdateRate
- (JNIEnv *, jclass, jdouble interval)
-{
- nt::SetUpdateRate(interval);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: getConnections
- * Signature: ()[Ledu/wpi/first/wpilibj/networktables/ConnectionInfo;
- */
-JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getConnections
- (JNIEnv *env, jclass)
-{
- auto arr = nt::GetConnections();
- jobjectArray jarr =
- env->NewObjectArray(arr.size(), connectionInfoCls, nullptr);
- if (!jarr) return nullptr;
- for (size_t i = 0; i < arr.size(); ++i) {
- JLocal<jobject> jelem{env, MakeJObject(env, arr[i])};
- env->SetObjectArrayElement(jarr, i, jelem);
- }
- return jarr;
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: savePersistent
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_savePersistent
- (JNIEnv *env, jclass, jstring filename)
-{
- if (!filename) {
- nullPointerEx.Throw(env, "filename cannot be null");
- return;
- }
- const char *err = nt::SavePersistent(JStringRef{env, filename});
- if (err) persistentEx.Throw(env, err);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: loadPersistent
- * Signature: (Ljava/lang/String;)[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_loadPersistent
- (JNIEnv *env, jclass, jstring filename)
-{
- if (!filename) {
- nullPointerEx.Throw(env, "filename cannot be null");
- return nullptr;
- }
- std::vector<std::string> warns;
- const char *err = nt::LoadPersistent(JStringRef{env, filename},
- [&](size_t line, const char *msg) {
- std::ostringstream oss;
- oss << line << ": " << msg;
- warns.push_back(oss.str());
- });
- if (err) {
- persistentEx.Throw(env, err);
- return nullptr;
- }
- return MakeJStringArray(env, warns);
-}
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: now
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_now
- (JNIEnv *, jclass)
-{
- return nt::Now();
-}
-
-} // extern "C"
-
-namespace {
-
-struct LogMessage {
- public:
- LogMessage(unsigned int level, const char *file, unsigned int line,
- const char *msg)
- : m_level(level), m_file(file), m_line(line), m_msg(msg) {}
-
- void CallJava(JNIEnv* env, jobject func, jmethodID mid) {
- JLocal<jstring> file{env, MakeJString(env, m_file)};
- JLocal<jstring> msg{env, MakeJString(env, m_msg)};
- env->CallVoidMethod(func, mid, (jint)m_level, file.obj(),
- (jint)m_line, msg.obj());
- }
-
- static const char* GetName() { return "NTLogger"; }
- static JavaVM* GetJVM() { return jvm; }
-
- private:
- unsigned int m_level;
- const char* m_file;
- unsigned int m_line;
- std::string m_msg;
-};
-
-typedef JSingletonCallbackManager<LogMessage> LoggerJNI;
-
-} // anonymous namespace
-
-ATOMIC_STATIC_INIT(LoggerJNI)
-
-extern "C" {
-
-/*
- * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI
- * Method: setLogger
- * Signature: (Ledu/wpi/first/wpilibj/networktables/NetworkTablesJNI/LoggerFunction;I)V
- */
-JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setLogger
- (JNIEnv *env, jclass, jobject func, jint minLevel)
-{
- if (!func) {
- nullPointerEx.Throw(env, "func cannot be null");
- return;
- }
-
- // cls is a temporary here; cannot be used within callback functor
- jclass cls = env->GetObjectClass(func);
- if (!cls) return;
-
- // method ids, on the other hand, are safe to retain
- jmethodID mid = env->GetMethodID(
- cls, "apply", "(ILjava/lang/String;ILjava/lang/String;)V");
- if (!mid) return;
-
- auto& logger = LoggerJNI::GetInstance();
- logger.Start();
- logger.SetFunc(env, func, mid);
-
- nt::SetLogger(
- [](unsigned int level, const char *file, unsigned int line,
- const char *msg) {
- LoggerJNI::GetInstance().Send(level, file, line, msg);
- },
- minLevel);
-}
-
-} // extern "C"
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/ConnectionInfo.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/ConnectionInfo.java
deleted file mode 100644
index eb1aec9..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/ConnectionInfo.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package edu.wpi.first.wpilibj.networktables;
-
-public class ConnectionInfo {
- public final String remote_id;
- public final String remote_ip;
- public final int remote_port;
- public final long last_update;
- public final int protocol_version;
-
- ConnectionInfo(String remote_id, String remote_ip, int remote_port, long last_update, int protocol_version) {
- this.remote_id = remote_id;
- this.remote_ip = remote_ip;
- this.remote_port = remote_port;
- this.last_update = last_update;
- this.protocol_version = protocol_version;
- }
-}
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/EntryInfo.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/EntryInfo.java
deleted file mode 100644
index b73e0e6..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/EntryInfo.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package edu.wpi.first.wpilibj.networktables;
-
-public class EntryInfo {
- public final String name;
- public final int type;
- public final int flags;
- public final long last_change;
-
- EntryInfo(String name, int type, int flags, long last_change) {
- this.name = name;
- this.type = type;
- this.flags = flags;
- this.last_change = last_change;
- }
-}
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/NetworkTable.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/NetworkTable.java
deleted file mode 100644
index ce28be6..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/NetworkTable.java
+++ /dev/null
@@ -1,1104 +0,0 @@
-package edu.wpi.first.wpilibj.networktables;
-
-import edu.wpi.first.wpilibj.tables.*;
-import edu.wpi.first.wpilibj.networktables2.type.*;
-import java.io.*;
-import java.nio.ByteBuffer;
-import java.util.*;
-
-/**
- * A network table that knows its subtable path.
- */
-public class NetworkTable implements ITable, IRemote {
- /**
- * The path separator for sub-tables and keys
- *
- */
- public static final char PATH_SEPARATOR = '/';
- /**
- * The default port that network tables operates on
- */
- public static final int DEFAULT_PORT = 1735;
-
- private static boolean client = false;
- private static boolean enableDS = true;
- private static boolean running = false;
- private static int port = DEFAULT_PORT;
- private static String persistentFilename = "networktables.ini";
-
- private synchronized static void checkInit() {
- if (running)
- throw new IllegalStateException(
- "Network tables has already been initialized");
- }
-
- /**
- * initializes network tables
- */
- public synchronized static void initialize() {
- if (running)
- shutdown();
- if (client) {
- NetworkTablesJNI.startClient();
- if (enableDS)
- NetworkTablesJNI.startDSClient(port);
- } else
- NetworkTablesJNI.startServer(persistentFilename, "", port);
- running = true;
- }
-
- /**
- * shuts down network tables
- */
- public synchronized static void shutdown() {
- if (!running)
- return;
- if (client) {
- NetworkTablesJNI.stopDSClient();
- NetworkTablesJNI.stopClient();
- } else
- NetworkTablesJNI.stopServer();
- running = false;
- }
-
- /**
- * set that network tables should be a server
- * This must be called before initialize or getTable
- */
- public synchronized static void setServerMode() {
- if (!client)
- return;
- checkInit();
- client = false;
- }
-
- /**
- * set that network tables should be a client
- * This must be called before initialize or getTable
- */
- public synchronized static void setClientMode() {
- if (client)
- return;
- checkInit();
- client = true;
- }
-
- /**
- * set the team the robot is configured for (this will set the mdns address that
- * network tables will connect to in client mode)
- * This must be called before initialize or getTable
- * @param team the team number
- */
- public synchronized static void setTeam(int team) {
- String[] addresses = new String[4];
- addresses[0] = "10." + (int)(team / 100) + "." + (int)(team % 100) + ".2";
- addresses[1] = "172.22.11.2";
- addresses[2] = "roboRIO-" + team + "-FRC.local";
- addresses[3] = "roboRIO-" + team + "-FRC.lan";
- setIPAddress(addresses);
- }
-
- /**
- * @param address the adress that network tables will connect to in client
- * mode
- */
- public synchronized static void setIPAddress(final String address) {
- String[] addresses = new String[1];
- addresses[0] = address;
- setIPAddress(addresses);
- }
-
- /**
- * @param addresses the adresses that network tables will connect to in
- * client mode (in round robin order)
- */
- public synchronized static void setIPAddress(final String[] addresses) {
- int[] ports = new int[addresses.length];
- for (int i=0; i<addresses.length; i++)
- ports[i] = port;
- NetworkTablesJNI.setServer(addresses, ports);
-
- // Stop the DS client if we're explicitly connecting to localhost
- if (addresses.length > 0 &&
- (addresses[0].equals("localhost") || addresses[0].equals("127.0.0.1")))
- NetworkTablesJNI.stopDSClient();
- else if (enableDS)
- NetworkTablesJNI.startDSClient(port);
- }
-
- /**
- * @param aport the port number that network tables will connect to in client
- * mode or listen to in server mode
- */
- public synchronized static void setPort(int aport) {
- if (port == aport)
- return;
- checkInit();
- port = aport;
- }
-
- /**
- * @param enabled whether to enable the connection to the local DS to get
- * the robot IP address (defaults to enabled)
- */
- public synchronized static void setDSClientEnabled(boolean enabled) {
- enableDS = enabled;
- if (enableDS)
- NetworkTablesJNI.startDSClient(port);
- else
- NetworkTablesJNI.stopDSClient();
- }
-
- /**
- * Sets the persistent filename.
- * @param filename the filename that the network tables server uses for
- * automatic loading and saving of persistent values
- */
- public synchronized static void setPersistentFilename(final String filename) {
- if (persistentFilename.equals(filename))
- return;
- checkInit();
- persistentFilename = filename;
- }
-
- /**
- * Sets the network identity.
- * This is provided in the connection info on the remote end.
- * @param name identity
- */
- public static void setNetworkIdentity(String name) {
- NetworkTablesJNI.setNetworkIdentity(name);
- }
-
- public static boolean[] toNative(Boolean[] arr) {
- boolean[] out = new boolean[arr.length];
- for (int i = 0; i < arr.length; i++)
- out[i] = arr[i];
- return out;
- }
-
- public static double[] toNative(Number[] arr) {
- double[] out = new double[arr.length];
- for (int i = 0; i < arr.length; i++)
- out[i] = arr[i].doubleValue();
- return out;
- }
-
- public static Boolean[] fromNative(boolean[] arr) {
- Boolean[] out = new Boolean[arr.length];
- for (int i = 0; i < arr.length; i++)
- out[i] = arr[i];
- return out;
- }
-
- public static Double[] fromNative(double[] arr) {
- Double[] out = new Double[arr.length];
- for (int i = 0; i < arr.length; i++)
- out[i] = arr[i];
- return out;
- }
-
- /**
- * Gets the table with the specified key. If the table does not exist, a new
- *table will be created.<br>
- * This will automatically initialize network tables if it has not been
- *already
- *
- * @param key
- * the key name
- * @return the network table requested
- */
- public synchronized static NetworkTable getTable(String key) {
- if (!running)
- initialize();
- if (key.isEmpty() || key.charAt(0) == PATH_SEPARATOR)
- return new NetworkTable(key);
- return new NetworkTable(PATH_SEPARATOR + key);
- }
-
- private final String path;
- private final String pathWithSep;
-
- NetworkTable(String path) {
- this.path = path;
- this.pathWithSep = path + PATH_SEPARATOR;
- }
- public String toString() { return "NetworkTable: " + path; }
-
- public static ConnectionInfo[] connections() {
- return NetworkTablesJNI.getConnections();
- }
-
- public boolean isConnected() {
- ConnectionInfo[] conns = NetworkTablesJNI.getConnections();
- return conns.length > 0;
- }
-
- public boolean isServer() {
- return !client;
- }
-
- private static class ListenerBase {
- public int uid;
- }
-
- private static class ConnectionListenerAdapter extends ListenerBase implements NetworkTablesJNI.ConnectionListenerFunction {
- private final IRemote targetSource;
- private final IRemoteConnectionListener targetListener;
-
- public ConnectionListenerAdapter(IRemote targetSource, IRemoteConnectionListener targetListener) {
- this.targetSource = targetSource;
- this.targetListener = targetListener;
- }
-
- public void apply(int uid, boolean connected, ConnectionInfo conn) {
- if (connected)
- targetListener.connectedEx(targetSource, conn);
- else
- targetListener.disconnectedEx(targetSource, conn);
- }
- }
-
- private static IRemote staticRemote = new IRemote() {
- public void addConnectionListener(IRemoteConnectionListener listener, boolean immediateNotify) {
- NetworkTable.addGlobalConnectionListener(listener, immediateNotify);
- }
- public void removeConnectionListener(IRemoteConnectionListener listener) {
- NetworkTable.removeGlobalConnectionListener(listener);
- }
- public boolean isConnected() {
- ConnectionInfo[] conns = NetworkTablesJNI.getConnections();
- return conns.length > 0;
- }
- public boolean isServer() {
- return !client;
- }
- };
-
- private static final Hashtable<IRemoteConnectionListener,ConnectionListenerAdapter> globalConnectionListenerMap = new Hashtable<IRemoteConnectionListener,ConnectionListenerAdapter>();
- public static synchronized void addGlobalConnectionListener(IRemoteConnectionListener listener,
- boolean immediateNotify) {
- ConnectionListenerAdapter adapter = globalConnectionListenerMap.get(listener);
- if (adapter != null)
- throw new IllegalStateException("Cannot add the same listener twice");
- adapter = new ConnectionListenerAdapter(staticRemote, listener);
- adapter.uid = NetworkTablesJNI.addConnectionListener(adapter, immediateNotify);
- globalConnectionListenerMap.put(listener, adapter);
- }
-
- public static synchronized void removeGlobalConnectionListener(IRemoteConnectionListener listener) {
- ConnectionListenerAdapter adapter = globalConnectionListenerMap.get(listener);
- if (adapter != null) {
- NetworkTablesJNI.removeConnectionListener(adapter.uid);
- globalConnectionListenerMap.remove(listener);
- }
- }
-
- private final Hashtable<IRemoteConnectionListener,ConnectionListenerAdapter> connectionListenerMap = new Hashtable<IRemoteConnectionListener,ConnectionListenerAdapter>();
- public synchronized void addConnectionListener(IRemoteConnectionListener listener,
- boolean immediateNotify) {
- ConnectionListenerAdapter adapter = connectionListenerMap.get(listener);
- if (adapter != null)
- throw new IllegalStateException("Cannot add the same listener twice");
- adapter = new ConnectionListenerAdapter(this, listener);
- adapter.uid = NetworkTablesJNI.addConnectionListener(adapter, immediateNotify);
- connectionListenerMap.put(listener, adapter);
- }
-
- public synchronized void removeConnectionListener(IRemoteConnectionListener listener) {
- ConnectionListenerAdapter adapter = connectionListenerMap.get(listener);
- if (adapter != null) {
- NetworkTablesJNI.removeConnectionListener(adapter.uid);
- connectionListenerMap.remove(listener);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addTableListener(ITableListener listener) {
- addTableListenerEx(listener, NOTIFY_NEW | NOTIFY_UPDATE);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addTableListener(ITableListener listener,
- boolean immediateNotify) {
- int flags = NOTIFY_NEW | NOTIFY_UPDATE;
- if (immediateNotify)
- flags |= NOTIFY_IMMEDIATE;
- addTableListenerEx(listener, flags);
- }
-
- private class TableListenerAdapter extends ListenerBase implements NetworkTablesJNI.EntryListenerFunction {
- private final int prefixLen;
- private final ITable targetSource;
- private final ITableListener targetListener;
-
- public TableListenerAdapter(int prefixLen, ITable targetSource, ITableListener targetListener) {
- this.prefixLen = prefixLen;
- this.targetSource = targetSource;
- this.targetListener = targetListener;
- }
-
- public void apply(int uid, String key, Object value, int flags) {
- String relativeKey = key.substring(prefixLen);
- if (relativeKey.indexOf(PATH_SEPARATOR) != -1)
- return;
- targetListener.valueChangedEx(targetSource, relativeKey, value, flags);
- }
- }
-
- private final Hashtable<ITableListener,List<ListenerBase>> listenerMap = new Hashtable<ITableListener,List<ListenerBase>>();
- public synchronized void addTableListenerEx(ITableListener listener,
- int flags) {
- List<ListenerBase> adapters = listenerMap.get(listener);
- if (adapters == null) {
- adapters = new ArrayList<ListenerBase>();
- listenerMap.put(listener, adapters);
- }
- TableListenerAdapter adapter =
- new TableListenerAdapter(path.length() + 1, this, listener);
- adapter.uid = NetworkTablesJNI.addEntryListener(pathWithSep, adapter, flags);
- adapters.add(adapter);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addTableListener(String key, ITableListener listener,
- boolean immediateNotify) {
- int flags = NOTIFY_NEW | NOTIFY_UPDATE;
- if (immediateNotify)
- flags |= NOTIFY_IMMEDIATE;
- addTableListenerEx(key, listener, flags);
- }
-
- private class KeyListenerAdapter extends ListenerBase implements NetworkTablesJNI.EntryListenerFunction {
- private final String relativeKey;
- private final String fullKey;
- private final ITable targetSource;
- private final ITableListener targetListener;
-
- public KeyListenerAdapter(String relativeKey, String fullKey, ITable targetSource, ITableListener targetListener) {
- this.relativeKey = relativeKey;
- this.fullKey = fullKey;
- this.targetSource = targetSource;
- this.targetListener = targetListener;
- }
-
- public void apply(int uid, String key, Object value, int flags) {
- if (!key.equals(fullKey))
- return;
- targetListener.valueChangedEx(targetSource, relativeKey, value, flags);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public synchronized void addTableListenerEx(String key,
- ITableListener listener,
- int flags) {
- List<ListenerBase> adapters = listenerMap.get(listener);
- if (adapters == null) {
- adapters = new ArrayList<ListenerBase>();
- listenerMap.put(listener, adapters);
- }
- String fullKey = pathWithSep + key;
- KeyListenerAdapter adapter =
- new KeyListenerAdapter(key, fullKey, this, listener);
- adapter.uid = NetworkTablesJNI.addEntryListener(fullKey, adapter, flags);
- adapters.add(adapter);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addSubTableListener(final ITableListener listener) {
- addSubTableListener(listener, false);
- }
-
- private class SubListenerAdapter extends ListenerBase implements NetworkTablesJNI.EntryListenerFunction {
- private final int prefixLen;
- private final ITable targetSource;
- private final ITableListener targetListener;
- private final Set<String> notifiedTables = new HashSet<String>();
-
- public SubListenerAdapter(int prefixLen, ITable targetSource, ITableListener targetListener) {
- this.prefixLen = prefixLen;
- this.targetSource = targetSource;
- this.targetListener = targetListener;
- }
-
- public void apply(int uid, String key, Object value, int flags) {
- String relativeKey = key.substring(prefixLen);
- int endSubTable = relativeKey.indexOf(PATH_SEPARATOR);
- if (endSubTable == -1)
- return;
- String subTableKey = relativeKey.substring(0, endSubTable);
- if (notifiedTables.contains(subTableKey))
- return;
- notifiedTables.add(subTableKey);
- targetListener.valueChangedEx(targetSource, subTableKey, targetSource.getSubTable(subTableKey), flags);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public synchronized void addSubTableListener(final ITableListener listener,
- boolean localNotify) {
- List<ListenerBase> adapters = listenerMap.get(listener);
- if (adapters == null) {
- adapters = new ArrayList<ListenerBase>();
- listenerMap.put(listener, adapters);
- }
- SubListenerAdapter adapter =
- new SubListenerAdapter(path.length() + 1, this, listener);
- int flags = NOTIFY_NEW | NOTIFY_IMMEDIATE;
- if (localNotify)
- flags |= NOTIFY_LOCAL;
- adapter.uid = NetworkTablesJNI.addEntryListener(pathWithSep, adapter, flags);
- adapters.add(adapter);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public synchronized void removeTableListener(ITableListener listener) {
- List<ListenerBase> adapters = listenerMap.get(listener);
- if (adapters != null) {
- for (int i = 0; i < adapters.size(); ++i)
- NetworkTablesJNI.removeEntryListener(adapters.get(i).uid);
- adapters.clear();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ITable getSubTable(String key) {
- return new NetworkTable(pathWithSep + key);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean containsKey(String key) {
- return NetworkTablesJNI.containsKey(pathWithSep + key);
- }
-
- public boolean containsSubTable(String key) {
- EntryInfo[] entries = NetworkTablesJNI.getEntries(pathWithSep + key + PATH_SEPARATOR, 0);
- return entries.length != 0;
- }
-
- /**
- * @param types bitmask of types; 0 is treated as a "don't care".
- * @return keys currently in the table
- */
- public Set<String> getKeys(int types) {
- Set<String> keys = new HashSet<String>();
- int prefixLen = path.length() + 1;
- for (EntryInfo entry : NetworkTablesJNI.getEntries(pathWithSep, types)) {
- String relativeKey = entry.name.substring(prefixLen);
- if (relativeKey.indexOf(PATH_SEPARATOR) != -1)
- continue;
- keys.add(relativeKey);
- }
- return keys;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Set<String> getKeys() {
- return getKeys(0);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Set<String> getSubTables() {
- Set<String> keys = new HashSet<String>();
- int prefixLen = path.length() + 1;
- for (EntryInfo entry : NetworkTablesJNI.getEntries(pathWithSep, 0)) {
- String relativeKey = entry.name.substring(prefixLen);
- int endSubTable = relativeKey.indexOf(PATH_SEPARATOR);
- if (endSubTable == -1)
- continue;
- keys.add(relativeKey.substring(0, endSubTable));
- }
- return keys;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean putNumber(String key, double value) {
- return NetworkTablesJNI.putDouble(pathWithSep + key, value);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean setDefaultNumber(String key, double defaultValue) {
- return NetworkTablesJNI.setDefaultDouble(pathWithSep + key,
- defaultValue);
- }
-
- /**
- * {@inheritDoc}
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getNumber(String, double)}.
- */
- @Override
- @Deprecated
- public double getNumber(String key) throws TableKeyNotDefinedException {
- return NetworkTablesJNI.getDouble(pathWithSep + key);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public double getNumber(String key, double defaultValue) {
- return NetworkTablesJNI.getDouble(pathWithSep + key, defaultValue);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean putString(String key, String value) {
- return NetworkTablesJNI.putString(pathWithSep + key, value);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean setDefaultString(String key, String defaultValue) {
- return NetworkTablesJNI.setDefaultString(pathWithSep + key,
- defaultValue);
- }
-
- /**
- * {@inheritDoc}
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getString(String, String)}.
- */
- @Override
- @Deprecated
- public String getString(String key) throws TableKeyNotDefinedException {
- return NetworkTablesJNI.getString(pathWithSep + key);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getString(String key, String defaultValue) {
- return NetworkTablesJNI.getString(pathWithSep + key, defaultValue);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean putBoolean(String key, boolean value) {
- return NetworkTablesJNI.putBoolean(pathWithSep + key, value);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean setDefaultBoolean(String key, boolean defaultValue) {
- return NetworkTablesJNI.setDefaultBoolean(pathWithSep + key,
- defaultValue);
- }
-
- /**
- * {@inheritDoc}
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getBoolean(String, boolean)}.
- */
- @Override
- @Deprecated
- public boolean getBoolean(String key) throws TableKeyNotDefinedException {
- return NetworkTablesJNI.getBoolean(pathWithSep + key);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean getBoolean(String key, boolean defaultValue) {
- return NetworkTablesJNI.getBoolean(pathWithSep + key, defaultValue);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean putBooleanArray(String key, boolean[] value) {
- return NetworkTablesJNI.putBooleanArray(pathWithSep + key, value);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean putBooleanArray(String key, Boolean[] value) {
- return putBooleanArray(key, toNative(value));
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean setDefaultBooleanArray(String key, boolean[] defaultValue) {
- return NetworkTablesJNI.setDefaultBooleanArray(pathWithSep + key,
- defaultValue);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean setDefaultBooleanArray(String key, Boolean[] defaultValue) {
- return NetworkTablesJNI.setDefaultBooleanArray(pathWithSep + key,
- toNative(defaultValue));
- }
-
- /**
- * {@inheritDoc}
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getBooleanArray(String, boolean[])}.
- */
- @Override
- @Deprecated
- public boolean[] getBooleanArray(String key) throws TableKeyNotDefinedException {
- return NetworkTablesJNI.getBooleanArray(pathWithSep + key);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean[] getBooleanArray(String key, boolean[] defaultValue) {
- return NetworkTablesJNI.getBooleanArray(pathWithSep + key, defaultValue);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Boolean[] getBooleanArray(String key, Boolean[] defaultValue) {
- try {
- return fromNative(getBooleanArray(key));
- } catch (TableKeyNotDefinedException e) {
- return defaultValue;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean putNumberArray(String key, double[] value) {
- return NetworkTablesJNI.putDoubleArray(pathWithSep + key, value);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean putNumberArray(String key, Double[] value) {
- return putNumberArray(key, toNative(value));
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean setDefaultNumberArray(String key, double[] defaultValue) {
- return NetworkTablesJNI.setDefaultDoubleArray(pathWithSep + key,
- defaultValue);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean setDefaultNumberArray(String key, Double[] defaultValue) {
- return NetworkTablesJNI.setDefaultDoubleArray(pathWithSep + key,
- toNative(defaultValue));
- }
-
- /**
- * {@inheritDoc}
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getNumberArray(String, double[])}.
- */
- @Override
- @Deprecated
- public double[] getNumberArray(String key) throws TableKeyNotDefinedException {
- return NetworkTablesJNI.getDoubleArray(pathWithSep + key);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public double[] getNumberArray(String key, double[] defaultValue) {
- return NetworkTablesJNI.getDoubleArray(pathWithSep + key, defaultValue);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Double[] getNumberArray(String key, Double[] defaultValue) {
- try {
- return fromNative(getNumberArray(key));
- } catch (TableKeyNotDefinedException e) {
- return defaultValue;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean putStringArray(String key, String[] value) {
- return NetworkTablesJNI.putStringArray(pathWithSep + key, value);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean setDefaultStringArray(String key, String[] defaultValue) {
- return NetworkTablesJNI.setDefaultStringArray(pathWithSep + key,
- defaultValue);
- }
-
- /**
- * {@inheritDoc}
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getStringArray(String, String[])}.
- */
- @Override
- @Deprecated
- public String[] getStringArray(String key) throws TableKeyNotDefinedException {
- return NetworkTablesJNI.getStringArray(pathWithSep + key);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String[] getStringArray(String key, String[] defaultValue) {
- return NetworkTablesJNI.getStringArray(pathWithSep + key, defaultValue);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean putRaw(String key, byte[] value) {
- return NetworkTablesJNI.putRaw(pathWithSep + key, value);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean setDefaultRaw(String key, byte[] defaultValue) {
- return NetworkTablesJNI.setDefaultRaw(pathWithSep + key,
- defaultValue);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean putRaw(String key, ByteBuffer value, int len) {
- if (!value.isDirect())
- throw new IllegalArgumentException("must be a direct buffer");
- if (value.capacity() < len)
- throw new IllegalArgumentException("buffer is too small, must be at least " + len);
- return NetworkTablesJNI.putRaw(pathWithSep + key, value, len);
- }
-
- /**
- * {@inheritDoc}
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getRaw(String, byte[])}.
- */
- @Override
- @Deprecated
- public byte[] getRaw(String key) throws TableKeyNotDefinedException {
- return NetworkTablesJNI.getRaw(pathWithSep + key);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public byte[] getRaw(String key, byte[] defaultValue) {
- return NetworkTablesJNI.getRaw(pathWithSep + key, defaultValue);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean putValue(String key, Object value) throws IllegalArgumentException {
- if (value instanceof Boolean)
- return NetworkTablesJNI.putBoolean(pathWithSep + key, ((Boolean)value).booleanValue());
- else if (value instanceof Number)
- return NetworkTablesJNI.putDouble(pathWithSep + key, ((Number)value).doubleValue());
- else if (value instanceof String)
- return NetworkTablesJNI.putString(pathWithSep + key, (String)value);
- else if (value instanceof byte[])
- return NetworkTablesJNI.putRaw(pathWithSep + key, (byte[])value);
- else if (value instanceof boolean[])
- return NetworkTablesJNI.putBooleanArray(pathWithSep + key, (boolean[])value);
- else if (value instanceof double[])
- return NetworkTablesJNI.putDoubleArray(pathWithSep + key, (double[])value);
- else if (value instanceof Boolean[])
- return NetworkTablesJNI.putBooleanArray(pathWithSep + key, toNative((Boolean[])value));
- else if (value instanceof Number[])
- return NetworkTablesJNI.putDoubleArray(pathWithSep + key, toNative((Number[])value));
- else if (value instanceof String[])
- return NetworkTablesJNI.putStringArray(pathWithSep + key, (String[])value);
- else if (value instanceof BooleanArray)
- return NetworkTablesJNI.putBooleanArray(pathWithSep + key, toNative((Boolean[])((ArrayData)value).getDataArray()));
- else if (value instanceof NumberArray)
- return NetworkTablesJNI.putDoubleArray(pathWithSep + key, toNative((Double[])((ArrayData)value).getDataArray()));
- else if (value instanceof StringArray)
- return NetworkTablesJNI.putStringArray(pathWithSep + key, (String[])((ArrayData)value).getDataArray());
- else
- throw new IllegalArgumentException("Value of type " + value.getClass().getName() + " cannot be put into a table");
- }
-
- /**
- * {@inheritDoc}
- * @deprecated Use get*Array functions instead.
- */
- @Override
- @Deprecated
- public void retrieveValue(String key, Object externalData) throws TableKeyNotDefinedException {
- Object value = getValue(key);
- if (value instanceof boolean[] && externalData instanceof BooleanArray)
- ((ArrayData)externalData).setDataArray(fromNative((boolean[])value));
- else if (value instanceof double[] && externalData instanceof NumberArray)
- ((ArrayData)externalData).setDataArray(fromNative((double[])value));
- else if (value instanceof String[] && externalData instanceof StringArray)
- ((ArrayData)externalData).setDataArray((String[])value);
- else
- throw new TableKeyNotDefinedException(key);
- }
-
- /**
- * {@inheritDoc}
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getValue(String, Object)}.
- */
- @Override
- @Deprecated
- public Object getValue(String key) throws TableKeyNotDefinedException {
- return NetworkTablesJNI.getValue(pathWithSep + key);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getValue(String key, Object defaultValue) {
- return NetworkTablesJNI.getValue(pathWithSep + key, defaultValue);
- }
-
- /** The persistent flag value. */
- public static final int PERSISTENT = 1;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setPersistent(String key) {
- setFlags(key, PERSISTENT);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void clearPersistent(String key) {
- clearFlags(key, PERSISTENT);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isPersistent(String key) {
- return (getFlags(key) & PERSISTENT) != 0;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setFlags(String key, int flags) {
- NetworkTablesJNI.setEntryFlags(pathWithSep + key, getFlags(key) | flags);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void clearFlags(String key, int flags) {
- NetworkTablesJNI.setEntryFlags(pathWithSep + key, getFlags(key) & ~flags);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getFlags(String key) {
- return NetworkTablesJNI.getEntryFlags(pathWithSep + key);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void delete(String key) {
- NetworkTablesJNI.deleteEntry(pathWithSep + key);
- }
-
- /**
- * Deletes ALL keys in ALL subtables. Use with caution!
- */
- public static void globalDeleteAll() {
- NetworkTablesJNI.deleteAllEntries();
- }
-
- /**
- * Flushes all updated values immediately to the network.
- * Note: This is rate-limited to protect the network from flooding.
- * This is primarily useful for synchronizing network updates with
- * user code.
- */
- public static void flush() {
- NetworkTablesJNI.flush();
- }
-
- /**
- * Set the periodic update rate.
- *
- * @param interval update interval in seconds (range 0.01 to 1.0)
- */
- public static void setUpdateRate(double interval) {
- NetworkTablesJNI.setUpdateRate(interval);
- }
-
- /**
- * Saves persistent keys to a file. The server does this automatically.
- *
- * @param filename file name
- * @throws PersistentException if error saving file
- */
- public static void savePersistent(String filename) throws PersistentException {
- NetworkTablesJNI.savePersistent(filename);
- }
-
- /**
- * Loads persistent keys from a file. The server does this automatically.
- *
- * @param filename file name
- * @return List of warnings (errors result in an exception instead)
- * @throws PersistentException if error reading file
- */
- public static String[] loadPersistent(String filename) throws PersistentException {
- return NetworkTablesJNI.loadPersistent(filename);
- }
-
- /*
- * Deprecated Methods
- */
-
- /**
- * {@inheritDoc}
- * @deprecated Use {@link #putNumber(String, double)} instead.
- */
- @Override
- @Deprecated
- public boolean putInt(String key, int value) {
- return putNumber(key, value);
- }
-
- /**
- * {@inheritDoc}
- * @deprecated Use {@link #getNumber(String, double)} instead.
- */
- @Override
- @Deprecated
- public int getInt(String key) throws TableKeyNotDefinedException {
- return (int)getNumber(key);
- }
-
- /**
- * {@inheritDoc}
- * @deprecated Use {@link #getNumber(String, double)} instead.
- */
- @Override
- @Deprecated
- public int getInt(String key, int defaultValue) throws TableKeyNotDefinedException {
- try {
- return (int)getNumber(key);
- } catch (NoSuchElementException ex) {
- return defaultValue;
- }
- }
-
- /**
- * {@inheritDoc}
- * @deprecated Use {@link #putNumber(String, double)} instead.
- */
- @Override
- @Deprecated
- public boolean putDouble(String key, double value) {
- return putNumber(key, value);
- }
-
- /**
- * {@inheritDoc}
- * @deprecated Use {@link #getNumber(String, double)} instead.
- */
- @Override
- @Deprecated
- public double getDouble(String key) throws TableKeyNotDefinedException {
- return getNumber(key);
- }
-
- /**
- * {@inheritDoc}
- * @deprecated Use {@link #getNumber(String, double)} instead.
- */
- @Override
- @Deprecated
- public double getDouble(String key, double defaultValue) {
- return getNumber(key, defaultValue);
- }
-}
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/NetworkTableKeyNotDefined.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/NetworkTableKeyNotDefined.java
deleted file mode 100644
index 144094c..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/NetworkTableKeyNotDefined.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package edu.wpi.first.wpilibj.networktables;
-
-import edu.wpi.first.wpilibj.tables.TableKeyNotDefinedException;
-
-/**
- * An exception throw when the lookup a a key-value fails in a {@link NetworkTable}
- *
- * @deprecated to provide backwards compatability for new api
- *
- * @author Mitchell
- *
- */
-@Deprecated
-public class NetworkTableKeyNotDefined extends TableKeyNotDefinedException {
-
- /**
- * @param key the key that was not defined in the table
- */
- public NetworkTableKeyNotDefined(String key) {
- super(key);
- }
-
-}
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/NetworkTablesJNI.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/NetworkTablesJNI.java
deleted file mode 100644
index 0271d51..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/NetworkTablesJNI.java
+++ /dev/null
@@ -1,175 +0,0 @@
-package edu.wpi.first.wpilibj.networktables;
-
-import edu.wpi.first.wpilibj.tables.*;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class NetworkTablesJNI {
- static boolean libraryLoaded = false;
- static File jniLibrary = null;
- static {
- if (!libraryLoaded) {
- try {
- System.loadLibrary("ntcore");
- } catch (UnsatisfiedLinkError e) {
- try {
- String osname = System.getProperty("os.name");
- String resname;
- if (osname.startsWith("Windows"))
- resname = "/Windows/" + System.getProperty("os.arch") + "/";
- else
- resname = "/" + osname + "/" + System.getProperty("os.arch") + "/";
- System.out.println("platform: " + resname);
- if (osname.startsWith("Windows"))
- resname += "ntcore.dll";
- else if (osname.startsWith("Mac"))
- resname += "libntcore.dylib";
- else
- resname += "libntcore.so";
- InputStream is = NetworkTablesJNI.class.getResourceAsStream(resname);
- if (is != null) {
- // create temporary file
- if (System.getProperty("os.name").startsWith("Windows"))
- jniLibrary = File.createTempFile("NetworkTablesJNI", ".dll");
- else if (System.getProperty("os.name").startsWith("Mac"))
- jniLibrary = File.createTempFile("libNetworkTablesJNI", ".dylib");
- else
- jniLibrary = File.createTempFile("libNetworkTablesJNI", ".so");
- // flag for delete on exit
- jniLibrary.deleteOnExit();
- OutputStream os = new FileOutputStream(jniLibrary);
-
- byte[] buffer = new byte[1024];
- int readBytes;
- try {
- while ((readBytes = is.read(buffer)) != -1) {
- os.write(buffer, 0, readBytes);
- }
- } finally {
- os.close();
- is.close();
- }
- System.load(jniLibrary.getAbsolutePath());
- } else {
- System.loadLibrary("ntcore");
- }
- } catch (IOException ex) {
- ex.printStackTrace();
- System.exit(1);
- }
- }
- libraryLoaded = true;
- }
- }
-
- public static native boolean containsKey(String key);
- public static native int getType(String key);
-
- public static native boolean putBoolean(String key, boolean value);
- public static native boolean putDouble(String key, double value);
- public static native boolean putString(String key, String value);
- public static native boolean putRaw(String key, byte[] value);
- public static native boolean putRaw(String key, ByteBuffer value, int len);
- public static native boolean putBooleanArray(String key, boolean[] value);
- public static native boolean putDoubleArray(String key, double[] value);
- public static native boolean putStringArray(String key, String[] value);
-
- public static native void forcePutBoolean(String key, boolean value);
- public static native void forcePutDouble(String key, double value);
- public static native void forcePutString(String key, String value);
- public static native void forcePutRaw(String key, byte[] value);
- public static native void forcePutRaw(String key, ByteBuffer value, int len);
- public static native void forcePutBooleanArray(String key, boolean[] value);
- public static native void forcePutDoubleArray(String key, double[] value);
- public static native void forcePutStringArray(String key, String[] value);
-
- public static native Object getValue(String key) throws TableKeyNotDefinedException;
- public static native boolean getBoolean(String key) throws TableKeyNotDefinedException;
- public static native double getDouble(String key) throws TableKeyNotDefinedException;
- public static native String getString(String key) throws TableKeyNotDefinedException;
- public static native byte[] getRaw(String key) throws TableKeyNotDefinedException;
- public static native boolean[] getBooleanArray(String key) throws TableKeyNotDefinedException;
- public static native double[] getDoubleArray(String key) throws TableKeyNotDefinedException;
- public static native String[] getStringArray(String key) throws TableKeyNotDefinedException;
-
- public static native Object getValue(String key, Object defaultValue);
- public static native boolean getBoolean(String key, boolean defaultValue);
- public static native double getDouble(String key, double defaultValue);
- public static native String getString(String key, String defaultValue);
- public static native byte[] getRaw(String key, byte[] defaultValue);
- public static native boolean[] getBooleanArray(String key, boolean[] defaultValue);
- public static native double[] getDoubleArray(String key, double[] defaultValue);
- public static native String[] getStringArray(String key, String[] defaultValue);
-
- public static native boolean setDefaultBoolean(String key, boolean defaultValue);
- public static native boolean setDefaultDouble(String key, double defaultValue);
- public static native boolean setDefaultString(String key, String defaultValue);
- public static native boolean setDefaultRaw(String key, byte[] defaultValue);
- public static native boolean setDefaultBooleanArray(String key, boolean[] defaultValue);
- public static native boolean setDefaultDoubleArray(String key, double[] defaultValue);
- public static native boolean setDefaultStringArray(String key, String[] defaultValue);
-
- public static native void setEntryFlags(String key, int flags);
- public static native int getEntryFlags(String key);
-
- public static native void deleteEntry(String key);
- public static native void deleteAllEntries();
-
- public static native EntryInfo[] getEntries(String prefix, int types);
-
- public static native void flush();
-
- @FunctionalInterface
- public interface EntryListenerFunction {
- void apply(int uid, String key, Object value, int flags);
- }
- public static native int addEntryListener(String prefix, EntryListenerFunction listener, int flags);
- public static native void removeEntryListener(int entryListenerUid);
-
- @FunctionalInterface
- public interface ConnectionListenerFunction {
- void apply(int uid, boolean connected, ConnectionInfo conn);
- }
- public static native int addConnectionListener(ConnectionListenerFunction listener, boolean immediateNotify);
- public static native void removeConnectionListener(int connListenerUid);
-
- // public static native void createRpc(String key, byte[] def, IRpc rpc);
- // public static native void createRpc(String key, ByteBuffer def, int def_len, IRpc rpc);
- public static native byte[] getRpc(String key) throws TableKeyNotDefinedException;
- public static native byte[] getRpc(String key, byte[] defaultValue);
- public static native int callRpc(String key, byte[] params);
- public static native int callRpc(String key, ByteBuffer params, int params_len);
- // public static native byte[] getRpcResultBlocking(int callUid);
- // public static native byte[] getRpcResultNonblocking(int callUid) throws RpcNoResponseException;
-
- public static native void setNetworkIdentity(String name);
- public static native void startServer(String persistFilename, String listenAddress, int port);
- public static native void stopServer();
- public static native void startClient();
- public static native void startClient(String serverName, int port);
- public static native void startClient(String[] serverNames, int[] ports);
- public static native void stopClient();
- public static native void setServer(String serverName, int port);
- public static native void setServer(String[] serverNames, int[] ports);
- public static native void startDSClient(int port);
- public static native void stopDSClient();
- public static native void setUpdateRate(double interval);
-
- public static native ConnectionInfo[] getConnections();
-
- public static native void savePersistent(String filename) throws PersistentException;
- public static native String[] loadPersistent(String filename) throws PersistentException; // returns warnings
-
- public static native long now();
-
- @FunctionalInterface
- public interface LoggerFunction {
- void apply(int level, String file, int line, String msg);
- }
- public static native void setLogger(LoggerFunction func, int minLevel);
-}
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/PersistentException.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/PersistentException.java
deleted file mode 100644
index 8d521fb..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables/PersistentException.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package edu.wpi.first.wpilibj.networktables;
-
-import java.io.IOException;
-
-/**
- * An exception thrown when persistent load/save fails in a {@link NetworkTable}
- *
- */
-public class PersistentException extends IOException {
-
- /**
- * @param message The error message
- */
- public PersistentException(String message) {
- super(message);
- }
-
-}
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables2/type/ArrayData.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables2/type/ArrayData.java
deleted file mode 100644
index f312532..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables2/type/ArrayData.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package edu.wpi.first.wpilibj.networktables2.type;
-
-/**
- * @deprecated Use ArrayList instead.
- */
-@Deprecated
-public class ArrayData {
- private Object[] data = new Object[0];
-
- protected Object getAsObject(int index) {
- return data[index];
- }
- protected void _set(int index, Object value) {
- data[index] = value;
- }
- protected void _add(Object value) {
- setSize(size() + 1);
- data[size() - 1] = value;
- }
- public void remove(int index) {
- if (index < 0 || index >= size())
- throw new IndexOutOfBoundsException();
- if (index < size() - 1)
- System.arraycopy(data, index + 1, data, index, size() - index - 1);
- setSize(size() - 1);
- }
- public void setSize(int size) {
- if (size == data.length)
- return;
- Object[] newArray = new Object[size];
- if (size < data.length)
- System.arraycopy(data, 0, newArray, 0, size);
- else {
- System.arraycopy(data, 0, newArray, 0, data.length);
- for (int i = data.length; i < newArray.length; ++i)
- newArray[i] = null;
- }
- data = newArray;
- }
- public int size() {
- return data.length;
- }
-
- public Object[] getDataArray() {
- return data;
- }
- public void setDataArray(Object[] value) {
- data = value;
- }
-}
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables2/type/BooleanArray.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables2/type/BooleanArray.java
deleted file mode 100644
index 6fda0ed..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables2/type/BooleanArray.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package edu.wpi.first.wpilibj.networktables2.type;
-
-/**
- * @deprecated Use {@literal ArrayList<Boolean>} instead.
- */
-@Deprecated
-public class BooleanArray extends ArrayData {
- public boolean get(int index) {
- return ((Boolean)getAsObject(index)).booleanValue();
- }
- public void set(int index, boolean value) {
- _set(index, value?Boolean.TRUE:Boolean.FALSE);
- }
- public void add(boolean value) {
- _add(value?Boolean.TRUE:Boolean.FALSE);
- }
-}
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables2/type/NumberArray.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables2/type/NumberArray.java
deleted file mode 100644
index 17394ab..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables2/type/NumberArray.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package edu.wpi.first.wpilibj.networktables2.type;
-
-/**
- * @deprecated Use {@literal ArrayList<Double>} instead.
- */
-@Deprecated
-public class NumberArray extends ArrayData {
- public double get(int index) {
- return ((Double)getAsObject(index)).doubleValue();
- }
- public void set(int index, double value) {
- _set(index, new Double(value));
- }
- public void add(double value) {
- _add(new Double(value));
- }
-}
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables2/type/StringArray.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables2/type/StringArray.java
deleted file mode 100644
index b5a41f3..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/networktables2/type/StringArray.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package edu.wpi.first.wpilibj.networktables2.type;
-
-/**
- * @deprecated Use {@literal ArrayList<String>} instead.
- */
-@Deprecated
-public class StringArray extends ArrayData {
- public String get(int index) {
- return ((String)getAsObject(index));
- }
- public void set(int index, String value) {
- _set(index, value);
- }
- public void add(String value) {
- _add(value);
- }
-}
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/IRemote.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/IRemote.java
deleted file mode 100644
index a79f740..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/IRemote.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package edu.wpi.first.wpilibj.tables;
-
-
-/**
- * Represents an object that has a remote connection
- *
- * @author Mitchell
- *
- */
-public interface IRemote {
- /**
- * Register an object to listen for connection and disconnection events
- *
- * @param listener the listener to be register
- * @param immediateNotify if the listener object should be notified of the current connection state
- */
- public void addConnectionListener(IRemoteConnectionListener listener, boolean immediateNotify);
-
- /**
- * Unregister a listener from connection events
- *
- * @param listener the listener to be unregistered
- */
- public void removeConnectionListener(IRemoteConnectionListener listener);
-
- /**
- * Get the current state of the objects connection
- * @return the current connection state
- */
- public boolean isConnected();
-
- /**
- * If the object is acting as a server
- * @return if the object is a server
- */
- public boolean isServer();
-}
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/IRemoteConnectionListener.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/IRemoteConnectionListener.java
deleted file mode 100644
index 9ca0e5f..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/IRemoteConnectionListener.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package edu.wpi.first.wpilibj.tables;
-
-import edu.wpi.first.wpilibj.networktables.ConnectionInfo;
-
-/**
- * A listener that listens for connection changes in a {@link IRemote} object
- *
- * @author Mitchell
- *
- */
-public interface IRemoteConnectionListener {
- /**
- * Called when an IRemote is connected
- * @param remote the object that connected
- */
- public void connected(IRemote remote);
- /**
- * Called when an IRemote is disconnected
- * @param remote the object that disconnected
- */
- public void disconnected(IRemote remote);
- /**
- * Extended version of connected called when an IRemote is connected.
- * Contains the connection info of the connected remote
- * @param remote the object that connected
- * @param info the connection info for the connected remote
- */
- default public void connectedEx(IRemote remote, ConnectionInfo info) {
- connected(remote);
- }
- /**
- * Extended version of connected called when an IRemote is disconnected.
- * Contains the connection info of the disconnected remote
- * @param remote the object that disconnected
- * @param info the connection info for the disconnected remote
- */
- default public void disconnectedEx(IRemote remote, ConnectionInfo info) {
- disconnected(remote);
- }
-}
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/ITable.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/ITable.java
deleted file mode 100644
index d126cf1..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/ITable.java
+++ /dev/null
@@ -1,628 +0,0 @@
-package edu.wpi.first.wpilibj.tables;
-
-import java.nio.ByteBuffer;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-
-/**
- * A table whose values can be read and written to
- */
-public interface ITable {
-
- /**
- * Checks the table and tells if it contains the specified key
- *
- * @param key the key to search for
- * @return true if the table as a value assigned to the given key
- */
- public boolean containsKey(String key);
-
- /**
- * @param key the key to search for
- * @return true if there is a subtable with the key which contains at least
- * one key/subtable of its own
- */
- public boolean containsSubTable(String key);
-
- /**
- * Returns the table at the specified key. If there is no table at the
- * specified key, it will create a new table
- *
- * @param key the name of the table relative to this one
- * @return a sub table relative to this one
- */
- public ITable getSubTable(String key);
-
- /**
- * @param types bitmask of types; 0 is treated as a "don't care".
- * @return keys currently in the table
- */
- public Set<String> getKeys(int types);
-
- /**
- * @return keys currently in the table
- */
- public Set<String> getKeys();
-
- /**
- * @return subtables currently in the table
- */
- public Set<String> getSubTables();
-
- /**
- * Makes a key's value persistent through program restarts.
- * The key cannot be null.
- *
- * @param key the key name
- */
- public void setPersistent(String key);
-
- /**
- * Stop making a key's value persistent through program restarts.
- * The key cannot be null.
- *
- * @param key the key name
- */
- public void clearPersistent(String key);
-
- /**
- * Returns whether the value is persistent through program restarts.
- * The key cannot be null.
- *
- * @param key the key name
- * @return True if the value is persistent.
- */
- public boolean isPersistent(String key);
-
- /**
- * Sets flags on the specified key in this table. The key can
- * not be null.
- *
- * @param key the key name
- * @param flags the flags to set (bitmask)
- */
- public void setFlags(String key, int flags);
-
- /**
- * Clears flags on the specified key in this table. The key can
- * not be null.
- *
- * @param key the key name
- * @param flags the flags to clear (bitmask)
- */
- public void clearFlags(String key, int flags);
-
- /**
- * Returns the flags for the specified key.
- *
- * @param key the key name
- * @return the flags, or 0 if the key is not defined
- */
- public int getFlags(String key);
-
- /**
- * Deletes the specified key in this table. The key can
- * not be null.
- *
- * @param key the key name
- */
- public void delete(String key);
-
- /**
- * Gets the value associated with a key as an object. If the key does not
- * exist, it will return the default value
- * NOTE: If the value is a double, it will return a Double object,
- * not a primitive. To get the primitive, use
- * {@link #getDouble(String, double)}.
- * @param key the key of the value to look up
- * @return the value associated with the given key
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getValue(String, Object)}.
- */
- @Deprecated
- public Object getValue(String key) throws TableKeyNotDefinedException;
-
- /**
- * Gets the value associated with a key as an object.
- * NOTE: If the value is a double, it will return a Double object,
- * not a primitive. To get the primitive, use
- * {@link #getDouble(String, double)}.
- * @param key the key of the value to look up
- * @param defaultValue the default value if the key is null
- * @return the value associated with the given key
- */
- public Object getValue(String key, Object defaultValue);
-
- /**
- * Put a value in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- * @throws IllegalArgumentException when the value is not supported by the
- * table
- */
- public boolean putValue(String key, Object value)
- throws IllegalArgumentException;
-
- /**
- * Retrieve an array data type from the table.
- * @param key the key to be assigned to
- * @param externalValue the array data type to retreive into
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated Use get*Array functions instead.
- */
- @Deprecated
- public void retrieveValue(String key, Object externalValue) throws TableKeyNotDefinedException;
-
- /**
- * Put a number in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- public boolean putNumber(String key, double value);
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doens't exist.
- * @return False if the table key exists with a different type
- */
- public boolean setDefaultNumber(String key, double defaultValue);
-
- /**
- * Returns the number the key maps to.
- * @param key the key to look up
- * @return the value associated with the given key
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getNumber(String, double)}.
- */
- @Deprecated
- public double getNumber(String key) throws TableKeyNotDefinedException;
- /**
- * Returns the number the key maps to. If the key does not exist or is of
- * different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- */
- public double getNumber(String key, double defaultValue);
-
- /**
- * Put a string in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- public boolean putString(String key, String value);
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doens't exist.
- * @return False if the table key exists with a different type
- */
- public boolean setDefaultString(String key, String defaultValue);
-
- /**
- * Returns the string the key maps to.
- * @param key the key to look up
- * @return the value associated with the given key
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getString(String, String)}.
- */
- @Deprecated
- public String getString(String key) throws TableKeyNotDefinedException;
- /**
- * Returns the string the key maps to. If the key does not exist or is of
- * different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- */
- public String getString(String key, String defaultValue);
-
- /**
- * Put a boolean in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- public boolean putBoolean(String key, boolean value);
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doens't exist.
- * @return False if the table key exists with a different type
- */
- public boolean setDefaultBoolean(String key, boolean defaultValue);
-
- /**
- * Returns the boolean the key maps to.
- * @param key the key to look up
- * @return the value associated with the given key
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getBoolean(String, boolean)}.
- */
- @Deprecated
- public boolean getBoolean(String key) throws TableKeyNotDefinedException;
- /**
- * Returns the boolean the key maps to. If the key does not exist or is of
- * different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- */
- public boolean getBoolean(String key, boolean defaultValue);
-
- /**
- * Put a boolean array in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- public boolean putBooleanArray(String key, boolean[] value);
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doens't exist.
- * @return False if the table key exists with a different type
- */
- public boolean setDefaultBooleanArray(String key, boolean[] defaultValue);
-
- /**
- * Put a boolean array in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- public boolean putBooleanArray(String key, Boolean[] value);
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doens't exist.
- * @return False if the table key exists with a different type
- */
- public boolean setDefaultBooleanArray(String key, Boolean[] defaultValue);
-
- /**
- * Returns the boolean array the key maps to.
- * @param key the key to look up
- * @return the value associated with the given key
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getBooleanArray(String, boolean[])}.
- */
- @Deprecated
- public boolean[] getBooleanArray(String key) throws TableKeyNotDefinedException;
- /**
- * Returns the boolean array the key maps to. If the key does not exist or is
- * of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- */
- public boolean[] getBooleanArray(String key, boolean[] defaultValue);
- /**
- * Returns the boolean array the key maps to. If the key does not exist or is
- * of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- */
- public Boolean[] getBooleanArray(String key, Boolean[] defaultValue);
-
- /**
- * Put a number array in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- public boolean putNumberArray(String key, double[] value);
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doens't exist.
- * @return False if the table key exists with a different type
- */
- public boolean setDefaultNumberArray(String key, double[] defaultValue);
-
- /**
- * Put a number array in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- public boolean putNumberArray(String key, Double[] value);
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doens't exist.
- * @return False if the table key exists with a different type
- */
- public boolean setDefaultNumberArray(String key, Double[] defaultValue);
-
- /**
- * Returns the number array the key maps to.
- * @param key the key to look up
- * @return the value associated with the given key
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getNumberArray(String, double[])}.
- */
- @Deprecated
- public double[] getNumberArray(String key) throws TableKeyNotDefinedException;
- /**
- * Returns the number array the key maps to. If the key does not exist or is
- * of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- */
- public double[] getNumberArray(String key, double[] defaultValue);
- /**
- * Returns the number array the key maps to. If the key does not exist or is
- * of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- */
- public Double[] getNumberArray(String key, Double[] defaultValue);
-
- /**
- * Put a string array in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- public boolean putStringArray(String key, String[] value);
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doens't exist.
- * @return False if the table key exists with a different type
- */
- public boolean setDefaultStringArray(String key, String[] defaultValue);
-
- /**
- * Returns the string array the key maps to.
- * @param key the key to look up
- * @return the value associated with the given key
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getStringArray(String, String[])}.
- */
- @Deprecated
- public String[] getStringArray(String key) throws TableKeyNotDefinedException;
- /**
- * Returns the string array the key maps to. If the key does not exist or is
- * of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- */
- public String[] getStringArray(String key, String[] defaultValue);
-
- /**
- * Put a raw value (byte array) in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @return False if the table key already exists with a different type
- */
- public boolean putRaw(String key, byte[] value);
-
- /**
- * Gets the current value in the table, setting it if it does not exist.
- * @param key the key
- * @param defaultValue the default value to set if key doens't exist.
- * @return False if the table key exists with a different type
- */
- public boolean setDefaultRaw(String key, byte[] defaultValue);
-
- /**
- * Put a raw value (bytes from a byte buffer) in the table
- * @param key the key to be assigned to
- * @param value the value that will be assigned
- * @param len the length of the value
- * @return False if the table key already exists with a different type
- */
- public boolean putRaw(String key, ByteBuffer value, int len);
- /**
- * Returns the raw value (byte array) the key maps to.
- * @param key the key to look up
- * @return the value associated with the given key
- * @throws TableKeyNotDefinedException if there is no value associated with
- * the given key
- * @deprecated This exception-raising method has been replaced by the
- * default-taking method {@link #getRaw(String, byte[])}.
- */
- @Deprecated
- public byte[] getRaw(String key) throws TableKeyNotDefinedException;
- /**
- * Returns the raw value (byte array) the key maps to. If the key does not
- * exist or is of different type, it will return the default value.
- * @param key the key to look up
- * @param defaultValue the value to be returned if no value is found
- * @return the value associated with the given key or the given default value
- * if there is no value associated with the key
- */
- public byte[] getRaw(String key, byte[] defaultValue);
-
- /** Notifier flag values. */
- public static final int NOTIFY_IMMEDIATE = 0x01;
- public static final int NOTIFY_LOCAL = 0x02;
- public static final int NOTIFY_NEW = 0x04;
- public static final int NOTIFY_DELETE = 0x08;
- public static final int NOTIFY_UPDATE = 0x10;
- public static final int NOTIFY_FLAGS = 0x20;
-
- /**
- * Add a listener for changes to the table
- * @param listener the listener to add
- */
- public void addTableListener(ITableListener listener);
- /**
- * Add a listener for changes to the table
- * @param listener the listener to add
- * @param immediateNotify if true then this listener will be notified of all
- * current entries (marked as new)
- */
- public void addTableListener(ITableListener listener,
- boolean immediateNotify);
- /**
- * Add a listener for changes to the table
- * @param listener the listener to add
- * @param flags bitmask specifying desired notifications
- */
- public void addTableListenerEx(ITableListener listener, int flags);
-
- /**
- * Add a listener for changes to a specific key the table
- * @param key the key to listen for
- * @param listener the listener to add
- * @param immediateNotify if true then this listener will be notified of all
- * current entries (marked as new)
- */
- public void addTableListener(String key, ITableListener listener,
- boolean immediateNotify);
- /**
- * Add a listener for changes to a specific key the table
- * @param key the key to listen for
- * @param listener the listener to add
- * @param flags bitmask specifying desired notifications
- */
- public void addTableListenerEx(String key, ITableListener listener,
- int flags);
- /**
- * This will immediately notify the listener of all current sub tables
- * @param listener the listener to notify
- */
- public void addSubTableListener(final ITableListener listener);
- /**
- * This will immediately notify the listener of all current sub tables
- * @param listener the listener to notify
- * @param localNotify if true then this listener will be notified of all
- * local changes in addition to all remote changes
- */
- public void addSubTableListener(final ITableListener listener,
- boolean localNotify);
- /**
- * Remove a listener from receiving table events
- * @param listener the listener to be removed
- */
- public void removeTableListener(ITableListener listener);
-
- /*
- * Deprecated Methods
- */
-
- /**
- * Maps the specified key to the specified value in this table.
- * The key can not be null.
- * The value can be retrieved by calling the get method with a key that is
- * equal to the original key.
- * @param key the key
- * @param value the value
- * @return False if the table key already exists with a different type
- * @throws IllegalArgumentException if key is null
- * @deprecated Use {@link #putNumber(String, double)} instead.
- */
- @Deprecated
- public boolean putInt(String key, int value);
-
- /**
- * Returns the value at the specified key.
- * @param key the key
- * @return the value
- * @throws TableKeyNotDefinedException if there is no value mapped to by the
- * key
- * @throws IllegalArgumentException if the value mapped to by the key is not
- * an int
- * @throws IllegalArgumentException if the key is null
- * @deprecated Use {@link #getNumber(String, double)} instead.
- */
- @Deprecated
- public int getInt(String key) throws TableKeyNotDefinedException;
-
- /**
- * Returns the value at the specified key.
- * @param key the key
- * @param defaultValue the value returned if the key is undefined
- * @return the value
- * @throws IllegalArgumentException if the value mapped to by the key is not
- * an int
- * @throws IllegalArgumentException if the key is null
- * @deprecated Use {@link #getNumber(String, double)} instead.
- */
- @Deprecated
- public int getInt(String key, int defaultValue)
- throws TableKeyNotDefinedException;
-
- /**
- * Maps the specified key to the specified value in this table.
- * The key can not be null.
- * The value can be retrieved by calling the get method with a key that is
- * equal to the original key.
- * @param key the key
- * @param value the value
- * @return False if the table key already exists with a different type
- * @throws IllegalArgumentException if key is null
- * @deprecated Use {@link #putNumber(String, double)} instead.
- */
- @Deprecated
- public boolean putDouble(String key, double value);
-
- /**
- * Returns the value at the specified key.
- * @param key the key
- * @return the value
- * @throws TableKeyNotDefinedException if there is no
- * value mapped to by the key
- * @throws IllegalArgumentException if the value mapped to by the key is not a
- * double
- * @throws IllegalArgumentException if the key is null
- * @deprecated Use {@link #getNumber(String, double)} instead.
- */
- @Deprecated
- public double getDouble(String key) throws TableKeyNotDefinedException;
-
- /**
- * Returns the value at the specified key.
- * @param key the key
- * @param defaultValue the value returned if the key is undefined
- * @return the value
- * @throws IllegalArgumentException if the value mapped to by the key is not a
- * double
- * @throws IllegalArgumentException if the key is null
- * @deprecated Use {@link #getNumber(String, double)} instead.
- */
- @Deprecated
- public double getDouble(String key, double defaultValue);
-}
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/ITableListener.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/ITableListener.java
deleted file mode 100644
index e1d9259..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/ITableListener.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package edu.wpi.first.wpilibj.tables;
-
-/**
- * A listener that listens to changes in values in a {@link ITable}
- *
- * @author Mitchell
- *
- */
-@FunctionalInterface
-public interface ITableListener {
- /**
- * Called when a key-value pair is changed in a {@link ITable}
- * @param source the table the key-value pair exists in
- * @param key the key associated with the value that changed
- * @param value the new value
- * @param isNew true if the key did not previously exist in the table, otherwise it is false
- */
- public void valueChanged(ITable source, String key, Object value, boolean isNew);
-
- /**
- * Extended version of valueChanged. Called when a key-value pair is
- * changed in a {@link ITable}. The default implementation simply calls
- * valueChanged(). If this is overridden, valueChanged() will not be
- * called.
- * @param source the table the key-value pair exists in
- * @param key the key associated with the value that changed
- * @param value the new value
- * @param flags update flags; for example, NOTIFY_NEW if the key did not
- * previously exist in the table
- */
- default public void valueChangedEx(ITable source, String key, Object value, int flags) {
- // NOTIFY_NEW = 0x04
- valueChanged(source, key, value, (flags & 0x04) != 0);
- }
-}
diff --git a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/TableKeyNotDefinedException.java b/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/TableKeyNotDefinedException.java
deleted file mode 100644
index 4ca3a54..0000000
--- a/third_party/ntcore_2017/java/src/edu/wpi/first/wpilibj/tables/TableKeyNotDefinedException.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package edu.wpi.first.wpilibj.tables;
-
-import java.util.NoSuchElementException;
-
-/**
- * An exception throw when the lookup a a key-value fails in a {@link ITable}
- *
- * @author Mitchell
- *
- */
-public class TableKeyNotDefinedException extends NoSuchElementException {
-
- /**
- * @param key the key that was not defined in the table
- */
- public TableKeyNotDefinedException(String key) {
- super("Unknown Table Key: "+key);
- }
-
-}
diff --git a/third_party/ntcore_2017/java/test/Client.java b/third_party/ntcore_2017/java/test/Client.java
deleted file mode 100644
index 7f18690..0000000
--- a/third_party/ntcore_2017/java/test/Client.java
+++ /dev/null
@@ -1,39 +0,0 @@
-import edu.wpi.first.wpilibj.networktables.*;
-import edu.wpi.first.wpilibj.tables.*;
-
-public class Client {
- private static class MyLogger implements NetworkTablesJNI.LoggerFunction {
- public void apply(int level, String file, int line, String msg) {
- System.err.println(msg);
- }
- }
-
- public static void main(String[] args) {
- NetworkTablesJNI.setLogger(new MyLogger(), 0);
- NetworkTable.setIPAddress("127.0.0.1");
- NetworkTable.setPort(10000);
- NetworkTable.setClientMode();
- NetworkTable nt = NetworkTable.getTable("");
- try { Thread.sleep(2000); } catch (InterruptedException e) {}
- try {
- System.out.println("Got foo: " + nt.getNumber("foo"));
- } catch(TableKeyNotDefinedException ex) {
- }
- nt.putBoolean("bar", false);
- nt.setFlags("bar", NetworkTable.PERSISTENT);
- nt.putBoolean("bar2", true);
- nt.putBoolean("bar2", false);
- nt.putBoolean("bar2", true);
- nt.putString("str", "hello world");
- double[] nums = new double[3];
- nums[0] = 0.5;
- nums[1] = 1.2;
- nums[2] = 3.0;
- nt.putNumberArray("numarray", nums);
- String[] strs = new String[2];
- strs[0] = "Hello";
- strs[1] = "World";
- nt.putStringArray("strarray", strs);
- try { Thread.sleep(10000); } catch (InterruptedException e) {}
- }
-}
diff --git a/third_party/ntcore_2017/java/test/Server.java b/third_party/ntcore_2017/java/test/Server.java
deleted file mode 100644
index 33844fb..0000000
--- a/third_party/ntcore_2017/java/test/Server.java
+++ /dev/null
@@ -1,26 +0,0 @@
-import edu.wpi.first.wpilibj.networktables.*;
-import edu.wpi.first.wpilibj.tables.*;
-
-public class Server {
- private static class MyLogger implements NetworkTablesJNI.LoggerFunction {
- public void apply(int level, String file, int line, String msg) {
- System.err.println(msg);
- }
- }
-
- public static void main(String[] args) {
- NetworkTablesJNI.setLogger(new MyLogger(), 0);
- NetworkTable.setIPAddress("127.0.0.1");
- NetworkTable.setPort(10000);
- NetworkTable.setServerMode();
- NetworkTable nt = NetworkTable.getTable("");
- try { Thread.sleep(1000); } catch (InterruptedException e) {}
- nt.putNumber("foo", 0.5);
- nt.setFlags("foo", NetworkTable.PERSISTENT);
- nt.putNumber("foo2", 0.5);
- nt.putNumber("foo2", 0.7);
- nt.putNumber("foo2", 0.6);
- nt.putNumber("foo2", 0.5);
- try { Thread.sleep(10000); } catch (InterruptedException e) {}
- }
-}
diff --git a/third_party/ntcore_2017/license.txt b/third_party/ntcore_2017/license.txt
deleted file mode 100644
index 5d3484b..0000000
--- a/third_party/ntcore_2017/license.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-* Copyright (c) 2009-2016 FIRST
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the FIRST nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY FIRST AND CONTRIBUTORS``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR
-* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/third_party/ntcore_2017/ntcore-jni.def b/third_party/ntcore_2017/ntcore-jni.def
deleted file mode 100644
index 1486064..0000000
--- a/third_party/ntcore_2017/ntcore-jni.def
+++ /dev/null
@@ -1,196 +0,0 @@
-LIBRARY NTCORE
-EXPORTS
-NT_GetEntryValue @1
-NT_SetEntryValue @2
-NT_SetEntryTypeValue @3
-NT_SetEntryFlags @4
-NT_GetEntryFlags @5
-NT_DeleteEntry @6
-NT_DeleteAllEntries @7
-NT_GetEntryInfo @8
-NT_Flush @9
-NT_AddEntryListener @10
-NT_RemoveEntryListener @11
-NT_AddConnectionListener @12
-NT_RemoveConnectionListener @13
-NT_SetNetworkIdentity @18
-NT_StartServer @19
-NT_StopServer @20
-NT_StartClient @21
-NT_StopClient @22
-NT_SetUpdateRate @23
-NT_GetConnections @24
-NT_SavePersistent @25
-NT_LoadPersistent @26
-NT_DisposeValue @27
-NT_InitValue @28
-NT_DisposeString @29
-NT_InitString @30
-NT_DisposeConnectionInfoArray @31
-NT_Now @32
-NT_SetLogger @33
-NT_CreateRpc @34
-NT_CreatePolledRpc @35
-NT_PollRpc @36
-NT_PostRpcResponse @37
-NT_CallRpc @38
-NT_GetRpcResult @39
-NT_PackRpcDefinition @40
-NT_UnpackRpcDefinition @41
-NT_PackRpcValues @42
-NT_UnpackRpcValues @43
-NT_DisposeRpcDefinition @44
-NT_DisposeRpcCallInfo @45
-NT_GetType @46
-NT_AllocateDoubleArray @47
-NT_AllocateBooleanArray @48
-NT_AllocateStringArray @49
-NT_FreeDoubleArray @51
-NT_FreeBooleanArray @52
-NT_FreeStringArray @53
-NT_GetValueType @54
-NT_GetValueBoolean @55
-NT_GetValueDouble @56
-NT_GetValueString @57
-NT_GetValueRaw @58
-NT_GetValueBooleanArray @59
-NT_GetValueDoubleArray @60
-NT_GetValueStringArray @61
-NT_GetEntryBoolean @62
-NT_GetEntryDouble @63
-NT_GetEntryString @64
-NT_GetEntryRaw @65
-NT_GetEntryBooleanArray @66
-NT_GetEntryDoubleArray @67
-NT_GetEntryStringArray @68
-NT_SetEntryDouble @69
-NT_SetEntryBoolean @70
-NT_SetEntryString @71
-NT_SetEntryRaw @72
-NT_SetEntryBooleanArray @73
-NT_SetEntryDoubleArray @74
-NT_SetEntryStringArray @75
-NT_DisposeEntryInfoArray @76
-NT_AllocateCharArray @77
-NT_FreeCharArray @78
-NT_NotifierDestroyed @79
-NT_StopRpcServer @80
-NT_StopNotifier @81
-NT_SetListenerOnStart @82
-NT_SetListenerOnExit @83
-NT_SetRpcServerOnStart @84
-NT_SetRpcServerOnExit @85
-NT_StartClientMulti @86
-
-NT_SetDefaultEntryValue @87
-NT_SetDefaultEntryBoolean @88
-NT_SetDefaultEntryDouble @89
-NT_SetDefaultEntryString @90
-NT_SetDefaultEntryRaw @91
-NT_SetDefaultEntryBooleanArray @92
-NT_SetDefaultEntryDoubleArray @93
-NT_SetDefaultEntryStringArray @94
-NT_PollRpcTimeout @95
-NT_GetRpcResultTimeout @96
-NT_CancelBlockingRpcResult @97
-
-NT_GetStringForTesting @98
-NT_GetEntryInfoForTesting @99
-NT_FreeEntryInfoForTesting @101
-NT_GetConnectionInfoForTesting @102
-NT_FreeConnectionInfoForTesting @103
-NT_GetValueBooleanForTesting @104
-NT_GetValueDoubleForTesting @105
-NT_GetValueStringForTesting @106
-NT_GetValueRawForTesting @107
-NT_GetValueBooleanArrayForTesting @108
-NT_GetValueDoubleArrayForTesting @109
-NT_GetValueStringArrayForTesting @110
-NT_GetRpcParamDefForTesting @111
-NT_FreeRpcParamDefForTesting @112
-NT_GetRpcResultsDefForTesting @113
-NT_FreeRpcResultsDefForTesting @114
-NT_GetRpcDefinitionForTesting @115
-NT_GetRpcCallInfoForTesting @116
-
-NT_SetServer @117
-NT_SetServerMulti @118
-NT_StartDSClient @119
-NT_StopDSClient @120
-NT_StartClientNone @121
-
-; JNI functions
-JNI_OnLoad
-JNI_OnUnload
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_containsKey
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getType
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putBoolean
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putDouble
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putString
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putRaw__Ljava_lang_String_2_3B
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putRaw__Ljava_lang_String_2Ljava_nio_ByteBuffer_2I
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putBooleanArray
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putDoubleArray
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putStringArray
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutBoolean
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutDouble
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutString
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutRaw__Ljava_lang_String_2_3B
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutRaw__Ljava_lang_String_2Ljava_nio_ByteBuffer_2I
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutBooleanArray
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutDoubleArray
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutStringArray
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getValue__Ljava_lang_String_2
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBoolean__Ljava_lang_String_2
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDouble__Ljava_lang_String_2
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getString__Ljava_lang_String_2
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRaw__Ljava_lang_String_2
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBooleanArray__Ljava_lang_String_2
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDoubleArray__Ljava_lang_String_2
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getStringArray__Ljava_lang_String_2
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getValue__Ljava_lang_String_2Ljava_lang_Object_2
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBoolean__Ljava_lang_String_2Z
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDouble__Ljava_lang_String_2D
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getString__Ljava_lang_String_2Ljava_lang_String_2
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRaw__Ljava_lang_String_2_3B
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBooleanArray__Ljava_lang_String_2_3Z
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDoubleArray__Ljava_lang_String_2_3D
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getStringArray__Ljava_lang_String_2_3Ljava_lang_String_2
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setEntryFlags
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getEntryFlags
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_deleteEntry
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_deleteAllEntries
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getEntries
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_flush
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_addEntryListener
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_removeEntryListener
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_addConnectionListener
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_removeConnectionListener
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRpc__Ljava_lang_String_2
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRpc__Ljava_lang_String_2_3B
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_callRpc__Ljava_lang_String_2_3B
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_callRpc__Ljava_lang_String_2Ljava_nio_ByteBuffer_2I
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setNetworkIdentity
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_startServer
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_stopServer
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_startClient__
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_startClient__Ljava_lang_String_2I
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_startClient___3Ljava_lang_String_2_3I
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_stopClient
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setServer__Ljava_lang_String_2I
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setServer___3Ljava_lang_String_2_3I
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_startDSClient
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_stopDSClient
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setUpdateRate
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getConnections
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_savePersistent
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_loadPersistent
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_now
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setLogger
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultBoolean
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultDouble
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultString
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultRaw
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultBooleanArray
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultDoubleArray
-Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultStringArray
diff --git a/third_party/ntcore_2017/ntcore.def b/third_party/ntcore_2017/ntcore.def
deleted file mode 100644
index 73157c3..0000000
--- a/third_party/ntcore_2017/ntcore.def
+++ /dev/null
@@ -1,120 +0,0 @@
-LIBRARY NTCORE
-EXPORTS
-NT_GetEntryValue @1
-NT_SetEntryValue @2
-NT_SetEntryTypeValue @3
-NT_SetEntryFlags @4
-NT_GetEntryFlags @5
-NT_DeleteEntry @6
-NT_DeleteAllEntries @7
-NT_GetEntryInfo @8
-NT_Flush @9
-NT_AddEntryListener @10
-NT_RemoveEntryListener @11
-NT_AddConnectionListener @12
-NT_RemoveConnectionListener @13
-NT_SetNetworkIdentity @18
-NT_StartServer @19
-NT_StopServer @20
-NT_StartClient @21
-NT_StopClient @22
-NT_SetUpdateRate @23
-NT_GetConnections @24
-NT_SavePersistent @25
-NT_LoadPersistent @26
-NT_DisposeValue @27
-NT_InitValue @28
-NT_DisposeString @29
-NT_InitString @30
-NT_DisposeConnectionInfoArray @31
-NT_Now @32
-NT_SetLogger @33
-NT_CreateRpc @34
-NT_CreatePolledRpc @35
-NT_PollRpc @36
-NT_PostRpcResponse @37
-NT_CallRpc @38
-NT_GetRpcResult @39
-NT_PackRpcDefinition @40
-NT_UnpackRpcDefinition @41
-NT_PackRpcValues @42
-NT_UnpackRpcValues @43
-NT_DisposeRpcDefinition @44
-NT_DisposeRpcCallInfo @45
-NT_GetType @46
-NT_AllocateDoubleArray @47
-NT_AllocateBooleanArray @48
-NT_AllocateStringArray @49
-NT_FreeDoubleArray @51
-NT_FreeBooleanArray @52
-NT_FreeStringArray @53
-NT_GetValueType @54
-NT_GetValueBoolean @55
-NT_GetValueDouble @56
-NT_GetValueString @57
-NT_GetValueRaw @58
-NT_GetValueBooleanArray @59
-NT_GetValueDoubleArray @60
-NT_GetValueStringArray @61
-NT_GetEntryBoolean @62
-NT_GetEntryDouble @63
-NT_GetEntryString @64
-NT_GetEntryRaw @65
-NT_GetEntryBooleanArray @66
-NT_GetEntryDoubleArray @67
-NT_GetEntryStringArray @68
-NT_SetEntryDouble @69
-NT_SetEntryBoolean @70
-NT_SetEntryString @71
-NT_SetEntryRaw @72
-NT_SetEntryBooleanArray @73
-NT_SetEntryDoubleArray @74
-NT_SetEntryStringArray @75
-NT_DisposeEntryInfoArray @76
-NT_AllocateCharArray @77
-NT_FreeCharArray @78
-NT_NotifierDestroyed @79
-NT_StopRpcServer @80
-NT_StopNotifier @81
-NT_SetListenerOnStart @82
-NT_SetListenerOnExit @83
-NT_SetRpcServerOnStart @84
-NT_SetRpcServerOnExit @85
-NT_StartClientMulti @86
-
-NT_SetDefaultEntryValue @87
-NT_SetDefaultEntryBoolean @88
-NT_SetDefaultEntryDouble @89
-NT_SetDefaultEntryString @90
-NT_SetDefaultEntryRaw @91
-NT_SetDefaultEntryBooleanArray @92
-NT_SetDefaultEntryDoubleArray @93
-NT_SetDefaultEntryStringArray @94
-NT_PollRpcTimeout @95
-NT_GetRpcResultTimeout @96
-NT_CancelBlockingRpcResult @97
-
-NT_GetStringForTesting @98
-NT_GetEntryInfoForTesting @99
-NT_FreeEntryInfoForTesting @101
-NT_GetConnectionInfoForTesting @102
-NT_FreeConnectionInfoForTesting @103
-NT_GetValueBooleanForTesting @104
-NT_GetValueDoubleForTesting @105
-NT_GetValueStringForTesting @106
-NT_GetValueRawForTesting @107
-NT_GetValueBooleanArrayForTesting @108
-NT_GetValueDoubleArrayForTesting @109
-NT_GetValueStringArrayForTesting @110
-NT_GetRpcParamDefForTesting @111
-NT_FreeRpcParamDefForTesting @112
-NT_GetRpcResultsDefForTesting @113
-NT_FreeRpcResultsDefForTesting @114
-NT_GetRpcDefinitionForTesting @115
-NT_GetRpcCallInfoForTesting @116
-
-NT_SetServer @117
-NT_SetServerMulti @118
-NT_StartDSClient @119
-NT_StopDSClient @120
-NT_StartClientNone @121
diff --git a/third_party/ntcore_2017/ntcore.gradle b/third_party/ntcore_2017/ntcore.gradle
deleted file mode 100644
index 39fb71e..0000000
--- a/third_party/ntcore_2017/ntcore.gradle
+++ /dev/null
@@ -1,173 +0,0 @@
-def ntcoreSetupModel = { project ->
- project.model {
- components {
- ntcore(NativeLibrarySpec) {
- if (project.isArm) {
- targetPlatform 'arm'
- } else {
- targetPlatform 'x86'
- targetPlatform 'x64'
- }
- setupDefines(project, binaries)
-
- if (includeJava) {
- project.setupJniIncludes(binaries)
- project.checkNativeSymbols(project.getNativeJNISymbols)
- binaries.all {
- project.setupDef(linker, "${rootDir}/ntcore-jni.def")
- }
- } else {
- binaries.all {
- project.setupDef(linker, "${rootDir}/ntcore.def")
- }
- }
-
- sources {
- cpp {
- source {
- srcDirs = ["${rootDir}/src"]
- if (includeJava) {
- srcDirs "${rootDir}/java/lib"
- }
- includes = ['**/*.cpp']
- }
- exportedHeaders {
- srcDirs = ["${rootDir}/include"]
- if (includeJava) {
- project.jniHeadersNetworkTables.outputs.files.each { file ->
- srcDirs file.getPath()
- }
- }
- includes = ['**/*.h']
- }
- if (project.isArm && project.hasProperty('compilerPrefix')) {
- lib project: ':arm:wpiutil', library: 'wpiutil', linkage: 'static'
- } else if (project.isArm) {
- // If roboRIO, link shared
- lib project: ':arm:wpiutil', library: 'wpiutil', linkage: 'shared'
- } else {
- lib project: ':native:wpiutil', library: 'wpiutil', linkage: 'static'
- }
- }
- }
- }
- }
- }
-}
-
-def ntcoreZipTask = { project ->
- project.ext.ntcoreZip = project.tasks.create("ntcoreZip", Zip) {
- description = 'Creates platform-specific zip of the desktop ntcore libraries.'
- group = 'WPILib'
- destinationDir = project.buildDir
- baseName = 'ntcore'
- if (project.isArm && project.hasProperty('compilerPrefix')
- && project.hasProperty('armSuffix')) {
- classifier = "${project.buildPlatform}${project.armSuffix}"
- } else {
- classifier = "${project.buildPlatform}"
- }
- duplicatesStrategy = 'exclude'
-
- from(file('include')) {
- into 'include'
- }
-
- if (!project.hasProperty('skipJava')) {
- project.jniHeadersNetworkTables.outputs.each {
- from(it) {
- into 'include'
- }
- }
- }
-
- project.model {
- binaries {
- withType(StaticLibraryBinarySpec) { binary ->
- from(binary.staticLibraryFile) {
- into getPlatformPath(binary)
- }
- }
- withType(SharedLibraryBinarySpec) { binary ->
- from(binary.sharedLibraryFile) {
- into getPlatformPath(binary)
- }
- from(new File(binary.sharedLibraryFile.absolutePath + ".debug")) {
- into getPlatformPath(binary)
- }
- }
- }
- }
- }
-
- project.build.dependsOn project.ntcoreZip
-
- project.debugStripSetup()
-
- project.tasks.whenTaskAdded { task ->
- def name = task.name.toLowerCase()
- if (name.contains("ntcoresharedlibrary") || name.contains("ntcorestaticlibrary") || name.contains("ntcoretest")) {
- project.ntcoreZip.dependsOn task
- }
- }
-}
-
-if (buildArm) {
- project(':arm:ntcore') {
- apply plugin: 'cpp'
-
- apply from: "${rootDir}/toolchains/arm.gradle"
- if (includeJava) {
- apply from: "${rootDir}/java/java.gradle"
- }
-
- ntcoreSetupModel(project)
- ntcoreZipTask(project)
- }
-}
-
-project(':native:ntcore') {
- apply plugin: 'cpp'
-
- apply from: "${rootDir}/toolchains/native.gradle"
-
- if (!project.hasProperty("withoutTests")) {
- apply from: "${rootDir}/test/tests.gradle"
- }
-
- if (includeJava) {
- apply from: "${rootDir}/java/java.gradle"
- }
-
- ntcoreSetupModel(project)
- ntcoreZipTask(project)
-}
-
-task ntcoreSourceZip(type: Zip) {
- description = 'Creates a sources-zip of the ntcore source files'
- group = 'WPILib'
- destinationDir = project.buildDir
- baseName = 'ntcore'
- classifier = "sources"
- duplicatesStrategy = 'exclude'
-
- from('src') {
- into 'src'
- }
-
- from('include') {
- into 'include'
- }
-
- if (includeJava) {
- from('java/lib') {
- into 'src'
- }
-
- project(':native:ntcore').jniHeadersNetworkTables.outputs.each {
- from(it) {
- into 'include'
- }
- }
- }
-}
diff --git a/third_party/ntcore_2017/publish.gradle b/third_party/ntcore_2017/publish.gradle
deleted file mode 100644
index 63d7243..0000000
--- a/third_party/ntcore_2017/publish.gradle
+++ /dev/null
@@ -1,132 +0,0 @@
-import org.gradle.internal.os.OperatingSystem
-
-apply plugin: 'maven-publish'
-apply plugin: 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin'
-
-def getVersion = {
- if (WPILibVersion.version.contains('-'))
- return WPILibVersion.version.substring(WPILibVersion.version.indexOf('-'))
- else
- return ""
-}
-
-if (!hasProperty('releaseType')) {
- WPILibVersion {
- releaseType = 'dev'
- }
-}
-
-def ntVersion
-def utilVersion
-if (project.hasProperty("ntPublishVersion")) {
- ntVersion = project.ntPublishVersion
-} else {
- ntVersion = WPILibVersion.version
-}
-
-if (project.hasProperty("utilPublishVersion")) {
- utilVersion = project.utilPublishVersion
-} else {
- utilVersion = "1.0.2${-> getVersion()}"
-}
-
-def utilFile = file("$buildDir/wpiutil.txt")
-def ntcoreFile = file("$buildDir/ntcore.txt")
-
-task outputVersions() {
- description = 'Prints the versions of ntcore and wpiutil to a file for use by the downstream packaging project'
- group = 'Build'
- outputs.files(utilFile, ntcoreFile)
-
- doFirst {
- buildDir.mkdir()
- }
-
- doLast {
- utilFile.write utilVersion
- ntcoreFile.write ntVersion
- }
-}
-
-task clean(type: Delete) {
- delete utilFile
- delete ntcoreFile
-}
-
-outputVersions.mustRunAfter clean
-
-project(':native:wpiutil').build.dependsOn outputVersions
-project(':native:ntcore').build.dependsOn outputVersions
-if (project.buildArm) {
- project(':arm:wpiutil').build.dependsOn outputVersions
- project(':arm:ntcore').build.dependsOn outputVersions
-}
-
-
-
-// We change what repo we publish to depending on whether this is a development, beta, stable, or full
-// release. This is set up in the main gradle file.
-publishing {
- publications {
- def nat = project('native:ntcore')
- if (!project.hasProperty('skipJava')) {
- java(MavenPublication) {
- artifact nat.jar
- artifact nat.networktablesJavaSource
- artifact nat.networktablesJavadoc
- if (project.buildArm) {
- def natArm = project('arm:ntcore')
- artifact natArm.jar
- // If the library is not embedded include it in the repo
- if (!project.hasProperty('compilerPrefix')) {
- artifact natArm.ntcoreZip
- }
- }
-
- if (project.hasProperty('makeDesktop')) {
- artifact nat.jar, {
- classifier = 'desktop'
- }
- }
-
- groupId 'edu.wpi.first.wpilib.networktables.java'
- artifactId 'NetworkTables'
- version ntVersion
- }
- }
- cpp(MavenPublication) {
- artifact nat.ntcoreZip
- artifact ntcoreSourceZip
- if (project.buildArm) {
- artifact project(':arm:ntcore').ntcoreZip
- }
-
- if (project.hasProperty('makeDesktop')) {
- artifact nat.ntcoreZip, {
- classifier = 'desktop'
- }
- }
-
- groupId 'edu.wpi.first.wpilib.networktables.cpp'
- artifactId 'NetworkTables'
- version ntVersion
- }
- wpiutil(MavenPublication) {
- artifact project(':native:wpiutil').wpiutilZip
- artifact wpiutilSourceZip
- if (project.buildArm) {
- artifact project(':arm:wpiutil').wpiutilZip
- }
-
- if (project.hasProperty('makeDesktop')) {
- artifact project(':native:wpiutil').wpiutilZip, {
- classifier = 'desktop'
- }
- }
-
- groupId 'edu.wpi.first.wpilib'
- artifactId 'wpiutil'
- version utilVersion
- }
- }
-}
diff --git a/third_party/ntcore_2017/settings.gradle b/third_party/ntcore_2017/settings.gradle
deleted file mode 100644
index 1a4c2aa..0000000
--- a/third_party/ntcore_2017/settings.gradle
+++ /dev/null
@@ -1,8 +0,0 @@
-include 'native:ntcore'
-include 'native:wpiutil'
-include 'gmock'
-
-if (!hasProperty('skipArm')) {
- include 'arm:ntcore'
- include 'arm:wpiutil'
-}
diff --git a/third_party/ntcore_2017/src/Dispatcher.cpp b/third_party/ntcore_2017/src/Dispatcher.cpp
deleted file mode 100644
index c65514b..0000000
--- a/third_party/ntcore_2017/src/Dispatcher.cpp
+++ /dev/null
@@ -1,561 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Dispatcher.h"
-
-#include <algorithm>
-#include <iterator>
-
-#include "Log.h"
-#include "tcpsockets/TCPAcceptor.h"
-#include "tcpsockets/TCPConnector.h"
-
-using namespace nt;
-
-ATOMIC_STATIC_INIT(Dispatcher)
-
-void Dispatcher::StartServer(llvm::StringRef persist_filename,
- const char* listen_address, unsigned int port) {
- DispatcherBase::StartServer(
- persist_filename,
- std::unique_ptr<wpi::NetworkAcceptor>(new wpi::TCPAcceptor(
- static_cast<int>(port), listen_address, Logger::GetInstance())));
-}
-
-void Dispatcher::SetServer(const char* server_name, unsigned int port) {
- std::string server_name_copy(server_name);
- SetConnector([=]() -> std::unique_ptr<wpi::NetworkStream> {
- return wpi::TCPConnector::connect(server_name_copy.c_str(),
- static_cast<int>(port),
- Logger::GetInstance(), 1);
- });
-}
-
-void Dispatcher::SetServer(
- ArrayRef<std::pair<StringRef, unsigned int>> servers) {
- std::vector<Connector> connectors;
- for (const auto& server : servers) {
- std::string server_name(server.first);
- unsigned int port = server.second;
- connectors.emplace_back([=]() -> std::unique_ptr<wpi::NetworkStream> {
- return wpi::TCPConnector::connect(server_name.c_str(),
- static_cast<int>(port),
- Logger::GetInstance(), 1);
- });
- }
- SetConnector(std::move(connectors));
-}
-
-void Dispatcher::SetServerOverride(const char* server_name, unsigned int port) {
- std::string server_name_copy(server_name);
- SetConnectorOverride([=]() -> std::unique_ptr<wpi::NetworkStream> {
- return wpi::TCPConnector::connect(server_name_copy.c_str(),
- static_cast<int>(port),
- Logger::GetInstance(), 1);
- });
-}
-
-void Dispatcher::ClearServerOverride() { ClearConnectorOverride(); }
-
-Dispatcher::Dispatcher()
- : Dispatcher(Storage::GetInstance(), Notifier::GetInstance()) {}
-
-DispatcherBase::DispatcherBase(Storage& storage, Notifier& notifier)
- : m_storage(storage), m_notifier(notifier) {
- m_active = false;
- m_update_rate = 100;
-}
-
-DispatcherBase::~DispatcherBase() {
- Logger::GetInstance().SetLogger(nullptr);
- Stop();
-}
-
-void DispatcherBase::StartServer(
- StringRef persist_filename,
- std::unique_ptr<wpi::NetworkAcceptor> acceptor) {
- {
- std::lock_guard<std::mutex> lock(m_user_mutex);
- if (m_active) return;
- m_active = true;
- }
- m_server = true;
- m_persist_filename = persist_filename;
- m_server_acceptor = std::move(acceptor);
-
- // Load persistent file. Ignore errors, but pass along warnings.
- if (!persist_filename.empty()) {
- bool first = true;
- m_storage.LoadPersistent(
- persist_filename, [&](std::size_t line, const char* msg) {
- if (first) {
- first = false;
- WARNING("When reading initial persistent values from '"
- << persist_filename << "':");
- }
- WARNING(persist_filename << ":" << line << ": " << msg);
- });
- }
-
- using namespace std::placeholders;
- m_storage.SetOutgoing(std::bind(&Dispatcher::QueueOutgoing, this, _1, _2, _3),
- m_server);
-
- m_dispatch_thread = std::thread(&Dispatcher::DispatchThreadMain, this);
- m_clientserver_thread = std::thread(&Dispatcher::ServerThreadMain, this);
-}
-
-void DispatcherBase::StartClient() {
- {
- std::lock_guard<std::mutex> lock(m_user_mutex);
- if (m_active) return;
- m_active = true;
- }
- m_server = false;
- using namespace std::placeholders;
- m_storage.SetOutgoing(std::bind(&Dispatcher::QueueOutgoing, this, _1, _2, _3),
- m_server);
-
- m_dispatch_thread = std::thread(&Dispatcher::DispatchThreadMain, this);
- m_clientserver_thread = std::thread(&Dispatcher::ClientThreadMain, this);
-}
-
-void DispatcherBase::Stop() {
- m_active = false;
-
- // wake up dispatch thread with a flush
- m_flush_cv.notify_one();
-
- // wake up client thread with a reconnect
- {
- std::lock_guard<std::mutex> lock(m_user_mutex);
- m_client_connectors.resize(0);
- }
- ClientReconnect();
-
- // wake up server thread by shutting down the socket
- if (m_server_acceptor) m_server_acceptor->shutdown();
-
- // join threads, with timeout
- if (m_dispatch_thread.joinable()) m_dispatch_thread.join();
- if (m_clientserver_thread.joinable()) m_clientserver_thread.join();
-
- std::vector<std::shared_ptr<NetworkConnection>> conns;
- {
- std::lock_guard<std::mutex> lock(m_user_mutex);
- conns.swap(m_connections);
- }
-
- // close all connections
- conns.resize(0);
-}
-
-void DispatcherBase::SetUpdateRate(double interval) {
- // don't allow update rates faster than 10 ms or slower than 1 second
- if (interval < 0.01)
- interval = 0.01;
- else if (interval > 1.0)
- interval = 1.0;
- m_update_rate = static_cast<unsigned int>(interval * 1000);
-}
-
-void DispatcherBase::SetIdentity(llvm::StringRef name) {
- std::lock_guard<std::mutex> lock(m_user_mutex);
- m_identity = name;
-}
-
-void DispatcherBase::Flush() {
- auto now = std::chrono::steady_clock::now();
- {
- std::lock_guard<std::mutex> lock(m_flush_mutex);
- // don't allow flushes more often than every 10 ms
- if ((now - m_last_flush) < std::chrono::milliseconds(10)) return;
- m_last_flush = now;
- m_do_flush = true;
- }
- m_flush_cv.notify_one();
-}
-
-std::vector<ConnectionInfo> DispatcherBase::GetConnections() const {
- std::vector<ConnectionInfo> conns;
- if (!m_active) return conns;
-
- std::lock_guard<std::mutex> lock(m_user_mutex);
- for (auto& conn : m_connections) {
- if (conn->state() != NetworkConnection::kActive) continue;
- conns.emplace_back(conn->info());
- }
-
- return conns;
-}
-
-void DispatcherBase::NotifyConnections(
- ConnectionListenerCallback callback) const {
- std::lock_guard<std::mutex> lock(m_user_mutex);
- for (const auto& conn : m_connections) conn->NotifyIfActive(callback);
-}
-
-void DispatcherBase::SetConnector(Connector connector) {
- std::vector<Connector> connectors;
- connectors.push_back(connector);
- SetConnector(std::move(connectors));
-}
-
-void DispatcherBase::SetConnector(std::vector<Connector>&& connectors) {
- std::lock_guard<std::mutex> lock(m_user_mutex);
- m_client_connectors = std::move(connectors);
-}
-
-void DispatcherBase::SetConnectorOverride(Connector connector) {
- std::lock_guard<std::mutex> lock(m_user_mutex);
- m_client_connector_override = std::move(connector);
-}
-
-void DispatcherBase::ClearConnectorOverride() {
- std::lock_guard<std::mutex> lock(m_user_mutex);
- m_client_connector_override = nullptr;
-}
-
-void DispatcherBase::DispatchThreadMain() {
- auto timeout_time = std::chrono::steady_clock::now();
-
- static const auto save_delta_time = std::chrono::seconds(1);
- auto next_save_time = timeout_time + save_delta_time;
-
- int count = 0;
-
- while (m_active) {
- // handle loop taking too long
- auto start = std::chrono::steady_clock::now();
- if (start > timeout_time) timeout_time = start;
-
- // wait for periodic or when flushed
- timeout_time += std::chrono::milliseconds(m_update_rate);
- std::unique_lock<std::mutex> flush_lock(m_flush_mutex);
- m_flush_cv.wait_until(flush_lock, timeout_time,
- [&] { return !m_active || m_do_flush; });
- m_do_flush = false;
- flush_lock.unlock();
- if (!m_active) break; // in case we were woken up to terminate
-
- // perform periodic persistent save
- if (m_server && !m_persist_filename.empty() && start > next_save_time) {
- next_save_time += save_delta_time;
- // handle loop taking too long
- if (start > next_save_time) next_save_time = start + save_delta_time;
- const char* err = m_storage.SavePersistent(m_persist_filename, true);
- if (err) WARNING("periodic persistent save: " << err);
- }
-
- {
- std::lock_guard<std::mutex> user_lock(m_user_mutex);
- bool reconnect = false;
-
- if (++count > 10) {
- DEBUG("dispatch running " << m_connections.size() << " connections");
- count = 0;
- }
-
- for (auto& conn : m_connections) {
- // post outgoing messages if connection is active
- // only send keep-alives on client
- if (conn->state() == NetworkConnection::kActive)
- conn->PostOutgoing(!m_server);
-
- // if client, reconnect if connection died
- if (!m_server && conn->state() == NetworkConnection::kDead)
- reconnect = true;
- }
- // reconnect if we disconnected (and a reconnect is not in progress)
- if (reconnect && !m_do_reconnect) {
- m_do_reconnect = true;
- m_reconnect_cv.notify_one();
- }
- }
- }
-}
-
-void DispatcherBase::QueueOutgoing(std::shared_ptr<Message> msg,
- NetworkConnection* only,
- NetworkConnection* except) {
- std::lock_guard<std::mutex> user_lock(m_user_mutex);
- for (auto& conn : m_connections) {
- if (conn.get() == except) continue;
- if (only && conn.get() != only) continue;
- auto state = conn->state();
- if (state != NetworkConnection::kSynchronized &&
- state != NetworkConnection::kActive)
- continue;
- conn->QueueOutgoing(msg);
- }
-}
-
-void DispatcherBase::ServerThreadMain() {
- if (m_server_acceptor->start() != 0) {
- m_active = false;
- return;
- }
- while (m_active) {
- auto stream = m_server_acceptor->accept();
- if (!stream) {
- m_active = false;
- return;
- }
- if (!m_active) return;
- DEBUG("server: client connection from " << stream->getPeerIP() << " port "
- << stream->getPeerPort());
-
- // add to connections list
- using namespace std::placeholders;
- auto conn = std::make_shared<NetworkConnection>(
- std::move(stream), m_notifier,
- std::bind(&Dispatcher::ServerHandshake, this, _1, _2, _3),
- std::bind(&Storage::GetEntryType, &m_storage, _1));
- conn->set_process_incoming(
- std::bind(&Storage::ProcessIncoming, &m_storage, _1, _2,
- std::weak_ptr<NetworkConnection>(conn)));
- {
- std::lock_guard<std::mutex> lock(m_user_mutex);
- // reuse dead connection slots
- bool placed = false;
- for (auto& c : m_connections) {
- if (c->state() == NetworkConnection::kDead) {
- c = conn;
- placed = true;
- break;
- }
- }
- if (!placed) m_connections.emplace_back(conn);
- conn->Start();
- }
- }
-}
-
-void DispatcherBase::ClientThreadMain() {
- std::size_t i = 0;
- while (m_active) {
- // sleep between retries
- std::this_thread::sleep_for(std::chrono::milliseconds(250));
- Connector connect;
-
- // get next server to connect to
- {
- std::lock_guard<std::mutex> lock(m_user_mutex);
- if (m_client_connector_override) {
- connect = m_client_connector_override;
- } else {
- if (m_client_connectors.empty()) continue;
- if (i >= m_client_connectors.size()) i = 0;
- connect = m_client_connectors[i++];
- }
- }
-
- // try to connect (with timeout)
- DEBUG("client trying to connect");
- auto stream = connect();
- if (!stream) continue; // keep retrying
- DEBUG("client connected");
-
- std::unique_lock<std::mutex> lock(m_user_mutex);
- using namespace std::placeholders;
- auto conn = std::make_shared<NetworkConnection>(
- std::move(stream), m_notifier,
- std::bind(&Dispatcher::ClientHandshake, this, _1, _2, _3),
- std::bind(&Storage::GetEntryType, &m_storage, _1));
- conn->set_process_incoming(
- std::bind(&Storage::ProcessIncoming, &m_storage, _1, _2,
- std::weak_ptr<NetworkConnection>(conn)));
- m_connections.resize(0); // disconnect any current
- m_connections.emplace_back(conn);
- conn->set_proto_rev(m_reconnect_proto_rev);
- conn->Start();
-
- // reconnect the next time starting with latest protocol revision
- m_reconnect_proto_rev = 0x0300;
-
- // block until told to reconnect
- m_do_reconnect = false;
- m_reconnect_cv.wait(lock, [&] { return !m_active || m_do_reconnect; });
- }
-}
-
-bool DispatcherBase::ClientHandshake(
- NetworkConnection& conn, std::function<std::shared_ptr<Message>()> get_msg,
- std::function<void(llvm::ArrayRef<std::shared_ptr<Message>>)> send_msgs) {
- // get identity
- std::string self_id;
- {
- std::lock_guard<std::mutex> lock(m_user_mutex);
- self_id = m_identity;
- }
-
- // send client hello
- DEBUG("client: sending hello");
- send_msgs(Message::ClientHello(self_id));
-
- // wait for response
- auto msg = get_msg();
- if (!msg) {
- // disconnected, retry
- DEBUG("client: server disconnected before first response");
- return false;
- }
-
- if (msg->Is(Message::kProtoUnsup)) {
- if (msg->id() == 0x0200) ClientReconnect(0x0200);
- return false;
- }
-
- bool new_server = true;
- if (conn.proto_rev() >= 0x0300) {
- // should be server hello; if not, disconnect.
- if (!msg->Is(Message::kServerHello)) return false;
- conn.set_remote_id(msg->str());
- if ((msg->flags() & 1) != 0) new_server = false;
- // get the next message
- msg = get_msg();
- }
-
- // receive initial assignments
- std::vector<std::shared_ptr<Message>> incoming;
- for (;;) {
- if (!msg) {
- // disconnected, retry
- DEBUG("client: server disconnected during initial entries");
- return false;
- }
- DEBUG4("received init str=" << msg->str() << " id=" << msg->id()
- << " seq_num=" << msg->seq_num_uid());
- if (msg->Is(Message::kServerHelloDone)) break;
- // shouldn't receive a keep alive, but handle gracefully
- if (msg->Is(Message::kKeepAlive)) {
- msg = get_msg();
- continue;
- }
- if (!msg->Is(Message::kEntryAssign)) {
- // unexpected message
- DEBUG("client: received message ("
- << msg->type()
- << ") other than entry assignment during initial handshake");
- return false;
- }
- incoming.emplace_back(std::move(msg));
- // get the next message
- msg = get_msg();
- }
-
- // generate outgoing assignments
- NetworkConnection::Outgoing outgoing;
-
- m_storage.ApplyInitialAssignments(conn, incoming, new_server, &outgoing);
-
- if (conn.proto_rev() >= 0x0300)
- outgoing.emplace_back(Message::ClientHelloDone());
-
- if (!outgoing.empty()) send_msgs(outgoing);
-
- INFO("client: CONNECTED to server " << conn.stream().getPeerIP() << " port "
- << conn.stream().getPeerPort());
- return true;
-}
-
-bool DispatcherBase::ServerHandshake(
- NetworkConnection& conn, std::function<std::shared_ptr<Message>()> get_msg,
- std::function<void(llvm::ArrayRef<std::shared_ptr<Message>>)> send_msgs) {
- // Wait for the client to send us a hello.
- auto msg = get_msg();
- if (!msg) {
- DEBUG("server: client disconnected before sending hello");
- return false;
- }
- if (!msg->Is(Message::kClientHello)) {
- DEBUG("server: client initial message was not client hello");
- return false;
- }
-
- // Check that the client requested version is not too high.
- unsigned int proto_rev = msg->id();
- if (proto_rev > 0x0300) {
- DEBUG("server: client requested proto > 0x0300");
- send_msgs(Message::ProtoUnsup());
- return false;
- }
-
- if (proto_rev >= 0x0300) conn.set_remote_id(msg->str());
-
- // Set the proto version to the client requested version
- DEBUG("server: client protocol " << proto_rev);
- conn.set_proto_rev(proto_rev);
-
- // Send initial set of assignments
- NetworkConnection::Outgoing outgoing;
-
- // Start with server hello. TODO: initial connection flag
- if (proto_rev >= 0x0300) {
- std::lock_guard<std::mutex> lock(m_user_mutex);
- outgoing.emplace_back(Message::ServerHello(0u, m_identity));
- }
-
- // Get snapshot of initial assignments
- m_storage.GetInitialAssignments(conn, &outgoing);
-
- // Finish with server hello done
- outgoing.emplace_back(Message::ServerHelloDone());
-
- // Batch transmit
- DEBUG("server: sending initial assignments");
- send_msgs(outgoing);
-
- // In proto rev 3.0 and later, the handshake concludes with a client hello
- // done message, so we can batch the assigns before marking the connection
- // active. In pre-3.0, we need to just immediately mark it active and hand
- // off control to the dispatcher to assign them as they arrive.
- if (proto_rev >= 0x0300) {
- // receive client initial assignments
- std::vector<std::shared_ptr<Message>> incoming;
- msg = get_msg();
- for (;;) {
- if (!msg) {
- // disconnected, retry
- DEBUG("server: disconnected waiting for initial entries");
- return false;
- }
- if (msg->Is(Message::kClientHelloDone)) break;
- // shouldn't receive a keep alive, but handle gracefully
- if (msg->Is(Message::kKeepAlive)) {
- msg = get_msg();
- continue;
- }
- if (!msg->Is(Message::kEntryAssign)) {
- // unexpected message
- DEBUG("server: received message ("
- << msg->type()
- << ") other than entry assignment during initial handshake");
- return false;
- }
- incoming.push_back(msg);
- // get the next message (blocks)
- msg = get_msg();
- }
- for (auto& msg : incoming)
- m_storage.ProcessIncoming(msg, &conn, std::weak_ptr<NetworkConnection>());
- }
-
- INFO("server: client CONNECTED: " << conn.stream().getPeerIP() << " port "
- << conn.stream().getPeerPort());
- return true;
-}
-
-void DispatcherBase::ClientReconnect(unsigned int proto_rev) {
- if (m_server) return;
- {
- std::lock_guard<std::mutex> lock(m_user_mutex);
- m_reconnect_proto_rev = proto_rev;
- m_do_reconnect = true;
- }
- m_reconnect_cv.notify_one();
-}
diff --git a/third_party/ntcore_2017/src/Dispatcher.h b/third_party/ntcore_2017/src/Dispatcher.h
deleted file mode 100644
index 2bfa228..0000000
--- a/third_party/ntcore_2017/src/Dispatcher.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NT_DISPATCHER_H_
-#define NT_DISPATCHER_H_
-
-#include <atomic>
-#include <chrono>
-#include <condition_variable>
-#include <functional>
-#include <memory>
-#include <mutex>
-#include <string>
-#include <vector>
-
-#include "llvm/StringRef.h"
-
-#include "support/atomic_static.h"
-#include "NetworkConnection.h"
-#include "Notifier.h"
-#include "Storage.h"
-
-namespace wpi {
-class NetworkAcceptor;
-class NetworkStream;
-}
-
-namespace nt {
-
-class DispatcherBase {
- friend class DispatcherTest;
-
- public:
- typedef std::function<std::unique_ptr<wpi::NetworkStream>()> Connector;
-
- virtual ~DispatcherBase();
-
- void StartServer(llvm::StringRef persist_filename,
- std::unique_ptr<wpi::NetworkAcceptor> acceptor);
- void StartClient();
- void Stop();
- void SetUpdateRate(double interval);
- void SetIdentity(llvm::StringRef name);
- void Flush();
- std::vector<ConnectionInfo> GetConnections() const;
- void NotifyConnections(ConnectionListenerCallback callback) const;
-
- void SetConnector(Connector connector);
- void SetConnector(std::vector<Connector>&& connectors);
-
- void SetConnectorOverride(Connector connector);
- void ClearConnectorOverride();
-
- bool active() const { return m_active; }
-
- DispatcherBase(const DispatcherBase&) = delete;
- DispatcherBase& operator=(const DispatcherBase&) = delete;
-
- protected:
- DispatcherBase(Storage& storage, Notifier& notifier);
-
- private:
- void DispatchThreadMain();
- void ServerThreadMain();
- void ClientThreadMain();
-
- bool ClientHandshake(
- NetworkConnection& conn,
- std::function<std::shared_ptr<Message>()> get_msg,
- std::function<void(llvm::ArrayRef<std::shared_ptr<Message>>)> send_msgs);
- bool ServerHandshake(
- NetworkConnection& conn,
- std::function<std::shared_ptr<Message>()> get_msg,
- std::function<void(llvm::ArrayRef<std::shared_ptr<Message>>)> send_msgs);
-
- void ClientReconnect(unsigned int proto_rev = 0x0300);
-
- void QueueOutgoing(std::shared_ptr<Message> msg, NetworkConnection* only,
- NetworkConnection* except);
-
- Storage& m_storage;
- Notifier& m_notifier;
- bool m_server = false;
- std::string m_persist_filename;
- std::thread m_dispatch_thread;
- std::thread m_clientserver_thread;
-
- std::unique_ptr<wpi::NetworkAcceptor> m_server_acceptor;
- Connector m_client_connector_override;
- std::vector<Connector> m_client_connectors;
-
- // Mutex for user-accessible items
- mutable std::mutex m_user_mutex;
- std::vector<std::shared_ptr<NetworkConnection>> m_connections;
- std::string m_identity;
-
- std::atomic_bool m_active; // set to false to terminate threads
- std::atomic_uint m_update_rate; // periodic dispatch update rate, in ms
-
- // Condition variable for forced dispatch wakeup (flush)
- std::mutex m_flush_mutex;
- std::condition_variable m_flush_cv;
- std::chrono::steady_clock::time_point m_last_flush;
- bool m_do_flush = false;
-
- // Condition variable for client reconnect (uses user mutex)
- std::condition_variable m_reconnect_cv;
- unsigned int m_reconnect_proto_rev = 0x0300;
- bool m_do_reconnect = true;
-};
-
-class Dispatcher : public DispatcherBase {
- friend class DispatcherTest;
-
- public:
- static Dispatcher& GetInstance() {
- ATOMIC_STATIC(Dispatcher, instance);
- return instance;
- }
-
- void StartServer(StringRef persist_filename, const char* listen_address,
- unsigned int port);
-
- void SetServer(const char* server_name, unsigned int port);
- void SetServer(ArrayRef<std::pair<StringRef, unsigned int>> servers);
-
- void SetServerOverride(const char* server_name, unsigned int port);
- void ClearServerOverride();
-
- private:
- Dispatcher();
- Dispatcher(Storage& storage, Notifier& notifier)
- : DispatcherBase(storage, notifier) {}
-
- ATOMIC_STATIC_DECL(Dispatcher)
-};
-
-} // namespace nt
-
-#endif // NT_DISPATCHER_H_
diff --git a/third_party/ntcore_2017/src/DsClient.cpp b/third_party/ntcore_2017/src/DsClient.cpp
deleted file mode 100644
index 1e2c5c2..0000000
--- a/third_party/ntcore_2017/src/DsClient.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "DsClient.h"
-
-#include "llvm/raw_ostream.h"
-#include "llvm/SmallString.h"
-#include "support/raw_socket_istream.h"
-#include "tcpsockets/TCPConnector.h"
-
-#include "Dispatcher.h"
-#include "Log.h"
-
-using namespace nt;
-
-ATOMIC_STATIC_INIT(DsClient)
-
-class DsClient::Thread : public wpi::SafeThread {
- public:
- Thread(unsigned int port) : m_port(port) {}
-
- void Main();
-
- unsigned int m_port;
- std::unique_ptr<wpi::NetworkStream> m_stream;
-};
-
-void DsClient::Start(unsigned int port) {
- auto thr = m_owner.GetThread();
- if (!thr)
- m_owner.Start(new Thread(port));
- else
- thr->m_port = port;
-}
-
-void DsClient::Stop() {
- {
- // Close the stream so the read (if any) terminates.
- auto thr = m_owner.GetThread();
- if (thr) {
- thr->m_active = false;
- if (thr->m_stream) thr->m_stream->close();
- }
- }
- m_owner.Stop();
-}
-
-void DsClient::Thread::Main() {
- unsigned int oldip = 0;
- wpi::Logger nolog; // to silence log messages from TCPConnector
-
- while (m_active) {
- // wait for periodic reconnect or termination
- auto timeout_time =
- std::chrono::steady_clock::now() + std::chrono::milliseconds(500);
- unsigned int port;
- {
- std::unique_lock<std::mutex> lock(m_mutex);
- m_cond.wait_until(lock, timeout_time, [&] { return !m_active; });
- port = m_port;
- }
- if (!m_active) goto done;
-
- // Try to connect to DS on the local machine
- m_stream =
- wpi::TCPConnector::connect("127.0.0.1", 1742, nolog, 1);
- if (!m_active) goto done;
- if (!m_stream) continue;
-
- DEBUG3("connected to DS");
- wpi::raw_socket_istream is(*m_stream);
-
- while (m_active && !is.has_error()) {
- // Read JSON "{...}". This is very limited, does not handle quoted "}" or
- // nested {}, but is sufficient for this purpose.
- llvm::SmallString<128> json;
- char ch;
-
- // Throw away characters until {
- do {
- is.read(ch);
- if (is.has_error()) break;
- if (!m_active) goto done;
- } while (ch != '{');
- json += '{';
-
- if (is.has_error()) {
- m_stream = nullptr;
- break;
- }
-
- // Read characters until }
- do {
- is.read(ch);
- if (is.has_error()) break;
- if (!m_active) goto done;
- json += ch;
- } while (ch != '}');
-
- if (is.has_error()) {
- m_stream = nullptr;
- break;
- }
- DEBUG3("json=" << json);
-
- // Look for "robotIP":12345, and get 12345 portion
- size_t pos = json.find("\"robotIP\"");
- if (pos == llvm::StringRef::npos) continue; // could not find?
- pos += 9;
- pos = json.find(':', pos);
- if (pos == llvm::StringRef::npos) continue; // could not find?
- size_t endpos = json.find_first_not_of("0123456789", pos + 1);
- DEBUG3("found robotIP=" << json.slice(pos + 1, endpos));
-
- // Parse into number
- unsigned int ip;
- if (json.slice(pos + 1, endpos).getAsInteger(10, ip)) continue; // error
-
- // If zero, clear the server override
- if (ip == 0) {
- Dispatcher::GetInstance().ClearServerOverride();
- oldip = 0;
- continue;
- }
-
- // If unchanged, don't reconnect
- if (ip == oldip) continue;
- oldip = ip;
-
- // Convert number into dotted quad
- json.clear();
- llvm::raw_svector_ostream os{json};
- os << ((ip >> 24) & 0xff) << "." << ((ip >> 16) & 0xff) << "."
- << ((ip >> 8) & 0xff) << "." << (ip & 0xff);
- INFO("client: DS overriding server IP to " << os.str());
- Dispatcher::GetInstance().SetServerOverride(json.c_str(), port);
- }
-
- // We disconnected from the DS, clear the server override
- Dispatcher::GetInstance().ClearServerOverride();
- oldip = 0;
- }
-
-done:
- Dispatcher::GetInstance().ClearServerOverride();
-}
diff --git a/third_party/ntcore_2017/src/DsClient.h b/third_party/ntcore_2017/src/DsClient.h
deleted file mode 100644
index 9dd905c..0000000
--- a/third_party/ntcore_2017/src/DsClient.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NT_DSCLIENT_H_
-#define NT_DSCLIENT_H_
-
-#include "support/atomic_static.h"
-#include "support/SafeThread.h"
-
-namespace nt {
-
-class DsClient {
- public:
- static DsClient& GetInstance() {
- ATOMIC_STATIC(DsClient, instance);
- return instance;
- }
- ~DsClient() = default;
-
- void Start(unsigned int port);
- void Stop();
-
- private:
- DsClient() = default;
-
- class Thread;
- wpi::SafeThreadOwner<Thread> m_owner;
-
- ATOMIC_STATIC_DECL(DsClient)
-};
-
-} // namespace nt
-
-#endif // NT_DSCLIENT_H_
diff --git a/third_party/ntcore_2017/src/Log.cpp b/third_party/ntcore_2017/src/Log.cpp
deleted file mode 100644
index c51ee96..0000000
--- a/third_party/ntcore_2017/src/Log.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Log.h"
-
-#include <cstdio>
-#ifdef _WIN32
-#include <cstdlib>
-#else
-#include <cstring>
-#endif
-
-#ifdef __APPLE__
-#include <libgen.h>
-#endif
-
-#ifdef __ANDROID__
-#include <libgen.h>
-#endif
-
-using namespace nt;
-
-ATOMIC_STATIC_INIT(Logger)
-
-static void def_log_func(unsigned int level, const char* file,
- unsigned int line, const char* msg) {
- if (level == 20) {
- std::fprintf(stderr, "NT: %s\n", msg);
- return;
- }
-
- const char* levelmsg;
- if (level >= 50)
- levelmsg = "CRITICAL";
- else if (level >= 40)
- levelmsg = "ERROR";
- else if (level >= 30)
- levelmsg = "WARNING";
- else
- return;
-#ifdef _WIN32
- char fname[60];
- char ext[10];
- _splitpath_s(file, nullptr, 0, nullptr, 0, fname, 60, ext, 10);
- std::fprintf(stderr, "NT: %s: %s (%s%s:%d)\n", levelmsg, msg, fname, ext,
- line);
-#elif __APPLE__
- int len = strlen(msg) + 1;
- char* basestr = new char[len + 1];
- strncpy(basestr, file, len);
- std::fprintf(stderr, "NT: %s: %s (%s:%d)\n", levelmsg, msg, basename(basestr),
- line);
- delete[] basestr;
-#else
- std::fprintf(stderr, "NT: %s: %s (%s:%d)\n", levelmsg, msg, basename(file),
- line);
-#endif
-}
-
-Logger::Logger() { SetLogger(def_log_func); }
-
-Logger::~Logger() {}
diff --git a/third_party/ntcore_2017/src/Log.h b/third_party/ntcore_2017/src/Log.h
deleted file mode 100644
index d56ba04..0000000
--- a/third_party/ntcore_2017/src/Log.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NT_LOG_H_
-#define NT_LOG_H_
-
-#include "support/atomic_static.h"
-#include "support/Logger.h"
-
-namespace nt {
-
-class Logger : public wpi::Logger {
- public:
- static Logger& GetInstance() {
- ATOMIC_STATIC(Logger, instance);
- return instance;
- }
- ~Logger();
-
- private:
- Logger();
-
- ATOMIC_STATIC_DECL(Logger)
-};
-
-#define LOG(level, x) WPI_LOG(nt::Logger::GetInstance(), level, x)
-
-#undef ERROR
-#define ERROR(x) WPI_ERROR(nt::Logger::GetInstance(), x)
-#define WARNING(x) WPI_WARNING(nt::Logger::GetInstance(), x)
-#define INFO(x) WPI_INFO(nt::Logger::GetInstance(), x)
-
-#define DEBUG(x) WPI_DEBUG(nt::Logger::GetInstance(), x)
-#define DEBUG1(x) WPI_DEBUG1(nt::Logger::GetInstance(), x)
-#define DEBUG2(x) WPI_DEBUG2(nt::Logger::GetInstance(), x)
-#define DEBUG3(x) WPI_DEBUG3(nt::Logger::GetInstance(), x)
-#define DEBUG4(x) WPI_DEBUG4(nt::Logger::GetInstance(), x)
-
-} // namespace nt
-
-#endif // NT_LOG_H_
diff --git a/third_party/ntcore_2017/src/Message.cpp b/third_party/ntcore_2017/src/Message.cpp
deleted file mode 100644
index 9dab685..0000000
--- a/third_party/ntcore_2017/src/Message.cpp
+++ /dev/null
@@ -1,299 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Message.h"
-
-#include "Log.h"
-#include "WireDecoder.h"
-#include "WireEncoder.h"
-
-#define kClearAllMagic 0xD06CB27Aul
-
-using namespace nt;
-
-std::shared_ptr<Message> Message::Read(WireDecoder& decoder,
- GetEntryTypeFunc get_entry_type) {
- unsigned int msg_type;
- if (!decoder.Read8(&msg_type)) return nullptr;
- auto msg =
- std::make_shared<Message>(static_cast<MsgType>(msg_type), private_init());
- switch (msg_type) {
- case kKeepAlive:
- break;
- case kClientHello: {
- unsigned int proto_rev;
- if (!decoder.Read16(&proto_rev)) return nullptr;
- msg->m_id = proto_rev;
- // This intentionally uses the provided proto_rev instead of
- // decoder.proto_rev().
- if (proto_rev >= 0x0300u) {
- if (!decoder.ReadString(&msg->m_str)) return nullptr;
- }
- break;
- }
- case kProtoUnsup: {
- if (!decoder.Read16(&msg->m_id)) return nullptr; // proto rev
- break;
- }
- case kServerHelloDone:
- break;
- case kServerHello:
- if (decoder.proto_rev() < 0x0300u) {
- decoder.set_error("received SERVER_HELLO in protocol < 3.0");
- return nullptr;
- }
- if (!decoder.Read8(&msg->m_flags)) return nullptr;
- if (!decoder.ReadString(&msg->m_str)) return nullptr;
- break;
- case kClientHelloDone:
- if (decoder.proto_rev() < 0x0300u) {
- decoder.set_error("received CLIENT_HELLO_DONE in protocol < 3.0");
- return nullptr;
- }
- break;
- case kEntryAssign: {
- if (!decoder.ReadString(&msg->m_str)) return nullptr; // name
- NT_Type type;
- if (!decoder.ReadType(&type)) return nullptr; // entry type
- if (!decoder.Read16(&msg->m_id)) return nullptr; // id
- if (!decoder.Read16(&msg->m_seq_num_uid)) return nullptr; // seq num
- if (decoder.proto_rev() >= 0x0300u) {
- if (!decoder.Read8(&msg->m_flags)) return nullptr; // flags
- }
- msg->m_value = decoder.ReadValue(type);
- if (!msg->m_value) return nullptr;
- break;
- }
- case kEntryUpdate: {
- if (!decoder.Read16(&msg->m_id)) return nullptr; // id
- if (!decoder.Read16(&msg->m_seq_num_uid)) return nullptr; // seq num
- NT_Type type;
- if (decoder.proto_rev() >= 0x0300u) {
- if (!decoder.ReadType(&type)) return nullptr;
- } else {
- type = get_entry_type(msg->m_id);
- }
- DEBUG4("update message data type: " << type);
- msg->m_value = decoder.ReadValue(type);
- if (!msg->m_value) return nullptr;
- break;
- }
- case kFlagsUpdate: {
- if (decoder.proto_rev() < 0x0300u) {
- decoder.set_error("received FLAGS_UPDATE in protocol < 3.0");
- return nullptr;
- }
- if (!decoder.Read16(&msg->m_id)) return nullptr;
- if (!decoder.Read8(&msg->m_flags)) return nullptr;
- break;
- }
- case kEntryDelete: {
- if (decoder.proto_rev() < 0x0300u) {
- decoder.set_error("received ENTRY_DELETE in protocol < 3.0");
- return nullptr;
- }
- if (!decoder.Read16(&msg->m_id)) return nullptr;
- break;
- }
- case kClearEntries: {
- if (decoder.proto_rev() < 0x0300u) {
- decoder.set_error("received CLEAR_ENTRIES in protocol < 3.0");
- return nullptr;
- }
- unsigned long magic;
- if (!decoder.Read32(&magic)) return nullptr;
- if (magic != kClearAllMagic) {
- decoder.set_error(
- "received incorrect CLEAR_ENTRIES magic value, ignoring");
- return nullptr;
- }
- break;
- }
- case kExecuteRpc: {
- if (decoder.proto_rev() < 0x0300u) {
- decoder.set_error("received EXECUTE_RPC in protocol < 3.0");
- return nullptr;
- }
- if (!decoder.Read16(&msg->m_id)) return nullptr;
- if (!decoder.Read16(&msg->m_seq_num_uid)) return nullptr; // uid
- unsigned long size;
- if (!decoder.ReadUleb128(&size)) return nullptr;
- const char* params;
- if (!decoder.Read(¶ms, size)) return nullptr;
- msg->m_str = llvm::StringRef(params, size);
- break;
- }
- case kRpcResponse: {
- if (decoder.proto_rev() < 0x0300u) {
- decoder.set_error("received RPC_RESPONSE in protocol < 3.0");
- return nullptr;
- }
- if (!decoder.Read16(&msg->m_id)) return nullptr;
- if (!decoder.Read16(&msg->m_seq_num_uid)) return nullptr; // uid
- unsigned long size;
- if (!decoder.ReadUleb128(&size)) return nullptr;
- const char* results;
- if (!decoder.Read(&results, size)) return nullptr;
- msg->m_str = llvm::StringRef(results, size);
- break;
- }
- default:
- decoder.set_error("unrecognized message type");
- INFO("unrecognized message type: " << msg_type);
- return nullptr;
- }
- return msg;
-}
-
-std::shared_ptr<Message> Message::ClientHello(llvm::StringRef self_id) {
- auto msg = std::make_shared<Message>(kClientHello, private_init());
- msg->m_str = self_id;
- return msg;
-}
-
-std::shared_ptr<Message> Message::ServerHello(unsigned int flags,
- llvm::StringRef self_id) {
- auto msg = std::make_shared<Message>(kServerHello, private_init());
- msg->m_str = self_id;
- msg->m_flags = flags;
- return msg;
-}
-
-std::shared_ptr<Message> Message::EntryAssign(llvm::StringRef name,
- unsigned int id,
- unsigned int seq_num,
- std::shared_ptr<Value> value,
- unsigned int flags) {
- auto msg = std::make_shared<Message>(kEntryAssign, private_init());
- msg->m_str = name;
- msg->m_value = value;
- msg->m_id = id;
- msg->m_flags = flags;
- msg->m_seq_num_uid = seq_num;
- return msg;
-}
-
-std::shared_ptr<Message> Message::EntryUpdate(unsigned int id,
- unsigned int seq_num,
- std::shared_ptr<Value> value) {
- auto msg = std::make_shared<Message>(kEntryUpdate, private_init());
- msg->m_value = value;
- msg->m_id = id;
- msg->m_seq_num_uid = seq_num;
- return msg;
-}
-
-std::shared_ptr<Message> Message::FlagsUpdate(unsigned int id,
- unsigned int flags) {
- auto msg = std::make_shared<Message>(kFlagsUpdate, private_init());
- msg->m_id = id;
- msg->m_flags = flags;
- return msg;
-}
-
-std::shared_ptr<Message> Message::EntryDelete(unsigned int id) {
- auto msg = std::make_shared<Message>(kEntryDelete, private_init());
- msg->m_id = id;
- return msg;
-}
-
-std::shared_ptr<Message> Message::ExecuteRpc(unsigned int id, unsigned int uid,
- llvm::StringRef params) {
- auto msg = std::make_shared<Message>(kExecuteRpc, private_init());
- msg->m_str = params;
- msg->m_id = id;
- msg->m_seq_num_uid = uid;
- return msg;
-}
-
-std::shared_ptr<Message> Message::RpcResponse(unsigned int id, unsigned int uid,
- llvm::StringRef results) {
- auto msg = std::make_shared<Message>(kRpcResponse, private_init());
- msg->m_str = results;
- msg->m_id = id;
- msg->m_seq_num_uid = uid;
- return msg;
-}
-
-void Message::Write(WireEncoder& encoder) const {
- switch (m_type) {
- case kKeepAlive:
- encoder.Write8(kKeepAlive);
- break;
- case kClientHello:
- encoder.Write8(kClientHello);
- encoder.Write16(encoder.proto_rev());
- if (encoder.proto_rev() < 0x0300u) return;
- encoder.WriteString(m_str);
- break;
- case kProtoUnsup:
- encoder.Write8(kProtoUnsup);
- encoder.Write16(encoder.proto_rev());
- break;
- case kServerHelloDone:
- encoder.Write8(kServerHelloDone);
- break;
- case kServerHello:
- if (encoder.proto_rev() < 0x0300u) return; // new message in version 3.0
- encoder.Write8(kServerHello);
- encoder.Write8(m_flags);
- encoder.WriteString(m_str);
- break;
- case kClientHelloDone:
- if (encoder.proto_rev() < 0x0300u) return; // new message in version 3.0
- encoder.Write8(kClientHelloDone);
- break;
- case kEntryAssign:
- encoder.Write8(kEntryAssign);
- encoder.WriteString(m_str);
- encoder.WriteType(m_value->type());
- encoder.Write16(m_id);
- encoder.Write16(m_seq_num_uid);
- if (encoder.proto_rev() >= 0x0300u) encoder.Write8(m_flags);
- encoder.WriteValue(*m_value);
- break;
- case kEntryUpdate:
- encoder.Write8(kEntryUpdate);
- encoder.Write16(m_id);
- encoder.Write16(m_seq_num_uid);
- if (encoder.proto_rev() >= 0x0300u) encoder.WriteType(m_value->type());
- encoder.WriteValue(*m_value);
- break;
- case kFlagsUpdate:
- if (encoder.proto_rev() < 0x0300u) return; // new message in version 3.0
- encoder.Write8(kFlagsUpdate);
- encoder.Write16(m_id);
- encoder.Write8(m_flags);
- break;
- case kEntryDelete:
- if (encoder.proto_rev() < 0x0300u) return; // new message in version 3.0
- encoder.Write8(kEntryDelete);
- encoder.Write16(m_id);
- break;
- case kClearEntries:
- if (encoder.proto_rev() < 0x0300u) return; // new message in version 3.0
- encoder.Write8(kClearEntries);
- encoder.Write32(kClearAllMagic);
- break;
- case kExecuteRpc:
- if (encoder.proto_rev() < 0x0300u) return; // new message in version 3.0
- encoder.Write8(kExecuteRpc);
- encoder.Write16(m_id);
- encoder.Write16(m_seq_num_uid);
- encoder.WriteString(m_str);
- break;
- case kRpcResponse:
- if (encoder.proto_rev() < 0x0300u) return; // new message in version 3.0
- encoder.Write8(kRpcResponse);
- encoder.Write16(m_id);
- encoder.Write16(m_seq_num_uid);
- encoder.WriteString(m_str);
- break;
- default:
- break;
- }
-}
diff --git a/third_party/ntcore_2017/src/Message.h b/third_party/ntcore_2017/src/Message.h
deleted file mode 100644
index 3047834..0000000
--- a/third_party/ntcore_2017/src/Message.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NT_MESSAGE_H_
-#define NT_MESSAGE_H_
-
-#include <functional>
-#include <memory>
-#include <string>
-
-#include "nt_Value.h"
-
-namespace nt {
-
-class WireDecoder;
-class WireEncoder;
-
-class Message {
- struct private_init {};
-
- public:
- enum MsgType {
- kUnknown = -1,
- kKeepAlive = 0x00,
- kClientHello = 0x01,
- kProtoUnsup = 0x02,
- kServerHelloDone = 0x03,
- kServerHello = 0x04,
- kClientHelloDone = 0x05,
- kEntryAssign = 0x10,
- kEntryUpdate = 0x11,
- kFlagsUpdate = 0x12,
- kEntryDelete = 0x13,
- kClearEntries = 0x14,
- kExecuteRpc = 0x20,
- kRpcResponse = 0x21
- };
- typedef std::function<NT_Type(unsigned int id)> GetEntryTypeFunc;
-
- Message() : m_type(kUnknown), m_id(0), m_flags(0), m_seq_num_uid(0) {}
- Message(MsgType type, const private_init&)
- : m_type(type), m_id(0), m_flags(0), m_seq_num_uid(0) {}
-
- MsgType type() const { return m_type; }
- bool Is(MsgType type) const { return type == m_type; }
-
- // Message data accessors. Callers are responsible for knowing what data is
- // actually provided for a particular message.
- llvm::StringRef str() const { return m_str; }
- std::shared_ptr<Value> value() const { return m_value; }
- unsigned int id() const { return m_id; }
- unsigned int flags() const { return m_flags; }
- unsigned int seq_num_uid() const { return m_seq_num_uid; }
-
- // Read and write from wire representation
- void Write(WireEncoder& encoder) const;
- static std::shared_ptr<Message> Read(WireDecoder& decoder,
- GetEntryTypeFunc get_entry_type);
-
- // Create messages without data
- static std::shared_ptr<Message> KeepAlive() {
- return std::make_shared<Message>(kKeepAlive, private_init());
- }
- static std::shared_ptr<Message> ProtoUnsup() {
- return std::make_shared<Message>(kProtoUnsup, private_init());
- }
- static std::shared_ptr<Message> ServerHelloDone() {
- return std::make_shared<Message>(kServerHelloDone, private_init());
- }
- static std::shared_ptr<Message> ClientHelloDone() {
- return std::make_shared<Message>(kClientHelloDone, private_init());
- }
- static std::shared_ptr<Message> ClearEntries() {
- return std::make_shared<Message>(kClearEntries, private_init());
- }
-
- // Create messages with data
- static std::shared_ptr<Message> ClientHello(llvm::StringRef self_id);
- static std::shared_ptr<Message> ServerHello(unsigned int flags,
- llvm::StringRef self_id);
- static std::shared_ptr<Message> EntryAssign(llvm::StringRef name,
- unsigned int id,
- unsigned int seq_num,
- std::shared_ptr<Value> value,
- unsigned int flags);
- static std::shared_ptr<Message> EntryUpdate(unsigned int id,
- unsigned int seq_num,
- std::shared_ptr<Value> value);
- static std::shared_ptr<Message> FlagsUpdate(unsigned int id,
- unsigned int flags);
- static std::shared_ptr<Message> EntryDelete(unsigned int id);
- static std::shared_ptr<Message> ExecuteRpc(unsigned int id, unsigned int uid,
- llvm::StringRef params);
- static std::shared_ptr<Message> RpcResponse(unsigned int id, unsigned int uid,
- llvm::StringRef results);
-
- Message(const Message&) = delete;
- Message& operator=(const Message&) = delete;
-
- private:
- MsgType m_type;
-
- // Message data. Use varies by message type.
- std::string m_str;
- std::shared_ptr<Value> m_value;
- unsigned int m_id; // also used for proto_rev
- unsigned int m_flags;
- unsigned int m_seq_num_uid;
-};
-
-} // namespace nt
-
-#endif // NT_MESSAGE_H_
diff --git a/third_party/ntcore_2017/src/NetworkConnection.cpp b/third_party/ntcore_2017/src/NetworkConnection.cpp
deleted file mode 100644
index a0b06c6..0000000
--- a/third_party/ntcore_2017/src/NetworkConnection.cpp
+++ /dev/null
@@ -1,330 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "NetworkConnection.h"
-
-#include "support/raw_socket_istream.h"
-#include "support/timestamp.h"
-#include "tcpsockets/NetworkStream.h"
-#include "Log.h"
-#include "Notifier.h"
-#include "WireDecoder.h"
-#include "WireEncoder.h"
-
-using namespace nt;
-
-std::atomic_uint NetworkConnection::s_uid;
-
-NetworkConnection::NetworkConnection(std::unique_ptr<wpi::NetworkStream> stream,
- Notifier& notifier,
- HandshakeFunc handshake,
- Message::GetEntryTypeFunc get_entry_type)
- : m_uid(s_uid.fetch_add(1)),
- m_stream(std::move(stream)),
- m_notifier(notifier),
- m_handshake(handshake),
- m_get_entry_type(get_entry_type),
- m_state(kCreated) {
- m_active = false;
- m_proto_rev = 0x0300;
- m_last_update = 0;
-
- // turn off Nagle algorithm; we bundle packets for transmission
- m_stream->setNoDelay();
-}
-
-NetworkConnection::~NetworkConnection() { Stop(); }
-
-void NetworkConnection::Start() {
- if (m_active) return;
- m_active = true;
- set_state(kInit);
- // clear queue
- while (!m_outgoing.empty()) m_outgoing.pop();
- // reset shutdown flags
- {
- std::lock_guard<std::mutex> lock(m_shutdown_mutex);
- m_read_shutdown = false;
- m_write_shutdown = false;
- }
- // start threads
- m_write_thread = std::thread(&NetworkConnection::WriteThreadMain, this);
- m_read_thread = std::thread(&NetworkConnection::ReadThreadMain, this);
-}
-
-void NetworkConnection::Stop() {
- DEBUG2("NetworkConnection stopping (" << this << ")");
- set_state(kDead);
- m_active = false;
- // closing the stream so the read thread terminates
- if (m_stream) m_stream->close();
- // send an empty outgoing message set so the write thread terminates
- m_outgoing.push(Outgoing());
- // wait for threads to terminate, with timeout
- if (m_write_thread.joinable()) {
- std::unique_lock<std::mutex> lock(m_shutdown_mutex);
- auto timeout_time =
- std::chrono::steady_clock::now() + std::chrono::milliseconds(200);
- if (m_write_shutdown_cv.wait_until(lock, timeout_time,
- [&] { return m_write_shutdown; }))
- m_write_thread.join();
- else
- m_write_thread.detach(); // timed out, detach it
- }
- if (m_read_thread.joinable()) {
- std::unique_lock<std::mutex> lock(m_shutdown_mutex);
- auto timeout_time =
- std::chrono::steady_clock::now() + std::chrono::milliseconds(200);
- if (m_read_shutdown_cv.wait_until(lock, timeout_time,
- [&] { return m_read_shutdown; }))
- m_read_thread.join();
- else
- m_read_thread.detach(); // timed out, detach it
- }
- // clear queue
- while (!m_outgoing.empty()) m_outgoing.pop();
-}
-
-ConnectionInfo NetworkConnection::info() const {
- return ConnectionInfo{remote_id(), m_stream->getPeerIP(),
- static_cast<unsigned int>(m_stream->getPeerPort()),
- m_last_update, m_proto_rev};
-}
-
-NetworkConnection::State NetworkConnection::state() const {
- std::lock_guard<std::mutex> lock(m_state_mutex);
- return m_state;
-}
-
-void NetworkConnection::set_state(State state) {
- std::lock_guard<std::mutex> lock(m_state_mutex);
- // Don't update state any more once we've died
- if (m_state == kDead) return;
- // One-shot notify state changes
- if (m_state != kActive && state == kActive)
- m_notifier.NotifyConnection(true, info());
- if (m_state != kDead && state == kDead)
- m_notifier.NotifyConnection(false, info());
- m_state = state;
-}
-
-void NetworkConnection::NotifyIfActive(
- ConnectionListenerCallback callback) const {
- std::lock_guard<std::mutex> lock(m_state_mutex);
- if (m_state == kActive) m_notifier.NotifyConnection(true, info(), callback);
-}
-
-std::string NetworkConnection::remote_id() const {
- std::lock_guard<std::mutex> lock(m_remote_id_mutex);
- return m_remote_id;
-}
-
-void NetworkConnection::set_remote_id(StringRef remote_id) {
- std::lock_guard<std::mutex> lock(m_remote_id_mutex);
- m_remote_id = remote_id;
-}
-
-void NetworkConnection::ReadThreadMain() {
- wpi::raw_socket_istream is(*m_stream);
- WireDecoder decoder(is, m_proto_rev);
-
- set_state(kHandshake);
- if (!m_handshake(*this,
- [&] {
- decoder.set_proto_rev(m_proto_rev);
- auto msg = Message::Read(decoder, m_get_entry_type);
- if (!msg && decoder.error())
- DEBUG("error reading in handshake: " << decoder.error());
- return msg;
- },
- [&](llvm::ArrayRef<std::shared_ptr<Message>> msgs) {
- m_outgoing.emplace(msgs);
- })) {
- set_state(kDead);
- m_active = false;
- goto done;
- }
-
- set_state(kActive);
- while (m_active) {
- if (!m_stream) break;
- decoder.set_proto_rev(m_proto_rev);
- decoder.Reset();
- auto msg = Message::Read(decoder, m_get_entry_type);
- if (!msg) {
- if (decoder.error()) INFO("read error: " << decoder.error());
- // terminate connection on bad message
- if (m_stream) m_stream->close();
- break;
- }
- DEBUG3("received type=" << msg->type() << " with str=" << msg->str()
- << " id=" << msg->id()
- << " seq_num=" << msg->seq_num_uid());
- m_last_update = Now();
- m_process_incoming(std::move(msg), this);
- }
- DEBUG2("read thread died (" << this << ")");
- set_state(kDead);
- m_active = false;
- m_outgoing.push(Outgoing()); // also kill write thread
-
-done:
- // use condition variable to signal thread shutdown
- {
- std::lock_guard<std::mutex> lock(m_shutdown_mutex);
- m_read_shutdown = true;
- m_read_shutdown_cv.notify_one();
- }
-}
-
-void NetworkConnection::WriteThreadMain() {
- WireEncoder encoder(m_proto_rev);
-
- while (m_active) {
- auto msgs = m_outgoing.pop();
- DEBUG4("write thread woke up");
- if (msgs.empty()) continue;
- encoder.set_proto_rev(m_proto_rev);
- encoder.Reset();
- DEBUG3("sending " << msgs.size() << " messages");
- for (auto& msg : msgs) {
- if (msg) {
- DEBUG3("sending type=" << msg->type() << " with str=" << msg->str()
- << " id=" << msg->id()
- << " seq_num=" << msg->seq_num_uid());
- msg->Write(encoder);
- }
- }
- wpi::NetworkStream::Error err;
- if (!m_stream) break;
- if (encoder.size() == 0) continue;
- if (m_stream->send(encoder.data(), encoder.size(), &err) == 0) break;
- DEBUG4("sent " << encoder.size() << " bytes");
- }
- DEBUG2("write thread died (" << this << ")");
- set_state(kDead);
- m_active = false;
- if (m_stream) m_stream->close(); // also kill read thread
-
- // use condition variable to signal thread shutdown
- {
- std::lock_guard<std::mutex> lock(m_shutdown_mutex);
- m_write_shutdown = true;
- m_write_shutdown_cv.notify_one();
- }
-}
-
-void NetworkConnection::QueueOutgoing(std::shared_ptr<Message> msg) {
- std::lock_guard<std::mutex> lock(m_pending_mutex);
-
- // Merge with previous. One case we don't combine: delete/assign loop.
- switch (msg->type()) {
- case Message::kEntryAssign:
- case Message::kEntryUpdate: {
- // don't do this for unassigned id's
- unsigned int id = msg->id();
- if (id == 0xffff) {
- m_pending_outgoing.push_back(msg);
- break;
- }
- if (id < m_pending_update.size() && m_pending_update[id].first != 0) {
- // overwrite the previous one for this id
- auto& oldmsg = m_pending_outgoing[m_pending_update[id].first - 1];
- if (oldmsg && oldmsg->Is(Message::kEntryAssign) &&
- msg->Is(Message::kEntryUpdate)) {
- // need to update assignment with new seq_num and value
- oldmsg = Message::EntryAssign(oldmsg->str(), id, msg->seq_num_uid(),
- msg->value(), oldmsg->flags());
- } else
- oldmsg = msg; // easy update
- } else {
- // new, but remember it
- std::size_t pos = m_pending_outgoing.size();
- m_pending_outgoing.push_back(msg);
- if (id >= m_pending_update.size()) m_pending_update.resize(id + 1);
- m_pending_update[id].first = pos + 1;
- }
- break;
- }
- case Message::kEntryDelete: {
- // don't do this for unassigned id's
- unsigned int id = msg->id();
- if (id == 0xffff) {
- m_pending_outgoing.push_back(msg);
- break;
- }
-
- // clear previous updates
- if (id < m_pending_update.size()) {
- if (m_pending_update[id].first != 0) {
- m_pending_outgoing[m_pending_update[id].first - 1].reset();
- m_pending_update[id].first = 0;
- }
- if (m_pending_update[id].second != 0) {
- m_pending_outgoing[m_pending_update[id].second - 1].reset();
- m_pending_update[id].second = 0;
- }
- }
-
- // add deletion
- m_pending_outgoing.push_back(msg);
- break;
- }
- case Message::kFlagsUpdate: {
- // don't do this for unassigned id's
- unsigned int id = msg->id();
- if (id == 0xffff) {
- m_pending_outgoing.push_back(msg);
- break;
- }
- if (id < m_pending_update.size() && m_pending_update[id].second != 0) {
- // overwrite the previous one for this id
- m_pending_outgoing[m_pending_update[id].second - 1] = msg;
- } else {
- // new, but remember it
- std::size_t pos = m_pending_outgoing.size();
- m_pending_outgoing.push_back(msg);
- if (id >= m_pending_update.size()) m_pending_update.resize(id + 1);
- m_pending_update[id].second = pos + 1;
- }
- break;
- }
- case Message::kClearEntries: {
- // knock out all previous assigns/updates!
- for (auto& i : m_pending_outgoing) {
- if (!i) continue;
- auto t = i->type();
- if (t == Message::kEntryAssign || t == Message::kEntryUpdate ||
- t == Message::kFlagsUpdate || t == Message::kEntryDelete ||
- t == Message::kClearEntries)
- i.reset();
- }
- m_pending_update.resize(0);
- m_pending_outgoing.push_back(msg);
- break;
- }
- default:
- m_pending_outgoing.push_back(msg);
- break;
- }
-}
-
-void NetworkConnection::PostOutgoing(bool keep_alive) {
- std::lock_guard<std::mutex> lock(m_pending_mutex);
- auto now = std::chrono::steady_clock::now();
- if (m_pending_outgoing.empty()) {
- if (!keep_alive) return;
- // send keep-alives once a second (if no other messages have been sent)
- if ((now - m_last_post) < std::chrono::seconds(1)) return;
- m_outgoing.emplace(Outgoing{Message::KeepAlive()});
- } else {
- m_outgoing.emplace(std::move(m_pending_outgoing));
- m_pending_outgoing.resize(0);
- m_pending_update.resize(0);
- }
- m_last_post = now;
-}
diff --git a/third_party/ntcore_2017/src/NetworkConnection.h b/third_party/ntcore_2017/src/NetworkConnection.h
deleted file mode 100644
index 6f79fa3..0000000
--- a/third_party/ntcore_2017/src/NetworkConnection.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NT_NETWORKCONNECTION_H_
-#define NT_NETWORKCONNECTION_H_
-
-#include <atomic>
-#include <chrono>
-#include <memory>
-#include <thread>
-
-#include "support/ConcurrentQueue.h"
-#include "Message.h"
-#include "ntcore_cpp.h"
-
-namespace wpi {
-class NetworkStream;
-}
-
-namespace nt {
-
-class Notifier;
-
-class NetworkConnection {
- public:
- enum State { kCreated, kInit, kHandshake, kSynchronized, kActive, kDead };
-
- typedef std::function<bool(
- NetworkConnection& conn,
- std::function<std::shared_ptr<Message>()> get_msg,
- std::function<void(llvm::ArrayRef<std::shared_ptr<Message>>)> send_msgs)>
- HandshakeFunc;
- typedef std::function<void(std::shared_ptr<Message> msg,
- NetworkConnection* conn)>
- ProcessIncomingFunc;
- typedef std::vector<std::shared_ptr<Message>> Outgoing;
- typedef wpi::ConcurrentQueue<Outgoing> OutgoingQueue;
-
- NetworkConnection(std::unique_ptr<wpi::NetworkStream> stream,
- Notifier& notifier, HandshakeFunc handshake,
- Message::GetEntryTypeFunc get_entry_type);
- ~NetworkConnection();
-
- // Set the input processor function. This must be called before Start().
- void set_process_incoming(ProcessIncomingFunc func) {
- m_process_incoming = func;
- }
-
- void Start();
- void Stop();
-
- ConnectionInfo info() const;
-
- bool active() const { return m_active; }
- wpi::NetworkStream& stream() { return *m_stream; }
-
- void QueueOutgoing(std::shared_ptr<Message> msg);
- void PostOutgoing(bool keep_alive);
- void NotifyIfActive(ConnectionListenerCallback callback) const;
-
- unsigned int uid() const { return m_uid; }
-
- unsigned int proto_rev() const { return m_proto_rev; }
- void set_proto_rev(unsigned int proto_rev) { m_proto_rev = proto_rev; }
-
- State state() const;
- void set_state(State state);
-
- std::string remote_id() const;
- void set_remote_id(StringRef remote_id);
-
- unsigned long long last_update() const { return m_last_update; }
-
- NetworkConnection(const NetworkConnection&) = delete;
- NetworkConnection& operator=(const NetworkConnection&) = delete;
-
- private:
- void ReadThreadMain();
- void WriteThreadMain();
-
- static std::atomic_uint s_uid;
-
- unsigned int m_uid;
- std::unique_ptr<wpi::NetworkStream> m_stream;
- Notifier& m_notifier;
- OutgoingQueue m_outgoing;
- HandshakeFunc m_handshake;
- Message::GetEntryTypeFunc m_get_entry_type;
- ProcessIncomingFunc m_process_incoming;
- std::thread m_read_thread;
- std::thread m_write_thread;
- std::atomic_bool m_active;
- std::atomic_uint m_proto_rev;
- mutable std::mutex m_state_mutex;
- State m_state;
- mutable std::mutex m_remote_id_mutex;
- std::string m_remote_id;
- std::atomic_ullong m_last_update;
- std::chrono::steady_clock::time_point m_last_post;
-
- std::mutex m_pending_mutex;
- Outgoing m_pending_outgoing;
- std::vector<std::pair<std::size_t, std::size_t>> m_pending_update;
-
- // Condition variables for shutdown
- std::mutex m_shutdown_mutex;
- std::condition_variable m_read_shutdown_cv;
- std::condition_variable m_write_shutdown_cv;
- bool m_read_shutdown = false;
- bool m_write_shutdown = false;
-};
-
-} // namespace nt
-
-#endif // NT_NETWORKCONNECTION_H_
diff --git a/third_party/ntcore_2017/src/Notifier.cpp b/third_party/ntcore_2017/src/Notifier.cpp
deleted file mode 100644
index b19d979..0000000
--- a/third_party/ntcore_2017/src/Notifier.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Notifier.h"
-
-#include <queue>
-#include <vector>
-
-using namespace nt;
-
-ATOMIC_STATIC_INIT(Notifier)
-bool Notifier::s_destroyed = false;
-
-namespace {
-// Vector which provides an integrated freelist for removal and reuse of
-// individual elements.
-template <typename T>
-class UidVector {
- public:
- typedef typename std::vector<T>::size_type size_type;
-
- size_type size() const { return m_vector.size(); }
- T& operator[](size_type i) { return m_vector[i]; }
- const T& operator[](size_type i) const { return m_vector[i]; }
-
- // Add a new T to the vector. If there are elements on the freelist,
- // reuses the last one; otherwise adds to the end of the vector.
- // Returns the resulting element index (+1).
- template <class... Args>
- unsigned int emplace_back(Args&&... args) {
- unsigned int uid;
- if (m_free.empty()) {
- uid = m_vector.size();
- m_vector.emplace_back(std::forward<Args>(args)...);
- } else {
- uid = m_free.back();
- m_free.pop_back();
- m_vector[uid] = T(std::forward<Args>(args)...);
- }
- return uid + 1;
- }
-
- // Removes the identified element by replacing it with a default-constructed
- // one. The element is added to the freelist for later reuse.
- void erase(unsigned int uid) {
- --uid;
- if (uid >= m_vector.size() || !m_vector[uid]) return;
- m_free.push_back(uid);
- m_vector[uid] = T();
- }
-
- private:
- std::vector<T> m_vector;
- std::vector<unsigned int> m_free;
-};
-
-} // anonymous namespace
-
-class Notifier::Thread : public wpi::SafeThread {
- public:
- Thread(std::function<void()> on_start, std::function<void()> on_exit)
- : m_on_start(on_start), m_on_exit(on_exit) {}
-
- void Main();
-
- struct EntryListener {
- EntryListener() = default;
- EntryListener(StringRef prefix_, EntryListenerCallback callback_,
- unsigned int flags_)
- : prefix(prefix_), callback(callback_), flags(flags_) {}
-
- explicit operator bool() const { return bool(callback); }
-
- std::string prefix;
- EntryListenerCallback callback;
- unsigned int flags;
- };
- UidVector<EntryListener> m_entry_listeners;
- UidVector<ConnectionListenerCallback> m_conn_listeners;
-
- struct EntryNotification {
- EntryNotification(llvm::StringRef name_, std::shared_ptr<Value> value_,
- unsigned int flags_, EntryListenerCallback only_)
- : name(name_), value(value_), flags(flags_), only(only_) {}
-
- std::string name;
- std::shared_ptr<Value> value;
- unsigned int flags;
- EntryListenerCallback only;
- };
- std::queue<EntryNotification> m_entry_notifications;
-
- struct ConnectionNotification {
- ConnectionNotification(bool connected_, const ConnectionInfo& conn_info_,
- ConnectionListenerCallback only_)
- : connected(connected_), conn_info(conn_info_), only(only_) {}
-
- bool connected;
- ConnectionInfo conn_info;
- ConnectionListenerCallback only;
- };
- std::queue<ConnectionNotification> m_conn_notifications;
-
- std::function<void()> m_on_start;
- std::function<void()> m_on_exit;
-};
-
-Notifier::Notifier() {
- m_local_notifiers = false;
- s_destroyed = false;
-}
-
-Notifier::~Notifier() { s_destroyed = true; }
-
-void Notifier::Start() {
- auto thr = m_owner.GetThread();
- if (!thr) m_owner.Start(new Thread(m_on_start, m_on_exit));
-}
-
-void Notifier::Stop() { m_owner.Stop(); }
-
-void Notifier::Thread::Main() {
- if (m_on_start) m_on_start();
-
- std::unique_lock<std::mutex> lock(m_mutex);
- while (m_active) {
- while (m_entry_notifications.empty() && m_conn_notifications.empty()) {
- m_cond.wait(lock);
- if (!m_active) goto done;
- }
-
- // Entry notifications
- while (!m_entry_notifications.empty()) {
- if (!m_active) goto done;
- auto item = std::move(m_entry_notifications.front());
- m_entry_notifications.pop();
-
- if (!item.value) continue;
- StringRef name(item.name);
-
- if (item.only) {
- // Don't hold mutex during callback execution!
- lock.unlock();
- item.only(0, name, item.value, item.flags);
- lock.lock();
- continue;
- }
-
- // Use index because iterator might get invalidated.
- for (std::size_t i = 0; i < m_entry_listeners.size(); ++i) {
- if (!m_entry_listeners[i]) continue; // removed
-
- // Flags must be within requested flag set for this listener.
- // Because assign messages can result in both a value and flags update,
- // we handle that case specially.
- unsigned int listen_flags = m_entry_listeners[i].flags;
- unsigned int flags = item.flags;
- unsigned int assign_both = NT_NOTIFY_UPDATE | NT_NOTIFY_FLAGS;
- if ((flags & assign_both) == assign_both) {
- if ((listen_flags & assign_both) == 0) continue;
- listen_flags &= ~assign_both;
- flags &= ~assign_both;
- }
- if ((flags & ~listen_flags) != 0) continue;
-
- // must match prefix
- if (!name.startswith(m_entry_listeners[i].prefix)) continue;
-
- // make a copy of the callback so we can safely release the mutex
- auto callback = m_entry_listeners[i].callback;
-
- // Don't hold mutex during callback execution!
- lock.unlock();
- callback(i + 1, name, item.value, item.flags);
- lock.lock();
- }
- }
-
- // Connection notifications
- while (!m_conn_notifications.empty()) {
- if (!m_active) goto done;
- auto item = std::move(m_conn_notifications.front());
- m_conn_notifications.pop();
-
- if (item.only) {
- // Don't hold mutex during callback execution!
- lock.unlock();
- item.only(0, item.connected, item.conn_info);
- lock.lock();
- continue;
- }
-
- // Use index because iterator might get invalidated.
- for (std::size_t i = 0; i < m_conn_listeners.size(); ++i) {
- if (!m_conn_listeners[i]) continue; // removed
- auto callback = m_conn_listeners[i];
- // Don't hold mutex during callback execution!
- lock.unlock();
- callback(i + 1, item.connected, item.conn_info);
- lock.lock();
- }
- }
- }
-
-done:
- if (m_on_exit) m_on_exit();
-}
-
-unsigned int Notifier::AddEntryListener(StringRef prefix,
- EntryListenerCallback callback,
- unsigned int flags) {
- Start();
- auto thr = m_owner.GetThread();
- if ((flags & NT_NOTIFY_LOCAL) != 0) m_local_notifiers = true;
- return thr->m_entry_listeners.emplace_back(prefix, callback, flags);
-}
-
-void Notifier::RemoveEntryListener(unsigned int entry_listener_uid) {
- auto thr = m_owner.GetThread();
- if (!thr) return;
- thr->m_entry_listeners.erase(entry_listener_uid);
-}
-
-void Notifier::NotifyEntry(StringRef name, std::shared_ptr<Value> value,
- unsigned int flags, EntryListenerCallback only) {
- // optimization: don't generate needless local queue entries if we have
- // no local listeners (as this is a common case on the server side)
- if ((flags & NT_NOTIFY_LOCAL) != 0 && !m_local_notifiers) return;
- auto thr = m_owner.GetThread();
- if (!thr) return;
- thr->m_entry_notifications.emplace(name, value, flags, only);
- thr->m_cond.notify_one();
-}
-
-unsigned int Notifier::AddConnectionListener(
- ConnectionListenerCallback callback) {
- Start();
- auto thr = m_owner.GetThread();
- return thr->m_conn_listeners.emplace_back(callback);
-}
-
-void Notifier::RemoveConnectionListener(unsigned int conn_listener_uid) {
- auto thr = m_owner.GetThread();
- if (!thr) return;
- thr->m_conn_listeners.erase(conn_listener_uid);
-}
-
-void Notifier::NotifyConnection(bool connected, const ConnectionInfo& conn_info,
- ConnectionListenerCallback only) {
- auto thr = m_owner.GetThread();
- if (!thr) return;
- thr->m_conn_notifications.emplace(connected, conn_info, only);
- thr->m_cond.notify_one();
-}
diff --git a/third_party/ntcore_2017/src/Notifier.h b/third_party/ntcore_2017/src/Notifier.h
deleted file mode 100644
index 49c9ec9..0000000
--- a/third_party/ntcore_2017/src/Notifier.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NT_NOTIFIER_H_
-#define NT_NOTIFIER_H_
-
-#include <functional>
-
-#include "support/atomic_static.h"
-#include "support/SafeThread.h"
-#include "ntcore_cpp.h"
-
-namespace nt {
-
-class Notifier {
- friend class NotifierTest;
-
- public:
- static Notifier& GetInstance() {
- ATOMIC_STATIC(Notifier, instance);
- return instance;
- }
- ~Notifier();
-
- void Start();
- void Stop();
-
- bool local_notifiers() const { return m_local_notifiers; }
- static bool destroyed() { return s_destroyed; }
-
- void SetOnStart(std::function<void()> on_start) { m_on_start = on_start; }
- void SetOnExit(std::function<void()> on_exit) { m_on_exit = on_exit; }
-
- unsigned int AddEntryListener(llvm::StringRef prefix,
- EntryListenerCallback callback,
- unsigned int flags);
- void RemoveEntryListener(unsigned int entry_listener_uid);
-
- void NotifyEntry(StringRef name, std::shared_ptr<Value> value,
- unsigned int flags, EntryListenerCallback only = nullptr);
-
- unsigned int AddConnectionListener(ConnectionListenerCallback callback);
- void RemoveConnectionListener(unsigned int conn_listener_uid);
-
- void NotifyConnection(bool connected, const ConnectionInfo& conn_info,
- ConnectionListenerCallback only = nullptr);
-
- private:
- Notifier();
-
- class Thread;
- wpi::SafeThreadOwner<Thread> m_owner;
-
- std::atomic_bool m_local_notifiers;
-
- std::function<void()> m_on_start;
- std::function<void()> m_on_exit;
-
- ATOMIC_STATIC_DECL(Notifier)
- static bool s_destroyed;
-};
-
-} // namespace nt
-
-#endif // NT_NOTIFIER_H_
diff --git a/third_party/ntcore_2017/src/RpcServer.cpp b/third_party/ntcore_2017/src/RpcServer.cpp
deleted file mode 100644
index df3cb4f..0000000
--- a/third_party/ntcore_2017/src/RpcServer.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "RpcServer.h"
-
-#include <queue>
-
-#include "Log.h"
-
-using namespace nt;
-
-ATOMIC_STATIC_INIT(RpcServer)
-
-class RpcServer::Thread : public wpi::SafeThread {
- public:
- Thread(std::function<void()> on_start, std::function<void()> on_exit)
- : m_on_start(on_start), m_on_exit(on_exit) {}
-
- void Main();
-
- std::queue<RpcCall> m_call_queue;
-
- std::function<void()> m_on_start;
- std::function<void()> m_on_exit;
-};
-
-RpcServer::RpcServer() { m_terminating = false; }
-
-RpcServer::~RpcServer() {
- Logger::GetInstance().SetLogger(nullptr);
- m_terminating = true;
- m_poll_cond.notify_all();
-}
-
-void RpcServer::Start() {
- auto thr = m_owner.GetThread();
- if (!thr) m_owner.Start(new Thread(m_on_start, m_on_exit));
-}
-
-void RpcServer::Stop() { m_owner.Stop(); }
-
-void RpcServer::ProcessRpc(StringRef name, std::shared_ptr<Message> msg,
- RpcCallback func, unsigned int conn_id,
- SendMsgFunc send_response,
- const ConnectionInfo& conn_info) {
- if (func) {
- auto thr = m_owner.GetThread();
- if (!thr) return;
- thr->m_call_queue.emplace(name, msg, func, conn_id, send_response,
- conn_info);
- thr->m_cond.notify_one();
- } else {
- std::lock_guard<std::mutex> lock(m_mutex);
- m_poll_queue.emplace(name, msg, func, conn_id, send_response, conn_info);
- m_poll_cond.notify_one();
- }
-}
-
-bool RpcServer::PollRpc(bool blocking, RpcCallInfo* call_info) {
- return PollRpc(blocking, kTimeout_Indefinite, call_info);
-}
-
-bool RpcServer::PollRpc(bool blocking, double time_out,
- RpcCallInfo* call_info) {
- std::unique_lock<std::mutex> lock(m_mutex);
-#if defined(_MSC_VER) && _MSC_VER < 1900
- auto timeout_time = std::chrono::steady_clock::now() +
- std::chrono::duration<int64_t, std::nano>(
- static_cast<int64_t>(time_out * 1e9));
-#else
- auto timeout_time = std::chrono::steady_clock::now() +
- std::chrono::duration<double>(time_out);
-#endif
- while (m_poll_queue.empty()) {
- if (!blocking || m_terminating) return false;
- if (time_out < 0) {
- m_poll_cond.wait(lock);
- } else {
- auto timed_out = m_poll_cond.wait_until(lock, timeout_time);
- if (timed_out == std::cv_status::timeout) {
- return false;
- }
- }
- if (m_terminating) return false;
- }
-
- auto& item = m_poll_queue.front();
- unsigned int call_uid;
- // do not include conn id if the result came from the server
- if (item.conn_id != 0xffff)
- call_uid = (item.conn_id << 16) | item.msg->seq_num_uid();
- else
- call_uid = item.msg->seq_num_uid();
- call_info->rpc_id = item.msg->id();
- call_info->call_uid = call_uid;
- call_info->name = std::move(item.name);
- call_info->params = item.msg->str();
- m_response_map.insert(std::make_pair(std::make_pair(item.msg->id(), call_uid),
- item.send_response));
- m_poll_queue.pop();
- return true;
-}
-
-void RpcServer::PostRpcResponse(unsigned int rpc_id, unsigned int call_uid,
- llvm::StringRef result) {
- auto i = m_response_map.find(std::make_pair(rpc_id, call_uid));
- if (i == m_response_map.end()) {
- WARNING("posting RPC response to nonexistent call (or duplicate response)");
- return;
- }
- (i->getSecond())(Message::RpcResponse(rpc_id, call_uid, result));
- m_response_map.erase(i);
-}
-
-void RpcServer::Thread::Main() {
- if (m_on_start) m_on_start();
-
- std::unique_lock<std::mutex> lock(m_mutex);
- std::string tmp;
- while (m_active) {
- while (m_call_queue.empty()) {
- m_cond.wait(lock);
- if (!m_active) goto done;
- }
-
- while (!m_call_queue.empty()) {
- if (!m_active) goto done;
- auto item = std::move(m_call_queue.front());
- m_call_queue.pop();
-
- DEBUG4("rpc calling " << item.name);
-
- if (item.name.empty() || !item.msg || !item.func || !item.send_response)
- continue;
-
- // Don't hold mutex during callback execution!
- lock.unlock();
- auto result = item.func(item.name, item.msg->str(), item.conn_info);
- item.send_response(Message::RpcResponse(item.msg->id(),
- item.msg->seq_num_uid(), result));
- lock.lock();
- }
- }
-
-done:
- if (m_on_exit) m_on_exit();
-}
diff --git a/third_party/ntcore_2017/src/RpcServer.h b/third_party/ntcore_2017/src/RpcServer.h
deleted file mode 100644
index 326ad18..0000000
--- a/third_party/ntcore_2017/src/RpcServer.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NT_RPCSERVER_H_
-#define NT_RPCSERVER_H_
-
-#include <atomic>
-#include <condition_variable>
-#include <mutex>
-#include <queue>
-#include <utility>
-
-#include "llvm/DenseMap.h"
-#include "support/atomic_static.h"
-#include "support/SafeThread.h"
-#include "Message.h"
-#include "ntcore_cpp.h"
-
-namespace nt {
-
-class RpcServer {
- friend class RpcServerTest;
-
- public:
- static RpcServer& GetInstance() {
- ATOMIC_STATIC(RpcServer, instance);
- return instance;
- }
- ~RpcServer();
-
- typedef std::function<void(std::shared_ptr<Message>)> SendMsgFunc;
-
- void Start();
- void Stop();
-
- void SetOnStart(std::function<void()> on_start) { m_on_start = on_start; }
- void SetOnExit(std::function<void()> on_exit) { m_on_exit = on_exit; }
-
- void ProcessRpc(StringRef name, std::shared_ptr<Message> msg,
- RpcCallback func, unsigned int conn_id,
- SendMsgFunc send_response, const ConnectionInfo& conn_info);
-
- bool PollRpc(bool blocking, RpcCallInfo* call_info);
- bool PollRpc(bool blocking, double time_out, RpcCallInfo* call_info);
- void PostRpcResponse(unsigned int rpc_id, unsigned int call_uid,
- llvm::StringRef result);
-
- private:
- RpcServer();
-
- class Thread;
- wpi::SafeThreadOwner<Thread> m_owner;
-
- struct RpcCall {
- RpcCall(StringRef name_, std::shared_ptr<Message> msg_, RpcCallback func_,
- unsigned int conn_id_, SendMsgFunc send_response_,
- const ConnectionInfo conn_info_)
- : name(name_),
- msg(msg_),
- func(func_),
- conn_id(conn_id_),
- send_response(send_response_),
- conn_info(conn_info_) {}
-
- std::string name;
- std::shared_ptr<Message> msg;
- RpcCallback func;
- unsigned int conn_id;
- SendMsgFunc send_response;
- ConnectionInfo conn_info;
- };
-
- std::mutex m_mutex;
-
- std::queue<RpcCall> m_poll_queue;
- llvm::DenseMap<std::pair<unsigned int, unsigned int>, SendMsgFunc>
- m_response_map;
-
- std::condition_variable m_poll_cond;
-
- std::atomic_bool m_terminating;
-
- std::function<void()> m_on_start;
- std::function<void()> m_on_exit;
-
- ATOMIC_STATIC_DECL(RpcServer)
-};
-
-} // namespace nt
-
-#endif // NT_RPCSERVER_H_
diff --git a/third_party/ntcore_2017/src/SequenceNumber.cpp b/third_party/ntcore_2017/src/SequenceNumber.cpp
deleted file mode 100644
index b22bfec..0000000
--- a/third_party/ntcore_2017/src/SequenceNumber.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "SequenceNumber.h"
-
-namespace nt {
-
-bool operator<(const SequenceNumber& lhs, const SequenceNumber& rhs) {
- if (lhs.m_value < rhs.m_value)
- return (rhs.m_value - lhs.m_value) < (1u << 15);
- else if (lhs.m_value > rhs.m_value)
- return (lhs.m_value - rhs.m_value) > (1u << 15);
- else
- return false;
-}
-
-bool operator>(const SequenceNumber& lhs, const SequenceNumber& rhs) {
- if (lhs.m_value < rhs.m_value)
- return (rhs.m_value - lhs.m_value) > (1u << 15);
- else if (lhs.m_value > rhs.m_value)
- return (lhs.m_value - rhs.m_value) < (1u << 15);
- else
- return false;
-}
-
-} // namespace nt
diff --git a/third_party/ntcore_2017/src/SequenceNumber.h b/third_party/ntcore_2017/src/SequenceNumber.h
deleted file mode 100644
index a8f85a4..0000000
--- a/third_party/ntcore_2017/src/SequenceNumber.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NT_SEQNUM_H_
-#define NT_SEQNUM_H_
-
-namespace nt {
-
-/* A sequence number per RFC 1982 */
-class SequenceNumber {
- public:
- SequenceNumber() : m_value(0) {}
- explicit SequenceNumber(unsigned int value) : m_value(value) {}
- unsigned int value() const { return m_value; }
-
- SequenceNumber& operator++() {
- ++m_value;
- if (m_value > 0xffff) m_value = 0;
- return *this;
- }
- SequenceNumber operator++(int) {
- SequenceNumber tmp(*this);
- operator++();
- return tmp;
- }
-
- friend bool operator<(const SequenceNumber& lhs, const SequenceNumber& rhs);
- friend bool operator>(const SequenceNumber& lhs, const SequenceNumber& rhs);
- friend bool operator<=(const SequenceNumber& lhs, const SequenceNumber& rhs);
- friend bool operator>=(const SequenceNumber& lhs, const SequenceNumber& rhs);
- friend bool operator==(const SequenceNumber& lhs, const SequenceNumber& rhs);
- friend bool operator!=(const SequenceNumber& lhs, const SequenceNumber& rhs);
-
- private:
- unsigned int m_value;
-};
-
-bool operator<(const SequenceNumber& lhs, const SequenceNumber& rhs);
-bool operator>(const SequenceNumber& lhs, const SequenceNumber& rhs);
-
-inline bool operator<=(const SequenceNumber& lhs, const SequenceNumber& rhs) {
- return lhs == rhs || lhs < rhs;
-}
-
-inline bool operator>=(const SequenceNumber& lhs, const SequenceNumber& rhs) {
- return lhs == rhs || lhs > rhs;
-}
-
-inline bool operator==(const SequenceNumber& lhs, const SequenceNumber& rhs) {
- return lhs.m_value == rhs.m_value;
-}
-
-inline bool operator!=(const SequenceNumber& lhs, const SequenceNumber& rhs) {
- return lhs.m_value != rhs.m_value;
-}
-
-} // namespace nt
-
-#endif // NT_SEQNUM_H_
diff --git a/third_party/ntcore_2017/src/Storage.cpp b/third_party/ntcore_2017/src/Storage.cpp
deleted file mode 100644
index 4129fdd..0000000
--- a/third_party/ntcore_2017/src/Storage.cpp
+++ /dev/null
@@ -1,1491 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Storage.h"
-
-#include <cctype>
-#include <string>
-#include <tuple>
-
-#include "llvm/StringExtras.h"
-#include "support/Base64.h"
-#include "support/timestamp.h"
-#include "Log.h"
-#include "NetworkConnection.h"
-
-using namespace nt;
-
-ATOMIC_STATIC_INIT(Storage)
-
-Storage::Storage()
- : Storage(Notifier::GetInstance(), RpcServer::GetInstance()) {}
-
-Storage::Storage(Notifier& notifier, RpcServer& rpc_server)
- : m_notifier(notifier), m_rpc_server(rpc_server) {
- m_terminating = false;
-}
-
-Storage::~Storage() {
- Logger::GetInstance().SetLogger(nullptr);
- m_terminating = true;
- m_rpc_results_cond.notify_all();
-}
-
-void Storage::SetOutgoing(QueueOutgoingFunc queue_outgoing, bool server) {
- std::lock_guard<std::mutex> lock(m_mutex);
- m_queue_outgoing = queue_outgoing;
- m_server = server;
-}
-
-void Storage::ClearOutgoing() { m_queue_outgoing = nullptr; }
-
-NT_Type Storage::GetEntryType(unsigned int id) const {
- std::lock_guard<std::mutex> lock(m_mutex);
- if (id >= m_idmap.size()) return NT_UNASSIGNED;
- Entry* entry = m_idmap[id];
- if (!entry || !entry->value) return NT_UNASSIGNED;
- return entry->value->type();
-}
-
-void Storage::ProcessIncoming(std::shared_ptr<Message> msg,
- NetworkConnection* conn,
- std::weak_ptr<NetworkConnection> conn_weak) {
- std::unique_lock<std::mutex> lock(m_mutex);
- switch (msg->type()) {
- case Message::kKeepAlive:
- break; // ignore
- case Message::kClientHello:
- case Message::kProtoUnsup:
- case Message::kServerHelloDone:
- case Message::kServerHello:
- case Message::kClientHelloDone:
- // shouldn't get these, but ignore if we do
- break;
- case Message::kEntryAssign: {
- unsigned int id = msg->id();
- StringRef name = msg->str();
- Entry* entry;
- bool may_need_update = false;
- if (m_server) {
- // if we're a server, id=0xffff requests are requests for an id
- // to be assigned, and we need to send the new assignment back to
- // the sender as well as all other connections.
- if (id == 0xffff) {
- // see if it was already assigned; ignore if so.
- if (m_entries.count(name) != 0) return;
-
- // create it locally
- id = m_idmap.size();
- auto& new_entry = m_entries[name];
- if (!new_entry) new_entry.reset(new Entry(name));
- entry = new_entry.get();
- entry->value = msg->value();
- entry->flags = msg->flags();
- entry->id = id;
- m_idmap.push_back(entry);
-
- // update persistent dirty flag if it's persistent
- if (entry->IsPersistent()) m_persistent_dirty = true;
-
- // notify
- m_notifier.NotifyEntry(name, entry->value, NT_NOTIFY_NEW);
-
- // send the assignment to everyone (including the originator)
- if (m_queue_outgoing) {
- auto queue_outgoing = m_queue_outgoing;
- auto outmsg = Message::EntryAssign(name, id, entry->seq_num.value(),
- msg->value(), msg->flags());
- lock.unlock();
- queue_outgoing(outmsg, nullptr, nullptr);
- }
- return;
- }
- if (id >= m_idmap.size() || !m_idmap[id]) {
- // ignore arbitrary entry assignments
- // this can happen due to e.g. assignment to deleted entry
- lock.unlock();
- DEBUG("server: received assignment to unknown entry");
- return;
- }
- entry = m_idmap[id];
- } else {
- // clients simply accept new assignments
- if (id == 0xffff) {
- lock.unlock();
- DEBUG("client: received entry assignment request?");
- return;
- }
- if (id >= m_idmap.size()) m_idmap.resize(id + 1);
- entry = m_idmap[id];
- if (!entry) {
- // create local
- auto& new_entry = m_entries[name];
- if (!new_entry) {
- // didn't exist at all (rather than just being a response to a
- // id assignment request)
- new_entry.reset(new Entry(name));
- new_entry->value = msg->value();
- new_entry->flags = msg->flags();
- new_entry->id = id;
- m_idmap[id] = new_entry.get();
-
- // notify
- m_notifier.NotifyEntry(name, new_entry->value, NT_NOTIFY_NEW);
- return;
- }
- may_need_update = true; // we may need to send an update message
- entry = new_entry.get();
- entry->id = id;
- m_idmap[id] = entry;
-
- // if the received flags don't match what we sent, we most likely
- // updated flags locally in the interim; send flags update message.
- if (msg->flags() != entry->flags) {
- auto queue_outgoing = m_queue_outgoing;
- auto outmsg = Message::FlagsUpdate(id, entry->flags);
- lock.unlock();
- queue_outgoing(outmsg, nullptr, nullptr);
- lock.lock();
- }
- }
- }
-
- // common client and server handling
-
- // already exists; ignore if sequence number not higher than local
- SequenceNumber seq_num(msg->seq_num_uid());
- if (seq_num < entry->seq_num) {
- if (may_need_update) {
- auto queue_outgoing = m_queue_outgoing;
- auto outmsg = Message::EntryUpdate(entry->id, entry->seq_num.value(),
- entry->value);
- lock.unlock();
- queue_outgoing(outmsg, nullptr, nullptr);
- }
- return;
- }
-
- // sanity check: name should match id
- if (msg->str() != entry->name) {
- lock.unlock();
- DEBUG("entry assignment for same id with different name?");
- return;
- }
-
- unsigned int notify_flags = NT_NOTIFY_UPDATE;
-
- // don't update flags from a <3.0 remote (not part of message)
- // don't update flags if this is a server response to a client id request
- if (!may_need_update && conn->proto_rev() >= 0x0300) {
- // update persistent dirty flag if persistent flag changed
- if ((entry->flags & NT_PERSISTENT) != (msg->flags() & NT_PERSISTENT))
- m_persistent_dirty = true;
- if (entry->flags != msg->flags()) notify_flags |= NT_NOTIFY_FLAGS;
- entry->flags = msg->flags();
- }
-
- // update persistent dirty flag if the value changed and it's persistent
- if (entry->IsPersistent() && *entry->value != *msg->value())
- m_persistent_dirty = true;
-
- // update local
- entry->value = msg->value();
- entry->seq_num = seq_num;
-
- // notify
- m_notifier.NotifyEntry(name, entry->value, notify_flags);
-
- // broadcast to all other connections (note for client there won't
- // be any other connections, so don't bother)
- if (m_server && m_queue_outgoing) {
- auto queue_outgoing = m_queue_outgoing;
- auto outmsg = Message::EntryAssign(entry->name, id, msg->seq_num_uid(),
- msg->value(), entry->flags);
- lock.unlock();
- queue_outgoing(outmsg, nullptr, conn);
- }
- break;
- }
- case Message::kEntryUpdate: {
- unsigned int id = msg->id();
- if (id >= m_idmap.size() || !m_idmap[id]) {
- // ignore arbitrary entry updates;
- // this can happen due to deleted entries
- lock.unlock();
- DEBUG("received update to unknown entry");
- return;
- }
- Entry* entry = m_idmap[id];
-
- // ignore if sequence number not higher than local
- SequenceNumber seq_num(msg->seq_num_uid());
- if (seq_num <= entry->seq_num) return;
-
- // update local
- entry->value = msg->value();
- entry->seq_num = seq_num;
-
- // update persistent dirty flag if it's a persistent value
- if (entry->IsPersistent()) m_persistent_dirty = true;
-
- // notify
- m_notifier.NotifyEntry(entry->name, entry->value, NT_NOTIFY_UPDATE);
-
- // broadcast to all other connections (note for client there won't
- // be any other connections, so don't bother)
- if (m_server && m_queue_outgoing) {
- auto queue_outgoing = m_queue_outgoing;
- lock.unlock();
- queue_outgoing(msg, nullptr, conn);
- }
- break;
- }
- case Message::kFlagsUpdate: {
- unsigned int id = msg->id();
- if (id >= m_idmap.size() || !m_idmap[id]) {
- // ignore arbitrary entry updates;
- // this can happen due to deleted entries
- lock.unlock();
- DEBUG("received flags update to unknown entry");
- return;
- }
- Entry* entry = m_idmap[id];
-
- // ignore if flags didn't actually change
- if (entry->flags == msg->flags()) return;
-
- // update persistent dirty flag if persistent flag changed
- if ((entry->flags & NT_PERSISTENT) != (msg->flags() & NT_PERSISTENT))
- m_persistent_dirty = true;
-
- // update local
- entry->flags = msg->flags();
-
- // notify
- m_notifier.NotifyEntry(entry->name, entry->value, NT_NOTIFY_FLAGS);
-
- // broadcast to all other connections (note for client there won't
- // be any other connections, so don't bother)
- if (m_server && m_queue_outgoing) {
- auto queue_outgoing = m_queue_outgoing;
- lock.unlock();
- queue_outgoing(msg, nullptr, conn);
- }
- break;
- }
- case Message::kEntryDelete: {
- unsigned int id = msg->id();
- if (id >= m_idmap.size() || !m_idmap[id]) {
- // ignore arbitrary entry updates;
- // this can happen due to deleted entries
- lock.unlock();
- DEBUG("received delete to unknown entry");
- return;
- }
- Entry* entry = m_idmap[id];
-
- // update persistent dirty flag if it's a persistent value
- if (entry->IsPersistent()) m_persistent_dirty = true;
-
- // delete it from idmap
- m_idmap[id] = nullptr;
-
- // get entry (as we'll need it for notify) and erase it from the map
- // it should always be in the map, but sanity check just in case
- auto i = m_entries.find(entry->name);
- if (i != m_entries.end()) {
- auto entry2 = std::move(i->getValue()); // move the value out
- m_entries.erase(i);
-
- // notify
- m_notifier.NotifyEntry(entry2->name, entry2->value, NT_NOTIFY_DELETE);
- }
-
- // broadcast to all other connections (note for client there won't
- // be any other connections, so don't bother)
- if (m_server && m_queue_outgoing) {
- auto queue_outgoing = m_queue_outgoing;
- lock.unlock();
- queue_outgoing(msg, nullptr, conn);
- }
- break;
- }
- case Message::kClearEntries: {
- // update local
- DeleteAllEntriesImpl();
-
- // broadcast to all other connections (note for client there won't
- // be any other connections, so don't bother)
- if (m_server && m_queue_outgoing) {
- auto queue_outgoing = m_queue_outgoing;
- lock.unlock();
- queue_outgoing(msg, nullptr, conn);
- }
- break;
- }
- case Message::kExecuteRpc: {
- if (!m_server) return; // only process on server
- unsigned int id = msg->id();
- if (id >= m_idmap.size() || !m_idmap[id]) {
- // ignore call to non-existent RPC
- // this can happen due to deleted entries
- lock.unlock();
- DEBUG("received RPC call to unknown entry");
- return;
- }
- Entry* entry = m_idmap[id];
- if (!entry->value->IsRpc()) {
- lock.unlock();
- DEBUG("received RPC call to non-RPC entry");
- return;
- }
- ConnectionInfo conn_info;
- auto c = conn_weak.lock();
- if (c) {
- conn_info = c->info();
- } else {
- conn_info.remote_id = "";
- conn_info.remote_ip = "";
- conn_info.remote_port = 0;
- conn_info.last_update = 0;
- conn_info.protocol_version = 0;
- }
- m_rpc_server.ProcessRpc(entry->name, msg, entry->rpc_callback,
- conn->uid(),
- [=](std::shared_ptr<Message> msg) {
- auto c = conn_weak.lock();
- if (c) c->QueueOutgoing(msg);
- },
- conn_info);
- break;
- }
- case Message::kRpcResponse: {
- if (m_server) return; // only process on client
- m_rpc_results.insert(std::make_pair(
- std::make_pair(msg->id(), msg->seq_num_uid()), msg->str()));
- m_rpc_results_cond.notify_all();
- break;
- }
- default:
- break;
- }
-}
-
-void Storage::GetInitialAssignments(
- NetworkConnection& conn, std::vector<std::shared_ptr<Message>>* msgs) {
- std::lock_guard<std::mutex> lock(m_mutex);
- conn.set_state(NetworkConnection::kSynchronized);
- for (auto& i : m_entries) {
- Entry* entry = i.getValue().get();
- msgs->emplace_back(Message::EntryAssign(i.getKey(), entry->id,
- entry->seq_num.value(),
- entry->value, entry->flags));
- }
-}
-
-void Storage::ApplyInitialAssignments(
- NetworkConnection& conn, llvm::ArrayRef<std::shared_ptr<Message>> msgs,
- bool new_server, std::vector<std::shared_ptr<Message>>* out_msgs) {
- std::unique_lock<std::mutex> lock(m_mutex);
- if (m_server) return; // should not do this on server
-
- conn.set_state(NetworkConnection::kSynchronized);
-
- std::vector<std::shared_ptr<Message>> update_msgs;
-
- // clear existing id's
- for (auto& i : m_entries) i.getValue()->id = 0xffff;
-
- // clear existing idmap
- m_idmap.resize(0);
-
- // apply assignments
- for (auto& msg : msgs) {
- if (!msg->Is(Message::kEntryAssign)) {
- DEBUG("client: received non-entry assignment request?");
- continue;
- }
-
- unsigned int id = msg->id();
- if (id == 0xffff) {
- DEBUG("client: received entry assignment request?");
- continue;
- }
-
- SequenceNumber seq_num(msg->seq_num_uid());
- StringRef name = msg->str();
-
- auto& entry = m_entries[name];
- if (!entry) {
- // doesn't currently exist
- entry.reset(new Entry(name));
- entry->value = msg->value();
- entry->flags = msg->flags();
- entry->seq_num = seq_num;
- // notify
- m_notifier.NotifyEntry(name, entry->value, NT_NOTIFY_NEW);
- } else {
- // if reconnect and sequence number not higher than local, then we
- // don't update the local value and instead send it back to the server
- // as an update message
- if (!new_server && seq_num <= entry->seq_num) {
- update_msgs.emplace_back(Message::EntryUpdate(
- entry->id, entry->seq_num.value(), entry->value));
- } else {
- entry->value = msg->value();
- entry->seq_num = seq_num;
- unsigned int notify_flags = NT_NOTIFY_UPDATE;
- // don't update flags from a <3.0 remote (not part of message)
- if (conn.proto_rev() >= 0x0300) {
- if (entry->flags != msg->flags()) notify_flags |= NT_NOTIFY_FLAGS;
- entry->flags = msg->flags();
- }
- // notify
- m_notifier.NotifyEntry(name, entry->value, notify_flags);
- }
- }
-
- // set id and save to idmap
- entry->id = id;
- if (id >= m_idmap.size()) m_idmap.resize(id + 1);
- m_idmap[id] = entry.get();
- }
-
- // generate assign messages for unassigned local entries
- for (auto& i : m_entries) {
- Entry* entry = i.getValue().get();
- if (entry->id != 0xffff) continue;
- out_msgs->emplace_back(Message::EntryAssign(entry->name, entry->id,
- entry->seq_num.value(),
- entry->value, entry->flags));
- }
- auto queue_outgoing = m_queue_outgoing;
- lock.unlock();
- for (auto& msg : update_msgs) queue_outgoing(msg, nullptr, nullptr);
-}
-
-std::shared_ptr<Value> Storage::GetEntryValue(StringRef name) const {
- std::lock_guard<std::mutex> lock(m_mutex);
- auto i = m_entries.find(name);
- return i == m_entries.end() ? nullptr : i->getValue()->value;
-}
-
-bool Storage::SetDefaultEntryValue(StringRef name,
- std::shared_ptr<Value> value) {
- if (!value) return false; // can't compare to a null value
- if (name.empty()) return false; // can't compare empty name
- std::unique_lock<std::mutex> lock(m_mutex);
- auto& new_entry = m_entries[name];
- if (new_entry) { // entry already exists
- auto old_value = new_entry->value;
- // if types match return true
- if (old_value && old_value->type() == value->type())
- return true;
- else
- return false; // entry exists but doesn't match type
- }
-
- // if we've gotten here, entry does not exist, and we can write it.
- new_entry.reset(new Entry(name));
- Entry* entry = new_entry.get();
- // don't need to compare old value as we know it will assign
- entry->value = value;
-
- // if we're the server, assign an id if it doesn't have one
- if (m_server && entry->id == 0xffff) {
- unsigned int id = m_idmap.size();
- entry->id = id;
- m_idmap.push_back(entry);
- }
-
- // notify (for local listeners)
- if (m_notifier.local_notifiers()) {
- // always a new entry if we got this far
- m_notifier.NotifyEntry(name, value, NT_NOTIFY_NEW | NT_NOTIFY_LOCAL);
- }
-
- // generate message
- if (!m_queue_outgoing) return true;
- auto queue_outgoing = m_queue_outgoing;
- auto msg = Message::EntryAssign(name, entry->id, entry->seq_num.value(),
- value, entry->flags);
- lock.unlock();
- queue_outgoing(msg, nullptr, nullptr);
- return true;
-}
-
-bool Storage::SetEntryValue(StringRef name, std::shared_ptr<Value> value) {
- if (name.empty()) return true;
- if (!value) return true;
- std::unique_lock<std::mutex> lock(m_mutex);
- auto& new_entry = m_entries[name];
- if (!new_entry) new_entry.reset(new Entry(name));
- Entry* entry = new_entry.get();
- auto old_value = entry->value;
- if (old_value && old_value->type() != value->type())
- return false; // error on type mismatch
- entry->value = value;
-
- // if we're the server, assign an id if it doesn't have one
- if (m_server && entry->id == 0xffff) {
- unsigned int id = m_idmap.size();
- entry->id = id;
- m_idmap.push_back(entry);
- }
-
- // update persistent dirty flag if value changed and it's persistent
- if (entry->IsPersistent() && *old_value != *value) m_persistent_dirty = true;
-
- // notify (for local listeners)
- if (m_notifier.local_notifiers()) {
- if (!old_value)
- m_notifier.NotifyEntry(name, value, NT_NOTIFY_NEW | NT_NOTIFY_LOCAL);
- else if (*old_value != *value)
- m_notifier.NotifyEntry(name, value, NT_NOTIFY_UPDATE | NT_NOTIFY_LOCAL);
- }
-
- // generate message
- if (!m_queue_outgoing) return true;
- auto queue_outgoing = m_queue_outgoing;
- if (!old_value) {
- auto msg = Message::EntryAssign(name, entry->id, entry->seq_num.value(),
- value, entry->flags);
- lock.unlock();
- queue_outgoing(msg, nullptr, nullptr);
- } else if (*old_value != *value) {
- ++entry->seq_num;
- // don't send an update if we don't have an assigned id yet
- if (entry->id != 0xffff) {
- auto msg = Message::EntryUpdate(entry->id, entry->seq_num.value(), value);
- lock.unlock();
- queue_outgoing(msg, nullptr, nullptr);
- }
- }
- return true;
-}
-
-void Storage::SetEntryTypeValue(StringRef name, std::shared_ptr<Value> value) {
- if (name.empty()) return;
- if (!value) return;
- std::unique_lock<std::mutex> lock(m_mutex);
- auto& new_entry = m_entries[name];
- if (!new_entry) new_entry.reset(new Entry(name));
- Entry* entry = new_entry.get();
- auto old_value = entry->value;
- entry->value = value;
- if (old_value && *old_value == *value) return;
-
- // if we're the server, assign an id if it doesn't have one
- if (m_server && entry->id == 0xffff) {
- unsigned int id = m_idmap.size();
- entry->id = id;
- m_idmap.push_back(entry);
- }
-
- // update persistent dirty flag if it's a persistent value
- if (entry->IsPersistent()) m_persistent_dirty = true;
-
- // notify (for local listeners)
- if (m_notifier.local_notifiers()) {
- if (!old_value)
- m_notifier.NotifyEntry(name, value, NT_NOTIFY_NEW | NT_NOTIFY_LOCAL);
- else
- m_notifier.NotifyEntry(name, value, NT_NOTIFY_UPDATE | NT_NOTIFY_LOCAL);
- }
-
- // generate message
- if (!m_queue_outgoing) return;
- auto queue_outgoing = m_queue_outgoing;
- if (!old_value || old_value->type() != value->type()) {
- ++entry->seq_num;
- auto msg = Message::EntryAssign(name, entry->id, entry->seq_num.value(),
- value, entry->flags);
- lock.unlock();
- queue_outgoing(msg, nullptr, nullptr);
- } else {
- ++entry->seq_num;
- // don't send an update if we don't have an assigned id yet
- if (entry->id != 0xffff) {
- auto msg = Message::EntryUpdate(entry->id, entry->seq_num.value(), value);
- lock.unlock();
- queue_outgoing(msg, nullptr, nullptr);
- }
- }
-}
-
-void Storage::SetEntryFlags(StringRef name, unsigned int flags) {
- if (name.empty()) return;
- std::unique_lock<std::mutex> lock(m_mutex);
- auto i = m_entries.find(name);
- if (i == m_entries.end()) return;
- Entry* entry = i->getValue().get();
- if (entry->flags == flags) return;
-
- // update persistent dirty flag if persistent flag changed
- if ((entry->flags & NT_PERSISTENT) != (flags & NT_PERSISTENT))
- m_persistent_dirty = true;
-
- entry->flags = flags;
-
- // notify
- m_notifier.NotifyEntry(name, entry->value, NT_NOTIFY_FLAGS | NT_NOTIFY_LOCAL);
-
- // generate message
- if (!m_queue_outgoing) return;
- auto queue_outgoing = m_queue_outgoing;
- unsigned int id = entry->id;
- // don't send an update if we don't have an assigned id yet
- if (id != 0xffff) {
- lock.unlock();
- queue_outgoing(Message::FlagsUpdate(id, flags), nullptr, nullptr);
- }
-}
-
-unsigned int Storage::GetEntryFlags(StringRef name) const {
- std::lock_guard<std::mutex> lock(m_mutex);
- auto i = m_entries.find(name);
- return i == m_entries.end() ? 0 : i->getValue()->flags;
-}
-
-void Storage::DeleteEntry(StringRef name) {
- std::unique_lock<std::mutex> lock(m_mutex);
- auto i = m_entries.find(name);
- if (i == m_entries.end()) return;
- auto entry = std::move(i->getValue());
- unsigned int id = entry->id;
-
- // update persistent dirty flag if it's a persistent value
- if (entry->IsPersistent()) m_persistent_dirty = true;
-
- m_entries.erase(i); // erase from map
- if (id < m_idmap.size()) m_idmap[id] = nullptr;
-
- if (!entry->value) return;
-
- // notify
- m_notifier.NotifyEntry(name, entry->value,
- NT_NOTIFY_DELETE | NT_NOTIFY_LOCAL);
-
- // if it had a value, generate message
- // don't send an update if we don't have an assigned id yet
- if (id != 0xffff) {
- if (!m_queue_outgoing) return;
- auto queue_outgoing = m_queue_outgoing;
- lock.unlock();
- queue_outgoing(Message::EntryDelete(id), nullptr, nullptr);
- }
-}
-
-void Storage::DeleteAllEntriesImpl() {
- if (m_entries.empty()) return;
-
- // only delete non-persistent values
- // can't erase without invalidating iterators, so build a new map
- EntriesMap entries;
- for (auto& i : m_entries) {
- Entry* entry = i.getValue().get();
- if (!entry->IsPersistent()) {
- // notify it's being deleted
- if (m_notifier.local_notifiers()) {
- m_notifier.NotifyEntry(i.getKey(), i.getValue()->value,
- NT_NOTIFY_DELETE | NT_NOTIFY_LOCAL);
- }
- // remove it from idmap
- if (entry->id != 0xffff) m_idmap[entry->id] = nullptr;
- } else {
- // add it to new entries
- entries.insert(std::make_pair(i.getKey(), std::move(i.getValue())));
- }
- }
- m_entries.swap(entries);
-}
-
-void Storage::DeleteAllEntries() {
- std::unique_lock<std::mutex> lock(m_mutex);
- if (m_entries.empty()) return;
-
- DeleteAllEntriesImpl();
-
- // generate message
- if (!m_queue_outgoing) return;
- auto queue_outgoing = m_queue_outgoing;
- lock.unlock();
- queue_outgoing(Message::ClearEntries(), nullptr, nullptr);
-}
-
-std::vector<EntryInfo> Storage::GetEntryInfo(StringRef prefix,
- unsigned int types) {
- std::lock_guard<std::mutex> lock(m_mutex);
- std::vector<EntryInfo> infos;
- for (auto& i : m_entries) {
- if (!i.getKey().startswith(prefix)) continue;
- Entry* entry = i.getValue().get();
- auto value = entry->value;
- if (!value) continue;
- if (types != 0 && (types & value->type()) == 0) continue;
- EntryInfo info;
- info.name = i.getKey();
- info.type = value->type();
- info.flags = entry->flags;
- info.last_change = value->last_change();
- infos.push_back(std::move(info));
- }
- return infos;
-}
-
-void Storage::NotifyEntries(StringRef prefix,
- EntryListenerCallback only) const {
- std::lock_guard<std::mutex> lock(m_mutex);
- for (auto& i : m_entries) {
- if (!i.getKey().startswith(prefix)) continue;
- m_notifier.NotifyEntry(i.getKey(), i.getValue()->value, NT_NOTIFY_IMMEDIATE,
- only);
- }
-}
-
-/* Escapes and writes a string, including start and end double quotes */
-static void WriteString(std::ostream& os, llvm::StringRef str) {
- os << '"';
- for (auto c : str) {
- switch (c) {
- case '\\':
- os << "\\\\";
- break;
- case '\t':
- os << "\\t";
- break;
- case '\n':
- os << "\\n";
- break;
- case '"':
- os << "\\\"";
- break;
- default:
- if (std::isprint(c) && c != '=') {
- os << c;
- break;
- }
-
- // Write out the escaped representation.
- os << "\\x";
- os << llvm::hexdigit((c >> 4) & 0xF);
- os << llvm::hexdigit((c >> 0) & 0xF);
- }
- }
- os << '"';
-}
-
-bool Storage::GetPersistentEntries(
- bool periodic,
- std::vector<std::pair<std::string, std::shared_ptr<Value>>>* entries)
- const {
- // copy values out of storage as quickly as possible so lock isn't held
- {
- std::lock_guard<std::mutex> lock(m_mutex);
- // for periodic, don't re-save unless something has changed
- if (periodic && !m_persistent_dirty) return false;
- m_persistent_dirty = false;
- entries->reserve(m_entries.size());
- for (auto& i : m_entries) {
- Entry* entry = i.getValue().get();
- // only write persistent-flagged values
- if (!entry->IsPersistent()) continue;
- entries->emplace_back(i.getKey(), entry->value);
- }
- }
-
- // sort in name order
- std::sort(entries->begin(), entries->end(),
- [](const std::pair<std::string, std::shared_ptr<Value>>& a,
- const std::pair<std::string, std::shared_ptr<Value>>& b) {
- return a.first < b.first;
- });
- return true;
-}
-
-static void SavePersistentImpl(
- std::ostream& os,
- llvm::ArrayRef<std::pair<std::string, std::shared_ptr<Value>>> entries) {
- std::string base64_encoded;
-
- // header
- os << "[NetworkTables Storage 3.0]\n";
-
- for (auto& i : entries) {
- // type
- auto v = i.second;
- if (!v) continue;
- switch (v->type()) {
- case NT_BOOLEAN:
- os << "boolean ";
- break;
- case NT_DOUBLE:
- os << "double ";
- break;
- case NT_STRING:
- os << "string ";
- break;
- case NT_RAW:
- os << "raw ";
- break;
- case NT_BOOLEAN_ARRAY:
- os << "array boolean ";
- break;
- case NT_DOUBLE_ARRAY:
- os << "array double ";
- break;
- case NT_STRING_ARRAY:
- os << "array string ";
- break;
- default:
- continue;
- }
-
- // name
- WriteString(os, i.first);
-
- // =
- os << '=';
-
- // value
- switch (v->type()) {
- case NT_BOOLEAN:
- os << (v->GetBoolean() ? "true" : "false");
- break;
- case NT_DOUBLE:
- os << v->GetDouble();
- break;
- case NT_STRING:
- WriteString(os, v->GetString());
- break;
- case NT_RAW:
- wpi::Base64Encode(v->GetRaw(), &base64_encoded);
- os << base64_encoded;
- break;
- case NT_BOOLEAN_ARRAY: {
- bool first = true;
- for (auto elem : v->GetBooleanArray()) {
- if (!first) os << ',';
- first = false;
- os << (elem ? "true" : "false");
- }
- break;
- }
- case NT_DOUBLE_ARRAY: {
- bool first = true;
- for (auto elem : v->GetDoubleArray()) {
- if (!first) os << ',';
- first = false;
- os << elem;
- }
- break;
- }
- case NT_STRING_ARRAY: {
- bool first = true;
- for (auto& elem : v->GetStringArray()) {
- if (!first) os << ',';
- first = false;
- WriteString(os, elem);
- }
- break;
- }
- default:
- break;
- }
-
- // eol
- os << '\n';
- }
-}
-
-void Storage::SavePersistent(std::ostream& os, bool periodic) const {
- std::vector<std::pair<std::string, std::shared_ptr<Value>>> entries;
- if (!GetPersistentEntries(periodic, &entries)) return;
- SavePersistentImpl(os, entries);
-}
-
-const char* Storage::SavePersistent(StringRef filename, bool periodic) const {
- std::string fn = filename;
- std::string tmp = filename;
- tmp += ".tmp";
- std::string bak = filename;
- bak += ".bak";
-
- // Get entries before creating file
- std::vector<std::pair<std::string, std::shared_ptr<Value>>> entries;
- if (!GetPersistentEntries(periodic, &entries)) return nullptr;
-
- const char* err = nullptr;
-
- // start by writing to temporary file
- std::ofstream os(tmp);
- if (!os) {
- err = "could not open file";
- goto done;
- }
- DEBUG("saving persistent file '" << filename << "'");
- SavePersistentImpl(os, entries);
- os.flush();
- if (!os) {
- os.close();
- std::remove(tmp.c_str());
- err = "error saving file";
- goto done;
- }
- os.close();
-
- // Safely move to real file. We ignore any failures related to the backup.
- std::remove(bak.c_str());
- std::rename(fn.c_str(), bak.c_str());
- if (std::rename(tmp.c_str(), fn.c_str()) != 0) {
- std::rename(bak.c_str(), fn.c_str()); // attempt to restore backup
- err = "could not rename temp file to real file";
- goto done;
- }
-
-done:
- // try again if there was an error
- if (err && periodic) m_persistent_dirty = true;
- return err;
-}
-
-/* Extracts an escaped string token. Does not unescape the string.
- * If a string cannot be matched, an empty string is returned.
- * If the string is unterminated, an empty tail string is returned.
- * The returned token includes the starting and trailing quotes (unless the
- * string is unterminated).
- * Returns a pair containing the extracted token (if any) and the remaining
- * tail string.
- */
-static std::pair<llvm::StringRef, llvm::StringRef> ReadStringToken(
- llvm::StringRef source) {
- // Match opening quote
- if (source.empty() || source.front() != '"')
- return std::make_pair(llvm::StringRef(), source);
-
- // Scan for ending double quote, checking for escaped as we go.
- std::size_t size = source.size();
- std::size_t pos;
- for (pos = 1; pos < size; ++pos) {
- if (source[pos] == '"' && source[pos - 1] != '\\') {
- ++pos; // we want to include the trailing quote in the result
- break;
- }
- }
- return std::make_pair(source.slice(0, pos), source.substr(pos));
-}
-
-static int fromxdigit(char ch) {
- if (ch >= 'a' && ch <= 'f')
- return (ch - 'a' + 10);
- else if (ch >= 'A' && ch <= 'F')
- return (ch - 'A' + 10);
- else
- return ch - '0';
-}
-
-static void UnescapeString(llvm::StringRef source, std::string* dest) {
- assert(source.size() >= 2 && source.front() == '"' && source.back() == '"');
- dest->clear();
- dest->reserve(source.size() - 2);
- for (auto s = source.begin() + 1, end = source.end() - 1; s != end; ++s) {
- if (*s != '\\') {
- dest->push_back(*s);
- continue;
- }
- switch (*++s) {
- case '\\':
- case '"':
- dest->push_back(s[-1]);
- break;
- case 't':
- dest->push_back('\t');
- break;
- case 'n':
- dest->push_back('\n');
- break;
- case 'x': {
- if (!isxdigit(*(s + 1))) {
- dest->push_back('x'); // treat it like a unknown escape
- break;
- }
- int ch = fromxdigit(*++s);
- if (isxdigit(*(s + 1))) {
- ch <<= 4;
- ch |= fromxdigit(*++s);
- }
- dest->push_back(static_cast<char>(ch));
- break;
- }
- default:
- dest->push_back(s[-1]);
- break;
- }
- }
-}
-
-bool Storage::LoadPersistent(
- std::istream& is,
- std::function<void(std::size_t line, const char* msg)> warn) {
- std::string line_str;
- std::size_t line_num = 1;
-
- // entries to add
- std::vector<std::pair<std::string, std::shared_ptr<Value>>> entries;
-
- // declare these outside the loop to reduce reallocs
- std::string name, str;
- std::vector<int> boolean_array;
- std::vector<double> double_array;
- std::vector<std::string> string_array;
-
- // ignore blank lines and lines that start with ; or # (comments)
- while (std::getline(is, line_str)) {
- llvm::StringRef line = llvm::StringRef(line_str).trim();
- if (!line.empty() && line.front() != ';' && line.front() != '#') break;
- }
-
- // header
- if (line_str != "[NetworkTables Storage 3.0]") {
- if (warn) warn(line_num, "header line mismatch, ignoring rest of file");
- return false;
- }
-
- while (std::getline(is, line_str)) {
- llvm::StringRef line = llvm::StringRef(line_str).trim();
- ++line_num;
-
- // ignore blank lines and lines that start with ; or # (comments)
- if (line.empty() || line.front() == ';' || line.front() == '#') continue;
-
- // type
- llvm::StringRef type_tok;
- std::tie(type_tok, line) = line.split(' ');
- NT_Type type = NT_UNASSIGNED;
- if (type_tok == "boolean")
- type = NT_BOOLEAN;
- else if (type_tok == "double")
- type = NT_DOUBLE;
- else if (type_tok == "string")
- type = NT_STRING;
- else if (type_tok == "raw")
- type = NT_RAW;
- else if (type_tok == "array") {
- llvm::StringRef array_tok;
- std::tie(array_tok, line) = line.split(' ');
- if (array_tok == "boolean")
- type = NT_BOOLEAN_ARRAY;
- else if (array_tok == "double")
- type = NT_DOUBLE_ARRAY;
- else if (array_tok == "string")
- type = NT_STRING_ARRAY;
- }
- if (type == NT_UNASSIGNED) {
- if (warn) warn(line_num, "unrecognized type");
- continue;
- }
-
- // name
- llvm::StringRef name_tok;
- std::tie(name_tok, line) = ReadStringToken(line);
- if (name_tok.empty()) {
- if (warn) warn(line_num, "missing name");
- continue;
- }
- if (name_tok.back() != '"') {
- if (warn) warn(line_num, "unterminated name string");
- continue;
- }
- UnescapeString(name_tok, &name);
-
- // =
- line = line.ltrim(" \t");
- if (line.empty() || line.front() != '=') {
- if (warn) warn(line_num, "expected = after name");
- continue;
- }
- line = line.drop_front().ltrim(" \t");
-
- // value
- std::shared_ptr<Value> value;
- switch (type) {
- case NT_BOOLEAN:
- // only true or false is accepted
- if (line == "true")
- value = Value::MakeBoolean(true);
- else if (line == "false")
- value = Value::MakeBoolean(false);
- else {
- if (warn)
- warn(line_num, "unrecognized boolean value, not 'true' or 'false'");
- goto next_line;
- }
- break;
- case NT_DOUBLE: {
- // need to convert to null-terminated string for strtod()
- str.clear();
- str += line;
- char* end;
- double v = std::strtod(str.c_str(), &end);
- if (*end != '\0') {
- if (warn) warn(line_num, "invalid double value");
- goto next_line;
- }
- value = Value::MakeDouble(v);
- break;
- }
- case NT_STRING: {
- llvm::StringRef str_tok;
- std::tie(str_tok, line) = ReadStringToken(line);
- if (str_tok.empty()) {
- if (warn) warn(line_num, "missing string value");
- goto next_line;
- }
- if (str_tok.back() != '"') {
- if (warn) warn(line_num, "unterminated string value");
- goto next_line;
- }
- UnescapeString(str_tok, &str);
- value = Value::MakeString(std::move(str));
- break;
- }
- case NT_RAW:
- wpi::Base64Decode(line, &str);
- value = Value::MakeRaw(std::move(str));
- break;
- case NT_BOOLEAN_ARRAY: {
- llvm::StringRef elem_tok;
- boolean_array.clear();
- while (!line.empty()) {
- std::tie(elem_tok, line) = line.split(',');
- elem_tok = elem_tok.trim(" \t");
- if (elem_tok == "true")
- boolean_array.push_back(1);
- else if (elem_tok == "false")
- boolean_array.push_back(0);
- else {
- if (warn)
- warn(line_num,
- "unrecognized boolean value, not 'true' or 'false'");
- goto next_line;
- }
- }
-
- value = Value::MakeBooleanArray(std::move(boolean_array));
- break;
- }
- case NT_DOUBLE_ARRAY: {
- llvm::StringRef elem_tok;
- double_array.clear();
- while (!line.empty()) {
- std::tie(elem_tok, line) = line.split(',');
- elem_tok = elem_tok.trim(" \t");
- // need to convert to null-terminated string for strtod()
- str.clear();
- str += elem_tok;
- char* end;
- double v = std::strtod(str.c_str(), &end);
- if (*end != '\0') {
- if (warn) warn(line_num, "invalid double value");
- goto next_line;
- }
- double_array.push_back(v);
- }
-
- value = Value::MakeDoubleArray(std::move(double_array));
- break;
- }
- case NT_STRING_ARRAY: {
- llvm::StringRef elem_tok;
- string_array.clear();
- while (!line.empty()) {
- std::tie(elem_tok, line) = ReadStringToken(line);
- if (elem_tok.empty()) {
- if (warn) warn(line_num, "missing string value");
- goto next_line;
- }
- if (elem_tok.back() != '"') {
- if (warn) warn(line_num, "unterminated string value");
- goto next_line;
- }
-
- UnescapeString(elem_tok, &str);
- string_array.push_back(std::move(str));
-
- line = line.ltrim(" \t");
- if (line.empty()) break;
- if (line.front() != ',') {
- if (warn) warn(line_num, "expected comma between strings");
- goto next_line;
- }
- line = line.drop_front().ltrim(" \t");
- }
-
- value = Value::MakeStringArray(std::move(string_array));
- break;
- }
- default:
- break;
- }
- if (!name.empty() && value)
- entries.push_back(std::make_pair(std::move(name), std::move(value)));
- next_line:
- continue;
- }
-
- // copy values into storage as quickly as possible so lock isn't held
- {
- std::vector<std::shared_ptr<Message>> msgs;
- std::unique_lock<std::mutex> lock(m_mutex);
- for (auto& i : entries) {
- auto& new_entry = m_entries[i.first];
- if (!new_entry) new_entry.reset(new Entry(i.first));
- Entry* entry = new_entry.get();
- auto old_value = entry->value;
- entry->value = i.second;
- bool was_persist = entry->IsPersistent();
- if (!was_persist) entry->flags |= NT_PERSISTENT;
-
- // if we're the server, assign an id if it doesn't have one
- if (m_server && entry->id == 0xffff) {
- unsigned int id = m_idmap.size();
- entry->id = id;
- m_idmap.push_back(entry);
- }
-
- // notify (for local listeners)
- if (m_notifier.local_notifiers()) {
- if (!old_value)
- m_notifier.NotifyEntry(i.first, i.second,
- NT_NOTIFY_NEW | NT_NOTIFY_LOCAL);
- else if (*old_value != *i.second) {
- unsigned int notify_flags = NT_NOTIFY_UPDATE | NT_NOTIFY_LOCAL;
- if (!was_persist) notify_flags |= NT_NOTIFY_FLAGS;
- m_notifier.NotifyEntry(i.first, i.second, notify_flags);
- }
- }
-
- if (!m_queue_outgoing) continue; // shortcut
- ++entry->seq_num;
-
- // put on update queue
- if (!old_value || old_value->type() != i.second->type())
- msgs.emplace_back(Message::EntryAssign(i.first, entry->id,
- entry->seq_num.value(), i.second,
- entry->flags));
- else if (entry->id != 0xffff) {
- // don't send an update if we don't have an assigned id yet
- if (*old_value != *i.second)
- msgs.emplace_back(Message::EntryUpdate(
- entry->id, entry->seq_num.value(), i.second));
- if (!was_persist)
- msgs.emplace_back(Message::FlagsUpdate(entry->id, entry->flags));
- }
- }
-
- if (m_queue_outgoing) {
- auto queue_outgoing = m_queue_outgoing;
- lock.unlock();
- for (auto& msg : msgs) queue_outgoing(std::move(msg), nullptr, nullptr);
- }
- }
-
- return true;
-}
-
-const char* Storage::LoadPersistent(
- StringRef filename,
- std::function<void(std::size_t line, const char* msg)> warn) {
- std::ifstream is(filename);
- if (!is) return "could not open file";
- if (!LoadPersistent(is, warn)) return "error reading file";
- return nullptr;
-}
-
-void Storage::CreateRpc(StringRef name, StringRef def, RpcCallback callback) {
- if (name.empty() || def.empty() || !callback) return;
- std::unique_lock<std::mutex> lock(m_mutex);
- if (!m_server) return; // only server can create RPCs
-
- auto& new_entry = m_entries[name];
- if (!new_entry) new_entry.reset(new Entry(name));
- Entry* entry = new_entry.get();
- auto old_value = entry->value;
- auto value = Value::MakeRpc(def);
- entry->value = value;
-
- // set up the new callback
- entry->rpc_callback = callback;
-
- // start the RPC server
- m_rpc_server.Start();
-
- if (old_value && *old_value == *value) return;
-
- // assign an id if it doesn't have one
- if (entry->id == 0xffff) {
- unsigned int id = m_idmap.size();
- entry->id = id;
- m_idmap.push_back(entry);
- }
-
- // generate message
- if (!m_queue_outgoing) return;
- auto queue_outgoing = m_queue_outgoing;
- if (!old_value || old_value->type() != value->type()) {
- ++entry->seq_num;
- auto msg = Message::EntryAssign(name, entry->id, entry->seq_num.value(),
- value, entry->flags);
- lock.unlock();
- queue_outgoing(msg, nullptr, nullptr);
- } else {
- ++entry->seq_num;
- auto msg = Message::EntryUpdate(entry->id, entry->seq_num.value(), value);
- lock.unlock();
- queue_outgoing(msg, nullptr, nullptr);
- }
-}
-
-void Storage::CreatePolledRpc(StringRef name, StringRef def) {
- if (name.empty() || def.empty()) return;
- std::unique_lock<std::mutex> lock(m_mutex);
- if (!m_server) return; // only server can create RPCs
-
- auto& new_entry = m_entries[name];
- if (!new_entry) new_entry.reset(new Entry(name));
- Entry* entry = new_entry.get();
- auto old_value = entry->value;
- auto value = Value::MakeRpc(def);
- entry->value = value;
-
- // a nullptr callback indicates a polled RPC
- entry->rpc_callback = nullptr;
-
- if (old_value && *old_value == *value) return;
-
- // assign an id if it doesn't have one
- if (entry->id == 0xffff) {
- unsigned int id = m_idmap.size();
- entry->id = id;
- m_idmap.push_back(entry);
- }
-
- // generate message
- if (!m_queue_outgoing) return;
- auto queue_outgoing = m_queue_outgoing;
- if (!old_value || old_value->type() != value->type()) {
- ++entry->seq_num;
- auto msg = Message::EntryAssign(name, entry->id, entry->seq_num.value(),
- value, entry->flags);
- lock.unlock();
- queue_outgoing(msg, nullptr, nullptr);
- } else {
- ++entry->seq_num;
- auto msg = Message::EntryUpdate(entry->id, entry->seq_num.value(), value);
- lock.unlock();
- queue_outgoing(msg, nullptr, nullptr);
- }
-}
-
-unsigned int Storage::CallRpc(StringRef name, StringRef params) {
- std::unique_lock<std::mutex> lock(m_mutex);
- auto i = m_entries.find(name);
- if (i == m_entries.end()) return 0;
- auto& entry = i->getValue();
- if (!entry->value->IsRpc()) return 0;
-
- ++entry->rpc_call_uid;
- if (entry->rpc_call_uid > 0xffff) entry->rpc_call_uid = 0;
- unsigned int combined_uid = (entry->id << 16) | entry->rpc_call_uid;
- auto msg = Message::ExecuteRpc(entry->id, entry->rpc_call_uid, params);
- if (m_server) {
- // RPCs are unlikely to be used locally on the server, but handle it
- // gracefully anyway.
- auto rpc_callback = entry->rpc_callback;
- lock.unlock();
- ConnectionInfo conn_info;
- conn_info.remote_id = "Server";
- conn_info.remote_ip = "localhost";
- conn_info.remote_port = 0;
- conn_info.last_update = wpi::Now();
- conn_info.protocol_version = 0x0300;
- m_rpc_server.ProcessRpc(
- name, msg, rpc_callback, 0xffffU,
- [this](std::shared_ptr<Message> msg) {
- std::lock_guard<std::mutex> lock(m_mutex);
- m_rpc_results.insert(std::make_pair(
- std::make_pair(msg->id(), msg->seq_num_uid()), msg->str()));
- m_rpc_results_cond.notify_all();
- },
- conn_info);
- } else {
- auto queue_outgoing = m_queue_outgoing;
- lock.unlock();
- queue_outgoing(msg, nullptr, nullptr);
- }
- return combined_uid;
-}
-
-bool Storage::GetRpcResult(bool blocking, unsigned int call_uid,
- std::string* result) {
- return GetRpcResult(blocking, call_uid, -1, result);
-}
-
-bool Storage::GetRpcResult(bool blocking, unsigned int call_uid,
- double time_out, std::string* result) {
- std::unique_lock<std::mutex> lock(m_mutex);
- // only allow one blocking call per rpc call uid
- if (!m_rpc_blocking_calls.insert(call_uid).second) return false;
-#if defined(_MSC_VER) && _MSC_VER < 1900
- auto timeout_time = std::chrono::steady_clock::now() +
- std::chrono::duration<int64_t, std::nano>(
- static_cast<int64_t>(time_out * 1e9));
-#else
- auto timeout_time = std::chrono::steady_clock::now() +
- std::chrono::duration<double>(time_out);
-#endif
- for (;;) {
- auto i =
- m_rpc_results.find(std::make_pair(call_uid >> 16, call_uid & 0xffff));
- if (i == m_rpc_results.end()) {
- if (!blocking || m_terminating) {
- m_rpc_blocking_calls.erase(call_uid);
- return false;
- }
- if (time_out < 0) {
- m_rpc_results_cond.wait(lock);
- } else {
- auto timed_out = m_rpc_results_cond.wait_until(lock, timeout_time);
- if (timed_out == std::cv_status::timeout) {
- m_rpc_blocking_calls.erase(call_uid);
- return false;
- }
- }
- // if element does not exist, we have been canceled
- if (m_rpc_blocking_calls.count(call_uid) == 0) {
- return false;
- }
- if (m_terminating) {
- m_rpc_blocking_calls.erase(call_uid);
- return false;
- }
- continue;
- }
- result->swap(i->getSecond());
- // safe to erase even if id does not exist
- m_rpc_blocking_calls.erase(call_uid);
- m_rpc_results.erase(i);
- return true;
- }
-}
-
-void Storage::CancelBlockingRpcResult(unsigned int call_uid) {
- std::unique_lock<std::mutex> lock(m_mutex);
- // safe to erase even if id does not exist
- m_rpc_blocking_calls.erase(call_uid);
- m_rpc_results_cond.notify_all();
-}
diff --git a/third_party/ntcore_2017/src/Storage.h b/third_party/ntcore_2017/src/Storage.h
deleted file mode 100644
index 9e7d23f..0000000
--- a/third_party/ntcore_2017/src/Storage.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NT_STORAGE_H_
-#define NT_STORAGE_H_
-
-#include <atomic>
-#include <cstddef>
-#include <fstream>
-#include <functional>
-#include <iosfwd>
-#include <memory>
-#include <mutex>
-#include <vector>
-
-#include "llvm/DenseMap.h"
-#include "llvm/SmallSet.h"
-#include "llvm/StringMap.h"
-#include "support/atomic_static.h"
-#include "Message.h"
-#include "Notifier.h"
-#include "ntcore_cpp.h"
-#include "RpcServer.h"
-#include "SequenceNumber.h"
-
-namespace nt {
-
-class NetworkConnection;
-class StorageTest;
-
-class Storage {
- friend class StorageTest;
-
- public:
- static Storage& GetInstance() {
- ATOMIC_STATIC(Storage, instance);
- return instance;
- }
- ~Storage();
-
- // Accessors required by Dispatcher. A function pointer is used for
- // generation of outgoing messages to break a dependency loop between
- // Storage and Dispatcher; in operation this is always set to
- // Dispatcher::QueueOutgoing.
- typedef std::function<void(std::shared_ptr<Message> msg,
- NetworkConnection* only,
- NetworkConnection* except)>
- QueueOutgoingFunc;
- void SetOutgoing(QueueOutgoingFunc queue_outgoing, bool server);
- void ClearOutgoing();
-
- // Required for wire protocol 2.0 to get the entry type of an entry when
- // receiving entry updates (because the length/type is not provided in the
- // message itself). Not used in wire protocol 3.0.
- NT_Type GetEntryType(unsigned int id) const;
-
- void ProcessIncoming(std::shared_ptr<Message> msg, NetworkConnection* conn,
- std::weak_ptr<NetworkConnection> conn_weak);
- void GetInitialAssignments(NetworkConnection& conn,
- std::vector<std::shared_ptr<Message>>* msgs);
- void ApplyInitialAssignments(NetworkConnection& conn,
- llvm::ArrayRef<std::shared_ptr<Message>> msgs,
- bool new_server,
- std::vector<std::shared_ptr<Message>>* out_msgs);
-
- // User functions. These are the actual implementations of the corresponding
- // user API functions in ntcore_cpp.
- std::shared_ptr<Value> GetEntryValue(StringRef name) const;
- bool SetDefaultEntryValue(StringRef name, std::shared_ptr<Value> value);
- bool SetEntryValue(StringRef name, std::shared_ptr<Value> value);
- void SetEntryTypeValue(StringRef name, std::shared_ptr<Value> value);
- void SetEntryFlags(StringRef name, unsigned int flags);
- unsigned int GetEntryFlags(StringRef name) const;
- void DeleteEntry(StringRef name);
- void DeleteAllEntries();
- std::vector<EntryInfo> GetEntryInfo(StringRef prefix, unsigned int types);
- void NotifyEntries(StringRef prefix,
- EntryListenerCallback only = nullptr) const;
-
- // Filename-based save/load functions. Used both by periodic saves and
- // accessible directly via the user API.
- const char* SavePersistent(StringRef filename, bool periodic) const;
- const char* LoadPersistent(
- StringRef filename,
- std::function<void(std::size_t line, const char* msg)> warn);
-
- // Stream-based save/load functions (exposed for testing purposes). These
- // implement the guts of the filename-based functions.
- void SavePersistent(std::ostream& os, bool periodic) const;
- bool LoadPersistent(
- std::istream& is,
- std::function<void(std::size_t line, const char* msg)> warn);
-
- // RPC configuration needs to come through here as RPC definitions are
- // actually special Storage value types.
- void CreateRpc(StringRef name, StringRef def, RpcCallback callback);
- void CreatePolledRpc(StringRef name, StringRef def);
-
- unsigned int CallRpc(StringRef name, StringRef params);
- bool GetRpcResult(bool blocking, unsigned int call_uid, std::string* result);
- bool GetRpcResult(bool blocking, unsigned int call_uid, double time_out,
- std::string* result);
- void CancelBlockingRpcResult(unsigned int call_uid);
-
- private:
- Storage();
- Storage(Notifier& notifier, RpcServer& rpcserver);
- Storage(const Storage&) = delete;
- Storage& operator=(const Storage&) = delete;
-
- // Data for each table entry.
- struct Entry {
- Entry(llvm::StringRef name_)
- : name(name_), flags(0), id(0xffff), rpc_call_uid(0) {}
- bool IsPersistent() const { return (flags & NT_PERSISTENT) != 0; }
-
- // We redundantly store the name so that it's available when accessing the
- // raw Entry* via the ID map.
- std::string name;
-
- // The current value and flags.
- std::shared_ptr<Value> value;
- unsigned int flags;
-
- // Unique ID for this entry as used in network messages. The value is
- // assigned by the server, so on the client this is 0xffff until an
- // entry assignment is received back from the server.
- unsigned int id;
-
- // Sequence number for update resolution.
- SequenceNumber seq_num;
-
- // RPC callback function. Null if either not an RPC or if the RPC is
- // polled.
- RpcCallback rpc_callback;
-
- // Last UID used when calling this RPC (primarily for client use). This
- // is incremented for each call.
- unsigned int rpc_call_uid;
- };
-
- typedef llvm::StringMap<std::unique_ptr<Entry>> EntriesMap;
- typedef std::vector<Entry*> IdMap;
- typedef llvm::DenseMap<std::pair<unsigned int, unsigned int>, std::string>
- RpcResultMap;
- typedef llvm::SmallSet<unsigned int, 12> RpcBlockingCallSet;
-
- mutable std::mutex m_mutex;
- EntriesMap m_entries;
- IdMap m_idmap;
- RpcResultMap m_rpc_results;
- RpcBlockingCallSet m_rpc_blocking_calls;
- // If any persistent values have changed
- mutable bool m_persistent_dirty = false;
-
- // condition variable and termination flag for blocking on a RPC result
- std::atomic_bool m_terminating;
- std::condition_variable m_rpc_results_cond;
-
- // configured by dispatcher at startup
- QueueOutgoingFunc m_queue_outgoing;
- bool m_server = true;
-
- // references to singletons (we don't grab them directly for testing purposes)
- Notifier& m_notifier;
- RpcServer& m_rpc_server;
-
- bool GetPersistentEntries(
- bool periodic,
- std::vector<std::pair<std::string, std::shared_ptr<Value>>>* entries)
- const;
- void DeleteAllEntriesImpl();
-
- ATOMIC_STATIC_DECL(Storage)
-};
-
-} // namespace nt
-
-#endif // NT_STORAGE_H_
diff --git a/third_party/ntcore_2017/src/Value.cpp b/third_party/ntcore_2017/src/Value.cpp
deleted file mode 100644
index ae9d779..0000000
--- a/third_party/ntcore_2017/src/Value.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "nt_Value.h"
-#include "Value_internal.h"
-#include "support/timestamp.h"
-
-using namespace nt;
-
-Value::Value() {
- m_val.type = NT_UNASSIGNED;
- m_val.last_change = wpi::Now();
-}
-
-Value::Value(NT_Type type, const private_init&) {
- m_val.type = type;
- m_val.last_change = wpi::Now();
- if (m_val.type == NT_BOOLEAN_ARRAY)
- m_val.data.arr_boolean.arr = nullptr;
- else if (m_val.type == NT_DOUBLE_ARRAY)
- m_val.data.arr_double.arr = nullptr;
- else if (m_val.type == NT_STRING_ARRAY)
- m_val.data.arr_string.arr = nullptr;
-}
-
-Value::~Value() {
- if (m_val.type == NT_BOOLEAN_ARRAY)
- delete[] m_val.data.arr_boolean.arr;
- else if (m_val.type == NT_DOUBLE_ARRAY)
- delete[] m_val.data.arr_double.arr;
- else if (m_val.type == NT_STRING_ARRAY)
- delete[] m_val.data.arr_string.arr;
-}
-
-std::shared_ptr<Value> Value::MakeBooleanArray(llvm::ArrayRef<int> value) {
- auto val = std::make_shared<Value>(NT_BOOLEAN_ARRAY, private_init());
- val->m_val.data.arr_boolean.arr = new int[value.size()];
- val->m_val.data.arr_boolean.size = value.size();
- std::copy(value.begin(), value.end(), val->m_val.data.arr_boolean.arr);
- return val;
-}
-
-std::shared_ptr<Value> Value::MakeDoubleArray(llvm::ArrayRef<double> value) {
- auto val = std::make_shared<Value>(NT_DOUBLE_ARRAY, private_init());
- val->m_val.data.arr_double.arr = new double[value.size()];
- val->m_val.data.arr_double.size = value.size();
- std::copy(value.begin(), value.end(), val->m_val.data.arr_double.arr);
- return val;
-}
-
-std::shared_ptr<Value> Value::MakeStringArray(
- llvm::ArrayRef<std::string> value) {
- auto val = std::make_shared<Value>(NT_STRING_ARRAY, private_init());
- val->m_string_array = value;
- // point NT_Value to the contents in the vector.
- val->m_val.data.arr_string.arr = new NT_String[value.size()];
- val->m_val.data.arr_string.size = val->m_string_array.size();
- for (std::size_t i = 0; i < value.size(); ++i) {
- val->m_val.data.arr_string.arr[i].str = const_cast<char*>(value[i].c_str());
- val->m_val.data.arr_string.arr[i].len = value[i].size();
- }
- return val;
-}
-
-std::shared_ptr<Value> Value::MakeStringArray(
- std::vector<std::string>&& value) {
- auto val = std::make_shared<Value>(NT_STRING_ARRAY, private_init());
- val->m_string_array = std::move(value);
- value.clear();
- // point NT_Value to the contents in the vector.
- val->m_val.data.arr_string.arr = new NT_String[val->m_string_array.size()];
- val->m_val.data.arr_string.size = val->m_string_array.size();
- for (std::size_t i = 0; i < val->m_string_array.size(); ++i) {
- val->m_val.data.arr_string.arr[i].str =
- const_cast<char*>(val->m_string_array[i].c_str());
- val->m_val.data.arr_string.arr[i].len = val->m_string_array[i].size();
- }
- return val;
-}
-
-void nt::ConvertToC(const Value& in, NT_Value* out) {
- out->type = NT_UNASSIGNED;
- switch (in.type()) {
- case NT_UNASSIGNED:
- return;
- case NT_BOOLEAN:
- out->data.v_boolean = in.GetBoolean() ? 1 : 0;
- break;
- case NT_DOUBLE:
- out->data.v_double = in.GetDouble();
- break;
- case NT_STRING:
- ConvertToC(in.GetString(), &out->data.v_string);
- break;
- case NT_RAW:
- ConvertToC(in.GetRaw(), &out->data.v_raw);
- break;
- case NT_RPC:
- ConvertToC(in.GetRpc(), &out->data.v_raw);
- break;
- case NT_BOOLEAN_ARRAY: {
- auto v = in.GetBooleanArray();
- out->data.arr_boolean.arr =
- static_cast<int*>(std::malloc(v.size() * sizeof(int)));
- out->data.arr_boolean.size = v.size();
- std::copy(v.begin(), v.end(), out->data.arr_boolean.arr);
- break;
- }
- case NT_DOUBLE_ARRAY: {
- auto v = in.GetDoubleArray();
- out->data.arr_double.arr =
- static_cast<double*>(std::malloc(v.size() * sizeof(double)));
- out->data.arr_double.size = v.size();
- std::copy(v.begin(), v.end(), out->data.arr_double.arr);
- break;
- }
- case NT_STRING_ARRAY: {
- auto v = in.GetStringArray();
- out->data.arr_string.arr =
- static_cast<NT_String*>(std::malloc(v.size() * sizeof(NT_String)));
- for (size_t i = 0; i < v.size(); ++i)
- ConvertToC(v[i], &out->data.arr_string.arr[i]);
- out->data.arr_string.size = v.size();
- break;
- }
- default:
- // assert(false && "unknown value type");
- return;
- }
- out->type = in.type();
-}
-
-void nt::ConvertToC(llvm::StringRef in, NT_String* out) {
- out->len = in.size();
- out->str = static_cast<char*>(std::malloc(in.size() + 1));
- std::memcpy(out->str, in.data(), in.size());
- out->str[in.size()] = '\0';
-}
-
-std::shared_ptr<Value> nt::ConvertFromC(const NT_Value& value) {
- switch (value.type) {
- case NT_UNASSIGNED:
- return nullptr;
- case NT_BOOLEAN:
- return Value::MakeBoolean(value.data.v_boolean != 0);
- case NT_DOUBLE:
- return Value::MakeDouble(value.data.v_double);
- case NT_STRING:
- return Value::MakeString(ConvertFromC(value.data.v_string));
- case NT_RAW:
- return Value::MakeRaw(ConvertFromC(value.data.v_raw));
- case NT_RPC:
- return Value::MakeRpc(ConvertFromC(value.data.v_raw));
- case NT_BOOLEAN_ARRAY:
- return Value::MakeBooleanArray(llvm::ArrayRef<int>(
- value.data.arr_boolean.arr, value.data.arr_boolean.size));
- case NT_DOUBLE_ARRAY:
- return Value::MakeDoubleArray(llvm::ArrayRef<double>(
- value.data.arr_double.arr, value.data.arr_double.size));
- case NT_STRING_ARRAY: {
- std::vector<std::string> v;
- v.reserve(value.data.arr_string.size);
- for (size_t i = 0; i < value.data.arr_string.size; ++i)
- v.push_back(ConvertFromC(value.data.arr_string.arr[i]));
- return Value::MakeStringArray(std::move(v));
- }
- default:
- // assert(false && "unknown value type");
- return nullptr;
- }
-}
-
-bool nt::operator==(const Value& lhs, const Value& rhs) {
- if (lhs.type() != rhs.type()) return false;
- switch (lhs.type()) {
- case NT_UNASSIGNED:
- return true; // XXX: is this better being false instead?
- case NT_BOOLEAN:
- return lhs.m_val.data.v_boolean == rhs.m_val.data.v_boolean;
- case NT_DOUBLE:
- return lhs.m_val.data.v_double == rhs.m_val.data.v_double;
- case NT_STRING:
- case NT_RAW:
- case NT_RPC:
- return lhs.m_string == rhs.m_string;
- case NT_BOOLEAN_ARRAY:
- if (lhs.m_val.data.arr_boolean.size != rhs.m_val.data.arr_boolean.size)
- return false;
- return std::memcmp(lhs.m_val.data.arr_boolean.arr,
- rhs.m_val.data.arr_boolean.arr,
- lhs.m_val.data.arr_boolean.size *
- sizeof(lhs.m_val.data.arr_boolean.arr[0])) == 0;
- case NT_DOUBLE_ARRAY:
- if (lhs.m_val.data.arr_double.size != rhs.m_val.data.arr_double.size)
- return false;
- return std::memcmp(lhs.m_val.data.arr_double.arr,
- rhs.m_val.data.arr_double.arr,
- lhs.m_val.data.arr_double.size *
- sizeof(lhs.m_val.data.arr_double.arr[0])) == 0;
- case NT_STRING_ARRAY:
- return lhs.m_string_array == rhs.m_string_array;
- default:
- // assert(false && "unknown value type");
- return false;
- }
-}
diff --git a/third_party/ntcore_2017/src/Value_internal.h b/third_party/ntcore_2017/src/Value_internal.h
deleted file mode 100644
index f09748c..0000000
--- a/third_party/ntcore_2017/src/Value_internal.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NT_VALUE_INTERNAL_H_
-#define NT_VALUE_INTERNAL_H_
-
-#include <memory>
-#include <string>
-
-#include "llvm/StringRef.h"
-#include "ntcore_c.h"
-
-namespace nt {
-
-class Value;
-
-void ConvertToC(const Value& in, NT_Value* out);
-std::shared_ptr<Value> ConvertFromC(const NT_Value& value);
-void ConvertToC(llvm::StringRef in, NT_String* out);
-inline llvm::StringRef ConvertFromC(const NT_String& str) {
- return llvm::StringRef(str.str, str.len);
-}
-
-} // namespace nt
-
-#endif // NT_VALUE_INTERNAL_H_
diff --git a/third_party/ntcore_2017/src/WireDecoder.cpp b/third_party/ntcore_2017/src/WireDecoder.cpp
deleted file mode 100644
index 2af12ce..0000000
--- a/third_party/ntcore_2017/src/WireDecoder.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "WireDecoder.h"
-
-#include <cassert>
-#include <cstdint>
-#include <cstdlib>
-#include <cstring>
-
-#include "llvm/MathExtras.h"
-#include "support/leb128.h"
-
-using namespace nt;
-
-static double ReadDouble(const char*& buf) {
- // Fast but non-portable!
- std::uint64_t val = (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- ++buf;
- val <<= 8;
- val |= (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- ++buf;
- val <<= 8;
- val |= (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- ++buf;
- val <<= 8;
- val |= (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- ++buf;
- val <<= 8;
- val |= (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- ++buf;
- val <<= 8;
- val |= (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- ++buf;
- val <<= 8;
- val |= (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- ++buf;
- val <<= 8;
- val |= (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- ++buf;
- return llvm::BitsToDouble(val);
-}
-
-WireDecoder::WireDecoder(wpi::raw_istream& is, unsigned int proto_rev)
- : m_is(is) {
- // Start with a 1K temporary buffer. Use malloc instead of new so we can
- // realloc.
- m_allocated = 1024;
- m_buf = static_cast<char*>(std::malloc(m_allocated));
- m_proto_rev = proto_rev;
- m_error = nullptr;
-}
-
-WireDecoder::~WireDecoder() { std::free(m_buf); }
-
-bool WireDecoder::ReadDouble(double* val) {
- const char* buf;
- if (!Read(&buf, 8)) return false;
- *val = ::ReadDouble(buf);
- return true;
-}
-
-void WireDecoder::Realloc(std::size_t len) {
- // Double current buffer size until we have enough space.
- if (m_allocated >= len) return;
- std::size_t newlen = m_allocated * 2;
- while (newlen < len) newlen *= 2;
- m_buf = static_cast<char*>(std::realloc(m_buf, newlen));
- m_allocated = newlen;
-}
-
-bool WireDecoder::ReadType(NT_Type* type) {
- unsigned int itype;
- if (!Read8(&itype)) return false;
- // Convert from byte value to enum
- switch (itype) {
- case 0x00:
- *type = NT_BOOLEAN;
- break;
- case 0x01:
- *type = NT_DOUBLE;
- break;
- case 0x02:
- *type = NT_STRING;
- break;
- case 0x03:
- *type = NT_RAW;
- break;
- case 0x10:
- *type = NT_BOOLEAN_ARRAY;
- break;
- case 0x11:
- *type = NT_DOUBLE_ARRAY;
- break;
- case 0x12:
- *type = NT_STRING_ARRAY;
- break;
- case 0x20:
- *type = NT_RPC;
- break;
- default:
- *type = NT_UNASSIGNED;
- m_error = "unrecognized value type";
- return false;
- }
- return true;
-}
-
-std::shared_ptr<Value> WireDecoder::ReadValue(NT_Type type) {
- switch (type) {
- case NT_BOOLEAN: {
- unsigned int v;
- if (!Read8(&v)) return nullptr;
- return Value::MakeBoolean(v != 0);
- }
- case NT_DOUBLE: {
- double v;
- if (!ReadDouble(&v)) return nullptr;
- return Value::MakeDouble(v);
- }
- case NT_STRING: {
- std::string v;
- if (!ReadString(&v)) return nullptr;
- return Value::MakeString(std::move(v));
- }
- case NT_RAW: {
- if (m_proto_rev < 0x0300u) {
- m_error = "received raw value in protocol < 3.0";
- return nullptr;
- }
- std::string v;
- if (!ReadString(&v)) return nullptr;
- return Value::MakeRaw(std::move(v));
- }
- case NT_RPC: {
- if (m_proto_rev < 0x0300u) {
- m_error = "received RPC value in protocol < 3.0";
- return nullptr;
- }
- std::string v;
- if (!ReadString(&v)) return nullptr;
- return Value::MakeRpc(std::move(v));
- }
- case NT_BOOLEAN_ARRAY: {
- // size
- unsigned int size;
- if (!Read8(&size)) return nullptr;
-
- // array values
- const char* buf;
- if (!Read(&buf, size)) return nullptr;
- std::vector<int> v(size);
- for (unsigned int i = 0; i < size; ++i) v[i] = buf[i] ? 1 : 0;
- return Value::MakeBooleanArray(std::move(v));
- }
- case NT_DOUBLE_ARRAY: {
- // size
- unsigned int size;
- if (!Read8(&size)) return nullptr;
-
- // array values
- const char* buf;
- if (!Read(&buf, size * 8)) return nullptr;
- std::vector<double> v(size);
- for (unsigned int i = 0; i < size; ++i) v[i] = ::ReadDouble(buf);
- return Value::MakeDoubleArray(std::move(v));
- }
- case NT_STRING_ARRAY: {
- // size
- unsigned int size;
- if (!Read8(&size)) return nullptr;
-
- // array values
- std::vector<std::string> v(size);
- for (unsigned int i = 0; i < size; ++i) {
- if (!ReadString(&v[i])) return nullptr;
- }
- return Value::MakeStringArray(std::move(v));
- }
- default:
- m_error = "invalid type when trying to read value";
- return nullptr;
- }
-}
-
-bool WireDecoder::ReadString(std::string* str) {
- size_t len;
- if (m_proto_rev < 0x0300u) {
- unsigned int v;
- if (!Read16(&v)) return false;
- len = v;
- } else {
- unsigned long v;
- if (!ReadUleb128(&v)) return false;
- len = v;
- }
- const char* buf;
- if (!Read(&buf, len)) return false;
- *str = llvm::StringRef(buf, len);
- return true;
-}
diff --git a/third_party/ntcore_2017/src/WireDecoder.h b/third_party/ntcore_2017/src/WireDecoder.h
deleted file mode 100644
index b428fa3..0000000
--- a/third_party/ntcore_2017/src/WireDecoder.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NT_WIREDECODER_H_
-#define NT_WIREDECODER_H_
-
-#include <cstddef>
-
-#include "nt_Value.h"
-#include "support/leb128.h"
-#include "support/raw_istream.h"
-//#include "Log.h"
-
-namespace nt {
-
-/* Decodes network data into native representation.
- * This class is designed to read from a raw_istream, which provides a blocking
- * read interface. There are no provisions in this class for resuming a read
- * that was interrupted partway. Read functions return false if
- * raw_istream.read() returned false (indicating the end of the input data
- * stream).
- */
-class WireDecoder {
- public:
- explicit WireDecoder(wpi::raw_istream& is, unsigned int proto_rev);
- ~WireDecoder();
-
- void set_proto_rev(unsigned int proto_rev) { m_proto_rev = proto_rev; }
-
- /* Get the active protocol revision. */
- unsigned int proto_rev() const { return m_proto_rev; }
-
- /* Clears error indicator. */
- void Reset() { m_error = nullptr; }
-
- /* Returns error indicator (a string describing the error). Returns nullptr
- * if no error has occurred.
- */
- const char* error() const { return m_error; }
-
- void set_error(const char* error) { m_error = error; }
-
- /* Reads the specified number of bytes.
- * @param buf pointer to read data (output parameter)
- * @param len number of bytes to read
- * Caution: the buffer is only temporarily valid.
- */
- bool Read(const char** buf, std::size_t len) {
- if (len > m_allocated) Realloc(len);
- *buf = m_buf;
- m_is.read(m_buf, len);
-#if 0
- nt::Logger& logger = nt::Logger::GetInstance();
- if (logger.min_level() <= NT_LOG_DEBUG4 && logger.HasLogger()) {
- std::ostringstream oss;
- oss << "read " << len << " bytes:" << std::hex;
- if (!rv)
- oss << "error";
- else {
- for (std::size_t i=0; i < len; ++i)
- oss << ' ' << (unsigned int)((*buf)[i]);
- }
- logger.Log(NT_LOG_DEBUG4, __FILE__, __LINE__, oss.str().c_str());
- }
-#endif
- return !m_is.has_error();
- }
-
- /* Reads a single byte. */
- bool Read8(unsigned int* val) {
- const char* buf;
- if (!Read(&buf, 1)) return false;
- *val = (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- return true;
- }
-
- /* Reads a 16-bit word. */
- bool Read16(unsigned int* val) {
- const char* buf;
- if (!Read(&buf, 2)) return false;
- unsigned int v = (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- ++buf;
- v <<= 8;
- v |= (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- *val = v;
- return true;
- }
-
- /* Reads a 32-bit word. */
- bool Read32(unsigned long* val) {
- const char* buf;
- if (!Read(&buf, 4)) return false;
- unsigned int v = (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- ++buf;
- v <<= 8;
- v |= (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- ++buf;
- v <<= 8;
- v |= (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- ++buf;
- v <<= 8;
- v |= (*reinterpret_cast<const unsigned char*>(buf)) & 0xff;
- *val = v;
- return true;
- }
-
- /* Reads a double. */
- bool ReadDouble(double* val);
-
- /* Reads an ULEB128-encoded unsigned integer. */
- bool ReadUleb128(unsigned long* val) { return wpi::ReadUleb128(m_is, val); }
-
- bool ReadType(NT_Type* type);
- bool ReadString(std::string* str);
- std::shared_ptr<Value> ReadValue(NT_Type type);
-
- WireDecoder(const WireDecoder&) = delete;
- WireDecoder& operator=(const WireDecoder&) = delete;
-
- protected:
- /* The protocol revision. E.g. 0x0200 for version 2.0. */
- unsigned int m_proto_rev;
-
- /* Error indicator. */
- const char* m_error;
-
- private:
- /* Reallocate temporary buffer to specified length. */
- void Realloc(std::size_t len);
-
- /* input stream */
- wpi::raw_istream& m_is;
-
- /* temporary buffer */
- char* m_buf;
-
- /* allocated size of temporary buffer */
- std::size_t m_allocated;
-};
-
-} // namespace nt
-
-#endif // NT_WIREDECODER_H_
diff --git a/third_party/ntcore_2017/src/WireEncoder.cpp b/third_party/ntcore_2017/src/WireEncoder.cpp
deleted file mode 100644
index 884d4b8..0000000
--- a/third_party/ntcore_2017/src/WireEncoder.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "WireEncoder.h"
-
-#include <cassert>
-#include <cstdint>
-#include <cstdlib>
-#include <cstring>
-
-#include "llvm/MathExtras.h"
-#include "support/leb128.h"
-
-using namespace nt;
-
-WireEncoder::WireEncoder(unsigned int proto_rev) {
- m_proto_rev = proto_rev;
- m_error = nullptr;
-}
-
-void WireEncoder::WriteDouble(double val) {
- // The highest performance way to do this, albeit non-portable.
- std::uint64_t v = llvm::DoubleToBits(val);
- m_data.append({(char)((v >> 56) & 0xff), (char)((v >> 48) & 0xff),
- (char)((v >> 40) & 0xff), (char)((v >> 32) & 0xff),
- (char)((v >> 24) & 0xff), (char)((v >> 16) & 0xff),
- (char)((v >> 8) & 0xff), (char)(v & 0xff)});
-}
-
-void WireEncoder::WriteUleb128(unsigned long val) {
- wpi::WriteUleb128(m_data, val);
-}
-
-void WireEncoder::WriteType(NT_Type type) {
- char ch;
- // Convert from enum to actual byte value.
- switch (type) {
- case NT_BOOLEAN:
- ch = 0x00;
- break;
- case NT_DOUBLE:
- ch = 0x01;
- break;
- case NT_STRING:
- ch = 0x02;
- break;
- case NT_RAW:
- if (m_proto_rev < 0x0300u) {
- m_error = "raw type not supported in protocol < 3.0";
- return;
- }
- ch = 0x03;
- break;
- case NT_BOOLEAN_ARRAY:
- ch = 0x10;
- break;
- case NT_DOUBLE_ARRAY:
- ch = 0x11;
- break;
- case NT_STRING_ARRAY:
- ch = 0x12;
- break;
- case NT_RPC:
- if (m_proto_rev < 0x0300u) {
- m_error = "RPC type not supported in protocol < 3.0";
- return;
- }
- ch = 0x20;
- break;
- default:
- m_error = "unrecognized type";
- return;
- }
- m_data.push_back(ch);
-}
-
-std::size_t WireEncoder::GetValueSize(const Value& value) const {
- switch (value.type()) {
- case NT_BOOLEAN:
- return 1;
- case NT_DOUBLE:
- return 8;
- case NT_STRING:
- return GetStringSize(value.GetString());
- case NT_RAW:
- if (m_proto_rev < 0x0300u) return 0;
- return GetStringSize(value.GetRaw());
- case NT_RPC:
- if (m_proto_rev < 0x0300u) return 0;
- return GetStringSize(value.GetRpc());
- case NT_BOOLEAN_ARRAY: {
- // 1-byte size, 1 byte per element
- std::size_t size = value.GetBooleanArray().size();
- if (size > 0xff) size = 0xff; // size is only 1 byte, truncate
- return 1 + size;
- }
- case NT_DOUBLE_ARRAY: {
- // 1-byte size, 8 bytes per element
- std::size_t size = value.GetDoubleArray().size();
- if (size > 0xff) size = 0xff; // size is only 1 byte, truncate
- return 1 + size * 8;
- }
- case NT_STRING_ARRAY: {
- auto v = value.GetStringArray();
- std::size_t size = v.size();
- if (size > 0xff) size = 0xff; // size is only 1 byte, truncate
- std::size_t len = 1; // 1-byte size
- for (std::size_t i = 0; i < size; ++i) len += GetStringSize(v[i]);
- return len;
- }
- default:
- return 0;
- }
-}
-
-void WireEncoder::WriteValue(const Value& value) {
- switch (value.type()) {
- case NT_BOOLEAN:
- Write8(value.GetBoolean() ? 1 : 0);
- break;
- case NT_DOUBLE:
- WriteDouble(value.GetDouble());
- break;
- case NT_STRING:
- WriteString(value.GetString());
- break;
- case NT_RAW:
- if (m_proto_rev < 0x0300u) {
- m_error = "raw values not supported in protocol < 3.0";
- return;
- }
- WriteString(value.GetRaw());
- break;
- case NT_RPC:
- if (m_proto_rev < 0x0300u) {
- m_error = "RPC values not supported in protocol < 3.0";
- return;
- }
- WriteString(value.GetRpc());
- break;
- case NT_BOOLEAN_ARRAY: {
- auto v = value.GetBooleanArray();
- std::size_t size = v.size();
- if (size > 0xff) size = 0xff; // size is only 1 byte, truncate
- Write8(size);
-
- for (std::size_t i = 0; i < size; ++i) Write8(v[i] ? 1 : 0);
- break;
- }
- case NT_DOUBLE_ARRAY: {
- auto v = value.GetDoubleArray();
- std::size_t size = v.size();
- if (size > 0xff) size = 0xff; // size is only 1 byte, truncate
- Write8(size);
-
- for (std::size_t i = 0; i < size; ++i) WriteDouble(v[i]);
- break;
- }
- case NT_STRING_ARRAY: {
- auto v = value.GetStringArray();
- std::size_t size = v.size();
- if (size > 0xff) size = 0xff; // size is only 1 byte, truncate
- Write8(size);
-
- for (std::size_t i = 0; i < size; ++i) WriteString(v[i]);
- break;
- }
- default:
- m_error = "unrecognized type when writing value";
- return;
- }
-}
-
-std::size_t WireEncoder::GetStringSize(llvm::StringRef str) const {
- if (m_proto_rev < 0x0300u) {
- std::size_t len = str.size();
- if (len > 0xffff) len = 0xffff; // Limited to 64K length; truncate
- return 2 + len;
- }
- return wpi::SizeUleb128(str.size()) + str.size();
-}
-
-void WireEncoder::WriteString(llvm::StringRef str) {
- // length
- std::size_t len = str.size();
- if (m_proto_rev < 0x0300u) {
- if (len > 0xffff) len = 0xffff; // Limited to 64K length; truncate
- Write16(len);
- } else
- WriteUleb128(len);
-
- // contents
- m_data.append(str.data(), str.data() + len);
-}
diff --git a/third_party/ntcore_2017/src/WireEncoder.h b/third_party/ntcore_2017/src/WireEncoder.h
deleted file mode 100644
index de122a6..0000000
--- a/third_party/ntcore_2017/src/WireEncoder.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NT_WIREENCODER_H_
-#define NT_WIREENCODER_H_
-
-#include <cassert>
-#include <cstddef>
-
-#include "llvm/SmallVector.h"
-#include "llvm/StringRef.h"
-#include "nt_Value.h"
-
-namespace nt {
-
-/* Encodes native data for network transmission.
- * This class maintains an internal memory buffer for written data so that
- * it can be efficiently bursted to the network after a number of writes
- * have been performed. For this reason, all operations are non-blocking.
- */
-class WireEncoder {
- public:
- explicit WireEncoder(unsigned int proto_rev);
-
- /* Change the protocol revision (mostly affects value encoding). */
- void set_proto_rev(unsigned int proto_rev) { m_proto_rev = proto_rev; }
-
- /* Get the active protocol revision. */
- unsigned int proto_rev() const { return m_proto_rev; }
-
- /* Clears buffer and error indicator. */
- void Reset() {
- m_data.clear();
- m_error = nullptr;
- }
-
- /* Returns error indicator (a string describing the error). Returns nullptr
- * if no error has occurred.
- */
- const char* error() const { return m_error; }
-
- /* Returns pointer to start of memory buffer with written data. */
- const char* data() const { return m_data.data(); }
-
- /* Returns number of bytes written to memory buffer. */
- std::size_t size() const { return m_data.size(); }
-
- llvm::StringRef ToStringRef() const {
- return llvm::StringRef(m_data.data(), m_data.size());
- }
-
- /* Writes a single byte. */
- void Write8(unsigned int val) { m_data.push_back((char)(val & 0xff)); }
-
- /* Writes a 16-bit word. */
- void Write16(unsigned int val) {
- m_data.append({(char)((val >> 8) & 0xff), (char)(val & 0xff)});
- }
-
- /* Writes a 32-bit word. */
- void Write32(unsigned long val) {
- m_data.append({(char)((val >> 24) & 0xff), (char)((val >> 16) & 0xff),
- (char)((val >> 8) & 0xff), (char)(val & 0xff)});
- }
-
- /* Writes a double. */
- void WriteDouble(double val);
-
- /* Writes an ULEB128-encoded unsigned integer. */
- void WriteUleb128(unsigned long val);
-
- void WriteType(NT_Type type);
- void WriteValue(const Value& value);
- void WriteString(llvm::StringRef str);
-
- /* Utility function to get the written size of a value (without actually
- * writing it).
- */
- std::size_t GetValueSize(const Value& value) const;
-
- /* Utility function to get the written size of a string (without actually
- * writing it).
- */
- std::size_t GetStringSize(llvm::StringRef str) const;
-
- protected:
- /* The protocol revision. E.g. 0x0200 for version 2.0. */
- unsigned int m_proto_rev;
-
- /* Error indicator. */
- const char* m_error;
-
- private:
- llvm::SmallVector<char, 256> m_data;
-};
-
-} // namespace nt
-
-#endif // NT_WIREENCODER_H_
diff --git a/third_party/ntcore_2017/src/networktables/NetworkTable.cpp b/third_party/ntcore_2017/src/networktables/NetworkTable.cpp
deleted file mode 100644
index 5a689e9..0000000
--- a/third_party/ntcore_2017/src/networktables/NetworkTable.cpp
+++ /dev/null
@@ -1,570 +0,0 @@
-#include "networktables/NetworkTable.h"
-
-#include <algorithm>
-
-#include "llvm/raw_ostream.h"
-#include "llvm/SmallString.h"
-#include "llvm/StringMap.h"
-#include "tables/ITableListener.h"
-#include "tables/TableKeyNotDefinedException.h"
-#include "ntcore.h"
-
-using llvm::StringRef;
-
-const char NetworkTable::PATH_SEPARATOR_CHAR = '/';
-std::string NetworkTable::s_persistent_filename = "networktables.ini";
-bool NetworkTable::s_client = false;
-bool NetworkTable::s_enable_ds = true;
-bool NetworkTable::s_running = false;
-unsigned int NetworkTable::s_port = NT_DEFAULT_PORT;
-
-void NetworkTable::Initialize() {
- if (s_running) Shutdown();
- if (s_client) {
- nt::StartClient();
- if (s_enable_ds) nt::StartDSClient(s_port);
- } else
- nt::StartServer(s_persistent_filename, "", s_port);
- s_running = true;
-}
-
-void NetworkTable::Shutdown() {
- if (!s_running) return;
- if (s_client) {
- nt::StopDSClient();
- nt::StopClient();
- } else
- nt::StopServer();
- s_running = false;
-}
-
-void NetworkTable::SetClientMode() { s_client = true; }
-
-void NetworkTable::SetServerMode() { s_client = false; }
-
-void NetworkTable::SetTeam(int team) {
- std::pair<StringRef, unsigned int> servers[4];
-
- // 10.te.am.2
- llvm::SmallString<32> fixed;
- {
- llvm::raw_svector_ostream oss{fixed};
- oss << "10." << static_cast<int>(team / 100) << '.'
- << static_cast<int>(team % 100) << ".2";
- servers[0] = std::make_pair(oss.str(), s_port);
- }
-
- // 172.22.11.2
- servers[1] = std::make_pair("172.22.11.2", s_port);
-
- // roboRIO-<team>-FRC.local
- llvm::SmallString<32> mdns;
- {
- llvm::raw_svector_ostream oss{mdns};
- oss << "roboRIO-" << team << "-FRC.local";
- servers[2] = std::make_pair(oss.str(), s_port);
- }
-
- // roboRIO-<team>-FRC.lan
- llvm::SmallString<32> mdns_lan;
- {
- llvm::raw_svector_ostream oss{mdns_lan};
- oss << "roboRIO-" << team << "-FRC.lan";
- servers[3] = std::make_pair(oss.str(), s_port);
- }
-
- nt::SetServer(servers);
-}
-
-void NetworkTable::SetIPAddress(StringRef address) {
- llvm::SmallString<32> addr_copy{address};
- nt::SetServer(addr_copy.c_str(), s_port);
-
- // Stop the DS client if we're explicitly connecting to localhost
- if (address == "localhost" || address == "127.0.0.1")
- nt::StopDSClient();
- else if (s_enable_ds)
- nt::StartDSClient(s_port);
-}
-
-void NetworkTable::SetIPAddress(llvm::ArrayRef<std::string> addresses) {
- llvm::SmallVector<std::pair<StringRef, unsigned int>, 8> servers;
- for (const auto& ip_address : addresses)
- servers.emplace_back(std::make_pair(ip_address, s_port));
- nt::SetServer(servers);
-
- // Stop the DS client if we're explicitly connecting to localhost
- if (!addresses.empty() &&
- (addresses[0] == "localhost" || addresses[0] == "127.0.0.1"))
- nt::StopDSClient();
- else if (s_enable_ds)
- nt::StartDSClient(s_port);
-}
-
-void NetworkTable::SetPort(unsigned int port) { s_port = port; }
-
-void NetworkTable::SetDSClientEnabled(bool enabled) {
- s_enable_ds = enabled;
- if (s_enable_ds)
- nt::StartDSClient(s_port);
- else
- nt::StopDSClient();
-}
-
-void NetworkTable::SetPersistentFilename(StringRef filename) {
- s_persistent_filename = filename;
-}
-
-void NetworkTable::SetNetworkIdentity(StringRef name) {
- nt::SetNetworkIdentity(name);
-}
-
-void NetworkTable::GlobalDeleteAll() { nt::DeleteAllEntries(); }
-
-void NetworkTable::Flush() { nt::Flush(); }
-
-void NetworkTable::SetUpdateRate(double interval) {
- nt::SetUpdateRate(interval);
-}
-
-const char* NetworkTable::SavePersistent(llvm::StringRef filename) {
- return nt::SavePersistent(filename);
-}
-
-const char* NetworkTable::LoadPersistent(
- llvm::StringRef filename,
- std::function<void(size_t line, const char* msg)> warn) {
- return nt::LoadPersistent(filename, warn);
-}
-
-std::shared_ptr<NetworkTable> NetworkTable::GetTable(StringRef key) {
- if (!s_running) Initialize();
- if (key.empty() || key[0] == PATH_SEPARATOR_CHAR) {
- return std::make_shared<NetworkTable>(key, private_init());
- } else {
- llvm::SmallString<128> path;
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return std::make_shared<NetworkTable>(path, private_init());
- }
-}
-
-NetworkTable::NetworkTable(StringRef path, const private_init&)
- : m_path(path) {}
-
-NetworkTable::~NetworkTable() {
- for (auto& i : m_listeners) nt::RemoveEntryListener(i.second);
-}
-
-void NetworkTable::AddTableListener(ITableListener* listener) {
- AddTableListenerEx(listener, NT_NOTIFY_NEW | NT_NOTIFY_UPDATE);
-}
-
-void NetworkTable::AddTableListener(ITableListener* listener,
- bool immediateNotify) {
- unsigned int flags = NT_NOTIFY_NEW | NT_NOTIFY_UPDATE;
- if (immediateNotify) flags |= NT_NOTIFY_IMMEDIATE;
- AddTableListenerEx(listener, flags);
-}
-
-void NetworkTable::AddTableListenerEx(ITableListener* listener,
- unsigned int flags) {
- std::lock_guard<std::mutex> lock(m_mutex);
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- std::size_t prefix_len = path.size();
- unsigned int id = nt::AddEntryListener(
- path,
- [=](unsigned int /*uid*/, StringRef name,
- std::shared_ptr<nt::Value> value, unsigned int flags_) {
- StringRef relative_key = name.substr(prefix_len);
- if (relative_key.find(PATH_SEPARATOR_CHAR) != StringRef::npos) return;
- listener->ValueChangedEx(this, relative_key, value, flags_);
- },
- flags);
- m_listeners.emplace_back(listener, id);
-}
-
-void NetworkTable::AddTableListener(StringRef key, ITableListener* listener,
- bool immediateNotify) {
- unsigned int flags = NT_NOTIFY_NEW | NT_NOTIFY_UPDATE;
- if (immediateNotify) flags |= NT_NOTIFY_IMMEDIATE;
- AddTableListenerEx(key, listener, flags);
-}
-
-void NetworkTable::AddTableListenerEx(StringRef key, ITableListener* listener,
- unsigned int flags) {
- std::lock_guard<std::mutex> lock(m_mutex);
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- std::size_t prefix_len = path.size();
- path += key;
- unsigned int id = nt::AddEntryListener(
- path,
- [=](unsigned int /*uid*/, StringRef name,
- std::shared_ptr<nt::Value> value, unsigned int flags_) {
- if (name != path) return;
- listener->ValueChangedEx(this, name.substr(prefix_len), value, flags_);
- },
- flags);
- m_listeners.emplace_back(listener, id);
-}
-
-void NetworkTable::AddSubTableListener(ITableListener* listener) {
- AddSubTableListener(listener, false);
-}
-
-void NetworkTable::AddSubTableListener(ITableListener* listener,
- bool localNotify) {
- std::lock_guard<std::mutex> lock(m_mutex);
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- std::size_t prefix_len = path.size();
-
- // The lambda needs to be copyable, but StringMap is not, so use
- // a shared_ptr to it.
- auto notified_tables = std::make_shared<llvm::StringMap<char>>();
-
- unsigned int flags = NT_NOTIFY_NEW | NT_NOTIFY_IMMEDIATE;
- if (localNotify) flags |= NT_NOTIFY_LOCAL;
- unsigned int id = nt::AddEntryListener(
- path,
- [=](unsigned int /*uid*/, StringRef name,
- std::shared_ptr<nt::Value> /*value*/, unsigned int flags_) mutable {
- StringRef relative_key = name.substr(prefix_len);
- auto end_sub_table = relative_key.find(PATH_SEPARATOR_CHAR);
- if (end_sub_table == StringRef::npos) return;
- StringRef sub_table_key = relative_key.substr(0, end_sub_table);
- if (notified_tables->find(sub_table_key) == notified_tables->end())
- return;
- notified_tables->insert(std::make_pair(sub_table_key, '\0'));
- listener->ValueChangedEx(this, sub_table_key, nullptr, flags_);
- },
- flags);
- m_listeners.emplace_back(listener, id);
-}
-
-void NetworkTable::RemoveTableListener(ITableListener* listener) {
- std::lock_guard<std::mutex> lock(m_mutex);
- auto matches_begin =
- std::remove_if(m_listeners.begin(), m_listeners.end(),
- [=](const Listener& x) { return x.first == listener; });
-
- for (auto i = matches_begin; i != m_listeners.end(); ++i)
- nt::RemoveEntryListener(i->second);
- m_listeners.erase(matches_begin, m_listeners.end());
-}
-
-std::shared_ptr<ITable> NetworkTable::GetSubTable(StringRef key) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return std::make_shared<NetworkTable>(path, private_init());
-}
-
-bool NetworkTable::ContainsKey(StringRef key) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::GetEntryValue(path) != nullptr;
-}
-
-bool NetworkTable::ContainsSubTable(StringRef key) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- path += PATH_SEPARATOR_CHAR;
- return !nt::GetEntryInfo(path, 0).empty();
-}
-
-std::vector<std::string> NetworkTable::GetKeys(int types) const {
- std::vector<std::string> keys;
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- for (auto& entry : nt::GetEntryInfo(path, types)) {
- auto relative_key = StringRef(entry.name).substr(path.size());
- if (relative_key.find(PATH_SEPARATOR_CHAR) != StringRef::npos) continue;
- keys.push_back(relative_key);
- }
- return keys;
-}
-
-std::vector<std::string> NetworkTable::GetSubTables() const {
- std::vector<std::string> keys;
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- for (auto& entry : nt::GetEntryInfo(path, 0)) {
- auto relative_key = StringRef(entry.name).substr(path.size());
- std::size_t end_subtable = relative_key.find(PATH_SEPARATOR_CHAR);
- if (end_subtable == StringRef::npos) continue;
- keys.push_back(relative_key.substr(0, end_subtable));
- }
- return keys;
-}
-
-void NetworkTable::SetPersistent(StringRef key) {
- SetFlags(key, NT_PERSISTENT);
-}
-
-void NetworkTable::ClearPersistent(StringRef key) {
- ClearFlags(key, NT_PERSISTENT);
-}
-
-bool NetworkTable::IsPersistent(StringRef key) const {
- return (GetFlags(key) & NT_PERSISTENT) != 0;
-}
-
-void NetworkTable::SetFlags(StringRef key, unsigned int flags) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- nt::SetEntryFlags(path, nt::GetEntryFlags(path) | flags);
-}
-
-void NetworkTable::ClearFlags(StringRef key, unsigned int flags) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- nt::SetEntryFlags(path, nt::GetEntryFlags(path) & ~flags);
-}
-
-unsigned int NetworkTable::GetFlags(StringRef key) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::GetEntryFlags(path);
-}
-
-void NetworkTable::Delete(StringRef key) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- nt::DeleteEntry(path);
-}
-
-bool NetworkTable::PutNumber(StringRef key, double value) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetEntryValue(path, nt::Value::MakeDouble(value));
-}
-
-bool NetworkTable::SetDefaultNumber(StringRef key, double defaultValue) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetDefaultEntryValue(path, nt::Value::MakeDouble(defaultValue));
-}
-
-double NetworkTable::GetNumber(StringRef key) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- auto value = nt::GetEntryValue(path);
- if (!value || value->type() != NT_DOUBLE)
- throw TableKeyNotDefinedException(path);
- return value->GetDouble();
-}
-
-double NetworkTable::GetNumber(StringRef key, double defaultValue) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- auto value = nt::GetEntryValue(path);
- if (!value || value->type() != NT_DOUBLE) return defaultValue;
- return value->GetDouble();
-}
-
-bool NetworkTable::PutString(StringRef key, StringRef value) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetEntryValue(path, nt::Value::MakeString(value));
-}
-
-bool NetworkTable::SetDefaultString(StringRef key, StringRef defaultValue) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetDefaultEntryValue(path, nt::Value::MakeString(defaultValue));
-}
-
-std::string NetworkTable::GetString(StringRef key) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- auto value = nt::GetEntryValue(path);
- if (!value || value->type() != NT_STRING)
- throw TableKeyNotDefinedException(path);
- return value->GetString();
-}
-
-std::string NetworkTable::GetString(StringRef key,
- StringRef defaultValue) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- auto value = nt::GetEntryValue(path);
- if (!value || value->type() != NT_STRING) return defaultValue;
- return value->GetString();
-}
-
-bool NetworkTable::PutBoolean(StringRef key, bool value) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetEntryValue(path, nt::Value::MakeBoolean(value));
-}
-
-bool NetworkTable::SetDefaultBoolean(StringRef key, bool defaultValue) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetDefaultEntryValue(path, nt::Value::MakeBoolean(defaultValue));
-}
-
-bool NetworkTable::GetBoolean(StringRef key) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- auto value = nt::GetEntryValue(path);
- if (!value || value->type() != NT_BOOLEAN)
- throw TableKeyNotDefinedException(path);
- return value->GetBoolean();
-}
-
-bool NetworkTable::GetBoolean(StringRef key, bool defaultValue) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- auto value = nt::GetEntryValue(path);
- if (!value || value->type() != NT_BOOLEAN) return defaultValue;
- return value->GetBoolean();
-}
-
-bool NetworkTable::PutBooleanArray(llvm::StringRef key,
- llvm::ArrayRef<int> value) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetEntryValue(path, nt::Value::MakeBooleanArray(value));
-}
-
-bool NetworkTable::SetDefaultBooleanArray(StringRef key,
- llvm::ArrayRef<int> defaultValue) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetDefaultEntryValue(path,
- nt::Value::MakeBooleanArray(defaultValue));
-}
-
-std::vector<int> NetworkTable::GetBooleanArray(
- llvm::StringRef key, llvm::ArrayRef<int> defaultValue) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- auto value = nt::GetEntryValue(path);
- if (!value || value->type() != NT_BOOLEAN_ARRAY) return defaultValue;
- return value->GetBooleanArray();
-}
-
-bool NetworkTable::PutNumberArray(llvm::StringRef key,
- llvm::ArrayRef<double> value) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetEntryValue(path, nt::Value::MakeDoubleArray(value));
-}
-
-bool NetworkTable::SetDefaultNumberArray(StringRef key,
- llvm::ArrayRef<double> defaultValue) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetDefaultEntryValue(path,
- nt::Value::MakeDoubleArray(defaultValue));
-}
-
-std::vector<double> NetworkTable::GetNumberArray(
- llvm::StringRef key, llvm::ArrayRef<double> defaultValue) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- auto value = nt::GetEntryValue(path);
- if (!value || value->type() != NT_DOUBLE_ARRAY) return defaultValue;
- return value->GetDoubleArray();
-}
-
-bool NetworkTable::PutStringArray(llvm::StringRef key,
- llvm::ArrayRef<std::string> value) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetEntryValue(path, nt::Value::MakeStringArray(value));
-}
-
-bool NetworkTable::SetDefaultStringArray(
- StringRef key, llvm::ArrayRef<std::string> defaultValue) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetDefaultEntryValue(path,
- nt::Value::MakeStringArray(defaultValue));
-}
-
-std::vector<std::string> NetworkTable::GetStringArray(
- llvm::StringRef key, llvm::ArrayRef<std::string> defaultValue) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- auto value = nt::GetEntryValue(path);
- if (!value || value->type() != NT_STRING_ARRAY) return defaultValue;
- return value->GetStringArray();
-}
-
-bool NetworkTable::PutRaw(llvm::StringRef key, llvm::StringRef value) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetEntryValue(path, nt::Value::MakeRaw(value));
-}
-
-bool NetworkTable::SetDefaultRaw(StringRef key, StringRef defaultValue) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetDefaultEntryValue(path, nt::Value::MakeRaw(defaultValue));
-}
-
-std::string NetworkTable::GetRaw(llvm::StringRef key,
- llvm::StringRef defaultValue) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- auto value = nt::GetEntryValue(path);
- if (!value || value->type() != NT_RAW) return defaultValue;
- return value->GetRaw();
-}
-
-bool NetworkTable::PutValue(StringRef key, std::shared_ptr<nt::Value> value) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetEntryValue(path, value);
-}
-
-bool NetworkTable::SetDefaultValue(StringRef key,
- std::shared_ptr<nt::Value> defaultValue) {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::SetDefaultEntryValue(path, defaultValue);
-}
-
-std::shared_ptr<nt::Value> NetworkTable::GetValue(StringRef key) const {
- llvm::SmallString<128> path(m_path);
- path += PATH_SEPARATOR_CHAR;
- path += key;
- return nt::GetEntryValue(path);
-}
diff --git a/third_party/ntcore_2017/src/ntcore_c.cpp b/third_party/ntcore_2017/src/ntcore_c.cpp
deleted file mode 100644
index 34ffb30..0000000
--- a/third_party/ntcore_2017/src/ntcore_c.cpp
+++ /dev/null
@@ -1,884 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "ntcore.h"
-
-#include <cassert>
-#include <cstdlib>
-
-#include "support/timestamp.h"
-#include "Value_internal.h"
-
-using namespace nt;
-
-// Conversion helpers
-
-static void ConvertToC(llvm::StringRef in, char** out) {
- *out = static_cast<char*>(std::malloc(in.size() + 1));
- std::memmove(*out, in.data(), in.size());
- (*out)[in.size()] = '\0';
-}
-
-static void ConvertToC(const EntryInfo& in, NT_EntryInfo* out) {
- ConvertToC(in.name, &out->name);
- out->type = in.type;
- out->flags = in.flags;
- out->last_change = in.last_change;
-}
-
-static void ConvertToC(const ConnectionInfo& in, NT_ConnectionInfo* out) {
- ConvertToC(in.remote_id, &out->remote_id);
- ConvertToC(in.remote_ip, &out->remote_ip);
- out->remote_port = in.remote_port;
- out->last_update = in.last_update;
- out->protocol_version = in.protocol_version;
-}
-
-static void ConvertToC(const RpcParamDef& in, NT_RpcParamDef* out) {
- ConvertToC(in.name, &out->name);
- ConvertToC(*in.def_value, &out->def_value);
-}
-
-static void ConvertToC(const RpcResultDef& in, NT_RpcResultDef* out) {
- ConvertToC(in.name, &out->name);
- out->type = in.type;
-}
-
-static void ConvertToC(const RpcDefinition& in, NT_RpcDefinition* out) {
- out->version = in.version;
- ConvertToC(in.name, &out->name);
-
- out->num_params = in.params.size();
- out->params = static_cast<NT_RpcParamDef*>(
- std::malloc(in.params.size() * sizeof(NT_RpcParamDef)));
- for (size_t i = 0; i < in.params.size(); ++i)
- ConvertToC(in.params[i], &out->params[i]);
-
- out->num_results = in.results.size();
- out->results = static_cast<NT_RpcResultDef*>(
- std::malloc(in.results.size() * sizeof(NT_RpcResultDef)));
- for (size_t i = 0; i < in.results.size(); ++i)
- ConvertToC(in.results[i], &out->results[i]);
-}
-
-static void ConvertToC(const RpcCallInfo& in, NT_RpcCallInfo* out) {
- out->rpc_id = in.rpc_id;
- out->call_uid = in.call_uid;
- ConvertToC(in.name, &out->name);
- ConvertToC(in.params, &out->params);
-}
-
-static void DisposeConnectionInfo(NT_ConnectionInfo* info) {
- std::free(info->remote_id.str);
- std::free(info->remote_ip.str);
-}
-
-static void DisposeEntryInfo(NT_EntryInfo* info) { std::free(info->name.str); }
-
-static RpcParamDef ConvertFromC(const NT_RpcParamDef& in) {
- RpcParamDef out;
- out.name = ConvertFromC(in.name);
- out.def_value = ConvertFromC(in.def_value);
- return out;
-}
-
-static RpcResultDef ConvertFromC(const NT_RpcResultDef& in) {
- RpcResultDef out;
- out.name = ConvertFromC(in.name);
- out.type = in.type;
- return out;
-}
-
-static RpcDefinition ConvertFromC(const NT_RpcDefinition& in) {
- RpcDefinition out;
- out.version = in.version;
- out.name = ConvertFromC(in.name);
-
- out.params.reserve(in.num_params);
- for (size_t i = 0; i < in.num_params; ++i)
- out.params.push_back(ConvertFromC(in.params[i]));
-
- out.results.reserve(in.num_results);
- for (size_t i = 0; i < in.num_results; ++i)
- out.results.push_back(ConvertFromC(in.results[i]));
-
- return out;
-}
-
-extern "C" {
-
-/*
- * Table Functions
- */
-
-void NT_GetEntryValue(const char* name, size_t name_len,
- struct NT_Value* value) {
- NT_InitValue(value);
- auto v = nt::GetEntryValue(StringRef(name, name_len));
- if (!v) return;
- ConvertToC(*v, value);
-}
-
-int NT_SetDefaultEntryValue(const char* name, size_t name_len,
- const struct NT_Value* set_value) {
- return nt::SetDefaultEntryValue(StringRef(name, name_len),
- ConvertFromC(*set_value));
-}
-
-int NT_SetEntryValue(const char* name, size_t name_len,
- const struct NT_Value* value) {
- return nt::SetEntryValue(StringRef(name, name_len), ConvertFromC(*value));
-}
-
-void NT_SetEntryTypeValue(const char* name, size_t name_len,
- const struct NT_Value* value) {
- nt::SetEntryTypeValue(StringRef(name, name_len), ConvertFromC(*value));
-}
-
-void NT_SetEntryFlags(const char* name, size_t name_len, unsigned int flags) {
- nt::SetEntryFlags(StringRef(name, name_len), flags);
-}
-
-unsigned int NT_GetEntryFlags(const char* name, size_t name_len) {
- return nt::GetEntryFlags(StringRef(name, name_len));
-}
-
-void NT_DeleteEntry(const char* name, size_t name_len) {
- nt::DeleteEntry(StringRef(name, name_len));
-}
-
-void NT_DeleteAllEntries(void) { nt::DeleteAllEntries(); }
-
-struct NT_EntryInfo* NT_GetEntryInfo(const char* prefix, size_t prefix_len,
- unsigned int types, size_t* count) {
- auto info_v = nt::GetEntryInfo(StringRef(prefix, prefix_len), types);
- *count = info_v.size();
- if (info_v.size() == 0) return nullptr;
-
- // create array and copy into it
- NT_EntryInfo* info = static_cast<NT_EntryInfo*>(
- std::malloc(info_v.size() * sizeof(NT_EntryInfo)));
- for (size_t i = 0; i < info_v.size(); ++i) ConvertToC(info_v[i], &info[i]);
- return info;
-}
-
-void NT_Flush(void) { nt::Flush(); }
-
-/*
- * Callback Creation Functions
- */
-
-void NT_SetListenerOnStart(void (*on_start)(void* data), void* data) {
- nt::SetListenerOnStart([=]() { on_start(data); });
-}
-
-void NT_SetListenerOnExit(void (*on_exit)(void* data), void* data) {
- nt::SetListenerOnExit([=]() { on_exit(data); });
-}
-
-unsigned int NT_AddEntryListener(const char* prefix, size_t prefix_len,
- void* data, NT_EntryListenerCallback callback,
- unsigned int flags) {
- return nt::AddEntryListener(
- StringRef(prefix, prefix_len),
- [=](unsigned int uid, StringRef name, std::shared_ptr<Value> value,
- unsigned int flags_) {
- callback(uid, data, name.data(), name.size(), &value->value(), flags_);
- },
- flags);
-}
-
-void NT_RemoveEntryListener(unsigned int entry_listener_uid) {
- nt::RemoveEntryListener(entry_listener_uid);
-}
-
-unsigned int NT_AddConnectionListener(void* data,
- NT_ConnectionListenerCallback callback,
- int immediate_notify) {
- return nt::AddConnectionListener(
- [=](unsigned int uid, bool connected, const ConnectionInfo& conn) {
- NT_ConnectionInfo conn_c;
- ConvertToC(conn, &conn_c);
- callback(uid, data, connected ? 1 : 0, &conn_c);
- DisposeConnectionInfo(&conn_c);
- },
- immediate_notify != 0);
-}
-
-void NT_RemoveConnectionListener(unsigned int conn_listener_uid) {
- nt::RemoveConnectionListener(conn_listener_uid);
-}
-
-int NT_NotifierDestroyed() { return nt::NotifierDestroyed(); }
-
-/*
- * Remote Procedure Call Functions
- */
-
-void NT_SetRpcServerOnStart(void (*on_start)(void* data), void* data) {
- nt::SetRpcServerOnStart([=]() { on_start(data); });
-}
-
-void NT_SetRpcServerOnExit(void (*on_exit)(void* data), void* data) {
- nt::SetRpcServerOnExit([=]() { on_exit(data); });
-}
-
-void NT_CreateRpc(const char* name, size_t name_len, const char* def,
- size_t def_len, void* data, NT_RpcCallback callback) {
- nt::CreateRpc(StringRef(name, name_len), StringRef(def, def_len),
- [=](StringRef name, StringRef params,
- const ConnectionInfo& conn_info) -> std::string {
- size_t results_len;
- NT_ConnectionInfo conn_c;
- ConvertToC(conn_info, &conn_c);
- char* results_c =
- callback(data, name.data(), name.size(), params.data(),
- params.size(), &results_len, &conn_c);
- std::string results(results_c, results_len);
- std::free(results_c);
- DisposeConnectionInfo(&conn_c);
- return results;
- });
-}
-
-void NT_CreatePolledRpc(const char* name, size_t name_len, const char* def,
- size_t def_len) {
- nt::CreatePolledRpc(StringRef(name, name_len), StringRef(def, def_len));
-}
-
-int NT_PollRpc(int blocking, NT_RpcCallInfo* call_info) {
- RpcCallInfo call_info_cpp;
- if (!nt::PollRpc(blocking != 0, &call_info_cpp)) return 0;
- ConvertToC(call_info_cpp, call_info);
- return 1;
-}
-
-int NT_PollRpcTimeout(int blocking, double time_out,
- NT_RpcCallInfo* call_info) {
- RpcCallInfo call_info_cpp;
- if (!nt::PollRpc(blocking != 0, time_out, &call_info_cpp)) return 0;
- ConvertToC(call_info_cpp, call_info);
- return 1;
-}
-
-void NT_PostRpcResponse(unsigned int rpc_id, unsigned int call_uid,
- const char* result, size_t result_len) {
- nt::PostRpcResponse(rpc_id, call_uid, StringRef(result, result_len));
-}
-
-unsigned int NT_CallRpc(const char* name, size_t name_len, const char* params,
- size_t params_len) {
- return nt::CallRpc(StringRef(name, name_len), StringRef(params, params_len));
-}
-
-char* NT_GetRpcResult(int blocking, unsigned int call_uid, size_t* result_len) {
- std::string result;
- if (!nt::GetRpcResult(blocking != 0, call_uid, &result)) return nullptr;
-
- // convert result
- *result_len = result.size();
- char* result_cstr;
- ConvertToC(result, &result_cstr);
- return result_cstr;
-}
-
-char* NT_GetRpcResultTimeout(int blocking, unsigned int call_uid,
- double time_out, size_t* result_len) {
- std::string result;
- if (!nt::GetRpcResult(blocking != 0, call_uid, time_out, &result))
- return nullptr;
-
- // convert result
- *result_len = result.size();
- char* result_cstr;
- ConvertToC(result, &result_cstr);
- return result_cstr;
-}
-
-void NT_CancelBlockingRpcResult(unsigned int call_uid) {
- nt::CancelBlockingRpcResult(call_uid);
-}
-
-char* NT_PackRpcDefinition(const NT_RpcDefinition* def, size_t* packed_len) {
- auto packed = nt::PackRpcDefinition(ConvertFromC(*def));
-
- // convert result
- *packed_len = packed.size();
- char* packed_cstr;
- ConvertToC(packed, &packed_cstr);
- return packed_cstr;
-}
-
-int NT_UnpackRpcDefinition(const char* packed, size_t packed_len,
- NT_RpcDefinition* def) {
- nt::RpcDefinition def_v;
- if (!nt::UnpackRpcDefinition(StringRef(packed, packed_len), &def_v)) return 0;
-
- // convert result
- ConvertToC(def_v, def);
- return 1;
-}
-
-char* NT_PackRpcValues(const NT_Value** values, size_t values_len,
- size_t* packed_len) {
- // create input vector
- std::vector<std::shared_ptr<Value>> values_v;
- values_v.reserve(values_len);
- for (size_t i = 0; i < values_len; ++i)
- values_v.push_back(ConvertFromC(*values[i]));
-
- // make the call
- auto packed = nt::PackRpcValues(values_v);
-
- // convert result
- *packed_len = packed.size();
- char* packed_cstr;
- ConvertToC(packed, &packed_cstr);
- return packed_cstr;
-}
-
-NT_Value** NT_UnpackRpcValues(const char* packed, size_t packed_len,
- const NT_Type* types, size_t types_len) {
- auto values_v = nt::UnpackRpcValues(StringRef(packed, packed_len),
- ArrayRef<NT_Type>(types, types_len));
- if (values_v.size() == 0) return nullptr;
-
- // create array and copy into it
- NT_Value** values =
- static_cast<NT_Value**>(std::malloc(values_v.size() * sizeof(NT_Value*)));
- for (size_t i = 0; i < values_v.size(); ++i) {
- values[i] = static_cast<NT_Value*>(std::malloc(sizeof(NT_Value)));
- ConvertToC(*values_v[i], values[i]);
- }
- return values;
-}
-
-/*
- * Client/Server Functions
- */
-
-void NT_SetNetworkIdentity(const char* name, size_t name_len) {
- nt::SetNetworkIdentity(StringRef(name, name_len));
-}
-
-void NT_StartServer(const char* persist_filename, const char* listen_address,
- unsigned int port) {
- nt::StartServer(persist_filename, listen_address, port);
-}
-
-void NT_StopServer(void) { nt::StopServer(); }
-
-void NT_StartClientNone(void) { nt::StartClient(); }
-
-void NT_StartClient(const char* server_name, unsigned int port) {
- nt::StartClient(server_name, port);
-}
-
-void NT_StartClientMulti(size_t count, const char** server_names,
- const unsigned int* ports) {
- std::vector<std::pair<StringRef, unsigned int>> servers;
- servers.reserve(count);
- for (size_t i = 0; i < count; ++i)
- servers.emplace_back(std::make_pair(server_names[i], ports[i]));
- nt::StartClient(servers);
-}
-
-void NT_StopClient(void) { nt::StopClient(); }
-
-void NT_SetServer(const char* server_name, unsigned int port) {
- nt::SetServer(server_name, port);
-}
-
-void NT_SetServerMulti(size_t count, const char** server_names,
- const unsigned int* ports) {
- std::vector<std::pair<StringRef, unsigned int>> servers;
- servers.reserve(count);
- for (size_t i = 0; i < count; ++i)
- servers.emplace_back(std::make_pair(server_names[i], ports[i]));
- nt::SetServer(servers);
-}
-
-void NT_StartDSClient(unsigned int port) { nt::StartDSClient(port); }
-
-void NT_StopDSClient(void) { nt::StopDSClient(); }
-
-void NT_StopRpcServer(void) { nt::StopRpcServer(); }
-
-void NT_StopNotifier(void) { nt::StopNotifier(); }
-
-void NT_SetUpdateRate(double interval) { nt::SetUpdateRate(interval); }
-
-struct NT_ConnectionInfo* NT_GetConnections(size_t* count) {
- auto conn_v = nt::GetConnections();
- *count = conn_v.size();
- if (conn_v.size() == 0) return nullptr;
-
- // create array and copy into it
- NT_ConnectionInfo* conn = static_cast<NT_ConnectionInfo*>(
- std::malloc(conn_v.size() * sizeof(NT_ConnectionInfo)));
- for (size_t i = 0; i < conn_v.size(); ++i) ConvertToC(conn_v[i], &conn[i]);
- return conn;
-}
-
-/*
- * Persistent Functions
- */
-
-const char* NT_SavePersistent(const char* filename) {
- return nt::SavePersistent(filename);
-}
-
-const char* NT_LoadPersistent(const char* filename,
- void (*warn)(size_t line, const char* msg)) {
- return nt::LoadPersistent(filename, warn);
-}
-
-/*
- * Utility Functions
- */
-
-unsigned long long NT_Now() { return wpi::Now(); }
-
-void NT_SetLogger(NT_LogFunc func, unsigned int min_level) {
- nt::SetLogger(func, min_level);
-}
-
-void NT_DisposeValue(NT_Value* value) {
- switch (value->type) {
- case NT_UNASSIGNED:
- case NT_BOOLEAN:
- case NT_DOUBLE:
- break;
- case NT_STRING:
- case NT_RAW:
- case NT_RPC:
- std::free(value->data.v_string.str);
- break;
- case NT_BOOLEAN_ARRAY:
- std::free(value->data.arr_boolean.arr);
- break;
- case NT_DOUBLE_ARRAY:
- std::free(value->data.arr_double.arr);
- break;
- case NT_STRING_ARRAY: {
- for (size_t i = 0; i < value->data.arr_string.size; i++)
- std::free(value->data.arr_string.arr[i].str);
- std::free(value->data.arr_string.arr);
- break;
- }
- default:
- assert(false && "unknown value type");
- }
- value->type = NT_UNASSIGNED;
- value->last_change = 0;
-}
-
-void NT_InitValue(NT_Value* value) {
- value->type = NT_UNASSIGNED;
- value->last_change = 0;
-}
-
-void NT_DisposeString(NT_String* str) {
- std::free(str->str);
- str->str = nullptr;
- str->len = 0;
-}
-
-void NT_InitString(NT_String* str) {
- str->str = nullptr;
- str->len = 0;
-}
-
-enum NT_Type NT_GetType(const char* name, size_t name_len) {
- auto v = nt::GetEntryValue(StringRef(name, name_len));
- if (!v) return NT_Type::NT_UNASSIGNED;
- return v->type();
-}
-
-void NT_DisposeConnectionInfoArray(NT_ConnectionInfo* arr, size_t count) {
- for (size_t i = 0; i < count; i++) DisposeConnectionInfo(&arr[i]);
- std::free(arr);
-}
-
-void NT_DisposeEntryInfoArray(NT_EntryInfo* arr, size_t count) {
- for (size_t i = 0; i < count; i++) DisposeEntryInfo(&arr[i]);
- std::free(arr);
-}
-
-void NT_DisposeRpcDefinition(NT_RpcDefinition* def) {
- NT_DisposeString(&def->name);
-
- for (size_t i = 0; i < def->num_params; ++i) {
- NT_DisposeString(&def->params[i].name);
- NT_DisposeValue(&def->params[i].def_value);
- }
- std::free(def->params);
- def->params = nullptr;
- def->num_params = 0;
-
- for (size_t i = 0; i < def->num_results; ++i)
- NT_DisposeString(&def->results[i].name);
- std::free(def->results);
- def->results = nullptr;
- def->num_results = 0;
-}
-
-void NT_DisposeRpcCallInfo(NT_RpcCallInfo* call_info) {
- NT_DisposeString(&call_info->name);
- NT_DisposeString(&call_info->params);
-}
-
-/* Interop Utility Functions */
-
-/* Array and Struct Allocations */
-
-/* Allocates a char array of the specified size.*/
-char* NT_AllocateCharArray(size_t size) {
- char* retVal = static_cast<char*>(std::malloc(size * sizeof(char)));
- return retVal;
-}
-
-/* Allocates an integer or boolean array of the specified size. */
-int* NT_AllocateBooleanArray(size_t size) {
- int* retVal = static_cast<int*>(std::malloc(size * sizeof(int)));
- return retVal;
-}
-
-/* Allocates a double array of the specified size. */
-double* NT_AllocateDoubleArray(size_t size) {
- double* retVal = static_cast<double*>(std::malloc(size * sizeof(double)));
- return retVal;
-}
-
-/* Allocates an NT_String array of the specified size. */
-struct NT_String* NT_AllocateStringArray(size_t size) {
- NT_String* retVal =
- static_cast<NT_String*>(std::malloc(size * sizeof(NT_String)));
- return retVal;
-}
-
-void NT_FreeCharArray(char* v_char) { std::free(v_char); }
-void NT_FreeDoubleArray(double* v_double) { std::free(v_double); }
-void NT_FreeBooleanArray(int* v_boolean) { std::free(v_boolean); }
-void NT_FreeStringArray(struct NT_String* v_string, size_t arr_size) {
- for (size_t i = 0; i < arr_size; i++) std::free(v_string[i].str);
- std::free(v_string);
-}
-
-int NT_SetEntryDouble(const char* name, size_t name_len, double v_double,
- int force) {
- if (force != 0) {
- nt::SetEntryTypeValue(StringRef(name, name_len),
- Value::MakeDouble(v_double));
- return 1;
- } else {
- return nt::SetEntryValue(StringRef(name, name_len),
- Value::MakeDouble(v_double));
- }
-}
-
-int NT_SetEntryBoolean(const char* name, size_t name_len, int v_boolean,
- int force) {
- if (force != 0) {
- nt::SetEntryTypeValue(StringRef(name, name_len),
- Value::MakeBoolean(v_boolean != 0));
- return 1;
- } else {
- return nt::SetEntryValue(StringRef(name, name_len),
- Value::MakeBoolean(v_boolean != 0));
- }
-}
-
-int NT_SetEntryString(const char* name, size_t name_len, const char* str,
- size_t str_len, int force) {
- if (force != 0) {
- nt::SetEntryTypeValue(StringRef(name, name_len),
- Value::MakeString(StringRef(str, str_len)));
- return 1;
- } else {
- return nt::SetEntryValue(StringRef(name, name_len),
- Value::MakeString(StringRef(str, str_len)));
- }
-}
-
-int NT_SetEntryRaw(const char* name, size_t name_len, const char* raw,
- size_t raw_len, int force) {
- if (force != 0) {
- nt::SetEntryTypeValue(StringRef(name, name_len),
- Value::MakeRaw(StringRef(raw, raw_len)));
- return 1;
- } else {
- return nt::SetEntryValue(StringRef(name, name_len),
- Value::MakeRaw(StringRef(raw, raw_len)));
- }
-}
-
-int NT_SetEntryBooleanArray(const char* name, size_t name_len, const int* arr,
- size_t size, int force) {
- if (force != 0) {
- nt::SetEntryTypeValue(
- StringRef(name, name_len),
- Value::MakeBooleanArray(llvm::makeArrayRef(arr, size)));
- return 1;
- } else {
- return nt::SetEntryValue(
- StringRef(name, name_len),
- Value::MakeBooleanArray(llvm::makeArrayRef(arr, size)));
- }
-}
-
-int NT_SetEntryDoubleArray(const char* name, size_t name_len, const double* arr,
- size_t size, int force) {
- if (force != 0) {
- nt::SetEntryTypeValue(
- StringRef(name, name_len),
- Value::MakeDoubleArray(llvm::makeArrayRef(arr, size)));
- return 1;
- } else {
- return nt::SetEntryValue(
- StringRef(name, name_len),
- Value::MakeDoubleArray(llvm::makeArrayRef(arr, size)));
- }
-}
-
-int NT_SetEntryStringArray(const char* name, size_t name_len,
- const struct NT_String* arr, size_t size,
- int force) {
- std::vector<std::string> v;
- v.reserve(size);
- for (size_t i = 0; i < size; ++i) v.push_back(ConvertFromC(arr[i]));
-
- if (force != 0) {
- nt::SetEntryTypeValue(StringRef(name, name_len),
- Value::MakeStringArray(std::move(v)));
- return 1;
- } else {
- return nt::SetEntryValue(StringRef(name, name_len),
- Value::MakeStringArray(std::move(v)));
- }
-}
-
-enum NT_Type NT_GetValueType(const struct NT_Value* value) {
- if (!value) return NT_Type::NT_UNASSIGNED;
- return value->type;
-}
-
-int NT_GetValueBoolean(const struct NT_Value* value,
- unsigned long long* last_change, int* v_boolean) {
- if (!value || value->type != NT_Type::NT_BOOLEAN) return 0;
- *v_boolean = value->data.v_boolean;
- *last_change = value->last_change;
- return 1;
-}
-
-int NT_GetValueDouble(const struct NT_Value* value,
- unsigned long long* last_change, double* v_double) {
- if (!value || value->type != NT_Type::NT_DOUBLE) return 0;
- *last_change = value->last_change;
- *v_double = value->data.v_double;
- return 1;
-}
-
-char* NT_GetValueString(const struct NT_Value* value,
- unsigned long long* last_change, size_t* str_len) {
- if (!value || value->type != NT_Type::NT_STRING) return nullptr;
- *last_change = value->last_change;
- *str_len = value->data.v_string.len;
- char* str = (char*)std::malloc(value->data.v_string.len + 1);
- std::memcpy(str, value->data.v_string.str, value->data.v_string.len + 1);
- return str;
-}
-
-char* NT_GetValueRaw(const struct NT_Value* value,
- unsigned long long* last_change, size_t* raw_len) {
- if (!value || value->type != NT_Type::NT_RAW) return nullptr;
- *last_change = value->last_change;
- *raw_len = value->data.v_string.len;
- char* raw = (char*)std::malloc(value->data.v_string.len + 1);
- std::memcpy(raw, value->data.v_string.str, value->data.v_string.len + 1);
- return raw;
-}
-
-int* NT_GetValueBooleanArray(const struct NT_Value* value,
- unsigned long long* last_change,
- size_t* arr_size) {
- if (!value || value->type != NT_Type::NT_BOOLEAN_ARRAY) return nullptr;
- *last_change = value->last_change;
- *arr_size = value->data.arr_boolean.size;
- int* arr = (int*)std::malloc(value->data.arr_boolean.size * sizeof(int));
- std::memcpy(arr, value->data.arr_boolean.arr,
- value->data.arr_boolean.size * sizeof(int));
- return arr;
-}
-
-double* NT_GetValueDoubleArray(const struct NT_Value* value,
- unsigned long long* last_change,
- size_t* arr_size) {
- if (!value || value->type != NT_Type::NT_DOUBLE_ARRAY) return nullptr;
- *last_change = value->last_change;
- *arr_size = value->data.arr_double.size;
- double* arr =
- (double*)std::malloc(value->data.arr_double.size * sizeof(double));
- std::memcpy(arr, value->data.arr_double.arr,
- value->data.arr_double.size * sizeof(double));
- return arr;
-}
-
-NT_String* NT_GetValueStringArray(const struct NT_Value* value,
- unsigned long long* last_change,
- size_t* arr_size) {
- if (!value || value->type != NT_Type::NT_STRING_ARRAY) return nullptr;
- *last_change = value->last_change;
- *arr_size = value->data.arr_string.size;
- NT_String* arr = static_cast<NT_String*>(
- std::malloc(value->data.arr_string.size * sizeof(NT_String)));
- for (size_t i = 0; i < value->data.arr_string.size; ++i) {
- size_t len = value->data.arr_string.arr[i].len;
- arr[i].len = len;
- arr[i].str = (char*)std::malloc(len + 1);
- std::memcpy(arr[i].str, value->data.arr_string.arr[i].str, len + 1);
- }
- return arr;
-}
-
-int NT_SetDefaultEntryBoolean(const char* name, size_t name_len,
- int default_boolean) {
- return nt::SetDefaultEntryValue(StringRef(name, name_len),
- Value::MakeBoolean(default_boolean != 0));
-}
-
-int NT_SetDefaultEntryDouble(const char* name, size_t name_len,
- double default_double) {
- return nt::SetDefaultEntryValue(StringRef(name, name_len),
- Value::MakeDouble(default_double));
-}
-
-int NT_SetDefaultEntryString(const char* name, size_t name_len,
- const char* default_value, size_t default_len) {
- return nt::SetDefaultEntryValue(
- StringRef(name, name_len),
- Value::MakeString(StringRef(default_value, default_len)));
-}
-
-int NT_SetDefaultEntryRaw(const char* name, size_t name_len,
- const char* default_value, size_t default_len) {
- return nt::SetDefaultEntryValue(
- StringRef(name, name_len),
- Value::MakeString(StringRef(default_value, default_len)));
-}
-
-int NT_SetDefaultEntryBooleanArray(const char* name, size_t name_len,
- const int* default_value,
- size_t default_size) {
- return nt::SetDefaultEntryValue(
- StringRef(name, name_len),
- Value::MakeBooleanArray(llvm::makeArrayRef(default_value, default_size)));
-}
-
-int NT_SetDefaultEntryDoubleArray(const char* name, size_t name_len,
- const double* default_value,
- size_t default_size) {
- return nt::SetDefaultEntryValue(
- StringRef(name, name_len),
- Value::MakeDoubleArray(llvm::makeArrayRef(default_value, default_size)));
-}
-
-int NT_SetDefaultEntryStringArray(const char* name, size_t name_len,
- const struct NT_String* default_value,
- size_t default_size) {
- std::vector<std::string> vec;
- vec.reserve(default_size);
- for (size_t i = 0; i < default_size; ++i)
- vec.push_back(ConvertFromC(default_value[i]));
-
- return nt::SetDefaultEntryValue(StringRef(name, name_len),
- Value::MakeStringArray(std::move(vec)));
-}
-
-int NT_GetEntryBoolean(const char* name, size_t name_len,
- unsigned long long* last_change, int* v_boolean) {
- auto v = nt::GetEntryValue(StringRef(name, name_len));
- if (!v || !v->IsBoolean()) return 0;
- *v_boolean = v->GetBoolean();
- *last_change = v->last_change();
- return 1;
-}
-
-int NT_GetEntryDouble(const char* name, size_t name_len,
- unsigned long long* last_change, double* v_double) {
- auto v = nt::GetEntryValue(StringRef(name, name_len));
- if (!v || !v->IsDouble()) return 0;
- *last_change = v->last_change();
- *v_double = v->GetDouble();
- return 1;
-}
-
-char* NT_GetEntryString(const char* name, size_t name_len,
- unsigned long long* last_change, size_t* str_len) {
- auto v = nt::GetEntryValue(StringRef(name, name_len));
- if (!v || !v->IsString()) return nullptr;
- *last_change = v->last_change();
- struct NT_String v_string;
- nt::ConvertToC(v->GetString(), &v_string);
- *str_len = v_string.len;
- return v_string.str;
-}
-
-char* NT_GetEntryRaw(const char* name, size_t name_len,
- unsigned long long* last_change, size_t* raw_len) {
- auto v = nt::GetEntryValue(StringRef(name, name_len));
- if (!v || !v->IsRaw()) return nullptr;
- *last_change = v->last_change();
- struct NT_String v_raw;
- nt::ConvertToC(v->GetRaw(), &v_raw);
- *raw_len = v_raw.len;
- return v_raw.str;
-}
-
-int* NT_GetEntryBooleanArray(const char* name, size_t name_len,
- unsigned long long* last_change,
- size_t* arr_size) {
- auto v = nt::GetEntryValue(StringRef(name, name_len));
- if (!v || !v->IsBooleanArray()) return nullptr;
- *last_change = v->last_change();
- auto vArr = v->GetBooleanArray();
- int* arr = static_cast<int*>(std::malloc(vArr.size() * sizeof(int)));
- *arr_size = vArr.size();
- std::copy(vArr.begin(), vArr.end(), arr);
- return arr;
-}
-
-double* NT_GetEntryDoubleArray(const char* name, size_t name_len,
- unsigned long long* last_change,
- size_t* arr_size) {
- auto v = nt::GetEntryValue(StringRef(name, name_len));
- if (!v || !v->IsDoubleArray()) return nullptr;
- *last_change = v->last_change();
- auto vArr = v->GetDoubleArray();
- double* arr = static_cast<double*>(std::malloc(vArr.size() * sizeof(double)));
- *arr_size = vArr.size();
- std::copy(vArr.begin(), vArr.end(), arr);
- return arr;
-}
-
-NT_String* NT_GetEntryStringArray(const char* name, size_t name_len,
- unsigned long long* last_change,
- size_t* arr_size) {
- auto v = nt::GetEntryValue(StringRef(name, name_len));
- if (!v || !v->IsStringArray()) return nullptr;
- *last_change = v->last_change();
- auto vArr = v->GetStringArray();
- NT_String* arr =
- static_cast<NT_String*>(std::malloc(vArr.size() * sizeof(NT_String)));
- for (size_t i = 0; i < vArr.size(); ++i) {
- ConvertToC(vArr[i], &arr[i]);
- }
- *arr_size = vArr.size();
- return arr;
-}
-
-} // extern "C"
diff --git a/third_party/ntcore_2017/src/ntcore_cpp.cpp b/third_party/ntcore_2017/src/ntcore_cpp.cpp
deleted file mode 100644
index 5ae962b..0000000
--- a/third_party/ntcore_2017/src/ntcore_cpp.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "ntcore.h"
-
-#include <cassert>
-#include <cstdio>
-#include <cstdlib>
-
-#include "support/timestamp.h"
-#include "Log.h"
-#include "Dispatcher.h"
-#include "DsClient.h"
-#include "Notifier.h"
-#include "RpcServer.h"
-#include "Storage.h"
-#include "WireDecoder.h"
-#include "WireEncoder.h"
-
-namespace nt {
-
-/*
- * Table Functions
- */
-
-std::shared_ptr<Value> GetEntryValue(StringRef name) {
- return Storage::GetInstance().GetEntryValue(name);
-}
-
-bool SetDefaultEntryValue(StringRef name, std::shared_ptr<Value> value) {
- return Storage::GetInstance().SetDefaultEntryValue(name, value);
-}
-
-bool SetEntryValue(StringRef name, std::shared_ptr<Value> value) {
- return Storage::GetInstance().SetEntryValue(name, value);
-}
-
-void SetEntryTypeValue(StringRef name, std::shared_ptr<Value> value) {
- Storage::GetInstance().SetEntryTypeValue(name, value);
-}
-
-void SetEntryFlags(StringRef name, unsigned int flags) {
- Storage::GetInstance().SetEntryFlags(name, flags);
-}
-
-unsigned int GetEntryFlags(StringRef name) {
- return Storage::GetInstance().GetEntryFlags(name);
-}
-
-void DeleteEntry(StringRef name) { Storage::GetInstance().DeleteEntry(name); }
-
-void DeleteAllEntries() { Storage::GetInstance().DeleteAllEntries(); }
-
-std::vector<EntryInfo> GetEntryInfo(StringRef prefix, unsigned int types) {
- return Storage::GetInstance().GetEntryInfo(prefix, types);
-}
-
-void Flush() { Dispatcher::GetInstance().Flush(); }
-
-/*
- * Callback Creation Functions
- */
-
-void SetListenerOnStart(std::function<void()> on_start) {
- Notifier::GetInstance().SetOnStart(on_start);
-}
-
-void SetListenerOnExit(std::function<void()> on_exit) {
- Notifier::GetInstance().SetOnExit(on_exit);
-}
-
-unsigned int AddEntryListener(StringRef prefix, EntryListenerCallback callback,
- unsigned int flags) {
- unsigned int uid =
- Notifier::GetInstance().AddEntryListener(prefix, callback, flags);
- if ((flags & NT_NOTIFY_IMMEDIATE) != 0)
- Storage::GetInstance().NotifyEntries(prefix, callback);
- return uid;
-}
-
-void RemoveEntryListener(unsigned int entry_listener_uid) {
- Notifier::GetInstance().RemoveEntryListener(entry_listener_uid);
-}
-
-unsigned int AddConnectionListener(ConnectionListenerCallback callback,
- bool immediate_notify) {
- unsigned int uid = Notifier::GetInstance().AddConnectionListener(callback);
- if (immediate_notify) Dispatcher::GetInstance().NotifyConnections(callback);
- return uid;
-}
-
-void RemoveConnectionListener(unsigned int conn_listener_uid) {
- Notifier::GetInstance().RemoveConnectionListener(conn_listener_uid);
-}
-
-bool NotifierDestroyed() { return Notifier::destroyed(); }
-
-/*
- * Remote Procedure Call Functions
- */
-
-void SetRpcServerOnStart(std::function<void()> on_start) {
- RpcServer::GetInstance().SetOnStart(on_start);
-}
-
-void SetRpcServerOnExit(std::function<void()> on_exit) {
- RpcServer::GetInstance().SetOnExit(on_exit);
-}
-
-void CreateRpc(StringRef name, StringRef def, RpcCallback callback) {
- Storage::GetInstance().CreateRpc(name, def, callback);
-}
-
-void CreatePolledRpc(StringRef name, StringRef def) {
- Storage::GetInstance().CreatePolledRpc(name, def);
-}
-
-bool PollRpc(bool blocking, RpcCallInfo* call_info) {
- return RpcServer::GetInstance().PollRpc(blocking, call_info);
-}
-
-bool PollRpc(bool blocking, double time_out, RpcCallInfo* call_info) {
- return RpcServer::GetInstance().PollRpc(blocking, time_out, call_info);
-}
-
-void PostRpcResponse(unsigned int rpc_id, unsigned int call_uid,
- StringRef result) {
- RpcServer::GetInstance().PostRpcResponse(rpc_id, call_uid, result);
-}
-
-unsigned int CallRpc(StringRef name, StringRef params) {
- return Storage::GetInstance().CallRpc(name, params);
-}
-
-bool GetRpcResult(bool blocking, unsigned int call_uid, std::string* result) {
- return Storage::GetInstance().GetRpcResult(blocking, call_uid, result);
-}
-
-bool GetRpcResult(bool blocking, unsigned int call_uid, double time_out,
- std::string* result) {
- return Storage::GetInstance().GetRpcResult(blocking, call_uid, time_out,
- result);
-}
-
-void CancelBlockingRpcResult(unsigned int call_uid) {
- Storage::GetInstance().CancelBlockingRpcResult(call_uid);
-}
-
-std::string PackRpcDefinition(const RpcDefinition& def) {
- WireEncoder enc(0x0300);
- enc.Write8(def.version);
- enc.WriteString(def.name);
-
- // parameters
- unsigned int params_size = def.params.size();
- if (params_size > 0xff) params_size = 0xff;
- enc.Write8(params_size);
- for (std::size_t i = 0; i < params_size; ++i) {
- enc.WriteType(def.params[i].def_value->type());
- enc.WriteString(def.params[i].name);
- enc.WriteValue(*def.params[i].def_value);
- }
-
- // results
- unsigned int results_size = def.results.size();
- if (results_size > 0xff) results_size = 0xff;
- enc.Write8(results_size);
- for (std::size_t i = 0; i < results_size; ++i) {
- enc.WriteType(def.results[i].type);
- enc.WriteString(def.results[i].name);
- }
-
- return enc.ToStringRef();
-}
-
-bool UnpackRpcDefinition(StringRef packed, RpcDefinition* def) {
- wpi::raw_mem_istream is(packed.data(), packed.size());
- WireDecoder dec(is, 0x0300);
- if (!dec.Read8(&def->version)) return false;
- if (!dec.ReadString(&def->name)) return false;
-
- // parameters
- unsigned int params_size;
- if (!dec.Read8(¶ms_size)) return false;
- def->params.resize(0);
- def->params.reserve(params_size);
- for (std::size_t i = 0; i < params_size; ++i) {
- RpcParamDef pdef;
- NT_Type type;
- if (!dec.ReadType(&type)) return false;
- if (!dec.ReadString(&pdef.name)) return false;
- pdef.def_value = dec.ReadValue(type);
- if (!pdef.def_value) return false;
- def->params.emplace_back(std::move(pdef));
- }
-
- // results
- unsigned int results_size;
- if (!dec.Read8(&results_size)) return false;
- def->results.resize(0);
- def->results.reserve(results_size);
- for (std::size_t i = 0; i < results_size; ++i) {
- RpcResultDef rdef;
- if (!dec.ReadType(&rdef.type)) return false;
- if (!dec.ReadString(&rdef.name)) return false;
- def->results.emplace_back(std::move(rdef));
- }
-
- return true;
-}
-
-std::string PackRpcValues(ArrayRef<std::shared_ptr<Value>> values) {
- WireEncoder enc(0x0300);
- for (auto& value : values) enc.WriteValue(*value);
- return enc.ToStringRef();
-}
-
-std::vector<std::shared_ptr<Value>> UnpackRpcValues(StringRef packed,
- ArrayRef<NT_Type> types) {
- wpi::raw_mem_istream is(packed.data(), packed.size());
- WireDecoder dec(is, 0x0300);
- std::vector<std::shared_ptr<Value>> vec;
- for (auto type : types) {
- auto item = dec.ReadValue(type);
- if (!item) return std::vector<std::shared_ptr<Value>>();
- vec.emplace_back(std::move(item));
- }
- return vec;
-}
-
-/*
- * Client/Server Functions
- */
-
-void SetNetworkIdentity(StringRef name) {
- Dispatcher::GetInstance().SetIdentity(name);
-}
-
-void StartServer(StringRef persist_filename, const char* listen_address,
- unsigned int port) {
- Dispatcher::GetInstance().StartServer(persist_filename, listen_address, port);
-}
-
-void StopServer() { Dispatcher::GetInstance().Stop(); }
-
-void StartClient() { Dispatcher::GetInstance().StartClient(); }
-
-void StartClient(const char* server_name, unsigned int port) {
- auto& d = Dispatcher::GetInstance();
- d.SetServer(server_name, port);
- d.StartClient();
-}
-
-void StartClient(ArrayRef<std::pair<StringRef, unsigned int>> servers) {
- auto& d = Dispatcher::GetInstance();
- d.SetServer(servers);
- d.StartClient();
-}
-
-void StopClient() { Dispatcher::GetInstance().Stop(); }
-
-void SetServer(const char* server_name, unsigned int port) {
- Dispatcher::GetInstance().SetServer(server_name, port);
-}
-
-void SetServer(ArrayRef<std::pair<StringRef, unsigned int>> servers) {
- Dispatcher::GetInstance().SetServer(servers);
-}
-
-void StartDSClient(unsigned int port) { DsClient::GetInstance().Start(port); }
-
-void StopDSClient() { DsClient::GetInstance().Stop(); }
-
-void StopRpcServer() { RpcServer::GetInstance().Stop(); }
-
-void StopNotifier() { Notifier::GetInstance().Stop(); }
-
-void SetUpdateRate(double interval) {
- Dispatcher::GetInstance().SetUpdateRate(interval);
-}
-
-std::vector<ConnectionInfo> GetConnections() {
- return Dispatcher::GetInstance().GetConnections();
-}
-
-/*
- * Persistent Functions
- */
-
-const char* SavePersistent(StringRef filename) {
- return Storage::GetInstance().SavePersistent(filename, false);
-}
-
-const char* LoadPersistent(
- StringRef filename,
- std::function<void(size_t line, const char* msg)> warn) {
- return Storage::GetInstance().LoadPersistent(filename, warn);
-}
-
-unsigned long long Now() { return wpi::Now(); }
-
-void SetLogger(LogFunc func, unsigned int min_level) {
- Logger& logger = Logger::GetInstance();
- logger.SetLogger(func);
- logger.set_min_level(min_level);
-}
-
-} // namespace nt
diff --git a/third_party/ntcore_2017/src/ntcore_test.cpp b/third_party/ntcore_2017/src/ntcore_test.cpp
deleted file mode 100644
index 9d6cca0..0000000
--- a/third_party/ntcore_2017/src/ntcore_test.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "ntcore_test.h"
-
-#include "Value_internal.h"
-
-extern "C" {
-struct NT_String* NT_GetStringForTesting(const char* string, int* struct_size) {
- struct NT_String* str =
- static_cast<NT_String*>(std::calloc(1, sizeof(NT_String)));
- nt::ConvertToC(llvm::StringRef(string), str);
- *struct_size = sizeof(NT_String);
- return str;
-}
-
-struct NT_EntryInfo* NT_GetEntryInfoForTesting(const char* name,
- enum NT_Type type,
- unsigned int flags,
- unsigned long long last_change,
- int* struct_size) {
- struct NT_EntryInfo* entry_info =
- static_cast<NT_EntryInfo*>(std::calloc(1, sizeof(NT_EntryInfo)));
- nt::ConvertToC(llvm::StringRef(name), &entry_info->name);
- entry_info->type = type;
- entry_info->flags = flags;
- entry_info->last_change = last_change;
- *struct_size = sizeof(NT_EntryInfo);
- return entry_info;
-}
-
-void NT_FreeEntryInfoForTesting(struct NT_EntryInfo* info) {
- std::free(info->name.str);
- std::free(info);
-}
-
-struct NT_ConnectionInfo* NT_GetConnectionInfoForTesting(
- const char* remote_id, const char* remote_ip, unsigned int remote_port,
- unsigned long long last_update, unsigned int protocol_version,
- int* struct_size) {
- struct NT_ConnectionInfo* conn_info = static_cast<NT_ConnectionInfo*>(
- std::calloc(1, sizeof(NT_ConnectionInfo)));
- nt::ConvertToC(llvm::StringRef(remote_id), &conn_info->remote_id);
- nt::ConvertToC(llvm::StringRef(remote_ip), &conn_info->remote_ip);
- conn_info->remote_port = remote_port;
- conn_info->last_update = last_update;
- conn_info->protocol_version = protocol_version;
- *struct_size = sizeof(NT_ConnectionInfo);
- return conn_info;
-}
-
-void NT_FreeConnectionInfoForTesting(struct NT_ConnectionInfo* info) {
- std::free(info->remote_id.str);
- std::free(info->remote_ip.str);
- std::free(info);
-}
-
-struct NT_Value* NT_GetValueBooleanForTesting(unsigned long long last_change,
- int val, int* struct_size) {
- struct NT_Value* value =
- static_cast<NT_Value*>(std::calloc(1, sizeof(NT_Value)));
- value->type = NT_BOOLEAN;
- value->last_change = last_change;
- value->data.v_boolean = val;
- *struct_size = sizeof(NT_Value);
- return value;
-}
-
-struct NT_Value* NT_GetValueDoubleForTesting(unsigned long long last_change,
- double val, int* struct_size) {
- struct NT_Value* value =
- static_cast<NT_Value*>(std::calloc(1, sizeof(NT_Value)));
- value->type = NT_DOUBLE;
- value->last_change = last_change;
- value->data.v_double = val;
- *struct_size = sizeof(NT_Value);
- return value;
-}
-
-struct NT_Value* NT_GetValueStringForTesting(unsigned long long last_change,
- const char* str,
- int* struct_size) {
- struct NT_Value* value =
- static_cast<NT_Value*>(std::calloc(1, sizeof(NT_Value)));
- value->type = NT_STRING;
- value->last_change = last_change;
- nt::ConvertToC(llvm::StringRef(str), &value->data.v_string);
- *struct_size = sizeof(NT_Value);
- return value;
-}
-
-struct NT_Value* NT_GetValueRawForTesting(unsigned long long last_change,
- const char* raw, int raw_len,
- int* struct_size) {
- struct NT_Value* value =
- static_cast<NT_Value*>(std::calloc(1, sizeof(NT_Value)));
- value->type = NT_RAW;
- value->last_change = last_change;
- nt::ConvertToC(llvm::StringRef(raw, raw_len), &value->data.v_string);
- *struct_size = sizeof(NT_Value);
- return value;
-}
-
-struct NT_Value* NT_GetValueBooleanArrayForTesting(
- unsigned long long last_change, const int* arr, size_t array_len,
- int* struct_size) {
- struct NT_Value* value =
- static_cast<NT_Value*>(std::calloc(1, sizeof(NT_Value)));
- value->type = NT_BOOLEAN_ARRAY;
- value->last_change = last_change;
- value->data.arr_boolean.arr = NT_AllocateBooleanArray(array_len);
- value->data.arr_boolean.size = array_len;
- std::memcpy(value->data.arr_boolean.arr, arr,
- value->data.arr_boolean.size * sizeof(int));
- *struct_size = sizeof(NT_Value);
- return value;
-}
-
-struct NT_Value* NT_GetValueDoubleArrayForTesting(
- unsigned long long last_change, const double* arr, size_t array_len,
- int* struct_size) {
- struct NT_Value* value =
- static_cast<NT_Value*>(std::calloc(1, sizeof(NT_Value)));
- value->type = NT_BOOLEAN;
- value->last_change = last_change;
- value->data.arr_double.arr = NT_AllocateDoubleArray(array_len);
- value->data.arr_double.size = array_len;
- std::memcpy(value->data.arr_double.arr, arr,
- value->data.arr_double.size * sizeof(int));
- *struct_size = sizeof(NT_Value);
- return value;
-}
-
-struct NT_Value* NT_GetValueStringArrayForTesting(
- unsigned long long last_change, const struct NT_String* arr,
- size_t array_len, int* struct_size) {
- struct NT_Value* value =
- static_cast<NT_Value*>(std::calloc(1, sizeof(NT_Value)));
- value->type = NT_BOOLEAN;
- value->last_change = last_change;
- value->data.arr_string.arr = NT_AllocateStringArray(array_len);
- value->data.arr_string.size = array_len;
- for (size_t i = 0; i < value->data.arr_string.size; ++i) {
- size_t len = arr[i].len;
- value->data.arr_string.arr[i].len = len;
- value->data.arr_string.arr[i].str = (char*)std::malloc(len + 1);
- std::memcpy(value->data.arr_string.arr[i].str, arr[i].str, len + 1);
- }
- *struct_size = sizeof(NT_Value);
- return value;
-}
-// No need for free as one already exists in the main library
-
-static void CopyNtValue(const struct NT_Value* copy_from,
- struct NT_Value* copy_to) {
- auto cpp_value = nt::ConvertFromC(*copy_from);
- nt::ConvertToC(*cpp_value, copy_to);
-}
-
-static void CopyNtString(const struct NT_String* copy_from,
- struct NT_String* copy_to) {
- nt::ConvertToC(llvm::StringRef(copy_from->str, copy_from->len), copy_to);
-}
-
-struct NT_RpcParamDef* NT_GetRpcParamDefForTesting(const char* name,
- const struct NT_Value* val,
- int* struct_size) {
- struct NT_RpcParamDef* def =
- static_cast<NT_RpcParamDef*>(std::calloc(1, sizeof(NT_RpcParamDef)));
- nt::ConvertToC(llvm::StringRef(name), &def->name);
- CopyNtValue(val, &def->def_value);
- *struct_size = sizeof(NT_RpcParamDef);
- return def;
-}
-
-void NT_FreeRpcParamDefForTesting(struct NT_RpcParamDef* def) {
- NT_DisposeValue(&def->def_value);
- NT_DisposeString(&def->name);
- std::free(def);
-}
-
-struct NT_RpcResultDef* NT_GetRpcResultsDefForTesting(const char* name,
- enum NT_Type type,
- int* struct_size) {
- struct NT_RpcResultDef* def =
- static_cast<NT_RpcResultDef*>(std::calloc(1, sizeof(NT_RpcResultDef)));
- nt::ConvertToC(llvm::StringRef(name), &def->name);
- def->type = type;
- *struct_size = sizeof(NT_RpcResultDef);
- return def;
-}
-
-void NT_FreeRpcResultsDefForTesting(struct NT_RpcResultDef* def) {
- NT_DisposeString(&def->name);
- std::free(def);
-}
-
-struct NT_RpcDefinition* NT_GetRpcDefinitionForTesting(
- unsigned int version, const char* name, size_t num_params,
- const struct NT_RpcParamDef* params, size_t num_results,
- const struct NT_RpcResultDef* results, int* struct_size) {
- struct NT_RpcDefinition* def =
- static_cast<NT_RpcDefinition*>(std::calloc(1, sizeof(NT_RpcDefinition)));
- def->version = version;
- nt::ConvertToC(llvm::StringRef(name), &def->name);
- def->num_params = num_params;
- def->params = static_cast<NT_RpcParamDef*>(
- std::malloc(num_params * sizeof(NT_RpcParamDef)));
- for (size_t i = 0; i < num_params; ++i) {
- CopyNtString(¶ms[i].name, &def->params[i].name);
- CopyNtValue(¶ms[i].def_value, &def->params[i].def_value);
- }
- def->num_results = num_results;
- def->results = static_cast<NT_RpcResultDef*>(
- std::malloc(num_results * sizeof(NT_RpcResultDef)));
- for (size_t i = 0; i < num_results; ++i) {
- CopyNtString(&results[i].name, &def->results[i].name);
- def->results[i].type = results[i].type;
- }
- *struct_size = sizeof(NT_RpcDefinition);
- return def;
-}
-// No need for free as one already exists in the main library
-
-struct NT_RpcCallInfo* NT_GetRpcCallInfoForTesting(
- unsigned int rpc_id, unsigned int call_uid, const char* name,
- const char* params, size_t params_len, int* struct_size) {
- struct NT_RpcCallInfo* info =
- static_cast<NT_RpcCallInfo*>(std::calloc(1, sizeof(NT_RpcCallInfo)));
- info->rpc_id = rpc_id;
- info->call_uid = call_uid;
- nt::ConvertToC(llvm::StringRef(name), &info->name);
- nt::ConvertToC(llvm::StringRef(params, params_len), &info->params);
- *struct_size = sizeof(NT_RpcCallInfo);
- return info;
-}
-// No need for free as one already exists in the main library
-}
diff --git a/third_party/ntcore_2017/src/tables/ITableListener.cpp b/third_party/ntcore_2017/src/tables/ITableListener.cpp
deleted file mode 100644
index df1f273..0000000
--- a/third_party/ntcore_2017/src/tables/ITableListener.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "tables/ITableListener.h"
-
-#include "ntcore_c.h"
-
-void ITableListener::ValueChangedEx(ITable* source, llvm::StringRef key,
- std::shared_ptr<nt::Value> value,
- unsigned int flags) {
- ValueChanged(source, key, value, (flags & NT_NOTIFY_NEW) != 0);
-}
diff --git a/third_party/ntcore_2017/src/tables/TableKeyNotDefinedException.cpp b/third_party/ntcore_2017/src/tables/TableKeyNotDefinedException.cpp
deleted file mode 100644
index 30bedd0..0000000
--- a/third_party/ntcore_2017/src/tables/TableKeyNotDefinedException.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "tables/TableKeyNotDefinedException.h"
-
-TableKeyNotDefinedException::TableKeyNotDefinedException(llvm::StringRef key)
- : msg("Unknown Table Key: ") {
- msg += key;
-}
-
-const char* TableKeyNotDefinedException::what() const NT_NOEXCEPT {
- return msg.c_str();
-}
-
-TableKeyNotDefinedException::~TableKeyNotDefinedException() NT_NOEXCEPT {}
diff --git a/third_party/ntcore_2017/test/CMakeLists.txt b/third_party/ntcore_2017/test/CMakeLists.txt
deleted file mode 100644
index 732b0a3..0000000
--- a/third_party/ntcore_2017/test/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-add_subdirectory(unit)
-
-if(MSVC)
-set(NTCORE_LIB ntcore_static)
-else()
-set(NTCORE_LIB ntcore)
-endif()
-
-add_executable(client client.cpp)
-target_link_libraries(client ${NTCORE_LIB} ${CMAKE_THREAD_LIBS_INIT})
-add_executable(server server.cpp)
-target_link_libraries(server ${NTCORE_LIB} ${CMAKE_THREAD_LIBS_INIT})
-add_executable(rpc_local rpc_local.cpp)
-target_link_libraries(rpc_local ${NTCORE_LIB} ${CMAKE_THREAD_LIBS_INIT})
-add_executable(rpc_speed rpc_speed.cpp)
-target_link_libraries(rpc_speed ${NTCORE_LIB} ${CMAKE_THREAD_LIBS_INIT})
diff --git a/third_party/ntcore_2017/test/client.cpp b/third_party/ntcore_2017/test/client.cpp
deleted file mode 100644
index 15c1ee4..0000000
--- a/third_party/ntcore_2017/test/client.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <chrono>
-#include <cstdio>
-#include <thread>
-
-#include "ntcore.h"
-
-int main() {
- nt::SetLogger(
- [](unsigned int level, const char* file, unsigned int line,
- const char* msg) {
- std::fputs(msg, stderr);
- std::fputc('\n', stderr);
- },
- 0);
- nt::StartClient("127.0.0.1", 10000);
- std::this_thread::sleep_for(std::chrono::seconds(2));
- auto foo = nt::GetEntryValue("/foo");
- if (foo && foo->IsDouble()) printf("Got foo: %g\n", foo->GetDouble());
- nt::SetEntryValue("/bar", nt::Value::MakeBoolean(false));
- nt::SetEntryFlags("/bar", NT_PERSISTENT);
- nt::SetEntryValue("/bar2", nt::Value::MakeBoolean(true));
- nt::SetEntryValue("/bar2", nt::Value::MakeBoolean(false));
- nt::SetEntryValue("/bar2", nt::Value::MakeBoolean(true));
- std::this_thread::sleep_for(std::chrono::seconds(10));
-}
diff --git a/third_party/ntcore_2017/test/rpc_local.cpp b/third_party/ntcore_2017/test/rpc_local.cpp
deleted file mode 100644
index bec06fe..0000000
--- a/third_party/ntcore_2017/test/rpc_local.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <chrono>
-#include <cstdio>
-#include <thread>
-
-#include "ntcore.h"
-
-std::string callback1(nt::StringRef name, nt::StringRef params_str,
- const nt::ConnectionInfo& conn_info) {
- auto params = nt::UnpackRpcValues(params_str, NT_DOUBLE);
- if (params.empty()) {
- std::fputs("empty params?\n", stderr);
- return "";
- }
- std::fprintf(stderr, "called with %g\n", params[0]->GetDouble());
-
- return nt::PackRpcValues(nt::Value::MakeDouble(params[0]->GetDouble() + 1.2));
-}
-
-int main() {
- nt::SetLogger(
- [](unsigned int level, const char* file, unsigned int line,
- const char* msg) {
- std::fputs(msg, stderr);
- std::fputc('\n', stderr);
- },
- 0);
-
- nt::RpcDefinition def;
- def.version = 1;
- def.name = "myfunc1";
- def.params.emplace_back("param1", nt::Value::MakeDouble(0.0));
- def.results.emplace_back("result1", NT_DOUBLE);
- nt::CreateRpc("func1", nt::PackRpcDefinition(def), callback1);
- std::fputs("calling rpc\n", stderr);
- unsigned int call1_uid =
- nt::CallRpc("func1", nt::PackRpcValues(nt::Value::MakeDouble(2.0)));
- std::string call1_result_str;
- std::fputs("waiting for rpc result\n", stderr);
- nt::GetRpcResult(true, call1_uid, &call1_result_str);
- auto call1_result = nt::UnpackRpcValues(call1_result_str, NT_DOUBLE);
- if (call1_result.empty()) {
- std::fputs("empty result?\n", stderr);
- return 1;
- }
- std::fprintf(stderr, "got %g\n", call1_result[0]->GetDouble());
-
- return 0;
-}
diff --git a/third_party/ntcore_2017/test/rpc_speed.cpp b/third_party/ntcore_2017/test/rpc_speed.cpp
deleted file mode 100644
index e8513a9..0000000
--- a/third_party/ntcore_2017/test/rpc_speed.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <chrono>
-#include <cstdio>
-#include <thread>
-#include <iostream>
-
-#include "ntcore.h"
-
-std::string callback1(nt::StringRef name, nt::StringRef params_str,
- const nt::ConnectionInfo& conn_info) {
- auto params = nt::UnpackRpcValues(params_str, NT_DOUBLE);
- if (params.empty()) {
- std::fputs("empty params?\n", stderr);
- return "";
- }
- return nt::PackRpcValues(nt::Value::MakeDouble(params[0]->GetDouble() + 1.2));
-}
-
-int main() {
- nt::RpcDefinition def;
- def.version = 1;
- def.name = "myfunc1";
- def.params.emplace_back("param1", nt::Value::MakeDouble(0.0));
- def.results.emplace_back("result1", NT_DOUBLE);
- nt::CreateRpc("func1", nt::PackRpcDefinition(def), callback1);
- std::string call1_result_str;
-
- auto start2 = std::chrono::high_resolution_clock::now();
- auto start = nt::Now();
- for (int i=0; i<10000; ++i) {
- unsigned int call1_uid =
- nt::CallRpc("func1", nt::PackRpcValues(nt::Value::MakeDouble(i)));
- nt::GetRpcResult(true, call1_uid, &call1_result_str);
- auto call1_result = nt::UnpackRpcValues(call1_result_str, NT_DOUBLE);
- if (call1_result.empty()) {
- std::fputs("empty result?\n", stderr);
- return 1;
- }
- }
- auto end2 = std::chrono::high_resolution_clock::now();
- auto end = nt::Now();
- std::cerr << "nt::Now start=" << start << " end=" << end << '\n';
- std::cerr << "std::chrono start=" <<
- std::chrono::duration_cast<std::chrono::nanoseconds>(start2.time_since_epoch()).count() << " end=" <<
- std::chrono::duration_cast<std::chrono::nanoseconds>(end2.time_since_epoch()).count() << '\n';
- std::fprintf(stderr, "time/call = %g us\n", (end-start) / 10.0 / 10000.0);
- std::chrono::duration<double, std::micro> diff = end2-start2;
- std::cerr << "time/call = " << (diff.count() / 10000.0) << " us\n";
-
- return 0;
-}
diff --git a/third_party/ntcore_2017/test/server.cpp b/third_party/ntcore_2017/test/server.cpp
deleted file mode 100644
index 8360e13..0000000
--- a/third_party/ntcore_2017/test/server.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <chrono>
-#include <cstdio>
-#include <thread>
-
-#include "ntcore.h"
-
-int main() {
- nt::SetLogger(
- [](unsigned int level, const char* file, unsigned int line,
- const char* msg) {
- std::fputs(msg, stderr);
- std::fputc('\n', stderr);
- },
- 0);
- nt::StartServer("persistent.ini", "", 10000);
- std::this_thread::sleep_for(std::chrono::seconds(1));
- nt::SetEntryValue("/foo", nt::Value::MakeDouble(0.5));
- nt::SetEntryFlags("/foo", NT_PERSISTENT);
- nt::SetEntryValue("/foo2", nt::Value::MakeDouble(0.5));
- nt::SetEntryValue("/foo2", nt::Value::MakeDouble(0.7));
- nt::SetEntryValue("/foo2", nt::Value::MakeDouble(0.6));
- nt::SetEntryValue("/foo2", nt::Value::MakeDouble(0.5));
- std::this_thread::sleep_for(std::chrono::seconds(10));
-}
diff --git a/third_party/ntcore_2017/test/tests.gradle b/third_party/ntcore_2017/test/tests.gradle
deleted file mode 100644
index 829336d..0000000
--- a/third_party/ntcore_2017/test/tests.gradle
+++ /dev/null
@@ -1,42 +0,0 @@
-apply plugin: 'google-test'
-
-model {
- testSuites {
- ntcoreTest {
- if (!project.hasProperty('skipJava')) {
- setupJniIncludes(binaries)
- }
- sources {
- cpp {
- source {
- srcDirs = ["${rootDir}/test/unit"]
- includes = ['**/*.cpp']
- }
- exportedHeaders {
- srcDirs = ["${rootDir}/include", "${rootDir}/src", "${rootDir}/wpiutil/include", "${rootDir}/gmock/include", "${rootDir}/gmock/gtest/include"]
- includes = ['**/*.h']
- }
- }
- }
- binaries.all {
- lib project: ':gmock', library: 'gmock', linkage: 'static'
- lib library: 'ntcore', linkage: 'static'
- }
- }
- }
-}
-
-model {
- binaries {
- withType(GoogleTestTestSuiteBinarySpec) {
- lib project: ':gmock', library: "gmock", linkage: "static"
- lib library: 'ntcore', linkage: 'static'
- if (targetPlatform.operatingSystem.windows) {
- cppCompiler.args '/EHsc', '/DNOMINMAX', '/D_SCL_SECURE_NO_WARNINGS', '/D_WINSOCK_DEPRECATED_NO_WARNINGS'
- } else {
- cppCompiler.args '-pthread', '-std=c++1y'
- linker.args '-pthread'
- }
- }
- }
-}
diff --git a/third_party/ntcore_2017/test/unit/CMakeLists.txt b/third_party/ntcore_2017/test/unit/CMakeLists.txt
deleted file mode 100644
index 4929b1e..0000000
--- a/third_party/ntcore_2017/test/unit/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-file(GLOB SRCS *.cpp)
-
-add_executable(testntcore ${SRCS})
-add_test(testntcore testntcore)
-
-if(MSVC)
-target_link_libraries(testntcore
- ntcore_static
- gmock
- gtest
- )
-else()
-target_link_libraries(testntcore
- ntcore
- gmock
- gtest
- )
-endif()
diff --git a/third_party/ntcore_2017/test/unit/NetworkTableTest.cpp b/third_party/ntcore_2017/test/unit/NetworkTableTest.cpp
deleted file mode 100644
index 24ad29f..0000000
--- a/third_party/ntcore_2017/test/unit/NetworkTableTest.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "networktables/NetworkTable.h"
-
-#include "gtest/gtest.h"
-
-class NetworkTableTest : public ::testing::Test {};
-
-TEST_F(NetworkTableTest, ContainsKey) {
- auto nt = NetworkTable::GetTable("containskey");
- ASSERT_FALSE(nt->ContainsKey("testkey"));
- nt->PutNumber("testkey", 5);
- ASSERT_TRUE(nt->ContainsKey("testkey"));
-}
-
-TEST_F(NetworkTableTest, LeadingSlash) {
- auto nt = NetworkTable::GetTable("leadingslash");
- auto nt2 = NetworkTable::GetTable("/leadingslash");
- ASSERT_FALSE(nt->ContainsKey("testkey"));
- nt2->PutNumber("testkey", 5);
- ASSERT_TRUE(nt->ContainsKey("testkey"));
-}
diff --git a/third_party/ntcore_2017/test/unit/StorageTest.cpp b/third_party/ntcore_2017/test/unit/StorageTest.cpp
deleted file mode 100644
index 2979f4b..0000000
--- a/third_party/ntcore_2017/test/unit/StorageTest.cpp
+++ /dev/null
@@ -1,873 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "Storage.h"
-#include "StorageTest.h"
-
-#include <sstream>
-
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
-
-namespace nt {
-
-class StorageTestEmpty : public StorageTest,
- public ::testing::TestWithParam<bool> {
- public:
- StorageTestEmpty() { HookOutgoing(GetParam()); }
-};
-
-class StorageTestPopulateOne : public StorageTestEmpty {
- public:
- StorageTestPopulateOne() {
- storage.SetEntryTypeValue("foo", Value::MakeBoolean(true));
- outgoing.clear();
- }
-};
-
-class StorageTestPopulated : public StorageTestEmpty {
- public:
- StorageTestPopulated() {
- storage.SetEntryTypeValue("foo", Value::MakeBoolean(true));
- storage.SetEntryTypeValue("foo2", Value::MakeDouble(0.0));
- storage.SetEntryTypeValue("bar", Value::MakeDouble(1.0));
- storage.SetEntryTypeValue("bar2", Value::MakeBoolean(false));
- outgoing.clear();
- }
-};
-
-class StorageTestPersistent : public StorageTestEmpty {
- public:
- StorageTestPersistent() {
- storage.SetEntryTypeValue("boolean/true", Value::MakeBoolean(true));
- storage.SetEntryTypeValue("boolean/false", Value::MakeBoolean(false));
- storage.SetEntryTypeValue("double/neg", Value::MakeDouble(-1.5));
- storage.SetEntryTypeValue("double/zero", Value::MakeDouble(0.0));
- storage.SetEntryTypeValue("double/big", Value::MakeDouble(1.3e8));
- storage.SetEntryTypeValue("string/empty", Value::MakeString(""));
- storage.SetEntryTypeValue("string/normal", Value::MakeString("hello"));
- storage.SetEntryTypeValue("string/special",
- Value::MakeString(StringRef("\0\3\5\n", 4)));
- storage.SetEntryTypeValue("raw/empty", Value::MakeRaw(""));
- storage.SetEntryTypeValue("raw/normal", Value::MakeRaw("hello"));
- storage.SetEntryTypeValue("raw/special",
- Value::MakeRaw(StringRef("\0\3\5\n", 4)));
- storage.SetEntryTypeValue("booleanarr/empty",
- Value::MakeBooleanArray(std::vector<int>{}));
- storage.SetEntryTypeValue("booleanarr/one",
- Value::MakeBooleanArray(std::vector<int>{1}));
- storage.SetEntryTypeValue("booleanarr/two",
- Value::MakeBooleanArray(std::vector<int>{1, 0}));
- storage.SetEntryTypeValue("doublearr/empty",
- Value::MakeDoubleArray(std::vector<double>{}));
- storage.SetEntryTypeValue("doublearr/one",
- Value::MakeDoubleArray(std::vector<double>{0.5}));
- storage.SetEntryTypeValue(
- "doublearr/two",
- Value::MakeDoubleArray(std::vector<double>{0.5, -0.25}));
- storage.SetEntryTypeValue(
- "stringarr/empty", Value::MakeStringArray(std::vector<std::string>{}));
- storage.SetEntryTypeValue(
- "stringarr/one",
- Value::MakeStringArray(std::vector<std::string>{"hello"}));
- storage.SetEntryTypeValue(
- "stringarr/two",
- Value::MakeStringArray(std::vector<std::string>{"hello", "world\n"}));
- storage.SetEntryTypeValue(StringRef("\0\3\5\n", 4),
- Value::MakeBoolean(true));
- storage.SetEntryTypeValue("=", Value::MakeBoolean(true));
- outgoing.clear();
- }
-};
-
-class MockLoadWarn {
- public:
- MOCK_METHOD2(Warn, void(std::size_t line, llvm::StringRef msg));
-};
-
-TEST_P(StorageTestEmpty, Construct) {
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
-}
-
-TEST_P(StorageTestEmpty, StorageEntryInit) {
- auto entry = GetEntry("foo");
- EXPECT_FALSE(entry->value);
- EXPECT_EQ(0u, entry->flags);
- EXPECT_EQ("foobar", entry->name); // since GetEntry uses the tmp_entry.
- EXPECT_EQ(0xffffu, entry->id);
- EXPECT_EQ(SequenceNumber(), entry->seq_num);
-}
-
-TEST_P(StorageTestEmpty, GetEntryValueNotExist) {
- EXPECT_FALSE(storage.GetEntryValue("foo"));
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestEmpty, GetEntryValueExist) {
- auto value = Value::MakeBoolean(true);
- storage.SetEntryTypeValue("foo", value);
- outgoing.clear();
- EXPECT_EQ(value, storage.GetEntryValue("foo"));
-}
-
-TEST_P(StorageTestEmpty, SetEntryTypeValueAssignNew) {
- // brand new entry
- auto value = Value::MakeBoolean(true);
- storage.SetEntryTypeValue("foo", value);
- EXPECT_EQ(value, GetEntry("foo")->value);
- if (GetParam()) {
- ASSERT_EQ(1u, idmap().size());
- EXPECT_EQ(value, idmap()[0]->value);
- } else {
- EXPECT_TRUE(idmap().empty());
- }
-
- ASSERT_EQ(1u, outgoing.size());
- EXPECT_FALSE(outgoing[0].only);
- EXPECT_FALSE(outgoing[0].except);
- auto msg = outgoing[0].msg;
- EXPECT_EQ(Message::kEntryAssign, msg->type());
- EXPECT_EQ("foo", msg->str());
- if (GetParam())
- EXPECT_EQ(0u, msg->id()); // assigned as server
- else
- EXPECT_EQ(0xffffu, msg->id()); // not assigned as client
- EXPECT_EQ(1u, msg->seq_num_uid());
- EXPECT_EQ(value, msg->value());
- EXPECT_EQ(0u, msg->flags());
-}
-
-TEST_P(StorageTestPopulateOne, SetEntryTypeValueAssignTypeChange) {
- // update with different type results in assignment message
- auto value = Value::MakeDouble(0.0);
- storage.SetEntryTypeValue("foo", value);
- EXPECT_EQ(value, GetEntry("foo")->value);
-
- ASSERT_EQ(1u, outgoing.size());
- EXPECT_FALSE(outgoing[0].only);
- EXPECT_FALSE(outgoing[0].except);
- auto msg = outgoing[0].msg;
- EXPECT_EQ(Message::kEntryAssign, msg->type());
- EXPECT_EQ("foo", msg->str());
- if (GetParam())
- EXPECT_EQ(0u, msg->id()); // assigned as server
- else
- EXPECT_EQ(0xffffu, msg->id()); // not assigned as client
- EXPECT_EQ(2u, msg->seq_num_uid()); // incremented
- EXPECT_EQ(value, msg->value());
- EXPECT_EQ(0u, msg->flags());
-}
-
-TEST_P(StorageTestPopulateOne, SetEntryTypeValueEqualValue) {
- // update with same type and same value: change value contents but no update
- // message is issued (minimizing bandwidth usage)
- auto value = Value::MakeBoolean(true);
- storage.SetEntryTypeValue("foo", value);
- EXPECT_EQ(value, GetEntry("foo")->value);
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestPopulated, SetEntryTypeValueDifferentValue) {
- // update with same type and different value results in value update message
- auto value = Value::MakeDouble(1.0);
- storage.SetEntryTypeValue("foo2", value);
- EXPECT_EQ(value, GetEntry("foo2")->value);
-
- if (GetParam()) {
- ASSERT_EQ(1u, outgoing.size());
- EXPECT_FALSE(outgoing[0].only);
- EXPECT_FALSE(outgoing[0].except);
- auto msg = outgoing[0].msg;
- EXPECT_EQ(Message::kEntryUpdate, msg->type());
- EXPECT_EQ(1u, msg->id()); // assigned as server
- EXPECT_EQ(2u, msg->seq_num_uid()); // incremented
- EXPECT_EQ(value, msg->value());
- } else {
- // shouldn't send an update id not assigned yet (happens on client only)
- EXPECT_TRUE(outgoing.empty());
- EXPECT_EQ(2u, GetEntry("foo2")->seq_num.value()); // still should be incremented
- }
-}
-
-TEST_P(StorageTestEmpty, SetEntryTypeValueEmptyName) {
- auto value = Value::MakeBoolean(true);
- storage.SetEntryTypeValue("", value);
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestEmpty, SetEntryTypeValueEmptyValue) {
- storage.SetEntryTypeValue("foo", nullptr);
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestEmpty, SetEntryValueAssignNew) {
- // brand new entry
- auto value = Value::MakeBoolean(true);
- EXPECT_TRUE(storage.SetEntryValue("foo", value));
- EXPECT_EQ(value, GetEntry("foo")->value);
-
- ASSERT_EQ(1u, outgoing.size());
- EXPECT_FALSE(outgoing[0].only);
- EXPECT_FALSE(outgoing[0].except);
- auto msg = outgoing[0].msg;
- EXPECT_EQ(Message::kEntryAssign, msg->type());
- EXPECT_EQ("foo", msg->str());
- if (GetParam())
- EXPECT_EQ(0u, msg->id()); // assigned as server
- else
- EXPECT_EQ(0xffffu, msg->id()); // not assigned as client
- EXPECT_EQ(0u, msg->seq_num_uid());
- EXPECT_EQ(value, msg->value());
- EXPECT_EQ(0u, msg->flags());
-}
-
-TEST_P(StorageTestPopulateOne, SetEntryValueAssignTypeChange) {
- // update with different type results in error and no message
- auto value = Value::MakeDouble(0.0);
- EXPECT_FALSE(storage.SetEntryValue("foo", value));
- auto entry = GetEntry("foo");
- EXPECT_NE(value, entry->value);
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestPopulateOne, SetEntryValueEqualValue) {
- // update with same type and same value: change value contents but no update
- // message is issued (minimizing bandwidth usage)
- auto value = Value::MakeBoolean(true);
- EXPECT_TRUE(storage.SetEntryValue("foo", value));
- auto entry = GetEntry("foo");
- EXPECT_EQ(value, entry->value);
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestPopulated, SetEntryValueDifferentValue) {
- // update with same type and different value results in value update message
- auto value = Value::MakeDouble(1.0);
- EXPECT_TRUE(storage.SetEntryValue("foo2", value));
- auto entry = GetEntry("foo2");
- EXPECT_EQ(value, entry->value);
-
- if (GetParam()) {
- ASSERT_EQ(1u, outgoing.size());
- EXPECT_FALSE(outgoing[0].only);
- EXPECT_FALSE(outgoing[0].except);
- auto msg = outgoing[0].msg;
- EXPECT_EQ(Message::kEntryUpdate, msg->type());
- EXPECT_EQ(1u, msg->id()); // assigned as server
- EXPECT_EQ(2u, msg->seq_num_uid()); // incremented
- EXPECT_EQ(value, msg->value());
- } else {
- // shouldn't send an update id not assigned yet (happens on client only)
- EXPECT_TRUE(outgoing.empty());
- EXPECT_EQ(2u, GetEntry("foo2")->seq_num.value()); // still should be incremented
- }
-}
-
-TEST_P(StorageTestEmpty, SetEntryValueEmptyName) {
- auto value = Value::MakeBoolean(true);
- EXPECT_TRUE(storage.SetEntryValue("", value));
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestEmpty, SetEntryValueEmptyValue) {
- EXPECT_TRUE(storage.SetEntryValue("foo", nullptr));
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestEmpty, SetDefaultEntryAssignNew) {
- // brand new entry
- auto value = Value::MakeBoolean(true);
- auto ret_val = storage.SetDefaultEntryValue("foo", value);
- EXPECT_TRUE(ret_val);
- EXPECT_EQ(value, GetEntry("foo")->value);
-
- ASSERT_EQ(1u, outgoing.size());
- EXPECT_FALSE(outgoing[0].only);
- EXPECT_FALSE(outgoing[0].except);
- auto msg = outgoing[0].msg;
- EXPECT_EQ(Message::kEntryAssign, msg->type());
- EXPECT_EQ("foo", msg->str());
- if (GetParam())
- EXPECT_EQ(0u, msg->id()); // assigned as server
- else
- EXPECT_EQ(0xffffu, msg->id()); // not assigned as client
- EXPECT_EQ(0u, msg->seq_num_uid());
- EXPECT_EQ(value, msg->value());
- EXPECT_EQ(0u, msg->flags());
-}
-
-TEST_P(StorageTestPopulateOne, SetDefaultEntryExistsSameType) {
- // existing entry
- auto value = Value::MakeBoolean(true);
- auto ret_val = storage.SetDefaultEntryValue("foo", value);
- EXPECT_TRUE(ret_val);
- EXPECT_NE(value, GetEntry("foo")->value);
-
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestPopulateOne, SetDefaultEntryExistsDifferentType) {
- // existing entry is boolean
- auto value = Value::MakeDouble(2.0);
- auto ret_val = storage.SetDefaultEntryValue("foo", value);
- EXPECT_FALSE(ret_val);
- // should not have updated value in table if it already existed.
- EXPECT_NE(value, GetEntry("foo")->value);
-
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestEmpty, SetDefaultEntryEmptyName) {
- auto value = Value::MakeBoolean(true);
- auto ret_val = storage.SetDefaultEntryValue("", value);
- EXPECT_FALSE(ret_val);
- auto entry = GetEntry("foo");
- EXPECT_FALSE(entry->value);
- EXPECT_EQ(0u, entry->flags);
- EXPECT_EQ("foobar", entry->name); // since GetEntry uses the tmp_entry.
- EXPECT_EQ(0xffffu, entry->id);
- EXPECT_EQ(SequenceNumber(), entry->seq_num);
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestEmpty, SetDefaultEntryEmptyValue) {
- auto value = Value::MakeBoolean(true);
- auto ret_val = storage.SetDefaultEntryValue("", nullptr);
- EXPECT_FALSE(ret_val);
- auto entry = GetEntry("foo");
- EXPECT_FALSE(entry->value);
- EXPECT_EQ(0u, entry->flags);
- EXPECT_EQ("foobar", entry->name); // since GetEntry uses the tmp_entry.
- EXPECT_EQ(0xffffu, entry->id);
- EXPECT_EQ(SequenceNumber(), entry->seq_num);
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestPopulated, SetDefaultEntryEmptyName) {
- auto value = Value::MakeBoolean(true);
- auto ret_val = storage.SetDefaultEntryValue("", value);
- EXPECT_FALSE(ret_val);
- // assert that no entries get added
- EXPECT_EQ(4u, entries().size());
- if (GetParam())
- EXPECT_EQ(4u, idmap().size());
- else
- EXPECT_EQ(0u, idmap().size());
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestPopulated, SetDefaultEntryEmptyValue) {
- auto value = Value::MakeBoolean(true);
- auto ret_val = storage.SetDefaultEntryValue("", nullptr);
- EXPECT_FALSE(ret_val);
- // assert that no entries get added
- EXPECT_EQ(4u, entries().size());
- if (GetParam())
- EXPECT_EQ(4u, idmap().size());
- else
- EXPECT_EQ(0u, idmap().size());
- EXPECT_TRUE(outgoing.empty());
-}
-
-
-TEST_P(StorageTestEmpty, SetEntryFlagsNew) {
- // flags setting doesn't create an entry
- storage.SetEntryFlags("foo", 0u);
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestPopulateOne, SetEntryFlagsEqualValue) {
- // update with same value: no update message is issued (minimizing bandwidth
- // usage)
- storage.SetEntryFlags("foo", 0u);
- auto entry = GetEntry("foo");
- EXPECT_EQ(0u, entry->flags);
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestPopulated, SetEntryFlagsDifferentValue) {
- // update with different value results in flags update message
- storage.SetEntryFlags("foo2", 1u);
- EXPECT_EQ(1u, GetEntry("foo2")->flags);
-
- if (GetParam()) {
- ASSERT_EQ(1u, outgoing.size());
- EXPECT_FALSE(outgoing[0].only);
- EXPECT_FALSE(outgoing[0].except);
- auto msg = outgoing[0].msg;
- EXPECT_EQ(Message::kFlagsUpdate, msg->type());
- EXPECT_EQ(1u, msg->id()); // assigned as server
- EXPECT_EQ(1u, msg->flags());
- } else {
- // shouldn't send an update id not assigned yet (happens on client only)
- EXPECT_TRUE(outgoing.empty());
- }
-}
-
-TEST_P(StorageTestEmpty, SetEntryFlagsEmptyName) {
- storage.SetEntryFlags("", 0u);
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestEmpty, GetEntryFlagsNotExist) {
- EXPECT_EQ(0u, storage.GetEntryFlags("foo"));
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestPopulateOne, GetEntryFlagsExist) {
- storage.SetEntryFlags("foo", 1u);
- outgoing.clear();
- EXPECT_EQ(1u, storage.GetEntryFlags("foo"));
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestEmpty, DeleteEntryNotExist) {
- storage.DeleteEntry("foo");
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestPopulated, DeleteEntryExist) {
- storage.DeleteEntry("foo2");
- EXPECT_TRUE(entries().count("foo2") == 0);
- if (GetParam()) {
- ASSERT_TRUE(idmap().size() >= 2);
- EXPECT_FALSE(idmap()[1]);
- }
-
- if (GetParam()) {
- ASSERT_EQ(1u, outgoing.size());
- EXPECT_FALSE(outgoing[0].only);
- EXPECT_FALSE(outgoing[0].except);
- auto msg = outgoing[0].msg;
- EXPECT_EQ(Message::kEntryDelete, msg->type());
- EXPECT_EQ(1u, msg->id()); // assigned as server
- } else {
- // shouldn't send an update id not assigned yet (happens on client only)
- EXPECT_TRUE(outgoing.empty());
- }
-}
-
-TEST_P(StorageTestEmpty, DeleteAllEntriesEmpty) {
- storage.DeleteAllEntries();
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestPopulated, DeleteAllEntries) {
- storage.DeleteAllEntries();
- ASSERT_TRUE(entries().empty());
-
- ASSERT_EQ(1u, outgoing.size());
- EXPECT_FALSE(outgoing[0].only);
- EXPECT_FALSE(outgoing[0].except);
- auto msg = outgoing[0].msg;
- EXPECT_EQ(Message::kClearEntries, msg->type());
-}
-
-TEST_P(StorageTestPopulated, DeleteAllEntriesPersistent) {
- GetEntry("foo2")->flags = NT_PERSISTENT;
- storage.DeleteAllEntries();
- ASSERT_EQ(1u, entries().size());
- EXPECT_EQ(1u, entries().count("foo2"));
-
- ASSERT_EQ(1u, outgoing.size());
- EXPECT_FALSE(outgoing[0].only);
- EXPECT_FALSE(outgoing[0].except);
- auto msg = outgoing[0].msg;
- EXPECT_EQ(Message::kClearEntries, msg->type());
-}
-
-TEST_P(StorageTestPopulated, GetEntryInfoAll) {
- auto info = storage.GetEntryInfo("", 0u);
- ASSERT_EQ(4u, info.size());
-}
-
-TEST_P(StorageTestPopulated, GetEntryInfoPrefix) {
- auto info = storage.GetEntryInfo("foo", 0u);
- ASSERT_EQ(2u, info.size());
- if (info[0].name == "foo") {
- EXPECT_EQ("foo", info[0].name);
- EXPECT_EQ(NT_BOOLEAN, info[0].type);
- EXPECT_EQ("foo2", info[1].name);
- EXPECT_EQ(NT_DOUBLE, info[1].type);
- } else {
- EXPECT_EQ("foo2", info[0].name);
- EXPECT_EQ(NT_DOUBLE, info[0].type);
- EXPECT_EQ("foo", info[1].name);
- EXPECT_EQ(NT_BOOLEAN, info[1].type);
- }
-}
-
-TEST_P(StorageTestPopulated, GetEntryInfoTypes) {
- auto info = storage.GetEntryInfo("", NT_DOUBLE);
- ASSERT_EQ(2u, info.size());
- EXPECT_EQ(NT_DOUBLE, info[0].type);
- EXPECT_EQ(NT_DOUBLE, info[1].type);
- if (info[0].name == "foo2") {
- EXPECT_EQ("foo2", info[0].name);
- EXPECT_EQ("bar", info[1].name);
- } else {
- EXPECT_EQ("bar", info[0].name);
- EXPECT_EQ("foo2", info[1].name);
- }
-}
-
-TEST_P(StorageTestPopulated, GetEntryInfoPrefixTypes) {
- auto info = storage.GetEntryInfo("bar", NT_BOOLEAN);
- ASSERT_EQ(1u, info.size());
- EXPECT_EQ("bar2", info[0].name);
- EXPECT_EQ(NT_BOOLEAN, info[0].type);
-}
-
-TEST_P(StorageTestPersistent, SavePersistentEmpty) {
- std::ostringstream oss;
- storage.SavePersistent(oss, false);
- ASSERT_EQ("[NetworkTables Storage 3.0]\n", oss.str());
-}
-
-TEST_P(StorageTestPersistent, SavePersistent) {
- for (auto& i : entries()) i.getValue()->flags = NT_PERSISTENT;
- std::ostringstream oss;
- storage.SavePersistent(oss, false);
- std::string out = oss.str();
- //fputs(out.c_str(), stderr);
- llvm::StringRef line, rem = out;
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("[NetworkTables Storage 3.0]", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("boolean \"\\x00\\x03\\x05\\n\"=true", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("boolean \"\\x3D\"=true", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("boolean \"boolean/false\"=false", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("boolean \"boolean/true\"=true", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("array boolean \"booleanarr/empty\"=", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("array boolean \"booleanarr/one\"=true", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("array boolean \"booleanarr/two\"=true,false", line);
- std::tie(line, rem) = rem.split('\n');
-#if defined(_MSC_VER) && _MSC_VER < 1900
- ASSERT_EQ("double \"double/big\"=1.3e+008", line);
-#else
- ASSERT_EQ("double \"double/big\"=1.3e+08", line);
-#endif
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("double \"double/neg\"=-1.5", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("double \"double/zero\"=0", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("array double \"doublearr/empty\"=", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("array double \"doublearr/one\"=0.5", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("array double \"doublearr/two\"=0.5,-0.25", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("raw \"raw/empty\"=", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("raw \"raw/normal\"=aGVsbG8=", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("raw \"raw/special\"=AAMFCg==", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("string \"string/empty\"=\"\"", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("string \"string/normal\"=\"hello\"", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("string \"string/special\"=\"\\x00\\x03\\x05\\n\"", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("array string \"stringarr/empty\"=", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("array string \"stringarr/one\"=\"hello\"", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("array string \"stringarr/two\"=\"hello\",\"world\\n\"", line);
- std::tie(line, rem) = rem.split('\n');
- ASSERT_EQ("", line);
-}
-
-TEST_P(StorageTestEmpty, LoadPersistentBadHeader) {
- MockLoadWarn warn;
- auto warn_func =
- [&](std::size_t line, const char* msg) { warn.Warn(line, msg); };
-
- std::istringstream iss("");
- EXPECT_CALL(warn, Warn(1, llvm::StringRef("header line mismatch, ignoring rest of file")));
- EXPECT_FALSE(storage.LoadPersistent(iss, warn_func));
-
- std::istringstream iss2("[NetworkTables");
- EXPECT_CALL(warn, Warn(1, llvm::StringRef("header line mismatch, ignoring rest of file")));
- EXPECT_FALSE(storage.LoadPersistent(iss2, warn_func));
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestEmpty, LoadPersistentCommentHeader) {
- MockLoadWarn warn;
- auto warn_func =
- [&](std::size_t line, const char* msg) { warn.Warn(line, msg); };
-
- std::istringstream iss(
- "\n; comment\n# comment\n[NetworkTables Storage 3.0]\n");
- EXPECT_TRUE(storage.LoadPersistent(iss, warn_func));
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestEmpty, LoadPersistentEmptyName) {
- MockLoadWarn warn;
- auto warn_func =
- [&](std::size_t line, const char* msg) { warn.Warn(line, msg); };
-
- std::istringstream iss(
- "[NetworkTables Storage 3.0]\nboolean \"\"=true\n");
- EXPECT_TRUE(storage.LoadPersistent(iss, warn_func));
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
- EXPECT_TRUE(outgoing.empty());
-}
-
-TEST_P(StorageTestEmpty, LoadPersistentAssign) {
- MockLoadWarn warn;
- auto warn_func =
- [&](std::size_t line, const char* msg) { warn.Warn(line, msg); };
-
- std::istringstream iss(
- "[NetworkTables Storage 3.0]\nboolean \"foo\"=true\n");
- EXPECT_TRUE(storage.LoadPersistent(iss, warn_func));
- auto entry = GetEntry("foo");
- EXPECT_EQ(*Value::MakeBoolean(true), *entry->value);
- EXPECT_EQ(NT_PERSISTENT, entry->flags);
-
- ASSERT_EQ(1u, outgoing.size());
- EXPECT_FALSE(outgoing[0].only);
- EXPECT_FALSE(outgoing[0].except);
- auto msg = outgoing[0].msg;
- EXPECT_EQ(Message::kEntryAssign, msg->type());
- EXPECT_EQ("foo", msg->str());
- if (GetParam())
- EXPECT_EQ(0u, msg->id()); // assigned as server
- else
- EXPECT_EQ(0xffffu, msg->id()); // not assigned as client
- EXPECT_EQ(1u, msg->seq_num_uid());
- EXPECT_EQ(*Value::MakeBoolean(true), *msg->value());
- EXPECT_EQ(NT_PERSISTENT, msg->flags());
-}
-
-TEST_P(StorageTestPopulated, LoadPersistentUpdateFlags) {
- MockLoadWarn warn;
- auto warn_func =
- [&](std::size_t line, const char* msg) { warn.Warn(line, msg); };
-
- std::istringstream iss(
- "[NetworkTables Storage 3.0]\ndouble \"foo2\"=0.0\n");
- EXPECT_TRUE(storage.LoadPersistent(iss, warn_func));
- auto entry = GetEntry("foo2");
- EXPECT_EQ(*Value::MakeDouble(0.0), *entry->value);
- EXPECT_EQ(NT_PERSISTENT, entry->flags);
-
- if (GetParam()) {
- ASSERT_EQ(1u, outgoing.size());
- EXPECT_FALSE(outgoing[0].only);
- EXPECT_FALSE(outgoing[0].except);
- auto msg = outgoing[0].msg;
- EXPECT_EQ(Message::kFlagsUpdate, msg->type());
- EXPECT_EQ(1u, msg->id()); // assigned as server
- EXPECT_EQ(NT_PERSISTENT, msg->flags());
- } else {
- // shouldn't send an update id not assigned yet (happens on client only)
- EXPECT_TRUE(outgoing.empty());
- }
-}
-
-TEST_P(StorageTestPopulated, LoadPersistentUpdateValue) {
- MockLoadWarn warn;
- auto warn_func =
- [&](std::size_t line, const char* msg) { warn.Warn(line, msg); };
-
- GetEntry("foo2")->flags = NT_PERSISTENT;
-
- std::istringstream iss(
- "[NetworkTables Storage 3.0]\ndouble \"foo2\"=1.0\n");
- EXPECT_TRUE(storage.LoadPersistent(iss, warn_func));
- auto entry = GetEntry("foo2");
- EXPECT_EQ(*Value::MakeDouble(1.0), *entry->value);
- EXPECT_EQ(NT_PERSISTENT, entry->flags);
-
- if (GetParam()) {
- ASSERT_EQ(1u, outgoing.size());
- EXPECT_FALSE(outgoing[0].only);
- EXPECT_FALSE(outgoing[0].except);
- auto msg = outgoing[0].msg;
- EXPECT_EQ(Message::kEntryUpdate, msg->type());
- EXPECT_EQ(1u, msg->id()); // assigned as server
- EXPECT_EQ(2u, msg->seq_num_uid()); // incremented
- EXPECT_EQ(*Value::MakeDouble(1.0), *msg->value());
- } else {
- // shouldn't send an update id not assigned yet (happens on client only)
- EXPECT_TRUE(outgoing.empty());
- EXPECT_EQ(2u, GetEntry("foo2")->seq_num.value()); // still should be incremented
- }
-}
-
-TEST_P(StorageTestPopulated, LoadPersistentUpdateValueFlags) {
- MockLoadWarn warn;
- auto warn_func =
- [&](std::size_t line, const char* msg) { warn.Warn(line, msg); };
-
- std::istringstream iss(
- "[NetworkTables Storage 3.0]\ndouble \"foo2\"=1.0\n");
- EXPECT_TRUE(storage.LoadPersistent(iss, warn_func));
- auto entry = GetEntry("foo2");
- EXPECT_EQ(*Value::MakeDouble(1.0), *entry->value);
- EXPECT_EQ(NT_PERSISTENT, entry->flags);
-
- if (GetParam()) {
- ASSERT_EQ(2u, outgoing.size());
- EXPECT_FALSE(outgoing[0].only);
- EXPECT_FALSE(outgoing[0].except);
- auto msg = outgoing[0].msg;
- EXPECT_EQ(Message::kEntryUpdate, msg->type());
- EXPECT_EQ(1u, msg->id()); // assigned as server
- EXPECT_EQ(2u, msg->seq_num_uid()); // incremented
- EXPECT_EQ(*Value::MakeDouble(1.0), *msg->value());
-
- EXPECT_FALSE(outgoing[1].only);
- EXPECT_FALSE(outgoing[1].except);
- msg = outgoing[1].msg;
- EXPECT_EQ(Message::kFlagsUpdate, msg->type());
- EXPECT_EQ(1u, msg->id()); // assigned as server
- EXPECT_EQ(NT_PERSISTENT, msg->flags());
- } else {
- // shouldn't send an update id not assigned yet (happens on client only)
- EXPECT_TRUE(outgoing.empty());
- EXPECT_EQ(2u, GetEntry("foo2")->seq_num.value()); // still should be incremented
- }
-}
-
-TEST_P(StorageTestEmpty, LoadPersistent) {
- MockLoadWarn warn;
- auto warn_func =
- [&](std::size_t line, const char* msg) { warn.Warn(line, msg); };
-
- std::string in = "[NetworkTables Storage 3.0]\n";
- in += "boolean \"\\x00\\x03\\x05\\n\"=true\n";
- in += "boolean \"\\x3D\"=true\n";
- in += "boolean \"boolean/false\"=false\n";
- in += "boolean \"boolean/true\"=true\n";
- in += "array boolean \"booleanarr/empty\"=\n";
- in += "array boolean \"booleanarr/one\"=true\n";
- in += "array boolean \"booleanarr/two\"=true,false\n";
- in += "double \"double/big\"=1.3e+08\n";
- in += "double \"double/neg\"=-1.5\n";
- in += "double \"double/zero\"=0\n";
- in += "array double \"doublearr/empty\"=\n";
- in += "array double \"doublearr/one\"=0.5\n";
- in += "array double \"doublearr/two\"=0.5,-0.25\n";
- in += "raw \"raw/empty\"=\n";
- in += "raw \"raw/normal\"=aGVsbG8=\n";
- in += "raw \"raw/special\"=AAMFCg==\n";
- in += "string \"string/empty\"=\"\"\n";
- in += "string \"string/normal\"=\"hello\"\n";
- in += "string \"string/special\"=\"\\x00\\x03\\x05\\n\"\n";
- in += "array string \"stringarr/empty\"=\n";
- in += "array string \"stringarr/one\"=\"hello\"\n";
- in += "array string \"stringarr/two\"=\"hello\",\"world\\n\"\n";
-
- std::istringstream iss(in);
- EXPECT_TRUE(storage.LoadPersistent(iss, warn_func));
- ASSERT_EQ(22u, entries().size());
- EXPECT_EQ(22u, outgoing.size());
-
- EXPECT_EQ(*Value::MakeBoolean(true), *storage.GetEntryValue("boolean/true"));
- EXPECT_EQ(*Value::MakeBoolean(false),
- *storage.GetEntryValue("boolean/false"));
- EXPECT_EQ(*Value::MakeDouble(-1.5), *storage.GetEntryValue("double/neg"));
- EXPECT_EQ(*Value::MakeDouble(0.0), *storage.GetEntryValue("double/zero"));
- EXPECT_EQ(*Value::MakeDouble(1.3e8), *storage.GetEntryValue("double/big"));
- EXPECT_EQ(*Value::MakeString(""), *storage.GetEntryValue("string/empty"));
- EXPECT_EQ(*Value::MakeString("hello"),
- *storage.GetEntryValue("string/normal"));
- EXPECT_EQ(*Value::MakeString(StringRef("\0\3\5\n", 4)),
- *storage.GetEntryValue("string/special"));
- EXPECT_EQ(*Value::MakeRaw(""),
- *storage.GetEntryValue("raw/empty"));
- EXPECT_EQ(*Value::MakeRaw("hello"),
- *storage.GetEntryValue("raw/normal"));
- EXPECT_EQ(*Value::MakeRaw(StringRef("\0\3\5\n", 4)),
- *storage.GetEntryValue("raw/special"));
- EXPECT_EQ(*Value::MakeBooleanArray(std::vector<int>{}),
- *storage.GetEntryValue("booleanarr/empty"));
- EXPECT_EQ(*Value::MakeBooleanArray(std::vector<int>{1}),
- *storage.GetEntryValue("booleanarr/one"));
- EXPECT_EQ(*Value::MakeBooleanArray(std::vector<int>{1, 0}),
- *storage.GetEntryValue("booleanarr/two"));
- EXPECT_EQ(*Value::MakeDoubleArray(std::vector<double>{}),
- *storage.GetEntryValue("doublearr/empty"));
- EXPECT_EQ(*Value::MakeDoubleArray(std::vector<double>{0.5}),
- *storage.GetEntryValue("doublearr/one"));
- EXPECT_EQ(*Value::MakeDoubleArray(std::vector<double>{0.5, -0.25}),
- *storage.GetEntryValue("doublearr/two"));
- EXPECT_EQ(*Value::MakeStringArray(std::vector<std::string>{}),
- *storage.GetEntryValue("stringarr/empty"));
- EXPECT_EQ(*Value::MakeStringArray(std::vector<std::string>{"hello"}),
- *storage.GetEntryValue("stringarr/one"));
- EXPECT_EQ(
- *Value::MakeStringArray(std::vector<std::string>{"hello", "world\n"}),
- *storage.GetEntryValue("stringarr/two"));
- EXPECT_EQ(*Value::MakeBoolean(true),
- *storage.GetEntryValue(StringRef("\0\3\5\n", 4)));
- EXPECT_EQ(*Value::MakeBoolean(true), *storage.GetEntryValue("="));
-}
-
-TEST_P(StorageTestEmpty, LoadPersistentWarn) {
- MockLoadWarn warn;
- auto warn_func =
- [&](std::size_t line, const char* msg) { warn.Warn(line, msg); };
-
- std::istringstream iss(
- "[NetworkTables Storage 3.0]\nboolean \"foo\"=foo\n");
- EXPECT_CALL(warn,
- Warn(2, llvm::StringRef("unrecognized boolean value, not 'true' or 'false'")));
- EXPECT_TRUE(storage.LoadPersistent(iss, warn_func));
-
- EXPECT_TRUE(entries().empty());
- EXPECT_TRUE(idmap().empty());
- EXPECT_TRUE(outgoing.empty());
-}
-
-INSTANTIATE_TEST_CASE_P(StorageTestsEmpty, StorageTestEmpty, ::testing::Bool());
-INSTANTIATE_TEST_CASE_P(StorageTestsPopulateOne, StorageTestPopulateOne,
- ::testing::Bool());
-INSTANTIATE_TEST_CASE_P(StorageTestsPopulated, StorageTestPopulated,
- ::testing::Bool());
-INSTANTIATE_TEST_CASE_P(StorageTestsPersistent, StorageTestPersistent,
- ::testing::Bool());
-
-} // namespace nt
diff --git a/third_party/ntcore_2017/test/unit/StorageTest.h b/third_party/ntcore_2017/test/unit/StorageTest.h
deleted file mode 100644
index dbd91c8..0000000
--- a/third_party/ntcore_2017/test/unit/StorageTest.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef NT_TEST_STORAGETEST_H_
-#define NT_TEST_STORAGETEST_H_
-
-#include <functional>
-#include <memory>
-#include <vector>
-
-#include "Storage.h"
-
-namespace nt {
-
-class StorageTest {
- public:
- StorageTest() : tmp_entry("foobar") {}
-
- Storage::EntriesMap& entries() { return storage.m_entries; }
- Storage::IdMap& idmap() { return storage.m_idmap; }
-
- Storage::Entry* GetEntry(StringRef name) {
- auto i = storage.m_entries.find(name);
- return i == storage.m_entries.end() ? &tmp_entry : i->getValue().get();
- }
-
- void HookOutgoing(bool server) {
- using namespace std::placeholders;
- storage.SetOutgoing(
- std::bind(&StorageTest::QueueOutgoing, this, _1, _2, _3), server);
- }
-
- struct OutgoingData {
- std::shared_ptr<Message> msg;
- NetworkConnection* only;
- NetworkConnection* except;
- };
-
- void QueueOutgoing(std::shared_ptr<Message> msg, NetworkConnection* only,
- NetworkConnection* except) {
- outgoing.emplace_back(OutgoingData{msg, only, except});
- }
-
- Storage storage;
- Storage::Entry tmp_entry;
- std::vector<OutgoingData> outgoing;
-};
-
-} // namespace nt
-
-#endif // NT_TEST_STORAGETEST_H_
diff --git a/third_party/ntcore_2017/test/unit/ValueTest.cpp b/third_party/ntcore_2017/test/unit/ValueTest.cpp
deleted file mode 100644
index e477e8e..0000000
--- a/third_party/ntcore_2017/test/unit/ValueTest.cpp
+++ /dev/null
@@ -1,365 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "nt_Value.h"
-#include "Value_internal.h"
-
-#include "gtest/gtest.h"
-
-namespace nt {
-
-class ValueTest : public ::testing::Test {};
-
-typedef ValueTest ValueDeathTest;
-
-TEST_F(ValueTest, ConstructEmpty) {
- Value v;
- ASSERT_EQ(NT_UNASSIGNED, v.type());
-}
-
-TEST_F(ValueTest, Boolean) {
- auto v = Value::MakeBoolean(false);
- ASSERT_EQ(NT_BOOLEAN, v->type());
- ASSERT_FALSE(v->GetBoolean());
- NT_Value cv;
- NT_InitValue(&cv);
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_BOOLEAN, cv.type);
- ASSERT_EQ(0, cv.data.v_boolean);
-
- v = Value::MakeBoolean(true);
- ASSERT_EQ(NT_BOOLEAN, v->type());
- ASSERT_TRUE(v->GetBoolean());
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_BOOLEAN, cv.type);
- ASSERT_EQ(1, cv.data.v_boolean);
-
- NT_DisposeValue(&cv);
-}
-
-TEST_F(ValueTest, Double) {
- auto v = Value::MakeDouble(0.5);
- ASSERT_EQ(NT_DOUBLE, v->type());
- ASSERT_EQ(0.5, v->GetDouble());
- NT_Value cv;
- NT_InitValue(&cv);
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_DOUBLE, cv.type);
- ASSERT_EQ(0.5, cv.data.v_double);
-
- v = Value::MakeDouble(0.25);
- ASSERT_EQ(NT_DOUBLE, v->type());
- ASSERT_EQ(0.25, v->GetDouble());
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_DOUBLE, cv.type);
- ASSERT_EQ(0.25, cv.data.v_double);
-
- NT_DisposeValue(&cv);
-}
-
-TEST_F(ValueTest, String) {
- auto v = Value::MakeString("hello");
- ASSERT_EQ(NT_STRING, v->type());
- ASSERT_EQ("hello", v->GetString());
- NT_Value cv;
- NT_InitValue(&cv);
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_STRING, cv.type);
- ASSERT_EQ(llvm::StringRef("hello"), cv.data.v_string.str);
- ASSERT_EQ(5u, cv.data.v_string.len);
-
- v = Value::MakeString("goodbye");
- ASSERT_EQ(NT_STRING, v->type());
- ASSERT_EQ("goodbye", v->GetString());
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_STRING, cv.type);
- ASSERT_EQ(llvm::StringRef("goodbye"), cv.data.v_string.str);
- ASSERT_EQ(7u, cv.data.v_string.len);
-
- NT_DisposeValue(&cv);
-}
-
-TEST_F(ValueTest, Raw) {
- auto v = Value::MakeRaw("hello");
- ASSERT_EQ(NT_RAW, v->type());
- ASSERT_EQ("hello", v->GetRaw());
- NT_Value cv;
- NT_InitValue(&cv);
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_RAW, cv.type);
- ASSERT_EQ(llvm::StringRef("hello"), cv.data.v_string.str);
- ASSERT_EQ(5u, cv.data.v_string.len);
-
- v = Value::MakeRaw("goodbye");
- ASSERT_EQ(NT_RAW, v->type());
- ASSERT_EQ("goodbye", v->GetRaw());
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_RAW, cv.type);
- ASSERT_EQ(llvm::StringRef("goodbye"), cv.data.v_string.str);
- ASSERT_EQ(7u, cv.data.v_string.len);
-
- NT_DisposeValue(&cv);
-}
-
-TEST_F(ValueTest, BooleanArray) {
- std::vector<int> vec{1,0,1};
- auto v = Value::MakeBooleanArray(vec);
- ASSERT_EQ(NT_BOOLEAN_ARRAY, v->type());
- ASSERT_EQ(llvm::ArrayRef<int>(vec), v->GetBooleanArray());
- NT_Value cv;
- NT_InitValue(&cv);
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_BOOLEAN_ARRAY, cv.type);
- ASSERT_EQ(3u, cv.data.arr_boolean.size);
- ASSERT_EQ(vec[0], cv.data.arr_boolean.arr[0]);
- ASSERT_EQ(vec[1], cv.data.arr_boolean.arr[1]);
- ASSERT_EQ(vec[2], cv.data.arr_boolean.arr[2]);
-
- // assign with same size
- vec = {0,1,0};
- v = Value::MakeBooleanArray(vec);
- ASSERT_EQ(NT_BOOLEAN_ARRAY, v->type());
- ASSERT_EQ(llvm::ArrayRef<int>(vec), v->GetBooleanArray());
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_BOOLEAN_ARRAY, cv.type);
- ASSERT_EQ(3u, cv.data.arr_boolean.size);
- ASSERT_EQ(vec[0], cv.data.arr_boolean.arr[0]);
- ASSERT_EQ(vec[1], cv.data.arr_boolean.arr[1]);
- ASSERT_EQ(vec[2], cv.data.arr_boolean.arr[2]);
-
- // assign with different size
- vec = {1,0};
- v = Value::MakeBooleanArray(vec);
- ASSERT_EQ(NT_BOOLEAN_ARRAY, v->type());
- ASSERT_EQ(llvm::ArrayRef<int>(vec), v->GetBooleanArray());
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_BOOLEAN_ARRAY, cv.type);
- ASSERT_EQ(2u, cv.data.arr_boolean.size);
- ASSERT_EQ(vec[0], cv.data.arr_boolean.arr[0]);
- ASSERT_EQ(vec[1], cv.data.arr_boolean.arr[1]);
-
- NT_DisposeValue(&cv);
-}
-
-TEST_F(ValueTest, DoubleArray) {
- std::vector<double> vec{0.5,0.25,0.5};
- auto v = Value::MakeDoubleArray(vec);
- ASSERT_EQ(NT_DOUBLE_ARRAY, v->type());
- ASSERT_EQ(llvm::ArrayRef<double>(vec), v->GetDoubleArray());
- NT_Value cv;
- NT_InitValue(&cv);
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_DOUBLE_ARRAY, cv.type);
- ASSERT_EQ(3u, cv.data.arr_double.size);
- ASSERT_EQ(vec[0], cv.data.arr_double.arr[0]);
- ASSERT_EQ(vec[1], cv.data.arr_double.arr[1]);
- ASSERT_EQ(vec[2], cv.data.arr_double.arr[2]);
-
- // assign with same size
- vec = {0.25,0.5,0.25};
- v = Value::MakeDoubleArray(vec);
- ASSERT_EQ(NT_DOUBLE_ARRAY, v->type());
- ASSERT_EQ(llvm::ArrayRef<double>(vec), v->GetDoubleArray());
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_DOUBLE_ARRAY, cv.type);
- ASSERT_EQ(3u, cv.data.arr_double.size);
- ASSERT_EQ(vec[0], cv.data.arr_double.arr[0]);
- ASSERT_EQ(vec[1], cv.data.arr_double.arr[1]);
- ASSERT_EQ(vec[2], cv.data.arr_double.arr[2]);
-
- // assign with different size
- vec = {0.5,0.25};
- v = Value::MakeDoubleArray(vec);
- ASSERT_EQ(NT_DOUBLE_ARRAY, v->type());
- ASSERT_EQ(llvm::ArrayRef<double>(vec), v->GetDoubleArray());
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_DOUBLE_ARRAY, cv.type);
- ASSERT_EQ(2u, cv.data.arr_double.size);
- ASSERT_EQ(vec[0], cv.data.arr_double.arr[0]);
- ASSERT_EQ(vec[1], cv.data.arr_double.arr[1]);
-
- NT_DisposeValue(&cv);
-}
-
-TEST_F(ValueTest, StringArray) {
- std::vector<std::string> vec;
- vec.push_back("hello");
- vec.push_back("goodbye");
- vec.push_back("string");
- auto v = Value::MakeStringArray(std::move(vec));
- ASSERT_EQ(NT_STRING_ARRAY, v->type());
- ASSERT_EQ(3u, v->GetStringArray().size());
- ASSERT_EQ(llvm::StringRef("hello"), v->GetStringArray()[0]);
- ASSERT_EQ(llvm::StringRef("goodbye"), v->GetStringArray()[1]);
- ASSERT_EQ(llvm::StringRef("string"), v->GetStringArray()[2]);
- NT_Value cv;
- NT_InitValue(&cv);
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_STRING_ARRAY, cv.type);
- ASSERT_EQ(3u, cv.data.arr_string.size);
- ASSERT_EQ(llvm::StringRef("hello"), cv.data.arr_string.arr[0].str);
- ASSERT_EQ(llvm::StringRef("goodbye"), cv.data.arr_string.arr[1].str);
- ASSERT_EQ(llvm::StringRef("string"), cv.data.arr_string.arr[2].str);
-
- // assign with same size
- vec.clear();
- vec.push_back("s1");
- vec.push_back("str2");
- vec.push_back("string3");
- v = Value::MakeStringArray(vec);
- ASSERT_EQ(NT_STRING_ARRAY, v->type());
- ASSERT_EQ(3u, v->GetStringArray().size());
- ASSERT_EQ(llvm::StringRef("s1"), v->GetStringArray()[0]);
- ASSERT_EQ(llvm::StringRef("str2"), v->GetStringArray()[1]);
- ASSERT_EQ(llvm::StringRef("string3"), v->GetStringArray()[2]);
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_STRING_ARRAY, cv.type);
- ASSERT_EQ(3u, cv.data.arr_string.size);
- ASSERT_EQ(llvm::StringRef("s1"), cv.data.arr_string.arr[0].str);
- ASSERT_EQ(llvm::StringRef("str2"), cv.data.arr_string.arr[1].str);
- ASSERT_EQ(llvm::StringRef("string3"), cv.data.arr_string.arr[2].str);
-
- // assign with different size
- vec.clear();
- vec.push_back("short");
- vec.push_back("er");
- v = Value::MakeStringArray(std::move(vec));
- ASSERT_EQ(NT_STRING_ARRAY, v->type());
- ASSERT_EQ(2u, v->GetStringArray().size());
- ASSERT_EQ(llvm::StringRef("short"), v->GetStringArray()[0]);
- ASSERT_EQ(llvm::StringRef("er"), v->GetStringArray()[1]);
- ConvertToC(*v, &cv);
- ASSERT_EQ(NT_STRING_ARRAY, cv.type);
- ASSERT_EQ(2u, cv.data.arr_string.size);
- ASSERT_EQ(llvm::StringRef("short"), cv.data.arr_string.arr[0].str);
- ASSERT_EQ(llvm::StringRef("er"), cv.data.arr_string.arr[1].str);
-
- NT_DisposeValue(&cv);
-}
-
-TEST_F(ValueDeathTest, GetAssertions) {
- Value v;
- ASSERT_DEATH(v.GetBoolean(), "type == NT_BOOLEAN");
- ASSERT_DEATH(v.GetDouble(), "type == NT_DOUBLE");
- ASSERT_DEATH(v.GetString(), "type == NT_STRING");
- ASSERT_DEATH(v.GetRaw(), "type == NT_RAW");
- ASSERT_DEATH(v.GetBooleanArray(), "type == NT_BOOLEAN_ARRAY");
- ASSERT_DEATH(v.GetDoubleArray(), "type == NT_DOUBLE_ARRAY");
- ASSERT_DEATH(v.GetStringArray(), "type == NT_STRING_ARRAY");
-}
-
-TEST_F(ValueTest, UnassignedComparison) {
- Value v1, v2;
- ASSERT_EQ(v1, v2);
-}
-
-TEST_F(ValueTest, MixedComparison) {
- Value v1;
- auto v2 = Value::MakeBoolean(true);
- ASSERT_NE(v1, *v2); // unassigned vs boolean
- auto v3 = Value::MakeDouble(0.5);
- ASSERT_NE(*v2, *v3); // boolean vs double
-}
-
-TEST_F(ValueTest, BooleanComparison) {
- auto v1 = Value::MakeBoolean(true);
- auto v2 = Value::MakeBoolean(true);
- ASSERT_EQ(*v1, *v2);
- v2 = Value::MakeBoolean(false);
- ASSERT_NE(*v1, *v2);
-}
-
-TEST_F(ValueTest, DoubleComparison) {
- auto v1 = Value::MakeDouble(0.25);
- auto v2 = Value::MakeDouble(0.25);
- ASSERT_EQ(*v1, *v2);
- v2 = Value::MakeDouble(0.5);
- ASSERT_NE(*v1, *v2);
-}
-
-TEST_F(ValueTest, StringComparison) {
- auto v1 = Value::MakeString("hello");
- auto v2 = Value::MakeString("hello");
- ASSERT_EQ(*v1, *v2);
- v2 = Value::MakeString("world"); // different contents
- ASSERT_NE(*v1, *v2);
- v2 = Value::MakeString("goodbye"); // different size
- ASSERT_NE(*v1, *v2);
-}
-
-TEST_F(ValueTest, BooleanArrayComparison) {
- std::vector<int> vec{1,0,1};
- auto v1 = Value::MakeBooleanArray(vec);
- auto v2 = Value::MakeBooleanArray(vec);
- ASSERT_EQ(*v1, *v2);
-
- // different contents
- vec = {1,1,1};
- v2 = Value::MakeBooleanArray(vec);
- ASSERT_NE(*v1, *v2);
-
- // different size
- vec = {1,0};
- v2 = Value::MakeBooleanArray(vec);
- ASSERT_NE(*v1, *v2);
-}
-
-TEST_F(ValueTest, DoubleArrayComparison) {
- std::vector<double> vec{0.5,0.25,0.5};
- auto v1 = Value::MakeDoubleArray(vec);
- auto v2 = Value::MakeDoubleArray(vec);
- ASSERT_EQ(*v1, *v2);
-
- // different contents
- vec = {0.5,0.5,0.5};
- v2 = Value::MakeDoubleArray(vec);
- ASSERT_NE(*v1, *v2);
-
- // different size
- vec = {0.5,0.25};
- v2 = Value::MakeDoubleArray(vec);
- ASSERT_NE(*v1, *v2);
-}
-
-TEST_F(ValueTest, StringArrayComparison) {
- std::vector<std::string> vec;
- vec.push_back("hello");
- vec.push_back("goodbye");
- vec.push_back("string");
- auto v1 = Value::MakeStringArray(vec);
- vec.clear();
- vec.push_back("hello");
- vec.push_back("goodbye");
- vec.push_back("string");
- auto v2 = Value::MakeStringArray(std::move(vec));
- ASSERT_EQ(*v1, *v2);
-
- // different contents
- vec.clear();
- vec.push_back("hello");
- vec.push_back("goodby2");
- vec.push_back("string");
- v2 = Value::MakeStringArray(std::move(vec));
- ASSERT_NE(*v1, *v2);
-
- // different sized contents
- vec.clear();
- vec.push_back("hello");
- vec.push_back("goodbye2");
- vec.push_back("string");
- v2 = Value::MakeStringArray(vec);
- ASSERT_NE(*v1, *v2);
-
- // different size
- vec.clear();
- vec.push_back("hello");
- vec.push_back("goodbye");
- v2 = Value::MakeStringArray(std::move(vec));
- ASSERT_NE(*v1, *v2);
-}
-
-} // namespace nt
diff --git a/third_party/ntcore_2017/test/unit/WireDecoderTest.cpp b/third_party/ntcore_2017/test/unit/WireDecoderTest.cpp
deleted file mode 100644
index 0f4d9eb..0000000
--- a/third_party/ntcore_2017/test/unit/WireDecoderTest.cpp
+++ /dev/null
@@ -1,602 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "WireDecoder.h"
-
-#include "gtest/gtest.h"
-
-#include <cfloat>
-#include <climits>
-#include <string>
-
-#include "llvm/StringRef.h"
-
-namespace nt {
-
-class WireDecoderTest : public ::testing::Test {
- protected:
- WireDecoderTest() {
- v_boolean = Value::MakeBoolean(true);
- v_double = Value::MakeDouble(1.0);
- v_string = Value::MakeString(llvm::StringRef("hello"));
- v_raw = Value::MakeRaw(llvm::StringRef("hello"));
- v_boolean_array = Value::MakeBooleanArray(std::vector<int>{0, 1, 0});
- v_boolean_array_big = Value::MakeBooleanArray(std::vector<int>(255));
- v_double_array = Value::MakeDoubleArray(std::vector<double>{0.5, 0.25});
- v_double_array_big = Value::MakeDoubleArray(std::vector<double>(255));
-
- std::vector<std::string> sa;
- sa.push_back("hello");
- sa.push_back("goodbye");
- v_string_array = Value::MakeStringArray(std::move(sa));
-
- sa.clear();
- for (int i=0; i<255; ++i)
- sa.push_back("h");
- v_string_array_big = Value::MakeStringArray(std::move(sa));
-
- s_normal = std::string("hello");
-
- s_long.clear();
- s_long.append(127, '*');
- s_long.push_back('x');
-
- s_big2.clear();
- s_big2.append(65534, '*');
- s_big2.push_back('x');
-
- s_big3.clear();
- s_big3.append(65534, '*');
- s_big3.append(3, 'x');
- }
-
- std::shared_ptr<Value> v_boolean, v_double, v_string, v_raw;
- std::shared_ptr<Value> v_boolean_array, v_boolean_array_big;
- std::shared_ptr<Value> v_double_array, v_double_array_big;
- std::shared_ptr<Value> v_string_array, v_string_array_big;
-
- std::string s_normal, s_long, s_big2, s_big3;
-};
-
-TEST_F(WireDecoderTest, Construct) {
- wpi::raw_mem_istream is("", 0);
- WireDecoder d(is, 0x0300u);
- EXPECT_EQ(nullptr, d.error());
- EXPECT_EQ(0x0300u, d.proto_rev());
-}
-
-TEST_F(WireDecoderTest, SetProtoRev) {
- wpi::raw_mem_istream is("", 0);
- WireDecoder d(is, 0x0300u);
- d.set_proto_rev(0x0200u);
- EXPECT_EQ(0x0200u, d.proto_rev());
-}
-
-TEST_F(WireDecoderTest, Read8) {
- wpi::raw_mem_istream is("\x05\x01\x00", 3);
- WireDecoder d(is, 0x0300u);
- unsigned int val;
- ASSERT_TRUE(d.Read8(&val));
- EXPECT_EQ(5u, val);
- ASSERT_TRUE(d.Read8(&val));
- EXPECT_EQ(1u, val);
- ASSERT_TRUE(d.Read8(&val));
- EXPECT_EQ(0u, val);
- ASSERT_FALSE(d.Read8(&val));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, Read16) {
- wpi::raw_mem_istream is("\x00\x05\x00\x01\x45\x67\x00\x00", 8);
- WireDecoder d(is, 0x0300u);
- unsigned int val;
- ASSERT_TRUE(d.Read16(&val));
- EXPECT_EQ(5u, val);
- ASSERT_TRUE(d.Read16(&val));
- EXPECT_EQ(1u, val);
- ASSERT_TRUE(d.Read16(&val));
- EXPECT_EQ(0x4567u, val);
- ASSERT_TRUE(d.Read16(&val));
- EXPECT_EQ(0u, val);
- ASSERT_FALSE(d.Read16(&val));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, Read32) {
- wpi::raw_mem_istream is(
- "\x00\x00\x00\x05\x00\x00\x00\x01\x00\x00\xab\xcd"
- "\x12\x34\x56\x78\x00\x00\x00\x00",
- 20);
- WireDecoder d(is, 0x0300u);
- unsigned long val;
- ASSERT_TRUE(d.Read32(&val));
- EXPECT_EQ(5ul, val);
- ASSERT_TRUE(d.Read32(&val));
- EXPECT_EQ(1ul, val);
- ASSERT_TRUE(d.Read32(&val));
- EXPECT_EQ(0xabcdul, val);
- ASSERT_TRUE(d.Read32(&val));
- EXPECT_EQ(0x12345678ul, val);
- ASSERT_TRUE(d.Read32(&val));
- EXPECT_EQ(0ul, val);
- ASSERT_FALSE(d.Read32(&val));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadDouble) {
- // values except min and max from
- // http://www.binaryconvert.com/result_double.html
- wpi::raw_mem_istream is(
- "\x00\x00\x00\x00\x00\x00\x00\x00"
- "\x41\x0c\x13\x80\x00\x00\x00\x00"
- "\x7f\xf0\x00\x00\x00\x00\x00\x00"
- "\x00\x10\x00\x00\x00\x00\x00\x00"
- "\x7f\xef\xff\xff\xff\xff\xff\xff",
- 40);
- WireDecoder d(is, 0x0300u);
- double val;
- ASSERT_TRUE(d.ReadDouble(&val));
- EXPECT_EQ(0.0, val);
- ASSERT_TRUE(d.ReadDouble(&val));
- EXPECT_EQ(2.3e5, val);
- ASSERT_TRUE(d.ReadDouble(&val));
- EXPECT_EQ(std::numeric_limits<double>::infinity(), val);
- ASSERT_TRUE(d.ReadDouble(&val));
- EXPECT_EQ(DBL_MIN, val);
- ASSERT_TRUE(d.ReadDouble(&val));
- EXPECT_EQ(DBL_MAX, val);
- ASSERT_FALSE(d.ReadDouble(&val));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadUleb128) {
- wpi::raw_mem_istream is("\x00\x7f\x80\x01\x80", 5);
- WireDecoder d(is, 0x0300u);
- unsigned long val;
- ASSERT_TRUE(d.ReadUleb128(&val));
- EXPECT_EQ(0ul, val);
- ASSERT_TRUE(d.ReadUleb128(&val));
- EXPECT_EQ(0x7ful, val);
- ASSERT_TRUE(d.ReadUleb128(&val));
- EXPECT_EQ(0x80ul, val);
- ASSERT_FALSE(d.ReadUleb128(&val)); // partial
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadType) {
- wpi::raw_mem_istream is("\x00\x01\x02\x03\x10\x11\x12\x20", 8);
- WireDecoder d(is, 0x0300u);
- NT_Type val;
- ASSERT_TRUE(d.ReadType(&val));
- EXPECT_EQ(NT_BOOLEAN, val);
- ASSERT_TRUE(d.ReadType(&val));
- EXPECT_EQ(NT_DOUBLE, val);
- ASSERT_TRUE(d.ReadType(&val));
- EXPECT_EQ(NT_STRING, val);
- ASSERT_TRUE(d.ReadType(&val));
- EXPECT_EQ(NT_RAW, val);
- ASSERT_TRUE(d.ReadType(&val));
- EXPECT_EQ(NT_BOOLEAN_ARRAY, val);
- ASSERT_TRUE(d.ReadType(&val));
- EXPECT_EQ(NT_DOUBLE_ARRAY, val);
- ASSERT_TRUE(d.ReadType(&val));
- EXPECT_EQ(NT_STRING_ARRAY, val);
- ASSERT_TRUE(d.ReadType(&val));
- EXPECT_EQ(NT_RPC, val);
- ASSERT_FALSE(d.ReadType(&val));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadTypeError) {
- wpi::raw_mem_istream is("\x30", 1);
- WireDecoder d(is, 0x0200u);
- NT_Type val;
- ASSERT_FALSE(d.ReadType(&val));
- EXPECT_EQ(NT_UNASSIGNED, val);
- ASSERT_NE(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, Reset) {
- wpi::raw_mem_istream is("\x30", 1);
- WireDecoder d(is, 0x0200u);
- NT_Type val;
- ASSERT_FALSE(d.ReadType(&val));
- EXPECT_EQ(NT_UNASSIGNED, val);
- ASSERT_NE(nullptr, d.error());
- d.Reset();
- EXPECT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadBooleanValue2) {
- wpi::raw_mem_istream is("\x01\x00", 2);
- WireDecoder d(is, 0x0200u);
- auto val = d.ReadValue(NT_BOOLEAN);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_boolean, *val);
-
- auto v_false = Value::MakeBoolean(false);
- val = d.ReadValue(NT_BOOLEAN);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_false, *val);
-
- ASSERT_FALSE(d.ReadValue(NT_BOOLEAN));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadDoubleValue2) {
- wpi::raw_mem_istream is(
- "\x3f\xf0\x00\x00\x00\x00\x00\x00"
- "\x3f\xf0\x00\x00\x00\x00\x00\x00",
- 16);
- WireDecoder d(is, 0x0200u);
- auto val = d.ReadValue(NT_DOUBLE);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_double, *val);
-
- val = d.ReadValue(NT_DOUBLE);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_double, *val);
-
- ASSERT_FALSE(d.ReadValue(NT_DOUBLE));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadStringValue2) {
- wpi::raw_mem_istream is("\x00\x05hello\x00\x03" "bye\x55", 13);
- WireDecoder d(is, 0x0200u);
- auto val = d.ReadValue(NT_STRING);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_string, *val);
-
- auto v_bye = Value::MakeString(llvm::StringRef("bye"));
- val = d.ReadValue(NT_STRING);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_bye, *val);
-
- unsigned int b;
- ASSERT_TRUE(d.Read8(&b));
- EXPECT_EQ(0x55u, b);
-
- ASSERT_FALSE(d.ReadValue(NT_STRING));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadBooleanArrayValue2) {
- wpi::raw_mem_istream is("\x03\x00\x01\x00\x02\x01\x00\xff", 8);
- WireDecoder d(is, 0x0200u);
- auto val = d.ReadValue(NT_BOOLEAN_ARRAY);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_boolean_array, *val);
-
- auto v_boolean_array2 = Value::MakeBooleanArray(std::vector<int>{1, 0});
- val = d.ReadValue(NT_BOOLEAN_ARRAY);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_boolean_array2, *val);
-
- ASSERT_FALSE(d.ReadValue(NT_BOOLEAN_ARRAY));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadBooleanArrayBigValue2) {
- std::string s;
- s.push_back('\xff');
- s.append(255, '\x00');
- wpi::raw_mem_istream is(s.data(), s.size());
- WireDecoder d(is, 0x0200u);
- auto val = d.ReadValue(NT_BOOLEAN_ARRAY);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_boolean_array_big, *val);
-
- ASSERT_FALSE(d.ReadValue(NT_BOOLEAN_ARRAY));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadDoubleArrayValue2) {
- wpi::raw_mem_istream is(
- "\x02\x3f\xe0\x00\x00\x00\x00\x00\x00"
- "\x3f\xd0\x00\x00\x00\x00\x00\x00\x55",
- 18);
- WireDecoder d(is, 0x0200u);
- auto val = d.ReadValue(NT_DOUBLE_ARRAY);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_double_array, *val);
-
- unsigned int b;
- ASSERT_TRUE(d.Read8(&b));
- EXPECT_EQ(0x55u, b);
-
- ASSERT_FALSE(d.ReadValue(NT_DOUBLE_ARRAY));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadDoubleArrayBigValue2) {
- std::string s;
- s.push_back('\xff');
- s.append(255*8, '\x00');
- wpi::raw_mem_istream is(s.data(), s.size());
- WireDecoder d(is, 0x0200u);
- auto val = d.ReadValue(NT_DOUBLE_ARRAY);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_double_array_big, *val);
-
- ASSERT_FALSE(d.ReadValue(NT_DOUBLE_ARRAY));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadStringArrayValue2) {
- wpi::raw_mem_istream is("\x02\x00\x05hello\x00\x07goodbye\x55", 18);
- WireDecoder d(is, 0x0200u);
- auto val = d.ReadValue(NT_STRING_ARRAY);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_string_array, *val);
-
- unsigned int b;
- ASSERT_TRUE(d.Read8(&b));
- EXPECT_EQ(0x55u, b);
-
- ASSERT_FALSE(d.ReadValue(NT_STRING_ARRAY));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadStringArrayBigValue2) {
- std::string s;
- s.push_back('\xff');
- for (int i=0; i<255; ++i)
- s.append("\x00\x01h", 3);
- wpi::raw_mem_istream is(s.data(), s.size());
- WireDecoder d(is, 0x0200u);
- auto val = d.ReadValue(NT_STRING_ARRAY);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_string_array_big, *val);
-
- ASSERT_FALSE(d.ReadValue(NT_STRING_ARRAY));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadValueError2) {
- wpi::raw_mem_istream is("", 0);
- WireDecoder d(is, 0x0200u);
- ASSERT_FALSE(d.ReadValue(NT_UNASSIGNED)); // unassigned
- ASSERT_NE(nullptr, d.error());
-
- d.Reset();
- ASSERT_FALSE(d.ReadValue(NT_RAW)); // not supported
- ASSERT_NE(nullptr, d.error());
-
- d.Reset();
- ASSERT_FALSE(d.ReadValue(NT_RPC)); // not supported
- ASSERT_NE(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadBooleanValue3) {
- wpi::raw_mem_istream is("\x01\x00", 2);
- WireDecoder d(is, 0x0300u);
- auto val = d.ReadValue(NT_BOOLEAN);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_boolean, *val);
-
- auto v_false = Value::MakeBoolean(false);
- val = d.ReadValue(NT_BOOLEAN);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_false, *val);
-
- ASSERT_FALSE(d.ReadValue(NT_BOOLEAN));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadDoubleValue3) {
- wpi::raw_mem_istream is(
- "\x3f\xf0\x00\x00\x00\x00\x00\x00"
- "\x3f\xf0\x00\x00\x00\x00\x00\x00",
- 16);
- WireDecoder d(is, 0x0300u);
- auto val = d.ReadValue(NT_DOUBLE);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_double, *val);
-
- val = d.ReadValue(NT_DOUBLE);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_double, *val);
-
- ASSERT_FALSE(d.ReadValue(NT_DOUBLE));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadStringValue3) {
- wpi::raw_mem_istream is("\x05hello\x03" "bye\x55", 11);
- WireDecoder d(is, 0x0300u);
- auto val = d.ReadValue(NT_STRING);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_string, *val);
-
- auto v_bye = Value::MakeString(llvm::StringRef("bye"));
- val = d.ReadValue(NT_STRING);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_bye, *val);
-
- unsigned int b;
- ASSERT_TRUE(d.Read8(&b));
- EXPECT_EQ(0x55u, b);
-
- ASSERT_FALSE(d.ReadValue(NT_STRING));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadRawValue3) {
- wpi::raw_mem_istream is("\x05hello\x03" "bye\x55", 11);
- WireDecoder d(is, 0x0300u);
- auto val = d.ReadValue(NT_RAW);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_raw, *val);
-
- auto v_bye = Value::MakeRaw(llvm::StringRef("bye"));
- val = d.ReadValue(NT_RAW);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_bye, *val);
-
- unsigned int b;
- ASSERT_TRUE(d.Read8(&b));
- EXPECT_EQ(0x55u, b);
-
- ASSERT_FALSE(d.ReadValue(NT_RAW));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadBooleanArrayValue3) {
- wpi::raw_mem_istream is("\x03\x00\x01\x00\x02\x01\x00\xff", 8);
- WireDecoder d(is, 0x0300u);
- auto val = d.ReadValue(NT_BOOLEAN_ARRAY);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_boolean_array, *val);
-
- auto v_boolean_array2 = Value::MakeBooleanArray(std::vector<int>{1, 0});
- val = d.ReadValue(NT_BOOLEAN_ARRAY);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_boolean_array2, *val);
-
- ASSERT_FALSE(d.ReadValue(NT_BOOLEAN_ARRAY));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadBooleanArrayBigValue3) {
- std::string s;
- s.push_back('\xff');
- s.append(255, '\x00');
- wpi::raw_mem_istream is(s.data(), s.size());
- WireDecoder d(is, 0x0300u);
- auto val = d.ReadValue(NT_BOOLEAN_ARRAY);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_boolean_array_big, *val);
-
- ASSERT_FALSE(d.ReadValue(NT_BOOLEAN_ARRAY));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadDoubleArrayValue3) {
- wpi::raw_mem_istream is(
- "\x02\x3f\xe0\x00\x00\x00\x00\x00\x00"
- "\x3f\xd0\x00\x00\x00\x00\x00\x00\x55",
- 18);
- WireDecoder d(is, 0x0300u);
- auto val = d.ReadValue(NT_DOUBLE_ARRAY);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_double_array, *val);
-
- unsigned int b;
- ASSERT_TRUE(d.Read8(&b));
- EXPECT_EQ(0x55u, b);
-
- ASSERT_FALSE(d.ReadValue(NT_DOUBLE_ARRAY));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadDoubleArrayBigValue3) {
- std::string s;
- s.push_back('\xff');
- s.append(255*8, '\x00');
- wpi::raw_mem_istream is(s.data(), s.size());
- WireDecoder d(is, 0x0300u);
- auto val = d.ReadValue(NT_DOUBLE_ARRAY);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_double_array_big, *val);
-
- ASSERT_FALSE(d.ReadValue(NT_DOUBLE_ARRAY));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadStringArrayValue3) {
- wpi::raw_mem_istream is("\x02\x05hello\x07goodbye\x55", 16);
- WireDecoder d(is, 0x0300u);
- auto val = d.ReadValue(NT_STRING_ARRAY);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_string_array, *val);
-
- unsigned int b;
- ASSERT_TRUE(d.Read8(&b));
- EXPECT_EQ(0x55u, b);
-
- ASSERT_FALSE(d.ReadValue(NT_STRING_ARRAY));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadStringArrayBigValue3) {
- std::string s;
- s.push_back('\xff');
- for (int i=0; i<255; ++i)
- s.append("\x01h", 2);
- wpi::raw_mem_istream is(s.data(), s.size());
- WireDecoder d(is, 0x0300u);
- auto val = d.ReadValue(NT_STRING_ARRAY);
- ASSERT_TRUE(bool(val));
- EXPECT_EQ(*v_string_array_big, *val);
-
- ASSERT_FALSE(d.ReadValue(NT_STRING_ARRAY));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadValueError3) {
- wpi::raw_mem_istream is("", 0);
- WireDecoder d(is, 0x0200u);
- ASSERT_FALSE(d.ReadValue(NT_UNASSIGNED)); // unassigned
- ASSERT_NE(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadString2) {
- std::string s;
- s.append("\x00\x05", 2);
- s += s_normal;
- s.append("\x00\x80", 2);
- s += s_long;
- s.append("\xff\xff", 2);
- s += s_big2;
- s.push_back('\x55');
- wpi::raw_mem_istream is(s.data(), s.size());
- WireDecoder d(is, 0x0200u);
- std::string outs;
- ASSERT_TRUE(d.ReadString(&outs));
- EXPECT_EQ(s_normal, outs);
- ASSERT_TRUE(d.ReadString(&outs));
- EXPECT_EQ(s_long, outs);
- ASSERT_TRUE(d.ReadString(&outs));
- EXPECT_EQ(s_big2, outs);
-
- unsigned int b;
- ASSERT_TRUE(d.Read8(&b));
- EXPECT_EQ(0x55u, b);
-
- ASSERT_FALSE(d.ReadString(&outs));
- ASSERT_EQ(nullptr, d.error());
-}
-
-TEST_F(WireDecoderTest, ReadString3) {
- std::string s;
- s.push_back('\x05');
- s += s_normal;
- s.append("\x80\x01", 2);
- s += s_long;
- s.append("\x81\x80\x04", 3);
- s += s_big3;
- s.push_back('\x55');
- wpi::raw_mem_istream is(s.data(), s.size());
- WireDecoder d(is, 0x0300u);
- std::string outs;
- ASSERT_TRUE(d.ReadString(&outs));
- EXPECT_EQ(s_normal, outs);
- ASSERT_TRUE(d.ReadString(&outs));
- EXPECT_EQ(s_long, outs);
- ASSERT_TRUE(d.ReadString(&outs));
- EXPECT_EQ(s_big3, outs);
-
- unsigned int b;
- ASSERT_TRUE(d.Read8(&b));
- EXPECT_EQ(0x55u, b);
-
- ASSERT_FALSE(d.ReadString(&outs));
- ASSERT_EQ(nullptr, d.error());
-}
-
-} // namespace nt
diff --git a/third_party/ntcore_2017/test/unit/WireEncoderTest.cpp b/third_party/ntcore_2017/test/unit/WireEncoderTest.cpp
deleted file mode 100644
index 39e248c..0000000
--- a/third_party/ntcore_2017/test/unit/WireEncoderTest.cpp
+++ /dev/null
@@ -1,499 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "WireEncoder.h"
-
-#include "gtest/gtest.h"
-
-#include <cfloat>
-#include <climits>
-#include <string>
-
-#include "llvm/StringRef.h"
-
-#define BUFSIZE 1024
-
-namespace nt {
-
-class WireEncoderTest : public ::testing::Test {
- protected:
- WireEncoderTest() {
- v_empty = std::make_shared<Value>();
- v_boolean = Value::MakeBoolean(true);
- v_double = Value::MakeDouble(1.0);
- v_string = Value::MakeString(llvm::StringRef("hello"));
- v_raw = Value::MakeRaw(llvm::StringRef("hello"));
- v_boolean_array = Value::MakeBooleanArray(std::vector<int>{0, 1, 0});
- v_boolean_array_big = Value::MakeBooleanArray(std::vector<int>(256));
- v_double_array = Value::MakeDoubleArray(std::vector<double>{0.5, 0.25});
- v_double_array_big = Value::MakeDoubleArray(std::vector<double>(256));
-
- std::vector<std::string> sa;
- sa.push_back("hello");
- sa.push_back("goodbye");
- v_string_array = Value::MakeStringArray(std::move(sa));
-
- sa.clear();
- for (int i=0; i<256; ++i)
- sa.push_back("h");
- v_string_array_big = Value::MakeStringArray(std::move(sa));
-
- s_normal = "hello";
-
- s_long.clear();
- s_long.append(127, '*');
- s_long.push_back('x');
-
- s_big.clear();
- s_big.append(65534, '*');
- s_big.append(3, 'x');
- }
-
- std::shared_ptr<Value> v_empty;
- std::shared_ptr<Value> v_boolean, v_double, v_string, v_raw;
- std::shared_ptr<Value> v_boolean_array, v_boolean_array_big;
- std::shared_ptr<Value> v_double_array, v_double_array_big;
- std::shared_ptr<Value> v_string_array, v_string_array_big;
-
- std::string s_normal, s_long, s_big;
-};
-
-TEST_F(WireEncoderTest, Construct) {
- WireEncoder e(0x0300u);
- EXPECT_EQ(0u, e.size());
- EXPECT_EQ(nullptr, e.error());
- EXPECT_EQ(0x0300u, e.proto_rev());
-}
-
-TEST_F(WireEncoderTest, SetProtoRev) {
- WireEncoder e(0x0300u);
- e.set_proto_rev(0x0200u);
- EXPECT_EQ(0x0200u, e.proto_rev());
-}
-
-TEST_F(WireEncoderTest, Write8) {
- std::size_t off = BUFSIZE-1;
- WireEncoder e(0x0300u);
- for(std::size_t i=0; i<off; ++i) e.Write8(0u); // test across Reserve()
- e.Write8(5u);
- e.Write8(0x101u); // should be truncated
- e.Write8(0u);
- ASSERT_EQ(3u, e.size()-off);
- ASSERT_EQ(llvm::StringRef("\x05\x01\x00", 3),
- llvm::StringRef(e.data(), e.size()).substr(off));
-}
-
-TEST_F(WireEncoderTest, Write16) {
- std::size_t off = BUFSIZE-2;
- WireEncoder e(0x0300u);
- for(std::size_t i=0; i<off; ++i) e.Write8(0u); // test across Reserve()
- e.Write16(5u);
- e.Write16(0x10001u); // should be truncated
- e.Write16(0x4567u);
- e.Write16(0u);
- ASSERT_EQ(8u, e.size()-off);
- ASSERT_EQ(llvm::StringRef("\x00\x05\x00\x01\x45\x67\x00\x00", 8),
- llvm::StringRef(e.data(), e.size()).substr(off));
-}
-
-TEST_F(WireEncoderTest, Write32) {
- std::size_t off = BUFSIZE-4;
- WireEncoder e(0x0300u);
- for(std::size_t i=0; i<off; ++i) e.Write8(0u); // test across Reserve()
- e.Write32(5ul);
- e.Write32(1ul);
- e.Write32(0xabcdul);
- e.Write32(0x12345678ul);
- e.Write32(0ul);
- ASSERT_EQ(20u, e.size()-off);
- ASSERT_EQ(llvm::StringRef(
- "\x00\x00\x00\x05\x00\x00\x00\x01\x00\x00\xab\xcd"
- "\x12\x34\x56\x78\x00\x00\x00\x00",
- 20),
- llvm::StringRef(e.data(), e.size()).substr(off));
-}
-
-TEST_F(WireEncoderTest, WriteDouble) {
- std::size_t off = BUFSIZE-8;
- WireEncoder e(0x0300u);
- for(std::size_t i=0; i<off; ++i) e.Write8(0u); // test across Reserve()
- e.WriteDouble(0.0);
- e.WriteDouble(2.3e5);
- e.WriteDouble(std::numeric_limits<double>::infinity());
- e.WriteDouble(DBL_MIN);
- e.WriteDouble(DBL_MAX);
- ASSERT_EQ(40u, e.size()-off);
- // golden values except min and max from
- // http://www.binaryconvert.com/result_double.html
- ASSERT_EQ(llvm::StringRef(
- "\x00\x00\x00\x00\x00\x00\x00\x00"
- "\x41\x0c\x13\x80\x00\x00\x00\x00"
- "\x7f\xf0\x00\x00\x00\x00\x00\x00"
- "\x00\x10\x00\x00\x00\x00\x00\x00"
- "\x7f\xef\xff\xff\xff\xff\xff\xff",
- 40),
- llvm::StringRef(e.data(), e.size()).substr(off));
-}
-
-TEST_F(WireEncoderTest, WriteUleb128) {
- std::size_t off = BUFSIZE-2;
- WireEncoder e(0x0300u);
- for(std::size_t i=0; i<off; ++i) e.Write8(0u); // test across Reserve()
- e.WriteUleb128(0ul);
- e.WriteUleb128(0x7ful);
- e.WriteUleb128(0x80ul);
- ASSERT_EQ(4u, e.size()-off);
- ASSERT_EQ(llvm::StringRef("\x00\x7f\x80\x01", 4),
- llvm::StringRef(e.data(), e.size()).substr(off));
-}
-
-TEST_F(WireEncoderTest, WriteType) {
- std::size_t off = BUFSIZE-1;
- WireEncoder e(0x0300u);
- for(std::size_t i=0; i<off; ++i) e.Write8(0u); // test across Reserve()
- e.WriteType(NT_BOOLEAN);
- e.WriteType(NT_DOUBLE);
- e.WriteType(NT_STRING);
- e.WriteType(NT_RAW);
- e.WriteType(NT_BOOLEAN_ARRAY);
- e.WriteType(NT_DOUBLE_ARRAY);
- e.WriteType(NT_STRING_ARRAY);
- e.WriteType(NT_RPC);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(8u, e.size()-off);
- ASSERT_EQ(llvm::StringRef("\x00\x01\x02\x03\x10\x11\x12\x20", 8),
- llvm::StringRef(e.data(), e.size()).substr(off));
-}
-
-TEST_F(WireEncoderTest, WriteTypeError) {
- WireEncoder e(0x0200u);
- e.WriteType(NT_UNASSIGNED);
- EXPECT_EQ(0u, e.size());
- EXPECT_EQ(std::string("unrecognized type"), e.error());
-
- e.Reset();
- e.WriteType(NT_RAW);
- EXPECT_EQ(0u, e.size());
- EXPECT_EQ(std::string("raw type not supported in protocol < 3.0"), e.error());
-
- e.Reset();
- e.WriteType(NT_RPC);
- EXPECT_EQ(0u, e.size());
- EXPECT_EQ(std::string("RPC type not supported in protocol < 3.0"), e.error());
-}
-
-TEST_F(WireEncoderTest, Reset) {
- WireEncoder e(0x0300u);
- e.WriteType(NT_UNASSIGNED);
- EXPECT_NE(nullptr, e.error());
- e.Reset();
- EXPECT_EQ(nullptr, e.error());
-
- e.Write8(0u);
- EXPECT_EQ(1u, e.size());
- e.Reset();
- EXPECT_EQ(0u, e.size());
-}
-
-TEST_F(WireEncoderTest, GetValueSize2) {
- WireEncoder e(0x0200u);
- EXPECT_EQ(0u, e.GetValueSize(*v_empty)); // empty
- EXPECT_EQ(1u, e.GetValueSize(*v_boolean));
- EXPECT_EQ(8u, e.GetValueSize(*v_double));
- EXPECT_EQ(7u, e.GetValueSize(*v_string));
- EXPECT_EQ(0u, e.GetValueSize(*v_raw)); // not supported
-
- EXPECT_EQ(1u+3u, e.GetValueSize(*v_boolean_array));
- // truncated
- EXPECT_EQ(1u+255u, e.GetValueSize(*v_boolean_array_big));
-
- EXPECT_EQ(1u+2u*8u, e.GetValueSize(*v_double_array));
- // truncated
- EXPECT_EQ(1u+255u*8u, e.GetValueSize(*v_double_array_big));
-
- EXPECT_EQ(1u+7u+9u, e.GetValueSize(*v_string_array));
- // truncated
- EXPECT_EQ(1u+255u*3u, e.GetValueSize(*v_string_array_big));
-}
-
-TEST_F(WireEncoderTest, WriteBooleanValue2) {
- WireEncoder e(0x0200u);
- e.WriteValue(*v_boolean);
- auto v_false = Value::MakeBoolean(false);
- e.WriteValue(*v_false);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(2u, e.size());
- ASSERT_EQ(llvm::StringRef("\x01\x00", 2),
- llvm::StringRef(e.data(), e.size()));
-}
-
-TEST_F(WireEncoderTest, WriteDoubleValue2) {
- WireEncoder e(0x0200u);
- e.WriteValue(*v_double);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(8u, e.size());
- ASSERT_EQ(llvm::StringRef("\x3f\xf0\x00\x00\x00\x00\x00\x00", 8),
- llvm::StringRef(e.data(), e.size()));
-}
-
-TEST_F(WireEncoderTest, WriteStringValue2) {
- WireEncoder e(0x0200u);
- e.WriteValue(*v_string);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(7u, e.size());
- ASSERT_EQ(llvm::StringRef("\x00\x05hello", 7),
- llvm::StringRef(e.data(), e.size()));
-}
-
-TEST_F(WireEncoderTest, WriteBooleanArrayValue2) {
- WireEncoder e(0x0200u);
- e.WriteValue(*v_boolean_array);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(1u+3u, e.size());
- ASSERT_EQ(llvm::StringRef("\x03\x00\x01\x00", 4),
- llvm::StringRef(e.data(), e.size()));
-
- // truncated
- e.Reset();
- e.WriteValue(*v_boolean_array_big);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(1u+255u, e.size());
- ASSERT_EQ(llvm::StringRef("\xff\x00", 2), llvm::StringRef(e.data(), 2));
-}
-
-TEST_F(WireEncoderTest, WriteDoubleArrayValue2) {
- WireEncoder e(0x0200u);
- e.WriteValue(*v_double_array);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(1u+2u*8u, e.size());
- ASSERT_EQ(llvm::StringRef("\x02\x3f\xe0\x00\x00\x00\x00\x00\x00"
- "\x3f\xd0\x00\x00\x00\x00\x00\x00", 17),
- llvm::StringRef(e.data(), e.size()));
-
- // truncated
- e.Reset();
- e.WriteValue(*v_double_array_big);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(1u+255u*8u, e.size());
- ASSERT_EQ(llvm::StringRef("\xff\x00", 2), llvm::StringRef(e.data(), 2));
-}
-
-TEST_F(WireEncoderTest, WriteStringArrayValue2) {
- WireEncoder e(0x0200u);
- e.WriteValue(*v_string_array);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(1u+7u+9u, e.size());
- ASSERT_EQ(llvm::StringRef("\x02\x00\x05hello\x00\x07goodbye", 17),
- llvm::StringRef(e.data(), e.size()));
-
- // truncated
- e.Reset();
- e.WriteValue(*v_string_array_big);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(1u+255u*3u, e.size());
- ASSERT_EQ(llvm::StringRef("\xff\x00\x01", 3), llvm::StringRef(e.data(), 3));
-}
-
-TEST_F(WireEncoderTest, WriteValueError2) {
- WireEncoder e(0x0200u);
- e.WriteValue(*v_empty); // empty
- ASSERT_EQ(0u, e.size());
- ASSERT_NE(nullptr, e.error());
-
- e.Reset();
- e.WriteValue(*v_raw); // not supported
- ASSERT_EQ(0u, e.size());
- ASSERT_NE(nullptr, e.error());
-}
-
-TEST_F(WireEncoderTest, GetValueSize3) {
- WireEncoder e(0x0300u);
- EXPECT_EQ(0u, e.GetValueSize(*v_empty)); // empty
- EXPECT_EQ(1u, e.GetValueSize(*v_boolean));
- EXPECT_EQ(8u, e.GetValueSize(*v_double));
- EXPECT_EQ(6u, e.GetValueSize(*v_string));
- EXPECT_EQ(6u, e.GetValueSize(*v_raw));
-
- EXPECT_EQ(1u+3u, e.GetValueSize(*v_boolean_array));
- // truncated
- EXPECT_EQ(1u+255u, e.GetValueSize(*v_boolean_array_big));
-
- EXPECT_EQ(1u+2u*8u, e.GetValueSize(*v_double_array));
- // truncated
- EXPECT_EQ(1u+255u*8u, e.GetValueSize(*v_double_array_big));
-
- EXPECT_EQ(1u+6u+8u, e.GetValueSize(*v_string_array));
- // truncated
- EXPECT_EQ(1u+255u*2u, e.GetValueSize(*v_string_array_big));
-}
-
-TEST_F(WireEncoderTest, WriteBooleanValue3) {
- WireEncoder e(0x0300u);
- e.WriteValue(*v_boolean);
- auto v_false = Value::MakeBoolean(false);
- e.WriteValue(*v_false);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(2u, e.size());
- ASSERT_EQ(llvm::StringRef("\x01\x00", 2),
- llvm::StringRef(e.data(), e.size()));
-}
-
-TEST_F(WireEncoderTest, WriteDoubleValue3) {
- WireEncoder e(0x0300u);
- e.WriteValue(*v_double);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(8u, e.size());
- ASSERT_EQ(llvm::StringRef("\x3f\xf0\x00\x00\x00\x00\x00\x00", 8),
- llvm::StringRef(e.data(), e.size()));
-}
-
-TEST_F(WireEncoderTest, WriteStringValue3) {
- WireEncoder e(0x0300u);
- e.WriteValue(*v_string);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(6u, e.size());
- ASSERT_EQ(llvm::StringRef("\x05hello", 6),
- llvm::StringRef(e.data(), e.size()));
-}
-
-TEST_F(WireEncoderTest, WriteRawValue3) {
- WireEncoder e(0x0300u);
- e.WriteValue(*v_raw);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(6u, e.size());
- ASSERT_EQ(llvm::StringRef("\x05hello", 6),
- llvm::StringRef(e.data(), e.size()));
-}
-
-TEST_F(WireEncoderTest, WriteBooleanArrayValue3) {
- WireEncoder e(0x0300u);
- e.WriteValue(*v_boolean_array);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(1u+3u, e.size());
- ASSERT_EQ(llvm::StringRef("\x03\x00\x01\x00", 4),
- llvm::StringRef(e.data(), e.size()));
-
- // truncated
- e.Reset();
- e.WriteValue(*v_boolean_array_big);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(1u+255u, e.size());
- ASSERT_EQ(llvm::StringRef("\xff\x00", 2), llvm::StringRef(e.data(), 2));
-}
-
-TEST_F(WireEncoderTest, WriteDoubleArrayValue3) {
- WireEncoder e(0x0300u);
- e.WriteValue(*v_double_array);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(1u+2u*8u, e.size());
- ASSERT_EQ(llvm::StringRef("\x02\x3f\xe0\x00\x00\x00\x00\x00\x00"
- "\x3f\xd0\x00\x00\x00\x00\x00\x00", 17),
- llvm::StringRef(e.data(), e.size()));
-
- // truncated
- e.Reset();
- e.WriteValue(*v_double_array_big);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(1u+255u*8u, e.size());
- ASSERT_EQ(llvm::StringRef("\xff\x00", 2), llvm::StringRef(e.data(), 2));
-}
-
-TEST_F(WireEncoderTest, WriteStringArrayValue3) {
- WireEncoder e(0x0300u);
- e.WriteValue(*v_string_array);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(1u+6u+8u, e.size());
- ASSERT_EQ(llvm::StringRef("\x02\x05hello\x07goodbye", 15),
- llvm::StringRef(e.data(), e.size()));
-
- // truncated
- e.Reset();
- e.WriteValue(*v_string_array_big);
- ASSERT_EQ(nullptr, e.error());
- ASSERT_EQ(1u+255u*2u, e.size());
- ASSERT_EQ(llvm::StringRef("\xff\x01", 2), llvm::StringRef(e.data(), 2));
-}
-
-TEST_F(WireEncoderTest, WriteValueError3) {
- WireEncoder e(0x0300u);
- e.WriteValue(*v_empty); // empty
- ASSERT_EQ(0u, e.size());
- ASSERT_NE(nullptr, e.error());
-}
-
-TEST_F(WireEncoderTest, GetStringSize2) {
- // 2-byte length
- WireEncoder e(0x0200u);
- EXPECT_EQ(7u, e.GetStringSize(s_normal));
- EXPECT_EQ(130u, e.GetStringSize(s_long));
- // truncated
- EXPECT_EQ(65537u, e.GetStringSize(s_big));
-}
-
-TEST_F(WireEncoderTest, WriteString2) {
- WireEncoder e(0x0200u);
- e.WriteString(s_normal);
- EXPECT_EQ(nullptr, e.error());
- EXPECT_EQ(7u, e.size());
- EXPECT_EQ(llvm::StringRef("\x00\x05hello", 7),
- llvm::StringRef(e.data(), e.size()));
-
- e.Reset();
- e.WriteString(s_long);
- EXPECT_EQ(nullptr, e.error());
- ASSERT_EQ(130u, e.size());
- EXPECT_EQ(llvm::StringRef("\x00\x80**", 4), llvm::StringRef(e.data(), 4));
- EXPECT_EQ('*', e.data()[128]);
- EXPECT_EQ('x', e.data()[129]);
-
- // truncated
- e.Reset();
- e.WriteString(s_big);
- EXPECT_EQ(nullptr, e.error());
- ASSERT_EQ(65537u, e.size());
- EXPECT_EQ(llvm::StringRef("\xff\xff**", 4), llvm::StringRef(e.data(), 4));
- EXPECT_EQ('*', e.data()[65535]);
- EXPECT_EQ('x', e.data()[65536]);
-}
-
-TEST_F(WireEncoderTest, GetStringSize3) {
- // leb128-encoded length
- WireEncoder e(0x0300u);
- EXPECT_EQ(6u, e.GetStringSize(s_normal));
- EXPECT_EQ(130u, e.GetStringSize(s_long));
- EXPECT_EQ(65540u, e.GetStringSize(s_big));
-}
-
-TEST_F(WireEncoderTest, WriteString3) {
- WireEncoder e(0x0300u);
- e.WriteString(s_normal);
- EXPECT_EQ(nullptr, e.error());
- EXPECT_EQ(6u, e.size());
- EXPECT_EQ(llvm::StringRef("\x05hello", 6),
- llvm::StringRef(e.data(), e.size()));
-
- e.Reset();
- e.WriteString(s_long);
- EXPECT_EQ(nullptr, e.error());
- ASSERT_EQ(130u, e.size());
- EXPECT_EQ(llvm::StringRef("\x80\x01**", 4), llvm::StringRef(e.data(), 4));
- EXPECT_EQ('*', e.data()[128]);
- EXPECT_EQ('x', e.data()[129]);
-
- // NOT truncated
- e.Reset();
- e.WriteString(s_big);
- EXPECT_EQ(nullptr, e.error());
- ASSERT_EQ(65540u, e.size());
- EXPECT_EQ(llvm::StringRef("\x81\x80\x04*", 4), llvm::StringRef(e.data(), 4));
- EXPECT_EQ('*', e.data()[65536]);
- EXPECT_EQ('x', e.data()[65537]);
- EXPECT_EQ('x', e.data()[65538]);
- EXPECT_EQ('x', e.data()[65539]);
-}
-
-} // namespace nt
diff --git a/third_party/ntcore_2017/test/unit/main.cpp b/third_party/ntcore_2017/test/unit/main.cpp
deleted file mode 100644
index 0673382..0000000
--- a/third_party/ntcore_2017/test/unit/main.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "gtest/gtest.h"
-
-#include "Log.h"
-
-int main(int argc, char **argv)
-{
- nt::Logger::GetInstance().SetLogger(
- [](unsigned int level, const char* file, unsigned int line,
- const char* msg) {
- std::fputs(msg, stderr);
- std::fputc('\n', stderr);
- });
- nt::Logger::GetInstance().set_min_level(0);
- ::testing::InitGoogleTest(&argc, argv);
- int ret = RUN_ALL_TESTS();
- return ret;
-}
diff --git a/third_party/ntcore_2017/toolchains/arm.gradle b/third_party/ntcore_2017/toolchains/arm.gradle
deleted file mode 100644
index 90a8758..0000000
--- a/third_party/ntcore_2017/toolchains/arm.gradle
+++ /dev/null
@@ -1,100 +0,0 @@
-ext.isArm = true
-ext.buildPlatform = 'arm'
-
-def compilerPrefix = project.hasProperty('compilerPrefix') ? project.compilerPrefix : 'arm-frc-linux-gnueabi-'
-def toolChainPath = project.hasProperty('toolChainPath') ? project.toolChainPath : null
-model {
- platforms {
- arm {
- architecture 'arm'
- operatingSystem 'linux'
- }
- }
- toolChains {
- armGcc(Gcc) {
- if (toolChainPath != null) path(toolChainPath)
- target("arm") {
- // We use a custom-built cross compiler with the prefix arm-frc-linux-gnueabi-<util name>
- // If this ever changes, the prefix will need to be changed here
- cCompiler.executable = compilerPrefix + cCompiler.executable
- cppCompiler.executable = compilerPrefix + cppCompiler.executable
- linker.executable = compilerPrefix + linker.executable
- assembler.executable = compilerPrefix + assembler.executable
- // Gradle auto-adds the -m32 argument to the linker and compiler. Our compiler only supports
- // arm, and doesn't understand this flag, so it is removed from both
- cppCompiler.withArguments { args ->
- args << '-std=c++1y' << '-Wformat=2' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic'
- args << '-Wno-psabi' << '-Wno-unused-parameter' << '-fPIC' << '-rdynamic'
- //TODO: When the compiler allows us to actually call deprecated functions from within
- // deprecated function, remove this line (this will cause calling deprecated functions
- // to be treated as a warning rather than an error).
- args << '-Wno-error=deprecated-declarations' << '-pthread'
- args.remove('-m32')
- }
- linker.withArguments { args ->
- args << '-rdynamic' << '-pthread'
- args.remove('-m32')
- }
- staticLibArchiver.executable = compilerPrefix + staticLibArchiver.executable
- }
- }
- }
-}
-
-ext.binTools = { tool ->
- if (toolChainPath != null) return "${toolChainPath}/${compilerPrefix}${tool}"
- return "${compilerPrefix}${tool}"
-}
-
-ext.setupReleaseDefines = { cppCompiler, linker ->
- cppCompiler.args '-O2', '-g'
-}
-
-ext.setupDebugDefines = { cppCompiler, linker ->
- cppCompiler.args '-g', '-O0'
-}
-
-// Used only on Windows.
-ext.setupDef = { linker, deffile -> }
-
-ext.debugStripSetup = {
- if (!project.hasProperty('debug')) {
- project.tasks.whenObjectAdded { task ->
- if (task.name.contains('link') && task.name.contains('SharedLibrary')) {
- def library = task.outputFile.absolutePath
- def debugLibrary = task.outputFile.absolutePath + ".debug"
- task.doLast {
- exec { commandLine binTools('objcopy'), '--only-keep-debug', library, debugLibrary }
- exec { commandLine binTools('strip'), '-g', library }
- exec { commandLine binTools('objcopy'), "--add-gnu-debuglink=$debugLibrary", library }
- }
- }
- }
- }
-}
-
-ext.checkNativeSymbols = { getSymbolFunc ->
- project.tasks.whenObjectAdded { task ->
- if (task.name.contains('link') && task.name.contains('SharedLibrary')) {
- def library = task.outputFile.absolutePath
- task.doLast {
- def nmOutput = new ByteArrayOutputStream()
- exec {
- commandLine binTools('nm'), library
- standardOutput nmOutput
- }
- // Remove '\r' so we can check for full string contents
- String nmSymbols = nmOutput.toString().replace('\r', '')
-
- def symbolList = getSymbolFunc()
- symbolList.each {
- //Add \n so we can check for the exact symbol
- def found = nmSymbols.contains(it + '\n')
- if (!found) {
- throw new GradleException("Found a definition that does not have a matching symbol ${it}")
- }
- }
- }
- }
- }
-}
diff --git a/third_party/ntcore_2017/toolchains/linux.gradle b/third_party/ntcore_2017/toolchains/linux.gradle
deleted file mode 100644
index cea85b4..0000000
--- a/third_party/ntcore_2017/toolchains/linux.gradle
+++ /dev/null
@@ -1,87 +0,0 @@
-model {
- toolChains {
- gcc(Gcc) {
- target('x86') {
- cppCompiler.withArguments { args ->
- args << '-std=c++11' << '-Wformat=2' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic'
- args << '-Wno-psabi' << '-Wno-unused-parameter' << '-fPIC' << '-rdynamic'
- //TODO: When the compiler allows us to actually call deprecated functions from within
- // deprecated function, remove this line (this will cause calling deprecated functions
- // to be treated as a warning rather than an error).
- args << '-Wno-error=deprecated-declarations' << '-pthread'
- args << '-m32'
- }
- linker.withArguments { args ->
- args << '-rdynamic' << '-pthread'
- args << '-m32'
- }
- }
- target('x64') {
- cppCompiler.withArguments { args ->
- args << '-std=c++11' << '-Wformat=2' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic'
- args << '-Wno-psabi' << '-Wno-unused-parameter' << '-fPIC' << '-rdynamic'
- //TODO: When the compiler allows us to actually call deprecated functions from within
- // deprecated function, remove this line (this will cause calling deprecated functions
- // to be treated as a warning rather than an error).
- args << '-Wno-error=deprecated-declarations' << '-pthread'
- }
- linker.withArguments { args ->
- args << '-rdynamic' << '-pthread'
- }
- }
- }
- }
-}
-
-ext.setupReleaseDefines = { cppCompiler, linker ->
- cppCompiler.args '-O2', '-g'
-}
-
-ext.setupDebugDefines = { cppCompiler, linker ->
- cppCompiler.args '-g', '-O0'
-}
-
-// Used only on Windows.
-ext.setupDef = { linker, deffile -> }
-
-ext.debugStripSetup = {
- if (!project.hasProperty('debug')) {
- project.tasks.whenObjectAdded { task ->
- if (task.name.contains('link') && task.name.contains('SharedLibrary')) {
- def library = task.outputFile.absolutePath
- def debugLibrary = task.outputFile.absolutePath + ".debug"
- task.doLast {
- exec { commandLine "objcopy", '--only-keep-debug', library, debugLibrary }
- exec { commandLine "strip", '-g', library }
- exec { commandLine "objcopy", "--add-gnu-debuglink=$debugLibrary", library }
- }
- }
- }
- }
-}
-
-ext.checkNativeSymbols = { getSymbolFunc ->
- project.tasks.whenObjectAdded { task ->
- if (task.name.contains('link') && task.name.contains('SharedLibrary')) {
- def library = task.outputFile.absolutePath
- task.doLast {
- def nmOutput = new ByteArrayOutputStream()
- exec {
- commandLine "nm", library
- standardOutput nmOutput
- }
- // Remove '\r' so we can check for full string contents
- String nmSymbols = nmOutput.toString().replace('\r', '')
-
- def symbolList = getSymbolFunc()
- symbolList.each {
- //Add \n so we can check for the exact symbol
- def found = nmSymbols.contains(it + '\n')
- if (!found) {
- throw new GradleException("Found a definition that does not have a matching symbol ${it}")
- }
- }
- }
- }
- }
-}
diff --git a/third_party/ntcore_2017/toolchains/mac.gradle b/third_party/ntcore_2017/toolchains/mac.gradle
deleted file mode 100644
index 902cbb5..0000000
--- a/third_party/ntcore_2017/toolchains/mac.gradle
+++ /dev/null
@@ -1,74 +0,0 @@
-model {
- toolChains {
- clang(Clang) {
- target('x86') {
- cppCompiler.withArguments { args ->
- args << '-std=c++11' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic-errors'
- args << '-fPIC' << '-m32'
- args << '-Wno-unused-parameter' << '-Wno-missing-field-initializers' << '-Wno-unused-private-field'
- }
- linker.withArguments { args ->
- args << '-m32'
- }
- }
- target('x64') {
- cppCompiler.withArguments { args ->
- args << '-std=c++11' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic-errors'
- args << '-fPIC'
- args << '-Wno-missing-field-initializers' << '-Wno-unused-private-field' << '-Wno-unused-parameter'
- }
- }
- }
- }
-}
-
-ext.setupReleaseDefines = { cppCompiler, linker ->
- cppCompiler.args '-O2'
-}
-
-ext.setupDebugDefines = { cppCompiler, linker ->
- cppCompiler.args '-g', '-O0'
-}
-
-// Used only on Windows.
-ext.setupDef = { linker, deffile -> }
-
-ext.debugStripSetup = {
- if (!project.hasProperty('debug')) {
- project.tasks.whenObjectAdded { task ->
- if (task.name.contains('link') && task.name.contains('SharedLibrary')) {
- def library = task.outputFile.absolutePath
- task.doLast {
- exec { commandLine "dsymutil", library }
- exec { commandLine "strip", '-S', library }
- }
- }
- }
- }
-}
-
-ext.checkNativeSymbols = { getSymbolFunc ->
- project.tasks.whenObjectAdded { task ->
- if (task.name.contains('link') && task.name.contains('SharedLibrary')) {
- def library = task.outputFile.absolutePath
- task.doLast {
- def nmOutput = new ByteArrayOutputStream()
- exec {
- commandLine "nm", library
- standardOutput nmOutput
- }
- // Remove '\r' so we can check for full string contents
- String nmSymbols = nmOutput.toString().replace('\r', '')
-
- def symbolList = getSymbolFunc()
- symbolList.each {
- //Add \n so we can check for the exact symbol
- def found = nmSymbols.contains(it + '\n')
- if (!found) {
- throw new GradleException("Found a definition that does not have a matching symbol ${it}")
- }
- }
- }
- }
- }
-}
diff --git a/third_party/ntcore_2017/toolchains/native.gradle b/third_party/ntcore_2017/toolchains/native.gradle
deleted file mode 100644
index 10d8b8a..0000000
--- a/third_party/ntcore_2017/toolchains/native.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-import org.gradle.internal.os.OperatingSystem
-
-ext.isArm = false
-ext.buildPlatform = OperatingSystem.current().getFamilyName()
-
-if (OperatingSystem.current().isLinux()) {
- apply from: "${rootDir}/toolchains/linux.gradle"
-} else if (OperatingSystem.current().isMacOsX()) {
- apply from: "${rootDir}/toolchains/mac.gradle"
-} else if (OperatingSystem.current().isWindows()) {
- apply from: "${rootDir}/toolchains/windows.gradle"
-} else {
- throw new GradleException("${name} does not support building on ${ext.buildPlatform}.")
-}
-
-model {
- platforms {
- x86 {
- architecture 'x86'
- }
- x64 {
- architecture 'x86_64'
- }
- }
-}
diff --git a/third_party/ntcore_2017/toolchains/windows.gradle b/third_party/ntcore_2017/toolchains/windows.gradle
deleted file mode 100644
index f565934..0000000
--- a/third_party/ntcore_2017/toolchains/windows.gradle
+++ /dev/null
@@ -1,33 +0,0 @@
-model {
- toolChains {
- visualCpp(VisualCpp) {
-
- eachPlatform {
- cppCompiler.withArguments { args ->
- args << '/EHsc' << '/DNOMINMAX' << '/D_SCL_SECURE_NO_WARNINGS' << '/D_WINSOCK_DEPRECATED_NO_WARNINGS'
- }
- }
- }
- }
-}
-
-ext.setupReleaseDefines = { cppCompiler, linker ->
- cppCompiler.args '/O2', '/Zi', '/FS'
-}
-
-ext.setupDebugDefines = { cppCompiler, linker ->
- cppCompiler.args '/Zi', '/FS'
- linker.args '/DEBUG'
-}
-
-ext.setupDef = { linker, deffile ->
- linker.args "/DEF:${deffile}"
-}
-
-// This is a noop on Windows. On gcc platforms, we strip the release binary and create a separate
-// debug library, but Windows already separates debug symbols into a .pdb file.
-ext.debugStripSetup = { }
-
-// This is a noop on Windows. The def file already implicilty checks for the symbols
-ext.checkNativeSymbols = { getSymbolFunc ->
-}
diff --git a/third_party/ntcore_2017/wpiutil.gradle b/third_party/ntcore_2017/wpiutil.gradle
deleted file mode 100644
index 6cd9fab..0000000
--- a/third_party/ntcore_2017/wpiutil.gradle
+++ /dev/null
@@ -1,119 +0,0 @@
-def wpiutilSetupModel = { project ->
- project.model {
- components {
- wpiutil(NativeLibrarySpec) {
- if (project.isArm) {
- targetPlatform 'arm'
- } else {
- targetPlatform 'x86'
- targetPlatform 'x64'
- }
- setupDefines(project, binaries)
-
- sources {
- cpp {
- source {
- srcDirs = ["${rootDir}/wpiutil/src"]
- includes = ['**/*.cpp']
- }
- exportedHeaders {
- srcDirs = ["${rootDir}/wpiutil/include"]
- includes = ['**/*.h']
- }
- }
- }
- }
- }
- }
-}
-
-
-def wpiutilZipTask = { project ->
- project.ext.wpiutilZip = project.tasks.create("wpiutilZip", Zip) {
- description = 'Creates platform-specific zip of the desktop wpiutil libraries.'
- group = 'WPILib'
- destinationDir = project.buildDir
- baseName = 'wpiutil'
- if (project.isArm && project.hasProperty('compilerPrefix')
- && project.hasProperty('armSuffix')) {
- classifier = "${project.buildPlatform}${project.armSuffix}"
- } else {
- classifier = "${project.buildPlatform}"
- }
- duplicatesStrategy = 'exclude'
-
- from(file('wpiutil/include')) {
- into 'include'
- }
-
- project.model {
- binaries {
- withType(StaticLibraryBinarySpec) { binary ->
- from(binary.staticLibraryFile) {
- into getPlatformPath(binary)
- }
- }
- withType(SharedLibraryBinarySpec) { binary ->
- from(binary.sharedLibraryFile) {
- into getPlatformPath(binary)
- }
- from(new File(binary.sharedLibraryFile.absolutePath + ".debug")) {
- into getPlatformPath(binary)
- }
- }
- }
- }
- }
-
- project.build.dependsOn project.wpiutilZip
-
- project.debugStripSetup()
-
- project.tasks.whenTaskAdded { task ->
- def name = task.name.toLowerCase()
- if (name.contains("wpiutilsharedlibrary") || name.contains("wpiutilstaticlibrary") || name.contains("wpiutiltest")) {
- project.wpiutilZip.dependsOn task
- }
- }
-}
-
-if (buildArm) {
- project(':arm:wpiutil') {
- apply plugin: 'cpp'
-
- apply from: "${rootDir}/toolchains/arm.gradle"
-
- wpiutilSetupModel(project)
- wpiutilZipTask(project)
- }
-}
-
-project(':native:wpiutil') {
- apply plugin: 'cpp'
-
- apply from: "${rootDir}/toolchains/native.gradle"
-
- if (!project.hasProperty("withoutTests")) {
- apply from: "${rootDir}/wpiutil/unittest/unittest.gradle"
- }
-
- wpiutilSetupModel(project)
- wpiutilZipTask(project)
-}
-
-task wpiutilSourceZip(type: Zip) {
- description = 'Creates a sources-zip of the wpiutil source files'
- group = 'WPILib'
- destinationDir = project.buildDir
- baseName = 'wpiutil'
- classifier = "sources"
- duplicatesStrategy = 'exclude'
-
- from('wpiutil/src') {
- into 'src'
- }
-
- from('wpiutil/include') {
- into 'include'
- }
-}
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/AlignOf.h b/third_party/ntcore_2017/wpiutil/include/llvm/AlignOf.h
deleted file mode 100644
index d54328b..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/AlignOf.h
+++ /dev/null
@@ -1,259 +0,0 @@
-//===--- AlignOf.h - Portable calculation of type alignment -----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the AlignOf function that computes alignments for
-// arbitrary types.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_ALIGNOF_H
-#define LLVM_SUPPORT_ALIGNOF_H
-
-#include "llvm/Compiler.h"
-#include <cstddef>
-#include <type_traits>
-
-namespace llvm {
-
-namespace detail {
-
-// For everything other than an abstract class we can calulate alignment by
-// building a class with a single character and a member of the given type.
-template <typename T, bool = std::is_abstract<T>::value>
-struct AlignmentCalcImpl {
- char x;
-#if defined(_MSC_VER)
-// Disables "structure was padded due to __declspec(align())" warnings that are
-// generated by any class using AlignOf<T> with a manually specified alignment.
-// Although the warning is disabled in the LLVM project we need this pragma
-// as AlignOf.h is a published support header that's available for use
-// out-of-tree, and we would like that to compile cleanly at /W4.
-#pragma warning(suppress : 4324)
-#endif
- T t;
-private:
- AlignmentCalcImpl() = delete;
-};
-
-// Abstract base class helper, this will have the minimal alignment and size
-// for any abstract class. We don't even define its destructor because this
-// type should never be used in a way that requires it.
-struct AlignmentCalcImplBase {
- virtual ~AlignmentCalcImplBase() = 0;
-};
-
-// When we have an abstract class type, specialize the alignment computation
-// engine to create another abstract class that derives from both an empty
-// abstract base class and the provided type. This has the same effect as the
-// above except that it handles the fact that we can't actually create a member
-// of type T.
-template <typename T>
-struct AlignmentCalcImpl<T, true> : AlignmentCalcImplBase, T {
- ~AlignmentCalcImpl() override = 0;
-};
-
-} // End detail namespace.
-
-/// AlignOf - A templated class that contains an enum value representing
-/// the alignment of the template argument. For example,
-/// AlignOf<int>::Alignment represents the alignment of type "int". The
-/// alignment calculated is the minimum alignment, and not necessarily
-/// the "desired" alignment returned by GCC's __alignof__ (for example). Note
-/// that because the alignment is an enum value, it can be used as a
-/// compile-time constant (e.g., for template instantiation).
-template <typename T>
-struct AlignOf {
-#ifndef _MSC_VER
- // Avoid warnings from GCC like:
- // comparison between 'enum llvm::AlignOf<X>::<anonymous>' and 'enum
- // llvm::AlignOf<Y>::<anonymous>' [-Wenum-compare]
- // by using constexpr instead of enum.
- // (except on MSVC, since it doesn't support constexpr yet).
- static constexpr unsigned Alignment = static_cast<unsigned int>(
- sizeof(detail::AlignmentCalcImpl<T>) - sizeof(T));
-#else
- enum {
- Alignment = static_cast<unsigned int>(
- sizeof(::llvm::detail::AlignmentCalcImpl<T>) - sizeof(T))
- };
-#endif
- enum { Alignment_GreaterEqual_2Bytes = Alignment >= 2 ? 1 : 0 };
- enum { Alignment_GreaterEqual_4Bytes = Alignment >= 4 ? 1 : 0 };
- enum { Alignment_GreaterEqual_8Bytes = Alignment >= 8 ? 1 : 0 };
- enum { Alignment_GreaterEqual_16Bytes = Alignment >= 16 ? 1 : 0 };
-
- enum { Alignment_LessEqual_2Bytes = Alignment <= 2 ? 1 : 0 };
- enum { Alignment_LessEqual_4Bytes = Alignment <= 4 ? 1 : 0 };
- enum { Alignment_LessEqual_8Bytes = Alignment <= 8 ? 1 : 0 };
- enum { Alignment_LessEqual_16Bytes = Alignment <= 16 ? 1 : 0 };
-};
-
-#ifndef _MSC_VER
-template <typename T> constexpr unsigned AlignOf<T>::Alignment;
-#endif
-
-/// alignOf - A templated function that returns the minimum alignment of
-/// of a type. This provides no extra functionality beyond the AlignOf
-/// class besides some cosmetic cleanliness. Example usage:
-/// alignOf<int>() returns the alignment of an int.
-template <typename T>
-inline unsigned alignOf() { return AlignOf<T>::Alignment; }
-
-/// \struct AlignedCharArray
-/// \brief Helper for building an aligned character array type.
-///
-/// This template is used to explicitly build up a collection of aligned
-/// character array types. We have to build these up using a macro and explicit
-/// specialization to cope with old versions of MSVC and GCC where only an
-/// integer literal can be used to specify an alignment constraint. Once built
-/// up here, we can then begin to indirect between these using normal C++
-/// template parameters.
-
-// MSVC requires special handling here.
-#ifndef _MSC_VER
-
-#if __has_feature(cxx_alignas)
-template<std::size_t Alignment, std::size_t Size>
-struct AlignedCharArray {
- alignas(Alignment) char buffer[Size];
-};
-
-#elif defined(__GNUC__) || defined(__IBM_ATTRIBUTES)
-/// \brief Create a type with an aligned char buffer.
-template<std::size_t Alignment, std::size_t Size>
-struct AlignedCharArray;
-
-#define LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(x) \
- template<std::size_t Size> \
- struct AlignedCharArray<x, Size> { \
- __attribute__((aligned(x))) char buffer[Size]; \
- };
-
-LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(1)
-LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(2)
-LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(4)
-LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(8)
-LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(16)
-LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(32)
-LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(64)
-LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(128)
-
-#undef LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT
-
-#else
-# error No supported align as directive.
-#endif
-
-#else // _MSC_VER
-
-/// \brief Create a type with an aligned char buffer.
-template<std::size_t Alignment, std::size_t Size>
-struct AlignedCharArray;
-
-// We provide special variations of this template for the most common
-// alignments because __declspec(align(...)) doesn't actually work when it is
-// a member of a by-value function argument in MSVC, even if the alignment
-// request is something reasonably like 8-byte or 16-byte. Note that we can't
-// even include the declspec with the union that forces the alignment because
-// MSVC warns on the existence of the declspec despite the union member forcing
-// proper alignment.
-
-template<std::size_t Size>
-struct AlignedCharArray<1, Size> {
- union {
- char aligned;
- char buffer[Size];
- };
-};
-
-template<std::size_t Size>
-struct AlignedCharArray<2, Size> {
- union {
- short aligned;
- char buffer[Size];
- };
-};
-
-template<std::size_t Size>
-struct AlignedCharArray<4, Size> {
- union {
- int aligned;
- char buffer[Size];
- };
-};
-
-template<std::size_t Size>
-struct AlignedCharArray<8, Size> {
- union {
- double aligned;
- char buffer[Size];
- };
-};
-
-
-// The rest of these are provided with a __declspec(align(...)) and we simply
-// can't pass them by-value as function arguments on MSVC.
-
-#define LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(x) \
- template<std::size_t Size> \
- struct AlignedCharArray<x, Size> { \
- __declspec(align(x)) char buffer[Size]; \
- };
-
-LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(16)
-LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(32)
-LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(64)
-LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(128)
-
-#undef LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT
-
-#endif // _MSC_VER
-
-namespace detail {
-template <typename T1,
- typename T2 = char, typename T3 = char, typename T4 = char,
- typename T5 = char, typename T6 = char, typename T7 = char,
- typename T8 = char, typename T9 = char, typename T10 = char>
-class AlignerImpl {
- T1 t1; T2 t2; T3 t3; T4 t4; T5 t5; T6 t6; T7 t7; T8 t8; T9 t9; T10 t10;
-
- AlignerImpl() = delete;
-};
-
-template <typename T1,
- typename T2 = char, typename T3 = char, typename T4 = char,
- typename T5 = char, typename T6 = char, typename T7 = char,
- typename T8 = char, typename T9 = char, typename T10 = char>
-union SizerImpl {
- char arr1[sizeof(T1)], arr2[sizeof(T2)], arr3[sizeof(T3)], arr4[sizeof(T4)],
- arr5[sizeof(T5)], arr6[sizeof(T6)], arr7[sizeof(T7)], arr8[sizeof(T8)],
- arr9[sizeof(T9)], arr10[sizeof(T10)];
-};
-} // end namespace detail
-
-/// \brief This union template exposes a suitably aligned and sized character
-/// array member which can hold elements of any of up to ten types.
-///
-/// These types may be arrays, structs, or any other types. The goal is to
-/// expose a char array buffer member which can be used as suitable storage for
-/// a placement new of any of these types. Support for more than ten types can
-/// be added at the cost of more boilerplate.
-template <typename T1,
- typename T2 = char, typename T3 = char, typename T4 = char,
- typename T5 = char, typename T6 = char, typename T7 = char,
- typename T8 = char, typename T9 = char, typename T10 = char>
-struct AlignedCharArrayUnion : llvm::AlignedCharArray<
- AlignOf<llvm::detail::AlignerImpl<T1, T2, T3, T4, T5,
- T6, T7, T8, T9, T10> >::Alignment,
- sizeof(::llvm::detail::SizerImpl<T1, T2, T3, T4, T5,
- T6, T7, T8, T9, T10>)> {
-};
-} // end namespace llvm
-
-#endif // LLVM_SUPPORT_ALIGNOF_H
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/ArrayRef.h b/third_party/ntcore_2017/wpiutil/include/llvm/ArrayRef.h
deleted file mode 100644
index 4e7cd1a..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/ArrayRef.h
+++ /dev/null
@@ -1,397 +0,0 @@
-//===--- ArrayRef.h - Array Reference Wrapper -------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_ARRAYREF_H
-#define LLVM_ADT_ARRAYREF_H
-
-#include "llvm/Compiler.h"
-#include "llvm/Hashing.h"
-#include "llvm/None.h"
-#include "llvm/SmallVector.h"
-#include <vector>
-
-namespace llvm {
- /// ArrayRef - Represent a constant reference to an array (0 or more elements
- /// consecutively in memory), i.e. a start pointer and a length. It allows
- /// various APIs to take consecutive elements easily and conveniently.
- ///
- /// This class does not own the underlying data, it is expected to be used in
- /// situations where the data resides in some other buffer, whose lifetime
- /// extends past that of the ArrayRef. For this reason, it is not in general
- /// safe to store an ArrayRef.
- ///
- /// This is intended to be trivially copyable, so it should be passed by
- /// value.
- template<typename T>
- class ArrayRef {
- public:
- typedef const T *iterator;
- typedef const T *const_iterator;
- typedef size_t size_type;
-
- typedef std::reverse_iterator<iterator> reverse_iterator;
-
- private:
- /// The start of the array, in an external buffer.
- const T *Data;
-
- /// The number of elements.
- size_type Length;
-
- public:
- /// @name Constructors
- /// @{
-
- /// Construct an empty ArrayRef.
- /*implicit*/ ArrayRef() : Data(nullptr), Length(0) {}
-
- /// Construct an empty ArrayRef from None.
- /*implicit*/ ArrayRef(NoneType) : Data(nullptr), Length(0) {}
-
- /// Construct an ArrayRef from a single element.
- /*implicit*/ ArrayRef(const T &OneElt)
- : Data(&OneElt), Length(1) {}
-
- /// Construct an ArrayRef from a pointer and length.
- /*implicit*/ ArrayRef(const T *data, size_t length)
- : Data(data), Length(length) {}
-
- /// Construct an ArrayRef from a range.
- ArrayRef(const T *begin, const T *end)
- : Data(begin), Length(end - begin) {}
-
- /// Construct an ArrayRef from a SmallVector. This is templated in order to
- /// avoid instantiating SmallVectorTemplateCommon<T> whenever we
- /// copy-construct an ArrayRef.
- template<typename U>
- /*implicit*/ ArrayRef(const SmallVectorTemplateCommon<T, U> &Vec)
- : Data(Vec.data()), Length(Vec.size()) {
- }
-
- /// Construct an ArrayRef from a std::vector.
- template<typename A>
- /*implicit*/ ArrayRef(const std::vector<T, A> &Vec)
- : Data(Vec.data()), Length(Vec.size()) {}
-
- /// Construct an ArrayRef from a C array.
- template <size_t N>
- /*implicit*/ LLVM_CONSTEXPR ArrayRef(const T (&Arr)[N])
- : Data(Arr), Length(N) {}
-
- /// Construct an ArrayRef from a std::initializer_list.
- /*implicit*/ ArrayRef(const std::initializer_list<T> &Vec)
- : Data(Vec.begin() == Vec.end() ? (T*)nullptr : Vec.begin()),
- Length(Vec.size()) {}
-
- /// Construct an ArrayRef<const T*> from ArrayRef<T*>. This uses SFINAE to
- /// ensure that only ArrayRefs of pointers can be converted.
- template <typename U>
- ArrayRef(
- const ArrayRef<U *> &A,
- typename std::enable_if<
- std::is_convertible<U *const *, T const *>::value>::type * = nullptr)
- : Data(A.data()), Length(A.size()) {}
-
- /// Construct an ArrayRef<const T*> from a SmallVector<T*>. This is
- /// templated in order to avoid instantiating SmallVectorTemplateCommon<T>
- /// whenever we copy-construct an ArrayRef.
- template<typename U, typename DummyT>
- /*implicit*/ ArrayRef(
- const SmallVectorTemplateCommon<U *, DummyT> &Vec,
- typename std::enable_if<
- std::is_convertible<U *const *, T const *>::value>::type * = nullptr)
- : Data(Vec.data()), Length(Vec.size()) {
- }
-
- /// Construct an ArrayRef<const T*> from std::vector<T*>. This uses SFINAE
- /// to ensure that only vectors of pointers can be converted.
- template<typename U, typename A>
- ArrayRef(const std::vector<U *, A> &Vec,
- typename std::enable_if<
- std::is_convertible<U *const *, T const *>::value>::type* = 0)
- : Data(Vec.data()), Length(Vec.size()) {}
-
- /// @}
- /// @name Simple Operations
- /// @{
-
- iterator begin() const { return Data; }
- iterator end() const { return Data + Length; }
-
- reverse_iterator rbegin() const { return reverse_iterator(end()); }
- reverse_iterator rend() const { return reverse_iterator(begin()); }
-
- /// empty - Check if the array is empty.
- bool empty() const { return Length == 0; }
-
- const T *data() const { return Data; }
-
- /// size - Get the array size.
- size_t size() const { return Length; }
-
- /// front - Get the first element.
- const T &front() const {
- assert(!empty());
- return Data[0];
- }
-
- /// back - Get the last element.
- const T &back() const {
- assert(!empty());
- return Data[Length-1];
- }
-
- // copy - Allocate copy in Allocator and return ArrayRef<T> to it.
- template <typename Allocator> ArrayRef<T> copy(Allocator &A) {
- T *Buff = A.template Allocate<T>(Length);
- std::uninitialized_copy(begin(), end(), Buff);
- return ArrayRef<T>(Buff, Length);
- }
-
- /// equals - Check for element-wise equality.
- bool equals(ArrayRef RHS) const {
- if (Length != RHS.Length)
- return false;
- return std::equal(begin(), end(), RHS.begin());
- }
-
- /// slice(n) - Chop off the first N elements of the array.
- ArrayRef<T> slice(size_t N) const {
- assert(N <= size() && "Invalid specifier");
- return ArrayRef<T>(data()+N, size()-N);
- }
-
- /// slice(n, m) - Chop off the first N elements of the array, and keep M
- /// elements in the array.
- ArrayRef<T> slice(size_t N, size_t M) const {
- assert(N+M <= size() && "Invalid specifier");
- return ArrayRef<T>(data()+N, M);
- }
-
- /// \brief Drop the first \p N elements of the array.
- ArrayRef<T> drop_front(size_t N = 1) const {
- assert(size() >= N && "Dropping more elements than exist");
- return slice(N, size() - N);
- }
-
- /// \brief Drop the last \p N elements of the array.
- ArrayRef<T> drop_back(size_t N = 1) const {
- assert(size() >= N && "Dropping more elements than exist");
- return slice(0, size() - N);
- }
-
- /// @}
- /// @name Operator Overloads
- /// @{
- const T &operator[](size_t Index) const {
- assert(Index < Length && "Invalid index!");
- return Data[Index];
- }
-
- /// @}
- /// @name Expensive Operations
- /// @{
- std::vector<T> vec() const {
- return std::vector<T>(Data, Data+Length);
- }
-
- /// @}
- /// @name Conversion operators
- /// @{
- operator std::vector<T>() const {
- return std::vector<T>(Data, Data+Length);
- }
-
- /// @}
- };
-
- /// MutableArrayRef - Represent a mutable reference to an array (0 or more
- /// elements consecutively in memory), i.e. a start pointer and a length. It
- /// allows various APIs to take and modify consecutive elements easily and
- /// conveniently.
- ///
- /// This class does not own the underlying data, it is expected to be used in
- /// situations where the data resides in some other buffer, whose lifetime
- /// extends past that of the MutableArrayRef. For this reason, it is not in
- /// general safe to store a MutableArrayRef.
- ///
- /// This is intended to be trivially copyable, so it should be passed by
- /// value.
- template<typename T>
- class MutableArrayRef : public ArrayRef<T> {
- public:
- typedef T *iterator;
-
- typedef std::reverse_iterator<iterator> reverse_iterator;
-
- /// Construct an empty MutableArrayRef.
- /*implicit*/ MutableArrayRef() : ArrayRef<T>() {}
-
- /// Construct an empty MutableArrayRef from None.
- /*implicit*/ MutableArrayRef(NoneType) : ArrayRef<T>() {}
-
- /// Construct an MutableArrayRef from a single element.
- /*implicit*/ MutableArrayRef(T &OneElt) : ArrayRef<T>(OneElt) {}
-
- /// Construct an MutableArrayRef from a pointer and length.
- /*implicit*/ MutableArrayRef(T *data, size_t length)
- : ArrayRef<T>(data, length) {}
-
- /// Construct an MutableArrayRef from a range.
- MutableArrayRef(T *begin, T *end) : ArrayRef<T>(begin, end) {}
-
- /// Construct an MutableArrayRef from a SmallVector.
- /*implicit*/ MutableArrayRef(SmallVectorImpl<T> &Vec)
- : ArrayRef<T>(Vec) {}
-
- /// Construct a MutableArrayRef from a std::vector.
- /*implicit*/ MutableArrayRef(std::vector<T> &Vec)
- : ArrayRef<T>(Vec) {}
-
- /// Construct an MutableArrayRef from a C array.
- template <size_t N>
- /*implicit*/ LLVM_CONSTEXPR MutableArrayRef(T (&Arr)[N])
- : ArrayRef<T>(Arr) {}
-
- T *data() const { return const_cast<T*>(ArrayRef<T>::data()); }
-
- iterator begin() const { return data(); }
- iterator end() const { return data() + this->size(); }
-
- reverse_iterator rbegin() const { return reverse_iterator(end()); }
- reverse_iterator rend() const { return reverse_iterator(begin()); }
-
- /// front - Get the first element.
- T &front() const {
- assert(!this->empty());
- return data()[0];
- }
-
- /// back - Get the last element.
- T &back() const {
- assert(!this->empty());
- return data()[this->size()-1];
- }
-
- /// slice(n) - Chop off the first N elements of the array.
- MutableArrayRef<T> slice(size_t N) const {
- assert(N <= this->size() && "Invalid specifier");
- return MutableArrayRef<T>(data()+N, this->size()-N);
- }
-
- /// slice(n, m) - Chop off the first N elements of the array, and keep M
- /// elements in the array.
- MutableArrayRef<T> slice(size_t N, size_t M) const {
- assert(N+M <= this->size() && "Invalid specifier");
- return MutableArrayRef<T>(data()+N, M);
- }
-
- /// \brief Drop the first \p N elements of the array.
- MutableArrayRef<T> drop_front(size_t N = 1) const {
- assert(this->size() >= N && "Dropping more elements than exist");
- return slice(N, this->size() - N);
- }
-
- MutableArrayRef<T> drop_back(size_t N = 1) const {
- assert(this->size() >= N && "Dropping more elements than exist");
- return slice(0, this->size() - N);
- }
-
- /// @}
- /// @name Operator Overloads
- /// @{
- T &operator[](size_t Index) const {
- assert(Index < this->size() && "Invalid index!");
- return data()[Index];
- }
- };
-
- /// @name ArrayRef Convenience constructors
- /// @{
-
- /// Construct an ArrayRef from a single element.
- template<typename T>
- ArrayRef<T> makeArrayRef(const T &OneElt) {
- return OneElt;
- }
-
- /// Construct an ArrayRef from a pointer and length.
- template<typename T>
- ArrayRef<T> makeArrayRef(const T *data, size_t length) {
- return ArrayRef<T>(data, length);
- }
-
- /// Construct an ArrayRef from a range.
- template<typename T>
- ArrayRef<T> makeArrayRef(const T *begin, const T *end) {
- return ArrayRef<T>(begin, end);
- }
-
- /// Construct an ArrayRef from a SmallVector.
- template <typename T>
- ArrayRef<T> makeArrayRef(const SmallVectorImpl<T> &Vec) {
- return Vec;
- }
-
- /// Construct an ArrayRef from a SmallVector.
- template <typename T, unsigned N>
- ArrayRef<T> makeArrayRef(const SmallVector<T, N> &Vec) {
- return Vec;
- }
-
- /// Construct an ArrayRef from a std::vector.
- template<typename T>
- ArrayRef<T> makeArrayRef(const std::vector<T> &Vec) {
- return Vec;
- }
-
- /// Construct an ArrayRef from an ArrayRef (no-op) (const)
- template <typename T> ArrayRef<T> makeArrayRef(const ArrayRef<T> &Vec) {
- return Vec;
- }
-
- /// Construct an ArrayRef from an ArrayRef (no-op)
- template <typename T> ArrayRef<T> &makeArrayRef(ArrayRef<T> &Vec) {
- return Vec;
- }
-
- /// Construct an ArrayRef from a C array.
- template<typename T, size_t N>
- ArrayRef<T> makeArrayRef(const T (&Arr)[N]) {
- return ArrayRef<T>(Arr);
- }
-
- /// @}
- /// @name ArrayRef Comparison Operators
- /// @{
-
- template<typename T>
- inline bool operator==(ArrayRef<T> LHS, ArrayRef<T> RHS) {
- return LHS.equals(RHS);
- }
-
- template<typename T>
- inline bool operator!=(ArrayRef<T> LHS, ArrayRef<T> RHS) {
- return !(LHS == RHS);
- }
-
- /// @}
-
- // ArrayRefs can be treated like a POD type.
- template <typename T> struct isPodLike;
- template <typename T> struct isPodLike<ArrayRef<T> > {
- static const bool value = true;
- };
-
- template <typename T> hash_code hash_value(ArrayRef<T> S) {
- return hash_combine_range(S.begin(), S.end());
- }
-} // end namespace llvm
-
-#endif // LLVM_ADT_ARRAYREF_H
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/Compiler.h b/third_party/ntcore_2017/wpiutil/include/llvm/Compiler.h
deleted file mode 100644
index b7add94..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/Compiler.h
+++ /dev/null
@@ -1,92 +0,0 @@
-//===-- llvm/Support/Compiler.h - Compiler abstraction support --*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines several macros, based on the current compiler. This allows
-// use of compiler-specific features in a way that remains portable.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_COMPILER_H
-#define LLVM_SUPPORT_COMPILER_H
-
-#ifndef __has_feature
-# define __has_feature(x) 0
-#endif
-
-#ifndef __has_extension
-# define __has_extension(x) 0
-#endif
-
-#ifndef __has_attribute
-# define __has_attribute(x) 0
-#endif
-
-#ifndef __has_builtin
-# define __has_builtin(x) 0
-#endif
-
-/// \macro LLVM_GNUC_PREREQ
-/// \brief Extend the default __GNUC_PREREQ even if glibc's features.h isn't
-/// available.
-#ifndef LLVM_GNUC_PREREQ
-# if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
-# define LLVM_GNUC_PREREQ(maj, min, patch) \
- ((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) + __GNUC_PATCHLEVEL__ >= \
- ((maj) << 20) + ((min) << 10) + (patch))
-# elif defined(__GNUC__) && defined(__GNUC_MINOR__)
-# define LLVM_GNUC_PREREQ(maj, min, patch) \
- ((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) >= ((maj) << 20) + ((min) << 10))
-# else
-# define LLVM_GNUC_PREREQ(maj, min, patch) 0
-# endif
-#endif
-
-#ifndef LLVM_CONSTEXPR
-# ifdef _MSC_VER
-# if _MSC_VER >= 1900
-# define LLVM_CONSTEXPR constexpr
-# else
-# define LLVM_CONSTEXPR
-# endif
-# elif defined(__has_feature)
-# if __has_feature(cxx_constexpr)
-# define LLVM_CONSTEXPR constexpr
-# else
-# define LLVM_CONSTEXPR
-# endif
-# elif defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define LLVM_CONSTEXPR constexpr
-# elif defined(__has_constexpr)
-# define LLVM_CONSTEXPR constexpr
-# else
-# define LLVM_CONSTEXPR
-# endif
-#endif
-
-#ifndef LLVM_ATTRIBUTE_UNUSED_RESULT
-#if __has_attribute(warn_unused_result) || LLVM_GNUC_PREREQ(3, 4, 0)
-#define LLVM_ATTRIBUTE_UNUSED_RESULT __attribute__((__warn_unused_result__))
-#elif defined(_MSC_VER)
-#define LLVM_ATTRIBUTE_UNUSED_RESULT _Check_return_
-#else
-#define LLVM_ATTRIBUTE_UNUSED_RESULT
-#endif
-#endif
-
-#ifndef LLVM_UNLIKELY
-#if __has_builtin(__builtin_expect) || LLVM_GNUC_PREREQ(4, 0, 0)
-#define LLVM_LIKELY(EXPR) __builtin_expect((bool)(EXPR), true)
-#define LLVM_UNLIKELY(EXPR) __builtin_expect((bool)(EXPR), false)
-#else
-#define LLVM_LIKELY(EXPR) (EXPR)
-#define LLVM_UNLIKELY(EXPR) (EXPR)
-#endif
-#endif
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/ConvertUTF.h b/third_party/ntcore_2017/wpiutil/include/llvm/ConvertUTF.h
deleted file mode 100644
index 5b02533..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/ConvertUTF.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/*===--- ConvertUTF.h - Universal Character Names conversions ---------------===
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is distributed under the University of Illinois Open Source
- * License. See LICENSE.TXT for details.
- *
- *==------------------------------------------------------------------------==*/
-/*
- * Copyright 2001-2004 Unicode, Inc.
- *
- * Disclaimer
- *
- * This source code is provided as is by Unicode, Inc. No claims are
- * made as to fitness for any particular purpose. No warranties of any
- * kind are expressed or implied. The recipient agrees to determine
- * applicability of information provided. If this file has been
- * purchased on magnetic or optical media from Unicode, Inc., the
- * sole remedy for any claim will be exchange of defective media
- * within 90 days of receipt.
- *
- * Limitations on Rights to Redistribute This Code
- *
- * Unicode, Inc. hereby grants the right to freely use the information
- * supplied in this file in the creation of products supporting the
- * Unicode Standard, and to make copies of this file in any form
- * for internal or external distribution as long as this notice
- * remains attached.
- */
-
-/* ---------------------------------------------------------------------
-
- Conversions between UTF32, UTF-16, and UTF-8. Header file.
-
- Several funtions are included here, forming a complete set of
- conversions between the three formats. UTF-7 is not included
- here, but is handled in a separate source file.
-
- Each of these routines takes pointers to input buffers and output
- buffers. The input buffers are const.
-
- Each routine converts the text between *sourceStart and sourceEnd,
- putting the result into the buffer between *targetStart and
- targetEnd. Note: the end pointers are *after* the last item: e.g.
- *(sourceEnd - 1) is the last item.
-
- The return result indicates whether the conversion was successful,
- and if not, whether the problem was in the source or target buffers.
- (Only the first encountered problem is indicated.)
-
- After the conversion, *sourceStart and *targetStart are both
- updated to point to the end of last text successfully converted in
- the respective buffers.
-
- Input parameters:
- sourceStart - pointer to a pointer to the source buffer.
- The contents of this are modified on return so that
- it points at the next thing to be converted.
- targetStart - similarly, pointer to pointer to the target buffer.
- sourceEnd, targetEnd - respectively pointers to the ends of the
- two buffers, for overflow checking only.
-
- These conversion functions take a ConversionFlags argument. When this
- flag is set to strict, both irregular sequences and isolated surrogates
- will cause an error. When the flag is set to lenient, both irregular
- sequences and isolated surrogates are converted.
-
- Whether the flag is strict or lenient, all illegal sequences will cause
- an error return. This includes sequences such as: <F4 90 80 80>, <C0 80>,
- or <A0> in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code
- must check for illegal sequences.
-
- When the flag is set to lenient, characters over 0x10FFFF are converted
- to the replacement character; otherwise (when the flag is set to strict)
- they constitute an error.
-
- Output parameters:
- The value "sourceIllegal" is returned from some routines if the input
- sequence is malformed. When "sourceIllegal" is returned, the source
- value will point to the illegal value that caused the problem. E.g.,
- in UTF-8 when a sequence is malformed, it points to the start of the
- malformed sequence.
-
- Author: Mark E. Davis, 1994.
- Rev History: Rick McGowan, fixes & updates May 2001.
- Fixes & updates, Sept 2001.
-
------------------------------------------------------------------------- */
-
-#ifndef LLVM_SUPPORT_CONVERTUTF_H
-#define LLVM_SUPPORT_CONVERTUTF_H
-
-/* ---------------------------------------------------------------------
- The following 4 definitions are compiler-specific.
- The C standard does not guarantee that wchar_t has at least
- 16 bits, so wchar_t is no less portable than unsigned short!
- All should be unsigned values to avoid sign extension during
- bit mask & shift operations.
------------------------------------------------------------------------- */
-
-typedef unsigned int UTF32; /* at least 32 bits */
-typedef unsigned short UTF16; /* at least 16 bits */
-typedef unsigned char UTF8; /* typically 8 bits */
-typedef bool Boolean; /* 0 or 1 */
-
-/* Some fundamental constants */
-#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
-#define UNI_MAX_BMP (UTF32)0x0000FFFF
-#define UNI_MAX_UTF16 (UTF32)0x0010FFFF
-#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
-#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
-
-#define UNI_MAX_UTF8_BYTES_PER_CODE_POINT 4
-
-#define UNI_UTF16_BYTE_ORDER_MARK_NATIVE 0xFEFF
-#define UNI_UTF16_BYTE_ORDER_MARK_SWAPPED 0xFFFE
-
-typedef enum {
- conversionOK, /* conversion successful */
- sourceExhausted, /* partial character in source, but hit end */
- targetExhausted, /* insuff. room in target for conversion */
- sourceIllegal /* source sequence is illegal/malformed */
-} ConversionResult;
-
-typedef enum {
- strictConversion = 0,
- lenientConversion
-} ConversionFlags;
-
-/* This is for C++ and does no harm in C */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-ConversionResult ConvertUTF8toUTF16 (
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
-
-/**
- * Convert a partial UTF8 sequence to UTF32. If the sequence ends in an
- * incomplete code unit sequence, returns \c sourceExhausted.
- */
-ConversionResult ConvertUTF8toUTF32Partial(
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
-
-/**
- * Convert a partial UTF8 sequence to UTF32. If the sequence ends in an
- * incomplete code unit sequence, returns \c sourceIllegal.
- */
-ConversionResult ConvertUTF8toUTF32(
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
-
-ConversionResult ConvertUTF16toUTF8 (
- const UTF16** sourceStart, const UTF16* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
-
-ConversionResult ConvertUTF32toUTF8 (
- const UTF32** sourceStart, const UTF32* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
-
-ConversionResult ConvertUTF16toUTF32 (
- const UTF16** sourceStart, const UTF16* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
-
-ConversionResult ConvertUTF32toUTF16 (
- const UTF32** sourceStart, const UTF32* sourceEnd,
- UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
-
-Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
-
-Boolean isLegalUTF8String(const UTF8 **source, const UTF8 *sourceEnd);
-
-unsigned getNumBytesForUTF8(UTF8 firstByte);
-
-#ifdef __cplusplus
-}
-
-/*************************************************************************/
-/* Below are LLVM-specific wrappers of the functions above. */
-
-#include "llvm/ArrayRef.h"
-#include "llvm/StringRef.h"
-
-namespace llvm {
-
-/**
- * Convert an Unicode code point to UTF8 sequence.
- *
- * \param Source a Unicode code point.
- * \param [in,out] ResultPtr pointer to the output buffer, needs to be at least
- * \c UNI_MAX_UTF8_BYTES_PER_CODE_POINT bytes. On success \c ResultPtr is
- * updated one past end of the converted sequence.
- *
- * \returns true on success.
- */
-bool ConvertCodePointToUTF8(unsigned Source, char *&ResultPtr);
-
-/**
- * Convert the first UTF8 sequence in the given source buffer to a UTF32
- * code point.
- *
- * \param [in,out] source A pointer to the source buffer. If the conversion
- * succeeds, this pointer will be updated to point to the byte just past the
- * end of the converted sequence.
- * \param sourceEnd A pointer just past the end of the source buffer.
- * \param [out] target The converted code
- * \param flags Whether the conversion is strict or lenient.
- *
- * \returns conversionOK on success
- *
- * \sa ConvertUTF8toUTF32
- */
-static inline ConversionResult convertUTF8Sequence(const UTF8 **source,
- const UTF8 *sourceEnd,
- UTF32 *target,
- ConversionFlags flags) {
- if (*source == sourceEnd)
- return sourceExhausted;
- unsigned size = getNumBytesForUTF8(**source);
- if ((ptrdiff_t)size > sourceEnd - *source)
- return sourceExhausted;
- return ConvertUTF8toUTF32(source, *source + size, &target, target + 1, flags);
-}
-
-/**
- * Returns true if a blob of text starts with a UTF-16 big or little endian byte
- * order mark.
- */
-bool hasUTF16ByteOrderMark(ArrayRef<char> SrcBytes);
-
-/**
- * Converts a UTF-16 string into a UTF-8 string.
- *
- * \returns true on success
- */
-bool convertUTF16ToUTF8String(ArrayRef<UTF16> SrcUTF16,
- SmallVectorImpl<char> &DstUTF8);
-
-/**
- * Converts a UTF-8 string into a UTF-16 string with native endianness.
- *
- * \returns true on success
- */
-bool convertUTF8ToUTF16String(StringRef SrcUTF8,
- SmallVectorImpl<UTF16> &DstUTF16);
-
-} /* end namespace llvm */
-
-#endif
-
-/* --------------------------------------------------------------------- */
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/DenseMap.h b/third_party/ntcore_2017/wpiutil/include/llvm/DenseMap.h
deleted file mode 100644
index 6b66d7e..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/DenseMap.h
+++ /dev/null
@@ -1,1120 +0,0 @@
-//===- llvm/ADT/DenseMap.h - Dense probed hash table ------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the DenseMap class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_DENSEMAP_H
-#define LLVM_ADT_DENSEMAP_H
-
-#include "llvm/DenseMapInfo.h"
-#include "llvm/EpochTracker.h"
-#include "llvm/AlignOf.h"
-#include "llvm/Compiler.h"
-#include "llvm/MathExtras.h"
-#include "llvm/PointerLikeTypeTraits.h"
-#include "llvm/type_traits.h"
-#include <algorithm>
-#include <cassert>
-#include <climits>
-#include <cstddef>
-#include <cstring>
-#include <iterator>
-#include <new>
-#include <utility>
-
-namespace llvm {
-
-namespace detail {
-// We extend a pair to allow users to override the bucket type with their own
-// implementation without requiring two members.
-template <typename KeyT, typename ValueT>
-struct DenseMapPair : public std::pair<KeyT, ValueT> {
- KeyT &getFirst() { return std::pair<KeyT, ValueT>::first; }
- const KeyT &getFirst() const { return std::pair<KeyT, ValueT>::first; }
- ValueT &getSecond() { return std::pair<KeyT, ValueT>::second; }
- const ValueT &getSecond() const { return std::pair<KeyT, ValueT>::second; }
-};
-}
-
-template <
- typename KeyT, typename ValueT, typename KeyInfoT = DenseMapInfo<KeyT>,
- typename Bucket = detail::DenseMapPair<KeyT, ValueT>, bool IsConst = false>
-class DenseMapIterator;
-
-template <typename DerivedT, typename KeyT, typename ValueT, typename KeyInfoT,
- typename BucketT>
-class DenseMapBase : public DebugEpochBase {
-public:
- typedef unsigned size_type;
- typedef KeyT key_type;
- typedef ValueT mapped_type;
- typedef BucketT value_type;
-
- typedef DenseMapIterator<KeyT, ValueT, KeyInfoT, BucketT> iterator;
- typedef DenseMapIterator<KeyT, ValueT, KeyInfoT, BucketT, true>
- const_iterator;
- inline iterator begin() {
- // When the map is empty, avoid the overhead of AdvancePastEmptyBuckets().
- return empty() ? end() : iterator(getBuckets(), getBucketsEnd(), *this);
- }
- inline iterator end() {
- return iterator(getBucketsEnd(), getBucketsEnd(), *this, true);
- }
- inline const_iterator begin() const {
- return empty() ? end()
- : const_iterator(getBuckets(), getBucketsEnd(), *this);
- }
- inline const_iterator end() const {
- return const_iterator(getBucketsEnd(), getBucketsEnd(), *this, true);
- }
-
- bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const {
- return getNumEntries() == 0;
- }
- unsigned size() const { return getNumEntries(); }
-
- /// Grow the densemap so that it can contain at least \p NumEntries items
- /// before resizing again.
- void reserve(size_type NumEntries) {
- auto NumBuckets = getMinBucketToReserveForEntries(NumEntries);
- incrementEpoch();
- if (NumBuckets > getNumBuckets())
- grow(NumBuckets);
- }
-
- void clear() {
- incrementEpoch();
- if (getNumEntries() == 0 && getNumTombstones() == 0) return;
-
- // If the capacity of the array is huge, and the # elements used is small,
- // shrink the array.
- if (getNumEntries() * 4 < getNumBuckets() && getNumBuckets() > 64) {
- shrink_and_clear();
- return;
- }
-
- const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey();
- unsigned NumEntries = getNumEntries();
- for (BucketT *P = getBuckets(), *E = getBucketsEnd(); P != E; ++P) {
- if (!KeyInfoT::isEqual(P->getFirst(), EmptyKey)) {
- if (!KeyInfoT::isEqual(P->getFirst(), TombstoneKey)) {
- P->getSecond().~ValueT();
- --NumEntries;
- }
- P->getFirst() = EmptyKey;
- }
- }
- assert(NumEntries == 0 && "Node count imbalance!");
- setNumEntries(0);
- setNumTombstones(0);
- }
-
- /// Return 1 if the specified key is in the map, 0 otherwise.
- size_type count(const KeyT &Val) const {
- const BucketT *TheBucket;
- return LookupBucketFor(Val, TheBucket) ? 1 : 0;
- }
-
- iterator find(const KeyT &Val) {
- BucketT *TheBucket;
- if (LookupBucketFor(Val, TheBucket))
- return iterator(TheBucket, getBucketsEnd(), *this, true);
- return end();
- }
- const_iterator find(const KeyT &Val) const {
- const BucketT *TheBucket;
- if (LookupBucketFor(Val, TheBucket))
- return const_iterator(TheBucket, getBucketsEnd(), *this, true);
- return end();
- }
-
- /// Alternate version of find() which allows a different, and possibly
- /// less expensive, key type.
- /// The DenseMapInfo is responsible for supplying methods
- /// getHashValue(LookupKeyT) and isEqual(LookupKeyT, KeyT) for each key
- /// type used.
- template<class LookupKeyT>
- iterator find_as(const LookupKeyT &Val) {
- BucketT *TheBucket;
- if (LookupBucketFor(Val, TheBucket))
- return iterator(TheBucket, getBucketsEnd(), *this, true);
- return end();
- }
- template<class LookupKeyT>
- const_iterator find_as(const LookupKeyT &Val) const {
- const BucketT *TheBucket;
- if (LookupBucketFor(Val, TheBucket))
- return const_iterator(TheBucket, getBucketsEnd(), *this, true);
- return end();
- }
-
- /// lookup - Return the entry for the specified key, or a default
- /// constructed value if no such entry exists.
- ValueT lookup(const KeyT &Val) const {
- const BucketT *TheBucket;
- if (LookupBucketFor(Val, TheBucket))
- return TheBucket->getSecond();
- return ValueT();
- }
-
- // Inserts key,value pair into the map if the key isn't already in the map.
- // If the key is already in the map, it returns false and doesn't update the
- // value.
- std::pair<iterator, bool> insert(const std::pair<KeyT, ValueT> &KV) {
- BucketT *TheBucket;
- if (LookupBucketFor(KV.first, TheBucket))
- return std::make_pair(iterator(TheBucket, getBucketsEnd(), *this, true),
- false); // Already in map.
-
- // Otherwise, insert the new element.
- TheBucket = InsertIntoBucket(KV.first, KV.second, TheBucket);
- return std::make_pair(iterator(TheBucket, getBucketsEnd(), *this, true),
- true);
- }
-
- // Inserts key,value pair into the map if the key isn't already in the map.
- // If the key is already in the map, it returns false and doesn't update the
- // value.
- std::pair<iterator, bool> insert(std::pair<KeyT, ValueT> &&KV) {
- BucketT *TheBucket;
- if (LookupBucketFor(KV.first, TheBucket))
- return std::make_pair(iterator(TheBucket, getBucketsEnd(), *this, true),
- false); // Already in map.
-
- // Otherwise, insert the new element.
- TheBucket = InsertIntoBucket(std::move(KV.first),
- std::move(KV.second),
- TheBucket);
- return std::make_pair(iterator(TheBucket, getBucketsEnd(), *this, true),
- true);
- }
-
- /// Alternate version of insert() which allows a different, and possibly
- /// less expensive, key type.
- /// The DenseMapInfo is responsible for supplying methods
- /// getHashValue(LookupKeyT) and isEqual(LookupKeyT, KeyT) for each key
- /// type used.
- template <typename LookupKeyT>
- std::pair<iterator, bool> insert_as(std::pair<KeyT, ValueT> &&KV,
- const LookupKeyT &Val) {
- BucketT *TheBucket;
- if (LookupBucketFor(Val, TheBucket))
- return std::make_pair(iterator(TheBucket, getBucketsEnd(), *this, true),
- false); // Already in map.
-
- // Otherwise, insert the new element.
- TheBucket = InsertIntoBucket(std::move(KV.first), std::move(KV.second), Val,
- TheBucket);
- return std::make_pair(iterator(TheBucket, getBucketsEnd(), *this, true),
- true);
- }
-
- /// insert - Range insertion of pairs.
- template<typename InputIt>
- void insert(InputIt I, InputIt E) {
- for (; I != E; ++I)
- insert(*I);
- }
-
-
- bool erase(const KeyT &Val) {
- BucketT *TheBucket;
- if (!LookupBucketFor(Val, TheBucket))
- return false; // not in map.
-
- TheBucket->getSecond().~ValueT();
- TheBucket->getFirst() = getTombstoneKey();
- decrementNumEntries();
- incrementNumTombstones();
- return true;
- }
- void erase(iterator I) {
- BucketT *TheBucket = &*I;
- TheBucket->getSecond().~ValueT();
- TheBucket->getFirst() = getTombstoneKey();
- decrementNumEntries();
- incrementNumTombstones();
- }
-
- value_type& FindAndConstruct(const KeyT &Key) {
- BucketT *TheBucket;
- if (LookupBucketFor(Key, TheBucket))
- return *TheBucket;
-
- return *InsertIntoBucket(Key, ValueT(), TheBucket);
- }
-
- ValueT &operator[](const KeyT &Key) {
- return FindAndConstruct(Key).second;
- }
-
- value_type& FindAndConstruct(KeyT &&Key) {
- BucketT *TheBucket;
- if (LookupBucketFor(Key, TheBucket))
- return *TheBucket;
-
- return *InsertIntoBucket(std::move(Key), ValueT(), TheBucket);
- }
-
- ValueT &operator[](KeyT &&Key) {
- return FindAndConstruct(std::move(Key)).second;
- }
-
- /// isPointerIntoBucketsArray - Return true if the specified pointer points
- /// somewhere into the DenseMap's array of buckets (i.e. either to a key or
- /// value in the DenseMap).
- bool isPointerIntoBucketsArray(const void *Ptr) const {
- return Ptr >= getBuckets() && Ptr < getBucketsEnd();
- }
-
- /// getPointerIntoBucketsArray() - Return an opaque pointer into the buckets
- /// array. In conjunction with the previous method, this can be used to
- /// determine whether an insertion caused the DenseMap to reallocate.
- const void *getPointerIntoBucketsArray() const { return getBuckets(); }
-
-protected:
- DenseMapBase() = default;
-
- void destroyAll() {
- if (getNumBuckets() == 0) // Nothing to do.
- return;
-
- const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey();
- for (BucketT *P = getBuckets(), *E = getBucketsEnd(); P != E; ++P) {
- if (!KeyInfoT::isEqual(P->getFirst(), EmptyKey) &&
- !KeyInfoT::isEqual(P->getFirst(), TombstoneKey))
- P->getSecond().~ValueT();
- P->getFirst().~KeyT();
- }
- }
-
- void initEmpty() {
- setNumEntries(0);
- setNumTombstones(0);
-
- assert((getNumBuckets() & (getNumBuckets()-1)) == 0 &&
- "# initial buckets must be a power of two!");
- const KeyT EmptyKey = getEmptyKey();
- for (BucketT *B = getBuckets(), *E = getBucketsEnd(); B != E; ++B)
- ::new (&B->getFirst()) KeyT(EmptyKey);
- }
-
- /// Returns the number of buckets to allocate to ensure that the DenseMap can
- /// accommodate \p NumEntries without need to grow().
- unsigned getMinBucketToReserveForEntries(unsigned NumEntries) {
- // Ensure that "NumEntries * 4 < NumBuckets * 3"
- if (NumEntries == 0)
- return 0;
- // +1 is required because of the strict equality.
- // For example if NumEntries is 48, we need to return 401.
- return NextPowerOf2(NumEntries * 4 / 3 + 1);
- }
-
- void moveFromOldBuckets(BucketT *OldBucketsBegin, BucketT *OldBucketsEnd) {
- initEmpty();
-
- // Insert all the old elements.
- const KeyT EmptyKey = getEmptyKey();
- const KeyT TombstoneKey = getTombstoneKey();
- for (BucketT *B = OldBucketsBegin, *E = OldBucketsEnd; B != E; ++B) {
- if (!KeyInfoT::isEqual(B->getFirst(), EmptyKey) &&
- !KeyInfoT::isEqual(B->getFirst(), TombstoneKey)) {
- // Insert the key/value into the new table.
- BucketT *DestBucket;
- bool FoundVal = LookupBucketFor(B->getFirst(), DestBucket);
- (void)FoundVal; // silence warning.
- assert(!FoundVal && "Key already in new map?");
- DestBucket->getFirst() = std::move(B->getFirst());
- ::new (&DestBucket->getSecond()) ValueT(std::move(B->getSecond()));
- incrementNumEntries();
-
- // Free the value.
- B->getSecond().~ValueT();
- }
- B->getFirst().~KeyT();
- }
- }
-
- template <typename OtherBaseT>
- void copyFrom(
- const DenseMapBase<OtherBaseT, KeyT, ValueT, KeyInfoT, BucketT> &other) {
- assert(&other != this);
- assert(getNumBuckets() == other.getNumBuckets());
-
- setNumEntries(other.getNumEntries());
- setNumTombstones(other.getNumTombstones());
-
- if (isPodLike<KeyT>::value && isPodLike<ValueT>::value)
- memcpy(getBuckets(), other.getBuckets(),
- getNumBuckets() * sizeof(BucketT));
- else
- for (size_t i = 0; i < getNumBuckets(); ++i) {
- ::new (&getBuckets()[i].getFirst())
- KeyT(other.getBuckets()[i].getFirst());
- if (!KeyInfoT::isEqual(getBuckets()[i].getFirst(), getEmptyKey()) &&
- !KeyInfoT::isEqual(getBuckets()[i].getFirst(), getTombstoneKey()))
- ::new (&getBuckets()[i].getSecond())
- ValueT(other.getBuckets()[i].getSecond());
- }
- }
-
- static unsigned getHashValue(const KeyT &Val) {
- return KeyInfoT::getHashValue(Val);
- }
- template<typename LookupKeyT>
- static unsigned getHashValue(const LookupKeyT &Val) {
- return KeyInfoT::getHashValue(Val);
- }
- static const KeyT getEmptyKey() {
- return KeyInfoT::getEmptyKey();
- }
- static const KeyT getTombstoneKey() {
- return KeyInfoT::getTombstoneKey();
- }
-
-private:
- unsigned getNumEntries() const {
- return static_cast<const DerivedT *>(this)->getNumEntries();
- }
- void setNumEntries(unsigned Num) {
- static_cast<DerivedT *>(this)->setNumEntries(Num);
- }
- void incrementNumEntries() {
- setNumEntries(getNumEntries() + 1);
- }
- void decrementNumEntries() {
- setNumEntries(getNumEntries() - 1);
- }
- unsigned getNumTombstones() const {
- return static_cast<const DerivedT *>(this)->getNumTombstones();
- }
- void setNumTombstones(unsigned Num) {
- static_cast<DerivedT *>(this)->setNumTombstones(Num);
- }
- void incrementNumTombstones() {
- setNumTombstones(getNumTombstones() + 1);
- }
- void decrementNumTombstones() {
- setNumTombstones(getNumTombstones() - 1);
- }
- const BucketT *getBuckets() const {
- return static_cast<const DerivedT *>(this)->getBuckets();
- }
- BucketT *getBuckets() {
- return static_cast<DerivedT *>(this)->getBuckets();
- }
- unsigned getNumBuckets() const {
- return static_cast<const DerivedT *>(this)->getNumBuckets();
- }
- BucketT *getBucketsEnd() {
- return getBuckets() + getNumBuckets();
- }
- const BucketT *getBucketsEnd() const {
- return getBuckets() + getNumBuckets();
- }
-
- void grow(unsigned AtLeast) {
- static_cast<DerivedT *>(this)->grow(AtLeast);
- }
-
- void shrink_and_clear() {
- static_cast<DerivedT *>(this)->shrink_and_clear();
- }
-
-
- BucketT *InsertIntoBucket(const KeyT &Key, const ValueT &Value,
- BucketT *TheBucket) {
- TheBucket = InsertIntoBucketImpl(Key, Key, TheBucket);
-
- TheBucket->getFirst() = Key;
- ::new (&TheBucket->getSecond()) ValueT(Value);
- return TheBucket;
- }
-
- BucketT *InsertIntoBucket(const KeyT &Key, ValueT &&Value,
- BucketT *TheBucket) {
- TheBucket = InsertIntoBucketImpl(Key, Key, TheBucket);
-
- TheBucket->getFirst() = Key;
- ::new (&TheBucket->getSecond()) ValueT(std::move(Value));
- return TheBucket;
- }
-
- BucketT *InsertIntoBucket(KeyT &&Key, ValueT &&Value, BucketT *TheBucket) {
- TheBucket = InsertIntoBucketImpl(Key, Key, TheBucket);
-
- TheBucket->getFirst() = std::move(Key);
- ::new (&TheBucket->getSecond()) ValueT(std::move(Value));
- return TheBucket;
- }
-
- template <typename LookupKeyT>
- BucketT *InsertIntoBucket(KeyT &&Key, ValueT &&Value, LookupKeyT &Lookup,
- BucketT *TheBucket) {
- TheBucket = InsertIntoBucketImpl(Key, Lookup, TheBucket);
-
- TheBucket->getFirst() = std::move(Key);
- ::new (&TheBucket->getSecond()) ValueT(std::move(Value));
- return TheBucket;
- }
-
- template <typename LookupKeyT>
- BucketT *InsertIntoBucketImpl(const KeyT &Key, const LookupKeyT &Lookup,
- BucketT *TheBucket) {
- incrementEpoch();
-
- // If the load of the hash table is more than 3/4, or if fewer than 1/8 of
- // the buckets are empty (meaning that many are filled with tombstones),
- // grow the table.
- //
- // The later case is tricky. For example, if we had one empty bucket with
- // tons of tombstones, failing lookups (e.g. for insertion) would have to
- // probe almost the entire table until it found the empty bucket. If the
- // table completely filled with tombstones, no lookup would ever succeed,
- // causing infinite loops in lookup.
- unsigned NewNumEntries = getNumEntries() + 1;
- unsigned NumBuckets = getNumBuckets();
- if (LLVM_UNLIKELY(NewNumEntries * 4 >= NumBuckets * 3)) {
- this->grow(NumBuckets * 2);
- LookupBucketFor(Lookup, TheBucket);
- NumBuckets = getNumBuckets();
- } else if (LLVM_UNLIKELY(NumBuckets-(NewNumEntries+getNumTombstones()) <=
- NumBuckets/8)) {
- this->grow(NumBuckets);
- LookupBucketFor(Lookup, TheBucket);
- }
- assert(TheBucket);
-
- // Only update the state after we've grown our bucket space appropriately
- // so that when growing buckets we have self-consistent entry count.
- incrementNumEntries();
-
- // If we are writing over a tombstone, remember this.
- const KeyT EmptyKey = getEmptyKey();
- if (!KeyInfoT::isEqual(TheBucket->getFirst(), EmptyKey))
- decrementNumTombstones();
-
- return TheBucket;
- }
-
- /// LookupBucketFor - Lookup the appropriate bucket for Val, returning it in
- /// FoundBucket. If the bucket contains the key and a value, this returns
- /// true, otherwise it returns a bucket with an empty marker or tombstone and
- /// returns false.
- template<typename LookupKeyT>
- bool LookupBucketFor(const LookupKeyT &Val,
- const BucketT *&FoundBucket) const {
- const BucketT *BucketsPtr = getBuckets();
- const unsigned NumBuckets = getNumBuckets();
-
- if (NumBuckets == 0) {
- FoundBucket = nullptr;
- return false;
- }
-
- // FoundTombstone - Keep track of whether we find a tombstone while probing.
- const BucketT *FoundTombstone = nullptr;
- const KeyT EmptyKey = getEmptyKey();
- const KeyT TombstoneKey = getTombstoneKey();
- assert(!KeyInfoT::isEqual(Val, EmptyKey) &&
- !KeyInfoT::isEqual(Val, TombstoneKey) &&
- "Empty/Tombstone value shouldn't be inserted into map!");
-
- unsigned BucketNo = getHashValue(Val) & (NumBuckets-1);
- unsigned ProbeAmt = 1;
- while (1) {
- const BucketT *ThisBucket = BucketsPtr + BucketNo;
- // Found Val's bucket? If so, return it.
- if (LLVM_LIKELY(KeyInfoT::isEqual(Val, ThisBucket->getFirst()))) {
- FoundBucket = ThisBucket;
- return true;
- }
-
- // If we found an empty bucket, the key doesn't exist in the set.
- // Insert it and return the default value.
- if (LLVM_LIKELY(KeyInfoT::isEqual(ThisBucket->getFirst(), EmptyKey))) {
- // If we've already seen a tombstone while probing, fill it in instead
- // of the empty bucket we eventually probed to.
- FoundBucket = FoundTombstone ? FoundTombstone : ThisBucket;
- return false;
- }
-
- // If this is a tombstone, remember it. If Val ends up not in the map, we
- // prefer to return it than something that would require more probing.
- if (KeyInfoT::isEqual(ThisBucket->getFirst(), TombstoneKey) &&
- !FoundTombstone)
- FoundTombstone = ThisBucket; // Remember the first tombstone found.
-
- // Otherwise, it's a hash collision or a tombstone, continue quadratic
- // probing.
- BucketNo += ProbeAmt++;
- BucketNo &= (NumBuckets-1);
- }
- }
-
- template <typename LookupKeyT>
- bool LookupBucketFor(const LookupKeyT &Val, BucketT *&FoundBucket) {
- const BucketT *ConstFoundBucket;
- bool Result = const_cast<const DenseMapBase *>(this)
- ->LookupBucketFor(Val, ConstFoundBucket);
- FoundBucket = const_cast<BucketT *>(ConstFoundBucket);
- return Result;
- }
-
-public:
- /// Return the approximate size (in bytes) of the actual map.
- /// This is just the raw memory used by DenseMap.
- /// If entries are pointers to objects, the size of the referenced objects
- /// are not included.
- size_t getMemorySize() const {
- return getNumBuckets() * sizeof(BucketT);
- }
-};
-
-template <typename KeyT, typename ValueT,
- typename KeyInfoT = DenseMapInfo<KeyT>,
- typename BucketT = detail::DenseMapPair<KeyT, ValueT>>
-class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
- KeyT, ValueT, KeyInfoT, BucketT> {
- // Lift some types from the dependent base class into this class for
- // simplicity of referring to them.
- typedef DenseMapBase<DenseMap, KeyT, ValueT, KeyInfoT, BucketT> BaseT;
- friend class DenseMapBase<DenseMap, KeyT, ValueT, KeyInfoT, BucketT>;
-
- BucketT *Buckets;
- unsigned NumEntries;
- unsigned NumTombstones;
- unsigned NumBuckets;
-
-public:
- /// Create a DenseMap wth an optional \p InitialReserve that guarantee that
- /// this number of elements can be inserted in the map without grow()
- explicit DenseMap(unsigned InitialReserve = 0) { init(InitialReserve); }
-
- DenseMap(const DenseMap &other) : BaseT() {
- init(0);
- copyFrom(other);
- }
-
- DenseMap(DenseMap &&other) : BaseT() {
- init(0);
- swap(other);
- }
-
- template<typename InputIt>
- DenseMap(const InputIt &I, const InputIt &E) {
- init(std::distance(I, E));
- this->insert(I, E);
- }
-
- ~DenseMap() {
- this->destroyAll();
- operator delete(Buckets);
- }
-
- void swap(DenseMap& RHS) {
- this->incrementEpoch();
- RHS.incrementEpoch();
- std::swap(Buckets, RHS.Buckets);
- std::swap(NumEntries, RHS.NumEntries);
- std::swap(NumTombstones, RHS.NumTombstones);
- std::swap(NumBuckets, RHS.NumBuckets);
- }
-
- DenseMap& operator=(const DenseMap& other) {
- if (&other != this)
- copyFrom(other);
- return *this;
- }
-
- DenseMap& operator=(DenseMap &&other) {
- this->destroyAll();
- operator delete(Buckets);
- init(0);
- swap(other);
- return *this;
- }
-
- void copyFrom(const DenseMap& other) {
- this->destroyAll();
- operator delete(Buckets);
- if (allocateBuckets(other.NumBuckets)) {
- this->BaseT::copyFrom(other);
- } else {
- NumEntries = 0;
- NumTombstones = 0;
- }
- }
-
- void init(unsigned InitNumEntries) {
- auto InitBuckets = BaseT::getMinBucketToReserveForEntries(InitNumEntries);
- if (allocateBuckets(InitBuckets)) {
- this->BaseT::initEmpty();
- } else {
- NumEntries = 0;
- NumTombstones = 0;
- }
- }
-
- void grow(unsigned AtLeast) {
- unsigned OldNumBuckets = NumBuckets;
- BucketT *OldBuckets = Buckets;
-
- allocateBuckets(std::max<unsigned>(64, static_cast<unsigned>(NextPowerOf2(AtLeast-1))));
- assert(Buckets);
- if (!OldBuckets) {
- this->BaseT::initEmpty();
- return;
- }
-
- this->moveFromOldBuckets(OldBuckets, OldBuckets+OldNumBuckets);
-
- // Free the old table.
- operator delete(OldBuckets);
- }
-
- void shrink_and_clear() {
- unsigned OldNumEntries = NumEntries;
- this->destroyAll();
-
- // Reduce the number of buckets.
- unsigned NewNumBuckets = 0;
- if (OldNumEntries)
- NewNumBuckets = std::max(64, 1 << (Log2_32_Ceil(OldNumEntries) + 1));
- if (NewNumBuckets == NumBuckets) {
- this->BaseT::initEmpty();
- return;
- }
-
- operator delete(Buckets);
- init(NewNumBuckets);
- }
-
-private:
- unsigned getNumEntries() const {
- return NumEntries;
- }
- void setNumEntries(unsigned Num) {
- NumEntries = Num;
- }
-
- unsigned getNumTombstones() const {
- return NumTombstones;
- }
- void setNumTombstones(unsigned Num) {
- NumTombstones = Num;
- }
-
- BucketT *getBuckets() const {
- return Buckets;
- }
-
- unsigned getNumBuckets() const {
- return NumBuckets;
- }
-
- bool allocateBuckets(unsigned Num) {
- NumBuckets = Num;
- if (NumBuckets == 0) {
- Buckets = nullptr;
- return false;
- }
-
- Buckets = static_cast<BucketT*>(operator new(sizeof(BucketT) * NumBuckets));
- return true;
- }
-};
-
-template <typename KeyT, typename ValueT, unsigned InlineBuckets = 4,
- typename KeyInfoT = DenseMapInfo<KeyT>,
- typename BucketT = detail::DenseMapPair<KeyT, ValueT>>
-class SmallDenseMap
- : public DenseMapBase<
- SmallDenseMap<KeyT, ValueT, InlineBuckets, KeyInfoT, BucketT>, KeyT,
- ValueT, KeyInfoT, BucketT> {
- // Lift some types from the dependent base class into this class for
- // simplicity of referring to them.
- typedef DenseMapBase<SmallDenseMap, KeyT, ValueT, KeyInfoT, BucketT> BaseT;
- friend class DenseMapBase<SmallDenseMap, KeyT, ValueT, KeyInfoT, BucketT>;
-
- unsigned Small : 1;
- unsigned NumEntries : 31;
- unsigned NumTombstones;
-
- struct LargeRep {
- BucketT *Buckets;
- unsigned NumBuckets;
- };
-
- /// A "union" of an inline bucket array and the struct representing
- /// a large bucket. This union will be discriminated by the 'Small' bit.
- AlignedCharArrayUnion<BucketT[InlineBuckets], LargeRep> storage;
-
-public:
- explicit SmallDenseMap(unsigned NumInitBuckets = 0) {
- init(NumInitBuckets);
- }
-
- SmallDenseMap(const SmallDenseMap &other) : BaseT() {
- init(0);
- copyFrom(other);
- }
-
- SmallDenseMap(SmallDenseMap &&other) : BaseT() {
- init(0);
- swap(other);
- }
-
- template<typename InputIt>
- SmallDenseMap(const InputIt &I, const InputIt &E) {
- init(NextPowerOf2(std::distance(I, E)));
- this->insert(I, E);
- }
-
- ~SmallDenseMap() {
- this->destroyAll();
- deallocateBuckets();
- }
-
- void swap(SmallDenseMap& RHS) {
- unsigned TmpNumEntries = RHS.NumEntries;
- RHS.NumEntries = NumEntries;
- NumEntries = TmpNumEntries;
- std::swap(NumTombstones, RHS.NumTombstones);
-
- const KeyT EmptyKey = this->getEmptyKey();
- const KeyT TombstoneKey = this->getTombstoneKey();
- if (Small && RHS.Small) {
- // If we're swapping inline bucket arrays, we have to cope with some of
- // the tricky bits of DenseMap's storage system: the buckets are not
- // fully initialized. Thus we swap every key, but we may have
- // a one-directional move of the value.
- for (unsigned i = 0, e = InlineBuckets; i != e; ++i) {
- BucketT *LHSB = &getInlineBuckets()[i],
- *RHSB = &RHS.getInlineBuckets()[i];
- bool hasLHSValue = (!KeyInfoT::isEqual(LHSB->getFirst(), EmptyKey) &&
- !KeyInfoT::isEqual(LHSB->getFirst(), TombstoneKey));
- bool hasRHSValue = (!KeyInfoT::isEqual(RHSB->getFirst(), EmptyKey) &&
- !KeyInfoT::isEqual(RHSB->getFirst(), TombstoneKey));
- if (hasLHSValue && hasRHSValue) {
- // Swap together if we can...
- std::swap(*LHSB, *RHSB);
- continue;
- }
- // Swap separately and handle any assymetry.
- std::swap(LHSB->getFirst(), RHSB->getFirst());
- if (hasLHSValue) {
- ::new (&RHSB->getSecond()) ValueT(std::move(LHSB->getSecond()));
- LHSB->getSecond().~ValueT();
- } else if (hasRHSValue) {
- ::new (&LHSB->getSecond()) ValueT(std::move(RHSB->getSecond()));
- RHSB->getSecond().~ValueT();
- }
- }
- return;
- }
- if (!Small && !RHS.Small) {
- std::swap(getLargeRep()->Buckets, RHS.getLargeRep()->Buckets);
- std::swap(getLargeRep()->NumBuckets, RHS.getLargeRep()->NumBuckets);
- return;
- }
-
- SmallDenseMap &SmallSide = Small ? *this : RHS;
- SmallDenseMap &LargeSide = Small ? RHS : *this;
-
- // First stash the large side's rep and move the small side across.
- LargeRep TmpRep = std::move(*LargeSide.getLargeRep());
- LargeSide.getLargeRep()->~LargeRep();
- LargeSide.Small = true;
- // This is similar to the standard move-from-old-buckets, but the bucket
- // count hasn't actually rotated in this case. So we have to carefully
- // move construct the keys and values into their new locations, but there
- // is no need to re-hash things.
- for (unsigned i = 0, e = InlineBuckets; i != e; ++i) {
- BucketT *NewB = &LargeSide.getInlineBuckets()[i],
- *OldB = &SmallSide.getInlineBuckets()[i];
- ::new (&NewB->getFirst()) KeyT(std::move(OldB->getFirst()));
- OldB->getFirst().~KeyT();
- if (!KeyInfoT::isEqual(NewB->getFirst(), EmptyKey) &&
- !KeyInfoT::isEqual(NewB->getFirst(), TombstoneKey)) {
- ::new (&NewB->getSecond()) ValueT(std::move(OldB->getSecond()));
- OldB->getSecond().~ValueT();
- }
- }
-
- // The hard part of moving the small buckets across is done, just move
- // the TmpRep into its new home.
- SmallSide.Small = false;
- new (SmallSide.getLargeRep()) LargeRep(std::move(TmpRep));
- }
-
- SmallDenseMap& operator=(const SmallDenseMap& other) {
- if (&other != this)
- copyFrom(other);
- return *this;
- }
-
- SmallDenseMap& operator=(SmallDenseMap &&other) {
- this->destroyAll();
- deallocateBuckets();
- init(0);
- swap(other);
- return *this;
- }
-
- void copyFrom(const SmallDenseMap& other) {
- this->destroyAll();
- deallocateBuckets();
- Small = true;
- if (other.getNumBuckets() > InlineBuckets) {
- Small = false;
- new (getLargeRep()) LargeRep(allocateBuckets(other.getNumBuckets()));
- }
- this->BaseT::copyFrom(other);
- }
-
- void init(unsigned InitBuckets) {
- Small = true;
- if (InitBuckets > InlineBuckets) {
- Small = false;
- new (getLargeRep()) LargeRep(allocateBuckets(InitBuckets));
- }
- this->BaseT::initEmpty();
- }
-
- void grow(unsigned AtLeast) {
- if (AtLeast >= InlineBuckets)
- AtLeast = std::max<unsigned>(64, NextPowerOf2(AtLeast-1));
-
- if (Small) {
- if (AtLeast < InlineBuckets)
- return; // Nothing to do.
-
- // First move the inline buckets into a temporary storage.
- AlignedCharArrayUnion<BucketT[InlineBuckets]> TmpStorage;
- BucketT *TmpBegin = reinterpret_cast<BucketT *>(TmpStorage.buffer);
- BucketT *TmpEnd = TmpBegin;
-
- // Loop over the buckets, moving non-empty, non-tombstones into the
- // temporary storage. Have the loop move the TmpEnd forward as it goes.
- const KeyT EmptyKey = this->getEmptyKey();
- const KeyT TombstoneKey = this->getTombstoneKey();
- for (BucketT *P = getBuckets(), *E = P + InlineBuckets; P != E; ++P) {
- if (!KeyInfoT::isEqual(P->getFirst(), EmptyKey) &&
- !KeyInfoT::isEqual(P->getFirst(), TombstoneKey)) {
- assert(size_t(TmpEnd - TmpBegin) < InlineBuckets &&
- "Too many inline buckets!");
- ::new (&TmpEnd->getFirst()) KeyT(std::move(P->getFirst()));
- ::new (&TmpEnd->getSecond()) ValueT(std::move(P->getSecond()));
- ++TmpEnd;
- P->getSecond().~ValueT();
- }
- P->getFirst().~KeyT();
- }
-
- // Now make this map use the large rep, and move all the entries back
- // into it.
- Small = false;
- new (getLargeRep()) LargeRep(allocateBuckets(AtLeast));
- this->moveFromOldBuckets(TmpBegin, TmpEnd);
- return;
- }
-
- LargeRep OldRep = std::move(*getLargeRep());
- getLargeRep()->~LargeRep();
- if (AtLeast <= InlineBuckets) {
- Small = true;
- } else {
- new (getLargeRep()) LargeRep(allocateBuckets(AtLeast));
- }
-
- this->moveFromOldBuckets(OldRep.Buckets, OldRep.Buckets+OldRep.NumBuckets);
-
- // Free the old table.
- operator delete(OldRep.Buckets);
- }
-
- void shrink_and_clear() {
- unsigned OldSize = this->size();
- this->destroyAll();
-
- // Reduce the number of buckets.
- unsigned NewNumBuckets = 0;
- if (OldSize) {
- NewNumBuckets = 1 << (Log2_32_Ceil(OldSize) + 1);
- if (NewNumBuckets > InlineBuckets && NewNumBuckets < 64u)
- NewNumBuckets = 64;
- }
- if ((Small && NewNumBuckets <= InlineBuckets) ||
- (!Small && NewNumBuckets == getLargeRep()->NumBuckets)) {
- this->BaseT::initEmpty();
- return;
- }
-
- deallocateBuckets();
- init(NewNumBuckets);
- }
-
-private:
- unsigned getNumEntries() const {
- return NumEntries;
- }
- void setNumEntries(unsigned Num) {
- assert(Num < INT_MAX && "Cannot support more than INT_MAX entries");
- NumEntries = Num;
- }
-
- unsigned getNumTombstones() const {
- return NumTombstones;
- }
- void setNumTombstones(unsigned Num) {
- NumTombstones = Num;
- }
-
- const BucketT *getInlineBuckets() const {
- assert(Small);
- // Note that this cast does not violate aliasing rules as we assert that
- // the memory's dynamic type is the small, inline bucket buffer, and the
- // 'storage.buffer' static type is 'char *'.
- return reinterpret_cast<const BucketT *>(storage.buffer);
- }
- BucketT *getInlineBuckets() {
- return const_cast<BucketT *>(
- const_cast<const SmallDenseMap *>(this)->getInlineBuckets());
- }
- const LargeRep *getLargeRep() const {
- assert(!Small);
- // Note, same rule about aliasing as with getInlineBuckets.
- return reinterpret_cast<const LargeRep *>(storage.buffer);
- }
- LargeRep *getLargeRep() {
- return const_cast<LargeRep *>(
- const_cast<const SmallDenseMap *>(this)->getLargeRep());
- }
-
- const BucketT *getBuckets() const {
- return Small ? getInlineBuckets() : getLargeRep()->Buckets;
- }
- BucketT *getBuckets() {
- return const_cast<BucketT *>(
- const_cast<const SmallDenseMap *>(this)->getBuckets());
- }
- unsigned getNumBuckets() const {
- return Small ? InlineBuckets : getLargeRep()->NumBuckets;
- }
-
- void deallocateBuckets() {
- if (Small)
- return;
-
- operator delete(getLargeRep()->Buckets);
- getLargeRep()->~LargeRep();
- }
-
- LargeRep allocateBuckets(unsigned Num) {
- assert(Num > InlineBuckets && "Must allocate more buckets than are inline");
- LargeRep Rep = {
- static_cast<BucketT*>(operator new(sizeof(BucketT) * Num)), Num
- };
- return Rep;
- }
-};
-
-template <typename KeyT, typename ValueT, typename KeyInfoT, typename Bucket,
- bool IsConst>
-class DenseMapIterator : DebugEpochBase::HandleBase {
- typedef DenseMapIterator<KeyT, ValueT, KeyInfoT, Bucket, true> ConstIterator;
- friend class DenseMapIterator<KeyT, ValueT, KeyInfoT, Bucket, true>;
- friend class DenseMapIterator<KeyT, ValueT, KeyInfoT, Bucket, false>;
-
-public:
- typedef ptrdiff_t difference_type;
- typedef typename std::conditional<IsConst, const Bucket, Bucket>::type
- value_type;
- typedef value_type *pointer;
- typedef value_type &reference;
- typedef std::forward_iterator_tag iterator_category;
-private:
- pointer Ptr, End;
-public:
- DenseMapIterator() : Ptr(nullptr), End(nullptr) {}
-
- DenseMapIterator(pointer Pos, pointer E, const DebugEpochBase &Epoch,
- bool NoAdvance = false)
- : DebugEpochBase::HandleBase(&Epoch), Ptr(Pos), End(E) {
- assert(isHandleInSync() && "invalid construction!");
- if (!NoAdvance) AdvancePastEmptyBuckets();
- }
-
- // Converting ctor from non-const iterators to const iterators. SFINAE'd out
- // for const iterator destinations so it doesn't end up as a user defined copy
- // constructor.
- template <bool IsConstSrc,
- typename = typename std::enable_if<!IsConstSrc && IsConst>::type>
- DenseMapIterator(
- const DenseMapIterator<KeyT, ValueT, KeyInfoT, Bucket, IsConstSrc> &I)
- : DebugEpochBase::HandleBase(I), Ptr(I.Ptr), End(I.End) {}
-
- reference operator*() const {
- assert(isHandleInSync() && "invalid iterator access!");
- return *Ptr;
- }
- pointer operator->() const {
- assert(isHandleInSync() && "invalid iterator access!");
- return Ptr;
- }
-
- bool operator==(const ConstIterator &RHS) const {
- assert((!Ptr || isHandleInSync()) && "handle not in sync!");
- assert((!RHS.Ptr || RHS.isHandleInSync()) && "handle not in sync!");
- assert(getEpochAddress() == RHS.getEpochAddress() &&
- "comparing incomparable iterators!");
- return Ptr == RHS.Ptr;
- }
- bool operator!=(const ConstIterator &RHS) const {
- assert((!Ptr || isHandleInSync()) && "handle not in sync!");
- assert((!RHS.Ptr || RHS.isHandleInSync()) && "handle not in sync!");
- assert(getEpochAddress() == RHS.getEpochAddress() &&
- "comparing incomparable iterators!");
- return Ptr != RHS.Ptr;
- }
-
- inline DenseMapIterator& operator++() { // Preincrement
- assert(isHandleInSync() && "invalid iterator access!");
- ++Ptr;
- AdvancePastEmptyBuckets();
- return *this;
- }
- DenseMapIterator operator++(int) { // Postincrement
- assert(isHandleInSync() && "invalid iterator access!");
- DenseMapIterator tmp = *this; ++*this; return tmp;
- }
-
-private:
- void AdvancePastEmptyBuckets() {
- const KeyT Empty = KeyInfoT::getEmptyKey();
- const KeyT Tombstone = KeyInfoT::getTombstoneKey();
-
- while (Ptr != End && (KeyInfoT::isEqual(Ptr->getFirst(), Empty) ||
- KeyInfoT::isEqual(Ptr->getFirst(), Tombstone)))
- ++Ptr;
- }
-};
-
-template<typename KeyT, typename ValueT, typename KeyInfoT>
-static inline size_t
-capacity_in_bytes(const DenseMap<KeyT, ValueT, KeyInfoT> &X) {
- return X.getMemorySize();
-}
-
-} // end namespace llvm
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/DenseMapInfo.h b/third_party/ntcore_2017/wpiutil/include/llvm/DenseMapInfo.h
deleted file mode 100644
index 65e38cc..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/DenseMapInfo.h
+++ /dev/null
@@ -1,251 +0,0 @@
-//===- llvm/ADT/DenseMapInfo.h - Type traits for DenseMap -------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines DenseMapInfo traits for DenseMap.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_DENSEMAPINFO_H
-#define LLVM_ADT_DENSEMAPINFO_H
-
-#include "llvm/ArrayRef.h"
-#include "llvm/Hashing.h"
-#include "llvm/StringRef.h"
-#include "llvm/PointerLikeTypeTraits.h"
-#include "llvm/type_traits.h"
-
-namespace llvm {
-
-template<typename T>
-struct DenseMapInfo {
- //static inline T getEmptyKey();
- //static inline T getTombstoneKey();
- //static unsigned getHashValue(const T &Val);
- //static bool isEqual(const T &LHS, const T &RHS);
-};
-
-template <typename T> struct CachedHash {
- CachedHash(T Val) : Val(std::move(Val)) {
- Hash = DenseMapInfo<T>::getHashValue(Val);
- }
- CachedHash(T Val, unsigned Hash) : Val(std::move(Val)), Hash(Hash) {}
- T Val;
- unsigned Hash;
-};
-
-// Provide DenseMapInfo for all CachedHash<T>.
-template <typename T> struct DenseMapInfo<CachedHash<T>> {
- static CachedHash<T> getEmptyKey() {
- T N = DenseMapInfo<T>::getEmptyKey();
- return {N, 0};
- }
- static CachedHash<T> getTombstoneKey() {
- T N = DenseMapInfo<T>::getTombstoneKey();
- return {N, 0};
- }
- static unsigned getHashValue(CachedHash<T> Val) {
- assert(!isEqual(Val, getEmptyKey()) && "Cannot hash the empty key!");
- assert(!isEqual(Val, getTombstoneKey()) &&
- "Cannot hash the tombstone key!");
- return Val.Hash;
- }
- static bool isEqual(CachedHash<T> A, CachedHash<T> B) {
- return DenseMapInfo<T>::isEqual(A.Val, B.Val);
- }
-};
-
-// Provide DenseMapInfo for all pointers.
-template<typename T>
-struct DenseMapInfo<T*> {
- static inline T* getEmptyKey() {
- uintptr_t Val = static_cast<uintptr_t>(-1);
- Val <<= PointerLikeTypeTraits<T*>::NumLowBitsAvailable;
- return reinterpret_cast<T*>(Val);
- }
- static inline T* getTombstoneKey() {
- uintptr_t Val = static_cast<uintptr_t>(-2);
- Val <<= PointerLikeTypeTraits<T*>::NumLowBitsAvailable;
- return reinterpret_cast<T*>(Val);
- }
- static unsigned getHashValue(const T *PtrVal) {
- return (unsigned((uintptr_t)PtrVal) >> 4) ^
- (unsigned((uintptr_t)PtrVal) >> 9);
- }
- static bool isEqual(const T *LHS, const T *RHS) { return LHS == RHS; }
-};
-
-// Provide DenseMapInfo for chars.
-template<> struct DenseMapInfo<char> {
- static inline char getEmptyKey() { return ~0; }
- static inline char getTombstoneKey() { return ~0 - 1; }
- static unsigned getHashValue(const char& Val) { return Val * 37U; }
- static bool isEqual(const char &LHS, const char &RHS) {
- return LHS == RHS;
- }
-};
-
-// Provide DenseMapInfo for unsigned ints.
-template<> struct DenseMapInfo<unsigned> {
- static inline unsigned getEmptyKey() { return ~0U; }
- static inline unsigned getTombstoneKey() { return ~0U - 1; }
- static unsigned getHashValue(const unsigned& Val) { return Val * 37U; }
- static bool isEqual(const unsigned& LHS, const unsigned& RHS) {
- return LHS == RHS;
- }
-};
-
-// Provide DenseMapInfo for unsigned longs.
-template<> struct DenseMapInfo<unsigned long> {
- static inline unsigned long getEmptyKey() { return ~0UL; }
- static inline unsigned long getTombstoneKey() { return ~0UL - 1L; }
- static unsigned getHashValue(const unsigned long& Val) {
- return (unsigned)(Val * 37UL);
- }
- static bool isEqual(const unsigned long& LHS, const unsigned long& RHS) {
- return LHS == RHS;
- }
-};
-
-// Provide DenseMapInfo for unsigned long longs.
-template<> struct DenseMapInfo<unsigned long long> {
- static inline unsigned long long getEmptyKey() { return ~0ULL; }
- static inline unsigned long long getTombstoneKey() { return ~0ULL - 1ULL; }
- static unsigned getHashValue(const unsigned long long& Val) {
- return (unsigned)(Val * 37ULL);
- }
- static bool isEqual(const unsigned long long& LHS,
- const unsigned long long& RHS) {
- return LHS == RHS;
- }
-};
-
-// Provide DenseMapInfo for ints.
-template<> struct DenseMapInfo<int> {
- static inline int getEmptyKey() { return 0x7fffffff; }
- static inline int getTombstoneKey() { return -0x7fffffff - 1; }
- static unsigned getHashValue(const int& Val) { return (unsigned)(Val * 37U); }
- static bool isEqual(const int& LHS, const int& RHS) {
- return LHS == RHS;
- }
-};
-
-// Provide DenseMapInfo for longs.
-template<> struct DenseMapInfo<long> {
- static inline long getEmptyKey() {
- return (1UL << (sizeof(long) * 8 - 1)) - 1UL;
- }
- static inline long getTombstoneKey() { return getEmptyKey() - 1L; }
- static unsigned getHashValue(const long& Val) {
- return (unsigned)(Val * 37UL);
- }
- static bool isEqual(const long& LHS, const long& RHS) {
- return LHS == RHS;
- }
-};
-
-// Provide DenseMapInfo for long longs.
-template<> struct DenseMapInfo<long long> {
- static inline long long getEmptyKey() { return 0x7fffffffffffffffLL; }
- static inline long long getTombstoneKey() { return -0x7fffffffffffffffLL-1; }
- static unsigned getHashValue(const long long& Val) {
- return (unsigned)(Val * 37ULL);
- }
- static bool isEqual(const long long& LHS,
- const long long& RHS) {
- return LHS == RHS;
- }
-};
-
-// Provide DenseMapInfo for all pairs whose members have info.
-template<typename T, typename U>
-struct DenseMapInfo<std::pair<T, U> > {
- typedef std::pair<T, U> Pair;
- typedef DenseMapInfo<T> FirstInfo;
- typedef DenseMapInfo<U> SecondInfo;
-
- static inline Pair getEmptyKey() {
- return std::make_pair(FirstInfo::getEmptyKey(),
- SecondInfo::getEmptyKey());
- }
- static inline Pair getTombstoneKey() {
- return std::make_pair(FirstInfo::getTombstoneKey(),
- SecondInfo::getTombstoneKey());
- }
- static unsigned getHashValue(const Pair& PairVal) {
- uint64_t key = (uint64_t)FirstInfo::getHashValue(PairVal.first) << 32
- | (uint64_t)SecondInfo::getHashValue(PairVal.second);
- key += ~(key << 32);
- key ^= (key >> 22);
- key += ~(key << 13);
- key ^= (key >> 8);
- key += (key << 3);
- key ^= (key >> 15);
- key += ~(key << 27);
- key ^= (key >> 31);
- return (unsigned)key;
- }
- static bool isEqual(const Pair &LHS, const Pair &RHS) {
- return FirstInfo::isEqual(LHS.first, RHS.first) &&
- SecondInfo::isEqual(LHS.second, RHS.second);
- }
-};
-
-// Provide DenseMapInfo for StringRefs.
-template <> struct DenseMapInfo<StringRef> {
- static inline StringRef getEmptyKey() {
- return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(0)),
- 0);
- }
- static inline StringRef getTombstoneKey() {
- return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(1)),
- 0);
- }
- static unsigned getHashValue(StringRef Val) {
- assert(Val.data() != getEmptyKey().data() && "Cannot hash the empty key!");
- assert(Val.data() != getTombstoneKey().data() &&
- "Cannot hash the tombstone key!");
- return (unsigned)(hash_value(Val));
- }
- static bool isEqual(StringRef LHS, StringRef RHS) {
- if (RHS.data() == getEmptyKey().data())
- return LHS.data() == getEmptyKey().data();
- if (RHS.data() == getTombstoneKey().data())
- return LHS.data() == getTombstoneKey().data();
- return LHS == RHS;
- }
-};
-
-// Provide DenseMapInfo for ArrayRefs.
-template <typename T> struct DenseMapInfo<ArrayRef<T>> {
- static inline ArrayRef<T> getEmptyKey() {
- return ArrayRef<T>(reinterpret_cast<const T *>(~static_cast<uintptr_t>(0)),
- size_t(0));
- }
- static inline ArrayRef<T> getTombstoneKey() {
- return ArrayRef<T>(reinterpret_cast<const T *>(~static_cast<uintptr_t>(1)),
- size_t(0));
- }
- static unsigned getHashValue(ArrayRef<T> Val) {
- assert(Val.data() != getEmptyKey().data() && "Cannot hash the empty key!");
- assert(Val.data() != getTombstoneKey().data() &&
- "Cannot hash the tombstone key!");
- return (unsigned)(hash_value(Val));
- }
- static bool isEqual(ArrayRef<T> LHS, ArrayRef<T> RHS) {
- if (RHS.data() == getEmptyKey().data())
- return LHS.data() == getEmptyKey().data();
- if (RHS.data() == getTombstoneKey().data())
- return LHS.data() == getTombstoneKey().data();
- return LHS == RHS;
- }
-};
-
-} // end namespace llvm
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/EpochTracker.h b/third_party/ntcore_2017/wpiutil/include/llvm/EpochTracker.h
deleted file mode 100644
index f589136..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/EpochTracker.h
+++ /dev/null
@@ -1,97 +0,0 @@
-//===- llvm/ADT/EpochTracker.h - ADT epoch tracking --------------*- C++ -*-==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the DebugEpochBase and DebugEpochBase::HandleBase classes.
-// These can be used to write iterators that are fail-fast when LLVM is built
-// with asserts enabled.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_EPOCH_TRACKER_H
-#define LLVM_ADT_EPOCH_TRACKER_H
-
-#include <cstdint>
-
-namespace llvm {
-
-#ifdef NDEBUG //ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS
-
-class DebugEpochBase {
-public:
- void incrementEpoch() {}
-
- class HandleBase {
- public:
- HandleBase() = default;
- explicit HandleBase(const DebugEpochBase *) {}
- bool isHandleInSync() const { return true; }
- const void *getEpochAddress() const { return nullptr; }
- };
-};
-
-#else
-
-/// \brief A base class for data structure classes wishing to make iterators
-/// ("handles") pointing into themselves fail-fast. When building without
-/// asserts, this class is empty and does nothing.
-///
-/// DebugEpochBase does not by itself track handles pointing into itself. The
-/// expectation is that routines touching the handles will poll on
-/// isHandleInSync at appropriate points to assert that the handle they're using
-/// is still valid.
-///
-class DebugEpochBase {
- uint64_t Epoch;
-
-public:
- DebugEpochBase() : Epoch(0) {}
-
- /// \brief Calling incrementEpoch invalidates all handles pointing into the
- /// calling instance.
- void incrementEpoch() { ++Epoch; }
-
- /// \brief The destructor calls incrementEpoch to make use-after-free bugs
- /// more likely to crash deterministically.
- ~DebugEpochBase() { incrementEpoch(); }
-
- /// \brief A base class for iterator classes ("handles") that wish to poll for
- /// iterator invalidating modifications in the underlying data structure.
- /// When LLVM is built without asserts, this class is empty and does nothing.
- ///
- /// HandleBase does not track the parent data structure by itself. It expects
- /// the routines modifying the data structure to call incrementEpoch when they
- /// make an iterator-invalidating modification.
- ///
- class HandleBase {
- const uint64_t *EpochAddress;
- uint64_t EpochAtCreation;
-
- public:
- HandleBase() : EpochAddress(nullptr), EpochAtCreation(UINT64_MAX) {}
-
- explicit HandleBase(const DebugEpochBase *Parent)
- : EpochAddress(&Parent->Epoch), EpochAtCreation(Parent->Epoch) {}
-
- /// \brief Returns true if the DebugEpochBase this Handle is linked to has
- /// not called incrementEpoch on itself since the creation of this
- /// HandleBase instance.
- bool isHandleInSync() const { return *EpochAddress == EpochAtCreation; }
-
- /// \brief Returns a pointer to the epoch word stored in the data structure
- /// this handle points into. Can be used to check if two iterators point
- /// into the same data structure.
- const void *getEpochAddress() const { return EpochAddress; }
- };
-};
-
-#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS
-
-} // namespace llvm
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/Format.h b/third_party/ntcore_2017/wpiutil/include/llvm/Format.h
deleted file mode 100644
index 5138dec..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/Format.h
+++ /dev/null
@@ -1,202 +0,0 @@
-//===- Format.h - Efficient printf-style formatting for streams -*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the format() function, which can be used with other
-// LLVM subsystems to provide printf-style formatting. This gives all the power
-// and risk of printf. This can be used like this (with raw_ostreams as an
-// example):
-//
-// OS << "mynumber: " << format("%4.5f", 1234.412) << '\n';
-//
-// Or if you prefer:
-//
-// OS << format("mynumber: %4.5f\n", 1234.412);
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_FORMAT_H
-#define LLVM_SUPPORT_FORMAT_H
-
-#include "llvm/STLExtras.h"
-#include "llvm/StringRef.h"
-#include <cassert>
-#include <cstdint>
-#include <cstdio>
-#include <tuple>
-
-namespace llvm {
-
-/// This is a helper class used for handling formatted output. It is the
-/// abstract base class of a templated derived class.
-class format_object_base {
-protected:
- const char *Fmt;
- ~format_object_base() = default; // Disallow polymorphic deletion.
- format_object_base(const format_object_base &) = default;
- virtual void home(); // Out of line virtual method.
-
- /// Call snprintf() for this object, on the given buffer and size.
- virtual int snprint(char *Buffer, unsigned BufferSize) const = 0;
-
-public:
- format_object_base(const char *fmt) : Fmt(fmt) {}
-
- /// Format the object into the specified buffer. On success, this returns
- /// the length of the formatted string. If the buffer is too small, this
- /// returns a length to retry with, which will be larger than BufferSize.
- unsigned print(char *Buffer, unsigned BufferSize) const {
- assert(BufferSize && "Invalid buffer size!");
-
- // Print the string, leaving room for the terminating null.
- int N = snprint(Buffer, BufferSize);
-
- // VC++ and old GlibC return negative on overflow, just double the size.
- if (N < 0)
- return BufferSize * 2;
-
- // Other implementations yield number of bytes needed, not including the
- // final '\0'.
- if (unsigned(N) >= BufferSize)
- return N + 1;
-
- // Otherwise N is the length of output (not including the final '\0').
- return N;
- }
-};
-
-/// These are templated helper classes used by the format function that
-/// capture the object to be formated and the format string. When actually
-/// printed, this synthesizes the string into a temporary buffer provided and
-/// returns whether or not it is big enough.
-
-template <typename... Ts>
-class format_object final : public format_object_base {
- std::tuple<Ts...> Vals;
-
- template <std::size_t... Is>
- int snprint_tuple(char *Buffer, unsigned BufferSize,
- index_sequence<Is...>) const {
-#ifdef _MSC_VER
- return _snprintf(Buffer, BufferSize, Fmt, std::get<Is>(Vals)...);
-#else
-#ifdef __GNUC__
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
-#endif
- return snprintf(Buffer, BufferSize, Fmt, std::get<Is>(Vals)...);
-#ifdef __GNUC__
-#pragma GCC diagnostic pop
-#endif
-#endif
- }
-
-public:
- format_object(const char *fmt, const Ts &... vals)
- : format_object_base(fmt), Vals(vals...) {}
-
- int snprint(char *Buffer, unsigned BufferSize) const override {
- return snprint_tuple(Buffer, BufferSize, index_sequence_for<Ts...>());
- }
-};
-
-/// These are helper functions used to produce formatted output. They use
-/// template type deduction to construct the appropriate instance of the
-/// format_object class to simplify their construction.
-///
-/// This is typically used like:
-/// \code
-/// OS << format("%0.4f", myfloat) << '\n';
-/// \endcode
-
-template <typename... Ts>
-inline format_object<Ts...> format(const char *Fmt, const Ts &... Vals) {
- return format_object<Ts...>(Fmt, Vals...);
-}
-
-/// This is a helper class used for left_justify() and right_justify().
-class FormattedString {
- StringRef Str;
- unsigned Width;
- bool RightJustify;
- friend class raw_ostream;
-
-public:
- FormattedString(StringRef S, unsigned W, bool R)
- : Str(S), Width(W), RightJustify(R) { }
-};
-
-/// left_justify - append spaces after string so total output is
-/// \p Width characters. If \p Str is larger that \p Width, full string
-/// is written with no padding.
-inline FormattedString left_justify(StringRef Str, unsigned Width) {
- return FormattedString(Str, Width, false);
-}
-
-/// right_justify - add spaces before string so total output is
-/// \p Width characters. If \p Str is larger that \p Width, full string
-/// is written with no padding.
-inline FormattedString right_justify(StringRef Str, unsigned Width) {
- return FormattedString(Str, Width, true);
-}
-
-/// This is a helper class used for format_hex() and format_decimal().
-class FormattedNumber {
- uint64_t HexValue;
- int64_t DecValue;
- unsigned Width;
- bool Hex;
- bool Upper;
- bool HexPrefix;
- friend class raw_ostream;
-
-public:
- FormattedNumber(uint64_t HV, int64_t DV, unsigned W, bool H, bool U,
- bool Prefix)
- : HexValue(HV), DecValue(DV), Width(W), Hex(H), Upper(U),
- HexPrefix(Prefix) {}
-};
-
-/// format_hex - Output \p N as a fixed width hexadecimal. If number will not
-/// fit in width, full number is still printed. Examples:
-/// OS << format_hex(255, 4) => 0xff
-/// OS << format_hex(255, 4, true) => 0xFF
-/// OS << format_hex(255, 6) => 0x00ff
-/// OS << format_hex(255, 2) => 0xff
-inline FormattedNumber format_hex(uint64_t N, unsigned Width,
- bool Upper = false) {
- assert(Width <= 18 && "hex width must be <= 18");
- return FormattedNumber(N, 0, Width, true, Upper, true);
-}
-
-/// format_hex_no_prefix - Output \p N as a fixed width hexadecimal. Does not
-/// prepend '0x' to the outputted string. If number will not fit in width,
-/// full number is still printed. Examples:
-/// OS << format_hex_no_prefix(255, 2) => ff
-/// OS << format_hex_no_prefix(255, 2, true) => FF
-/// OS << format_hex_no_prefix(255, 4) => 00ff
-/// OS << format_hex_no_prefix(255, 1) => ff
-inline FormattedNumber format_hex_no_prefix(uint64_t N, unsigned Width,
- bool Upper = false) {
- assert(Width <= 16 && "hex width must be <= 16");
- return FormattedNumber(N, 0, Width, true, Upper, false);
-}
-
-/// format_decimal - Output \p N as a right justified, fixed-width decimal. If
-/// number will not fit in width, full number is still printed. Examples:
-/// OS << format_decimal(0, 5) => " 0"
-/// OS << format_decimal(255, 5) => " 255"
-/// OS << format_decimal(-1, 3) => " -1"
-/// OS << format_decimal(12345, 3) => "12345"
-inline FormattedNumber format_decimal(int64_t N, unsigned Width) {
- return FormattedNumber(0, N, Width, false, false, false);
-}
-
-} // end namespace llvm
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/Hashing.h b/third_party/ntcore_2017/wpiutil/include/llvm/Hashing.h
deleted file mode 100644
index 6efd99e..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/Hashing.h
+++ /dev/null
@@ -1,659 +0,0 @@
-//===-- llvm/ADT/Hashing.h - Utilities for hashing --------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the newly proposed standard C++ interfaces for hashing
-// arbitrary data and building hash functions for user-defined types. This
-// interface was originally proposed in N3333[1] and is currently under review
-// for inclusion in a future TR and/or standard.
-//
-// The primary interfaces provide are comprised of one type and three functions:
-//
-// -- 'hash_code' class is an opaque type representing the hash code for some
-// data. It is the intended product of hashing, and can be used to implement
-// hash tables, checksumming, and other common uses of hashes. It is not an
-// integer type (although it can be converted to one) because it is risky
-// to assume much about the internals of a hash_code. In particular, each
-// execution of the program has a high probability of producing a different
-// hash_code for a given input. Thus their values are not stable to save or
-// persist, and should only be used during the execution for the
-// construction of hashing datastructures.
-//
-// -- 'hash_value' is a function designed to be overloaded for each
-// user-defined type which wishes to be used within a hashing context. It
-// should be overloaded within the user-defined type's namespace and found
-// via ADL. Overloads for primitive types are provided by this library.
-//
-// -- 'hash_combine' and 'hash_combine_range' are functions designed to aid
-// programmers in easily and intuitively combining a set of data into
-// a single hash_code for their object. They should only logically be used
-// within the implementation of a 'hash_value' routine or similar context.
-//
-// Note that 'hash_combine_range' contains very special logic for hashing
-// a contiguous array of integers or pointers. This logic is *extremely* fast,
-// on a modern Intel "Gainestown" Xeon (Nehalem uarch) @2.2 GHz, these were
-// benchmarked at over 6.5 GiB/s for large keys, and <20 cycles/hash for keys
-// under 32-bytes.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_HASHING_H
-#define LLVM_ADT_HASHING_H
-
-#include "llvm/type_traits.h"
-#include <algorithm>
-#include <cassert>
-#include <cstdint>
-#include <cstring>
-#include <string>
-#include <utility>
-
-namespace llvm {
-
-/// \brief An opaque object representing a hash code.
-///
-/// This object represents the result of hashing some entity. It is intended to
-/// be used to implement hashtables or other hashing-based data structures.
-/// While it wraps and exposes a numeric value, this value should not be
-/// trusted to be stable or predictable across processes or executions.
-///
-/// In order to obtain the hash_code for an object 'x':
-/// \code
-/// using llvm::hash_value;
-/// llvm::hash_code code = hash_value(x);
-/// \endcode
-class hash_code {
- size_t value;
-
-public:
- /// \brief Default construct a hash_code.
- /// Note that this leaves the value uninitialized.
- hash_code() = default;
-
- /// \brief Form a hash code directly from a numerical value.
- hash_code(size_t value) : value(value) {}
-
- /// \brief Convert the hash code to its numerical value for use.
- /*explicit*/ operator size_t() const { return value; }
-
- friend bool operator==(const hash_code &lhs, const hash_code &rhs) {
- return lhs.value == rhs.value;
- }
- friend bool operator!=(const hash_code &lhs, const hash_code &rhs) {
- return lhs.value != rhs.value;
- }
-
- /// \brief Allow a hash_code to be directly run through hash_value.
- friend size_t hash_value(const hash_code &code) { return code.value; }
-};
-
-/// \brief Compute a hash_code for any integer value.
-///
-/// Note that this function is intended to compute the same hash_code for
-/// a particular value without regard to the pre-promotion type. This is in
-/// contrast to hash_combine which may produce different hash_codes for
-/// differing argument types even if they would implicit promote to a common
-/// type without changing the value.
-template <typename T>
-typename std::enable_if<is_integral_or_enum<T>::value, hash_code>::type
-hash_value(T value);
-
-/// \brief Compute a hash_code for a pointer's address.
-///
-/// N.B.: This hashes the *address*. Not the value and not the type.
-template <typename T> hash_code hash_value(const T *ptr);
-
-/// \brief Compute a hash_code for a pair of objects.
-template <typename T, typename U>
-hash_code hash_value(const std::pair<T, U> &arg);
-
-/// \brief Compute a hash_code for a standard string.
-template <typename T>
-hash_code hash_value(const std::basic_string<T> &arg);
-
-
-/// \brief Override the execution seed with a fixed value.
-///
-/// This hashing library uses a per-execution seed designed to change on each
-/// run with high probability in order to ensure that the hash codes are not
-/// attackable and to ensure that output which is intended to be stable does
-/// not rely on the particulars of the hash codes produced.
-///
-/// That said, there are use cases where it is important to be able to
-/// reproduce *exactly* a specific behavior. To that end, we provide a function
-/// which will forcibly set the seed to a fixed value. This must be done at the
-/// start of the program, before any hashes are computed. Also, it cannot be
-/// undone. This makes it thread-hostile and very hard to use outside of
-/// immediately on start of a simple program designed for reproducible
-/// behavior.
-void set_fixed_execution_hash_seed(size_t fixed_value);
-
-
-// All of the implementation details of actually computing the various hash
-// code values are held within this namespace. These routines are included in
-// the header file mainly to allow inlining and constant propagation.
-namespace hashing {
-namespace detail {
-
-inline uint64_t fetch64(const char *p) {
- uint64_t result;
- memcpy(&result, p, sizeof(result));
- //if (sys::IsBigEndianHost)
- // sys::swapByteOrder(result);
- return result;
-}
-
-inline uint32_t fetch32(const char *p) {
- uint32_t result;
- memcpy(&result, p, sizeof(result));
- //if (sys::IsBigEndianHost)
- // sys::swapByteOrder(result);
- return result;
-}
-
-/// Some primes between 2^63 and 2^64 for various uses.
-static const uint64_t k0 = 0xc3a5c85c97cb3127ULL;
-static const uint64_t k1 = 0xb492b66fbe98f273ULL;
-static const uint64_t k2 = 0x9ae16a3b2f90404fULL;
-static const uint64_t k3 = 0xc949d7c7509e6557ULL;
-
-/// \brief Bitwise right rotate.
-/// Normally this will compile to a single instruction, especially if the
-/// shift is a manifest constant.
-inline uint64_t rotate(uint64_t val, size_t shift) {
- // Avoid shifting by 64: doing so yields an undefined result.
- return shift == 0 ? val : ((val >> shift) | (val << (64 - shift)));
-}
-
-inline uint64_t shift_mix(uint64_t val) {
- return val ^ (val >> 47);
-}
-
-inline uint64_t hash_16_bytes(uint64_t low, uint64_t high) {
- // Murmur-inspired hashing.
- const uint64_t kMul = 0x9ddfea08eb382d69ULL;
- uint64_t a = (low ^ high) * kMul;
- a ^= (a >> 47);
- uint64_t b = (high ^ a) * kMul;
- b ^= (b >> 47);
- b *= kMul;
- return b;
-}
-
-inline uint64_t hash_1to3_bytes(const char *s, size_t len, uint64_t seed) {
- uint8_t a = s[0];
- uint8_t b = s[len >> 1];
- uint8_t c = s[len - 1];
- uint32_t y = static_cast<uint32_t>(a) + (static_cast<uint32_t>(b) << 8);
- uint32_t z = len + (static_cast<uint32_t>(c) << 2);
- return shift_mix(y * k2 ^ z * k3 ^ seed) * k2;
-}
-
-inline uint64_t hash_4to8_bytes(const char *s, size_t len, uint64_t seed) {
- uint64_t a = fetch32(s);
- return hash_16_bytes(len + (a << 3), seed ^ fetch32(s + len - 4));
-}
-
-inline uint64_t hash_9to16_bytes(const char *s, size_t len, uint64_t seed) {
- uint64_t a = fetch64(s);
- uint64_t b = fetch64(s + len - 8);
- return hash_16_bytes(seed ^ a, rotate(b + len, len)) ^ b;
-}
-
-inline uint64_t hash_17to32_bytes(const char *s, size_t len, uint64_t seed) {
- uint64_t a = fetch64(s) * k1;
- uint64_t b = fetch64(s + 8);
- uint64_t c = fetch64(s + len - 8) * k2;
- uint64_t d = fetch64(s + len - 16) * k0;
- return hash_16_bytes(rotate(a - b, 43) + rotate(c ^ seed, 30) + d,
- a + rotate(b ^ k3, 20) - c + len + seed);
-}
-
-inline uint64_t hash_33to64_bytes(const char *s, size_t len, uint64_t seed) {
- uint64_t z = fetch64(s + 24);
- uint64_t a = fetch64(s) + (len + fetch64(s + len - 16)) * k0;
- uint64_t b = rotate(a + z, 52);
- uint64_t c = rotate(a, 37);
- a += fetch64(s + 8);
- c += rotate(a, 7);
- a += fetch64(s + 16);
- uint64_t vf = a + z;
- uint64_t vs = b + rotate(a, 31) + c;
- a = fetch64(s + 16) + fetch64(s + len - 32);
- z = fetch64(s + len - 8);
- b = rotate(a + z, 52);
- c = rotate(a, 37);
- a += fetch64(s + len - 24);
- c += rotate(a, 7);
- a += fetch64(s + len - 16);
- uint64_t wf = a + z;
- uint64_t ws = b + rotate(a, 31) + c;
- uint64_t r = shift_mix((vf + ws) * k2 + (wf + vs) * k0);
- return shift_mix((seed ^ (r * k0)) + vs) * k2;
-}
-
-inline uint64_t hash_short(const char *s, size_t length, uint64_t seed) {
- if (length >= 4 && length <= 8)
- return hash_4to8_bytes(s, length, seed);
- if (length > 8 && length <= 16)
- return hash_9to16_bytes(s, length, seed);
- if (length > 16 && length <= 32)
- return hash_17to32_bytes(s, length, seed);
- if (length > 32)
- return hash_33to64_bytes(s, length, seed);
- if (length != 0)
- return hash_1to3_bytes(s, length, seed);
-
- return k2 ^ seed;
-}
-
-/// \brief The intermediate state used during hashing.
-/// Currently, the algorithm for computing hash codes is based on CityHash and
-/// keeps 56 bytes of arbitrary state.
-struct hash_state {
- uint64_t h0, h1, h2, h3, h4, h5, h6;
-
- /// \brief Create a new hash_state structure and initialize it based on the
- /// seed and the first 64-byte chunk.
- /// This effectively performs the initial mix.
- static hash_state create(const char *s, uint64_t seed) {
- hash_state state = {
- 0, seed, hash_16_bytes(seed, k1), rotate(seed ^ k1, 49),
- seed * k1, shift_mix(seed), 0 };
- state.h6 = hash_16_bytes(state.h4, state.h5);
- state.mix(s);
- return state;
- }
-
- /// \brief Mix 32-bytes from the input sequence into the 16-bytes of 'a'
- /// and 'b', including whatever is already in 'a' and 'b'.
- static void mix_32_bytes(const char *s, uint64_t &a, uint64_t &b) {
- a += fetch64(s);
- uint64_t c = fetch64(s + 24);
- b = rotate(b + a + c, 21);
- uint64_t d = a;
- a += fetch64(s + 8) + fetch64(s + 16);
- b += rotate(a, 44) + d;
- a += c;
- }
-
- /// \brief Mix in a 64-byte buffer of data.
- /// We mix all 64 bytes even when the chunk length is smaller, but we
- /// record the actual length.
- void mix(const char *s) {
- h0 = rotate(h0 + h1 + h3 + fetch64(s + 8), 37) * k1;
- h1 = rotate(h1 + h4 + fetch64(s + 48), 42) * k1;
- h0 ^= h6;
- h1 += h3 + fetch64(s + 40);
- h2 = rotate(h2 + h5, 33) * k1;
- h3 = h4 * k1;
- h4 = h0 + h5;
- mix_32_bytes(s, h3, h4);
- h5 = h2 + h6;
- h6 = h1 + fetch64(s + 16);
- mix_32_bytes(s + 32, h5, h6);
- std::swap(h2, h0);
- }
-
- /// \brief Compute the final 64-bit hash code value based on the current
- /// state and the length of bytes hashed.
- uint64_t finalize(size_t length) {
- return hash_16_bytes(hash_16_bytes(h3, h5) + shift_mix(h1) * k1 + h2,
- hash_16_bytes(h4, h6) + shift_mix(length) * k1 + h0);
- }
-};
-
-
-/// \brief A global, fixed seed-override variable.
-///
-/// This variable can be set using the \see llvm::set_fixed_execution_seed
-/// function. See that function for details. Do not, under any circumstances,
-/// set or read this variable.
-extern size_t fixed_seed_override;
-
-inline size_t get_execution_seed() {
- // FIXME: This needs to be a per-execution seed. This is just a placeholder
- // implementation. Switching to a per-execution seed is likely to flush out
- // instability bugs and so will happen as its own commit.
- //
- // However, if there is a fixed seed override set the first time this is
- // called, return that instead of the per-execution seed.
- const uint64_t seed_prime = 0xff51afd7ed558ccdULL;
- static size_t seed = fixed_seed_override ? fixed_seed_override
- : (size_t)seed_prime;
- return seed;
-}
-
-
-/// \brief Trait to indicate whether a type's bits can be hashed directly.
-///
-/// A type trait which is true if we want to combine values for hashing by
-/// reading the underlying data. It is false if values of this type must
-/// first be passed to hash_value, and the resulting hash_codes combined.
-//
-// FIXME: We want to replace is_integral_or_enum and is_pointer here with
-// a predicate which asserts that comparing the underlying storage of two
-// values of the type for equality is equivalent to comparing the two values
-// for equality. For all the platforms we care about, this holds for integers
-// and pointers, but there are platforms where it doesn't and we would like to
-// support user-defined types which happen to satisfy this property.
-template <typename T> struct is_hashable_data
- : std::integral_constant<bool, ((is_integral_or_enum<T>::value ||
- std::is_pointer<T>::value) &&
- 64 % sizeof(T) == 0)> {};
-
-// Special case std::pair to detect when both types are viable and when there
-// is no alignment-derived padding in the pair. This is a bit of a lie because
-// std::pair isn't truly POD, but it's close enough in all reasonable
-// implementations for our use case of hashing the underlying data.
-template <typename T, typename U> struct is_hashable_data<std::pair<T, U> >
- : std::integral_constant<bool, (is_hashable_data<T>::value &&
- is_hashable_data<U>::value &&
- (sizeof(T) + sizeof(U)) ==
- sizeof(std::pair<T, U>))> {};
-
-/// \brief Helper to get the hashable data representation for a type.
-/// This variant is enabled when the type itself can be used.
-template <typename T>
-typename std::enable_if<is_hashable_data<T>::value, T>::type
-get_hashable_data(const T &value) {
- return value;
-}
-/// \brief Helper to get the hashable data representation for a type.
-/// This variant is enabled when we must first call hash_value and use the
-/// result as our data.
-template <typename T>
-typename std::enable_if<!is_hashable_data<T>::value, size_t>::type
-get_hashable_data(const T &value) {
- using ::llvm::hash_value;
- return hash_value(value);
-}
-
-/// \brief Helper to store data from a value into a buffer and advance the
-/// pointer into that buffer.
-///
-/// This routine first checks whether there is enough space in the provided
-/// buffer, and if not immediately returns false. If there is space, it
-/// copies the underlying bytes of value into the buffer, advances the
-/// buffer_ptr past the copied bytes, and returns true.
-template <typename T>
-bool store_and_advance(char *&buffer_ptr, char *buffer_end, const T& value,
- size_t offset = 0) {
- size_t store_size = sizeof(value) - offset;
- if (buffer_ptr + store_size > buffer_end)
- return false;
- const char *value_data = reinterpret_cast<const char *>(&value);
- memcpy(buffer_ptr, value_data + offset, store_size);
- buffer_ptr += store_size;
- return true;
-}
-
-/// \brief Implement the combining of integral values into a hash_code.
-///
-/// This overload is selected when the value type of the iterator is
-/// integral. Rather than computing a hash_code for each object and then
-/// combining them, this (as an optimization) directly combines the integers.
-template <typename InputIteratorT>
-hash_code hash_combine_range_impl(InputIteratorT first, InputIteratorT last) {
- const size_t seed = get_execution_seed();
- char buffer[64], *buffer_ptr = buffer;
- char *const buffer_end = std::end(buffer);
- while (first != last && store_and_advance(buffer_ptr, buffer_end,
- get_hashable_data(*first)))
- ++first;
- if (first == last)
- return hash_short(buffer, buffer_ptr - buffer, seed);
- assert(buffer_ptr == buffer_end);
-
- hash_state state = state.create(buffer, seed);
- size_t length = 64;
- while (first != last) {
- // Fill up the buffer. We don't clear it, which re-mixes the last round
- // when only a partial 64-byte chunk is left.
- buffer_ptr = buffer;
- while (first != last && store_and_advance(buffer_ptr, buffer_end,
- get_hashable_data(*first)))
- ++first;
-
- // Rotate the buffer if we did a partial fill in order to simulate doing
- // a mix of the last 64-bytes. That is how the algorithm works when we
- // have a contiguous byte sequence, and we want to emulate that here.
- std::rotate(buffer, buffer_ptr, buffer_end);
-
- // Mix this chunk into the current state.
- state.mix(buffer);
- length += buffer_ptr - buffer;
- };
-
- return state.finalize(length);
-}
-
-/// \brief Implement the combining of integral values into a hash_code.
-///
-/// This overload is selected when the value type of the iterator is integral
-/// and when the input iterator is actually a pointer. Rather than computing
-/// a hash_code for each object and then combining them, this (as an
-/// optimization) directly combines the integers. Also, because the integers
-/// are stored in contiguous memory, this routine avoids copying each value
-/// and directly reads from the underlying memory.
-template <typename ValueT>
-typename std::enable_if<is_hashable_data<ValueT>::value, hash_code>::type
-hash_combine_range_impl(ValueT *first, ValueT *last) {
- const size_t seed = get_execution_seed();
- const char *s_begin = reinterpret_cast<const char *>(first);
- const char *s_end = reinterpret_cast<const char *>(last);
- const size_t length = std::distance(s_begin, s_end);
- if (length <= 64)
- return hash_short(s_begin, length, seed);
-
- const char *s_aligned_end = s_begin + (length & ~63);
- hash_state state = state.create(s_begin, seed);
- s_begin += 64;
- while (s_begin != s_aligned_end) {
- state.mix(s_begin);
- s_begin += 64;
- }
- if (length & 63)
- state.mix(s_end - 64);
-
- return state.finalize(length);
-}
-
-} // namespace detail
-} // namespace hashing
-
-
-/// \brief Compute a hash_code for a sequence of values.
-///
-/// This hashes a sequence of values. It produces the same hash_code as
-/// 'hash_combine(a, b, c, ...)', but can run over arbitrary sized sequences
-/// and is significantly faster given pointers and types which can be hashed as
-/// a sequence of bytes.
-template <typename InputIteratorT>
-hash_code hash_combine_range(InputIteratorT first, InputIteratorT last) {
- return ::llvm::hashing::detail::hash_combine_range_impl(first, last);
-}
-
-
-// Implementation details for hash_combine.
-namespace hashing {
-namespace detail {
-
-/// \brief Helper class to manage the recursive combining of hash_combine
-/// arguments.
-///
-/// This class exists to manage the state and various calls involved in the
-/// recursive combining of arguments used in hash_combine. It is particularly
-/// useful at minimizing the code in the recursive calls to ease the pain
-/// caused by a lack of variadic functions.
-struct hash_combine_recursive_helper {
- char buffer[64];
- hash_state state;
- const size_t seed;
-
-public:
- /// \brief Construct a recursive hash combining helper.
- ///
- /// This sets up the state for a recursive hash combine, including getting
- /// the seed and buffer setup.
- hash_combine_recursive_helper()
- : seed(get_execution_seed()) {}
-
- /// \brief Combine one chunk of data into the current in-flight hash.
- ///
- /// This merges one chunk of data into the hash. First it tries to buffer
- /// the data. If the buffer is full, it hashes the buffer into its
- /// hash_state, empties it, and then merges the new chunk in. This also
- /// handles cases where the data straddles the end of the buffer.
- template <typename T>
- char *combine_data(size_t &length, char *buffer_ptr, char *buffer_end, T data) {
- if (!store_and_advance(buffer_ptr, buffer_end, data)) {
- // Check for skew which prevents the buffer from being packed, and do
- // a partial store into the buffer to fill it. This is only a concern
- // with the variadic combine because that formation can have varying
- // argument types.
- size_t partial_store_size = buffer_end - buffer_ptr;
- memcpy(buffer_ptr, &data, partial_store_size);
-
- // If the store fails, our buffer is full and ready to hash. We have to
- // either initialize the hash state (on the first full buffer) or mix
- // this buffer into the existing hash state. Length tracks the *hashed*
- // length, not the buffered length.
- if (length == 0) {
- state = state.create(buffer, seed);
- length = 64;
- } else {
- // Mix this chunk into the current state and bump length up by 64.
- state.mix(buffer);
- length += 64;
- }
- // Reset the buffer_ptr to the head of the buffer for the next chunk of
- // data.
- buffer_ptr = buffer;
-
- // Try again to store into the buffer -- this cannot fail as we only
- // store types smaller than the buffer.
- if (!store_and_advance(buffer_ptr, buffer_end, data,
- partial_store_size))
- abort();
- }
- return buffer_ptr;
- }
-
- /// \brief Recursive, variadic combining method.
- ///
- /// This function recurses through each argument, combining that argument
- /// into a single hash.
- template <typename T, typename ...Ts>
- hash_code combine(size_t length, char *buffer_ptr, char *buffer_end,
- const T &arg, const Ts &...args) {
- buffer_ptr = combine_data(length, buffer_ptr, buffer_end, get_hashable_data(arg));
-
- // Recurse to the next argument.
- return combine(length, buffer_ptr, buffer_end, args...);
- }
-
- /// \brief Base case for recursive, variadic combining.
- ///
- /// The base case when combining arguments recursively is reached when all
- /// arguments have been handled. It flushes the remaining buffer and
- /// constructs a hash_code.
- hash_code combine(size_t length, char *buffer_ptr, char *buffer_end) {
- // Check whether the entire set of values fit in the buffer. If so, we'll
- // use the optimized short hashing routine and skip state entirely.
- if (length == 0)
- return hash_short(buffer, buffer_ptr - buffer, seed);
-
- // Mix the final buffer, rotating it if we did a partial fill in order to
- // simulate doing a mix of the last 64-bytes. That is how the algorithm
- // works when we have a contiguous byte sequence, and we want to emulate
- // that here.
- std::rotate(buffer, buffer_ptr, buffer_end);
-
- // Mix this chunk into the current state.
- state.mix(buffer);
- length += buffer_ptr - buffer;
-
- return state.finalize(length);
- }
-};
-
-} // namespace detail
-} // namespace hashing
-
-/// \brief Combine values into a single hash_code.
-///
-/// This routine accepts a varying number of arguments of any type. It will
-/// attempt to combine them into a single hash_code. For user-defined types it
-/// attempts to call a \see hash_value overload (via ADL) for the type. For
-/// integer and pointer types it directly combines their data into the
-/// resulting hash_code.
-///
-/// The result is suitable for returning from a user's hash_value
-/// *implementation* for their user-defined type. Consumers of a type should
-/// *not* call this routine, they should instead call 'hash_value'.
-template <typename ...Ts> hash_code hash_combine(const Ts &...args) {
- // Recursively hash each argument using a helper class.
- ::llvm::hashing::detail::hash_combine_recursive_helper helper;
- return helper.combine(0, helper.buffer, helper.buffer + 64, args...);
-}
-
-// Implementation details for implementations of hash_value overloads provided
-// here.
-namespace hashing {
-namespace detail {
-
-/// \brief Helper to hash the value of a single integer.
-///
-/// Overloads for smaller integer types are not provided to ensure consistent
-/// behavior in the presence of integral promotions. Essentially,
-/// "hash_value('4')" and "hash_value('0' + 4)" should be the same.
-inline hash_code hash_integer_value(uint64_t value) {
- // Similar to hash_4to8_bytes but using a seed instead of length.
- const uint64_t seed = get_execution_seed();
- const char *s = reinterpret_cast<const char *>(&value);
- const uint64_t a = fetch32(s);
- return hash_16_bytes(seed + (a << 3), fetch32(s + 4));
-}
-
-} // namespace detail
-} // namespace hashing
-
-// Declared and documented above, but defined here so that any of the hashing
-// infrastructure is available.
-template <typename T>
-typename std::enable_if<is_integral_or_enum<T>::value, hash_code>::type
-hash_value(T value) {
- return ::llvm::hashing::detail::hash_integer_value(
- static_cast<uint64_t>(value));
-}
-
-// Declared and documented above, but defined here so that any of the hashing
-// infrastructure is available.
-template <typename T> hash_code hash_value(const T *ptr) {
- return ::llvm::hashing::detail::hash_integer_value(
- reinterpret_cast<uintptr_t>(ptr));
-}
-
-// Declared and documented above, but defined here so that any of the hashing
-// infrastructure is available.
-template <typename T, typename U>
-hash_code hash_value(const std::pair<T, U> &arg) {
- return hash_combine(arg.first, arg.second);
-}
-
-// Declared and documented above, but defined here so that any of the hashing
-// infrastructure is available.
-template <typename T>
-hash_code hash_value(const std::basic_string<T> &arg) {
- return hash_combine_range(arg.begin(), arg.end());
-}
-
-} // namespace llvm
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/MathExtras.h b/third_party/ntcore_2017/wpiutil/include/llvm/MathExtras.h
deleted file mode 100644
index a8258ba..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/MathExtras.h
+++ /dev/null
@@ -1,653 +0,0 @@
-//===-- llvm/Support/MathExtras.h - Useful math functions -------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains some functions that are useful for math stuff.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_MATHEXTRAS_H
-#define LLVM_SUPPORT_MATHEXTRAS_H
-
-#include "llvm/Compiler.h"
-#include <cstdint>
-#include <algorithm>
-#include <cassert>
-#include <cmath>
-#include <cstring>
-#include <type_traits>
-#include <limits>
-
-#ifdef _MSC_VER
-#include <intrin.h>
-#endif
-
-namespace llvm {
-/// \brief The behavior an operation has on an input of 0.
-enum ZeroBehavior {
- /// \brief The returned value is undefined.
- ZB_Undefined,
- /// \brief The returned value is numeric_limits<T>::max()
- ZB_Max,
- /// \brief The returned value is numeric_limits<T>::digits
- ZB_Width
-};
-
-namespace detail {
-template <typename T, std::size_t SizeOfT> struct LeadingZerosCounter {
- static std::size_t count(T Val, ZeroBehavior) {
- if (!Val)
- return std::numeric_limits<T>::digits;
-
- // Bisection method.
- std::size_t ZeroBits = 0;
- for (T Shift = std::numeric_limits<T>::digits >> 1; Shift; Shift >>= 1) {
- T Tmp = Val >> Shift;
- if (Tmp)
- Val = Tmp;
- else
- ZeroBits |= Shift;
- }
- return ZeroBits;
- }
-};
-
-#if __GNUC__ >= 4 || defined(_MSC_VER)
-template <typename T> struct LeadingZerosCounter<T, 4> {
- static std::size_t count(T Val, ZeroBehavior ZB) {
- if (ZB != ZB_Undefined && Val == 0)
- return 32;
-
-#if __has_builtin(__builtin_clz) || LLVM_GNUC_PREREQ(4, 0, 0)
- return __builtin_clz(Val);
-#elif defined(_MSC_VER)
- unsigned long Index;
- _BitScanReverse(&Index, Val);
- return Index ^ 31;
-#endif
- }
-};
-
-#if !defined(_MSC_VER) || defined(_M_X64)
-template <typename T> struct LeadingZerosCounter<T, 8> {
- static std::size_t count(T Val, ZeroBehavior ZB) {
- if (ZB != ZB_Undefined && Val == 0)
- return 64;
-
-#if __has_builtin(__builtin_clzll) || LLVM_GNUC_PREREQ(4, 0, 0)
- return __builtin_clzll(Val);
-#elif defined(_MSC_VER)
- unsigned long Index;
- _BitScanReverse64(&Index, Val);
- return Index ^ 63;
-#endif
- }
-};
-#endif
-#endif
-} // namespace detail
-
-/// \brief Count number of 0's from the most significant bit to the least
-/// stopping at the first 1.
-///
-/// Only unsigned integral types are allowed.
-///
-/// \param ZB the behavior on an input of 0. Only ZB_Width and ZB_Undefined are
-/// valid arguments.
-template <typename T>
-std::size_t countLeadingZeros(T Val, ZeroBehavior ZB = ZB_Width) {
- static_assert(std::numeric_limits<T>::is_integer &&
- !std::numeric_limits<T>::is_signed,
- "Only unsigned integral types are allowed.");
- return detail::LeadingZerosCounter<T, sizeof(T)>::count(Val, ZB);
-}
-
-/// \brief Get the index of the last set bit starting from the least
-/// significant bit.
-///
-/// Only unsigned integral types are allowed.
-///
-/// \param ZB the behavior on an input of 0. Only ZB_Max and ZB_Undefined are
-/// valid arguments.
-template <typename T> T findLastSet(T Val, ZeroBehavior ZB = ZB_Max) {
- if (ZB == ZB_Max && Val == 0)
- return std::numeric_limits<T>::max();
-
- // Use ^ instead of - because both gcc and llvm can remove the associated ^
- // in the __builtin_clz intrinsic on x86.
- return countLeadingZeros(Val, ZB_Undefined) ^
- (std::numeric_limits<T>::digits - 1);
-}
-
-/// \brief Macro compressed bit reversal table for 256 bits.
-///
-/// http://graphics.stanford.edu/~seander/bithacks.html#BitReverseTable
-static const unsigned char BitReverseTable256[256] = {
-#define R2(n) n, n + 2 * 64, n + 1 * 64, n + 3 * 64
-#define R4(n) R2(n), R2(n + 2 * 16), R2(n + 1 * 16), R2(n + 3 * 16)
-#define R6(n) R4(n), R4(n + 2 * 4), R4(n + 1 * 4), R4(n + 3 * 4)
- R6(0), R6(2), R6(1), R6(3)
-#undef R2
-#undef R4
-#undef R6
-};
-
-/// \brief Reverse the bits in \p Val.
-template <typename T>
-T reverseBits(T Val) {
- unsigned char in[sizeof(Val)];
- unsigned char out[sizeof(Val)];
- std::memcpy(in, &Val, sizeof(Val));
- for (unsigned i = 0; i < sizeof(Val); ++i)
- out[(sizeof(Val) - i) - 1] = BitReverseTable256[in[i]];
- std::memcpy(&Val, out, sizeof(Val));
- return Val;
-}
-
-// NOTE: The following support functions use the _32/_64 extensions instead of
-// type overloading so that signed and unsigned integers can be used without
-// ambiguity.
-
-/// Hi_32 - This function returns the high 32 bits of a 64 bit value.
-inline uint32_t Hi_32(uint64_t Value) {
- return static_cast<uint32_t>(Value >> 32);
-}
-
-/// Lo_32 - This function returns the low 32 bits of a 64 bit value.
-inline uint32_t Lo_32(uint64_t Value) {
- return static_cast<uint32_t>(Value);
-}
-
-/// Make_64 - This functions makes a 64-bit integer from a high / low pair of
-/// 32-bit integers.
-inline uint64_t Make_64(uint32_t High, uint32_t Low) {
- return ((uint64_t)High << 32) | (uint64_t)Low;
-}
-
-/// isInt - Checks if an integer fits into the given bit width.
-template<unsigned N>
-inline bool isInt(int64_t x) {
- return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1)));
-}
-// Template specializations to get better code for common cases.
-template<>
-inline bool isInt<8>(int64_t x) {
- return static_cast<int8_t>(x) == x;
-}
-template<>
-inline bool isInt<16>(int64_t x) {
- return static_cast<int16_t>(x) == x;
-}
-template<>
-inline bool isInt<32>(int64_t x) {
- return static_cast<int32_t>(x) == x;
-}
-
-/// isShiftedInt<N,S> - Checks if a signed integer is an N bit number shifted
-/// left by S.
-template<unsigned N, unsigned S>
-inline bool isShiftedInt(int64_t x) {
- return isInt<N+S>(x) && (x % (1<<S) == 0);
-}
-
-/// isUInt - Checks if an unsigned integer fits into the given bit width.
-template<unsigned N>
-inline bool isUInt(uint64_t x) {
- return N >= 64 || x < (UINT64_C(1)<<(N));
-}
-// Template specializations to get better code for common cases.
-template<>
-inline bool isUInt<8>(uint64_t x) {
- return static_cast<uint8_t>(x) == x;
-}
-template<>
-inline bool isUInt<16>(uint64_t x) {
- return static_cast<uint16_t>(x) == x;
-}
-template<>
-inline bool isUInt<32>(uint64_t x) {
- return static_cast<uint32_t>(x) == x;
-}
-
-/// isShiftedUInt<N,S> - Checks if a unsigned integer is an N bit number shifted
-/// left by S.
-template<unsigned N, unsigned S>
-inline bool isShiftedUInt(uint64_t x) {
- return isUInt<N+S>(x) && (x % (1<<S) == 0);
-}
-
-/// Gets the maximum value for a N-bit unsigned integer.
-inline uint64_t maxUIntN(uint64_t N) {
- assert(N > 0 && N <= 64 && "integer width out of range");
-
- return (UINT64_C(1) << N) - 1;
-}
-
-/// Gets the minimum value for a N-bit signed integer.
-inline int64_t minIntN(int64_t N) {
- assert(N > 0 && N <= 64 && "integer width out of range");
-
- return -(INT64_C(1)<<(N-1));
-}
-
-/// Gets the maximum value for a N-bit signed integer.
-inline int64_t maxIntN(int64_t N) {
- assert(N > 0 && N <= 64 && "integer width out of range");
-
- return (INT64_C(1)<<(N-1)) - 1;
-}
-
-/// isUIntN - Checks if an unsigned integer fits into the given (dynamic)
-/// bit width.
-inline bool isUIntN(unsigned N, uint64_t x) {
- return N >= 64 || x <= maxUIntN(N);
-}
-
-/// isIntN - Checks if an signed integer fits into the given (dynamic)
-/// bit width.
-inline bool isIntN(unsigned N, int64_t x) {
- return N >= 64 || (minIntN(N) <= x && x <= maxIntN(N));
-}
-
-/// isMask_32 - This function returns true if the argument is a non-empty
-/// sequence of ones starting at the least significant bit with the remainder
-/// zero (32 bit version). Ex. isMask_32(0x0000FFFFU) == true.
-inline bool isMask_32(uint32_t Value) {
- return Value && ((Value + 1) & Value) == 0;
-}
-
-/// isMask_64 - This function returns true if the argument is a non-empty
-/// sequence of ones starting at the least significant bit with the remainder
-/// zero (64 bit version).
-inline bool isMask_64(uint64_t Value) {
- return Value && ((Value + 1) & Value) == 0;
-}
-
-/// isShiftedMask_32 - This function returns true if the argument contains a
-/// non-empty sequence of ones with the remainder zero (32 bit version.)
-/// Ex. isShiftedMask_32(0x0000FF00U) == true.
-inline bool isShiftedMask_32(uint32_t Value) {
- return Value && isMask_32((Value - 1) | Value);
-}
-
-/// isShiftedMask_64 - This function returns true if the argument contains a
-/// non-empty sequence of ones with the remainder zero (64 bit version.)
-inline bool isShiftedMask_64(uint64_t Value) {
- return Value && isMask_64((Value - 1) | Value);
-}
-
-/// isPowerOf2_32 - This function returns true if the argument is a power of
-/// two > 0. Ex. isPowerOf2_32(0x00100000U) == true (32 bit edition.)
-inline bool isPowerOf2_32(uint32_t Value) {
- return Value && !(Value & (Value - 1));
-}
-
-/// isPowerOf2_64 - This function returns true if the argument is a power of two
-/// > 0 (64 bit edition.)
-inline bool isPowerOf2_64(uint64_t Value) {
- return Value && !(Value & (Value - int64_t(1L)));
-}
-
-/// \brief Count the number of ones from the most significant bit to the first
-/// zero bit.
-///
-/// Ex. CountLeadingOnes(0xFF0FFF00) == 8.
-/// Only unsigned integral types are allowed.
-///
-/// \param ZB the behavior on an input of all ones. Only ZB_Width and
-/// ZB_Undefined are valid arguments.
-template <typename T>
-std::size_t countLeadingOnes(T Value, ZeroBehavior ZB = ZB_Width) {
- static_assert(std::numeric_limits<T>::is_integer &&
- !std::numeric_limits<T>::is_signed,
- "Only unsigned integral types are allowed.");
- return countLeadingZeros(~Value, ZB);
-}
-
-namespace detail {
-template <typename T, std::size_t SizeOfT> struct PopulationCounter {
- static unsigned count(T Value) {
- // Generic version, forward to 32 bits.
- static_assert(SizeOfT <= 4, "Not implemented!");
-#if __GNUC__ >= 4
- return __builtin_popcount(Value);
-#else
- uint32_t v = Value;
- v = v - ((v >> 1) & 0x55555555);
- v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
- return ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
-#endif
- }
-};
-
-template <typename T> struct PopulationCounter<T, 8> {
- static unsigned count(T Value) {
-#if __GNUC__ >= 4
- return __builtin_popcountll(Value);
-#else
- uint64_t v = Value;
- v = v - ((v >> 1) & 0x5555555555555555ULL);
- v = (v & 0x3333333333333333ULL) + ((v >> 2) & 0x3333333333333333ULL);
- v = (v + (v >> 4)) & 0x0F0F0F0F0F0F0F0FULL;
- return unsigned((uint64_t)(v * 0x0101010101010101ULL) >> 56);
-#endif
- }
-};
-} // namespace detail
-
-/// \brief Count the number of set bits in a value.
-/// Ex. countPopulation(0xF000F000) = 8
-/// Returns 0 if the word is zero.
-template <typename T>
-inline unsigned countPopulation(T Value) {
- static_assert(std::numeric_limits<T>::is_integer &&
- !std::numeric_limits<T>::is_signed,
- "Only unsigned integral types are allowed.");
- return detail::PopulationCounter<T, sizeof(T)>::count(Value);
-}
-
-/// Log2 - This function returns the log base 2 of the specified value
-inline double Log2(double Value) {
-#if defined(__ANDROID_API__) && __ANDROID_API__ < 18
- return __builtin_log(Value) / __builtin_log(2.0);
-#else
- return std::log2(Value);
-#endif
-}
-
-/// Log2_32 - This function returns the floor log base 2 of the specified value,
-/// -1 if the value is zero. (32 bit edition.)
-/// Ex. Log2_32(32) == 5, Log2_32(1) == 0, Log2_32(0) == -1, Log2_32(6) == 2
-inline unsigned Log2_32(uint32_t Value) {
- return 31 - countLeadingZeros(Value);
-}
-
-/// Log2_64 - This function returns the floor log base 2 of the specified value,
-/// -1 if the value is zero. (64 bit edition.)
-inline unsigned Log2_64(uint64_t Value) {
- return 63 - countLeadingZeros(Value);
-}
-
-/// Log2_32_Ceil - This function returns the ceil log base 2 of the specified
-/// value, 32 if the value is zero. (32 bit edition).
-/// Ex. Log2_32_Ceil(32) == 5, Log2_32_Ceil(1) == 0, Log2_32_Ceil(6) == 3
-inline unsigned Log2_32_Ceil(uint32_t Value) {
- return 32 - countLeadingZeros(Value - 1);
-}
-
-/// Log2_64_Ceil - This function returns the ceil log base 2 of the specified
-/// value, 64 if the value is zero. (64 bit edition.)
-inline unsigned Log2_64_Ceil(uint64_t Value) {
- return 64 - countLeadingZeros(Value - 1);
-}
-
-/// GreatestCommonDivisor64 - Return the greatest common divisor of the two
-/// values using Euclid's algorithm.
-inline uint64_t GreatestCommonDivisor64(uint64_t A, uint64_t B) {
- while (B) {
- uint64_t T = B;
- B = A % B;
- A = T;
- }
- return A;
-}
-
-/// BitsToDouble - This function takes a 64-bit integer and returns the bit
-/// equivalent double.
-inline double BitsToDouble(uint64_t Bits) {
- union {
- uint64_t L;
- double D;
- } T;
- T.L = Bits;
- return T.D;
-}
-
-/// BitsToFloat - This function takes a 32-bit integer and returns the bit
-/// equivalent float.
-inline float BitsToFloat(uint32_t Bits) {
- union {
- uint32_t I;
- float F;
- } T;
- T.I = Bits;
- return T.F;
-}
-
-/// DoubleToBits - This function takes a double and returns the bit
-/// equivalent 64-bit integer. Note that copying doubles around
-/// changes the bits of NaNs on some hosts, notably x86, so this
-/// routine cannot be used if these bits are needed.
-inline uint64_t DoubleToBits(double Double) {
- union {
- uint64_t L;
- double D;
- } T;
- T.D = Double;
- return T.L;
-}
-
-/// FloatToBits - This function takes a float and returns the bit
-/// equivalent 32-bit integer. Note that copying floats around
-/// changes the bits of NaNs on some hosts, notably x86, so this
-/// routine cannot be used if these bits are needed.
-inline uint32_t FloatToBits(float Float) {
- union {
- uint32_t I;
- float F;
- } T;
- T.F = Float;
- return T.I;
-}
-
-/// MinAlign - A and B are either alignments or offsets. Return the minimum
-/// alignment that may be assumed after adding the two together.
-inline uint64_t MinAlign(uint64_t A, uint64_t B) {
- // The largest power of 2 that divides both A and B.
- //
- // Replace "-Value" by "1+~Value" in the following commented code to avoid
- // MSVC warning C4146
- // return (A | B) & -(A | B);
- return (A | B) & (1 + ~(A | B));
-}
-
-/// \brief Aligns \c Addr to \c Alignment bytes, rounding up.
-///
-/// Alignment should be a power of two. This method rounds up, so
-/// alignAddr(7, 4) == 8 and alignAddr(8, 4) == 8.
-inline uintptr_t alignAddr(const void *Addr, size_t Alignment) {
- assert(Alignment && isPowerOf2_64((uint64_t)Alignment) &&
- "Alignment is not a power of two!");
-
- assert((uintptr_t)Addr + Alignment - 1 >= (uintptr_t)Addr);
-
- return (((uintptr_t)Addr + Alignment - 1) & ~(uintptr_t)(Alignment - 1));
-}
-
-/// \brief Returns the necessary adjustment for aligning \c Ptr to \c Alignment
-/// bytes, rounding up.
-inline size_t alignmentAdjustment(const void *Ptr, size_t Alignment) {
- return alignAddr(Ptr, Alignment) - (uintptr_t)Ptr;
-}
-
-/// NextPowerOf2 - Returns the next power of two (in 64-bits)
-/// that is strictly greater than A. Returns zero on overflow.
-inline uint64_t NextPowerOf2(uint64_t A) {
- A |= (A >> 1);
- A |= (A >> 2);
- A |= (A >> 4);
- A |= (A >> 8);
- A |= (A >> 16);
- A |= (A >> 32);
- return A + 1;
-}
-
-/// Returns the power of two which is less than or equal to the given value.
-/// Essentially, it is a floor operation across the domain of powers of two.
-inline uint64_t PowerOf2Floor(uint64_t A) {
- if (!A) return 0;
- return 1ull << (63 - countLeadingZeros(A, ZB_Undefined));
-}
-
-/// Returns the next integer (mod 2**64) that is greater than or equal to
-/// \p Value and is a multiple of \p Align. \p Align must be non-zero.
-///
-/// If non-zero \p Skew is specified, the return value will be a minimal
-/// integer that is greater than or equal to \p Value and equal to
-/// \p Align * N + \p Skew for some integer N. If \p Skew is larger than
-/// \p Align, its value is adjusted to '\p Skew mod \p Align'.
-///
-/// Examples:
-/// \code
-/// alignTo(5, 8) = 8
-/// alignTo(17, 8) = 24
-/// alignTo(~0LL, 8) = 0
-/// alignTo(321, 255) = 510
-///
-/// alignTo(5, 8, 7) = 7
-/// alignTo(17, 8, 1) = 17
-/// alignTo(~0LL, 8, 3) = 3
-/// alignTo(321, 255, 42) = 552
-/// \endcode
-inline uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew = 0) {
- Skew %= Align;
- return (Value + Align - 1 - Skew) / Align * Align + Skew;
-}
-
-/// Returns the largest uint64_t less than or equal to \p Value and is
-/// \p Skew mod \p Align. \p Align must be non-zero
-inline uint64_t alignDown(uint64_t Value, uint64_t Align, uint64_t Skew = 0) {
- Skew %= Align;
- return (Value - Skew) / Align * Align + Skew;
-}
-
-/// Returns the offset to the next integer (mod 2**64) that is greater than
-/// or equal to \p Value and is a multiple of \p Align. \p Align must be
-/// non-zero.
-inline uint64_t OffsetToAlignment(uint64_t Value, uint64_t Align) {
- return alignTo(Value, Align) - Value;
-}
-
-/// SignExtend32 - Sign extend B-bit number x to 32-bit int.
-/// Usage int32_t r = SignExtend32<5>(x);
-template <unsigned B> inline int32_t SignExtend32(uint32_t x) {
- return int32_t(x << (32 - B)) >> (32 - B);
-}
-
-/// \brief Sign extend number in the bottom B bits of X to a 32-bit int.
-/// Requires 0 < B <= 32.
-inline int32_t SignExtend32(uint32_t X, unsigned B) {
- return int32_t(X << (32 - B)) >> (32 - B);
-}
-
-/// SignExtend64 - Sign extend B-bit number x to 64-bit int.
-/// Usage int64_t r = SignExtend64<5>(x);
-template <unsigned B> inline int64_t SignExtend64(uint64_t x) {
- return int64_t(x << (64 - B)) >> (64 - B);
-}
-
-/// \brief Sign extend number in the bottom B bits of X to a 64-bit int.
-/// Requires 0 < B <= 64.
-inline int64_t SignExtend64(uint64_t X, unsigned B) {
- return int64_t(X << (64 - B)) >> (64 - B);
-}
-
-/// \brief Subtract two unsigned integers, X and Y, of type T and return their
-/// absolute value.
-template <typename T>
-typename std::enable_if<std::is_unsigned<T>::value, T>::type
-AbsoluteDifference(T X, T Y) {
- return std::max(X, Y) - std::min(X, Y);
-}
-
-/// \brief Add two unsigned integers, X and Y, of type T.
-/// Clamp the result to the maximum representable value of T on overflow.
-/// ResultOverflowed indicates if the result is larger than the maximum
-/// representable value of type T.
-template <typename T>
-typename std::enable_if<std::is_unsigned<T>::value, T>::type
-SaturatingAdd(T X, T Y, bool *ResultOverflowed = nullptr) {
- bool Dummy;
- bool &Overflowed = ResultOverflowed ? *ResultOverflowed : Dummy;
- // Hacker's Delight, p. 29
- T Z = X + Y;
- Overflowed = (Z < X || Z < Y);
- if (Overflowed)
- return std::numeric_limits<T>::max();
- else
- return Z;
-}
-
-/// \brief Multiply two unsigned integers, X and Y, of type T.
-/// Clamp the result to the maximum representable value of T on overflow.
-/// ResultOverflowed indicates if the result is larger than the maximum
-/// representable value of type T.
-template <typename T>
-typename std::enable_if<std::is_unsigned<T>::value, T>::type
-SaturatingMultiply(T X, T Y, bool *ResultOverflowed = nullptr) {
- bool Dummy;
- bool &Overflowed = ResultOverflowed ? *ResultOverflowed : Dummy;
-
- // Hacker's Delight, p. 30 has a different algorithm, but we don't use that
- // because it fails for uint16_t (where multiplication can have undefined
- // behavior due to promotion to int), and requires a division in addition
- // to the multiplication.
-
- Overflowed = false;
-
- // Log2(Z) would be either Log2Z or Log2Z + 1.
- // Special case: if X or Y is 0, Log2_64 gives -1, and Log2Z
- // will necessarily be less than Log2Max as desired.
- int Log2Z = Log2_64(X) + Log2_64(Y);
- const T Max = std::numeric_limits<T>::max();
- int Log2Max = Log2_64(Max);
- if (Log2Z < Log2Max) {
- return X * Y;
- }
- if (Log2Z > Log2Max) {
- Overflowed = true;
- return Max;
- }
-
- // We're going to use the top bit, and maybe overflow one
- // bit past it. Multiply all but the bottom bit then add
- // that on at the end.
- T Z = (X >> 1) * Y;
- if (Z & ~(Max >> 1)) {
- Overflowed = true;
- return Max;
- }
- Z <<= 1;
- if (X & 1)
- return SaturatingAdd(Z, Y, ResultOverflowed);
-
- return Z;
-}
-
-/// \brief Multiply two unsigned integers, X and Y, and add the unsigned
-/// integer, A to the product. Clamp the result to the maximum representable
-/// value of T on overflow. ResultOverflowed indicates if the result is larger
-/// than the maximum representable value of type T.
-/// Note that this is purely a convenience function as there is no distinction
-/// where overflow occurred in a 'fused' multiply-add for unsigned numbers.
-template <typename T>
-typename std::enable_if<std::is_unsigned<T>::value, T>::type
-SaturatingMultiplyAdd(T X, T Y, T A, bool *ResultOverflowed = nullptr) {
- bool Dummy;
- bool &Overflowed = ResultOverflowed ? *ResultOverflowed : Dummy;
-
- T Product = SaturatingMultiply(X, Y, &Overflowed);
- if (Overflowed)
- return Product;
-
- return SaturatingAdd(A, Product, &Overflowed);
-}
-
-} // namespace llvm
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/None.h b/third_party/ntcore_2017/wpiutil/include/llvm/None.h
deleted file mode 100644
index d69ec17..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/None.h
+++ /dev/null
@@ -1,26 +0,0 @@
-//===-- None.h - Simple null value for implicit construction ------*- C++ -*-=//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file provides None, an enumerator for use in implicit constructors
-// of various (usually templated) types to make such construction more
-// terse.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_NONE_H
-#define LLVM_ADT_NONE_H
-
-namespace llvm {
-/// \brief A simple null object to allow implicit construction of Optional<T>
-/// and similar types without having to spell out the specialization's name.
-enum class NoneType { None };
-const NoneType None = None;
-}
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/Optional.h b/third_party/ntcore_2017/wpiutil/include/llvm/Optional.h
deleted file mode 100644
index a494c56..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/Optional.h
+++ /dev/null
@@ -1,228 +0,0 @@
-//===-- Optional.h - Simple variant for passing optional values ---*- C++ -*-=//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file provides Optional, a template class modeled in the spirit of
-// OCaml's 'opt' variant. The idea is to strongly type whether or not
-// a value can be optional.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_OPTIONAL_H
-#define LLVM_ADT_OPTIONAL_H
-
-#include "llvm/None.h"
-#include "llvm/AlignOf.h"
-#include "llvm/Compiler.h"
-#include <cassert>
-#include <new>
-#include <utility>
-
-namespace llvm {
-
-template<typename T>
-class Optional {
- AlignedCharArrayUnion<T> storage;
- bool hasVal;
-public:
- typedef T value_type;
-
- Optional(NoneType) : hasVal(false) {}
- explicit Optional() : hasVal(false) {}
- Optional(const T &y) : hasVal(true) {
- new (storage.buffer) T(y);
- }
- Optional(const Optional &O) : hasVal(O.hasVal) {
- if (hasVal)
- new (storage.buffer) T(*O);
- }
-
- Optional(T &&y) : hasVal(true) {
- new (storage.buffer) T(std::forward<T>(y));
- }
- Optional(Optional<T> &&O) : hasVal(O) {
- if (O) {
- new (storage.buffer) T(std::move(*O));
- O.reset();
- }
- }
- Optional &operator=(T &&y) {
- if (hasVal)
- **this = std::move(y);
- else {
- new (storage.buffer) T(std::move(y));
- hasVal = true;
- }
- return *this;
- }
- Optional &operator=(Optional &&O) {
- if (!O)
- reset();
- else {
- *this = std::move(*O);
- O.reset();
- }
- return *this;
- }
-
- /// Create a new object by constructing it in place with the given arguments.
- template<typename ...ArgTypes>
- void emplace(ArgTypes &&...Args) {
- reset();
- hasVal = true;
- new (storage.buffer) T(std::forward<ArgTypes>(Args)...);
- }
-
- static inline Optional create(const T* y) {
- return y ? Optional(*y) : Optional();
- }
-
- // FIXME: these assignments (& the equivalent const T&/const Optional& ctors)
- // could be made more efficient by passing by value, possibly unifying them
- // with the rvalue versions above - but this could place a different set of
- // requirements (notably: the existence of a default ctor) when implemented
- // in that way. Careful SFINAE to avoid such pitfalls would be required.
- Optional &operator=(const T &y) {
- if (hasVal)
- **this = y;
- else {
- new (storage.buffer) T(y);
- hasVal = true;
- }
- return *this;
- }
-
- Optional &operator=(const Optional &O) {
- if (!O)
- reset();
- else
- *this = *O;
- return *this;
- }
-
- void reset() {
- if (hasVal) {
- (**this).~T();
- hasVal = false;
- }
- }
-
- ~Optional() {
- reset();
- }
-
- const T* getPointer() const { assert(hasVal); return reinterpret_cast<const T*>(storage.buffer); }
- T* getPointer() { assert(hasVal); return reinterpret_cast<T*>(storage.buffer); }
- const T& getValue() const LLVM_LVALUE_FUNCTION { assert(hasVal); return *getPointer(); }
- T& getValue() LLVM_LVALUE_FUNCTION { assert(hasVal); return *getPointer(); }
-
- explicit operator bool() const { return hasVal; }
- bool hasValue() const { return hasVal; }
- const T* operator->() const { return getPointer(); }
- T* operator->() { return getPointer(); }
- const T& operator*() const LLVM_LVALUE_FUNCTION { assert(hasVal); return *getPointer(); }
- T& operator*() LLVM_LVALUE_FUNCTION { assert(hasVal); return *getPointer(); }
-
- template <typename U>
- LLVM_CONSTEXPR T getValueOr(U &&value) const LLVM_LVALUE_FUNCTION {
- return hasValue() ? getValue() : std::forward<U>(value);
- }
-
-#if LLVM_HAS_RVALUE_REFERENCE_THIS
- T&& getValue() && { assert(hasVal); return std::move(*getPointer()); }
- T&& operator*() && { assert(hasVal); return std::move(*getPointer()); }
-
- template <typename U>
- T getValueOr(U &&value) && {
- return hasValue() ? std::move(getValue()) : std::forward<U>(value);
- }
-#endif
-};
-
-template <typename T> struct isPodLike;
-template <typename T> struct isPodLike<Optional<T> > {
- // An Optional<T> is pod-like if T is.
- static const bool value = isPodLike<T>::value;
-};
-
-/// \brief Poison comparison between two \c Optional objects. Clients needs to
-/// explicitly compare the underlying values and account for empty \c Optional
-/// objects.
-///
-/// This routine will never be defined. It returns \c void to help diagnose
-/// errors at compile time.
-template<typename T, typename U>
-void operator==(const Optional<T> &X, const Optional<U> &Y);
-
-template<typename T>
-bool operator==(const Optional<T> &X, NoneType) {
- return !X.hasValue();
-}
-
-template<typename T>
-bool operator==(NoneType, const Optional<T> &X) {
- return X == None;
-}
-
-template<typename T>
-bool operator!=(const Optional<T> &X, NoneType) {
- return !(X == None);
-}
-
-template<typename T>
-bool operator!=(NoneType, const Optional<T> &X) {
- return X != None;
-}
-/// \brief Poison comparison between two \c Optional objects. Clients needs to
-/// explicitly compare the underlying values and account for empty \c Optional
-/// objects.
-///
-/// This routine will never be defined. It returns \c void to help diagnose
-/// errors at compile time.
-template<typename T, typename U>
-void operator!=(const Optional<T> &X, const Optional<U> &Y);
-
-/// \brief Poison comparison between two \c Optional objects. Clients needs to
-/// explicitly compare the underlying values and account for empty \c Optional
-/// objects.
-///
-/// This routine will never be defined. It returns \c void to help diagnose
-/// errors at compile time.
-template<typename T, typename U>
-void operator<(const Optional<T> &X, const Optional<U> &Y);
-
-/// \brief Poison comparison between two \c Optional objects. Clients needs to
-/// explicitly compare the underlying values and account for empty \c Optional
-/// objects.
-///
-/// This routine will never be defined. It returns \c void to help diagnose
-/// errors at compile time.
-template<typename T, typename U>
-void operator<=(const Optional<T> &X, const Optional<U> &Y);
-
-/// \brief Poison comparison between two \c Optional objects. Clients needs to
-/// explicitly compare the underlying values and account for empty \c Optional
-/// objects.
-///
-/// This routine will never be defined. It returns \c void to help diagnose
-/// errors at compile time.
-template<typename T, typename U>
-void operator>=(const Optional<T> &X, const Optional<U> &Y);
-
-/// \brief Poison comparison between two \c Optional objects. Clients needs to
-/// explicitly compare the underlying values and account for empty \c Optional
-/// objects.
-///
-/// This routine will never be defined. It returns \c void to help diagnose
-/// errors at compile time.
-template<typename T, typename U>
-void operator>(const Optional<T> &X, const Optional<U> &Y);
-
-} // end llvm namespace
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/PointerLikeTypeTraits.h b/third_party/ntcore_2017/wpiutil/include/llvm/PointerLikeTypeTraits.h
deleted file mode 100644
index 3b96694..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/PointerLikeTypeTraits.h
+++ /dev/null
@@ -1,94 +0,0 @@
-//===- llvm/Support/PointerLikeTypeTraits.h - Pointer Traits ----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the PointerLikeTypeTraits class. This allows data
-// structures to reason about pointers and other things that are pointer sized.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_POINTERLIKETYPETRAITS_H
-#define LLVM_SUPPORT_POINTERLIKETYPETRAITS_H
-
-#include "llvm/AlignOf.h"
-#include <cstdint>
-
-namespace llvm {
-
-/// A traits type that is used to handle pointer types and things that are just
-/// wrappers for pointers as a uniform entity.
-template <typename T> class PointerLikeTypeTraits {
- // getAsVoidPointer
- // getFromVoidPointer
- // getNumLowBitsAvailable
-};
-
-namespace detail {
-/// A tiny meta function to compute the log2 of a compile time constant.
-template <size_t N>
-struct ConstantLog2
- : std::integral_constant<size_t, ConstantLog2<N / 2>::value + 1> {};
-template <> struct ConstantLog2<1> : std::integral_constant<size_t, 0> {};
-}
-
-// Provide PointerLikeTypeTraits for non-cvr pointers.
-template <typename T> class PointerLikeTypeTraits<T *> {
-public:
- static inline void *getAsVoidPointer(T *P) { return P; }
- static inline T *getFromVoidPointer(void *P) { return static_cast<T *>(P); }
-
- enum {
- NumLowBitsAvailable = detail::ConstantLog2<AlignOf<T>::Alignment>::value
- };
-};
-
-template <> class PointerLikeTypeTraits<void *> {
-public:
- static inline void *getAsVoidPointer(void *P) { return P; }
- static inline void *getFromVoidPointer(void *P) { return P; }
-
- /// Note, we assume here that void* is related to raw malloc'ed memory and
- /// that malloc returns objects at least 4-byte aligned. However, this may be
- /// wrong, or pointers may be from something other than malloc. In this case,
- /// you should specify a real typed pointer or avoid this template.
- ///
- /// All clients should use assertions to do a run-time check to ensure that
- /// this is actually true.
- enum { NumLowBitsAvailable = 2 };
-};
-
-// Provide PointerLikeTypeTraits for const pointers.
-template <typename T> class PointerLikeTypeTraits<const T *> {
- typedef PointerLikeTypeTraits<T *> NonConst;
-
-public:
- static inline const void *getAsVoidPointer(const T *P) {
- return NonConst::getAsVoidPointer(const_cast<T *>(P));
- }
- static inline const T *getFromVoidPointer(const void *P) {
- return NonConst::getFromVoidPointer(const_cast<void *>(P));
- }
- enum { NumLowBitsAvailable = NonConst::NumLowBitsAvailable };
-};
-
-// Provide PointerLikeTypeTraits for uintptr_t.
-template <> class PointerLikeTypeTraits<uintptr_t> {
-public:
- static inline void *getAsVoidPointer(uintptr_t P) {
- return reinterpret_cast<void *>(P);
- }
- static inline uintptr_t getFromVoidPointer(void *P) {
- return reinterpret_cast<uintptr_t>(P);
- }
- // No bits are available!
- enum { NumLowBitsAvailable = 0 };
-};
-
-} // end namespace llvm
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/STLExtras.h b/third_party/ntcore_2017/wpiutil/include/llvm/STLExtras.h
deleted file mode 100644
index 1b43f30..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/STLExtras.h
+++ /dev/null
@@ -1,521 +0,0 @@
-//===- llvm/ADT/STLExtras.h - Useful STL related functions ------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains some templates that are useful if you are working with the
-// STL at all.
-//
-// No library is required when using these functions.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_STLEXTRAS_H
-#define LLVM_ADT_STLEXTRAS_H
-
-#include <algorithm> // for std::all_of
-#include <cassert>
-#include <cstddef> // for std::size_t
-#include <cstdlib> // for qsort
-#include <functional>
-#include <iterator>
-#include <memory>
-#include <utility> // for std::pair
-
-#include "llvm/iterator_range.h"
-#include "llvm/Compiler.h"
-
-namespace llvm {
-
-//===----------------------------------------------------------------------===//
-// Extra additions to <functional>
-//===----------------------------------------------------------------------===//
-
-template<class Ty>
-struct identity : public std::unary_function<Ty, Ty> {
- Ty &operator()(Ty &self) const {
- return self;
- }
- const Ty &operator()(const Ty &self) const {
- return self;
- }
-};
-
-template<class Ty>
-struct less_ptr : public std::binary_function<Ty, Ty, bool> {
- bool operator()(const Ty* left, const Ty* right) const {
- return *left < *right;
- }
-};
-
-template<class Ty>
-struct greater_ptr : public std::binary_function<Ty, Ty, bool> {
- bool operator()(const Ty* left, const Ty* right) const {
- return *right < *left;
- }
-};
-
-/// An efficient, type-erasing, non-owning reference to a callable. This is
-/// intended for use as the type of a function parameter that is not used
-/// after the function in question returns.
-///
-/// This class does not own the callable, so it is not in general safe to store
-/// a function_ref.
-template<typename Fn> class function_ref;
-
-template<typename Ret, typename ...Params>
-class function_ref<Ret(Params...)> {
- Ret (*callback)(intptr_t callable, Params ...params);
- intptr_t callable;
-
- template<typename Callable>
- static Ret callback_fn(intptr_t callable, Params ...params) {
- return (*reinterpret_cast<Callable*>(callable))(
- std::forward<Params>(params)...);
- }
-
-public:
- template <typename Callable>
- function_ref(Callable &&callable,
- typename std::enable_if<
- !std::is_same<typename std::remove_reference<Callable>::type,
- function_ref>::value>::type * = nullptr)
- : callback(callback_fn<typename std::remove_reference<Callable>::type>),
- callable(reinterpret_cast<intptr_t>(&callable)) {}
- Ret operator()(Params ...params) const {
- return callback(callable, std::forward<Params>(params)...);
- }
-};
-
-// deleter - Very very very simple method that is used to invoke operator
-// delete on something. It is used like this:
-//
-// for_each(V.begin(), B.end(), deleter<Interval>);
-//
-template <class T>
-inline void deleter(T *Ptr) {
- delete Ptr;
-}
-
-
-
-//===----------------------------------------------------------------------===//
-// Extra additions to <iterator>
-//===----------------------------------------------------------------------===//
-
-// mapped_iterator - This is a simple iterator adapter that causes a function to
-// be dereferenced whenever operator* is invoked on the iterator.
-//
-template <class RootIt, class UnaryFunc>
-class mapped_iterator {
- RootIt current;
- UnaryFunc Fn;
-public:
- typedef typename std::iterator_traits<RootIt>::iterator_category
- iterator_category;
- typedef typename std::iterator_traits<RootIt>::difference_type
- difference_type;
- typedef typename std::result_of<
- UnaryFunc(decltype(*std::declval<RootIt>()))>
- ::type value_type;
-
- typedef void pointer;
- //typedef typename UnaryFunc::result_type *pointer;
- typedef void reference; // Can't modify value returned by fn
-
- typedef RootIt iterator_type;
-
- inline const RootIt &getCurrent() const { return current; }
- inline const UnaryFunc &getFunc() const { return Fn; }
-
- inline explicit mapped_iterator(const RootIt &I, UnaryFunc F)
- : current(I), Fn(F) {}
-
- inline value_type operator*() const { // All this work to do this
- return Fn(*current); // little change
- }
-
- mapped_iterator &operator++() {
- ++current;
- return *this;
- }
- mapped_iterator &operator--() {
- --current;
- return *this;
- }
- mapped_iterator operator++(int) {
- mapped_iterator __tmp = *this;
- ++current;
- return __tmp;
- }
- mapped_iterator operator--(int) {
- mapped_iterator __tmp = *this;
- --current;
- return __tmp;
- }
- mapped_iterator operator+(difference_type n) const {
- return mapped_iterator(current + n, Fn);
- }
- mapped_iterator &operator+=(difference_type n) {
- current += n;
- return *this;
- }
- mapped_iterator operator-(difference_type n) const {
- return mapped_iterator(current - n, Fn);
- }
- mapped_iterator &operator-=(difference_type n) {
- current -= n;
- return *this;
- }
- reference operator[](difference_type n) const { return *(*this + n); }
-
- bool operator!=(const mapped_iterator &X) const { return !operator==(X); }
- bool operator==(const mapped_iterator &X) const {
- return current == X.current;
- }
- bool operator<(const mapped_iterator &X) const { return current < X.current; }
-
- difference_type operator-(const mapped_iterator &X) const {
- return current - X.current;
- }
-};
-
-template <class Iterator, class Func>
-inline mapped_iterator<Iterator, Func>
-operator+(typename mapped_iterator<Iterator, Func>::difference_type N,
- const mapped_iterator<Iterator, Func> &X) {
- return mapped_iterator<Iterator, Func>(X.getCurrent() - N, X.getFunc());
-}
-
-
-// map_iterator - Provide a convenient way to create mapped_iterators, just like
-// make_pair is useful for creating pairs...
-//
-template <class ItTy, class FuncTy>
-inline mapped_iterator<ItTy, FuncTy> map_iterator(const ItTy &I, FuncTy F) {
- return mapped_iterator<ItTy, FuncTy>(I, F);
-}
-
-/// \brief Metafunction to determine if type T has a member called rbegin().
-template <typename T> struct has_rbegin {
- template <typename U> static char(&f(const U &, decltype(&U::rbegin)))[1];
- static char(&f(...))[2];
- const static bool value = sizeof(f(std::declval<T>(), nullptr)) == 1;
-};
-
-// Returns an iterator_range over the given container which iterates in reverse.
-// Note that the container must have rbegin()/rend() methods for this to work.
-template <typename ContainerTy>
-auto reverse(ContainerTy &&C,
- typename std::enable_if<has_rbegin<ContainerTy>::value>::type * =
- nullptr) -> decltype(make_range(C.rbegin(), C.rend())) {
- return make_range(C.rbegin(), C.rend());
-}
-
-// Returns a std::reverse_iterator wrapped around the given iterator.
-template <typename IteratorTy>
-std::reverse_iterator<IteratorTy> make_reverse_iterator(IteratorTy It) {
- return std::reverse_iterator<IteratorTy>(It);
-}
-
-// Returns an iterator_range over the given container which iterates in reverse.
-// Note that the container must have begin()/end() methods which return
-// bidirectional iterators for this to work.
-template <typename ContainerTy>
-auto reverse(
- ContainerTy &&C,
- typename std::enable_if<!has_rbegin<ContainerTy>::value>::type * = nullptr)
- -> decltype(make_range(llvm::make_reverse_iterator(std::end(C)),
- llvm::make_reverse_iterator(std::begin(C)))) {
- return make_range(llvm::make_reverse_iterator(std::end(C)),
- llvm::make_reverse_iterator(std::begin(C)));
-}
-
-//===----------------------------------------------------------------------===//
-// Extra additions to <utility>
-//===----------------------------------------------------------------------===//
-
-/// \brief Function object to check whether the first component of a std::pair
-/// compares less than the first component of another std::pair.
-struct less_first {
- template <typename T> bool operator()(const T &lhs, const T &rhs) const {
- return lhs.first < rhs.first;
- }
-};
-
-/// \brief Function object to check whether the second component of a std::pair
-/// compares less than the second component of another std::pair.
-struct less_second {
- template <typename T> bool operator()(const T &lhs, const T &rhs) const {
- return lhs.second < rhs.second;
- }
-};
-
-// A subset of N3658. More stuff can be added as-needed.
-
-/// \brief Represents a compile-time sequence of integers.
-template <class T, T... I> struct integer_sequence {
- typedef T value_type;
-
- static LLVM_CONSTEXPR size_t size() { return sizeof...(I); }
-};
-
-/// \brief Alias for the common case of a sequence of size_ts.
-template <size_t... I>
-struct index_sequence : integer_sequence<std::size_t, I...> {};
-
-template <std::size_t N, std::size_t... I>
-struct build_index_impl : build_index_impl<N - 1, N - 1, I...> {};
-template <std::size_t... I>
-struct build_index_impl<0, I...> : index_sequence<I...> {};
-
-/// \brief Creates a compile-time integer sequence for a parameter pack.
-template <class... Ts>
-struct index_sequence_for : build_index_impl<sizeof...(Ts)> {};
-
-//===----------------------------------------------------------------------===//
-// Extra additions for arrays
-//===----------------------------------------------------------------------===//
-
-/// Find the length of an array.
-template <class T, std::size_t N>
-LLVM_CONSTEXPR inline size_t array_lengthof(T (&)[N]) {
- return N;
-}
-
-/// Adapt std::less<T> for array_pod_sort.
-template<typename T>
-inline int array_pod_sort_comparator(const void *P1, const void *P2) {
- if (std::less<T>()(*reinterpret_cast<const T*>(P1),
- *reinterpret_cast<const T*>(P2)))
- return -1;
- if (std::less<T>()(*reinterpret_cast<const T*>(P2),
- *reinterpret_cast<const T*>(P1)))
- return 1;
- return 0;
-}
-
-/// get_array_pod_sort_comparator - This is an internal helper function used to
-/// get type deduction of T right.
-template<typename T>
-inline int (*get_array_pod_sort_comparator(const T &))
- (const void*, const void*) {
- return array_pod_sort_comparator<T>;
-}
-
-
-/// array_pod_sort - This sorts an array with the specified start and end
-/// extent. This is just like std::sort, except that it calls qsort instead of
-/// using an inlined template. qsort is slightly slower than std::sort, but
-/// most sorts are not performance critical in LLVM and std::sort has to be
-/// template instantiated for each type, leading to significant measured code
-/// bloat. This function should generally be used instead of std::sort where
-/// possible.
-///
-/// This function assumes that you have simple POD-like types that can be
-/// compared with std::less and can be moved with memcpy. If this isn't true,
-/// you should use std::sort.
-///
-/// NOTE: If qsort_r were portable, we could allow a custom comparator and
-/// default to std::less.
-template<class IteratorTy>
-inline void array_pod_sort(IteratorTy Start, IteratorTy End) {
- // Don't inefficiently call qsort with one element or trigger undefined
- // behavior with an empty sequence.
- auto NElts = End - Start;
- if (NElts <= 1) return;
- qsort(&*Start, NElts, sizeof(*Start), get_array_pod_sort_comparator(*Start));
-}
-
-template <class IteratorTy>
-inline void array_pod_sort(
- IteratorTy Start, IteratorTy End,
- int (*Compare)(
- const typename std::iterator_traits<IteratorTy>::value_type *,
- const typename std::iterator_traits<IteratorTy>::value_type *)) {
- // Don't inefficiently call qsort with one element or trigger undefined
- // behavior with an empty sequence.
- auto NElts = End - Start;
- if (NElts <= 1) return;
- qsort(&*Start, NElts, sizeof(*Start),
- reinterpret_cast<int (*)(const void *, const void *)>(Compare));
-}
-
-//===----------------------------------------------------------------------===//
-// Extra additions to <algorithm>
-//===----------------------------------------------------------------------===//
-
-/// For a container of pointers, deletes the pointers and then clears the
-/// container.
-template<typename Container>
-void DeleteContainerPointers(Container &C) {
- for (typename Container::iterator I = C.begin(), E = C.end(); I != E; ++I)
- delete *I;
- C.clear();
-}
-
-/// In a container of pairs (usually a map) whose second element is a pointer,
-/// deletes the second elements and then clears the container.
-template<typename Container>
-void DeleteContainerSeconds(Container &C) {
- for (typename Container::iterator I = C.begin(), E = C.end(); I != E; ++I)
- delete I->second;
- C.clear();
-}
-
-/// Provide wrappers to std::all_of which take ranges instead of having to pass
-/// begin/end explicitly.
-template<typename R, class UnaryPredicate>
-bool all_of(R &&Range, UnaryPredicate &&P) {
- return std::all_of(Range.begin(), Range.end(),
- std::forward<UnaryPredicate>(P));
-}
-
-/// Provide wrappers to std::any_of which take ranges instead of having to pass
-/// begin/end explicitly.
-template <typename R, class UnaryPredicate>
-bool any_of(R &&Range, UnaryPredicate &&P) {
- return std::any_of(Range.begin(), Range.end(),
- std::forward<UnaryPredicate>(P));
-}
-
-/// Provide wrappers to std::none_of which take ranges instead of having to pass
-/// begin/end explicitly.
-template <typename R, class UnaryPredicate>
-bool none_of(R &&Range, UnaryPredicate &&P) {
- return std::none_of(Range.begin(), Range.end(),
- std::forward<UnaryPredicate>(P));
-}
-
-/// Provide wrappers to std::find which take ranges instead of having to pass
-/// begin/end explicitly.
-template<typename R, class T>
-auto find(R &&Range, const T &val) -> decltype(Range.begin()) {
- return std::find(Range.begin(), Range.end(), val);
-}
-
-/// Provide wrappers to std::find_if which take ranges instead of having to pass
-/// begin/end explicitly.
-template <typename R, class T>
-auto find_if(R &&Range, const T &Pred) -> decltype(Range.begin()) {
- return std::find_if(Range.begin(), Range.end(), Pred);
-}
-
-/// Provide wrappers to std::remove_if which take ranges instead of having to
-/// pass begin/end explicitly.
-template<typename R, class UnaryPredicate>
-auto remove_if(R &&Range, UnaryPredicate &&P) -> decltype(Range.begin()) {
- return std::remove_if(Range.begin(), Range.end(), P);
-}
-
-/// Wrapper function around std::find to detect if an element exists
-/// in a container.
-template <typename R, typename E>
-bool is_contained(R &&Range, const E &Element) {
- return std::find(Range.begin(), Range.end(), Element) != Range.end();
-}
-
-/// Wrapper function around std::count_if to count the number of times an
-/// element satisfying a given predicate occurs in a range.
-template <typename R, typename UnaryPredicate>
-auto count_if(R &&Range, UnaryPredicate &&P)
- -> typename std::iterator_traits<decltype(Range.begin())>::difference_type {
- return std::count_if(Range.begin(), Range.end(), P);
-}
-
-/// Wrapper function around std::transform to apply a function to a range and
-/// store the result elsewhere.
-template <typename R, class OutputIt, typename UnaryPredicate>
-OutputIt transform(R &&Range, OutputIt d_first, UnaryPredicate &&P) {
- return std::transform(Range.begin(), Range.end(), d_first,
- std::forward<UnaryPredicate>(P));
-}
-
-//===----------------------------------------------------------------------===//
-// Extra additions to <memory>
-//===----------------------------------------------------------------------===//
-
-// Implement make_unique according to N3656.
-
-/// \brief Constructs a `new T()` with the given args and returns a
-/// `unique_ptr<T>` which owns the object.
-///
-/// Example:
-///
-/// auto p = make_unique<int>();
-/// auto p = make_unique<std::tuple<int, int>>(0, 1);
-template <class T, class... Args>
-typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
-make_unique(Args &&... args) {
- return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
-}
-
-/// \brief Constructs a `new T[n]` with the given args and returns a
-/// `unique_ptr<T[]>` which owns the object.
-///
-/// \param n size of the new array.
-///
-/// Example:
-///
-/// auto p = make_unique<int[]>(2); // value-initializes the array with 0's.
-template <class T>
-typename std::enable_if<std::is_array<T>::value && std::extent<T>::value == 0,
- std::unique_ptr<T>>::type
-make_unique(size_t n) {
- return std::unique_ptr<T>(new typename std::remove_extent<T>::type[n]());
-}
-
-/// This function isn't used and is only here to provide better compile errors.
-template <class T, class... Args>
-typename std::enable_if<std::extent<T>::value != 0>::type
-make_unique(Args &&...) = delete;
-
-struct FreeDeleter {
- void operator()(void* v) {
- ::free(v);
- }
-};
-
-template<typename First, typename Second>
-struct pair_hash {
- size_t operator()(const std::pair<First, Second> &P) const {
- return std::hash<First>()(P.first) * 31 + std::hash<Second>()(P.second);
- }
-};
-
-/// A functor like C++14's std::less<void> in its absence.
-struct less {
- template <typename A, typename B> bool operator()(A &&a, B &&b) const {
- return std::forward<A>(a) < std::forward<B>(b);
- }
-};
-
-/// A functor like C++14's std::equal<void> in its absence.
-struct equal {
- template <typename A, typename B> bool operator()(A &&a, B &&b) const {
- return std::forward<A>(a) == std::forward<B>(b);
- }
-};
-
-/// Binary functor that adapts to any other binary functor after dereferencing
-/// operands.
-template <typename T> struct deref {
- T func;
- // Could be further improved to cope with non-derivable functors and
- // non-binary functors (should be a variadic template member function
- // operator()).
- template <typename A, typename B>
- auto operator()(A &lhs, B &rhs) const -> decltype(func(*lhs, *rhs)) {
- assert(lhs);
- assert(rhs);
- return func(*lhs, *rhs);
- }
-};
-
-} // End llvm namespace
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/SmallPtrSet.h b/third_party/ntcore_2017/wpiutil/include/llvm/SmallPtrSet.h
deleted file mode 100644
index b78e1fd..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/SmallPtrSet.h
+++ /dev/null
@@ -1,406 +0,0 @@
-//===- llvm/ADT/SmallPtrSet.h - 'Normally small' pointer set ----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the SmallPtrSet class. See the doxygen comment for
-// SmallPtrSetImplBase for more details on the algorithm used.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_SMALLPTRSET_H
-#define LLVM_ADT_SMALLPTRSET_H
-
-#include "llvm/Compiler.h"
-#include "llvm/PointerLikeTypeTraits.h"
-#include <cassert>
-#include <cstddef>
-#include <cstdint>
-#include <cstring>
-#include <cstdlib>
-#include <iterator>
-#include <utility>
-
-namespace llvm {
-
-class SmallPtrSetIteratorImpl;
-
-/// SmallPtrSetImplBase - This is the common code shared among all the
-/// SmallPtrSet<>'s, which is almost everything. SmallPtrSet has two modes, one
-/// for small and one for large sets.
-///
-/// Small sets use an array of pointers allocated in the SmallPtrSet object,
-/// which is treated as a simple array of pointers. When a pointer is added to
-/// the set, the array is scanned to see if the element already exists, if not
-/// the element is 'pushed back' onto the array. If we run out of space in the
-/// array, we grow into the 'large set' case. SmallSet should be used when the
-/// sets are often small. In this case, no memory allocation is used, and only
-/// light-weight and cache-efficient scanning is used.
-///
-/// Large sets use a classic exponentially-probed hash table. Empty buckets are
-/// represented with an illegal pointer value (-1) to allow null pointers to be
-/// inserted. Tombstones are represented with another illegal pointer value
-/// (-2), to allow deletion. The hash table is resized when the table is 3/4 or
-/// more. When this happens, the table is doubled in size.
-///
-class SmallPtrSetImplBase {
- friend class SmallPtrSetIteratorImpl;
-
-protected:
- /// SmallArray - Points to a fixed size set of buckets, used in 'small mode'.
- const void **SmallArray;
- /// CurArray - This is the current set of buckets. If equal to SmallArray,
- /// then the set is in 'small mode'.
- const void **CurArray;
- /// CurArraySize - The allocated size of CurArray, always a power of two.
- unsigned CurArraySize;
-
- /// Number of elements in CurArray that contain a value or are a tombstone.
- /// If small, all these elements are at the beginning of CurArray and the rest
- /// is uninitialized.
- unsigned NumNonEmpty;
- /// Number of tombstones in CurArray.
- unsigned NumTombstones;
-
- // Helpers to copy and move construct a SmallPtrSet.
- SmallPtrSetImplBase(const void **SmallStorage,
- const SmallPtrSetImplBase &that);
- SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize,
- SmallPtrSetImplBase &&that);
- explicit SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize)
- : SmallArray(SmallStorage), CurArray(SmallStorage),
- CurArraySize(SmallSize), NumNonEmpty(0), NumTombstones(0) {
- assert(SmallSize && (SmallSize & (SmallSize-1)) == 0 &&
- "Initial size must be a power of two!");
- }
- ~SmallPtrSetImplBase() {
- if (!isSmall())
- free(CurArray);
- }
-
-public:
- typedef unsigned size_type;
- bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { return size() == 0; }
- size_type size() const { return NumNonEmpty - NumTombstones; }
-
- void clear() {
- // If the capacity of the array is huge, and the # elements used is small,
- // shrink the array.
- if (!isSmall()) {
- if (size() * 4 < CurArraySize && CurArraySize > 32)
- return shrink_and_clear();
- // Fill the array with empty markers.
- memset(CurArray, -1, CurArraySize * sizeof(void *));
- }
-
- NumNonEmpty = 0;
- NumTombstones = 0;
- }
-
-protected:
- static void *getTombstoneMarker() { return reinterpret_cast<void*>(-2); }
- static void *getEmptyMarker() {
- // Note that -1 is chosen to make clear() efficiently implementable with
- // memset and because it's not a valid pointer value.
- return reinterpret_cast<void*>(-1);
- }
-
- const void **EndPointer() const {
- return isSmall() ? CurArray + NumNonEmpty : CurArray + CurArraySize;
- }
-
- /// insert_imp - This returns true if the pointer was new to the set, false if
- /// it was already in the set. This is hidden from the client so that the
- /// derived class can check that the right type of pointer is passed in.
- std::pair<const void *const *, bool> insert_imp(const void *Ptr) {
- if (isSmall()) {
- // Check to see if it is already in the set.
- const void **LastTombstone = nullptr;
- for (const void **APtr = SmallArray, **E = SmallArray + NumNonEmpty;
- APtr != E; ++APtr) {
- const void *Value = *APtr;
- if (Value == Ptr)
- return std::make_pair(APtr, false);
- if (Value == getTombstoneMarker())
- LastTombstone = APtr;
- }
-
- // Did we find any tombstone marker?
- if (LastTombstone != nullptr) {
- *LastTombstone = Ptr;
- --NumTombstones;
- return std::make_pair(LastTombstone, true);
- }
-
- // Nope, there isn't. If we stay small, just 'pushback' now.
- if (NumNonEmpty < CurArraySize) {
- SmallArray[NumNonEmpty++] = Ptr;
- return std::make_pair(SmallArray + (NumNonEmpty - 1), true);
- }
- // Otherwise, hit the big set case, which will call grow.
- }
- return insert_imp_big(Ptr);
- }
-
- /// erase_imp - If the set contains the specified pointer, remove it and
- /// return true, otherwise return false. This is hidden from the client so
- /// that the derived class can check that the right type of pointer is passed
- /// in.
- bool erase_imp(const void * Ptr);
-
- bool count_imp(const void * Ptr) const {
- if (isSmall()) {
- // Linear search for the item.
- for (const void *const *APtr = SmallArray,
- *const *E = SmallArray + NumNonEmpty; APtr != E; ++APtr)
- if (*APtr == Ptr)
- return true;
- return false;
- }
-
- // Big set case.
- return *FindBucketFor(Ptr) == Ptr;
- }
-
-private:
- bool isSmall() const { return CurArray == SmallArray; }
-
- std::pair<const void *const *, bool> insert_imp_big(const void *Ptr);
-
- const void * const *FindBucketFor(const void *Ptr) const;
- void shrink_and_clear();
-
- /// Grow - Allocate a larger backing store for the buckets and move it over.
- void Grow(unsigned NewSize);
-
- void operator=(const SmallPtrSetImplBase &RHS) = delete;
-
-protected:
- /// swap - Swaps the elements of two sets.
- /// Note: This method assumes that both sets have the same small size.
- void swap(SmallPtrSetImplBase &RHS);
-
- void CopyFrom(const SmallPtrSetImplBase &RHS);
- void MoveFrom(unsigned SmallSize, SmallPtrSetImplBase &&RHS);
-
-private:
- /// Code shared by MoveFrom() and move constructor.
- void MoveHelper(unsigned SmallSize, SmallPtrSetImplBase &&RHS);
- /// Code shared by CopyFrom() and copy constructor.
- void CopyHelper(const SmallPtrSetImplBase &RHS);
-};
-
-/// SmallPtrSetIteratorImpl - This is the common base class shared between all
-/// instances of SmallPtrSetIterator.
-class SmallPtrSetIteratorImpl {
-protected:
- const void *const *Bucket;
- const void *const *End;
-
-public:
- explicit SmallPtrSetIteratorImpl(const void *const *BP, const void*const *E)
- : Bucket(BP), End(E) {
- AdvanceIfNotValid();
- }
-
- bool operator==(const SmallPtrSetIteratorImpl &RHS) const {
- return Bucket == RHS.Bucket;
- }
- bool operator!=(const SmallPtrSetIteratorImpl &RHS) const {
- return Bucket != RHS.Bucket;
- }
-
-protected:
- /// AdvanceIfNotValid - If the current bucket isn't valid, advance to a bucket
- /// that is. This is guaranteed to stop because the end() bucket is marked
- /// valid.
- void AdvanceIfNotValid() {
- assert(Bucket <= End);
- while (Bucket != End &&
- (*Bucket == SmallPtrSetImplBase::getEmptyMarker() ||
- *Bucket == SmallPtrSetImplBase::getTombstoneMarker()))
- ++Bucket;
- }
-};
-
-/// SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
-template<typename PtrTy>
-class SmallPtrSetIterator : public SmallPtrSetIteratorImpl {
- typedef PointerLikeTypeTraits<PtrTy> PtrTraits;
-
-public:
- typedef PtrTy value_type;
- typedef PtrTy reference;
- typedef PtrTy pointer;
- typedef std::ptrdiff_t difference_type;
- typedef std::forward_iterator_tag iterator_category;
-
- explicit SmallPtrSetIterator(const void *const *BP, const void *const *E)
- : SmallPtrSetIteratorImpl(BP, E) {}
-
- // Most methods provided by baseclass.
-
- const PtrTy operator*() const {
- assert(Bucket < End);
- return PtrTraits::getFromVoidPointer(const_cast<void*>(*Bucket));
- }
-
- inline SmallPtrSetIterator& operator++() { // Preincrement
- ++Bucket;
- AdvanceIfNotValid();
- return *this;
- }
-
- SmallPtrSetIterator operator++(int) { // Postincrement
- SmallPtrSetIterator tmp = *this; ++*this; return tmp;
- }
-};
-
-/// RoundUpToPowerOfTwo - This is a helper template that rounds N up to the next
-/// power of two (which means N itself if N is already a power of two).
-template<unsigned N>
-struct RoundUpToPowerOfTwo;
-
-/// RoundUpToPowerOfTwoH - If N is not a power of two, increase it. This is a
-/// helper template used to implement RoundUpToPowerOfTwo.
-template<unsigned N, bool isPowerTwo>
-struct RoundUpToPowerOfTwoH {
- enum { Val = N };
-};
-template<unsigned N>
-struct RoundUpToPowerOfTwoH<N, false> {
- enum {
- // We could just use NextVal = N+1, but this converges faster. N|(N-1) sets
- // the right-most zero bits to one all at once, e.g. 0b0011000 -> 0b0011111.
- Val = RoundUpToPowerOfTwo<(N|(N-1)) + 1>::Val
- };
-};
-
-template<unsigned N>
-struct RoundUpToPowerOfTwo {
- enum { Val = RoundUpToPowerOfTwoH<N, (N&(N-1)) == 0>::Val };
-};
-
-/// \brief A templated base class for \c SmallPtrSet which provides the
-/// typesafe interface that is common across all small sizes.
-///
-/// This is particularly useful for passing around between interface boundaries
-/// to avoid encoding a particular small size in the interface boundary.
-template <typename PtrType>
-class SmallPtrSetImpl : public SmallPtrSetImplBase {
- typedef PointerLikeTypeTraits<PtrType> PtrTraits;
-
- SmallPtrSetImpl(const SmallPtrSetImpl &) = delete;
-
-protected:
- // Constructors that forward to the base.
- SmallPtrSetImpl(const void **SmallStorage, const SmallPtrSetImpl &that)
- : SmallPtrSetImplBase(SmallStorage, that) {}
- SmallPtrSetImpl(const void **SmallStorage, unsigned SmallSize,
- SmallPtrSetImpl &&that)
- : SmallPtrSetImplBase(SmallStorage, SmallSize, std::move(that)) {}
- explicit SmallPtrSetImpl(const void **SmallStorage, unsigned SmallSize)
- : SmallPtrSetImplBase(SmallStorage, SmallSize) {}
-
-public:
- typedef SmallPtrSetIterator<PtrType> iterator;
- typedef SmallPtrSetIterator<PtrType> const_iterator;
-
- /// Inserts Ptr if and only if there is no element in the container equal to
- /// Ptr. The bool component of the returned pair is true if and only if the
- /// insertion takes place, and the iterator component of the pair points to
- /// the element equal to Ptr.
- std::pair<iterator, bool> insert(PtrType Ptr) {
- auto p = insert_imp(PtrTraits::getAsVoidPointer(Ptr));
- return std::make_pair(iterator(p.first, EndPointer()), p.second);
- }
-
- /// erase - If the set contains the specified pointer, remove it and return
- /// true, otherwise return false.
- bool erase(PtrType Ptr) {
- return erase_imp(PtrTraits::getAsVoidPointer(Ptr));
- }
-
- /// count - Return 1 if the specified pointer is in the set, 0 otherwise.
- size_type count(PtrType Ptr) const {
- return count_imp(PtrTraits::getAsVoidPointer(Ptr)) ? 1 : 0;
- }
-
- template <typename IterT>
- void insert(IterT I, IterT E) {
- for (; I != E; ++I)
- insert(*I);
- }
-
- inline iterator begin() const {
- return iterator(CurArray, EndPointer());
- }
- inline iterator end() const {
- const void *const *End = EndPointer();
- return iterator(End, End);
- }
-};
-
-/// SmallPtrSet - This class implements a set which is optimized for holding
-/// SmallSize or less elements. This internally rounds up SmallSize to the next
-/// power of two if it is not already a power of two. See the comments above
-/// SmallPtrSetImplBase for details of the algorithm.
-template<class PtrType, unsigned SmallSize>
-class SmallPtrSet : public SmallPtrSetImpl<PtrType> {
- // In small mode SmallPtrSet uses linear search for the elements, so it is
- // not a good idea to choose this value too high. You may consider using a
- // DenseSet<> instead if you expect many elements in the set.
- static_assert(SmallSize <= 32, "SmallSize should be small");
-
- typedef SmallPtrSetImpl<PtrType> BaseT;
-
- // Make sure that SmallSize is a power of two, round up if not.
- enum { SmallSizePowTwo = RoundUpToPowerOfTwo<SmallSize>::Val };
- /// SmallStorage - Fixed size storage used in 'small mode'.
- const void *SmallStorage[SmallSizePowTwo];
-
-public:
- SmallPtrSet() : BaseT(SmallStorage, SmallSizePowTwo) {}
- SmallPtrSet(const SmallPtrSet &that) : BaseT(SmallStorage, that) {}
- SmallPtrSet(SmallPtrSet &&that)
- : BaseT(SmallStorage, SmallSizePowTwo, std::move(that)) {}
-
- template<typename It>
- SmallPtrSet(It I, It E) : BaseT(SmallStorage, SmallSizePowTwo) {
- this->insert(I, E);
- }
-
- SmallPtrSet<PtrType, SmallSize> &
- operator=(const SmallPtrSet<PtrType, SmallSize> &RHS) {
- if (&RHS != this)
- this->CopyFrom(RHS);
- return *this;
- }
-
- SmallPtrSet<PtrType, SmallSize>&
- operator=(SmallPtrSet<PtrType, SmallSize> &&RHS) {
- if (&RHS != this)
- this->MoveFrom(SmallSizePowTwo, std::move(RHS));
- return *this;
- }
-
- /// swap - Swaps the elements of two sets.
- void swap(SmallPtrSet<PtrType, SmallSize> &RHS) {
- SmallPtrSetImplBase::swap(RHS);
- }
-};
-}
-
-namespace std {
- /// Implement std::swap in terms of SmallPtrSet swap.
- template<class T, unsigned N>
- inline void swap(llvm::SmallPtrSet<T, N> &LHS, llvm::SmallPtrSet<T, N> &RHS) {
- LHS.swap(RHS);
- }
-}
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/SmallSet.h b/third_party/ntcore_2017/wpiutil/include/llvm/SmallSet.h
deleted file mode 100644
index 3dfd1f9..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/SmallSet.h
+++ /dev/null
@@ -1,136 +0,0 @@
-//===- llvm/ADT/SmallSet.h - 'Normally small' sets --------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the SmallSet class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_SMALLSET_H
-#define LLVM_ADT_SMALLSET_H
-
-#include "llvm/None.h"
-#include "llvm/SmallPtrSet.h"
-#include "llvm/SmallVector.h"
-#include <set>
-
-namespace llvm {
-
-/// SmallSet - This maintains a set of unique values, optimizing for the case
-/// when the set is small (less than N). In this case, the set can be
-/// maintained with no mallocs. If the set gets large, we expand to using an
-/// std::set to maintain reasonable lookup times.
-///
-/// Note that this set does not provide a way to iterate over members in the
-/// set.
-template <typename T, unsigned N, typename C = std::less<T> >
-class SmallSet {
- /// Use a SmallVector to hold the elements here (even though it will never
- /// reach its 'large' stage) to avoid calling the default ctors of elements
- /// we will never use.
- SmallVector<T, N> Vector;
- std::set<T, C> Set;
- typedef typename SmallVector<T, N>::const_iterator VIterator;
- typedef typename SmallVector<T, N>::iterator mutable_iterator;
-
- // In small mode SmallPtrSet uses linear search for the elements, so it is
- // not a good idea to choose this value too high. You may consider using a
- // DenseSet<> instead if you expect many elements in the set.
- static_assert(N <= 32, "N should be small");
-
-public:
- typedef size_t size_type;
- SmallSet() {}
-
- bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const {
- return Vector.empty() && Set.empty();
- }
-
- size_type size() const {
- return isSmall() ? Vector.size() : Set.size();
- }
-
- /// count - Return 1 if the element is in the set, 0 otherwise.
- size_type count(const T &V) const {
- if (isSmall()) {
- // Since the collection is small, just do a linear search.
- return vfind(V) == Vector.end() ? 0 : 1;
- } else {
- return Set.count(V);
- }
- }
-
- /// insert - Insert an element into the set if it isn't already there.
- /// Returns true if the element is inserted (it was not in the set before).
- /// The first value of the returned pair is unused and provided for
- /// partial compatibility with the standard library self-associative container
- /// concept.
- // FIXME: Add iterators that abstract over the small and large form, and then
- // return those here.
- std::pair<NoneType, bool> insert(const T &V) {
- if (!isSmall())
- return std::make_pair(None, Set.insert(V).second);
-
- VIterator I = vfind(V);
- if (I != Vector.end()) // Don't reinsert if it already exists.
- return std::make_pair(None, false);
- if (Vector.size() < N) {
- Vector.push_back(V);
- return std::make_pair(None, true);
- }
-
- // Otherwise, grow from vector to set.
- while (!Vector.empty()) {
- Set.insert(Vector.back());
- Vector.pop_back();
- }
- Set.insert(V);
- return std::make_pair(None, true);
- }
-
- template <typename IterT>
- void insert(IterT I, IterT E) {
- for (; I != E; ++I)
- insert(*I);
- }
-
- bool erase(const T &V) {
- if (!isSmall())
- return Set.erase(V);
- for (mutable_iterator I = Vector.begin(), E = Vector.end(); I != E; ++I)
- if (*I == V) {
- Vector.erase(I);
- return true;
- }
- return false;
- }
-
- void clear() {
- Vector.clear();
- Set.clear();
- }
-
-private:
- bool isSmall() const { return Set.empty(); }
-
- VIterator vfind(const T &V) const {
- for (VIterator I = Vector.begin(), E = Vector.end(); I != E; ++I)
- if (*I == V)
- return I;
- return Vector.end();
- }
-};
-
-/// If this set is of pointer values, transparently switch over to using
-/// SmallPtrSet for performance.
-template <typename PointeeType, unsigned N>
-class SmallSet<PointeeType*, N> : public SmallPtrSet<PointeeType*, N> {};
-
-} // end namespace llvm
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/SmallString.h b/third_party/ntcore_2017/wpiutil/include/llvm/SmallString.h
deleted file mode 100644
index 4c60c9b..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/SmallString.h
+++ /dev/null
@@ -1,297 +0,0 @@
-//===- llvm/ADT/SmallString.h - 'Normally small' strings --------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the SmallString class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_SMALLSTRING_H
-#define LLVM_ADT_SMALLSTRING_H
-
-#include "llvm/SmallVector.h"
-#include "llvm/StringRef.h"
-
-namespace llvm {
-
-/// SmallString - A SmallString is just a SmallVector with methods and accessors
-/// that make it work better as a string (e.g. operator+ etc).
-template<unsigned InternalLen>
-class SmallString : public SmallVector<char, InternalLen> {
-public:
- /// Default ctor - Initialize to empty.
- SmallString() {}
-
- /// Initialize from a StringRef.
- SmallString(StringRef S) : SmallVector<char, InternalLen>(S.begin(), S.end()) {}
-
- /// Initialize with a range.
- template<typename ItTy>
- SmallString(ItTy S, ItTy E) : SmallVector<char, InternalLen>(S, E) {}
-
- // Note that in order to add new overloads for append & assign, we have to
- // duplicate the inherited versions so as not to inadvertently hide them.
-
- /// @}
- /// @name String Assignment
- /// @{
-
- /// Assign from a repeated element.
- void assign(size_t NumElts, char Elt) {
- this->SmallVectorImpl<char>::assign(NumElts, Elt);
- }
-
- /// Assign from an iterator pair.
- template<typename in_iter>
- void assign(in_iter S, in_iter E) {
- this->clear();
- SmallVectorImpl<char>::append(S, E);
- }
-
- /// Assign from a StringRef.
- void assign(StringRef RHS) {
- this->clear();
- SmallVectorImpl<char>::append(RHS.begin(), RHS.end());
- }
-
- /// Assign from a SmallVector.
- void assign(const SmallVectorImpl<char> &RHS) {
- this->clear();
- SmallVectorImpl<char>::append(RHS.begin(), RHS.end());
- }
-
- /// @}
- /// @name String Concatenation
- /// @{
-
- /// Append from an iterator pair.
- template<typename in_iter>
- void append(in_iter S, in_iter E) {
- SmallVectorImpl<char>::append(S, E);
- }
-
- void append(size_t NumInputs, char Elt) {
- SmallVectorImpl<char>::append(NumInputs, Elt);
- }
-
-
- /// Append from a StringRef.
- void append(StringRef RHS) {
- SmallVectorImpl<char>::append(RHS.begin(), RHS.end());
- }
-
- /// Append from a SmallVector.
- void append(const SmallVectorImpl<char> &RHS) {
- SmallVectorImpl<char>::append(RHS.begin(), RHS.end());
- }
-
- /// @}
- /// @name String Comparison
- /// @{
-
- /// Check for string equality. This is more efficient than compare() when
- /// the relative ordering of inequal strings isn't needed.
- bool equals(StringRef RHS) const {
- return str().equals(RHS);
- }
-
- /// Check for string equality, ignoring case.
- bool equals_lower(StringRef RHS) const {
- return str().equals_lower(RHS);
- }
-
- /// Compare two strings; the result is -1, 0, or 1 if this string is
- /// lexicographically less than, equal to, or greater than the \p RHS.
- int compare(StringRef RHS) const {
- return str().compare(RHS);
- }
-
- /// compare_lower - Compare two strings, ignoring case.
- int compare_lower(StringRef RHS) const {
- return str().compare_lower(RHS);
- }
-
- /// compare_numeric - Compare two strings, treating sequences of digits as
- /// numbers.
- int compare_numeric(StringRef RHS) const {
- return str().compare_numeric(RHS);
- }
-
- /// @}
- /// @name String Predicates
- /// @{
-
- /// startswith - Check if this string starts with the given \p Prefix.
- bool startswith(StringRef Prefix) const {
- return str().startswith(Prefix);
- }
-
- /// endswith - Check if this string ends with the given \p Suffix.
- bool endswith(StringRef Suffix) const {
- return str().endswith(Suffix);
- }
-
- /// @}
- /// @name String Searching
- /// @{
-
- /// find - Search for the first character \p C in the string.
- ///
- /// \return - The index of the first occurrence of \p C, or npos if not
- /// found.
- size_t find(char C, size_t From = 0) const {
- return str().find(C, From);
- }
-
- /// Search for the first string \p Str in the string.
- ///
- /// \returns The index of the first occurrence of \p Str, or npos if not
- /// found.
- size_t find(StringRef Str, size_t From = 0) const {
- return str().find(Str, From);
- }
-
- /// Search for the last character \p C in the string.
- ///
- /// \returns The index of the last occurrence of \p C, or npos if not
- /// found.
- size_t rfind(char C, size_t From = StringRef::npos) const {
- return str().rfind(C, From);
- }
-
- /// Search for the last string \p Str in the string.
- ///
- /// \returns The index of the last occurrence of \p Str, or npos if not
- /// found.
- size_t rfind(StringRef Str) const {
- return str().rfind(Str);
- }
-
- /// Find the first character in the string that is \p C, or npos if not
- /// found. Same as find.
- size_t find_first_of(char C, size_t From = 0) const {
- return str().find_first_of(C, From);
- }
-
- /// Find the first character in the string that is in \p Chars, or npos if
- /// not found.
- ///
- /// Complexity: O(size() + Chars.size())
- size_t find_first_of(StringRef Chars, size_t From = 0) const {
- return str().find_first_of(Chars, From);
- }
-
- /// Find the first character in the string that is not \p C or npos if not
- /// found.
- size_t find_first_not_of(char C, size_t From = 0) const {
- return str().find_first_not_of(C, From);
- }
-
- /// Find the first character in the string that is not in the string
- /// \p Chars, or npos if not found.
- ///
- /// Complexity: O(size() + Chars.size())
- size_t find_first_not_of(StringRef Chars, size_t From = 0) const {
- return str().find_first_not_of(Chars, From);
- }
-
- /// Find the last character in the string that is \p C, or npos if not
- /// found.
- size_t find_last_of(char C, size_t From = StringRef::npos) const {
- return str().find_last_of(C, From);
- }
-
- /// Find the last character in the string that is in \p C, or npos if not
- /// found.
- ///
- /// Complexity: O(size() + Chars.size())
- size_t find_last_of(
- StringRef Chars, size_t From = StringRef::npos) const {
- return str().find_last_of(Chars, From);
- }
-
- /// @}
- /// @name Helpful Algorithms
- /// @{
-
- /// Return the number of occurrences of \p C in the string.
- size_t count(char C) const {
- return str().count(C);
- }
-
- /// Return the number of non-overlapped occurrences of \p Str in the
- /// string.
- size_t count(StringRef Str) const {
- return str().count(Str);
- }
-
- /// @}
- /// @name Substring Operations
- /// @{
-
- /// Return a reference to the substring from [Start, Start + N).
- ///
- /// \param Start The index of the starting character in the substring; if
- /// the index is npos or greater than the length of the string then the
- /// empty substring will be returned.
- ///
- /// \param N The number of characters to included in the substring. If \p N
- /// exceeds the number of characters remaining in the string, the string
- /// suffix (starting with \p Start) will be returned.
- StringRef substr(size_t Start, size_t N = StringRef::npos) const {
- return str().substr(Start, N);
- }
-
- /// Return a reference to the substring from [Start, End).
- ///
- /// \param Start The index of the starting character in the substring; if
- /// the index is npos or greater than the length of the string then the
- /// empty substring will be returned.
- ///
- /// \param End The index following the last character to include in the
- /// substring. If this is npos, or less than \p Start, or exceeds the
- /// number of characters remaining in the string, the string suffix
- /// (starting with \p Start) will be returned.
- StringRef slice(size_t Start, size_t End) const {
- return str().slice(Start, End);
- }
-
- // Extra methods.
-
- /// Explicit conversion to StringRef.
- StringRef str() const { return StringRef(this->begin(), this->size()); }
-
- // TODO: Make this const, if it's safe...
- const char* c_str() {
- this->push_back(0);
- this->pop_back();
- return this->data();
- }
-
- /// Implicit conversion to StringRef.
- operator StringRef() const { return str(); }
-
- // Extra operators.
- const SmallString &operator=(StringRef RHS) {
- this->clear();
- return *this += RHS;
- }
-
- SmallString &operator+=(StringRef RHS) {
- this->append(RHS.begin(), RHS.end());
- return *this;
- }
- SmallString &operator+=(char C) {
- this->push_back(C);
- return *this;
- }
-};
-
-}
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/SmallVector.h b/third_party/ntcore_2017/wpiutil/include/llvm/SmallVector.h
deleted file mode 100644
index 0f9c73b..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/SmallVector.h
+++ /dev/null
@@ -1,920 +0,0 @@
-//===- llvm/ADT/SmallVector.h - 'Normally small' vectors --------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the SmallVector class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_SMALLVECTOR_H
-#define LLVM_ADT_SMALLVECTOR_H
-
-#include "llvm/iterator_range.h"
-#include "llvm/AlignOf.h"
-#include "llvm/Compiler.h"
-#include "llvm/MathExtras.h"
-#include "llvm/type_traits.h"
-#include <algorithm>
-#include <cassert>
-#include <cstddef>
-#include <cstdlib>
-#include <cstring>
-#include <initializer_list>
-#include <iterator>
-#include <memory>
-
-namespace llvm {
-
-/// This is all the non-templated stuff common to all SmallVectors.
-class SmallVectorBase {
-protected:
- void *BeginX, *EndX, *CapacityX;
-
-protected:
- SmallVectorBase(void *FirstEl, size_t Size)
- : BeginX(FirstEl), EndX(FirstEl), CapacityX((char*)FirstEl+Size) {}
-
- /// This is an implementation of the grow() method which only works
- /// on POD-like data types and is out of line to reduce code duplication.
- void grow_pod(void *FirstEl, size_t MinSizeInBytes, size_t TSize);
-
-public:
- /// This returns size()*sizeof(T).
- size_t size_in_bytes() const {
- return size_t((char*)EndX - (char*)BeginX);
- }
-
- /// capacity_in_bytes - This returns capacity()*sizeof(T).
- size_t capacity_in_bytes() const {
- return size_t((char*)CapacityX - (char*)BeginX);
- }
-
- bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { return BeginX == EndX; }
-};
-
-template <typename T, unsigned N> struct SmallVectorStorage;
-
-/// This is the part of SmallVectorTemplateBase which does not depend on whether
-/// the type T is a POD. The extra dummy template argument is used by ArrayRef
-/// to avoid unnecessarily requiring T to be complete.
-template <typename T, typename = void>
-class SmallVectorTemplateCommon : public SmallVectorBase {
-private:
- template <typename, unsigned> friend struct SmallVectorStorage;
-
- // Allocate raw space for N elements of type T. If T has a ctor or dtor, we
- // don't want it to be automatically run, so we need to represent the space as
- // something else. Use an array of char of sufficient alignment.
- typedef llvm::AlignedCharArrayUnion<T> U;
- U FirstEl;
- // Space after 'FirstEl' is clobbered, do not add any instance vars after it.
-
-protected:
- SmallVectorTemplateCommon(size_t Size) : SmallVectorBase(&FirstEl, Size) {}
-
- void grow_pod(size_t MinSizeInBytes, size_t TSize) {
- SmallVectorBase::grow_pod(&FirstEl, MinSizeInBytes, TSize);
- }
-
- /// Return true if this is a smallvector which has not had dynamic
- /// memory allocated for it.
- bool isSmall() const {
- return BeginX == static_cast<const void*>(&FirstEl);
- }
-
- /// Put this vector in a state of being small.
- void resetToSmall() {
- BeginX = EndX = CapacityX = &FirstEl;
- }
-
- void setEnd(T *P) { this->EndX = P; }
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef T value_type;
- typedef T *iterator;
- typedef const T *const_iterator;
-
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
-
- typedef T &reference;
- typedef const T &const_reference;
- typedef T *pointer;
- typedef const T *const_pointer;
-
- // forward iterator creation methods.
- iterator begin() { return (iterator)this->BeginX; }
- const_iterator begin() const { return (const_iterator)this->BeginX; }
- iterator end() { return (iterator)this->EndX; }
- const_iterator end() const { return (const_iterator)this->EndX; }
-protected:
- iterator capacity_ptr() { return (iterator)this->CapacityX; }
- const_iterator capacity_ptr() const { return (const_iterator)this->CapacityX;}
-public:
-
- // reverse iterator creation methods.
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- const_reverse_iterator rbegin() const{ return const_reverse_iterator(end()); }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rend() const { return const_reverse_iterator(begin());}
-
- size_type size() const { return end()-begin(); }
- size_type max_size() const { return size_type(-1) / sizeof(T); }
-
- /// Return the total number of elements in the currently allocated buffer.
- size_t capacity() const { return capacity_ptr() - begin(); }
-
- /// Return a pointer to the vector's buffer, even if empty().
- pointer data() { return pointer(begin()); }
- /// Return a pointer to the vector's buffer, even if empty().
- const_pointer data() const { return const_pointer(begin()); }
-
- reference operator[](size_type idx) {
- assert(idx < size());
- return begin()[idx];
- }
- const_reference operator[](size_type idx) const {
- assert(idx < size());
- return begin()[idx];
- }
-
- reference front() {
- assert(!empty());
- return begin()[0];
- }
- const_reference front() const {
- assert(!empty());
- return begin()[0];
- }
-
- reference back() {
- assert(!empty());
- return end()[-1];
- }
- const_reference back() const {
- assert(!empty());
- return end()[-1];
- }
-};
-
-/// SmallVectorTemplateBase<isPodLike = false> - This is where we put method
-/// implementations that are designed to work with non-POD-like T's.
-template <typename T, bool isPodLike>
-class SmallVectorTemplateBase : public SmallVectorTemplateCommon<T> {
-protected:
- SmallVectorTemplateBase(size_t Size) : SmallVectorTemplateCommon<T>(Size) {}
-
- static void destroy_range(T *S, T *E) {
- while (S != E) {
- --E;
- E->~T();
- }
- }
-
- /// Move the range [I, E) into the uninitialized memory starting with "Dest",
- /// constructing elements as needed.
- template<typename It1, typename It2>
- static void uninitialized_move(It1 I, It1 E, It2 Dest) {
- std::uninitialized_copy(std::make_move_iterator(I),
- std::make_move_iterator(E), Dest);
- }
-
- /// Copy the range [I, E) onto the uninitialized memory starting with "Dest",
- /// constructing elements as needed.
- template<typename It1, typename It2>
- static void uninitialized_copy(It1 I, It1 E, It2 Dest) {
- std::uninitialized_copy(I, E, Dest);
- }
-
- /// Grow the allocated memory (without initializing new elements), doubling
- /// the size of the allocated memory. Guarantees space for at least one more
- /// element, or MinSize more elements if specified.
- void grow(size_t MinSize = 0);
-
-public:
- void push_back(const T &Elt) {
- if (LLVM_UNLIKELY(this->EndX >= this->CapacityX))
- this->grow();
- ::new ((void*) this->end()) T(Elt);
- this->setEnd(this->end()+1);
- }
-
- void push_back(T &&Elt) {
- if (LLVM_UNLIKELY(this->EndX >= this->CapacityX))
- this->grow();
- ::new ((void*) this->end()) T(::std::move(Elt));
- this->setEnd(this->end()+1);
- }
-
- void pop_back() {
- this->setEnd(this->end()-1);
- this->end()->~T();
- }
-};
-
-// Define this out-of-line to dissuade the C++ compiler from inlining it.
-template <typename T, bool isPodLike>
-void SmallVectorTemplateBase<T, isPodLike>::grow(size_t MinSize) {
- size_t CurCapacity = this->capacity();
- size_t CurSize = this->size();
- // Always grow, even from zero.
- size_t NewCapacity = size_t(NextPowerOf2(CurCapacity+2));
- if (NewCapacity < MinSize)
- NewCapacity = MinSize;
- T *NewElts = static_cast<T*>(malloc(NewCapacity*sizeof(T)));
-
- // Move the elements over.
- this->uninitialized_move(this->begin(), this->end(), NewElts);
-
- // Destroy the original elements.
- destroy_range(this->begin(), this->end());
-
- // If this wasn't grown from the inline copy, deallocate the old space.
- if (!this->isSmall())
- free(this->begin());
-
- this->setEnd(NewElts+CurSize);
- this->BeginX = NewElts;
- this->CapacityX = this->begin()+NewCapacity;
-}
-
-
-/// SmallVectorTemplateBase<isPodLike = true> - This is where we put method
-/// implementations that are designed to work with POD-like T's.
-template <typename T>
-class SmallVectorTemplateBase<T, true> : public SmallVectorTemplateCommon<T> {
-protected:
- SmallVectorTemplateBase(size_t Size) : SmallVectorTemplateCommon<T>(Size) {}
-
- // No need to do a destroy loop for POD's.
- static void destroy_range(T *, T *) {}
-
- /// Move the range [I, E) onto the uninitialized memory
- /// starting with "Dest", constructing elements into it as needed.
- template<typename It1, typename It2>
- static void uninitialized_move(It1 I, It1 E, It2 Dest) {
- // Just do a copy.
- uninitialized_copy(I, E, Dest);
- }
-
- /// Copy the range [I, E) onto the uninitialized memory
- /// starting with "Dest", constructing elements into it as needed.
- template<typename It1, typename It2>
- static void uninitialized_copy(It1 I, It1 E, It2 Dest) {
- // Arbitrary iterator types; just use the basic implementation.
- std::uninitialized_copy(I, E, Dest);
- }
-
- /// Copy the range [I, E) onto the uninitialized memory
- /// starting with "Dest", constructing elements into it as needed.
- template <typename T1, typename T2>
- static void uninitialized_copy(
- T1 *I, T1 *E, T2 *Dest,
- typename std::enable_if<std::is_same<typename std::remove_const<T1>::type,
- T2>::value>::type * = nullptr) {
- // Use memcpy for PODs iterated by pointers (which includes SmallVector
- // iterators): std::uninitialized_copy optimizes to memmove, but we can
- // use memcpy here. Note that I and E are iterators and thus might be
- // invalid for memcpy if they are equal.
- if (I != E)
- memcpy(Dest, I, (E - I) * sizeof(T));
- }
-
- /// Double the size of the allocated memory, guaranteeing space for at
- /// least one more element or MinSize if specified.
- void grow(size_t MinSize = 0) {
- this->grow_pod(MinSize*sizeof(T), sizeof(T));
- }
-public:
- void push_back(const T &Elt) {
- if (LLVM_UNLIKELY(this->EndX >= this->CapacityX))
- this->grow();
- memcpy(this->end(), &Elt, sizeof(T));
- this->setEnd(this->end()+1);
- }
-
- void pop_back() {
- this->setEnd(this->end()-1);
- }
-};
-
-
-/// This class consists of common code factored out of the SmallVector class to
-/// reduce code duplication based on the SmallVector 'N' template parameter.
-template <typename T>
-class SmallVectorImpl : public SmallVectorTemplateBase<T, isPodLike<T>::value> {
- typedef SmallVectorTemplateBase<T, isPodLike<T>::value > SuperClass;
-
- SmallVectorImpl(const SmallVectorImpl&) = delete;
-public:
- typedef typename SuperClass::iterator iterator;
- typedef typename SuperClass::const_iterator const_iterator;
- typedef typename SuperClass::size_type size_type;
-
-protected:
- // Default ctor - Initialize to empty.
- explicit SmallVectorImpl(unsigned N)
- : SmallVectorTemplateBase<T, isPodLike<T>::value>(N*sizeof(T)) {
- }
-
-public:
- ~SmallVectorImpl() {
- // Destroy the constructed elements in the vector.
- this->destroy_range(this->begin(), this->end());
-
- // If this wasn't grown from the inline copy, deallocate the old space.
- if (!this->isSmall())
- free(this->begin());
- }
-
-
- void clear() {
- this->destroy_range(this->begin(), this->end());
- this->EndX = this->BeginX;
- }
-
- void resize(size_type N) {
- if (N < this->size()) {
- this->destroy_range(this->begin()+N, this->end());
- this->setEnd(this->begin()+N);
- } else if (N > this->size()) {
- if (this->capacity() < N)
- this->grow(N);
- for (auto I = this->end(), E = this->begin() + N; I != E; ++I)
- new (&*I) T();
- this->setEnd(this->begin()+N);
- }
- }
-
- void resize(size_type N, const T &NV) {
- if (N < this->size()) {
- this->destroy_range(this->begin()+N, this->end());
- this->setEnd(this->begin()+N);
- } else if (N > this->size()) {
- if (this->capacity() < N)
- this->grow(N);
- std::uninitialized_fill(this->end(), this->begin()+N, NV);
- this->setEnd(this->begin()+N);
- }
- }
-
- void reserve(size_type N) {
- if (this->capacity() < N)
- this->grow(N);
- }
-
- T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val() {
- T Result = ::std::move(this->back());
- this->pop_back();
- return Result;
- }
-
- void swap(SmallVectorImpl &RHS);
-
- /// Add the specified range to the end of the SmallVector.
- template<typename in_iter>
- void append(in_iter in_start, in_iter in_end) {
- size_type NumInputs = std::distance(in_start, in_end);
- // Grow allocated space if needed.
- if (NumInputs > size_type(this->capacity_ptr()-this->end()))
- this->grow(this->size()+NumInputs);
-
- // Copy the new elements over.
- this->uninitialized_copy(in_start, in_end, this->end());
- this->setEnd(this->end() + NumInputs);
- }
-
- /// Add the specified range to the end of the SmallVector.
- void append(size_type NumInputs, const T &Elt) {
- // Grow allocated space if needed.
- if (NumInputs > size_type(this->capacity_ptr()-this->end()))
- this->grow(this->size()+NumInputs);
-
- // Copy the new elements over.
- std::uninitialized_fill_n(this->end(), NumInputs, Elt);
- this->setEnd(this->end() + NumInputs);
- }
-
- void append(std::initializer_list<T> IL) {
- append(IL.begin(), IL.end());
- }
-
- void assign(size_type NumElts, const T &Elt) {
- clear();
- if (this->capacity() < NumElts)
- this->grow(NumElts);
- this->setEnd(this->begin()+NumElts);
- std::uninitialized_fill(this->begin(), this->end(), Elt);
- }
-
- void assign(std::initializer_list<T> IL) {
- clear();
- append(IL);
- }
-
- iterator erase(const_iterator CI) {
- // Just cast away constness because this is a non-const member function.
- iterator I = const_cast<iterator>(CI);
-
- assert(I >= this->begin() && "Iterator to erase is out of bounds.");
- assert(I < this->end() && "Erasing at past-the-end iterator.");
-
- iterator N = I;
- // Shift all elts down one.
- std::move(I+1, this->end(), I);
- // Drop the last elt.
- this->pop_back();
- return(N);
- }
-
- iterator erase(const_iterator CS, const_iterator CE) {
- // Just cast away constness because this is a non-const member function.
- iterator S = const_cast<iterator>(CS);
- iterator E = const_cast<iterator>(CE);
-
- assert(S >= this->begin() && "Range to erase is out of bounds.");
- assert(S <= E && "Trying to erase invalid range.");
- assert(E <= this->end() && "Trying to erase past the end.");
-
- iterator N = S;
- // Shift all elts down.
- iterator I = std::move(E, this->end(), S);
- // Drop the last elts.
- this->destroy_range(I, this->end());
- this->setEnd(I);
- return(N);
- }
-
- iterator insert(iterator I, T &&Elt) {
- if (I == this->end()) { // Important special case for empty vector.
- this->push_back(::std::move(Elt));
- return this->end()-1;
- }
-
- assert(I >= this->begin() && "Insertion iterator is out of bounds.");
- assert(I <= this->end() && "Inserting past the end of the vector.");
-
- if (this->EndX >= this->CapacityX) {
- size_t EltNo = I-this->begin();
- this->grow();
- I = this->begin()+EltNo;
- }
-
- ::new ((void*) this->end()) T(::std::move(this->back()));
- // Push everything else over.
- std::move_backward(I, this->end()-1, this->end());
- this->setEnd(this->end()+1);
-
- // If we just moved the element we're inserting, be sure to update
- // the reference.
- T *EltPtr = &Elt;
- if (I <= EltPtr && EltPtr < this->EndX)
- ++EltPtr;
-
- *I = ::std::move(*EltPtr);
- return I;
- }
-
- iterator insert(iterator I, const T &Elt) {
- if (I == this->end()) { // Important special case for empty vector.
- this->push_back(Elt);
- return this->end()-1;
- }
-
- assert(I >= this->begin() && "Insertion iterator is out of bounds.");
- assert(I <= this->end() && "Inserting past the end of the vector.");
-
- if (this->EndX >= this->CapacityX) {
- size_t EltNo = I-this->begin();
- this->grow();
- I = this->begin()+EltNo;
- }
- ::new ((void*) this->end()) T(std::move(this->back()));
- // Push everything else over.
- std::move_backward(I, this->end()-1, this->end());
- this->setEnd(this->end()+1);
-
- // If we just moved the element we're inserting, be sure to update
- // the reference.
- const T *EltPtr = &Elt;
- if (I <= EltPtr && EltPtr < this->EndX)
- ++EltPtr;
-
- *I = *EltPtr;
- return I;
- }
-
- iterator insert(iterator I, size_type NumToInsert, const T &Elt) {
- // Convert iterator to elt# to avoid invalidating iterator when we reserve()
- size_t InsertElt = I - this->begin();
-
- if (I == this->end()) { // Important special case for empty vector.
- append(NumToInsert, Elt);
- return this->begin()+InsertElt;
- }
-
- assert(I >= this->begin() && "Insertion iterator is out of bounds.");
- assert(I <= this->end() && "Inserting past the end of the vector.");
-
- // Ensure there is enough space.
- reserve(this->size() + NumToInsert);
-
- // Uninvalidate the iterator.
- I = this->begin()+InsertElt;
-
- // If there are more elements between the insertion point and the end of the
- // range than there are being inserted, we can use a simple approach to
- // insertion. Since we already reserved space, we know that this won't
- // reallocate the vector.
- if (size_t(this->end()-I) >= NumToInsert) {
- T *OldEnd = this->end();
- append(std::move_iterator<iterator>(this->end() - NumToInsert),
- std::move_iterator<iterator>(this->end()));
-
- // Copy the existing elements that get replaced.
- std::move_backward(I, OldEnd-NumToInsert, OldEnd);
-
- std::fill_n(I, NumToInsert, Elt);
- return I;
- }
-
- // Otherwise, we're inserting more elements than exist already, and we're
- // not inserting at the end.
-
- // Move over the elements that we're about to overwrite.
- T *OldEnd = this->end();
- this->setEnd(this->end() + NumToInsert);
- size_t NumOverwritten = OldEnd-I;
- this->uninitialized_move(I, OldEnd, this->end()-NumOverwritten);
-
- // Replace the overwritten part.
- std::fill_n(I, NumOverwritten, Elt);
-
- // Insert the non-overwritten middle part.
- std::uninitialized_fill_n(OldEnd, NumToInsert-NumOverwritten, Elt);
- return I;
- }
-
- template<typename ItTy>
- iterator insert(iterator I, ItTy From, ItTy To) {
- // Convert iterator to elt# to avoid invalidating iterator when we reserve()
- size_t InsertElt = I - this->begin();
-
- if (I == this->end()) { // Important special case for empty vector.
- append(From, To);
- return this->begin()+InsertElt;
- }
-
- assert(I >= this->begin() && "Insertion iterator is out of bounds.");
- assert(I <= this->end() && "Inserting past the end of the vector.");
-
- size_t NumToInsert = std::distance(From, To);
-
- // Ensure there is enough space.
- reserve(this->size() + NumToInsert);
-
- // Uninvalidate the iterator.
- I = this->begin()+InsertElt;
-
- // If there are more elements between the insertion point and the end of the
- // range than there are being inserted, we can use a simple approach to
- // insertion. Since we already reserved space, we know that this won't
- // reallocate the vector.
- if (size_t(this->end()-I) >= NumToInsert) {
- T *OldEnd = this->end();
- append(std::move_iterator<iterator>(this->end() - NumToInsert),
- std::move_iterator<iterator>(this->end()));
-
- // Copy the existing elements that get replaced.
- std::move_backward(I, OldEnd-NumToInsert, OldEnd);
-
- std::copy(From, To, I);
- return I;
- }
-
- // Otherwise, we're inserting more elements than exist already, and we're
- // not inserting at the end.
-
- // Move over the elements that we're about to overwrite.
- T *OldEnd = this->end();
- this->setEnd(this->end() + NumToInsert);
- size_t NumOverwritten = OldEnd-I;
- this->uninitialized_move(I, OldEnd, this->end()-NumOverwritten);
-
- // Replace the overwritten part.
- for (T *J = I; NumOverwritten > 0; --NumOverwritten) {
- *J = *From;
- ++J; ++From;
- }
-
- // Insert the non-overwritten middle part.
- this->uninitialized_copy(From, To, OldEnd);
- return I;
- }
-
- void insert(iterator I, std::initializer_list<T> IL) {
- insert(I, IL.begin(), IL.end());
- }
-
- template <typename... ArgTypes> void emplace_back(ArgTypes &&... Args) {
- if (LLVM_UNLIKELY(this->EndX >= this->CapacityX))
- this->grow();
- ::new ((void *)this->end()) T(std::forward<ArgTypes>(Args)...);
- this->setEnd(this->end() + 1);
- }
-
- SmallVectorImpl &operator=(const SmallVectorImpl &RHS);
-
- SmallVectorImpl &operator=(SmallVectorImpl &&RHS);
-
- bool operator==(const SmallVectorImpl &RHS) const {
- if (this->size() != RHS.size()) return false;
- return std::equal(this->begin(), this->end(), RHS.begin());
- }
- bool operator!=(const SmallVectorImpl &RHS) const {
- return !(*this == RHS);
- }
-
- bool operator<(const SmallVectorImpl &RHS) const {
- return std::lexicographical_compare(this->begin(), this->end(),
- RHS.begin(), RHS.end());
- }
-
- /// Set the array size to \p N, which the current array must have enough
- /// capacity for.
- ///
- /// This does not construct or destroy any elements in the vector.
- ///
- /// Clients can use this in conjunction with capacity() to write past the end
- /// of the buffer when they know that more elements are available, and only
- /// update the size later. This avoids the cost of value initializing elements
- /// which will only be overwritten.
- void set_size(size_type N) {
- assert(N <= this->capacity());
- this->setEnd(this->begin() + N);
- }
-};
-
-
-template <typename T>
-void SmallVectorImpl<T>::swap(SmallVectorImpl<T> &RHS) {
- if (this == &RHS) return;
-
- // We can only avoid copying elements if neither vector is small.
- if (!this->isSmall() && !RHS.isSmall()) {
- std::swap(this->BeginX, RHS.BeginX);
- std::swap(this->EndX, RHS.EndX);
- std::swap(this->CapacityX, RHS.CapacityX);
- return;
- }
- if (RHS.size() > this->capacity())
- this->grow(RHS.size());
- if (this->size() > RHS.capacity())
- RHS.grow(this->size());
-
- // Swap the shared elements.
- size_t NumShared = this->size();
- if (NumShared > RHS.size()) NumShared = RHS.size();
- for (size_type i = 0; i != NumShared; ++i)
- std::swap((*this)[i], RHS[i]);
-
- // Copy over the extra elts.
- if (this->size() > RHS.size()) {
- size_t EltDiff = this->size() - RHS.size();
- this->uninitialized_copy(this->begin()+NumShared, this->end(), RHS.end());
- RHS.setEnd(RHS.end()+EltDiff);
- this->destroy_range(this->begin()+NumShared, this->end());
- this->setEnd(this->begin()+NumShared);
- } else if (RHS.size() > this->size()) {
- size_t EltDiff = RHS.size() - this->size();
- this->uninitialized_copy(RHS.begin()+NumShared, RHS.end(), this->end());
- this->setEnd(this->end() + EltDiff);
- this->destroy_range(RHS.begin()+NumShared, RHS.end());
- RHS.setEnd(RHS.begin()+NumShared);
- }
-}
-
-template <typename T>
-SmallVectorImpl<T> &SmallVectorImpl<T>::
- operator=(const SmallVectorImpl<T> &RHS) {
- // Avoid self-assignment.
- if (this == &RHS) return *this;
-
- // If we already have sufficient space, assign the common elements, then
- // destroy any excess.
- size_t RHSSize = RHS.size();
- size_t CurSize = this->size();
- if (CurSize >= RHSSize) {
- // Assign common elements.
- iterator NewEnd;
- if (RHSSize)
- NewEnd = std::copy(RHS.begin(), RHS.begin()+RHSSize, this->begin());
- else
- NewEnd = this->begin();
-
- // Destroy excess elements.
- this->destroy_range(NewEnd, this->end());
-
- // Trim.
- this->setEnd(NewEnd);
- return *this;
- }
-
- // If we have to grow to have enough elements, destroy the current elements.
- // This allows us to avoid copying them during the grow.
- // FIXME: don't do this if they're efficiently moveable.
- if (this->capacity() < RHSSize) {
- // Destroy current elements.
- this->destroy_range(this->begin(), this->end());
- this->setEnd(this->begin());
- CurSize = 0;
- this->grow(RHSSize);
- } else if (CurSize) {
- // Otherwise, use assignment for the already-constructed elements.
- std::copy(RHS.begin(), RHS.begin()+CurSize, this->begin());
- }
-
- // Copy construct the new elements in place.
- this->uninitialized_copy(RHS.begin()+CurSize, RHS.end(),
- this->begin()+CurSize);
-
- // Set end.
- this->setEnd(this->begin()+RHSSize);
- return *this;
-}
-
-template <typename T>
-SmallVectorImpl<T> &SmallVectorImpl<T>::operator=(SmallVectorImpl<T> &&RHS) {
- // Avoid self-assignment.
- if (this == &RHS) return *this;
-
- // If the RHS isn't small, clear this vector and then steal its buffer.
- if (!RHS.isSmall()) {
- this->destroy_range(this->begin(), this->end());
- if (!this->isSmall()) free(this->begin());
- this->BeginX = RHS.BeginX;
- this->EndX = RHS.EndX;
- this->CapacityX = RHS.CapacityX;
- RHS.resetToSmall();
- return *this;
- }
-
- // If we already have sufficient space, assign the common elements, then
- // destroy any excess.
- size_t RHSSize = RHS.size();
- size_t CurSize = this->size();
- if (CurSize >= RHSSize) {
- // Assign common elements.
- iterator NewEnd = this->begin();
- if (RHSSize)
- NewEnd = std::move(RHS.begin(), RHS.end(), NewEnd);
-
- // Destroy excess elements and trim the bounds.
- this->destroy_range(NewEnd, this->end());
- this->setEnd(NewEnd);
-
- // Clear the RHS.
- RHS.clear();
-
- return *this;
- }
-
- // If we have to grow to have enough elements, destroy the current elements.
- // This allows us to avoid copying them during the grow.
- // FIXME: this may not actually make any sense if we can efficiently move
- // elements.
- if (this->capacity() < RHSSize) {
- // Destroy current elements.
- this->destroy_range(this->begin(), this->end());
- this->setEnd(this->begin());
- CurSize = 0;
- this->grow(RHSSize);
- } else if (CurSize) {
- // Otherwise, use assignment for the already-constructed elements.
- std::move(RHS.begin(), RHS.begin()+CurSize, this->begin());
- }
-
- // Move-construct the new elements in place.
- this->uninitialized_move(RHS.begin()+CurSize, RHS.end(),
- this->begin()+CurSize);
-
- // Set end.
- this->setEnd(this->begin()+RHSSize);
-
- RHS.clear();
- return *this;
-}
-
-/// Storage for the SmallVector elements which aren't contained in
-/// SmallVectorTemplateCommon. There are 'N-1' elements here. The remaining '1'
-/// element is in the base class. This is specialized for the N=1 and N=0 cases
-/// to avoid allocating unnecessary storage.
-template <typename T, unsigned N>
-struct SmallVectorStorage {
- typename SmallVectorTemplateCommon<T>::U InlineElts[N - 1];
-};
-template <typename T> struct SmallVectorStorage<T, 1> {};
-template <typename T> struct SmallVectorStorage<T, 0> {};
-
-/// This is a 'vector' (really, a variable-sized array), optimized
-/// for the case when the array is small. It contains some number of elements
-/// in-place, which allows it to avoid heap allocation when the actual number of
-/// elements is below that threshold. This allows normal "small" cases to be
-/// fast without losing generality for large inputs.
-///
-/// Note that this does not attempt to be exception safe.
-///
-template <typename T, unsigned N>
-class SmallVector : public SmallVectorImpl<T> {
- /// Inline space for elements which aren't stored in the base class.
- SmallVectorStorage<T, N> Storage;
-public:
- SmallVector() : SmallVectorImpl<T>(N) {
- }
-
- explicit SmallVector(size_t Size, const T &Value = T())
- : SmallVectorImpl<T>(N) {
- this->assign(Size, Value);
- }
-
- template<typename ItTy>
- SmallVector(ItTy S, ItTy E) : SmallVectorImpl<T>(N) {
- this->append(S, E);
- }
-
- template <typename RangeTy>
- explicit SmallVector(const llvm::iterator_range<RangeTy> R)
- : SmallVectorImpl<T>(N) {
- this->append(R.begin(), R.end());
- }
-
- SmallVector(std::initializer_list<T> IL) : SmallVectorImpl<T>(N) {
- this->assign(IL);
- }
-
- SmallVector(const SmallVector &RHS) : SmallVectorImpl<T>(N) {
- if (!RHS.empty())
- SmallVectorImpl<T>::operator=(RHS);
- }
-
- const SmallVector &operator=(const SmallVector &RHS) {
- SmallVectorImpl<T>::operator=(RHS);
- return *this;
- }
-
- SmallVector(SmallVector &&RHS) : SmallVectorImpl<T>(N) {
- if (!RHS.empty())
- SmallVectorImpl<T>::operator=(::std::move(RHS));
- }
-
- const SmallVector &operator=(SmallVector &&RHS) {
- SmallVectorImpl<T>::operator=(::std::move(RHS));
- return *this;
- }
-
- SmallVector(SmallVectorImpl<T> &&RHS) : SmallVectorImpl<T>(N) {
- if (!RHS.empty())
- SmallVectorImpl<T>::operator=(::std::move(RHS));
- }
-
- const SmallVector &operator=(SmallVectorImpl<T> &&RHS) {
- SmallVectorImpl<T>::operator=(::std::move(RHS));
- return *this;
- }
-
- const SmallVector &operator=(std::initializer_list<T> IL) {
- this->assign(IL);
- return *this;
- }
-};
-
-template<typename T, unsigned N>
-static inline size_t capacity_in_bytes(const SmallVector<T, N> &X) {
- return X.capacity_in_bytes();
-}
-
-} // End llvm namespace
-
-namespace std {
- /// Implement std::swap in terms of SmallVector swap.
- template<typename T>
- inline void
- swap(llvm::SmallVectorImpl<T> &LHS, llvm::SmallVectorImpl<T> &RHS) {
- LHS.swap(RHS);
- }
-
- /// Implement std::swap in terms of SmallVector swap.
- template<typename T, unsigned N>
- inline void
- swap(llvm::SmallVector<T, N> &LHS, llvm::SmallVector<T, N> &RHS) {
- LHS.swap(RHS);
- }
-}
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/StringExtras.h b/third_party/ntcore_2017/wpiutil/include/llvm/StringExtras.h
deleted file mode 100644
index 9cf468a..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/StringExtras.h
+++ /dev/null
@@ -1,197 +0,0 @@
-//===-- llvm/ADT/StringExtras.h - Useful string functions -------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains some functions that are useful when dealing with strings.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_STRINGEXTRAS_H
-#define LLVM_ADT_STRINGEXTRAS_H
-
-#include "llvm/StringRef.h"
-#include <cstdint>
-#include <iterator>
-
-namespace llvm {
-template<typename T> class SmallVectorImpl;
-
-/// hexdigit - Return the hexadecimal character for the
-/// given number \p X (which should be less than 16).
-static inline char hexdigit(unsigned X, bool LowerCase = false) {
- const char HexChar = LowerCase ? 'a' : 'A';
- return X < 10 ? '0' + X : HexChar + X - 10;
-}
-
-/// Construct a string ref from a boolean.
-static inline StringRef toStringRef(bool B) {
- return StringRef(B ? "true" : "false");
-}
-
-/// Interpret the given character \p C as a hexadecimal digit and return its
-/// value.
-///
-/// If \p C is not a valid hex digit, -1U is returned.
-static inline unsigned hexDigitValue(char C) {
- if (C >= '0' && C <= '9') return C-'0';
- if (C >= 'a' && C <= 'f') return C-'a'+10U;
- if (C >= 'A' && C <= 'F') return C-'A'+10U;
- return -1U;
-}
-
-static inline std::string utohexstr(uint64_t X, bool LowerCase = false) {
- char Buffer[17];
- char *BufPtr = std::end(Buffer);
-
- if (X == 0) *--BufPtr = '0';
-
- while (X) {
- unsigned char Mod = static_cast<unsigned char>(X) & 15;
- *--BufPtr = hexdigit(Mod, LowerCase);
- X >>= 4;
- }
-
- return std::string(BufPtr, std::end(Buffer));
-}
-
-/// Convert buffer \p Input to its hexadecimal representation.
-/// The returned string is double the size of \p Input.
-static inline std::string toHex(StringRef Input) {
- static const char *const LUT = "0123456789ABCDEF";
- size_t Length = Input.size();
-
- std::string Output;
- Output.reserve(2 * Length);
- for (size_t i = 0; i < Length; ++i) {
- const unsigned char c = Input[i];
- Output.push_back(LUT[c >> 4]);
- Output.push_back(LUT[c & 15]);
- }
- return Output;
-}
-
-static inline std::string utostr(uint64_t X, bool isNeg = false) {
- char Buffer[21];
- char *BufPtr = std::end(Buffer);
-
- if (X == 0) *--BufPtr = '0'; // Handle special case...
-
- while (X) {
- *--BufPtr = '0' + char(X % 10);
- X /= 10;
- }
-
- if (isNeg) *--BufPtr = '-'; // Add negative sign...
- return std::string(BufPtr, std::end(Buffer));
-}
-
-
-static inline std::string itostr(int64_t X) {
- if (X < 0)
- return utostr(static_cast<uint64_t>(-X), true);
- else
- return utostr(static_cast<uint64_t>(X));
-}
-
-/// StrInStrNoCase - Portable version of strcasestr. Locates the first
-/// occurrence of string 's1' in string 's2', ignoring case. Returns
-/// the offset of s2 in s1 or npos if s2 cannot be found.
-StringRef::size_type StrInStrNoCase(StringRef s1, StringRef s2);
-
-/// getToken - This function extracts one token from source, ignoring any
-/// leading characters that appear in the Delimiters string, and ending the
-/// token at any of the characters that appear in the Delimiters string. If
-/// there are no tokens in the source string, an empty string is returned.
-/// The function returns a pair containing the extracted token and the
-/// remaining tail string.
-std::pair<StringRef, StringRef> getToken(StringRef Source,
- StringRef Delimiters = " \t\n\v\f\r");
-
-/// SplitString - Split up the specified string according to the specified
-/// delimiters, appending the result fragments to the output list.
-void SplitString(StringRef Source,
- SmallVectorImpl<StringRef> &OutFragments,
- StringRef Delimiters = " \t\n\v\f\r");
-
-/// HashString - Hash function for strings.
-///
-/// This is the Bernstein hash function.
-//
-// FIXME: Investigate whether a modified bernstein hash function performs
-// better: http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx
-// X*33+c -> X*33^c
-static inline unsigned HashString(StringRef Str, unsigned Result = 0) {
- for (StringRef::size_type i = 0, e = Str.size(); i != e; ++i)
- Result = Result * 33 + (unsigned char)Str[i];
- return Result;
-}
-
-/// Returns the English suffix for an ordinal integer (-st, -nd, -rd, -th).
-static inline StringRef getOrdinalSuffix(unsigned Val) {
- // It is critically important that we do this perfectly for
- // user-written sequences with over 100 elements.
- switch (Val % 100) {
- case 11:
- case 12:
- case 13:
- return "th";
- default:
- switch (Val % 10) {
- case 1: return "st";
- case 2: return "nd";
- case 3: return "rd";
- default: return "th";
- }
- }
-}
-
-template <typename IteratorT>
-inline std::string join_impl(IteratorT Begin, IteratorT End,
- StringRef Separator, std::input_iterator_tag) {
- std::string S;
- if (Begin == End)
- return S;
-
- S += (*Begin);
- while (++Begin != End) {
- S += Separator;
- S += (*Begin);
- }
- return S;
-}
-
-template <typename IteratorT>
-inline std::string join_impl(IteratorT Begin, IteratorT End,
- StringRef Separator, std::forward_iterator_tag) {
- std::string S;
- if (Begin == End)
- return S;
-
- size_t Len = (std::distance(Begin, End) - 1) * Separator.size();
- for (IteratorT I = Begin; I != End; ++I)
- Len += (*Begin).size();
- S.reserve(Len);
- S += (*Begin);
- while (++Begin != End) {
- S += Separator;
- S += (*Begin);
- }
- return S;
-}
-
-/// Joins the strings in the range [Begin, End), adding Separator between
-/// the elements.
-template <typename IteratorT>
-inline std::string join(IteratorT Begin, IteratorT End, StringRef Separator) {
- typedef typename std::iterator_traits<IteratorT>::iterator_category tag;
- return join_impl(Begin, End, Separator, tag());
-}
-
-} // End llvm namespace
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/StringMap.h b/third_party/ntcore_2017/wpiutil/include/llvm/StringMap.h
deleted file mode 100644
index 522c08a..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/StringMap.h
+++ /dev/null
@@ -1,476 +0,0 @@
-//===--- StringMap.h - String Hash table map interface ----------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the StringMap class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_STRINGMAP_H
-#define LLVM_ADT_STRINGMAP_H
-
-#include "llvm/StringRef.h"
-#include "llvm/PointerLikeTypeTraits.h"
-#include <cstdlib>
-#include <cstring>
-#include <utility>
-
-namespace llvm {
- template<typename ValueT>
- class StringMapConstIterator;
- template<typename ValueT>
- class StringMapIterator;
- template<typename ValueTy>
- class StringMapEntry;
-
-/// StringMapEntryBase - Shared base class of StringMapEntry instances.
-class StringMapEntryBase {
- unsigned StrLen;
-
-public:
- explicit StringMapEntryBase(unsigned Len) : StrLen(Len) {}
-
- unsigned getKeyLength() const { return StrLen; }
-};
-
-/// StringMapImpl - This is the base class of StringMap that is shared among
-/// all of its instantiations.
-class StringMapImpl {
-protected:
- // Array of NumBuckets pointers to entries, null pointers are holes.
- // TheTable[NumBuckets] contains a sentinel value for easy iteration. Followed
- // by an array of the actual hash values as unsigned integers.
- StringMapEntryBase **TheTable;
- unsigned NumBuckets;
- unsigned NumItems;
- unsigned NumTombstones;
- unsigned ItemSize;
-
-protected:
- explicit StringMapImpl(unsigned itemSize)
- : TheTable(nullptr),
- // Initialize the map with zero buckets to allocation.
- NumBuckets(0), NumItems(0), NumTombstones(0), ItemSize(itemSize) {}
- StringMapImpl(StringMapImpl &&RHS)
- : TheTable(RHS.TheTable), NumBuckets(RHS.NumBuckets),
- NumItems(RHS.NumItems), NumTombstones(RHS.NumTombstones),
- ItemSize(RHS.ItemSize) {
- RHS.TheTable = nullptr;
- RHS.NumBuckets = 0;
- RHS.NumItems = 0;
- RHS.NumTombstones = 0;
- }
-
- StringMapImpl(unsigned InitSize, unsigned ItemSize);
- unsigned RehashTable(unsigned BucketNo = 0);
-
- /// LookupBucketFor - Look up the bucket that the specified string should end
- /// up in. If it already exists as a key in the map, the Item pointer for the
- /// specified bucket will be non-null. Otherwise, it will be null. In either
- /// case, the FullHashValue field of the bucket will be set to the hash value
- /// of the string.
- unsigned LookupBucketFor(StringRef Key);
-
- /// FindKey - Look up the bucket that contains the specified key. If it exists
- /// in the map, return the bucket number of the key. Otherwise return -1.
- /// This does not modify the map.
- int FindKey(StringRef Key) const;
-
- /// RemoveKey - Remove the specified StringMapEntry from the table, but do not
- /// delete it. This aborts if the value isn't in the table.
- void RemoveKey(StringMapEntryBase *V);
-
- /// RemoveKey - Remove the StringMapEntry for the specified key from the
- /// table, returning it. If the key is not in the table, this returns null.
- StringMapEntryBase *RemoveKey(StringRef Key);
-
- /// Allocate the table with the specified number of buckets and otherwise
- /// setup the map as empty.
- void init(unsigned Size);
-
-public:
- static StringMapEntryBase *getTombstoneVal() {
- uintptr_t Val = static_cast<uintptr_t>(-1);
- Val <<= PointerLikeTypeTraits<StringMapEntryBase *>::NumLowBitsAvailable;
- return reinterpret_cast<StringMapEntryBase *>(Val);
- }
-
- unsigned getNumBuckets() const { return NumBuckets; }
- unsigned getNumItems() const { return NumItems; }
-
- bool empty() const { return NumItems == 0; }
- unsigned size() const { return NumItems; }
-
- void swap(StringMapImpl &Other) {
- std::swap(TheTable, Other.TheTable);
- std::swap(NumBuckets, Other.NumBuckets);
- std::swap(NumItems, Other.NumItems);
- std::swap(NumTombstones, Other.NumTombstones);
- }
-};
-
-/// StringMapEntry - This is used to represent one value that is inserted into
-/// a StringMap. It contains the Value itself and the key: the string length
-/// and data.
-template<typename ValueTy>
-class StringMapEntry : public StringMapEntryBase {
- StringMapEntry(StringMapEntry &E) = delete;
-
-public:
- ValueTy second;
-
- explicit StringMapEntry(unsigned strLen)
- : StringMapEntryBase(strLen), second() {}
- template <typename... InitTy>
- StringMapEntry(unsigned strLen, InitTy &&... InitVals)
- : StringMapEntryBase(strLen), second(std::forward<InitTy>(InitVals)...) {}
-
- StringRef getKey() const {
- return StringRef(getKeyData(), getKeyLength());
- }
-
- const ValueTy &getValue() const { return second; }
- ValueTy &getValue() { return second; }
-
- void setValue(const ValueTy &V) { second = V; }
-
- /// getKeyData - Return the start of the string data that is the key for this
- /// value. The string data is always stored immediately after the
- /// StringMapEntry object.
- const char *getKeyData() const {return reinterpret_cast<const char*>(this+1);}
-
- StringRef first() const { return StringRef(getKeyData(), getKeyLength()); }
-
- /// Create a StringMapEntry for the specified key construct the value using
- /// \p InitiVals.
- template <typename... InitTy>
- static StringMapEntry *Create(StringRef Key, InitTy &&... InitVals) {
- unsigned KeyLength = Key.size();
-
- // Allocate a new item with space for the string at the end and a null
- // terminator.
- unsigned AllocSize = static_cast<unsigned>(sizeof(StringMapEntry))+
- KeyLength+1;
-
- StringMapEntry *NewItem =
- static_cast<StringMapEntry*>(std::malloc(AllocSize));
-
- // Construct the value.
- new (NewItem) StringMapEntry(KeyLength, std::forward<InitTy>(InitVals)...);
-
- // Copy the string information.
- char *StrBuffer = const_cast<char*>(NewItem->getKeyData());
- if (KeyLength > 0)
- memcpy(StrBuffer, Key.data(), KeyLength);
- StrBuffer[KeyLength] = 0; // Null terminate for convenience of clients.
- return NewItem;
- }
-
- static StringMapEntry *Create(StringRef Key) {
- return Create(Key, ValueTy());
- }
-
- /// GetStringMapEntryFromKeyData - Given key data that is known to be embedded
- /// into a StringMapEntry, return the StringMapEntry itself.
- static StringMapEntry &GetStringMapEntryFromKeyData(const char *KeyData) {
- char *Ptr = const_cast<char*>(KeyData) - sizeof(StringMapEntry<ValueTy>);
- return *reinterpret_cast<StringMapEntry*>(Ptr);
- }
-
- /// Destroy - Destroy this StringMapEntry, releasing memory back to the
- /// specified allocator.
- void Destroy() {
- // Free memory referenced by the item.
- this->~StringMapEntry();
- std::free(static_cast<void *>(this));
- }
-};
-
-
-/// StringMap - This is an unconventional map that is specialized for handling
-/// keys that are "strings", which are basically ranges of bytes. This does some
-/// funky memory allocation and hashing things to make it extremely efficient,
-/// storing the string data *after* the value in the map.
-template<typename ValueTy>
-class StringMap : public StringMapImpl {
-public:
- typedef StringMapEntry<ValueTy> MapEntryTy;
-
- StringMap() : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))) {}
- explicit StringMap(unsigned InitialSize)
- : StringMapImpl(InitialSize, static_cast<unsigned>(sizeof(MapEntryTy))) {}
-
- StringMap(std::initializer_list<std::pair<StringRef, ValueTy>> List)
- : StringMapImpl(List.size(), static_cast<unsigned>(sizeof(MapEntryTy))) {
- for (const auto &P : List) {
- insert(P);
- }
- }
-
- StringMap(StringMap &&RHS)
- : StringMapImpl(std::move(RHS)) {}
-
- StringMap &operator=(StringMap RHS) {
- StringMapImpl::swap(RHS);
- return *this;
- }
-
- StringMap(const StringMap &RHS) :
- StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))) {
- if (RHS.empty())
- return;
-
- // Allocate TheTable of the same size as RHS's TheTable, and set the
- // sentinel appropriately (and NumBuckets).
- init(RHS.NumBuckets);
- unsigned *HashTable = (unsigned *)(TheTable + NumBuckets + 1),
- *RHSHashTable = (unsigned *)(RHS.TheTable + NumBuckets + 1);
-
- NumItems = RHS.NumItems;
- NumTombstones = RHS.NumTombstones;
- for (unsigned I = 0, E = NumBuckets; I != E; ++I) {
- StringMapEntryBase *Bucket = RHS.TheTable[I];
- if (!Bucket || Bucket == getTombstoneVal()) {
- TheTable[I] = Bucket;
- continue;
- }
-
- TheTable[I] = MapEntryTy::Create(
- static_cast<MapEntryTy *>(Bucket)->getKey(),
- static_cast<MapEntryTy *>(Bucket)->getValue());
- HashTable[I] = RHSHashTable[I];
- }
-
- // Note that here we've copied everything from the RHS into this object,
- // tombstones included. We could, instead, have re-probed for each key to
- // instantiate this new object without any tombstone buckets. The
- // assumption here is that items are rarely deleted from most StringMaps,
- // and so tombstones are rare, so the cost of re-probing for all inputs is
- // not worthwhile.
- }
-
-
- typedef const char* key_type;
- typedef ValueTy mapped_type;
- typedef StringMapEntry<ValueTy> value_type;
- typedef size_t size_type;
-
- typedef StringMapConstIterator<ValueTy> const_iterator;
- typedef StringMapIterator<ValueTy> iterator;
-
- iterator begin() {
- return iterator(TheTable, NumBuckets == 0);
- }
- iterator end() {
- return iterator(TheTable+NumBuckets, true);
- }
- const_iterator begin() const {
- return const_iterator(TheTable, NumBuckets == 0);
- }
- const_iterator end() const {
- return const_iterator(TheTable+NumBuckets, true);
- }
-
- iterator find(StringRef Key) {
- int Bucket = FindKey(Key);
- if (Bucket == -1) return end();
- return iterator(TheTable+Bucket, true);
- }
-
- const_iterator find(StringRef Key) const {
- int Bucket = FindKey(Key);
- if (Bucket == -1) return end();
- return const_iterator(TheTable+Bucket, true);
- }
-
- /// lookup - Return the entry for the specified key, or a default
- /// constructed value if no such entry exists.
- ValueTy lookup(StringRef Key) const {
- const_iterator it = find(Key);
- if (it != end())
- return it->second;
- return ValueTy();
- }
-
- /// Lookup the ValueTy for the \p Key, or create a default constructed value
- /// if the key is not in the map.
- ValueTy &operator[](StringRef Key) {
- return emplace_second(Key).first->second;
- }
-
- /// count - Return 1 if the element is in the map, 0 otherwise.
- size_type count(StringRef Key) const {
- return find(Key) == end() ? 0 : 1;
- }
-
- /// insert - Insert the specified key/value pair into the map. If the key
- /// already exists in the map, return false and ignore the request, otherwise
- /// insert it and return true.
- bool insert(MapEntryTy *KeyValue) {
- unsigned BucketNo = LookupBucketFor(KeyValue->getKey());
- StringMapEntryBase *&Bucket = TheTable[BucketNo];
- if (Bucket && Bucket != getTombstoneVal())
- return false; // Already exists in map.
-
- if (Bucket == getTombstoneVal())
- --NumTombstones;
- Bucket = KeyValue;
- ++NumItems;
- assert(NumItems + NumTombstones <= NumBuckets);
-
- RehashTable();
- return true;
- }
-
- /// insert - Inserts the specified key/value pair into the map if the key
- /// isn't already in the map. The bool component of the returned pair is true
- /// if and only if the insertion takes place, and the iterator component of
- /// the pair points to the element with key equivalent to the key of the pair.
- std::pair<iterator, bool> insert(std::pair<StringRef, ValueTy> KV) {
- return emplace_second(KV.first, std::move(KV.second));
- }
-
- /// Emplace a new element for the specified key into the map if the key isn't
- /// already in the map. The bool component of the returned pair is true
- /// if and only if the insertion takes place, and the iterator component of
- /// the pair points to the element with key equivalent to the key of the pair.
- template <typename... ArgsTy>
- std::pair<iterator, bool> emplace_second(StringRef Key, ArgsTy &&... Args) {
- unsigned BucketNo = LookupBucketFor(Key);
- StringMapEntryBase *&Bucket = TheTable[BucketNo];
- if (Bucket && Bucket != getTombstoneVal())
- return std::make_pair(iterator(TheTable + BucketNo, false),
- false); // Already exists in map.
-
- if (Bucket == getTombstoneVal())
- --NumTombstones;
- Bucket = MapEntryTy::Create(Key, std::forward<ArgsTy>(Args)...);
- ++NumItems;
- assert(NumItems + NumTombstones <= NumBuckets);
-
- BucketNo = RehashTable(BucketNo);
- return std::make_pair(iterator(TheTable + BucketNo, false), true);
- }
-
- // clear - Empties out the StringMap
- void clear() {
- if (empty()) return;
-
- // Zap all values, resetting the keys back to non-present (not tombstone),
- // which is safe because we're removing all elements.
- for (unsigned I = 0, E = NumBuckets; I != E; ++I) {
- StringMapEntryBase *&Bucket = TheTable[I];
- if (Bucket && Bucket != getTombstoneVal()) {
- static_cast<MapEntryTy*>(Bucket)->Destroy();
- }
- Bucket = nullptr;
- }
-
- NumItems = 0;
- NumTombstones = 0;
- }
-
- /// remove - Remove the specified key/value pair from the map, but do not
- /// erase it. This aborts if the key is not in the map.
- void remove(MapEntryTy *KeyValue) {
- RemoveKey(KeyValue);
- }
-
- void erase(iterator I) {
- MapEntryTy &V = *I;
- remove(&V);
- V.Destroy();
- }
-
- bool erase(StringRef Key) {
- iterator I = find(Key);
- if (I == end()) return false;
- erase(I);
- return true;
- }
-
- ~StringMap() {
- // Delete all the elements in the map, but don't reset the elements
- // to default values. This is a copy of clear(), but avoids unnecessary
- // work not required in the destructor.
- if (!empty()) {
- for (unsigned I = 0, E = NumBuckets; I != E; ++I) {
- StringMapEntryBase *Bucket = TheTable[I];
- if (Bucket && Bucket != getTombstoneVal()) {
- static_cast<MapEntryTy*>(Bucket)->Destroy();
- }
- }
- }
- free(TheTable);
- }
-};
-
-template <typename ValueTy> class StringMapConstIterator {
-protected:
- StringMapEntryBase **Ptr;
-
-public:
- typedef StringMapEntry<ValueTy> value_type;
-
- StringMapConstIterator() : Ptr(nullptr) { }
-
- explicit StringMapConstIterator(StringMapEntryBase **Bucket,
- bool NoAdvance = false)
- : Ptr(Bucket) {
- if (!NoAdvance) AdvancePastEmptyBuckets();
- }
-
- const value_type &operator*() const {
- return *static_cast<StringMapEntry<ValueTy>*>(*Ptr);
- }
- const value_type *operator->() const {
- return static_cast<StringMapEntry<ValueTy>*>(*Ptr);
- }
-
- bool operator==(const StringMapConstIterator &RHS) const {
- return Ptr == RHS.Ptr;
- }
- bool operator!=(const StringMapConstIterator &RHS) const {
- return Ptr != RHS.Ptr;
- }
-
- inline StringMapConstIterator& operator++() { // Preincrement
- ++Ptr;
- AdvancePastEmptyBuckets();
- return *this;
- }
- StringMapConstIterator operator++(int) { // Postincrement
- StringMapConstIterator tmp = *this; ++*this; return tmp;
- }
-
-private:
- void AdvancePastEmptyBuckets() {
- while (*Ptr == nullptr || *Ptr == StringMapImpl::getTombstoneVal())
- ++Ptr;
- }
-};
-
-template<typename ValueTy>
-class StringMapIterator : public StringMapConstIterator<ValueTy> {
-public:
- StringMapIterator() {}
- explicit StringMapIterator(StringMapEntryBase **Bucket,
- bool NoAdvance = false)
- : StringMapConstIterator<ValueTy>(Bucket, NoAdvance) {
- }
- StringMapEntry<ValueTy> &operator*() const {
- return *static_cast<StringMapEntry<ValueTy>*>(*this->Ptr);
- }
- StringMapEntry<ValueTy> *operator->() const {
- return static_cast<StringMapEntry<ValueTy>*>(*this->Ptr);
- }
-};
-
-} // namespace llvm
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/StringRef.h b/third_party/ntcore_2017/wpiutil/include/llvm/StringRef.h
deleted file mode 100644
index c147534..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/StringRef.h
+++ /dev/null
@@ -1,623 +0,0 @@
-//===--- StringRef.h - Constant String Reference Wrapper --------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_STRINGREF_H
-#define LLVM_ADT_STRINGREF_H
-
-#include "llvm/iterator_range.h"
-#include "llvm/Compiler.h"
-#include <algorithm>
-#include <cassert>
-#include <cstring>
-#include <limits>
-#include <ostream>
-#include <string>
-#include <utility>
-
-namespace llvm {
- template <typename T>
- class SmallVectorImpl;
- class hash_code;
- class StringRef;
-
- /// Helper functions for StringRef::getAsInteger.
- bool getAsUnsignedInteger(StringRef Str, unsigned Radix,
- unsigned long long &Result);
-
- bool getAsSignedInteger(StringRef Str, unsigned Radix, long long &Result);
-
- /// StringRef - Represent a constant reference to a string, i.e. a character
- /// array and a length, which need not be null terminated.
- ///
- /// This class does not own the string data, it is expected to be used in
- /// situations where the character data resides in some other buffer, whose
- /// lifetime extends past that of the StringRef. For this reason, it is not in
- /// general safe to store a StringRef.
- class StringRef {
- public:
- typedef const char *iterator;
- typedef const char *const_iterator;
- static const size_t npos = ~size_t(0);
- typedef size_t size_type;
-
- private:
- /// The start of the string, in an external buffer.
- const char *Data;
-
- /// The length of the string.
- /// MSB of length indicates if we are null terminated or not
- /// Flag set is null terminated, flag not set is not
- size_t Length;
-
- // Workaround memcmp issue with null pointers (undefined behavior)
- // by providing a specialized version
- static int compareMemory(const char *Lhs, const char *Rhs, size_t Length) {
- if (Length == 0) { return 0; }
- return ::memcmp(Lhs,Rhs,Length);
- }
-
- /// Set the flag to say we are null terminated
- void set_null_terminated(bool set) {
- if (set)
- Length |= ((size_t)1 << (sizeof(size_t) * 8 - 1));
- else {
- Length &= ~((size_t)1 << (sizeof(size_t) * 8 - 1));
- }
- }
-
- public:
- /// @name Constructors
- /// @{
-
- /// Construct an empty string ref.
- /*implicit*/ StringRef() : Data(nullptr), Length(0) {}
-
- /// Construct a string ref from a cstring.
- /*implicit*/ StringRef(const char *Str)
- : Data(Str) {
- assert(Str && "StringRef cannot be built from a NULL argument");
- Length = ::strlen(Str); // invoking strlen(NULL) is undefined behavior
- // Require length to not use MSB of size
- assert(Length < ~((size_t)1 << (sizeof(size_t) * 8 - 1)));
- // If from a const char*, we are null terminated
- set_null_terminated(true);
- }
-
- /// Construct a string ref from a pointer and length.
- /*implicit*/ StringRef(const char *data, size_t length)
- : Data(data), Length(length) {
- assert((data || length == 0) &&
- "StringRef cannot be built from a NULL argument with non-null length");
- // Require length to not use MSB of size
- assert(Length < ~((size_t)1 << (sizeof(size_t) * 8 - 1)));
- // If passed an explicit length, we are not null terminated
- set_null_terminated(false);
- }
-
- /// Construct a string ref from an std::string.
- /*implicit*/ StringRef(const std::string &Str)
- : Data(Str.data()), Length(Str.length()) {
- // Require length to not use MSB of size
- assert(Length < ~((size_t)1 << (sizeof(size_t) * 8 - 1)));
- // If from a std::string, we are null terminated
- set_null_terminated(true);
- }
-
- /// @}
- /// @name Iterators
- /// @{
-
- iterator begin() const { return Data; }
-
- iterator end() const { return Data + size(); }
-
- const unsigned char *bytes_begin() const {
- return reinterpret_cast<const unsigned char *>(begin());
- }
- const unsigned char *bytes_end() const {
- return reinterpret_cast<const unsigned char *>(end());
- }
- iterator_range<const unsigned char *> bytes() const {
- return make_range(bytes_begin(), bytes_end());
- }
-
- /// @}
- /// @name String Operations
- /// @{
-
- /// data - Get a pointer to the start of the string (which may not be null
- /// terminated).
- const char *data() const { return Data; }
-
- /// c_str - Get a null terminated pointer to the start of the string
- /// If string is not null terminated, use buffer to store new string
- const char *c_str(llvm::SmallVectorImpl<char>& buf) const;
-
- /// empty - Check if the string is empty.
- bool empty() const { return size() == 0; }
-
- /// size - Get the string size.
- size_t size() const {
- return Length & ~((size_t)1 << (sizeof(size_t) * 8 - 1));
- }
-
- /// is_null_terminated - Get if the string is guaranteed null terminated
- bool is_null_terminated() const {
- return (Length & ((size_t)1 << (sizeof(size_t) * 8 - 1))) ==
- ((size_t)1 << (sizeof(size_t) * 8 - 1));
- }
-
- /// front - Get the first character in the string.
- char front() const {
- assert(!empty());
- return Data[0];
- }
-
- /// back - Get the last character in the string.
- char back() const {
- assert(!empty());
- return Data[size()-1];
- }
-
- // copy - Allocate copy in Allocator and return StringRef to it.
- template <typename Allocator> StringRef copy(Allocator &A) const {
- // Don't request a length 0 copy from the allocator.
- if (empty())
- return StringRef();
- char *S = A.template Allocate<char>(size());
- std::copy(begin(), end(), S);
- return StringRef(S, size());
- }
-
- /// equals - Check for string equality, this is more efficient than
- /// compare() when the relative ordering of inequal strings isn't needed.
- bool equals(StringRef RHS) const {
- return (size() == RHS.size() &&
- compareMemory(Data, RHS.Data, RHS.size()) == 0);
- }
-
- /// equals_lower - Check for string equality, ignoring case.
- bool equals_lower(StringRef RHS) const {
- return size() == RHS.size() && compare_lower(RHS) == 0;
- }
-
- /// compare - Compare two strings; the result is -1, 0, or 1 if this string
- /// is lexicographically less than, equal to, or greater than the \p RHS.
- int compare(StringRef RHS) const {
- // Check the prefix for a mismatch.
- if (int Res = compareMemory(Data, RHS.Data, std::min(size(), RHS.size())))
- return Res < 0 ? -1 : 1;
-
- // Otherwise the prefixes match, so we only need to check the lengths.
- if (size() == RHS.size())
- return 0;
- return size() < RHS.size() ? -1 : 1;
- }
-
- /// compare_lower - Compare two strings, ignoring case.
- int compare_lower(StringRef RHS) const;
-
- /// compare_numeric - Compare two strings, treating sequences of digits as
- /// numbers.
- int compare_numeric(StringRef RHS) const;
-
- /// str - Get the contents as an std::string.
- std::string str() const {
- if (!Data) return std::string();
- return std::string(Data, size());
- }
-
- /// @}
- /// @name Operator Overloads
- /// @{
-
- char operator[](size_t Index) const {
- assert(Index < size() && "Invalid index!");
- return Data[Index];
- }
-
- /// @}
- /// @name Type Conversions
- /// @{
-
- operator std::string() const {
- return str();
- }
-
- /// @}
- /// @name String Predicates
- /// @{
-
- /// Check if this string starts with the given \p Prefix.
- bool startswith(StringRef Prefix) const {
- return size() >= Prefix.size() &&
- compareMemory(Data, Prefix.Data, Prefix.size()) == 0;
- }
-
- /// Check if this string starts with the given \p Prefix, ignoring case.
- bool startswith_lower(StringRef Prefix) const;
-
- /// Check if this string ends with the given \p Suffix.
- bool endswith(StringRef Suffix) const {
- return size() >= Suffix.size() &&
- compareMemory(end() - Suffix.size(), Suffix.Data, Suffix.size()) == 0;
- }
-
- /// Check if this string ends with the given \p Suffix, ignoring case.
- bool endswith_lower(StringRef Suffix) const;
-
- /// @}
- /// @name String Searching
- /// @{
-
- /// Search for the first character \p C in the string.
- ///
- /// \returns The index of the first occurrence of \p C, or npos if not
- /// found.
- size_t find(char C, size_t From = 0) const {
- size_t FindBegin = std::min(From, size());
- if (FindBegin < size()) { // Avoid calling memchr with nullptr.
- // Just forward to memchr, which is faster than a hand-rolled loop.
- if (const void *P = ::memchr(Data + FindBegin, C, size() - FindBegin))
- return static_cast<const char *>(P) - Data;
- }
- return npos;
- }
-
- /// Search for the first string \p Str in the string.
- ///
- /// \returns The index of the first occurrence of \p Str, or npos if not
- /// found.
- size_t find(StringRef Str, size_t From = 0) const;
-
- /// Search for the last character \p C in the string.
- ///
- /// \returns The index of the last occurrence of \p C, or npos if not
- /// found.
- size_t rfind(char C, size_t From = npos) const {
- From = std::min(From, size());
- size_t i = From;
- while (i != 0) {
- --i;
- if (Data[i] == C)
- return i;
- }
- return npos;
- }
-
- /// Search for the last string \p Str in the string.
- ///
- /// \returns The index of the last occurrence of \p Str, or npos if not
- /// found.
- size_t rfind(StringRef Str) const;
-
- /// Find the first character in the string that is \p C, or npos if not
- /// found. Same as find.
- size_t find_first_of(char C, size_t From = 0) const {
- return find(C, From);
- }
-
- /// Find the first character in the string that is in \p Chars, or npos if
- /// not found.
- ///
- /// Complexity: O(size() + Chars.size())
- size_t find_first_of(StringRef Chars, size_t From = 0) const;
-
- /// Find the first character in the string that is not \p C or npos if not
- /// found.
- size_t find_first_not_of(char C, size_t From = 0) const;
-
- /// Find the first character in the string that is not in the string
- /// \p Chars, or npos if not found.
- ///
- /// Complexity: O(size() + Chars.size())
- size_t find_first_not_of(StringRef Chars, size_t From = 0) const;
-
- /// Find the last character in the string that is \p C, or npos if not
- /// found.
- size_t find_last_of(char C, size_t From = npos) const {
- return rfind(C, From);
- }
-
- /// Find the last character in the string that is in \p C, or npos if not
- /// found.
- ///
- /// Complexity: O(size() + Chars.size())
- size_t find_last_of(StringRef Chars, size_t From = npos) const;
-
- /// Find the last character in the string that is not \p C, or npos if not
- /// found.
- size_t find_last_not_of(char C, size_t From = npos) const;
-
- /// Find the last character in the string that is not in \p Chars, or
- /// npos if not found.
- ///
- /// Complexity: O(size() + Chars.size())
- size_t find_last_not_of(StringRef Chars, size_t From = npos) const;
-
- /// @}
- /// @name Helpful Algorithms
- /// @{
-
- /// Return the number of occurrences of \p C in the string.
- size_t count(char C) const {
- size_t Count = 0;
- for (size_t i = 0, e = size(); i != e; ++i)
- if (Data[i] == C)
- ++Count;
- return Count;
- }
-
- /// Return the number of non-overlapped occurrences of \p Str in
- /// the string.
- size_t count(StringRef Str) const;
-
- /// Parse the current string as an integer of the specified radix. If
- /// \p Radix is specified as zero, this does radix autosensing using
- /// extended C rules: 0 is octal, 0x is hex, 0b is binary.
- ///
- /// If the string is invalid or if only a subset of the string is valid,
- /// this returns true to signify the error. The string is considered
- /// erroneous if empty or if it overflows T.
- template <typename T>
- typename std::enable_if<std::numeric_limits<T>::is_signed, bool>::type
- getAsInteger(unsigned Radix, T &Result) const {
- long long LLVal;
- if (getAsSignedInteger(*this, Radix, LLVal) ||
- static_cast<T>(LLVal) != LLVal)
- return true;
- Result = LLVal;
- return false;
- }
-
- template <typename T>
- typename std::enable_if<!std::numeric_limits<T>::is_signed, bool>::type
- getAsInteger(unsigned Radix, T &Result) const {
- unsigned long long ULLVal;
- // The additional cast to unsigned long long is required to avoid the
- // Visual C++ warning C4805: '!=' : unsafe mix of type 'bool' and type
- // 'unsigned __int64' when instantiating getAsInteger with T = bool.
- if (getAsUnsignedInteger(*this, Radix, ULLVal) ||
- static_cast<unsigned long long>(static_cast<T>(ULLVal)) != ULLVal)
- return true;
- Result = ULLVal;
- return false;
- }
-
- /// @}
- /// @name String Operations
- /// @{
-
- // Convert the given ASCII string to lowercase.
- std::string lower() const;
-
- /// Convert the given ASCII string to uppercase.
- std::string upper() const;
-
- /// @}
- /// @name Substring Operations
- /// @{
-
- /// Return a reference to the substring from [Start, Start + N).
- ///
- /// \param Start The index of the starting character in the substring; if
- /// the index is npos or greater than the length of the string then the
- /// empty substring will be returned.
- ///
- /// \param N The number of characters to included in the substring. If N
- /// exceeds the number of characters remaining in the string, the string
- /// suffix (starting with \p Start) will be returned.
- StringRef substr(size_t Start, size_t N = npos) const {
- Start = std::min(Start, size());
- return StringRef(Data + Start, std::min(N, size() - Start));
- }
-
- /// Return a StringRef equal to 'this' but with the first \p N elements
- /// dropped.
- StringRef drop_front(size_t N = 1) const {
- assert(size() >= N && "Dropping more elements than exist");
- return substr(N);
- }
-
- /// Return a StringRef equal to 'this' but with the last \p N elements
- /// dropped.
- StringRef drop_back(size_t N = 1) const {
- assert(size() >= N && "Dropping more elements than exist");
- return substr(0, size()-N);
- }
-
- /// Return a reference to the substring from [Start, End).
- ///
- /// \param Start The index of the starting character in the substring; if
- /// the index is npos or greater than the length of the string then the
- /// empty substring will be returned.
- ///
- /// \param End The index following the last character to include in the
- /// substring. If this is npos or exceeds the number of characters
- /// remaining in the string, the string suffix (starting with \p Start)
- /// will be returned. If this is less than \p Start, an empty string will
- /// be returned.
- StringRef slice(size_t Start, size_t End) const {
- Start = std::min(Start, size());
- End = std::min(std::max(Start, End), size());
- return StringRef(Data + Start, End - Start);
- }
-
- /// Split into two substrings around the first occurrence of a separator
- /// character.
- ///
- /// If \p Separator is in the string, then the result is a pair (LHS, RHS)
- /// such that (*this == LHS + Separator + RHS) is true and RHS is
- /// maximal. If \p Separator is not in the string, then the result is a
- /// pair (LHS, RHS) where (*this == LHS) and (RHS == "").
- ///
- /// \param Separator The character to split on.
- /// \returns The split substrings.
- std::pair<StringRef, StringRef> split(char Separator) const {
- size_t Idx = find(Separator);
- if (Idx == npos)
- return std::make_pair(*this, StringRef());
- return std::make_pair(slice(0, Idx), slice(Idx+1, npos));
- }
-
- /// Split into two substrings around the first occurrence of a separator
- /// string.
- ///
- /// If \p Separator is in the string, then the result is a pair (LHS, RHS)
- /// such that (*this == LHS + Separator + RHS) is true and RHS is
- /// maximal. If \p Separator is not in the string, then the result is a
- /// pair (LHS, RHS) where (*this == LHS) and (RHS == "").
- ///
- /// \param Separator - The string to split on.
- /// \return - The split substrings.
- std::pair<StringRef, StringRef> split(StringRef Separator) const {
- size_t Idx = find(Separator);
- if (Idx == npos)
- return std::make_pair(*this, StringRef());
- return std::make_pair(slice(0, Idx), slice(Idx + Separator.size(), npos));
- }
-
- /// Split into substrings around the occurrences of a separator string.
- ///
- /// Each substring is stored in \p A. If \p MaxSplit is >= 0, at most
- /// \p MaxSplit splits are done and consequently <= \p MaxSplit + 1
- /// elements are added to A.
- /// If \p KeepEmpty is false, empty strings are not added to \p A. They
- /// still count when considering \p MaxSplit
- /// An useful invariant is that
- /// Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true
- ///
- /// \param A - Where to put the substrings.
- /// \param Separator - The string to split on.
- /// \param MaxSplit - The maximum number of times the string is split.
- /// \param KeepEmpty - True if empty substring should be added.
- void split(SmallVectorImpl<StringRef> &A,
- StringRef Separator, int MaxSplit = -1,
- bool KeepEmpty = true) const;
-
- /// Split into substrings around the occurrences of a separator character.
- ///
- /// Each substring is stored in \p A. If \p MaxSplit is >= 0, at most
- /// \p MaxSplit splits are done and consequently <= \p MaxSplit + 1
- /// elements are added to A.
- /// If \p KeepEmpty is false, empty strings are not added to \p A. They
- /// still count when considering \p MaxSplit
- /// An useful invariant is that
- /// Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true
- ///
- /// \param A - Where to put the substrings.
- /// \param Separator - The string to split on.
- /// \param MaxSplit - The maximum number of times the string is split.
- /// \param KeepEmpty - True if empty substring should be added.
- void split(SmallVectorImpl<StringRef> &A, char Separator, int MaxSplit = -1,
- bool KeepEmpty = true) const;
-
- /// Split into two substrings around the last occurrence of a separator
- /// character.
- ///
- /// If \p Separator is in the string, then the result is a pair (LHS, RHS)
- /// such that (*this == LHS + Separator + RHS) is true and RHS is
- /// minimal. If \p Separator is not in the string, then the result is a
- /// pair (LHS, RHS) where (*this == LHS) and (RHS == "").
- ///
- /// \param Separator - The character to split on.
- /// \return - The split substrings.
- std::pair<StringRef, StringRef> rsplit(char Separator) const {
- size_t Idx = rfind(Separator);
- if (Idx == npos)
- return std::make_pair(*this, StringRef());
- return std::make_pair(slice(0, Idx), slice(Idx+1, npos));
- }
-
- /// Return string with consecutive \p Char characters starting from the
- /// the left removed.
- StringRef ltrim(char Char) const {
- return drop_front(std::min(size(), find_first_not_of(Char)));
- }
-
- /// Return string with consecutive characters in \p Chars starting from
- /// the left removed.
- StringRef ltrim(StringRef Chars = " \t\n\v\f\r") const {
- return drop_front(std::min(size(), find_first_not_of(Chars)));
- }
-
- /// Return string with consecutive \p Char characters starting from the
- /// right removed.
- StringRef rtrim(char Char) const {
- return drop_back(size() - std::min(size(), find_last_not_of(Char) + 1));
- }
-
- /// Return string with consecutive characters in \p Chars starting from
- /// the right removed.
- StringRef rtrim(StringRef Chars = " \t\n\v\f\r") const {
- return drop_back(size() - std::min(size(), find_last_not_of(Chars) + 1));
- }
-
- /// Return string with consecutive \p Char characters starting from the
- /// left and right removed.
- StringRef trim(char Char) const {
- return ltrim(Char).rtrim(Char);
- }
-
- /// Return string with consecutive characters in \p Chars starting from
- /// the left and right removed.
- StringRef trim(StringRef Chars = " \t\n\v\f\r") const {
- return ltrim(Chars).rtrim(Chars);
- }
-
- /// @}
- };
-
- /// @name StringRef Comparison Operators
- /// @{
-
- inline bool operator==(StringRef LHS, StringRef RHS) {
- return LHS.equals(RHS);
- }
-
- inline bool operator!=(StringRef LHS, StringRef RHS) {
- return !(LHS == RHS);
- }
-
- inline bool operator<(StringRef LHS, StringRef RHS) {
- return LHS.compare(RHS) == -1;
- }
-
- inline bool operator<=(StringRef LHS, StringRef RHS) {
- return LHS.compare(RHS) != 1;
- }
-
- inline bool operator>(StringRef LHS, StringRef RHS) {
- return LHS.compare(RHS) == 1;
- }
-
- inline bool operator>=(StringRef LHS, StringRef RHS) {
- return LHS.compare(RHS) != -1;
- }
-
- inline std::string &operator+=(std::string &buffer, StringRef string) {
- return buffer.append(string.data(), string.size());
- }
-
- inline std::ostream &operator<<(std::ostream &os, StringRef string) {
- os.write(string.data(), string.size());
- return os;
- }
-
- /// @}
-
- /// \brief Compute a hash_code for a StringRef.
- hash_code hash_value(StringRef S);
-
- // StringRefs can be treated like a POD type.
- template <typename T> struct isPodLike;
- template <> struct isPodLike<StringRef> { static const bool value = true; };
-} // namespace llvm
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/WindowsError.h b/third_party/ntcore_2017/wpiutil/include/llvm/WindowsError.h
deleted file mode 100644
index 63bfe59..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/WindowsError.h
+++ /dev/null
@@ -1,19 +0,0 @@
-//===-- WindowsError.h - Support for mapping windows errors to posix-------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_WINDOWSERROR_H
-#define LLVM_SUPPORT_WINDOWSERROR_H
-
-#include <system_error>
-
-namespace llvm {
-std::error_code mapWindowsError(unsigned EV);
-}
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/iterator_range.h b/third_party/ntcore_2017/wpiutil/include/llvm/iterator_range.h
deleted file mode 100644
index 3dd679b..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/iterator_range.h
+++ /dev/null
@@ -1,68 +0,0 @@
-//===- iterator_range.h - A range adaptor for iterators ---------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-/// \file
-/// This provides a very simple, boring adaptor for a begin and end iterator
-/// into a range type. This should be used to build range views that work well
-/// with range based for loops and range based constructors.
-///
-/// Note that code here follows more standards-based coding conventions as it
-/// is mirroring proposed interfaces for standardization.
-///
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_ITERATOR_RANGE_H
-#define LLVM_ADT_ITERATOR_RANGE_H
-
-#include <utility>
-#include <iterator>
-
-namespace llvm {
-
-/// \brief A range adaptor for a pair of iterators.
-///
-/// This just wraps two iterators into a range-compatible interface. Nothing
-/// fancy at all.
-template <typename IteratorT>
-class iterator_range {
- IteratorT begin_iterator, end_iterator;
-
-public:
- //TODO: Add SFINAE to test that the Container's iterators match the range's
- // iterators.
- template <typename Container>
- iterator_range(Container &&c)
- //TODO: Consider ADL/non-member begin/end calls.
- : begin_iterator(c.begin()), end_iterator(c.end()) {}
- iterator_range(IteratorT begin_iterator, IteratorT end_iterator)
- : begin_iterator(std::move(begin_iterator)),
- end_iterator(std::move(end_iterator)) {}
-
- IteratorT begin() const { return begin_iterator; }
- IteratorT end() const { return end_iterator; }
-};
-
-/// \brief Convenience function for iterating over sub-ranges.
-///
-/// This provides a bit of syntactic sugar to make using sub-ranges
-/// in for loops a bit easier. Analogous to std::make_pair().
-template <class T> iterator_range<T> make_range(T x, T y) {
- return iterator_range<T>(std::move(x), std::move(y));
-}
-
-template <typename T> iterator_range<T> make_range(std::pair<T, T> p) {
- return iterator_range<T>(std::move(p.first), std::move(p.second));
-}
-
-template<typename T>
-iterator_range<decltype(begin(std::declval<T>()))> drop_begin(T &&t, int n) {
- return make_range(std::next(begin(t), n), end(t));
-}
-}
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/raw_os_ostream.h b/third_party/ntcore_2017/wpiutil/include/llvm/raw_os_ostream.h
deleted file mode 100644
index 22dfa59..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/raw_os_ostream.h
+++ /dev/null
@@ -1,42 +0,0 @@
-//===- raw_os_ostream.h - std::ostream adaptor for raw_ostream --*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the raw_os_ostream class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_RAW_OS_OSTREAM_H
-#define LLVM_SUPPORT_RAW_OS_OSTREAM_H
-
-#include "llvm/raw_ostream.h"
-#include <iosfwd>
-
-namespace llvm {
-
-/// raw_os_ostream - A raw_ostream that writes to an std::ostream. This is a
-/// simple adaptor class. It does not check for output errors; clients should
-/// use the underlying stream to detect errors.
-class raw_os_ostream : public raw_ostream {
- std::ostream &OS;
-
- /// write_impl - See raw_ostream::write_impl.
- void write_impl(const char *Ptr, size_t Size) override;
-
- /// current_pos - Return the current position within the stream, not
- /// counting the bytes currently in the buffer.
- uint64_t current_pos() const override;
-
-public:
- raw_os_ostream(std::ostream &O) : OS(O) {}
- ~raw_os_ostream() override;
-};
-
-} // end llvm namespace
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/raw_ostream.h b/third_party/ntcore_2017/wpiutil/include/llvm/raw_ostream.h
deleted file mode 100644
index aa2d98d..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/raw_ostream.h
+++ /dev/null
@@ -1,547 +0,0 @@
-//===--- raw_ostream.h - Raw output stream ----------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the raw_ostream class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_RAW_OSTREAM_H
-#define LLVM_SUPPORT_RAW_OSTREAM_H
-
-#include "llvm/SmallVector.h"
-#include "llvm/StringRef.h"
-#include <cstdint>
-#include <system_error>
-
-namespace llvm {
-class format_object_base;
-class FormattedString;
-class FormattedNumber;
-template <typename T> class SmallVectorImpl;
-
-namespace sys {
-namespace fs {
-enum OpenFlags : unsigned {
- F_None = 0,
-
- /// F_Excl - When opening a file, this flag makes raw_fd_ostream
- /// report an error if the file already exists.
- F_Excl = 1,
-
- /// F_Append - When opening a file, if it already exists append to the
- /// existing file instead of returning an error. This may not be specified
- /// with F_Excl.
- F_Append = 2,
-
- /// The file should be opened in text mode on platforms that make this
- /// distinction.
- F_Text = 4,
-
- /// Open the file for read and write.
- F_RW = 8
-};
-
-inline OpenFlags operator|(OpenFlags A, OpenFlags B) {
- return OpenFlags(unsigned(A) | unsigned(B));
-}
-
-inline OpenFlags &operator|=(OpenFlags &A, OpenFlags B) {
- A = A | B;
- return A;
-}
-} // namespace fs
-} // namespace sys
-
-/// This class implements an extremely fast bulk output stream that can *only*
-/// output to a stream. It does not support seeking, reopening, rewinding, line
-/// buffered disciplines etc. It is a simple buffer that outputs
-/// a chunk at a time.
-class raw_ostream {
-private:
- void operator=(const raw_ostream &) = delete;
- raw_ostream(const raw_ostream &) = delete;
-
- /// The buffer is handled in such a way that the buffer is
- /// uninitialized, unbuffered, or out of space when OutBufCur >=
- /// OutBufEnd. Thus a single comparison suffices to determine if we
- /// need to take the slow path to write a single character.
- ///
- /// The buffer is in one of three states:
- /// 1. Unbuffered (BufferMode == Unbuffered)
- /// 1. Uninitialized (BufferMode != Unbuffered && OutBufStart == 0).
- /// 2. Buffered (BufferMode != Unbuffered && OutBufStart != 0 &&
- /// OutBufEnd - OutBufStart >= 1).
- ///
- /// If buffered, then the raw_ostream owns the buffer if (BufferMode ==
- /// InternalBuffer); otherwise the buffer has been set via SetBuffer and is
- /// managed by the subclass.
- ///
- /// If a subclass installs an external buffer using SetBuffer then it can wait
- /// for a \see write_impl() call to handle the data which has been put into
- /// this buffer.
- char *OutBufStart, *OutBufEnd, *OutBufCur;
-
- enum BufferKind {
- Unbuffered = 0,
- InternalBuffer,
- ExternalBuffer
- } BufferMode;
-
-public:
- // color order matches ANSI escape sequence, don't change
- enum Colors {
- BLACK=0,
- RED,
- GREEN,
- YELLOW,
- BLUE,
- MAGENTA,
- CYAN,
- WHITE,
- SAVEDCOLOR
- };
-
- explicit raw_ostream(bool unbuffered = false)
- : BufferMode(unbuffered ? Unbuffered : InternalBuffer) {
- // Start out ready to flush.
- OutBufStart = OutBufEnd = OutBufCur = nullptr;
- }
-
- virtual ~raw_ostream();
-
- /// tell - Return the current offset with the file.
- uint64_t tell() const { return current_pos() + GetNumBytesInBuffer(); }
-
- //===--------------------------------------------------------------------===//
- // Configuration Interface
- //===--------------------------------------------------------------------===//
-
- /// Set the stream to be buffered, with an automatically determined buffer
- /// size.
- void SetBuffered();
-
- /// Set the stream to be buffered, using the specified buffer size.
- void SetBufferSize(size_t Size) {
- flush();
- SetBufferAndMode(new char[Size], Size, InternalBuffer);
- }
-
- size_t GetBufferSize() const {
- // If we're supposed to be buffered but haven't actually gotten around
- // to allocating the buffer yet, return the value that would be used.
- if (BufferMode != Unbuffered && OutBufStart == nullptr)
- return preferred_buffer_size();
-
- // Otherwise just return the size of the allocated buffer.
- return OutBufEnd - OutBufStart;
- }
-
- /// Set the stream to be unbuffered. When unbuffered, the stream will flush
- /// after every write. This routine will also flush the buffer immediately
- /// when the stream is being set to unbuffered.
- void SetUnbuffered() {
- flush();
- SetBufferAndMode(nullptr, 0, Unbuffered);
- }
-
- size_t GetNumBytesInBuffer() const {
- return OutBufCur - OutBufStart;
- }
-
- //===--------------------------------------------------------------------===//
- // Data Output Interface
- //===--------------------------------------------------------------------===//
-
- void flush() {
- if (OutBufCur != OutBufStart)
- flush_nonempty();
- }
-
- raw_ostream &operator<<(char C) {
- if (OutBufCur >= OutBufEnd)
- return write(C);
- *OutBufCur++ = C;
- return *this;
- }
-
- raw_ostream &operator<<(unsigned char C) {
- if (OutBufCur >= OutBufEnd)
- return write(C);
- *OutBufCur++ = C;
- return *this;
- }
-
- raw_ostream &operator<<(signed char C) {
- if (OutBufCur >= OutBufEnd)
- return write(C);
- *OutBufCur++ = C;
- return *this;
- }
-
- raw_ostream &operator<<(StringRef Str) {
- // Inline fast path, particularly for strings with a known length.
- size_t Size = Str.size();
-
- // Make sure we can use the fast path.
- if (Size > (size_t)(OutBufEnd - OutBufCur))
- return write(Str.data(), Size);
-
- if (Size) {
- memcpy(OutBufCur, Str.data(), Size);
- OutBufCur += Size;
- }
- return *this;
- }
-
- raw_ostream &operator<<(const char *Str) {
- // Inline fast path, particularly for constant strings where a sufficiently
- // smart compiler will simplify strlen.
-
- return this->operator<<(StringRef(Str));
- }
-
- raw_ostream &operator<<(const std::string &Str) {
- // Avoid the fast path, it would only increase code size for a marginal win.
- return write(Str.data(), Str.length());
- }
-
- raw_ostream &operator<<(const llvm::SmallVectorImpl<char> &Str) {
- return write(Str.data(), Str.size());
- }
-
- raw_ostream &operator<<(unsigned long N);
- raw_ostream &operator<<(long N);
- raw_ostream &operator<<(unsigned long long N);
- raw_ostream &operator<<(long long N);
- raw_ostream &operator<<(const void *P);
- raw_ostream &operator<<(unsigned int N) {
- return this->operator<<(static_cast<unsigned long>(N));
- }
-
- raw_ostream &operator<<(int N) {
- return this->operator<<(static_cast<long>(N));
- }
-
- raw_ostream &operator<<(double N);
-
- /// Output \p N in hexadecimal, without any prefix or padding.
- raw_ostream &write_hex(unsigned long long N);
-
- /// Output \p Str, turning '\\', '\t', '\n', '"', and anything that doesn't
- /// satisfy std::isprint into an escape sequence.
- raw_ostream &write_escaped(StringRef Str, bool UseHexEscapes = false);
-
- raw_ostream &write(unsigned char C);
- raw_ostream &write(const char *Ptr, size_t Size);
-
- // Formatted output, see the format() function in Support/Format.h.
- raw_ostream &operator<<(const format_object_base &Fmt);
-
- // Formatted output, see the leftJustify() function in Support/Format.h.
- raw_ostream &operator<<(const FormattedString &);
-
- // Formatted output, see the formatHex() function in Support/Format.h.
- raw_ostream &operator<<(const FormattedNumber &);
-
- /// indent - Insert 'NumSpaces' spaces.
- raw_ostream &indent(unsigned NumSpaces);
-
- /// Changes the foreground color of text that will be output from this point
- /// forward.
- /// @param Color ANSI color to use, the special SAVEDCOLOR can be used to
- /// change only the bold attribute, and keep colors untouched
- /// @param Bold bold/brighter text, default false
- /// @param BG if true change the background, default: change foreground
- /// @returns itself so it can be used within << invocations
- virtual raw_ostream &changeColor(enum Colors Color,
- bool Bold = false,
- bool BG = false) {
- (void)Color;
- (void)Bold;
- (void)BG;
- return *this;
- }
-
- /// Resets the colors to terminal defaults. Call this when you are done
- /// outputting colored text, or before program exit.
- virtual raw_ostream &resetColor() { return *this; }
-
- /// Reverses the foreground and background colors.
- virtual raw_ostream &reverseColor() { return *this; }
-
- /// This function determines if this stream is connected to a "tty" or
- /// "console" window. That is, the output would be displayed to the user
- /// rather than being put on a pipe or stored in a file.
- virtual bool is_displayed() const { return false; }
-
- /// This function determines if this stream is displayed and supports colors.
- virtual bool has_colors() const { return is_displayed(); }
-
- //===--------------------------------------------------------------------===//
- // Subclass Interface
- //===--------------------------------------------------------------------===//
-
-private:
- /// The is the piece of the class that is implemented by subclasses. This
- /// writes the \p Size bytes starting at
- /// \p Ptr to the underlying stream.
- ///
- /// This function is guaranteed to only be called at a point at which it is
- /// safe for the subclass to install a new buffer via SetBuffer.
- ///
- /// \param Ptr The start of the data to be written. For buffered streams this
- /// is guaranteed to be the start of the buffer.
- ///
- /// \param Size The number of bytes to be written.
- ///
- /// \invariant { Size > 0 }
- virtual void write_impl(const char *Ptr, size_t Size) = 0;
-
- // An out of line virtual method to provide a home for the class vtable.
- virtual void handle();
-
- /// Return the current position within the stream, not counting the bytes
- /// currently in the buffer.
- virtual uint64_t current_pos() const = 0;
-
-protected:
- /// Use the provided buffer as the raw_ostream buffer. This is intended for
- /// use only by subclasses which can arrange for the output to go directly
- /// into the desired output buffer, instead of being copied on each flush.
- void SetBuffer(char *BufferStart, size_t Size) {
- SetBufferAndMode(BufferStart, Size, ExternalBuffer);
- }
-
- /// Return an efficient buffer size for the underlying output mechanism.
- virtual size_t preferred_buffer_size() const;
-
- /// Return the beginning of the current stream buffer, or 0 if the stream is
- /// unbuffered.
- const char *getBufferStart() const { return OutBufStart; }
-
- //===--------------------------------------------------------------------===//
- // Private Interface
- //===--------------------------------------------------------------------===//
-private:
- /// Install the given buffer and mode.
- void SetBufferAndMode(char *BufferStart, size_t Size, BufferKind Mode);
-
- /// Flush the current buffer, which is known to be non-empty. This outputs the
- /// currently buffered data and resets the buffer to empty.
- void flush_nonempty();
-
- /// Copy data into the buffer. Size must not be greater than the number of
- /// unused bytes in the buffer.
- void copy_to_buffer(const char *Ptr, size_t Size);
-};
-
-/// An abstract base class for streams implementations that also support a
-/// pwrite operation. This is useful for code that can mostly stream out data,
-/// but needs to patch in a header that needs to know the output size.
-class raw_pwrite_stream : public raw_ostream {
- virtual void pwrite_impl(const char *Ptr, size_t Size, uint64_t Offset) = 0;
-
-public:
- explicit raw_pwrite_stream(bool Unbuffered = false)
- : raw_ostream(Unbuffered) {}
- void pwrite(const char *Ptr, size_t Size, uint64_t Offset) {
-#ifndef NDBEBUG
- uint64_t Pos = tell();
- // /dev/null always reports a pos of 0, so we cannot perform this check
- // in that case.
- if (Pos)
- assert(Size + Offset <= Pos && "We don't support extending the stream");
-#endif
- pwrite_impl(Ptr, Size, Offset);
- }
-};
-
-//===----------------------------------------------------------------------===//
-// File Output Streams
-//===----------------------------------------------------------------------===//
-
-/// A raw_ostream that writes to a file descriptor.
-///
-class raw_fd_ostream : public raw_pwrite_stream {
- int FD;
- bool ShouldClose;
-
- /// Error This flag is true if an error of any kind has been detected.
- ///
- bool Error;
-
- uint64_t pos;
-
- bool SupportsSeeking;
-
- /// See raw_ostream::write_impl.
- void write_impl(const char *Ptr, size_t Size) override;
-
- void pwrite_impl(const char *Ptr, size_t Size, uint64_t Offset) override;
-
- /// Return the current position within the stream, not counting the bytes
- /// currently in the buffer.
- uint64_t current_pos() const override { return pos; }
-
- /// Determine an efficient buffer size.
- size_t preferred_buffer_size() const override;
-
- /// Set the flag indicating that an output error has been encountered.
- void error_detected() { Error = true; }
-
-public:
- /// Open the specified file for writing. If an error occurs, information
- /// about the error is put into EC, and the stream should be immediately
- /// destroyed;
- /// \p Flags allows optional flags to control how the file will be opened.
- ///
- /// As a special case, if Filename is "-", then the stream will use
- /// STDOUT_FILENO instead of opening a file. Note that it will still consider
- /// itself to own the file descriptor. In particular, it will close the
- /// file descriptor when it is done (this is necessary to detect
- /// output errors).
- raw_fd_ostream(StringRef Filename, std::error_code &EC,
- sys::fs::OpenFlags Flags);
-
- /// FD is the file descriptor that this writes to. If ShouldClose is true,
- /// this closes the file when the stream is destroyed.
- raw_fd_ostream(int fd, bool shouldClose, bool unbuffered=false);
-
- ~raw_fd_ostream() override;
-
- /// Manually flush the stream and close the file. Note that this does not call
- /// fsync.
- void close();
-
- bool supportsSeeking() { return SupportsSeeking; }
-
- /// Flushes the stream and repositions the underlying file descriptor position
- /// to the offset specified from the beginning of the file.
- uint64_t seek(uint64_t off);
-
- /// Return the value of the flag in this raw_fd_ostream indicating whether an
- /// output error has been encountered.
- /// This doesn't implicitly flush any pending output. Also, it doesn't
- /// guarantee to detect all errors unless the stream has been closed.
- bool has_error() const {
- return Error;
- }
-
- /// Set the flag read by has_error() to false. If the error flag is set at the
- /// time when this raw_ostream's destructor is called, report_fatal_error is
- /// called to report the error. Use clear_error() after handling the error to
- /// avoid this behavior.
- ///
- /// "Errors should never pass silently.
- /// Unless explicitly silenced."
- /// - from The Zen of Python, by Tim Peters
- ///
- void clear_error() {
- Error = false;
- }
-};
-
-/// This returns a reference to a raw_ostream for standard output. Use it like:
-/// outs() << "foo" << "bar";
-raw_ostream &outs();
-
-/// This returns a reference to a raw_ostream for standard error. Use it like:
-/// errs() << "foo" << "bar";
-raw_ostream &errs();
-
-/// This returns a reference to a raw_ostream which simply discards output.
-raw_ostream &nulls();
-
-//===----------------------------------------------------------------------===//
-// Output Stream Adaptors
-//===----------------------------------------------------------------------===//
-
-/// A raw_ostream that writes to an std::string. This is a simple adaptor
-/// class. This class does not encounter output errors.
-class raw_string_ostream : public raw_ostream {
- std::string &OS;
-
- /// See raw_ostream::write_impl.
- void write_impl(const char *Ptr, size_t Size) override;
-
- /// Return the current position within the stream, not counting the bytes
- /// currently in the buffer.
- uint64_t current_pos() const override { return OS.size(); }
-
-public:
- explicit raw_string_ostream(std::string &O) : OS(O) {}
- ~raw_string_ostream() override;
-
- /// Flushes the stream contents to the target string and returns the string's
- /// reference.
- std::string& str() {
- flush();
- return OS;
- }
-};
-
-/// A raw_ostream that writes to an SmallVector or SmallString. This is a
-/// simple adaptor class. This class does not encounter output errors.
-/// raw_svector_ostream operates without a buffer, delegating all memory
-/// management to the SmallString. Thus the SmallString is always up-to-date,
-/// may be used directly and there is no need to call flush().
-class raw_svector_ostream : public raw_pwrite_stream {
- SmallVectorImpl<char> &OS;
-
- /// See raw_ostream::write_impl.
- void write_impl(const char *Ptr, size_t Size) override;
-
- void pwrite_impl(const char *Ptr, size_t Size, uint64_t Offset) override;
-
- /// Return the current position within the stream.
- uint64_t current_pos() const override;
-
-public:
- /// Construct a new raw_svector_ostream.
- ///
- /// \param O The vector to write to; this should generally have at least 128
- /// bytes free to avoid any extraneous memory overhead.
- explicit raw_svector_ostream(SmallVectorImpl<char> &O) : OS(O) {
- SetUnbuffered();
- }
- ~raw_svector_ostream() override {}
-
- void flush() = delete;
-
- /// Return a StringRef for the vector contents.
- StringRef str() { return StringRef(OS.data(), OS.size()); }
-};
-
-/// A raw_ostream that discards all output.
-class raw_null_ostream : public raw_pwrite_stream {
- /// See raw_ostream::write_impl.
- void write_impl(const char *Ptr, size_t size) override;
- void pwrite_impl(const char *Ptr, size_t Size, uint64_t Offset) override;
-
- /// Return the current position within the stream, not counting the bytes
- /// currently in the buffer.
- uint64_t current_pos() const override;
-
-public:
- explicit raw_null_ostream() {}
- ~raw_null_ostream() override;
-};
-
-class buffer_ostream : public raw_svector_ostream {
- raw_ostream &OS;
- SmallVector<char, 0> Buffer;
-
-public:
- buffer_ostream(raw_ostream &OS) : raw_svector_ostream(Buffer), OS(OS) {}
- ~buffer_ostream() override { OS << str(); }
-};
-
-} // end llvm namespace
-
-#endif // LLVM_SUPPORT_RAW_OSTREAM_H
diff --git a/third_party/ntcore_2017/wpiutil/include/llvm/type_traits.h b/third_party/ntcore_2017/wpiutil/include/llvm/type_traits.h
deleted file mode 100644
index d8ce4fa..0000000
--- a/third_party/ntcore_2017/wpiutil/include/llvm/type_traits.h
+++ /dev/null
@@ -1,95 +0,0 @@
-//===- llvm/Support/type_traits.h - Simplfied type traits -------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file provides useful additions to the standard type_traits library.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_TYPE_TRAITS_H
-#define LLVM_SUPPORT_TYPE_TRAITS_H
-
-#include <type_traits>
-#include <utility>
-
-#include "llvm/Compiler.h"
-
-namespace llvm {
-
-/// isPodLike - This is a type trait that is used to determine whether a given
-/// type can be copied around with memcpy instead of running ctors etc.
-template <typename T>
-struct isPodLike {
- // std::is_trivially_copyable is available in libc++ with clang, libstdc++
- // that comes with GCC 5.
-#if (__has_feature(is_trivially_copyable) && defined(_LIBCPP_VERSION)) || \
- (defined(__GNUC__) && __GNUC__ >= 5)
- // If the compiler supports the is_trivially_copyable trait use it, as it
- // matches the definition of isPodLike closely.
- static const bool value = std::is_trivially_copyable<T>::value;
-#elif __has_feature(is_trivially_copyable)
- // Use the internal name if the compiler supports is_trivially_copyable but we
- // don't know if the standard library does. This is the case for clang in
- // conjunction with libstdc++ from GCC 4.x.
- static const bool value = __is_trivially_copyable(T);
-#else
- // If we don't know anything else, we can (at least) assume that all non-class
- // types are PODs.
- static const bool value = !std::is_class<T>::value;
-#endif
-};
-
-// std::pair's are pod-like if their elements are.
-template<typename T, typename U>
-struct isPodLike<std::pair<T, U> > {
- static const bool value = isPodLike<T>::value && isPodLike<U>::value;
-};
-
-/// \brief Metafunction that determines whether the given type is either an
-/// integral type or an enumeration type, including enum classes.
-///
-/// Note that this accepts potentially more integral types than is_integral
-/// because it is based on being implicitly convertible to an integral type.
-/// Also note that enum classes aren't implicitly convertible to integral types,
-/// the value may therefore need to be explicitly converted before being used.
-template <typename T> class is_integral_or_enum {
- typedef typename std::remove_reference<T>::type UnderlyingT;
-
-public:
- static const bool value =
- !std::is_class<UnderlyingT>::value && // Filter conversion operators.
- !std::is_pointer<UnderlyingT>::value &&
- !std::is_floating_point<UnderlyingT>::value &&
- (std::is_enum<UnderlyingT>::value ||
- std::is_convertible<UnderlyingT, unsigned long long>::value);
-};
-
-/// \brief If T is a pointer, just return it. If it is not, return T&.
-template<typename T, typename Enable = void>
-struct add_lvalue_reference_if_not_pointer { typedef T &type; };
-
-template <typename T>
-struct add_lvalue_reference_if_not_pointer<
- T, typename std::enable_if<std::is_pointer<T>::value>::type> {
- typedef T type;
-};
-
-/// \brief If T is a pointer to X, return a pointer to const X. If it is not,
-/// return const T.
-template<typename T, typename Enable = void>
-struct add_const_past_pointer { typedef const T type; };
-
-template <typename T>
-struct add_const_past_pointer<
- T, typename std::enable_if<std::is_pointer<T>::value>::type> {
- typedef const typename std::remove_pointer<T>::type *type;
-};
-
-} // namespace llvm
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/include/support/Base64.h b/third_party/ntcore_2017/wpiutil/include/support/Base64.h
deleted file mode 100644
index 40cb252..0000000
--- a/third_party/ntcore_2017/wpiutil/include/support/Base64.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef WPIUTIL_SUPPORT_BASE64_H_
-#define WPIUTIL_SUPPORT_BASE64_H_
-
-#include <cstddef>
-#include <string>
-
-#include "llvm/StringRef.h"
-
-namespace wpi {
-
-std::size_t Base64Decode(llvm::StringRef encoded, std::string* plain);
-void Base64Encode(llvm::StringRef plain, std::string* encoded);
-
-} // namespace wpi
-
-#endif // WPIUTIL_SUPPORT_BASE64_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/support/ConcurrentQueue.h b/third_party/ntcore_2017/wpiutil/include/support/ConcurrentQueue.h
deleted file mode 100644
index abe9580..0000000
--- a/third_party/ntcore_2017/wpiutil/include/support/ConcurrentQueue.h
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// Copyright (c) 2013 Juan Palacios juan.palacios.puyana@gmail.com
-// Subject to the BSD 2-Clause License
-// - see < http://opensource.org/licenses/BSD-2-Clause>
-//
-
-#ifndef WPIUTIL_SUPPORT_CONCURRENT_QUEUE_H_
-#define WPIUTIL_SUPPORT_CONCURRENT_QUEUE_H_
-
-#include <queue>
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-
-namespace wpi {
-
-template <typename T>
-class ConcurrentQueue {
- public:
- bool empty() const {
- std::unique_lock<std::mutex> mlock(mutex_);
- return queue_.empty();
- }
-
- typename std::queue<T>::size_type size() const {
- std::unique_lock<std::mutex> mlock(mutex_);
- return queue_.size();
- }
-
- T pop() {
- std::unique_lock<std::mutex> mlock(mutex_);
- while (queue_.empty()) {
- cond_.wait(mlock);
- }
- auto item = std::move(queue_.front());
- queue_.pop();
- return item;
- }
-
- void pop(T& item) {
- std::unique_lock<std::mutex> mlock(mutex_);
- while (queue_.empty()) {
- cond_.wait(mlock);
- }
- item = queue_.front();
- queue_.pop();
- }
-
- void push(const T& item) {
- std::unique_lock<std::mutex> mlock(mutex_);
- queue_.push(item);
- mlock.unlock();
- cond_.notify_one();
- }
-
- void push(T&& item) {
- std::unique_lock<std::mutex> mlock(mutex_);
- queue_.push(std::forward<T>(item));
- mlock.unlock();
- cond_.notify_one();
- }
-
- template <typename... Args>
- void emplace(Args&&... args) {
- std::unique_lock<std::mutex> mlock(mutex_);
- queue_.emplace(std::forward<Args>(args)...);
- mlock.unlock();
- cond_.notify_one();
- }
-
- ConcurrentQueue() = default;
- ConcurrentQueue(const ConcurrentQueue&) = delete;
- ConcurrentQueue& operator=(const ConcurrentQueue&) = delete;
-
- private:
- std::queue<T> queue_;
- mutable std::mutex mutex_;
- std::condition_variable cond_;
-};
-
-} // namespace wpi
-
-#endif // WPIUTIL_SUPPORT_CONCURRENT_QUEUE_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/support/Logger.h b/third_party/ntcore_2017/wpiutil/include/support/Logger.h
deleted file mode 100644
index c19ab9d..0000000
--- a/third_party/ntcore_2017/wpiutil/include/support/Logger.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef WPIUTIL_SUPPORT_LOGGER_H_
-#define WPIUTIL_SUPPORT_LOGGER_H_
-
-#include <functional>
-
-#include "llvm/raw_ostream.h"
-#include "llvm/SmallString.h"
-
-namespace wpi {
-
-enum LogLevel {
- WPI_LOG_CRITICAL = 50,
- WPI_LOG_ERROR = 40,
- WPI_LOG_WARNING = 30,
- WPI_LOG_INFO = 20,
- WPI_LOG_DEBUG = 10,
- WPI_LOG_DEBUG1 = 9,
- WPI_LOG_DEBUG2 = 8,
- WPI_LOG_DEBUG3 = 7,
- WPI_LOG_DEBUG4 = 6
-};
-
-class Logger {
- public:
- typedef std::function<void(unsigned int level, const char* file,
- unsigned int line, const char* msg)> LogFunc;
-
- void SetLogger(LogFunc func) { m_func = func; }
-
- void set_min_level(unsigned int level) { m_min_level = level; }
- unsigned int min_level() const { return m_min_level; }
-
- void Log(unsigned int level, const char* file, unsigned int line,
- const char* msg) {
- if (!m_func || level < m_min_level) return;
- m_func(level, file, line, msg);
- }
-
- bool HasLogger() const { return m_func != nullptr; }
-
- private:
- LogFunc m_func;
- unsigned int m_min_level = 20;
-};
-
-#define WPI_LOG(logger_inst, level, x) \
- do { \
- ::wpi::Logger& WPI_logger_ = logger_inst; \
- if (WPI_logger_.min_level() <= level && WPI_logger_.HasLogger()) { \
- llvm::SmallString<128> log_buf_; \
- llvm::raw_svector_ostream log_os_{log_buf_}; \
- log_os_ << x; \
- WPI_logger_.Log(level, __FILE__, __LINE__, log_buf_.c_str()); \
- } \
- } while (0)
-
-#define WPI_ERROR(inst, x) WPI_LOG(inst, ::wpi::WPI_LOG_ERROR, x)
-#define WPI_WARNING(inst, x) WPI_LOG(inst, ::wpi::WPI_LOG_WARNING, x)
-#define WPI_INFO(inst, x) WPI_LOG(inst, ::wpi::WPI_LOG_INFO, x)
-
-#ifdef NDEBUG
-#define WPI_DEBUG(inst, x) do {} while (0)
-#define WPI_DEBUG1(inst, x) do {} while (0)
-#define WPI_DEBUG2(inst, x) do {} while (0)
-#define WPI_DEBUG3(inst, x) do {} while (0)
-#define WPI_DEBUG4(inst, x) do {} while (0)
-#else
-#define WPI_DEBUG(inst, x) WPI_LOG(inst, ::wpi::WPI_LOG_DEBUG, x)
-#define WPI_DEBUG1(inst, x) WPI_LOG(inst, ::wpi::WPI_LOG_DEBUG1, x)
-#define WPI_DEBUG2(inst, x) WPI_LOG(inst, ::wpi::WPI_LOG_DEBUG2, x)
-#define WPI_DEBUG3(inst, x) WPI_LOG(inst, ::wpi::WPI_LOG_DEBUG3, x)
-#define WPI_DEBUG4(inst, x) WPI_LOG(inst, ::wpi::WPI_LOG_DEBUG4, x)
-#endif
-
-} // namespace wpi
-
-#endif // WPIUTIL_SUPPORT_LOGGER_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/support/SafeThread.h b/third_party/ntcore_2017/wpiutil/include/support/SafeThread.h
deleted file mode 100644
index 465957b..0000000
--- a/third_party/ntcore_2017/wpiutil/include/support/SafeThread.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef WPIUTIL_SUPPORT_SAFETHREAD_H_
-#define WPIUTIL_SUPPORT_SAFETHREAD_H_
-
-#include <atomic>
-#include <condition_variable>
-#include <mutex>
-#include <thread>
-
-namespace wpi {
-
-// Base class for SafeThreadOwner threads.
-class SafeThread {
- public:
- SafeThread() { m_active = true; }
- virtual ~SafeThread() = default;
- virtual void Main() = 0;
-
- std::mutex m_mutex;
- std::atomic_bool m_active;
- std::condition_variable m_cond;
-};
-
-namespace detail {
-
-// Non-template proxy base class for common proxy code.
-class SafeThreadProxyBase {
- public:
- SafeThreadProxyBase(SafeThread* thr) : m_thread(thr) {
- if (!m_thread) return;
- std::unique_lock<std::mutex>(m_thread->m_mutex).swap(m_lock);
- if (!m_thread->m_active) {
- m_lock.unlock();
- m_thread = nullptr;
- return;
- }
- }
- explicit operator bool() const { return m_thread != nullptr; }
- std::unique_lock<std::mutex>& GetLock() { return m_lock; }
-
- protected:
- SafeThread* m_thread;
- std::unique_lock<std::mutex> m_lock;
-};
-
-// A proxy for SafeThread.
-// Also serves as a scoped lock on SafeThread::m_mutex.
-template <typename T>
-class SafeThreadProxy : public SafeThreadProxyBase {
- public:
- SafeThreadProxy(SafeThread* thr) : SafeThreadProxyBase(thr) {}
- T& operator*() const { return *static_cast<T*>(m_thread); }
- T* operator->() const { return static_cast<T*>(m_thread); }
-};
-
-// Non-template owner base class for common owner code.
-class SafeThreadOwnerBase {
- public:
- void Stop();
-
- SafeThreadOwnerBase() { m_thread = nullptr; }
- SafeThreadOwnerBase(const SafeThreadOwnerBase&) = delete;
- SafeThreadOwnerBase& operator=(const SafeThreadOwnerBase&) = delete;
- SafeThreadOwnerBase(SafeThreadOwnerBase&& other)
- : m_thread(other.m_thread.exchange(nullptr)) {}
- SafeThreadOwnerBase& operator=(SafeThreadOwnerBase other) {
- SafeThread* otherthr = other.m_thread.exchange(nullptr);
- SafeThread* curthr = m_thread.exchange(otherthr);
- other.m_thread.exchange(curthr); // other destructor will clean up
- return *this;
- }
- ~SafeThreadOwnerBase() { Stop(); }
-
- explicit operator bool() const { return m_thread.load(); }
-
- protected:
- void Start(SafeThread* thr);
- SafeThread* GetThread() const { return m_thread.load(); }
-
- private:
- std::atomic<SafeThread*> m_thread;
-};
-
-inline void SafeThreadOwnerBase::Start(SafeThread* thr) {
- SafeThread* curthr = nullptr;
- SafeThread* newthr = thr;
- if (!m_thread.compare_exchange_strong(curthr, newthr)) {
- delete newthr;
- return;
- }
- std::thread([=]() {
- newthr->Main();
- delete newthr;
- }).detach();
-}
-
-inline void SafeThreadOwnerBase::Stop() {
- SafeThread* thr = m_thread.exchange(nullptr);
- if (!thr) return;
- thr->m_active = false;
- thr->m_cond.notify_one();
-}
-
-} // namespace detail
-
-template <typename T>
-class SafeThreadOwner : public detail::SafeThreadOwnerBase {
- public:
- void Start() { Start(new T); }
- void Start(T* thr) { detail::SafeThreadOwnerBase::Start(thr); }
-
- using Proxy = typename detail::SafeThreadProxy<T>;
- Proxy GetThread() const {
- return Proxy(detail::SafeThreadOwnerBase::GetThread());
- }
-};
-
-} // namespace wpi
-
-#endif // WPIUTIL_SUPPORT_SAFETHREAD_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/support/atomic_static.h b/third_party/ntcore_2017/wpiutil/include/support/atomic_static.h
deleted file mode 100644
index 146a1de..0000000
--- a/third_party/ntcore_2017/wpiutil/include/support/atomic_static.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef WPIUTIL_SUPPORT_ATOMIC_STATIC_H_
-#define WPIUTIL_SUPPORT_ATOMIC_STATIC_H_
-
-#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
-
-// Just use a local static. This is thread-safe per
-// http://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/
-
-// Per https://msdn.microsoft.com/en-us/library/Hh567368.aspx "Magic Statics"
-// are supported in Visual Studio 2015 but not in earlier versions.
-#define ATOMIC_STATIC(cls, inst) static cls inst
-#define ATOMIC_STATIC_DECL(cls)
-#define ATOMIC_STATIC_INIT(cls)
-
-#else
-// From http://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/
-#include <atomic>
-#include <mutex>
-
-#define ATOMIC_STATIC(cls, inst) \
- cls* inst##tmp = m_instance.load(std::memory_order_acquire); \
- if (inst##tmp == nullptr) { \
- std::lock_guard<std::mutex> lock(m_instance_mutex); \
- inst##tmp = m_instance.load(std::memory_order_relaxed); \
- if (inst##tmp == nullptr) { \
- inst##tmp = new cls; \
- m_instance.store(inst##tmp, std::memory_order_release); \
- } \
- } \
- cls& inst = *inst##tmp
-
-#define ATOMIC_STATIC_DECL(cls) \
- static std::atomic<cls*> m_instance; \
- static std::mutex m_instance_mutex;
-
-#define ATOMIC_STATIC_INIT(cls) \
- std::atomic<cls*> cls::m_instance; \
- std::mutex cls::m_instance_mutex;
-
-#endif
-
-#endif // WPIUTIL_SUPPORT_ATOMIC_STATIC_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/support/deprecated.h b/third_party/ntcore_2017/wpiutil/include/support/deprecated.h
deleted file mode 100644
index 4a22b73..0000000
--- a/third_party/ntcore_2017/wpiutil/include/support/deprecated.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef DEPRECATED_H_
-#define DEPRECATED_H_
-
-// [[deprecated(msg)]] is a C++14 feature not supported by MSVC or GCC < 4.9.
-// We provide an equivalent warning implementation for those compilers here.
-#ifndef WPI_DEPRECATED
- #if defined(_MSC_VER)
- #define WPI_DEPRECATED(msg) __declspec(deprecated(msg))
- #elif defined(__GNUC__)
- #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)
- #if __cplusplus > 201103L
- #define WPI_DEPRECATED(msg) [[deprecated(msg)]]
- #else
- #define WPI_DEPRECATED(msg) [[gnu::deprecated(msg)]]
- #endif
- #else
- #define WPI_DEPRECATED(msg) __attribute__((deprecated(msg)))
- #endif
- #elif __cplusplus > 201103L
- #define WPI_DEPRECATED(msg) [[deprecated(msg)]]
- #else
- #define WPI_DEPRECATED(msg) /*nothing*/
- #endif
-#endif
-
-#endif // DEPRECATED_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/support/jni_util.h b/third_party/ntcore_2017/wpiutil/include/support/jni_util.h
deleted file mode 100644
index 3523894..0000000
--- a/third_party/ntcore_2017/wpiutil/include/support/jni_util.h
+++ /dev/null
@@ -1,608 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef WPIUTIL_SUPPORT_JNI_UTIL_H_
-#define WPIUTIL_SUPPORT_JNI_UTIL_H_
-
-#include <mutex>
-#include <string>
-#include <type_traits>
-#include <queue>
-#include <vector>
-
-#include <jni.h>
-
-#include "llvm/ArrayRef.h"
-#include "llvm/ConvertUTF.h"
-#include "llvm/raw_ostream.h"
-#include "llvm/SmallString.h"
-#include "llvm/SmallVector.h"
-#include "llvm/StringRef.h"
-#include "support/atomic_static.h"
-#include "support/SafeThread.h"
-
-namespace wpi {
-namespace java {
-
-// Gets a Java stack trace. This version also provides the last function
-// in the stack trace not starting with excludeFuncPrefix (useful for e.g.
-// finding the first user call to a series of library functions).
-template <const char* excludeFuncPrefix = nullptr>
-std::string GetJavaStackTrace(JNIEnv* env, std::string* func);
-
-// Gets a Java stack trace.
-inline std::string GetJavaStackTrace(JNIEnv* env) {
- return GetJavaStackTrace(env, nullptr);
-}
-
-// Finds a class and keep it as a global reference.
-// Use with caution, as the destructor does NOT call DeleteGlobalRef due
-// to potential shutdown issues with doing so.
-class JClass {
- public:
- JClass() = default;
-
- JClass(JNIEnv* env, const char* name) {
- jclass local = env->FindClass(name);
- if (!local) return;
- m_cls = static_cast<jclass>(env->NewGlobalRef(local));
- env->DeleteLocalRef(local);
- }
-
- void free(JNIEnv *env) {
- if (m_cls) env->DeleteGlobalRef(m_cls);
- m_cls = nullptr;
- }
-
- explicit operator bool() const { return m_cls; }
-
- operator jclass() const { return m_cls; }
-
- protected:
- jclass m_cls = nullptr;
-};
-
-// Container class for cleaning up Java local references.
-// The destructor calls DeleteLocalRef.
-template <typename T>
-class JLocal {
- public:
- JLocal(JNIEnv *env, T obj) : m_env(env), m_obj(obj) {}
- JLocal(const JLocal&) = delete;
- JLocal(JLocal&& oth) : m_env(oth.m_env), m_obj(oth.m_obj) {
- oth.m_obj = nullptr;
- }
- JLocal& operator=(const JLocal&) = delete;
- JLocal& operator=(JLocal&& oth) {
- m_env = oth.m_env;
- m_obj = oth.m_obj;
- oth.m_obj = nullptr;
- return *this;
- }
- ~JLocal() {
- if (m_obj) m_env->DeleteLocalRef(m_obj);
- }
- operator T() { return m_obj; }
- T obj() { return m_obj; }
-
- private:
- JNIEnv *m_env;
- T m_obj;
-};
-
-//
-// Conversions from Java objects to C++
-//
-
-// Java string (jstring) reference. The string is provided as UTF8.
-// This is not actually a reference, as it makes a copy of the string
-// characters, but it's named this way for consistency.
-class JStringRef {
- public:
- JStringRef(JNIEnv *env, jstring str) {
- if (str) {
- jsize size = env->GetStringLength(str);
- const jchar *chars = env->GetStringCritical(str, nullptr);
- if (chars) {
- llvm::convertUTF16ToUTF8String(llvm::makeArrayRef(chars, size), m_str);
- env->ReleaseStringCritical(str, chars);
- }
- } else {
- llvm::errs() << "JStringRef was passed a null pointer at \n"
- << GetJavaStackTrace(env);
- }
- // Ensure str is null-terminated.
- m_str.push_back('\0');
- m_str.pop_back();
- }
-
- operator llvm::StringRef() const { return m_str; }
- llvm::StringRef str() const { return m_str; }
- const char* c_str() const { return m_str.data(); }
- size_t size() const { return m_str.size(); }
-
- private:
- llvm::SmallString<128> m_str;
-};
-
-// Details for J*ArrayRef and CriticalJ*ArrayRef
-namespace detail {
-
-template <typename C, typename T>
-class JArrayRefInner {};
-
-// Specialization of JArrayRefBase to provide StringRef conversion.
-template <typename C>
-class JArrayRefInner<C, jbyte> {
- public:
- operator llvm::StringRef() const { return str(); }
-
- llvm::StringRef str() const {
- auto arr = static_cast<const C *>(this)->array();
- if (arr.empty()) return llvm::StringRef{};
- return llvm::StringRef{reinterpret_cast<const char *>(arr.data()),
- arr.size()};
- }
-};
-
-// Base class for J*ArrayRef and CriticalJ*ArrayRef
-template <typename T>
-class JArrayRefBase : public JArrayRefInner<JArrayRefBase<T>, T> {
- public:
- explicit operator bool() const { return this->m_elements != nullptr; }
-
- operator llvm::ArrayRef<T>() const { return array(); }
-
- llvm::ArrayRef<T> array() const {
- if (!this->m_elements) return llvm::ArrayRef<T>{};
- return llvm::ArrayRef<T>{this->m_elements, this->m_size};
- }
-
- JArrayRefBase(const JArrayRefBase&) = delete;
- JArrayRefBase& operator=(const JArrayRefBase&) = delete;
-
- JArrayRefBase(JArrayRefBase&& oth)
- : m_env(oth.m_env),
- m_jarr(oth.m_jarr),
- m_size(oth.m_size),
- m_elements(oth.m_elements) {
- oth.m_jarr = nullptr;
- oth.m_elements = nullptr;
- }
-
- JArrayRefBase& operator=(JArrayRefBase&& oth) {
- this->m_env = oth.m_env;
- this->m_jarr = oth.m_jarr;
- this->m_size = oth.m_size;
- this->m_elements = oth.m_elements;
- oth.m_jarr = nullptr;
- oth.m_elements = nullptr;
- }
-
- protected:
- JArrayRefBase(JNIEnv *env, T* elements, size_t size) {
- this->m_env = env;
- this->m_jarr = nullptr;
- this->m_size = size;
- this->m_elements = elements;
- }
-
- JArrayRefBase(JNIEnv *env, jarray jarr) {
- this->m_env = env;
- this->m_jarr = jarr;
- this->m_size = jarr ? env->GetArrayLength(jarr) : 0;
- this->m_elements = nullptr;
- }
-
- JNIEnv *m_env;
- jarray m_jarr = nullptr;
- size_t m_size;
- T *m_elements;
-};
-
-} // namespace detail
-
-// Java array / DirectBuffer reference.
-
-#define WPI_JNI_JARRAYREF(T, F) \
- class J##F##ArrayRef : public detail::JArrayRefBase<T> { \
- public: \
- J##F##ArrayRef(JNIEnv* env, jobject bb, int len) \
- : detail::JArrayRefBase<T>( \
- env, \
- static_cast<T*>(bb ? env->GetDirectBufferAddress(bb) : nullptr), \
- len) { \
- if (!bb) \
- llvm::errs() << "JArrayRef was passed a null pointer at \n" \
- << GetJavaStackTrace(env); \
- } \
- J##F##ArrayRef(JNIEnv* env, T##Array jarr) \
- : detail::JArrayRefBase<T>(env, jarr) { \
- if (jarr) \
- m_elements = env->Get##F##ArrayElements(jarr, nullptr); \
- else \
- llvm::errs() << "JArrayRef was passed a null pointer at \n" \
- << GetJavaStackTrace(env); \
- } \
- ~J##F##ArrayRef() { \
- if (m_jarr && m_elements) \
- m_env->Release##F##ArrayElements(static_cast<T##Array>(m_jarr), \
- m_elements, JNI_ABORT); \
- } \
- }; \
- \
- class CriticalJ##F##ArrayRef : public detail::JArrayRefBase<T> { \
- public: \
- CriticalJ##F##ArrayRef(JNIEnv* env, T##Array jarr) \
- : detail::JArrayRefBase<T>(env, jarr) { \
- if (jarr) \
- m_elements = \
- static_cast<T*>(env->GetPrimitiveArrayCritical(jarr, nullptr)); \
- else \
- llvm::errs() << "JArrayRef was passed a null pointer at \n" \
- << GetJavaStackTrace(env); \
- } \
- ~CriticalJ##F##ArrayRef() { \
- if (m_jarr && m_elements) \
- m_env->ReleasePrimitiveArrayCritical(m_jarr, m_elements, JNI_ABORT); \
- } \
- };
-
-WPI_JNI_JARRAYREF(jboolean, Boolean)
-WPI_JNI_JARRAYREF(jbyte, Byte)
-WPI_JNI_JARRAYREF(jshort, Short)
-WPI_JNI_JARRAYREF(jint, Int)
-WPI_JNI_JARRAYREF(jlong, Long)
-WPI_JNI_JARRAYREF(jfloat, Float)
-WPI_JNI_JARRAYREF(jdouble, Double)
-
-#undef WPI_JNI_JARRAYREF
-
-//
-// Conversions from C++ to Java objects
-//
-
-// Convert a UTF8 string into a jstring.
-inline jstring MakeJString(JNIEnv *env, llvm::StringRef str) {
- llvm::SmallVector<UTF16, 128> chars;
- llvm::convertUTF8ToUTF16String(str, chars);
- return env->NewString(chars.begin(), chars.size());
-}
-
-// details for MakeJIntArray
-namespace detail {
-
-// Slow path (get primitive array and set individual elements). This
-// is used if the input type is not an integer of the same size (note
-// signed/unsigned is ignored).
-template <typename T,
- bool = (std::is_integral<T>::value && sizeof(jint) == sizeof(T))>
-struct ConvertIntArray {
- static jintArray ToJava(JNIEnv *env, llvm::ArrayRef<T> arr) {
- jintArray jarr = env->NewIntArray(arr.size());
- if (!jarr) return nullptr;
- jint *elements =
- static_cast<jint *>(env->GetPrimitiveArrayCritical(jarr, nullptr));
- if (!elements) return nullptr;
- for (size_t i = 0; i < arr.size(); ++i)
- elements[i] = static_cast<jint>(arr[i]);
- env->ReleasePrimitiveArrayCritical(jarr, elements, 0);
- return jarr;
- }
-};
-
-// Fast path (use SetIntArrayRegion)
-template <typename T>
-struct ConvertIntArray<T, true> {
- static jintArray ToJava(JNIEnv *env, llvm::ArrayRef<T> arr) {
- jintArray jarr = env->NewIntArray(arr.size());
- if (!jarr) return nullptr;
- env->SetIntArrayRegion(jarr, 0, arr.size(),
- reinterpret_cast<const jint*>(arr.data()));
- return jarr;
- }
-};
-
-} // namespace detail
-
-// Convert an ArrayRef to a jintArray.
-template <typename T>
-inline jintArray MakeJIntArray(JNIEnv *env, llvm::ArrayRef<T> arr) {
- return detail::ConvertIntArray<T>::ToJava(env, arr);
-}
-
-// Convert a SmallVector to a jintArray. This is required in addition to
-// ArrayRef because template resolution occurs prior to implicit conversions.
-template <typename T>
-inline jintArray MakeJIntArray(JNIEnv *env,
- const llvm::SmallVectorImpl<T> &arr) {
- return detail::ConvertIntArray<T>::ToJava(env, arr);
-}
-
-// Convert a std::vector to a jintArray. This is required in addition to
-// ArrayRef because template resolution occurs prior to implicit conversions.
-template <typename T>
-inline jintArray MakeJIntArray(JNIEnv *env, const std::vector<T> &arr) {
- return detail::ConvertIntArray<T>::ToJava(env, arr);
-}
-
-// Convert a StringRef into a jbyteArray.
-inline jbyteArray MakeJByteArray(JNIEnv *env, llvm::StringRef str) {
- jbyteArray jarr = env->NewByteArray(str.size());
- if (!jarr) return nullptr;
- env->SetByteArrayRegion(jarr, 0, str.size(),
- reinterpret_cast<const jbyte *>(str.data()));
- return jarr;
-}
-
-// Convert an array of integers into a jbooleanArray.
-inline jbooleanArray MakeJBooleanArray(JNIEnv *env, llvm::ArrayRef<int> arr)
-{
- jbooleanArray jarr = env->NewBooleanArray(arr.size());
- if (!jarr) return nullptr;
- jboolean *elements =
- static_cast<jboolean*>(env->GetPrimitiveArrayCritical(jarr, nullptr));
- if (!elements) return nullptr;
- for (size_t i = 0; i < arr.size(); ++i)
- elements[i] = arr[i] ? JNI_TRUE : JNI_FALSE;
- env->ReleasePrimitiveArrayCritical(jarr, elements, 0);
- return jarr;
-}
-
-// Convert an array of booleans into a jbooleanArray.
-inline jbooleanArray MakeJBooleanArray(JNIEnv *env, llvm::ArrayRef<bool> arr)
-{
- jbooleanArray jarr = env->NewBooleanArray(arr.size());
- if (!jarr) return nullptr;
- jboolean *elements =
- static_cast<jboolean*>(env->GetPrimitiveArrayCritical(jarr, nullptr));
- if (!elements) return nullptr;
- for (size_t i = 0; i < arr.size(); ++i)
- elements[i] = arr[i] ? JNI_TRUE : JNI_FALSE;
- env->ReleasePrimitiveArrayCritical(jarr, elements, 0);
- return jarr;
-}
-
-// Other MakeJ*Array conversions.
-
-#define WPI_JNI_MAKEJARRAY(T, F) \
- inline T##Array MakeJ##F##Array(JNIEnv *env, llvm::ArrayRef<T> arr) { \
- T##Array jarr = env->New##F##Array(arr.size()); \
- if (!jarr) return nullptr; \
- env->Set##F##ArrayRegion(jarr, 0, arr.size(), arr.data()); \
- return jarr; \
- }
-
-WPI_JNI_MAKEJARRAY(jboolean, Boolean)
-WPI_JNI_MAKEJARRAY(jbyte, Byte)
-WPI_JNI_MAKEJARRAY(jshort, Short)
-WPI_JNI_MAKEJARRAY(jlong, Long)
-WPI_JNI_MAKEJARRAY(jfloat, Float)
-WPI_JNI_MAKEJARRAY(jdouble, Double)
-
-#undef WPI_JNI_MAKEJARRAY
-
-// Convert an array of std::string into a jarray of jstring.
-inline jobjectArray MakeJStringArray(JNIEnv *env,
- llvm::ArrayRef<std::string> arr) {
- static JClass stringCls{env, "java/lang/String"};
- if (!stringCls) return nullptr;
- jobjectArray jarr = env->NewObjectArray(arr.size(), stringCls, nullptr);
- if (!jarr) return nullptr;
- for (std::size_t i = 0; i < arr.size(); ++i) {
- JLocal<jstring> elem{env, MakeJString(env, arr[i])};
- env->SetObjectArrayElement(jarr, i, elem.obj());
- }
- return jarr;
-}
-
-// Generic callback thread implementation.
-//
-// JNI's AttachCurrentThread() creates a Java Thread object on every
-// invocation, which is both time inefficient and causes issues with Eclipse
-// (which tries to keep a thread list up-to-date and thus gets swamped).
-//
-// Instead, this class attaches just once. When a hardware notification
-// occurs, a condition variable wakes up this thread and this thread actually
-// makes the call into Java.
-//
-// The template parameter T is the message being passed to the callback, but
-// also needs to provide the following functions:
-// static JavaVM* GetJVM();
-// static const char* GetName();
-// void CallJava(JNIEnv *env, jobject func, jmethodID mid);
-//
-// When creating this, ATOMIC_STATIC_INIT() needs to be performed on the
-// templated class as well.
-template <typename T>
-class JCallbackThread : public SafeThread {
- public:
- void Main();
-
- std::queue<T> m_queue;
- jobject m_func = nullptr;
- jmethodID m_mid;
-};
-
-template <typename T>
-class JCallbackManager : public SafeThreadOwner<JCallbackThread<T>> {
- public:
- void SetFunc(JNIEnv* env, jobject func, jmethodID mid);
-
- template <typename... Args>
- void Send(Args&&... args);
-};
-
-template <typename T>
-void JCallbackManager<T>::SetFunc(JNIEnv* env, jobject func, jmethodID mid) {
- auto thr = this->GetThread();
- if (!thr) return;
- // free global reference
- if (thr->m_func) env->DeleteGlobalRef(thr->m_func);
- // create global reference
- thr->m_func = env->NewGlobalRef(func);
- thr->m_mid = mid;
-}
-
-template <typename T>
-template <typename... Args>
-void JCallbackManager<T>::Send(Args&&... args) {
- auto thr = this->GetThread();
- if (!thr) return;
- thr->m_queue.emplace(std::forward<Args>(args)...);
- thr->m_cond.notify_one();
-}
-
-template <typename T>
-void JCallbackThread<T>::Main() {
- JNIEnv *env;
- JavaVMAttachArgs args;
- args.version = JNI_VERSION_1_2;
- args.name = const_cast<char*>(T::GetName());
- args.group = nullptr;
- jint rs = T::GetJVM()->AttachCurrentThreadAsDaemon((void**)&env, &args);
- if (rs != JNI_OK) return;
-
- std::unique_lock<std::mutex> lock(m_mutex);
- while (m_active) {
- m_cond.wait(lock, [&] { return !(m_active && m_queue.empty()); });
- if (!m_active) break;
- while (!m_queue.empty()) {
- if (!m_active) break;
- auto item = std::move(m_queue.front());
- m_queue.pop();
- auto func = m_func;
- auto mid = m_mid;
- lock.unlock(); // don't hold mutex during callback execution
- item.CallJava(env, func, mid);
- if (env->ExceptionCheck()) {
- env->ExceptionDescribe();
- env->ExceptionClear();
- }
- lock.lock();
- }
- }
-
- JavaVM* jvm = T::GetJVM();
- if (jvm) jvm->DetachCurrentThread();
-}
-
-template <typename T>
-class JSingletonCallbackManager : public JCallbackManager<T> {
- public:
- static JSingletonCallbackManager<T>& GetInstance() {
- ATOMIC_STATIC(JSingletonCallbackManager<T>, instance);
- return instance;
- }
-
- private:
- ATOMIC_STATIC_DECL(JSingletonCallbackManager<T>)
-};
-
-template<const char* excludeFuncPrefix>
-std::string GetJavaStackTrace(JNIEnv* env, std::string* func) {
- // create a throwable
- static JClass throwableCls(env, "java/lang/Throwable");
- if (!throwableCls) return "";
- static jmethodID constructorId = nullptr;
- if (!constructorId)
- constructorId = env->GetMethodID(throwableCls, "<init>", "()V");
- JLocal<jobject> throwable(env, env->NewObject(throwableCls, constructorId));
-
- // retrieve information from the exception.
- // get method id
- // getStackTrace returns an array of StackTraceElement
- static jmethodID getStackTraceId = nullptr;
- if (!getStackTraceId)
- getStackTraceId = env->GetMethodID(throwableCls, "getStackTrace",
- "()[Ljava/lang/StackTraceElement;");
-
- // call getStackTrace
- JLocal<jobjectArray> stackTrace(
- env, static_cast<jobjectArray>(
- env->CallObjectMethod(throwable, getStackTraceId)));
-
- if (!stackTrace) return "";
-
- // get length of the array
- jsize stackTraceLength = env->GetArrayLength(stackTrace);
-
- // get toString methodId of StackTraceElement class
- static JClass stackTraceElementCls(env, "java/lang/StackTraceElement");
- if (!stackTraceElementCls) return "";
- static jmethodID toStringId = nullptr;
- if (!toStringId)
- toStringId = env->GetMethodID(stackTraceElementCls, "toString",
- "()Ljava/lang/String;");
-
- bool haveLoc = false;
- std::string buf;
- llvm::raw_string_ostream oss(buf);
- for (jsize i = 0; i < stackTraceLength; i++) {
- // add the result of toString method of each element in the result
- JLocal<jobject> curStackTraceElement(
- env, env->GetObjectArrayElement(stackTrace, i));
-
- // call to string on the object
- JLocal<jstring> stackElementString(
- env, static_cast<jstring>(
- env->CallObjectMethod(curStackTraceElement, toStringId)));
-
- if (!stackElementString) return "";
-
- // add a line to res
- JStringRef elem(env, stackElementString);
- oss << elem << '\n';
-
- if (func) {
- // func is caller of immediate caller (if there was one)
- // or, if we see it, the first user function
- if (i == 1)
- *func = elem.str();
- else if (i > 1 && !haveLoc && excludeFuncPrefix != nullptr &&
- !elem.str().startswith(excludeFuncPrefix)) {
- *func = elem.str();
- haveLoc = true;
- }
- }
- }
-
- return oss.str();
-}
-
-// Finds an exception class and keep it as a global reference.
-// Similar to JClass, but provides Throw methods.
-// Use with caution, as the destructor does NOT call DeleteGlobalRef due
-// to potential shutdown issues with doing so.
-class JException : public JClass {
- public:
- JException() = default;
- JException(JNIEnv* env, const char* name) : JClass(env, name) {
- if (m_cls)
- m_constructor =
- env->GetMethodID(m_cls, "<init>", "(Ljava/lang/String;)V");
- }
-
- void Throw(JNIEnv* env, jstring msg) {
- jobject exception = env->NewObject(m_cls, m_constructor, msg);
- env->Throw(static_cast<jthrowable>(exception));
- }
-
- void Throw(JNIEnv* env, llvm::StringRef msg) {
- Throw(env, MakeJString(env, msg));
- }
-
- explicit operator bool() const { return m_constructor; }
-
- private:
- jmethodID m_constructor = nullptr;
-};
-
-} // namespace java
-} // namespace wpi
-
-#endif // WPIUTIL_SUPPORT_JNI_UTIL_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/support/leb128.h b/third_party/ntcore_2017/wpiutil/include/support/leb128.h
deleted file mode 100644
index de08a23..0000000
--- a/third_party/ntcore_2017/wpiutil/include/support/leb128.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef WPIUTIL_SUPPORT_LEB128_H_
-#define WPIUTIL_SUPPORT_LEB128_H_
-
-#include <cstddef>
-
-#include "llvm/SmallVector.h"
-
-namespace wpi {
-
-class raw_istream;
-
-std::size_t SizeUleb128(unsigned long val);
-std::size_t WriteUleb128(llvm::SmallVectorImpl<char>& dest, unsigned long val);
-std::size_t ReadUleb128(const char* addr, unsigned long* ret);
-bool ReadUleb128(raw_istream& is, unsigned long* ret);
-
-} // namespace wpi
-
-#endif // WPIUTIL_SUPPORT_LEB128_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/support/raw_istream.h b/third_party/ntcore_2017/wpiutil/include/support/raw_istream.h
deleted file mode 100644
index d9a9b9c..0000000
--- a/third_party/ntcore_2017/wpiutil/include/support/raw_istream.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef WPIUTIL_SUPPORT_RAW_ISTREAM_H_
-#define WPIUTIL_SUPPORT_RAW_ISTREAM_H_
-
-#include <algorithm>
-#include <cstddef>
-
-namespace wpi {
-
-class raw_istream {
- public:
- raw_istream() = default;
- virtual ~raw_istream() = default;
-
- raw_istream& read(char& c) {
- read_impl(&c, 1);
- return *this;
- }
-
- raw_istream& read(unsigned char& c) {
- read_impl(&c, 1);
- return *this;
- }
-
- raw_istream& read(signed char& c) {
- read_impl(&c, 1);
- return *this;
- }
-
- raw_istream& read(void* data, std::size_t len) {
- read_impl(data, len);
- return *this;
- }
-
- std::size_t readsome(void* data, std::size_t len) {
- std::size_t readlen = std::min(in_avail(), len);
- if (readlen == 0) return 0;
- read_impl(data, readlen);
- return readlen;
- };
-
- virtual void close() = 0;
- virtual std::size_t in_avail() const = 0;
-
- bool has_error() const { return m_error; }
- void clear_error() { m_error = false; }
-
- raw_istream(const raw_istream&) = delete;
- raw_istream& operator=(const raw_istream&) = delete;
-
- protected:
- void error_detected() { m_error = true; }
-
- private:
- virtual void read_impl(void* data, std::size_t len) = 0;
-
- bool m_error = false;
-};
-
-class raw_mem_istream : public raw_istream {
- public:
- raw_mem_istream(const char* mem, std::size_t len) : m_cur(mem), m_left(len) {}
- void close() override;
- std::size_t in_avail() const override;
-
- private:
- void read_impl(void* data, std::size_t len) override;
-
- const char* m_cur;
- std::size_t m_left;
-};
-
-class raw_fd_istream : public raw_istream {
- public:
- raw_fd_istream(int fd, bool shouldClose, std::size_t bufSize = 4096);
- ~raw_fd_istream() override;
- void close() override;
- std::size_t in_avail() const override;
-
- private:
- void read_impl(void* data, std::size_t len) override;
-
- char* m_buf;
- char* m_cur;
- char* m_end;
- std::size_t m_bufSize;
- int m_fd;
- bool m_shouldClose;
-};
-
-} // namespace wpi
-
-#endif // WPIUTIL_SUPPORT_RAW_ISTREAM_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/support/raw_socket_istream.h b/third_party/ntcore_2017/wpiutil/include/support/raw_socket_istream.h
deleted file mode 100644
index 475d3d0..0000000
--- a/third_party/ntcore_2017/wpiutil/include/support/raw_socket_istream.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef WPIUTIL_SUPPORT_RAW_SOCKET_ISTREAM_H_
-#define WPIUTIL_SUPPORT_RAW_SOCKET_ISTREAM_H_
-
-#include "support/raw_istream.h"
-
-namespace wpi {
-
-class NetworkStream;
-
-class raw_socket_istream : public raw_istream {
- public:
- explicit raw_socket_istream(NetworkStream& stream, int timeout = 0)
- : m_stream(stream), m_timeout(timeout) {}
-
- void close() override;
- std::size_t in_avail() const override;
-
- private:
- void read_impl(void* data, std::size_t len) override;
-
- NetworkStream& m_stream;
- int m_timeout;
-};
-
-} // namespace wpi
-
-#endif // WPIUTIL_SUPPORT_RAW_SOCKET_ISTREAM_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/support/raw_socket_ostream.h b/third_party/ntcore_2017/wpiutil/include/support/raw_socket_ostream.h
deleted file mode 100644
index 65793d3..0000000
--- a/third_party/ntcore_2017/wpiutil/include/support/raw_socket_ostream.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2016. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef WPIUTIL_SUPPORT_RAW_SOCKET_OSTREAM_H_
-#define WPIUTIL_SUPPORT_RAW_SOCKET_OSTREAM_H_
-
-#include "llvm/raw_ostream.h"
-
-namespace wpi {
-
-class NetworkStream;
-
-class raw_socket_ostream : public llvm::raw_ostream {
- public:
- raw_socket_ostream(NetworkStream& stream, bool shouldClose)
- : m_stream(stream), m_shouldClose(shouldClose) {}
- ~raw_socket_ostream();
-
- void close();
-
- bool has_error() const { return m_error; }
- void clear_error() { m_error = false; }
-
- protected:
- void error_detected() { m_error = true; }
-
- private:
- void write_impl(const char* data, std::size_t len) override;
- uint64_t current_pos() const override;
-
- NetworkStream& m_stream;
- bool m_error = false;
- bool m_shouldClose;
-};
-
-} // namespace wpi
-
-#endif // WPIUTIL_SUPPORT_RAW_SOCKET_OSTREAM_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/support/timestamp.h b/third_party/ntcore_2017/wpiutil/include/support/timestamp.h
deleted file mode 100644
index 526d6e5..0000000
--- a/third_party/ntcore_2017/wpiutil/include/support/timestamp.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-#ifndef WPIUTIL_SUPPORT_TIMESTAMP_H_
-#define WPIUTIL_SUPPORT_TIMESTAMP_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-unsigned long long WPI_Now(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#ifdef __cplusplus
-namespace wpi {
-
-unsigned long long Now();
-
-} // namespace wpi
-#endif
-
-#endif // WPIUTIL_SUPPORT_TIMESTAMP_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/tcpsockets/NetworkAcceptor.h b/third_party/ntcore_2017/wpiutil/include/tcpsockets/NetworkAcceptor.h
deleted file mode 100644
index f4d9120..0000000
--- a/third_party/ntcore_2017/wpiutil/include/tcpsockets/NetworkAcceptor.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef WPIUTIL_TCPSOCKETS_NETWORKACCEPTOR_H_
-#define WPIUTIL_TCPSOCKETS_NETWORKACCEPTOR_H_
-
-#include "tcpsockets/NetworkStream.h"
-
-namespace wpi {
-
-class NetworkAcceptor {
- public:
- NetworkAcceptor() = default;
- virtual ~NetworkAcceptor() = default;
-
- virtual int start() = 0;
- virtual void shutdown() = 0;
- virtual std::unique_ptr<NetworkStream> accept() = 0;
-
- NetworkAcceptor(const NetworkAcceptor&) = delete;
- NetworkAcceptor& operator=(const NetworkAcceptor&) = delete;
-};
-
-} // namespace wpi
-
-#endif // WPIUTIL_TCPSOCKETS_NETWORKACCEPTOR_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/tcpsockets/NetworkStream.h b/third_party/ntcore_2017/wpiutil/include/tcpsockets/NetworkStream.h
deleted file mode 100644
index 03b3a93..0000000
--- a/third_party/ntcore_2017/wpiutil/include/tcpsockets/NetworkStream.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef WPIUTIL_TCPSOCKETS_NETWORKSTREAM_H_
-#define WPIUTIL_TCPSOCKETS_NETWORKSTREAM_H_
-
-#include <cstddef>
-
-#include "llvm/StringRef.h"
-
-namespace wpi {
-
-class NetworkStream {
- public:
- NetworkStream() = default;
- virtual ~NetworkStream() = default;
-
- enum Error {
- kConnectionClosed = 0,
- kConnectionReset = -1,
- kConnectionTimedOut = -2,
- kWouldBlock = -3
- };
-
- virtual std::size_t send(const char* buffer, std::size_t len, Error* err) = 0;
- virtual std::size_t receive(char* buffer, std::size_t len, Error* err,
- int timeout = 0) = 0;
- virtual void close() = 0;
-
- virtual llvm::StringRef getPeerIP() const = 0;
- virtual int getPeerPort() const = 0;
- virtual void setNoDelay() = 0;
-
- // returns false on failure
- virtual bool setBlocking(bool enabled) = 0;
- virtual int getNativeHandle() const = 0;
-
- NetworkStream(const NetworkStream&) = delete;
- NetworkStream& operator=(const NetworkStream&) = delete;
-};
-
-} // namespace wpi
-
-#endif // WPIUTIL_TCPSOCKETS_NETWORKSTREAM_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/tcpsockets/SocketError.h b/third_party/ntcore_2017/wpiutil/include/tcpsockets/SocketError.h
deleted file mode 100644
index 3d87b2d..0000000
--- a/third_party/ntcore_2017/wpiutil/include/tcpsockets/SocketError.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#ifndef WPIUTIL_TCPSOCKETS_SOCKETERROR_H_
-#define WPIUTIL_TCPSOCKETS_SOCKETERROR_H_
-
-#include <string>
-
-#ifdef _WIN32
-#include <WinSock2.h>
-#else
-#include <errno.h>
-#endif
-
-namespace wpi {
-
-static inline int SocketErrno() {
-#ifdef _WIN32
- return WSAGetLastError();
-#else
- return errno;
-#endif
-}
-
-std::string SocketStrerror(int code);
-
-static inline std::string SocketStrerror() {
- return SocketStrerror(SocketErrno());
-}
-
-} // namespace wpi
-
-#endif // WPIUTIL_TCPSOCKETS_SOCKETERROR_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/tcpsockets/TCPAcceptor.h b/third_party/ntcore_2017/wpiutil/include/tcpsockets/TCPAcceptor.h
deleted file mode 100644
index 99403a3..0000000
--- a/third_party/ntcore_2017/wpiutil/include/tcpsockets/TCPAcceptor.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- TCPAcceptor.h
-
- TCPAcceptor class interface. TCPAcceptor provides methods to passively
- establish TCP/IP connections with clients.
-
- ------------------------------------------
-
- Copyright © 2013 [Vic Hargrave - http://vichargrave.com]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-#ifndef WPIUTIL_TCPSOCKETS_TCPACCEPTOR_H_
-#define WPIUTIL_TCPSOCKETS_TCPACCEPTOR_H_
-
-#include <atomic>
-#include <memory>
-#include <string>
-
-#include "tcpsockets/NetworkAcceptor.h"
-#include "tcpsockets/TCPStream.h"
-
-namespace wpi {
-
-class Logger;
-
-class TCPAcceptor : public NetworkAcceptor {
- int m_lsd;
- int m_port;
- std::string m_address;
- bool m_listening;
- std::atomic_bool m_shutdown;
- Logger& m_logger;
-
- public:
- TCPAcceptor(int port, const char* address, Logger& logger);
- ~TCPAcceptor();
-
- int start() override;
- void shutdown() override;
- std::unique_ptr<NetworkStream> accept() override;
-};
-
-} // namespace wpi
-
-#endif // WPIUTIL_TCPSOCKETS_TCPACCEPTOR_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/tcpsockets/TCPConnector.h b/third_party/ntcore_2017/wpiutil/include/tcpsockets/TCPConnector.h
deleted file mode 100644
index 7afb044..0000000
--- a/third_party/ntcore_2017/wpiutil/include/tcpsockets/TCPConnector.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- TCPConnector.h
-
- TCPConnector class interface. TCPConnector provides methods to actively
- establish TCP/IP connections with a server.
-
- ------------------------------------------
-
- Copyright © 2013 [Vic Hargrave - http://vichargrave.com]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License
-*/
-
-#ifndef WPIUTIL_TCPSOCKETS_TCPCONNECTOR_H_
-#define WPIUTIL_TCPSOCKETS_TCPCONNECTOR_H_
-
-#include <memory>
-
-#include "tcpsockets/NetworkStream.h"
-
-namespace wpi {
-
-class Logger;
-
-class TCPConnector {
- public:
- static std::unique_ptr<NetworkStream> connect(const char* server, int port,
- Logger& logger,
- int timeout = 0);
-};
-
-} // namespace wpi
-
-#endif // WPIUTIL_TCPSOCKETS_TCPCONNECTOR_H_
diff --git a/third_party/ntcore_2017/wpiutil/include/tcpsockets/TCPStream.h b/third_party/ntcore_2017/wpiutil/include/tcpsockets/TCPStream.h
deleted file mode 100644
index 89e3779..0000000
--- a/third_party/ntcore_2017/wpiutil/include/tcpsockets/TCPStream.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- TCPStream.h
-
- TCPStream class interface. TCPStream provides methods to trasnfer
- data between peers over a TCP/IP connection.
-
- ------------------------------------------
-
- Copyright © 2013 [Vic Hargrave - http://vichargrave.com]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-#ifndef WPIUTIL_TCPSOCKETS_TCPSTREAM_H_
-#define WPIUTIL_TCPSOCKETS_TCPSTREAM_H_
-
-#include <cstddef>
-#include <string>
-
-#ifdef _WIN32
-#include <winsock2.h>
-#else
-#include <sys/socket.h>
-#endif
-
-#include "tcpsockets/NetworkStream.h"
-
-struct sockaddr_in;
-
-namespace wpi {
-
-class TCPStream : public NetworkStream {
- int m_sd;
- std::string m_peerIP;
- int m_peerPort;
- bool m_blocking;
-
- public:
- friend class TCPAcceptor;
- friend class TCPConnector;
-
- ~TCPStream();
-
- std::size_t send(const char* buffer, std::size_t len, Error* err) override;
- std::size_t receive(char* buffer, std::size_t len, Error* err,
- int timeout = 0) override;
- void close() override;
-
- llvm::StringRef getPeerIP() const override;
- int getPeerPort() const override;
- void setNoDelay() override;
- bool setBlocking(bool enabled) override;
- int getNativeHandle() const override;
-
- TCPStream(const TCPStream& stream) = delete;
- TCPStream& operator=(const TCPStream&) = delete;
- private:
- bool WaitForReadEvent(int timeout);
-
- TCPStream(int sd, sockaddr_in* address);
- TCPStream() = delete;
-};
-
-} // namespace wpi
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/src/llvm/ConvertUTF.cpp b/third_party/ntcore_2017/wpiutil/src/llvm/ConvertUTF.cpp
deleted file mode 100644
index 73f66d1..0000000
--- a/third_party/ntcore_2017/wpiutil/src/llvm/ConvertUTF.cpp
+++ /dev/null
@@ -1,708 +0,0 @@
-/*===--- ConvertUTF.c - Universal Character Names conversions ---------------===
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is distributed under the University of Illinois Open Source
- * License. See LICENSE.TXT for details.
- *
- *===------------------------------------------------------------------------=*/
-/*
- * Copyright 2001-2004 Unicode, Inc.
- *
- * Disclaimer
- *
- * This source code is provided as is by Unicode, Inc. No claims are
- * made as to fitness for any particular purpose. No warranties of any
- * kind are expressed or implied. The recipient agrees to determine
- * applicability of information provided. If this file has been
- * purchased on magnetic or optical media from Unicode, Inc., the
- * sole remedy for any claim will be exchange of defective media
- * within 90 days of receipt.
- *
- * Limitations on Rights to Redistribute This Code
- *
- * Unicode, Inc. hereby grants the right to freely use the information
- * supplied in this file in the creation of products supporting the
- * Unicode Standard, and to make copies of this file in any form
- * for internal or external distribution as long as this notice
- * remains attached.
- */
-
-/* ---------------------------------------------------------------------
-
- Conversions between UTF32, UTF-16, and UTF-8. Source code file.
- Author: Mark E. Davis, 1994.
- Rev History: Rick McGowan, fixes & updates May 2001.
- Sept 2001: fixed const & error conditions per
- mods suggested by S. Parent & A. Lillich.
- June 2002: Tim Dodd added detection and handling of incomplete
- source sequences, enhanced error detection, added casts
- to eliminate compiler warnings.
- July 2003: slight mods to back out aggressive FFFE detection.
- Jan 2004: updated switches in from-UTF8 conversions.
- Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions.
-
- See the header file "ConvertUTF.h" for complete documentation.
-
------------------------------------------------------------------------- */
-
-
-#include "llvm/ConvertUTF.h"
-#ifdef CVTUTF_DEBUG
-#include <stdio.h>
-#endif
-#include <assert.h>
-
-static const int halfShift = 10; /* used for shifting by 10 bits */
-
-static const UTF32 halfBase = 0x0010000UL;
-static const UTF32 halfMask = 0x3FFUL;
-
-#define UNI_SUR_HIGH_START (UTF32)0xD800
-#define UNI_SUR_HIGH_END (UTF32)0xDBFF
-#define UNI_SUR_LOW_START (UTF32)0xDC00
-#define UNI_SUR_LOW_END (UTF32)0xDFFF
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Index into the table below with the first byte of a UTF-8 sequence to
- * get the number of trailing bytes that are supposed to follow it.
- * Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is
- * left as-is for anyone who may want to do such conversion, which was
- * allowed in earlier algorithms.
- */
-static const char trailingBytesForUTF8[256] = {
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
-};
-
-/*
- * Magic values subtracted from a buffer value during UTF8 conversion.
- * This table contains as many values as there might be trailing bytes
- * in a UTF-8 sequence.
- */
-static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
- 0x03C82080UL, 0xFA082080UL, 0x82082080UL };
-
-/*
- * Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
- * into the first byte, depending on how many bytes follow. There are
- * as many entries in this table as there are UTF-8 sequence types.
- * (I.e., one byte sequence, two byte... etc.). Remember that sequencs
- * for *legal* UTF-8 will be 4 or fewer bytes total.
- */
-static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
-
-/* --------------------------------------------------------------------- */
-
-/* The interface converts a whole buffer to avoid function-call overhead.
- * Constants have been gathered. Loops & conditionals have been removed as
- * much as possible for efficiency, in favor of drop-through switches.
- * (See "Note A" at the bottom of the file for equivalent code.)
- * If your compiler supports it, the "isLegalUTF8" call can be turned
- * into an inline function.
- */
-
-extern "C" {
-/* --------------------------------------------------------------------- */
-
-ConversionResult ConvertUTF32toUTF16 (
- const UTF32** sourceStart, const UTF32* sourceEnd,
- UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
- ConversionResult result = conversionOK;
- const UTF32* source = *sourceStart;
- UTF16* target = *targetStart;
- while (source < sourceEnd) {
- UTF32 ch;
- if (target >= targetEnd) {
- result = targetExhausted; break;
- }
- ch = *source++;
- if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
- /* UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are both reserved values */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- if (flags == strictConversion) {
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- *target++ = (UTF16)ch; /* normal case */
- }
- } else if (ch > UNI_MAX_LEGAL_UTF32) {
- if (flags == strictConversion) {
- result = sourceIllegal;
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- /* target is a character in range 0xFFFF - 0x10FFFF. */
- if (target + 1 >= targetEnd) {
- --source; /* Back up source pointer! */
- result = targetExhausted; break;
- }
- ch -= halfBase;
- *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
- *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
- }
- }
- *sourceStart = source;
- *targetStart = target;
- return result;
-}
-
-/* --------------------------------------------------------------------- */
-
-ConversionResult ConvertUTF16toUTF32 (
- const UTF16** sourceStart, const UTF16* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
- ConversionResult result = conversionOK;
- const UTF16* source = *sourceStart;
- UTF32* target = *targetStart;
- UTF32 ch, ch2;
- while (source < sourceEnd) {
- const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
- ch = *source++;
- /* If we have a surrogate pair, convert to UTF32 first. */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
- /* If the 16 bits following the high surrogate are in the source buffer... */
- if (source < sourceEnd) {
- ch2 = *source;
- /* If it's a low surrogate, convert to UTF32. */
- if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
- ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
- + (ch2 - UNI_SUR_LOW_START) + halfBase;
- ++source;
- } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- } else { /* We don't have the 16 bits following the high surrogate. */
- --source; /* return to the high surrogate */
- result = sourceExhausted;
- break;
- }
- } else if (flags == strictConversion) {
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- }
- if (target >= targetEnd) {
- source = oldSource; /* Back up source pointer! */
- result = targetExhausted; break;
- }
- *target++ = ch;
- }
- *sourceStart = source;
- *targetStart = target;
-#ifdef CVTUTF_DEBUG
-if (result == sourceIllegal) {
- fprintf(stderr, "ConvertUTF16toUTF32 illegal seq 0x%04x,%04x\n", ch, ch2);
- fflush(stderr);
-}
-#endif
- return result;
-}
-ConversionResult ConvertUTF16toUTF8 (
- const UTF16** sourceStart, const UTF16* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
- ConversionResult result = conversionOK;
- const UTF16* source = *sourceStart;
- UTF8* target = *targetStart;
- while (source < sourceEnd) {
- UTF32 ch;
- unsigned short bytesToWrite = 0;
- const UTF32 byteMask = 0xBF;
- const UTF32 byteMark = 0x80;
- const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
- ch = *source++;
- /* If we have a surrogate pair, convert to UTF32 first. */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
- /* If the 16 bits following the high surrogate are in the source buffer... */
- if (source < sourceEnd) {
- UTF32 ch2 = *source;
- /* If it's a low surrogate, convert to UTF32. */
- if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
- ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
- + (ch2 - UNI_SUR_LOW_START) + halfBase;
- ++source;
- } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- } else { /* We don't have the 16 bits following the high surrogate. */
- --source; /* return to the high surrogate */
- result = sourceExhausted;
- break;
- }
- } else if (flags == strictConversion) {
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- }
- /* Figure out how many bytes the result will require */
- if (ch < (UTF32)0x80) { bytesToWrite = 1;
- } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
- } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
- } else if (ch < (UTF32)0x110000) { bytesToWrite = 4;
- } else { bytesToWrite = 3;
- ch = UNI_REPLACEMENT_CHAR;
- }
-
- target += bytesToWrite;
- if (target > targetEnd) {
- source = oldSource; /* Back up source pointer! */
- target -= bytesToWrite; result = targetExhausted; break;
- }
- switch (bytesToWrite) { /* note: everything falls through. */
- case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
- }
- target += bytesToWrite;
- }
- *sourceStart = source;
- *targetStart = target;
- return result;
-}
-
-/* --------------------------------------------------------------------- */
-
-ConversionResult ConvertUTF32toUTF8 (
- const UTF32** sourceStart, const UTF32* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
- ConversionResult result = conversionOK;
- const UTF32* source = *sourceStart;
- UTF8* target = *targetStart;
- while (source < sourceEnd) {
- UTF32 ch;
- unsigned short bytesToWrite = 0;
- const UTF32 byteMask = 0xBF;
- const UTF32 byteMark = 0x80;
- ch = *source++;
- if (flags == strictConversion ) {
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- }
- /*
- * Figure out how many bytes the result will require. Turn any
- * illegally large UTF32 things (> Plane 17) into replacement chars.
- */
- if (ch < (UTF32)0x80) { bytesToWrite = 1;
- } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
- } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
- } else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4;
- } else { bytesToWrite = 3;
- ch = UNI_REPLACEMENT_CHAR;
- result = sourceIllegal;
- }
-
- target += bytesToWrite;
- if (target > targetEnd) {
- --source; /* Back up source pointer! */
- target -= bytesToWrite; result = targetExhausted; break;
- }
- switch (bytesToWrite) { /* note: everything falls through. */
- case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
- }
- target += bytesToWrite;
- }
- *sourceStart = source;
- *targetStart = target;
- return result;
-}
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Utility routine to tell whether a sequence of bytes is legal UTF-8.
- * This must be called with the length pre-determined by the first byte.
- * If not calling this from ConvertUTF8to*, then the length can be set by:
- * length = trailingBytesForUTF8[*source]+1;
- * and the sequence is illegal right away if there aren't that many bytes
- * available.
- * If presented with a length > 4, this returns false. The Unicode
- * definition of UTF-8 goes up to 4-byte sequences.
- */
-
-static Boolean isLegalUTF8(const UTF8 *source, int length) {
- UTF8 a;
- const UTF8 *srcptr = source+length;
- switch (length) {
- default: return false;
- /* Everything else falls through when "true"... */
- case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
- case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
- case 2: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
-
- switch (*source) {
- /* no fall-through in this inner switch */
- case 0xE0: if (a < 0xA0) return false; break;
- case 0xED: if (a > 0x9F) return false; break;
- case 0xF0: if (a < 0x90) return false; break;
- case 0xF4: if (a > 0x8F) return false; break;
- default: if (a < 0x80) return false;
- }
-
- case 1: if (*source >= 0x80 && *source < 0xC2) return false;
- }
- if (*source > 0xF4) return false;
- return true;
-}
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Exported function to return whether a UTF-8 sequence is legal or not.
- * This is not used here; it's just exported.
- */
-Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
- int length = trailingBytesForUTF8[*source]+1;
- if (length > sourceEnd - source) {
- return false;
- }
- return isLegalUTF8(source, length);
-}
-
-/* --------------------------------------------------------------------- */
-
-static unsigned
-findMaximalSubpartOfIllFormedUTF8Sequence(const UTF8 *source,
- const UTF8 *sourceEnd) {
- UTF8 b1, b2, b3;
-
- assert(!isLegalUTF8Sequence(source, sourceEnd));
-
- /*
- * Unicode 6.3.0, D93b:
- *
- * Maximal subpart of an ill-formed subsequence: The longest code unit
- * subsequence starting at an unconvertible offset that is either:
- * a. the initial subsequence of a well-formed code unit sequence, or
- * b. a subsequence of length one.
- */
-
- if (source == sourceEnd)
- return 0;
-
- /*
- * Perform case analysis. See Unicode 6.3.0, Table 3-7. Well-Formed UTF-8
- * Byte Sequences.
- */
-
- b1 = *source;
- ++source;
- if (b1 >= 0xC2 && b1 <= 0xDF) {
- /*
- * First byte is valid, but we know that this code unit sequence is
- * invalid, so the maximal subpart has to end after the first byte.
- */
- return 1;
- }
-
- if (source == sourceEnd)
- return 1;
-
- b2 = *source;
- ++source;
-
- if (b1 == 0xE0) {
- return (b2 >= 0xA0 && b2 <= 0xBF) ? 2 : 1;
- }
- if (b1 >= 0xE1 && b1 <= 0xEC) {
- return (b2 >= 0x80 && b2 <= 0xBF) ? 2 : 1;
- }
- if (b1 == 0xED) {
- return (b2 >= 0x80 && b2 <= 0x9F) ? 2 : 1;
- }
- if (b1 >= 0xEE && b1 <= 0xEF) {
- return (b2 >= 0x80 && b2 <= 0xBF) ? 2 : 1;
- }
- if (b1 == 0xF0) {
- if (b2 >= 0x90 && b2 <= 0xBF) {
- if (source == sourceEnd)
- return 2;
-
- b3 = *source;
- return (b3 >= 0x80 && b3 <= 0xBF) ? 3 : 2;
- }
- return 1;
- }
- if (b1 >= 0xF1 && b1 <= 0xF3) {
- if (b2 >= 0x80 && b2 <= 0xBF) {
- if (source == sourceEnd)
- return 2;
-
- b3 = *source;
- return (b3 >= 0x80 && b3 <= 0xBF) ? 3 : 2;
- }
- return 1;
- }
- if (b1 == 0xF4) {
- if (b2 >= 0x80 && b2 <= 0x8F) {
- if (source == sourceEnd)
- return 2;
-
- b3 = *source;
- return (b3 >= 0x80 && b3 <= 0xBF) ? 3 : 2;
- }
- return 1;
- }
-
- assert((b1 >= 0x80 && b1 <= 0xC1) || b1 >= 0xF5);
- /*
- * There are no valid sequences that start with these bytes. Maximal subpart
- * is defined to have length 1 in these cases.
- */
- return 1;
-}
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Exported function to return the total number of bytes in a codepoint
- * represented in UTF-8, given the value of the first byte.
- */
-unsigned getNumBytesForUTF8(UTF8 first) {
- return trailingBytesForUTF8[first] + 1;
-}
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Exported function to return whether a UTF-8 string is legal or not.
- * This is not used here; it's just exported.
- */
-Boolean isLegalUTF8String(const UTF8 **source, const UTF8 *sourceEnd) {
- while (*source != sourceEnd) {
- int length = trailingBytesForUTF8[**source] + 1;
- if (length > sourceEnd - *source || !isLegalUTF8(*source, length))
- return false;
- *source += length;
- }
- return true;
-}
-
-/* --------------------------------------------------------------------- */
-
-ConversionResult ConvertUTF8toUTF16 (
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
- ConversionResult result = conversionOK;
- const UTF8* source = *sourceStart;
- UTF16* target = *targetStart;
- while (source < sourceEnd) {
- UTF32 ch = 0;
- unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
- if (extraBytesToRead >= sourceEnd - source) {
- result = sourceExhausted; break;
- }
- /* Do this check whether lenient or strict */
- if (!isLegalUTF8(source, extraBytesToRead+1)) {
- result = sourceIllegal;
- break;
- }
- /*
- * The cases all fall through. See "Note A" below.
- */
- switch (extraBytesToRead) {
- case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
- case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
- case 3: ch += *source++; ch <<= 6;
- case 2: ch += *source++; ch <<= 6;
- case 1: ch += *source++; ch <<= 6;
- case 0: ch += *source++;
- }
- ch -= offsetsFromUTF8[extraBytesToRead];
-
- if (target >= targetEnd) {
- source -= (extraBytesToRead+1); /* Back up source pointer! */
- result = targetExhausted; break;
- }
- if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- if (flags == strictConversion) {
- source -= (extraBytesToRead+1); /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- *target++ = (UTF16)ch; /* normal case */
- }
- } else if (ch > UNI_MAX_UTF16) {
- if (flags == strictConversion) {
- result = sourceIllegal;
- source -= (extraBytesToRead+1); /* return to the start */
- break; /* Bail out; shouldn't continue */
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- /* target is a character in range 0xFFFF - 0x10FFFF. */
- if (target + 1 >= targetEnd) {
- source -= (extraBytesToRead+1); /* Back up source pointer! */
- result = targetExhausted; break;
- }
- ch -= halfBase;
- *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
- *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
- }
- }
- *sourceStart = source;
- *targetStart = target;
- return result;
-}
-
-/* --------------------------------------------------------------------- */
-
-static ConversionResult ConvertUTF8toUTF32Impl(
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags,
- Boolean InputIsPartial) {
- ConversionResult result = conversionOK;
- const UTF8* source = *sourceStart;
- UTF32* target = *targetStart;
- while (source < sourceEnd) {
- UTF32 ch = 0;
- unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
- if (extraBytesToRead >= sourceEnd - source) {
- if (flags == strictConversion || InputIsPartial) {
- result = sourceExhausted;
- break;
- } else {
- result = sourceIllegal;
-
- /*
- * Replace the maximal subpart of ill-formed sequence with
- * replacement character.
- */
- source += findMaximalSubpartOfIllFormedUTF8Sequence(source,
- sourceEnd);
- *target++ = UNI_REPLACEMENT_CHAR;
- continue;
- }
- }
- if (target >= targetEnd) {
- result = targetExhausted; break;
- }
-
- /* Do this check whether lenient or strict */
- if (!isLegalUTF8(source, extraBytesToRead+1)) {
- result = sourceIllegal;
- if (flags == strictConversion) {
- /* Abort conversion. */
- break;
- } else {
- /*
- * Replace the maximal subpart of ill-formed sequence with
- * replacement character.
- */
- source += findMaximalSubpartOfIllFormedUTF8Sequence(source,
- sourceEnd);
- *target++ = UNI_REPLACEMENT_CHAR;
- continue;
- }
- }
- /*
- * The cases all fall through. See "Note A" below.
- */
- switch (extraBytesToRead) {
- case 5: ch += *source++; ch <<= 6;
- case 4: ch += *source++; ch <<= 6;
- case 3: ch += *source++; ch <<= 6;
- case 2: ch += *source++; ch <<= 6;
- case 1: ch += *source++; ch <<= 6;
- case 0: ch += *source++;
- }
- ch -= offsetsFromUTF8[extraBytesToRead];
-
- if (ch <= UNI_MAX_LEGAL_UTF32) {
- /*
- * UTF-16 surrogate values are illegal in UTF-32, and anything
- * over Plane 17 (> 0x10FFFF) is illegal.
- */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- if (flags == strictConversion) {
- source -= (extraBytesToRead+1); /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- *target++ = ch;
- }
- } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
- result = sourceIllegal;
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- }
- *sourceStart = source;
- *targetStart = target;
- return result;
-}
-
-ConversionResult ConvertUTF8toUTF32Partial(const UTF8 **sourceStart,
- const UTF8 *sourceEnd,
- UTF32 **targetStart,
- UTF32 *targetEnd,
- ConversionFlags flags) {
- return ConvertUTF8toUTF32Impl(sourceStart, sourceEnd, targetStart, targetEnd,
- flags, /*InputIsPartial=*/true);
-}
-
-ConversionResult ConvertUTF8toUTF32(const UTF8 **sourceStart,
- const UTF8 *sourceEnd, UTF32 **targetStart,
- UTF32 *targetEnd, ConversionFlags flags) {
- return ConvertUTF8toUTF32Impl(sourceStart, sourceEnd, targetStart, targetEnd,
- flags, /*InputIsPartial=*/false);
-}
-
-}
-
-/* ---------------------------------------------------------------------
-
- Note A.
- The fall-through switches in UTF-8 reading code save a
- temp variable, some decrements & conditionals. The switches
- are equivalent to the following loop:
- {
- int tmpBytesToRead = extraBytesToRead+1;
- do {
- ch += *source++;
- --tmpBytesToRead;
- if (tmpBytesToRead) ch <<= 6;
- } while (tmpBytesToRead > 0);
- }
- In UTF-8 writing code, the switches on "bytesToWrite" are
- similarly unrolled loops.
-
- --------------------------------------------------------------------- */
diff --git a/third_party/ntcore_2017/wpiutil/src/llvm/ConvertUTFWrapper.cpp b/third_party/ntcore_2017/wpiutil/src/llvm/ConvertUTFWrapper.cpp
deleted file mode 100644
index 810c135..0000000
--- a/third_party/ntcore_2017/wpiutil/src/llvm/ConvertUTFWrapper.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-//===-- ConvertUTFWrapper.cpp - Wrap ConvertUTF.h with clang data types -----===
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ConvertUTF.h"
-#include <string>
-#include <vector>
-
-namespace llvm {
-
-bool ConvertCodePointToUTF8(unsigned Source, char *&ResultPtr) {
- const UTF32 *SourceStart = &Source;
- const UTF32 *SourceEnd = SourceStart + 1;
- UTF8 *TargetStart = reinterpret_cast<UTF8 *>(ResultPtr);
- UTF8 *TargetEnd = TargetStart + 4;
- ConversionResult CR = ConvertUTF32toUTF8(&SourceStart, SourceEnd,
- &TargetStart, TargetEnd,
- strictConversion);
- if (CR != conversionOK)
- return false;
-
- ResultPtr = reinterpret_cast<char*>(TargetStart);
- return true;
-}
-
-bool hasUTF16ByteOrderMark(ArrayRef<char> S) {
- return (S.size() >= 2 &&
- ((S[0] == '\xff' && S[1] == '\xfe') ||
- (S[0] == '\xfe' && S[1] == '\xff')));
-}
-
-bool convertUTF16ToUTF8String(ArrayRef<UTF16> SrcUTF16,
- SmallVectorImpl<char> &DstUTF8) {
- assert(DstUTF8.empty());
-
- // Avoid OOB by returning early on empty input.
- if (SrcUTF16.empty())
- return true;
-
- const UTF16 *Src = SrcUTF16.begin();
- const UTF16 *SrcEnd = SrcUTF16.end();
-
- // Byteswap if necessary.
- std::vector<UTF16> ByteSwapped;
- if (Src[0] == UNI_UTF16_BYTE_ORDER_MARK_SWAPPED) {
- ByteSwapped.insert(ByteSwapped.end(), Src, SrcEnd);
- for (unsigned I = 0, E = ByteSwapped.size(); I != E; ++I)
- ByteSwapped[I] = (ByteSwapped[I] << 8) | (ByteSwapped[I] >> 8);
- Src = &ByteSwapped[0];
- SrcEnd = &ByteSwapped[ByteSwapped.size() - 1] + 1;
- }
-
- // Skip the BOM for conversion.
- if (Src[0] == UNI_UTF16_BYTE_ORDER_MARK_NATIVE)
- Src++;
-
- // Just allocate enough space up front. We'll shrink it later. Allocate
- // enough that we can fit a null terminator without reallocating.
- DstUTF8.resize(SrcUTF16.size() * UNI_MAX_UTF8_BYTES_PER_CODE_POINT + 1);
- UTF8 *Dst = reinterpret_cast<UTF8*>(&DstUTF8[0]);
- UTF8 *DstEnd = Dst + DstUTF8.size();
-
- ConversionResult CR =
- ConvertUTF16toUTF8(&Src, SrcEnd, &Dst, DstEnd, strictConversion);
- assert(CR != targetExhausted);
-
- if (CR != conversionOK) {
- DstUTF8.clear();
- return false;
- }
-
- DstUTF8.resize(reinterpret_cast<char*>(Dst) - &DstUTF8[0]);
- DstUTF8.push_back(0);
- DstUTF8.pop_back();
- return true;
-}
-
-bool convertUTF8ToUTF16String(StringRef SrcUTF8,
- SmallVectorImpl<UTF16> &DstUTF16) {
- assert(DstUTF16.empty());
-
- // Avoid OOB by returning early on empty input.
- if (SrcUTF8.empty()) {
- DstUTF16.push_back(0);
- DstUTF16.pop_back();
- return true;
- }
-
- const UTF8 *Src = reinterpret_cast<const UTF8 *>(SrcUTF8.begin());
- const UTF8 *SrcEnd = reinterpret_cast<const UTF8 *>(SrcUTF8.end());
-
- // Allocate the same number of UTF-16 code units as UTF-8 code units. Encoding
- // as UTF-16 should always require the same amount or less code units than the
- // UTF-8 encoding. Allocate one extra byte for the null terminator though,
- // so that someone calling DstUTF16.data() gets a null terminated string.
- // We resize down later so we don't have to worry that this over allocates.
- DstUTF16.resize(SrcUTF8.size()+1);
- UTF16 *Dst = &DstUTF16[0];
- UTF16 *DstEnd = Dst + DstUTF16.size();
-
- ConversionResult CR =
- ConvertUTF8toUTF16(&Src, SrcEnd, &Dst, DstEnd, strictConversion);
- assert(CR != targetExhausted);
-
- if (CR != conversionOK) {
- DstUTF16.clear();
- return false;
- }
-
- DstUTF16.resize(Dst - &DstUTF16[0]);
- DstUTF16.push_back(0);
- DstUTF16.pop_back();
- return true;
-}
-
-} // end namespace llvm
-
diff --git a/third_party/ntcore_2017/wpiutil/src/llvm/ErrorHandling.cpp b/third_party/ntcore_2017/wpiutil/src/llvm/ErrorHandling.cpp
deleted file mode 100644
index 1ab2405..0000000
--- a/third_party/ntcore_2017/wpiutil/src/llvm/ErrorHandling.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-//===- lib/Support/ErrorHandling.cpp - Callbacks for errors ---------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines an API used to indicate fatal error conditions. Non-fatal
-// errors (most of them) should be handled through LLVMContext.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/WindowsError.h"
-
-#ifdef _WIN32
-
-#include <system_error>
-#include <winerror.h>
-
-// I'd rather not double the line count of the following.
-#define MAP_ERR_TO_COND(x, y) \
- case x: \
- return std::make_error_code(std::errc::y)
-
-std::error_code llvm::mapWindowsError(unsigned EV) {
- switch (EV) {
- MAP_ERR_TO_COND(ERROR_ACCESS_DENIED, permission_denied);
- MAP_ERR_TO_COND(ERROR_ALREADY_EXISTS, file_exists);
- MAP_ERR_TO_COND(ERROR_BAD_UNIT, no_such_device);
- MAP_ERR_TO_COND(ERROR_BUFFER_OVERFLOW, filename_too_long);
- MAP_ERR_TO_COND(ERROR_BUSY, device_or_resource_busy);
- MAP_ERR_TO_COND(ERROR_BUSY_DRIVE, device_or_resource_busy);
- MAP_ERR_TO_COND(ERROR_CANNOT_MAKE, permission_denied);
- MAP_ERR_TO_COND(ERROR_CANTOPEN, io_error);
- MAP_ERR_TO_COND(ERROR_CANTREAD, io_error);
- MAP_ERR_TO_COND(ERROR_CANTWRITE, io_error);
- MAP_ERR_TO_COND(ERROR_CURRENT_DIRECTORY, permission_denied);
- MAP_ERR_TO_COND(ERROR_DEV_NOT_EXIST, no_such_device);
- MAP_ERR_TO_COND(ERROR_DEVICE_IN_USE, device_or_resource_busy);
- MAP_ERR_TO_COND(ERROR_DIR_NOT_EMPTY, directory_not_empty);
- MAP_ERR_TO_COND(ERROR_DIRECTORY, invalid_argument);
- MAP_ERR_TO_COND(ERROR_DISK_FULL, no_space_on_device);
- MAP_ERR_TO_COND(ERROR_FILE_EXISTS, file_exists);
- MAP_ERR_TO_COND(ERROR_FILE_NOT_FOUND, no_such_file_or_directory);
- MAP_ERR_TO_COND(ERROR_HANDLE_DISK_FULL, no_space_on_device);
- MAP_ERR_TO_COND(ERROR_INVALID_ACCESS, permission_denied);
- MAP_ERR_TO_COND(ERROR_INVALID_DRIVE, no_such_device);
- MAP_ERR_TO_COND(ERROR_INVALID_FUNCTION, function_not_supported);
- MAP_ERR_TO_COND(ERROR_INVALID_HANDLE, invalid_argument);
- MAP_ERR_TO_COND(ERROR_INVALID_NAME, invalid_argument);
- MAP_ERR_TO_COND(ERROR_LOCK_VIOLATION, no_lock_available);
- MAP_ERR_TO_COND(ERROR_LOCKED, no_lock_available);
- MAP_ERR_TO_COND(ERROR_NEGATIVE_SEEK, invalid_argument);
- MAP_ERR_TO_COND(ERROR_NOACCESS, permission_denied);
- MAP_ERR_TO_COND(ERROR_NOT_ENOUGH_MEMORY, not_enough_memory);
- MAP_ERR_TO_COND(ERROR_NOT_READY, resource_unavailable_try_again);
- MAP_ERR_TO_COND(ERROR_OPEN_FAILED, io_error);
- MAP_ERR_TO_COND(ERROR_OPEN_FILES, device_or_resource_busy);
- MAP_ERR_TO_COND(ERROR_OUTOFMEMORY, not_enough_memory);
- MAP_ERR_TO_COND(ERROR_PATH_NOT_FOUND, no_such_file_or_directory);
- MAP_ERR_TO_COND(ERROR_BAD_NETPATH, no_such_file_or_directory);
- MAP_ERR_TO_COND(ERROR_READ_FAULT, io_error);
- MAP_ERR_TO_COND(ERROR_RETRY, resource_unavailable_try_again);
- MAP_ERR_TO_COND(ERROR_SEEK, io_error);
- MAP_ERR_TO_COND(ERROR_SHARING_VIOLATION, permission_denied);
- MAP_ERR_TO_COND(ERROR_TOO_MANY_OPEN_FILES, too_many_files_open);
- MAP_ERR_TO_COND(ERROR_WRITE_FAULT, io_error);
- MAP_ERR_TO_COND(ERROR_WRITE_PROTECT, permission_denied);
- MAP_ERR_TO_COND(WSAEACCES, permission_denied);
- MAP_ERR_TO_COND(WSAEBADF, bad_file_descriptor);
- MAP_ERR_TO_COND(WSAEFAULT, bad_address);
- MAP_ERR_TO_COND(WSAEINTR, interrupted);
- MAP_ERR_TO_COND(WSAEINVAL, invalid_argument);
- MAP_ERR_TO_COND(WSAEMFILE, too_many_files_open);
- MAP_ERR_TO_COND(WSAENAMETOOLONG, filename_too_long);
- default:
- return std::error_code(EV, std::system_category());
- }
-}
-
-#endif
diff --git a/third_party/ntcore_2017/wpiutil/src/llvm/Hashing.cpp b/third_party/ntcore_2017/wpiutil/src/llvm/Hashing.cpp
deleted file mode 100644
index b280043..0000000
--- a/third_party/ntcore_2017/wpiutil/src/llvm/Hashing.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-//===-------------- lib/Support/Hashing.cpp -------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file provides implementation bits for the LLVM common hashing
-// infrastructure. Documentation and most of the other information is in the
-// header file.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Hashing.h"
-
-using namespace llvm;
-
-// Provide a definition and static initializer for the fixed seed. This
-// initializer should always be zero to ensure its value can never appear to be
-// non-zero, even during dynamic initialization.
-size_t llvm::hashing::detail::fixed_seed_override = 0;
-
-// Implement the function for forced setting of the fixed seed.
-// FIXME: Use atomic operations here so that there is no data race.
-void llvm::set_fixed_execution_hash_seed(size_t fixed_value) {
- hashing::detail::fixed_seed_override = fixed_value;
-}
diff --git a/third_party/ntcore_2017/wpiutil/src/llvm/SmallPtrSet.cpp b/third_party/ntcore_2017/wpiutil/src/llvm/SmallPtrSet.cpp
deleted file mode 100644
index 6187f78..0000000
--- a/third_party/ntcore_2017/wpiutil/src/llvm/SmallPtrSet.cpp
+++ /dev/null
@@ -1,295 +0,0 @@
-//===- llvm/ADT/SmallPtrSet.cpp - 'Normally small' pointer set ------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the SmallPtrSet class. See SmallPtrSet.h for an
-// overview of the algorithm.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/SmallPtrSet.h"
-#include "llvm/DenseMapInfo.h"
-#include "llvm/MathExtras.h"
-#include <algorithm>
-#include <cstdlib>
-
-using namespace llvm;
-
-void SmallPtrSetImplBase::shrink_and_clear() {
- assert(!isSmall() && "Can't shrink a small set!");
- free(CurArray);
-
- // Reduce the number of buckets.
- unsigned Size = size();
- CurArraySize = Size > 16 ? 1 << (Log2_32_Ceil(Size) + 1) : 32;
- NumNonEmpty = NumTombstones = 0;
-
- // Install the new array. Clear all the buckets to empty.
- CurArray = (const void**)malloc(sizeof(void*) * CurArraySize);
- assert(CurArray && "Failed to allocate memory?");
- memset(CurArray, -1, CurArraySize*sizeof(void*));
-}
-
-std::pair<const void *const *, bool>
-SmallPtrSetImplBase::insert_imp_big(const void *Ptr) {
- if (LLVM_UNLIKELY(size() * 4 >= CurArraySize * 3)) {
- // If more than 3/4 of the array is full, grow.
- Grow(CurArraySize < 64 ? 128 : CurArraySize * 2);
- } else if (LLVM_UNLIKELY(CurArraySize - NumNonEmpty < CurArraySize / 8)) {
- // If fewer of 1/8 of the array is empty (meaning that many are filled with
- // tombstones), rehash.
- Grow(CurArraySize);
- }
-
- // Okay, we know we have space. Find a hash bucket.
- const void **Bucket = const_cast<const void**>(FindBucketFor(Ptr));
- if (*Bucket == Ptr)
- return std::make_pair(Bucket, false); // Already inserted, good.
-
- // Otherwise, insert it!
- if (*Bucket == getTombstoneMarker())
- --NumTombstones;
- else
- ++NumNonEmpty; // Track density.
- *Bucket = Ptr;
- return std::make_pair(Bucket, true);
-}
-
-bool SmallPtrSetImplBase::erase_imp(const void * Ptr) {
- if (isSmall()) {
- // Check to see if it is in the set.
- for (const void **APtr = CurArray, **E = CurArray + NumNonEmpty; APtr != E;
- ++APtr)
- if (*APtr == Ptr) {
- // If it is in the set, replace this element.
- *APtr = getTombstoneMarker();
- ++NumTombstones;
- return true;
- }
-
- return false;
- }
-
- // Okay, we know we have space. Find a hash bucket.
- void **Bucket = const_cast<void**>(FindBucketFor(Ptr));
- if (*Bucket != Ptr) return false; // Not in the set?
-
- // Set this as a tombstone.
- *Bucket = getTombstoneMarker();
- ++NumTombstones;
- return true;
-}
-
-const void * const *SmallPtrSetImplBase::FindBucketFor(const void *Ptr) const {
- unsigned Bucket = DenseMapInfo<void *>::getHashValue(Ptr) & (CurArraySize-1);
- unsigned ArraySize = CurArraySize;
- unsigned ProbeAmt = 1;
- const void *const *Array = CurArray;
- const void *const *Tombstone = nullptr;
- while (1) {
- // If we found an empty bucket, the pointer doesn't exist in the set.
- // Return a tombstone if we've seen one so far, or the empty bucket if
- // not.
- if (LLVM_LIKELY(Array[Bucket] == getEmptyMarker()))
- return Tombstone ? Tombstone : Array+Bucket;
-
- // Found Ptr's bucket?
- if (LLVM_LIKELY(Array[Bucket] == Ptr))
- return Array+Bucket;
-
- // If this is a tombstone, remember it. If Ptr ends up not in the set, we
- // prefer to return it than something that would require more probing.
- if (Array[Bucket] == getTombstoneMarker() && !Tombstone)
- Tombstone = Array+Bucket; // Remember the first tombstone found.
-
- // It's a hash collision or a tombstone. Reprobe.
- Bucket = (Bucket + ProbeAmt++) & (ArraySize-1);
- }
-}
-
-/// Grow - Allocate a larger backing store for the buckets and move it over.
-///
-void SmallPtrSetImplBase::Grow(unsigned NewSize) {
- const void **OldBuckets = CurArray;
- const void **OldEnd = EndPointer();
- bool WasSmall = isSmall();
-
- // Install the new array. Clear all the buckets to empty.
- CurArray = (const void**)malloc(sizeof(void*) * NewSize);
- assert(CurArray && "Failed to allocate memory?");
- CurArraySize = NewSize;
- memset(CurArray, -1, NewSize*sizeof(void*));
-
- // Copy over all valid entries.
- for (const void **BucketPtr = OldBuckets; BucketPtr != OldEnd; ++BucketPtr) {
- // Copy over the element if it is valid.
- const void *Elt = *BucketPtr;
- if (Elt != getTombstoneMarker() && Elt != getEmptyMarker())
- *const_cast<void**>(FindBucketFor(Elt)) = const_cast<void*>(Elt);
- }
-
- if (!WasSmall)
- free(OldBuckets);
- NumNonEmpty -= NumTombstones;
- NumTombstones = 0;
-}
-
-SmallPtrSetImplBase::SmallPtrSetImplBase(const void **SmallStorage,
- const SmallPtrSetImplBase &that) {
- SmallArray = SmallStorage;
-
- // If we're becoming small, prepare to insert into our stack space
- if (that.isSmall()) {
- CurArray = SmallArray;
- // Otherwise, allocate new heap space (unless we were the same size)
- } else {
- CurArray = (const void**)malloc(sizeof(void*) * that.CurArraySize);
- assert(CurArray && "Failed to allocate memory?");
- }
-
- // Copy over the that array.
- CopyHelper(that);
-}
-
-SmallPtrSetImplBase::SmallPtrSetImplBase(const void **SmallStorage,
- unsigned SmallSize,
- SmallPtrSetImplBase &&that) {
- SmallArray = SmallStorage;
- MoveHelper(SmallSize, std::move(that));
-}
-
-void SmallPtrSetImplBase::CopyFrom(const SmallPtrSetImplBase &RHS) {
- assert(&RHS != this && "Self-copy should be handled by the caller.");
-
- if (isSmall() && RHS.isSmall())
- assert(CurArraySize == RHS.CurArraySize &&
- "Cannot assign sets with different small sizes");
-
- // If we're becoming small, prepare to insert into our stack space
- if (RHS.isSmall()) {
- if (!isSmall())
- free(CurArray);
- CurArray = SmallArray;
- // Otherwise, allocate new heap space (unless we were the same size)
- } else if (CurArraySize != RHS.CurArraySize) {
- if (isSmall())
- CurArray = (const void**)malloc(sizeof(void*) * RHS.CurArraySize);
- else {
- const void **T = (const void**)realloc(CurArray,
- sizeof(void*) * RHS.CurArraySize);
- if (!T)
- free(CurArray);
- CurArray = T;
- }
- assert(CurArray && "Failed to allocate memory?");
- }
-
- CopyHelper(RHS);
-}
-
-void SmallPtrSetImplBase::CopyHelper(const SmallPtrSetImplBase &RHS) {
- // Copy over the new array size
- CurArraySize = RHS.CurArraySize;
-
- // Copy over the contents from the other set
- std::copy(RHS.CurArray, RHS.EndPointer(), CurArray);
-
- NumNonEmpty = RHS.NumNonEmpty;
- NumTombstones = RHS.NumTombstones;
-}
-
-void SmallPtrSetImplBase::MoveFrom(unsigned SmallSize,
- SmallPtrSetImplBase &&RHS) {
- if (!isSmall())
- free(CurArray);
- MoveHelper(SmallSize, std::move(RHS));
-}
-
-void SmallPtrSetImplBase::MoveHelper(unsigned SmallSize,
- SmallPtrSetImplBase &&RHS) {
- assert(&RHS != this && "Self-move should be handled by the caller.");
-
- if (RHS.isSmall()) {
- // Copy a small RHS rather than moving.
- CurArray = SmallArray;
- std::copy(RHS.CurArray, RHS.CurArray + RHS.NumNonEmpty, CurArray);
- } else {
- CurArray = RHS.CurArray;
- RHS.CurArray = RHS.SmallArray;
- }
-
- // Copy the rest of the trivial members.
- CurArraySize = RHS.CurArraySize;
- NumNonEmpty = RHS.NumNonEmpty;
- NumTombstones = RHS.NumTombstones;
-
- // Make the RHS small and empty.
- RHS.CurArraySize = SmallSize;
- assert(RHS.CurArray == RHS.SmallArray);
- RHS.NumNonEmpty = 0;
- RHS.NumTombstones = 0;
-}
-
-void SmallPtrSetImplBase::swap(SmallPtrSetImplBase &RHS) {
- if (this == &RHS) return;
-
- // We can only avoid copying elements if neither set is small.
- if (!this->isSmall() && !RHS.isSmall()) {
- std::swap(this->CurArray, RHS.CurArray);
- std::swap(this->CurArraySize, RHS.CurArraySize);
- std::swap(this->NumNonEmpty, RHS.NumNonEmpty);
- std::swap(this->NumTombstones, RHS.NumTombstones);
- return;
- }
-
- // FIXME: From here on we assume that both sets have the same small size.
-
- // If only RHS is small, copy the small elements into LHS and move the pointer
- // from LHS to RHS.
- if (!this->isSmall() && RHS.isSmall()) {
- assert(RHS.CurArray == RHS.SmallArray);
- std::copy(RHS.CurArray, RHS.CurArray + RHS.NumNonEmpty, this->SmallArray);
- std::swap(RHS.CurArraySize, this->CurArraySize);
- std::swap(this->NumNonEmpty, RHS.NumNonEmpty);
- std::swap(this->NumTombstones, RHS.NumTombstones);
- RHS.CurArray = this->CurArray;
- this->CurArray = this->SmallArray;
- return;
- }
-
- // If only LHS is small, copy the small elements into RHS and move the pointer
- // from RHS to LHS.
- if (this->isSmall() && !RHS.isSmall()) {
- assert(this->CurArray == this->SmallArray);
- std::copy(this->CurArray, this->CurArray + this->NumNonEmpty,
- RHS.SmallArray);
- std::swap(RHS.CurArraySize, this->CurArraySize);
- std::swap(RHS.NumNonEmpty, this->NumNonEmpty);
- std::swap(RHS.NumTombstones, this->NumTombstones);
- this->CurArray = RHS.CurArray;
- RHS.CurArray = RHS.SmallArray;
- return;
- }
-
- // Both a small, just swap the small elements.
- assert(this->isSmall() && RHS.isSmall());
- unsigned MinNonEmpty = std::min(this->NumNonEmpty, RHS.NumNonEmpty);
- std::swap_ranges(this->SmallArray, this->SmallArray + MinNonEmpty,
- RHS.SmallArray);
- if (this->NumNonEmpty > MinNonEmpty) {
- std::copy(this->SmallArray + MinNonEmpty,
- this->SmallArray + this->NumNonEmpty,
- RHS.SmallArray + MinNonEmpty);
- } else {
- std::copy(RHS.SmallArray + MinNonEmpty, RHS.SmallArray + RHS.NumNonEmpty,
- this->SmallArray + MinNonEmpty);
- }
- assert(this->CurArraySize == RHS.CurArraySize);
- std::swap(this->NumNonEmpty, RHS.NumNonEmpty);
- std::swap(this->NumTombstones, RHS.NumTombstones);
-}
diff --git a/third_party/ntcore_2017/wpiutil/src/llvm/SmallVector.cpp b/third_party/ntcore_2017/wpiutil/src/llvm/SmallVector.cpp
deleted file mode 100644
index 6aa709e..0000000
--- a/third_party/ntcore_2017/wpiutil/src/llvm/SmallVector.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//===- llvm/ADT/SmallVector.cpp - 'Normally small' vectors ----------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the SmallVector class.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/SmallVector.h"
-using namespace llvm;
-
-/// grow_pod - This is an implementation of the grow() method which only works
-/// on POD-like datatypes and is out of line to reduce code duplication.
-void SmallVectorBase::grow_pod(void *FirstEl, size_t MinSizeInBytes,
- size_t TSize) {
- size_t CurSizeBytes = size_in_bytes();
- size_t NewCapacityInBytes = 2 * capacity_in_bytes() + TSize; // Always grow.
- if (NewCapacityInBytes < MinSizeInBytes)
- NewCapacityInBytes = MinSizeInBytes;
-
- void *NewElts;
- if (BeginX == FirstEl) {
- NewElts = malloc(NewCapacityInBytes);
-
- // Copy the elements over. No need to run dtors on PODs.
- memcpy(NewElts, this->BeginX, CurSizeBytes);
- } else {
- // If this wasn't grown from the inline copy, grow the allocated space.
- NewElts = realloc(this->BeginX, NewCapacityInBytes);
- }
- assert(NewElts && "Out of memory");
-
- this->EndX = (char*)NewElts+CurSizeBytes;
- this->BeginX = NewElts;
- this->CapacityX = (char*)this->BeginX + NewCapacityInBytes;
-}
diff --git a/third_party/ntcore_2017/wpiutil/src/llvm/StringExtras.cpp b/third_party/ntcore_2017/wpiutil/src/llvm/StringExtras.cpp
deleted file mode 100644
index 74b47a5..0000000
--- a/third_party/ntcore_2017/wpiutil/src/llvm/StringExtras.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//===-- StringExtras.cpp - Implement the StringExtras header --------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the StringExtras.h header
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/StringExtras.h"
-#include "llvm/SmallVector.h"
-using namespace llvm;
-
-/// StrInStrNoCase - Portable version of strcasestr. Locates the first
-/// occurrence of string 's1' in string 's2', ignoring case. Returns
-/// the offset of s2 in s1 or npos if s2 cannot be found.
-StringRef::size_type llvm::StrInStrNoCase(StringRef s1, StringRef s2) {
- size_t N = s2.size(), M = s1.size();
- if (N > M)
- return StringRef::npos;
- for (size_t i = 0, e = M - N + 1; i != e; ++i)
- if (s1.substr(i, N).equals_lower(s2))
- return i;
- return StringRef::npos;
-}
-
-/// getToken - This function extracts one token from source, ignoring any
-/// leading characters that appear in the Delimiters string, and ending the
-/// token at any of the characters that appear in the Delimiters string. If
-/// there are no tokens in the source string, an empty string is returned.
-/// The function returns a pair containing the extracted token and the
-/// remaining tail string.
-std::pair<StringRef, StringRef> llvm::getToken(StringRef Source,
- StringRef Delimiters) {
- // Figure out where the token starts.
- StringRef::size_type Start = Source.find_first_not_of(Delimiters);
-
- // Find the next occurrence of the delimiter.
- StringRef::size_type End = Source.find_first_of(Delimiters, Start);
-
- return std::make_pair(Source.slice(Start, End), Source.substr(End));
-}
-
-/// SplitString - Split up the specified string according to the specified
-/// delimiters, appending the result fragments to the output list.
-void llvm::SplitString(StringRef Source,
- SmallVectorImpl<StringRef> &OutFragments,
- StringRef Delimiters) {
- std::pair<StringRef, StringRef> S = getToken(Source, Delimiters);
- while (!S.first.empty()) {
- OutFragments.push_back(S.first);
- S = getToken(S.second, Delimiters);
- }
-}
diff --git a/third_party/ntcore_2017/wpiutil/src/llvm/StringMap.cpp b/third_party/ntcore_2017/wpiutil/src/llvm/StringMap.cpp
deleted file mode 100644
index 032c368..0000000
--- a/third_party/ntcore_2017/wpiutil/src/llvm/StringMap.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-//===--- StringMap.cpp - String Hash table map implementation -------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the StringMap class.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/StringMap.h"
-#include "llvm/MathExtras.h"
-#include "llvm/StringExtras.h"
-#include "llvm/Compiler.h"
-#include <cassert>
-using namespace llvm;
-
-/// Returns the number of buckets to allocate to ensure that the DenseMap can
-/// accommodate \p NumEntries without need to grow().
-static unsigned getMinBucketToReserveForEntries(unsigned NumEntries) {
- // Ensure that "NumEntries * 4 < NumBuckets * 3"
- if (NumEntries == 0)
- return 0;
- // +1 is required because of the strict equality.
- // For example if NumEntries is 48, we need to return 401.
- return NextPowerOf2(NumEntries * 4 / 3 + 1);
-}
-
-StringMapImpl::StringMapImpl(unsigned InitSize, unsigned itemSize) {
- ItemSize = itemSize;
-
- // If a size is specified, initialize the table with that many buckets.
- if (InitSize) {
- // The table will grow when the number of entries reach 3/4 of the number of
- // buckets. To guarantee that "InitSize" number of entries can be inserted
- // in the table without growing, we allocate just what is needed here.
- init(getMinBucketToReserveForEntries(InitSize));
- return;
- }
-
- // Otherwise, initialize it with zero buckets to avoid the allocation.
- TheTable = nullptr;
- NumBuckets = 0;
- NumItems = 0;
- NumTombstones = 0;
-}
-
-void StringMapImpl::init(unsigned InitSize) {
- assert((InitSize & (InitSize-1)) == 0 &&
- "Init Size must be a power of 2 or zero!");
- NumBuckets = InitSize ? InitSize : 16;
- NumItems = 0;
- NumTombstones = 0;
-
- TheTable = (StringMapEntryBase **)calloc(NumBuckets+1,
- sizeof(StringMapEntryBase **) +
- sizeof(unsigned));
-
- // Allocate one extra bucket, set it to look filled so the iterators stop at
- // end.
- TheTable[NumBuckets] = (StringMapEntryBase*)2;
-}
-
-
-/// LookupBucketFor - Look up the bucket that the specified string should end
-/// up in. If it already exists as a key in the map, the Item pointer for the
-/// specified bucket will be non-null. Otherwise, it will be null. In either
-/// case, the FullHashValue field of the bucket will be set to the hash value
-/// of the string.
-unsigned StringMapImpl::LookupBucketFor(StringRef Name) {
- unsigned HTSize = NumBuckets;
- if (HTSize == 0) { // Hash table unallocated so far?
- init(16);
- HTSize = NumBuckets;
- }
- unsigned FullHashValue = HashString(Name);
- unsigned BucketNo = FullHashValue & (HTSize-1);
- unsigned *HashTable = (unsigned *)(TheTable + NumBuckets + 1);
-
- unsigned ProbeAmt = 1;
- int FirstTombstone = -1;
- while (1) {
- StringMapEntryBase *BucketItem = TheTable[BucketNo];
- // If we found an empty bucket, this key isn't in the table yet, return it.
- if (LLVM_LIKELY(!BucketItem)) {
- // If we found a tombstone, we want to reuse the tombstone instead of an
- // empty bucket. This reduces probing.
- if (FirstTombstone != -1) {
- HashTable[FirstTombstone] = FullHashValue;
- return FirstTombstone;
- }
-
- HashTable[BucketNo] = FullHashValue;
- return BucketNo;
- }
-
- if (BucketItem == getTombstoneVal()) {
- // Skip over tombstones. However, remember the first one we see.
- if (FirstTombstone == -1) FirstTombstone = BucketNo;
- } else if (LLVM_LIKELY(HashTable[BucketNo] == FullHashValue)) {
- // If the full hash value matches, check deeply for a match. The common
- // case here is that we are only looking at the buckets (for item info
- // being non-null and for the full hash value) not at the items. This
- // is important for cache locality.
-
- // Do the comparison like this because Name isn't necessarily
- // null-terminated!
- char *ItemStr = (char*)BucketItem+ItemSize;
- if (Name == StringRef(ItemStr, BucketItem->getKeyLength())) {
- // We found a match!
- return BucketNo;
- }
- }
-
- // Okay, we didn't find the item. Probe to the next bucket.
- BucketNo = (BucketNo+ProbeAmt) & (HTSize-1);
-
- // Use quadratic probing, it has fewer clumping artifacts than linear
- // probing and has good cache behavior in the common case.
- ++ProbeAmt;
- }
-}
-
-
-/// FindKey - Look up the bucket that contains the specified key. If it exists
-/// in the map, return the bucket number of the key. Otherwise return -1.
-/// This does not modify the map.
-int StringMapImpl::FindKey(StringRef Key) const {
- unsigned HTSize = NumBuckets;
- if (HTSize == 0) return -1; // Really empty table?
- unsigned FullHashValue = HashString(Key);
- unsigned BucketNo = FullHashValue & (HTSize-1);
- unsigned *HashTable = (unsigned *)(TheTable + NumBuckets + 1);
-
- unsigned ProbeAmt = 1;
- while (1) {
- StringMapEntryBase *BucketItem = TheTable[BucketNo];
- // If we found an empty bucket, this key isn't in the table yet, return.
- if (LLVM_LIKELY(!BucketItem))
- return -1;
-
- if (BucketItem == getTombstoneVal()) {
- // Ignore tombstones.
- } else if (LLVM_LIKELY(HashTable[BucketNo] == FullHashValue)) {
- // If the full hash value matches, check deeply for a match. The common
- // case here is that we are only looking at the buckets (for item info
- // being non-null and for the full hash value) not at the items. This
- // is important for cache locality.
-
- // Do the comparison like this because NameStart isn't necessarily
- // null-terminated!
- char *ItemStr = (char*)BucketItem+ItemSize;
- if (Key == StringRef(ItemStr, BucketItem->getKeyLength())) {
- // We found a match!
- return BucketNo;
- }
- }
-
- // Okay, we didn't find the item. Probe to the next bucket.
- BucketNo = (BucketNo+ProbeAmt) & (HTSize-1);
-
- // Use quadratic probing, it has fewer clumping artifacts than linear
- // probing and has good cache behavior in the common case.
- ++ProbeAmt;
- }
-}
-
-/// RemoveKey - Remove the specified StringMapEntry from the table, but do not
-/// delete it. This aborts if the value isn't in the table.
-void StringMapImpl::RemoveKey(StringMapEntryBase *V) {
- const char *VStr = (char*)V + ItemSize;
- StringMapEntryBase *V2 = RemoveKey(StringRef(VStr, V->getKeyLength()));
- (void)V2;
- assert(V == V2 && "Didn't find key?");
-}
-
-/// RemoveKey - Remove the StringMapEntry for the specified key from the
-/// table, returning it. If the key is not in the table, this returns null.
-StringMapEntryBase *StringMapImpl::RemoveKey(StringRef Key) {
- int Bucket = FindKey(Key);
- if (Bucket == -1) return nullptr;
-
- StringMapEntryBase *Result = TheTable[Bucket];
- TheTable[Bucket] = getTombstoneVal();
- --NumItems;
- ++NumTombstones;
- assert(NumItems + NumTombstones <= NumBuckets);
-
- return Result;
-}
-
-
-
-/// RehashTable - Grow the table, redistributing values into the buckets with
-/// the appropriate mod-of-hashtable-size.
-unsigned StringMapImpl::RehashTable(unsigned BucketNo) {
- unsigned NewSize;
- unsigned *HashTable = (unsigned *)(TheTable + NumBuckets + 1);
-
- // If the hash table is now more than 3/4 full, or if fewer than 1/8 of
- // the buckets are empty (meaning that many are filled with tombstones),
- // grow/rehash the table.
- if (LLVM_UNLIKELY(NumItems * 4 > NumBuckets * 3)) {
- NewSize = NumBuckets*2;
- } else if (LLVM_UNLIKELY(NumBuckets - (NumItems + NumTombstones) <=
- NumBuckets / 8)) {
- NewSize = NumBuckets;
- } else {
- return BucketNo;
- }
-
- unsigned NewBucketNo = BucketNo;
- // Allocate one extra bucket which will always be non-empty. This allows the
- // iterators to stop at end.
- StringMapEntryBase **NewTableArray =
- (StringMapEntryBase **)calloc(NewSize+1, sizeof(StringMapEntryBase *) +
- sizeof(unsigned));
- unsigned *NewHashArray = (unsigned *)(NewTableArray + NewSize + 1);
- NewTableArray[NewSize] = (StringMapEntryBase*)2;
-
- // Rehash all the items into their new buckets. Luckily :) we already have
- // the hash values available, so we don't have to rehash any strings.
- for (unsigned I = 0, E = NumBuckets; I != E; ++I) {
- StringMapEntryBase *Bucket = TheTable[I];
- if (Bucket && Bucket != getTombstoneVal()) {
- // Fast case, bucket available.
- unsigned FullHash = HashTable[I];
- unsigned NewBucket = FullHash & (NewSize-1);
- if (!NewTableArray[NewBucket]) {
- NewTableArray[FullHash & (NewSize-1)] = Bucket;
- NewHashArray[FullHash & (NewSize-1)] = FullHash;
- if (I == BucketNo)
- NewBucketNo = NewBucket;
- continue;
- }
-
- // Otherwise probe for a spot.
- unsigned ProbeSize = 1;
- do {
- NewBucket = (NewBucket + ProbeSize++) & (NewSize-1);
- } while (NewTableArray[NewBucket]);
-
- // Finally found a slot. Fill it in.
- NewTableArray[NewBucket] = Bucket;
- NewHashArray[NewBucket] = FullHash;
- if (I == BucketNo)
- NewBucketNo = NewBucket;
- }
- }
-
- free(TheTable);
-
- TheTable = NewTableArray;
- NumBuckets = NewSize;
- NumTombstones = 0;
- return NewBucketNo;
-}
diff --git a/third_party/ntcore_2017/wpiutil/src/llvm/StringRef.cpp b/third_party/ntcore_2017/wpiutil/src/llvm/StringRef.cpp
deleted file mode 100644
index c254ae3..0000000
--- a/third_party/ntcore_2017/wpiutil/src/llvm/StringRef.cpp
+++ /dev/null
@@ -1,452 +0,0 @@
-//===-- StringRef.cpp - Lightweight String References ---------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/StringRef.h"
-#include "llvm/Hashing.h"
-#include "llvm/SmallVector.h"
-#include <bitset>
-#include <climits>
-
-using namespace llvm;
-
-// MSVC emits references to this into the translation units which reference it.
-#ifndef _MSC_VER
-const size_t StringRef::npos;
-#endif
-
-static char ascii_tolower(char x) {
- if (x >= 'A' && x <= 'Z')
- return x - 'A' + 'a';
- return x;
-}
-
-static char ascii_toupper(char x) {
- if (x >= 'a' && x <= 'z')
- return x - 'a' + 'A';
- return x;
-}
-
-static bool ascii_isdigit(char x) {
- return x >= '0' && x <= '9';
-}
-
-// strncasecmp() is not available on non-POSIX systems, so define an
-// alternative function here.
-static int ascii_strncasecmp(const char *LHS, const char *RHS, size_t Length) {
- for (size_t I = 0; I < Length; ++I) {
- unsigned char LHC = ascii_tolower(LHS[I]);
- unsigned char RHC = ascii_tolower(RHS[I]);
- if (LHC != RHC)
- return LHC < RHC ? -1 : 1;
- }
- return 0;
-}
-
-/// compare_lower - Compare strings, ignoring case.
-int StringRef::compare_lower(StringRef RHS) const {
- if (int Res = ascii_strncasecmp(Data, RHS.Data, std::min(size(), RHS.size())))
- return Res;
- if (size() == RHS.size())
- return 0;
- return size() < RHS.size() ? -1 : 1;
-}
-
-/// Check if this string starts with the given \p Prefix, ignoring case.
-bool StringRef::startswith_lower(StringRef Prefix) const {
- return size() >= Prefix.size() &&
- ascii_strncasecmp(Data, Prefix.Data, Prefix.size()) == 0;
-}
-
-/// Check if this string ends with the given \p Suffix, ignoring case.
-bool StringRef::endswith_lower(StringRef Suffix) const {
- return size() >= Suffix.size() &&
- ascii_strncasecmp(end() - Suffix.size(), Suffix.Data, Suffix.size()) == 0;
-}
-
-/// compare_numeric - Compare strings, handle embedded numbers.
-int StringRef::compare_numeric(StringRef RHS) const {
- for (size_t I = 0, E = std::min(size(), RHS.size()); I != E; ++I) {
- // Check for sequences of digits.
- if (ascii_isdigit(Data[I]) && ascii_isdigit(RHS.Data[I])) {
- // The longer sequence of numbers is considered larger.
- // This doesn't really handle prefixed zeros well.
- size_t J;
- for (J = I + 1; J != E + 1; ++J) {
- bool ld = J < size() && ascii_isdigit(Data[J]);
- bool rd = J < RHS.size() && ascii_isdigit(RHS.Data[J]);
- if (ld != rd)
- return rd ? -1 : 1;
- if (!rd)
- break;
- }
- // The two number sequences have the same length (J-I), just memcmp them.
- if (int Res = compareMemory(Data + I, RHS.Data + I, J - I))
- return Res < 0 ? -1 : 1;
- // Identical number sequences, continue search after the numbers.
- I = J - 1;
- continue;
- }
- if (Data[I] != RHS.Data[I])
- return (unsigned char)Data[I] < (unsigned char)RHS.Data[I] ? -1 : 1;
- }
- if (size() == RHS.size())
- return 0;
- return size() < RHS.size() ? -1 : 1;
-}
-
-//===----------------------------------------------------------------------===//
-// String Operations
-//===----------------------------------------------------------------------===//
-
-std::string StringRef::lower() const {
- std::string Result(size(), char());
- for (size_type i = 0, e = size(); i != e; ++i) {
- Result[i] = ascii_tolower(Data[i]);
- }
- return Result;
-}
-
-std::string StringRef::upper() const {
- std::string Result(size(), char());
- for (size_type i = 0, e = size(); i != e; ++i) {
- Result[i] = ascii_toupper(Data[i]);
- }
- return Result;
-}
-
-const char *StringRef::c_str(llvm::SmallVectorImpl<char>& buf) const {
- if (is_null_terminated()) {
- // If null terminated, return data directly
- return data();
- } else {
- // If not null terminated, use SmallVectorImpl to store data
- // copy data, and return a known null terminated string
- buf.clear();
- buf.append(begin(), end());
- buf.push_back(0);
- return buf.begin();
- }
-}
-
-//===----------------------------------------------------------------------===//
-// String Searching
-//===----------------------------------------------------------------------===//
-
-
-/// find - Search for the first string \arg Str in the string.
-///
-/// \return - The index of the first occurrence of \arg Str, or npos if not
-/// found.
-size_t StringRef::find(StringRef Str, size_t From) const {
- if (From > size())
- return npos;
-
- const char *Needle = Str.data();
- size_t N = Str.size();
- if (N == 0)
- return From;
-
- size_t Size = size() - From;
- if (Size < N)
- return npos;
-
- const char *Start = Data + From;
- const char *Stop = Start + (Size - N + 1);
-
- // For short haystacks or unsupported needles fall back to the naive algorithm
- if (Size < 16 || N > 255) {
- do {
- if (std::memcmp(Start, Needle, N) == 0)
- return Start - Data;
- ++Start;
- } while (Start < Stop);
- return npos;
- }
-
- // Build the bad char heuristic table, with uint8_t to reduce cache thrashing.
- uint8_t BadCharSkip[256];
- std::memset(BadCharSkip, N, 256);
- for (unsigned i = 0; i != N-1; ++i)
- BadCharSkip[(uint8_t)Str[i]] = N-1-i;
-
- do {
- if (std::memcmp(Start, Needle, N) == 0)
- return Start - Data;
-
- // Otherwise skip the appropriate number of bytes.
- Start += BadCharSkip[(uint8_t)Start[N-1]];
- } while (Start < Stop);
-
- return npos;
-}
-
-/// rfind - Search for the last string \arg Str in the string.
-///
-/// \return - The index of the last occurrence of \arg Str, or npos if not
-/// found.
-size_t StringRef::rfind(StringRef Str) const {
- size_t N = Str.size();
- if (N > size())
- return npos;
- for (size_t i = size() - N + 1, e = 0; i != e;) {
- --i;
- if (substr(i, N).equals(Str))
- return i;
- }
- return npos;
-}
-
-/// find_first_of - Find the first character in the string that is in \arg
-/// Chars, or npos if not found.
-///
-/// Note: O(size() + Chars.size())
-StringRef::size_type StringRef::find_first_of(StringRef Chars,
- size_t From) const {
- std::bitset<1 << CHAR_BIT> CharBits;
- for (size_type i = 0; i != Chars.size(); ++i)
- CharBits.set((unsigned char)Chars[i]);
-
- for (size_type i = std::min(From, size()), e = size(); i != e; ++i)
- if (CharBits.test((unsigned char)Data[i]))
- return i;
- return npos;
-}
-
-/// find_first_not_of - Find the first character in the string that is not
-/// \arg C or npos if not found.
-StringRef::size_type StringRef::find_first_not_of(char C, size_t From) const {
- for (size_type i = std::min(From, size()), e = size(); i != e; ++i)
- if (Data[i] != C)
- return i;
- return npos;
-}
-
-/// find_first_not_of - Find the first character in the string that is not
-/// in the string \arg Chars, or npos if not found.
-///
-/// Note: O(size() + Chars.size())
-StringRef::size_type StringRef::find_first_not_of(StringRef Chars,
- size_t From) const {
- std::bitset<1 << CHAR_BIT> CharBits;
- for (size_type i = 0; i != Chars.size(); ++i)
- CharBits.set((unsigned char)Chars[i]);
-
- for (size_type i = std::min(From, size()), e = size(); i != e; ++i)
- if (!CharBits.test((unsigned char)Data[i]))
- return i;
- return npos;
-}
-
-/// find_last_of - Find the last character in the string that is in \arg C,
-/// or npos if not found.
-///
-/// Note: O(size() + Chars.size())
-StringRef::size_type StringRef::find_last_of(StringRef Chars,
- size_t From) const {
- std::bitset<1 << CHAR_BIT> CharBits;
- for (size_type i = 0; i != Chars.size(); ++i)
- CharBits.set((unsigned char)Chars[i]);
-
- for (size_type i = std::min(From, size()) - 1, e = -1; i != e; --i)
- if (CharBits.test((unsigned char)Data[i]))
- return i;
- return npos;
-}
-
-/// find_last_not_of - Find the last character in the string that is not
-/// \arg C, or npos if not found.
-StringRef::size_type StringRef::find_last_not_of(char C, size_t From) const {
- for (size_type i = std::min(From, size()) - 1, e = -1; i != e; --i)
- if (Data[i] != C)
- return i;
- return npos;
-}
-
-/// find_last_not_of - Find the last character in the string that is not in
-/// \arg Chars, or npos if not found.
-///
-/// Note: O(size() + Chars.size())
-StringRef::size_type StringRef::find_last_not_of(StringRef Chars,
- size_t From) const {
- std::bitset<1 << CHAR_BIT> CharBits;
- for (size_type i = 0, e = Chars.size(); i != e; ++i)
- CharBits.set((unsigned char)Chars[i]);
-
- for (size_type i = std::min(From, size()) - 1, e = -1; i != e; --i)
- if (!CharBits.test((unsigned char)Data[i]))
- return i;
- return npos;
-}
-
-void StringRef::split(SmallVectorImpl<StringRef> &A,
- StringRef Separator, int MaxSplit,
- bool KeepEmpty) const {
- StringRef S = *this;
-
- // Count down from MaxSplit. When MaxSplit is -1, this will just split
- // "forever". This doesn't support splitting more than 2^31 times
- // intentionally; if we ever want that we can make MaxSplit a 64-bit integer
- // but that seems unlikely to be useful.
- while (MaxSplit-- != 0) {
- size_t Idx = S.find(Separator);
- if (Idx == npos)
- break;
-
- // Push this split.
- if (KeepEmpty || Idx > 0)
- A.push_back(S.slice(0, Idx));
-
- // Jump forward.
- S = S.slice(Idx + Separator.size(), npos);
- }
-
- // Push the tail.
- if (KeepEmpty || !S.empty())
- A.push_back(S);
-}
-
-void StringRef::split(SmallVectorImpl<StringRef> &A, char Separator,
- int MaxSplit, bool KeepEmpty) const {
- StringRef S = *this;
-
- // Count down from MaxSplit. When MaxSplit is -1, this will just split
- // "forever". This doesn't support splitting more than 2^31 times
- // intentionally; if we ever want that we can make MaxSplit a 64-bit integer
- // but that seems unlikely to be useful.
- while (MaxSplit-- != 0) {
- size_t Idx = S.find(Separator);
- if (Idx == npos)
- break;
-
- // Push this split.
- if (KeepEmpty || Idx > 0)
- A.push_back(S.slice(0, Idx));
-
- // Jump forward.
- S = S.slice(Idx + 1, npos);
- }
-
- // Push the tail.
- if (KeepEmpty || !S.empty())
- A.push_back(S);
-}
-
-//===----------------------------------------------------------------------===//
-// Helpful Algorithms
-//===----------------------------------------------------------------------===//
-
-/// count - Return the number of non-overlapped occurrences of \arg Str in
-/// the string.
-size_t StringRef::count(StringRef Str) const {
- size_t Count = 0;
- size_t N = Str.size();
- if (N > size())
- return 0;
- for (size_t i = 0, e = size() - N + 1; i != e; ++i)
- if (substr(i, N).equals(Str))
- ++Count;
- return Count;
-}
-
-static unsigned GetAutoSenseRadix(StringRef &Str) {
- if (Str.startswith("0x") || Str.startswith("0X")) {
- Str = Str.substr(2);
- return 16;
- }
-
- if (Str.startswith("0b") || Str.startswith("0B")) {
- Str = Str.substr(2);
- return 2;
- }
-
- if (Str.startswith("0o")) {
- Str = Str.substr(2);
- return 8;
- }
-
- if (Str.startswith("0"))
- return 8;
-
- return 10;
-}
-
-
-/// GetAsUnsignedInteger - Workhorse method that converts a integer character
-/// sequence of radix up to 36 to an unsigned long long value.
-bool llvm::getAsUnsignedInteger(StringRef Str, unsigned Radix,
- unsigned long long &Result) {
- // Autosense radix if not specified.
- if (Radix == 0)
- Radix = GetAutoSenseRadix(Str);
-
- // Empty strings (after the radix autosense) are invalid.
- if (Str.empty()) return true;
-
- // Parse all the bytes of the string given this radix. Watch for overflow.
- Result = 0;
- while (!Str.empty()) {
- unsigned CharVal;
- if (Str[0] >= '0' && Str[0] <= '9')
- CharVal = Str[0]-'0';
- else if (Str[0] >= 'a' && Str[0] <= 'z')
- CharVal = Str[0]-'a'+10;
- else if (Str[0] >= 'A' && Str[0] <= 'Z')
- CharVal = Str[0]-'A'+10;
- else
- return true;
-
- // If the parsed value is larger than the integer radix, the string is
- // invalid.
- if (CharVal >= Radix)
- return true;
-
- // Add in this character.
- unsigned long long PrevResult = Result;
- Result = Result*Radix+CharVal;
-
- // Check for overflow by shifting back and seeing if bits were lost.
- if (Result/Radix < PrevResult)
- return true;
-
- Str = Str.substr(1);
- }
-
- return false;
-}
-
-bool llvm::getAsSignedInteger(StringRef Str, unsigned Radix,
- long long &Result) {
- unsigned long long ULLVal;
-
- // Handle positive strings first.
- if (Str.empty() || Str.front() != '-') {
- if (getAsUnsignedInteger(Str, Radix, ULLVal) ||
- // Check for value so large it overflows a signed value.
- (long long)ULLVal < 0)
- return true;
- Result = ULLVal;
- return false;
- }
-
- // Get the positive part of the value.
- if (getAsUnsignedInteger(Str.substr(1), Radix, ULLVal) ||
- // Reject values so large they'd overflow as negative signed, but allow
- // "-0". This negates the unsigned so that the negative isn't undefined
- // on signed overflow.
- (long long)-ULLVal > 0)
- return true;
-
- Result = -ULLVal;
- return false;
-}
-
-// Implementation of StringRef hashing.
-hash_code llvm::hash_value(StringRef S) {
- return hash_combine_range(S.begin(), S.end());
-}
diff --git a/third_party/ntcore_2017/wpiutil/src/llvm/raw_os_ostream.cpp b/third_party/ntcore_2017/wpiutil/src/llvm/raw_os_ostream.cpp
deleted file mode 100644
index 402004e..0000000
--- a/third_party/ntcore_2017/wpiutil/src/llvm/raw_os_ostream.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//===--- raw_os_ostream.cpp - Implement the raw_os_ostream class ----------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This implements support adapting raw_ostream to std::ostream.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/raw_os_ostream.h"
-#include <ostream>
-using namespace llvm;
-
-//===----------------------------------------------------------------------===//
-// raw_os_ostream
-//===----------------------------------------------------------------------===//
-
-raw_os_ostream::~raw_os_ostream() {
- flush();
-}
-
-void raw_os_ostream::write_impl(const char *Ptr, size_t Size) {
- OS.write(Ptr, Size);
-}
-
-uint64_t raw_os_ostream::current_pos() const { return OS.tellp(); }
diff --git a/third_party/ntcore_2017/wpiutil/src/llvm/raw_ostream.cpp b/third_party/ntcore_2017/wpiutil/src/llvm/raw_ostream.cpp
deleted file mode 100644
index 8ddbcc6..0000000
--- a/third_party/ntcore_2017/wpiutil/src/llvm/raw_ostream.cpp
+++ /dev/null
@@ -1,855 +0,0 @@
-//===--- raw_ostream.cpp - Implement the raw_ostream classes --------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This implements support for bulk buffered stream output.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/raw_ostream.h"
-#include "llvm/SmallString.h"
-#include "llvm/SmallVector.h"
-#include "llvm/StringExtras.h"
-#include "llvm/Compiler.h"
-#include "llvm/Format.h"
-#include "llvm/MathExtras.h"
-#include "llvm/WindowsError.h"
-#include <cctype>
-#include <cerrno>
-#include <sys/stat.h>
-#include <system_error>
-
-// <fcntl.h> may provide O_BINARY.
-#include <fcntl.h>
-
-#ifndef _WIN32
-#include <unistd.h>
-#include <sys/uio.h>
-#endif
-
-#if defined(__CYGWIN__)
-#include <io.h>
-#endif
-
-#if defined(_MSC_VER)
-#include <io.h>
-#ifndef STDIN_FILENO
-# define STDIN_FILENO 0
-#endif
-#ifndef STDOUT_FILENO
-# define STDOUT_FILENO 1
-#endif
-#ifndef STDERR_FILENO
-# define STDERR_FILENO 2
-#endif
-#endif
-
-#if defined(_WIN32)
-#include <windows.h>
-
-/// Determines if the program is running on Windows 8 or newer. This
-/// reimplements one of the helpers in the Windows 8.1 SDK, which are intended
-/// to supercede raw calls to GetVersionEx. Old SDKs, Cygwin, and MinGW don't
-/// yet have VersionHelpers.h, so we have our own helper.
-static inline bool RunningWindows8OrGreater() {
- // Windows 8 is version 6.2, service pack 0.
- OSVERSIONINFOEXW osvi = {};
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- osvi.dwMajorVersion = 6;
- osvi.dwMinorVersion = 2;
- osvi.wServicePackMajor = 0;
-
- DWORDLONG Mask = 0;
- Mask = VerSetConditionMask(Mask, VER_MAJORVERSION, VER_GREATER_EQUAL);
- Mask = VerSetConditionMask(Mask, VER_MINORVERSION, VER_GREATER_EQUAL);
- Mask = VerSetConditionMask(Mask, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
-
- return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION |
- VER_SERVICEPACKMAJOR,
- Mask) != FALSE;
-}
-
-static std::error_code UTF8ToUTF16(llvm::StringRef utf8,
- llvm::SmallVectorImpl<wchar_t> &utf16) {
- if (!utf8.empty()) {
- int len = ::MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, utf8.begin(),
- utf8.size(), utf16.begin(), 0);
-
- if (len == 0)
- return llvm::mapWindowsError(::GetLastError());
-
- utf16.reserve(len + 1);
- utf16.set_size(len);
-
- len = ::MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, utf8.begin(),
- utf8.size(), utf16.begin(), utf16.size());
-
- if (len == 0)
- return llvm::mapWindowsError(::GetLastError());
- }
-
- // Make utf16 null terminated.
- utf16.push_back(0);
- utf16.pop_back();
-
- return std::error_code();
-}
-
-#endif
-
-using namespace llvm;
-
-raw_ostream::~raw_ostream() {
- // raw_ostream's subclasses should take care to flush the buffer
- // in their destructors.
- assert(OutBufCur == OutBufStart &&
- "raw_ostream destructor called with non-empty buffer!");
-
- if (BufferMode == InternalBuffer)
- delete [] OutBufStart;
-}
-
-// An out of line virtual method to provide a home for the class vtable.
-void raw_ostream::handle() {}
-
-size_t raw_ostream::preferred_buffer_size() const {
- // BUFSIZ is intended to be a reasonable default.
- return BUFSIZ;
-}
-
-void raw_ostream::SetBuffered() {
- // Ask the subclass to determine an appropriate buffer size.
- if (size_t Size = preferred_buffer_size())
- SetBufferSize(Size);
- else
- // It may return 0, meaning this stream should be unbuffered.
- SetUnbuffered();
-}
-
-void raw_ostream::SetBufferAndMode(char *BufferStart, size_t Size,
- BufferKind Mode) {
- assert(((Mode == Unbuffered && !BufferStart && Size == 0) ||
- (Mode != Unbuffered && BufferStart && Size != 0)) &&
- "stream must be unbuffered or have at least one byte");
- // Make sure the current buffer is free of content (we can't flush here; the
- // child buffer management logic will be in write_impl).
- assert(GetNumBytesInBuffer() == 0 && "Current buffer is non-empty!");
-
- if (BufferMode == InternalBuffer)
- delete [] OutBufStart;
- OutBufStart = BufferStart;
- OutBufEnd = OutBufStart+Size;
- OutBufCur = OutBufStart;
- BufferMode = Mode;
-
- assert(OutBufStart <= OutBufEnd && "Invalid size!");
-}
-
-raw_ostream &raw_ostream::operator<<(unsigned long N) {
- // Zero is a special case.
- if (N == 0)
- return *this << '0';
-
- char NumberBuffer[20];
- char *EndPtr = NumberBuffer+sizeof(NumberBuffer);
- char *CurPtr = EndPtr;
-
- while (N) {
- *--CurPtr = '0' + char(N % 10);
- N /= 10;
- }
- return write(CurPtr, EndPtr-CurPtr);
-}
-
-raw_ostream &raw_ostream::operator<<(long N) {
- if (N < 0) {
- *this << '-';
- // Avoid undefined behavior on LONG_MIN with a cast.
- N = -(unsigned long)N;
- }
-
- return this->operator<<(static_cast<unsigned long>(N));
-}
-
-raw_ostream &raw_ostream::operator<<(unsigned long long N) {
- // Output using 32-bit div/mod when possible.
- if (N == static_cast<unsigned long>(N))
- return this->operator<<(static_cast<unsigned long>(N));
-
- char NumberBuffer[20];
- char *EndPtr = std::end(NumberBuffer);
- char *CurPtr = EndPtr;
-
- while (N) {
- *--CurPtr = '0' + char(N % 10);
- N /= 10;
- }
- return write(CurPtr, EndPtr-CurPtr);
-}
-
-raw_ostream &raw_ostream::operator<<(long long N) {
- if (N < 0) {
- *this << '-';
- // Avoid undefined behavior on INT64_MIN with a cast.
- N = -(unsigned long long)N;
- }
-
- return this->operator<<(static_cast<unsigned long long>(N));
-}
-
-raw_ostream &raw_ostream::write_hex(unsigned long long N) {
- // Zero is a special case.
- if (N == 0)
- return *this << '0';
-
- char NumberBuffer[16];
- char *EndPtr = std::end(NumberBuffer);
- char *CurPtr = EndPtr;
-
- while (N) {
- unsigned char x = static_cast<unsigned char>(N) % 16;
- *--CurPtr = hexdigit(x, /*LowerCase*/true);
- N /= 16;
- }
-
- return write(CurPtr, EndPtr-CurPtr);
-}
-
-raw_ostream &raw_ostream::write_escaped(StringRef Str,
- bool UseHexEscapes) {
- for (unsigned char c : Str) {
- switch (c) {
- case '\\':
- *this << '\\' << '\\';
- break;
- case '\t':
- *this << '\\' << 't';
- break;
- case '\n':
- *this << '\\' << 'n';
- break;
- case '"':
- *this << '\\' << '"';
- break;
- default:
- if (std::isprint(c)) {
- *this << c;
- break;
- }
-
- // Write out the escaped representation.
- if (UseHexEscapes) {
- *this << '\\' << 'x';
- *this << hexdigit((c >> 4 & 0xF));
- *this << hexdigit((c >> 0) & 0xF);
- } else {
- // Always use a full 3-character octal escape.
- *this << '\\';
- *this << char('0' + ((c >> 6) & 7));
- *this << char('0' + ((c >> 3) & 7));
- *this << char('0' + ((c >> 0) & 7));
- }
- }
- }
-
- return *this;
-}
-
-raw_ostream &raw_ostream::operator<<(const void *P) {
- *this << '0' << 'x';
-
- return write_hex((uintptr_t) P);
-}
-
-raw_ostream &raw_ostream::operator<<(double N) {
-#ifdef _WIN32
- // On MSVCRT and compatible, output of %e is incompatible to Posix
- // by default. Number of exponent digits should be at least 2. "%+03d"
- // FIXME: Implement our formatter to here or Support/Format.h!
-#if defined(__MINGW32__)
- // FIXME: It should be generic to C++11.
- if (N == 0.0 && std::signbit(N))
- return *this << "-0.000000e+00";
-#else
- int fpcl = _fpclass(N);
-
- // negative zero
- if (fpcl == _FPCLASS_NZ)
- return *this << "-0.000000e+00";
-#endif
-
- char buf[16];
- unsigned len;
- len = format("%e", N).snprint(buf, sizeof(buf));
- if (len <= sizeof(buf) - 2) {
- if (len >= 5 && buf[len - 5] == 'e' && buf[len - 3] == '0') {
- int cs = buf[len - 4];
- if (cs == '+' || cs == '-') {
- int c1 = buf[len - 2];
- int c0 = buf[len - 1];
- if (isdigit(static_cast<unsigned char>(c1)) &&
- isdigit(static_cast<unsigned char>(c0))) {
- // Trim leading '0': "...e+012" -> "...e+12\0"
- buf[len - 3] = c1;
- buf[len - 2] = c0;
- buf[--len] = 0;
- }
- }
- }
- return this->operator<<(buf);
- }
-#endif
- return this->operator<<(format("%e", N));
-}
-
-
-
-void raw_ostream::flush_nonempty() {
- assert(OutBufCur > OutBufStart && "Invalid call to flush_nonempty.");
- size_t Length = OutBufCur - OutBufStart;
- OutBufCur = OutBufStart;
- write_impl(OutBufStart, Length);
-}
-
-raw_ostream &raw_ostream::write(unsigned char C) {
- // Group exceptional cases into a single branch.
- if (LLVM_UNLIKELY(OutBufCur >= OutBufEnd)) {
- if (LLVM_UNLIKELY(!OutBufStart)) {
- if (BufferMode == Unbuffered) {
- write_impl(reinterpret_cast<char*>(&C), 1);
- return *this;
- }
- // Set up a buffer and start over.
- SetBuffered();
- return write(C);
- }
-
- flush_nonempty();
- }
-
- *OutBufCur++ = C;
- return *this;
-}
-
-raw_ostream &raw_ostream::write(const char *Ptr, size_t Size) {
- // Group exceptional cases into a single branch.
- if (LLVM_UNLIKELY(size_t(OutBufEnd - OutBufCur) < Size)) {
- if (LLVM_UNLIKELY(!OutBufStart)) {
- if (BufferMode == Unbuffered) {
- write_impl(Ptr, Size);
- return *this;
- }
- // Set up a buffer and start over.
- SetBuffered();
- return write(Ptr, Size);
- }
-
- size_t NumBytes = OutBufEnd - OutBufCur;
-
- // If the buffer is empty at this point we have a string that is larger
- // than the buffer. Directly write the chunk that is a multiple of the
- // preferred buffer size and put the remainder in the buffer.
- if (LLVM_UNLIKELY(OutBufCur == OutBufStart)) {
- assert(NumBytes != 0 && "undefined behavior");
- size_t BytesToWrite = Size - (Size % NumBytes);
- write_impl(Ptr, BytesToWrite);
- size_t BytesRemaining = Size - BytesToWrite;
- if (BytesRemaining > size_t(OutBufEnd - OutBufCur)) {
- // Too much left over to copy into our buffer.
- return write(Ptr + BytesToWrite, BytesRemaining);
- }
- copy_to_buffer(Ptr + BytesToWrite, BytesRemaining);
- return *this;
- }
-
- // We don't have enough space in the buffer to fit the string in. Insert as
- // much as possible, flush and start over with the remainder.
- copy_to_buffer(Ptr, NumBytes);
- flush_nonempty();
- return write(Ptr + NumBytes, Size - NumBytes);
- }
-
- copy_to_buffer(Ptr, Size);
-
- return *this;
-}
-
-void raw_ostream::copy_to_buffer(const char *Ptr, size_t Size) {
- assert(Size <= size_t(OutBufEnd - OutBufCur) && "Buffer overrun!");
-
- // Handle short strings specially, memcpy isn't very good at very short
- // strings.
- switch (Size) {
- case 4: OutBufCur[3] = Ptr[3]; // FALL THROUGH
- case 3: OutBufCur[2] = Ptr[2]; // FALL THROUGH
- case 2: OutBufCur[1] = Ptr[1]; // FALL THROUGH
- case 1: OutBufCur[0] = Ptr[0]; // FALL THROUGH
- case 0: break;
- default:
- memcpy(OutBufCur, Ptr, Size);
- break;
- }
-
- OutBufCur += Size;
-}
-
-// Formatted output.
-raw_ostream &raw_ostream::operator<<(const format_object_base &Fmt) {
- // If we have more than a few bytes left in our output buffer, try
- // formatting directly onto its end.
- size_t NextBufferSize = 127;
- size_t BufferBytesLeft = OutBufEnd - OutBufCur;
- if (BufferBytesLeft > 3) {
- size_t BytesUsed = Fmt.print(OutBufCur, BufferBytesLeft);
-
- // Common case is that we have plenty of space.
- if (BytesUsed <= BufferBytesLeft) {
- OutBufCur += BytesUsed;
- return *this;
- }
-
- // Otherwise, we overflowed and the return value tells us the size to try
- // again with.
- NextBufferSize = BytesUsed;
- }
-
- // If we got here, we didn't have enough space in the output buffer for the
- // string. Try printing into a SmallVector that is resized to have enough
- // space. Iterate until we win.
- SmallVector<char, 128> V;
-
- while (1) {
- V.resize(NextBufferSize);
-
- // Try formatting into the SmallVector.
- size_t BytesUsed = Fmt.print(V.data(), NextBufferSize);
-
- // If BytesUsed fit into the vector, we win.
- if (BytesUsed <= NextBufferSize)
- return write(V.data(), BytesUsed);
-
- // Otherwise, try again with a new size.
- assert(BytesUsed > NextBufferSize && "Didn't grow buffer!?");
- NextBufferSize = BytesUsed;
- }
-}
-
-raw_ostream &raw_ostream::operator<<(const FormattedString &FS) {
- unsigned Len = FS.Str.size();
- int PadAmount = FS.Width - Len;
- if (FS.RightJustify && (PadAmount > 0))
- this->indent(PadAmount);
- this->operator<<(FS.Str);
- if (!FS.RightJustify && (PadAmount > 0))
- this->indent(PadAmount);
- return *this;
-}
-
-raw_ostream &raw_ostream::operator<<(const FormattedNumber &FN) {
- if (FN.Hex) {
- unsigned Nibbles = (64 - countLeadingZeros(FN.HexValue)+3)/4;
- unsigned PrefixChars = FN.HexPrefix ? 2 : 0;
- unsigned Width = std::max(FN.Width, Nibbles + PrefixChars);
-
- char NumberBuffer[20] = "0x0000000000000000";
- if (!FN.HexPrefix)
- NumberBuffer[1] = '0';
- char *EndPtr = NumberBuffer+Width;
- char *CurPtr = EndPtr;
- unsigned long long N = FN.HexValue;
- while (N) {
- unsigned char x = static_cast<unsigned char>(N) % 16;
- *--CurPtr = hexdigit(x, !FN.Upper);
- N /= 16;
- }
-
- return write(NumberBuffer, Width);
- } else {
- // Zero is a special case.
- if (FN.DecValue == 0) {
- this->indent(FN.Width-1);
- return *this << '0';
- }
- char NumberBuffer[32];
- char *EndPtr = NumberBuffer+sizeof(NumberBuffer);
- char *CurPtr = EndPtr;
- bool Neg = (FN.DecValue < 0);
- uint64_t N = Neg ? -static_cast<uint64_t>(FN.DecValue) : FN.DecValue;
- while (N) {
- *--CurPtr = '0' + char(N % 10);
- N /= 10;
- }
- int Len = EndPtr - CurPtr;
- int Pad = FN.Width - Len;
- if (Neg)
- --Pad;
- if (Pad > 0)
- this->indent(Pad);
- if (Neg)
- *this << '-';
- return write(CurPtr, Len);
- }
-}
-
-
-/// indent - Insert 'NumSpaces' spaces.
-raw_ostream &raw_ostream::indent(unsigned NumSpaces) {
- static const char Spaces[] = " "
- " "
- " ";
-
- // Usually the indentation is small, handle it with a fastpath.
- if (NumSpaces < array_lengthof(Spaces))
- return write(Spaces, NumSpaces);
-
- while (NumSpaces) {
- unsigned NumToWrite = std::min(NumSpaces,
- (unsigned)array_lengthof(Spaces)-1);
- write(Spaces, NumToWrite);
- NumSpaces -= NumToWrite;
- }
- return *this;
-}
-
-
-//===----------------------------------------------------------------------===//
-// Formatted Output
-//===----------------------------------------------------------------------===//
-
-// Out of line virtual method.
-void format_object_base::home() {
-}
-
-//===----------------------------------------------------------------------===//
-// raw_fd_ostream
-//===----------------------------------------------------------------------===//
-
-static int getFD(StringRef Filename, std::error_code &EC,
- sys::fs::OpenFlags Flags) {
- // Handle "-" as stdout. Note that when we do this, we consider ourself
- // the owner of stdout. This means that we can do things like close the
- // file descriptor when we're done and set the "binary" flag globally.
- if (Filename == "-") {
- EC = std::error_code();
- // If user requested binary then put stdout into binary mode if
- // possible.
- if (!(Flags & sys::fs::F_Text)) {
-#if defined(_WIN32)
- _setmode(_fileno(stdout), _O_BINARY);
-#endif
- }
- return STDOUT_FILENO;
- }
-
- int FD;
-
- //EC = sys::fs::openFileForWrite(Filename, FD, Flags);
- //if (EC)
- // return -1;
-#if defined(_WIN32)
- // Verify that we don't have both "append" and "excl".
- assert((!(Flags & sys::fs::F_Excl) || !(Flags & sys::fs::F_Append)) &&
- "Cannot specify both 'excl' and 'append' file creation flags!");
-
- SmallVector<wchar_t, 128> PathUTF16;
-
- EC = UTF8ToUTF16(Filename, PathUTF16);
- if (EC) return -1;
-
- DWORD CreationDisposition;
- if (Flags & sys::fs::F_Excl)
- CreationDisposition = CREATE_NEW;
- else if (Flags & sys::fs::F_Append)
- CreationDisposition = OPEN_ALWAYS;
- else
- CreationDisposition = CREATE_ALWAYS;
-
- DWORD Access = GENERIC_WRITE;
- if (Flags & sys::fs::F_RW)
- Access |= GENERIC_READ;
-
- HANDLE H = ::CreateFileW(PathUTF16.begin(), Access,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
- CreationDisposition, FILE_ATTRIBUTE_NORMAL, NULL);
-
- if (H == INVALID_HANDLE_VALUE) {
- DWORD LastError = ::GetLastError();
- EC = mapWindowsError(LastError);
- return -1;
- }
-
- int OpenFlags = 0;
- if (Flags & sys::fs::F_Append)
- OpenFlags |= _O_APPEND;
-
- if (Flags & sys::fs::F_Text)
- OpenFlags |= _O_TEXT;
-
- FD = ::_open_osfhandle(intptr_t(H), OpenFlags);
- if (FD == -1) {
- ::CloseHandle(H);
- EC = mapWindowsError(ERROR_INVALID_HANDLE);
- return -1;
- }
-#else
- // Verify that we don't have both "append" and "excl".
- assert((!(Flags & sys::fs::F_Excl) || !(Flags & sys::fs::F_Append)) &&
- "Cannot specify both 'excl' and 'append' file creation flags!");
-
- int OpenFlags = O_CREAT;
-
- if (Flags & sys::fs::F_RW)
- OpenFlags |= O_RDWR;
- else
- OpenFlags |= O_WRONLY;
-
- if (Flags & sys::fs::F_Append)
- OpenFlags |= O_APPEND;
- else
- OpenFlags |= O_TRUNC;
-
- if (Flags & sys::fs::F_Excl)
- OpenFlags |= O_EXCL;
-
- SmallString<128> Storage{Filename};
- while ((FD = open(Storage.c_str(), OpenFlags, 0666)) < 0) {
- if (errno != EINTR) {
- EC = std::error_code(errno, std::generic_category());
- return -1;
- }
- }
-#endif
-
- EC = std::error_code();
- return FD;
-}
-
-raw_fd_ostream::raw_fd_ostream(StringRef Filename, std::error_code &EC,
- sys::fs::OpenFlags Flags)
- : raw_fd_ostream(getFD(Filename, EC, Flags), true) {}
-
-/// FD is the file descriptor that this writes to. If ShouldClose is true, this
-/// closes the file when the stream is destroyed.
-raw_fd_ostream::raw_fd_ostream(int fd, bool shouldClose, bool unbuffered)
- : raw_pwrite_stream(unbuffered), FD(fd), ShouldClose(shouldClose),
- Error(false) {
- if (FD < 0 ) {
- ShouldClose = false;
- return;
- }
-
- // Get the starting position.
- off_t loc = ::lseek(FD, 0, SEEK_CUR);
-#ifdef _WIN32
- // MSVCRT's _lseek(SEEK_CUR) doesn't return -1 for pipes.
- SupportsSeeking = loc != (off_t)-1 && ::GetFileType(reinterpret_cast<HANDLE>(::_get_osfhandle(FD))) != FILE_TYPE_PIPE;
-#else
- SupportsSeeking = loc != (off_t)-1;
-#endif
- if (!SupportsSeeking)
- pos = 0;
- else
- pos = static_cast<uint64_t>(loc);
-}
-
-raw_fd_ostream::~raw_fd_ostream() {
- if (FD >= 0) {
- flush();
- if (ShouldClose && ::close(FD) < 0)
- error_detected();
- }
-
-#ifdef __MINGW32__
- // On mingw, global dtors should not call exit().
- // report_fatal_error() invokes exit(). We know report_fatal_error()
- // might not write messages to stderr when any errors were detected
- // on FD == 2.
- if (FD == 2) return;
-#endif
-}
-
-
-void raw_fd_ostream::write_impl(const char *Ptr, size_t Size) {
- assert(FD >= 0 && "File already closed.");
- pos += Size;
-
-#ifndef _WIN32
- bool ShouldWriteInChunks = false;
-#else
- // Writing a large size of output to Windows console returns ENOMEM. It seems
- // that, prior to Windows 8, WriteFile() is redirecting to WriteConsole(), and
- // the latter has a size limit (66000 bytes or less, depending on heap usage).
- bool ShouldWriteInChunks = !!::_isatty(FD) && !RunningWindows8OrGreater();
-#endif
-
- do {
- size_t ChunkSize = Size;
- if (ChunkSize > 32767 && ShouldWriteInChunks)
- ChunkSize = 32767;
-
-#ifdef _WIN32
- int ret = ::_write(FD, Ptr, ChunkSize);
-#else
- ssize_t ret = ::write(FD, Ptr, ChunkSize);
-#endif
-
- if (ret < 0) {
- // If it's a recoverable error, swallow it and retry the write.
- //
- // Ideally we wouldn't ever see EAGAIN or EWOULDBLOCK here, since
- // raw_ostream isn't designed to do non-blocking I/O. However, some
- // programs, such as old versions of bjam, have mistakenly used
- // O_NONBLOCK. For compatibility, emulate blocking semantics by
- // spinning until the write succeeds. If you don't want spinning,
- // don't use O_NONBLOCK file descriptors with raw_ostream.
- if (errno == EINTR || errno == EAGAIN
-#ifdef EWOULDBLOCK
- || errno == EWOULDBLOCK
-#endif
- )
- continue;
-
- // Otherwise it's a non-recoverable error. Note it and quit.
- error_detected();
- break;
- }
-
- // The write may have written some or all of the data. Update the
- // size and buffer pointer to reflect the remainder that needs
- // to be written. If there are no bytes left, we're done.
- Ptr += ret;
- Size -= ret;
- } while (Size > 0);
-}
-
-void raw_fd_ostream::close() {
- assert(ShouldClose);
- ShouldClose = false;
- flush();
- if (::close(FD) < 0)
- error_detected();
- FD = -1;
-}
-
-uint64_t raw_fd_ostream::seek(uint64_t off) {
- assert(SupportsSeeking && "Stream does not support seeking!");
- flush();
- pos = ::lseek(FD, off, SEEK_SET);
- if (pos == (uint64_t)-1)
- error_detected();
- return pos;
-}
-
-void raw_fd_ostream::pwrite_impl(const char *Ptr, size_t Size,
- uint64_t Offset) {
- uint64_t Pos = tell();
- seek(Offset);
- write(Ptr, Size);
- seek(Pos);
-}
-
-size_t raw_fd_ostream::preferred_buffer_size() const {
-#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__minix)
- // Windows and Minix have no st_blksize.
- assert(FD >= 0 && "File not yet open!");
- struct stat statbuf;
- if (fstat(FD, &statbuf) != 0)
- return 0;
-
- // If this is a terminal, don't use buffering. Line buffering
- // would be a more traditional thing to do, but it's not worth
- // the complexity.
- if (S_ISCHR(statbuf.st_mode) && isatty(FD))
- return 0;
- // Return the preferred block size.
- return statbuf.st_blksize;
-#else
- return raw_ostream::preferred_buffer_size();
-#endif
-}
-
-//===----------------------------------------------------------------------===//
-// outs(), errs(), nulls()
-//===----------------------------------------------------------------------===//
-
-/// outs() - This returns a reference to a raw_ostream for standard output.
-/// Use it like: outs() << "foo" << "bar";
-raw_ostream &llvm::outs() {
- // Set buffer settings to model stdout behavior. Delete the file descriptor
- // when the program exits, forcing error detection. This means that if you
- // ever call outs(), you can't open another raw_fd_ostream on stdout, as we'll
- // close stdout twice and print an error the second time.
- std::error_code EC;
- static raw_fd_ostream S("-", EC, sys::fs::F_None);
- assert(!EC);
- return S;
-}
-
-/// errs() - This returns a reference to a raw_ostream for standard error.
-/// Use it like: errs() << "foo" << "bar";
-raw_ostream &llvm::errs() {
- // Set standard error to be unbuffered by default.
- static raw_fd_ostream S(STDERR_FILENO, false, true);
- return S;
-}
-
-/// nulls() - This returns a reference to a raw_ostream which discards output.
-raw_ostream &llvm::nulls() {
- static raw_null_ostream S;
- return S;
-}
-
-
-//===----------------------------------------------------------------------===//
-// raw_string_ostream
-//===----------------------------------------------------------------------===//
-
-raw_string_ostream::~raw_string_ostream() {
- flush();
-}
-
-void raw_string_ostream::write_impl(const char *Ptr, size_t Size) {
- OS.append(Ptr, Size);
-}
-
-//===----------------------------------------------------------------------===//
-// raw_svector_ostream
-//===----------------------------------------------------------------------===//
-
-uint64_t raw_svector_ostream::current_pos() const { return OS.size(); }
-
-void raw_svector_ostream::write_impl(const char *Ptr, size_t Size) {
- OS.append(Ptr, Ptr + Size);
-}
-
-void raw_svector_ostream::pwrite_impl(const char *Ptr, size_t Size,
- uint64_t Offset) {
- memcpy(OS.data() + Offset, Ptr, Size);
-}
-
-//===----------------------------------------------------------------------===//
-// raw_null_ostream
-//===----------------------------------------------------------------------===//
-
-raw_null_ostream::~raw_null_ostream() {
-#ifndef NDEBUG
- // ~raw_ostream asserts that the buffer is empty. This isn't necessary
- // with raw_null_ostream, but it's better to have raw_null_ostream follow
- // the rules than to change the rules just for raw_null_ostream.
- flush();
-#endif
-}
-
-void raw_null_ostream::write_impl(const char * /*Ptr*/, size_t /*Size*/) {}
-
-uint64_t raw_null_ostream::current_pos() const {
- return 0;
-}
-
-void raw_null_ostream::pwrite_impl(const char * /*Ptr*/, size_t /*Size*/,
- uint64_t /*Offset*/) {}
diff --git a/third_party/ntcore_2017/wpiutil/src/support/Base64.cpp b/third_party/ntcore_2017/wpiutil/src/support/Base64.cpp
deleted file mode 100644
index 88fe28a..0000000
--- a/third_party/ntcore_2017/wpiutil/src/support/Base64.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-/* ====================================================================
- * Copyright (c) 1995-1999 The Apache Group. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Group and was originally based
- * on public domain software written at the National Center for
- * Supercomputing Applications, University of Illinois, Urbana-Champaign.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- */
-
-#include "support/Base64.h"
-
-namespace wpi {
-
-// aaaack but it's fast and const should make it shared text page.
-static const unsigned char pr2six[256] =
-{
- // ASCII table
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64,
- 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64,
- 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
-};
-
-std::size_t Base64Decode(llvm::StringRef encoded, std::string* plain) {
- const unsigned char *end = encoded.bytes_begin();
- while (pr2six[*end] <= 63 && end != encoded.bytes_end()) ++end;
- std::size_t nprbytes = end - encoded.bytes_begin();
-
- plain->clear();
- if (nprbytes == 0)
- return 0;
- plain->reserve(((nprbytes + 3) / 4) * 3);
-
- const unsigned char *cur = encoded.bytes_begin();
-
- while (nprbytes > 4) {
- (*plain) += (pr2six[cur[0]] << 2 | pr2six[cur[1]] >> 4);
- (*plain) += (pr2six[cur[1]] << 4 | pr2six[cur[2]] >> 2);
- (*plain) += (pr2six[cur[2]] << 6 | pr2six[cur[3]]);
- cur += 4;
- nprbytes -= 4;
- }
-
- // Note: (nprbytes == 1) would be an error, so just ignore that case
- if (nprbytes > 1) (*plain) += (pr2six[cur[0]] << 2 | pr2six[cur[1]] >> 4);
- if (nprbytes > 2) (*plain) += (pr2six[cur[1]] << 4 | pr2six[cur[2]] >> 2);
- if (nprbytes > 3) (*plain) += (pr2six[cur[2]] << 6 | pr2six[cur[3]]);
-
- return (end - encoded.bytes_begin()) + ((4 - nprbytes) & 3);
-}
-
-static const char basis_64[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-void Base64Encode(llvm::StringRef plain, std::string* encoded) {
- encoded->clear();
- if (plain.empty())
- return;
- std::size_t len = plain.size();
- encoded->reserve(((len + 2) / 3 * 4) + 1);
-
- std::size_t i;
- for (i = 0; (i + 2) < len; i += 3) {
- (*encoded) += basis_64[(plain[i] >> 2) & 0x3F];
- (*encoded) +=
- basis_64[((plain[i] & 0x3) << 4) | ((int)(plain[i + 1] & 0xF0) >> 4)];
- (*encoded) += basis_64[((plain[i + 1] & 0xF) << 2) |
- ((int)(plain[i + 2] & 0xC0) >> 6)];
- (*encoded) += basis_64[plain[i + 2] & 0x3F];
- }
- if (i < len) {
- (*encoded) += basis_64[(plain[i] >> 2) & 0x3F];
- if (i == (len - 1)) {
- (*encoded) += basis_64[((plain[i] & 0x3) << 4)];
- (*encoded) += '=';
- } else {
- (*encoded) +=
- basis_64[((plain[i] & 0x3) << 4) | ((int)(plain[i + 1] & 0xF0) >> 4)];
- (*encoded) += basis_64[((plain[i + 1] & 0xF) << 2)];
- }
- (*encoded) += '=';
- }
-}
-
-} // namespace wpi
diff --git a/third_party/ntcore_2017/wpiutil/src/support/leb128.cpp b/third_party/ntcore_2017/wpiutil/src/support/leb128.cpp
deleted file mode 100644
index 11605bc..0000000
--- a/third_party/ntcore_2017/wpiutil/src/support/leb128.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "support/leb128.h"
-
-#include "support/raw_istream.h"
-
-namespace wpi {
-
-/**
- * Get size of unsigned LEB128 data
- * @val: value
- *
- * Determine the number of bytes required to encode an unsigned LEB128 datum.
- * The algorithm is taken from Appendix C of the DWARF 3 spec. For information
- * on the encodings refer to section "7.6 - Variable Length Data". Return
- * the number of bytes required.
- */
-std::size_t SizeUleb128(unsigned long val) {
- std::size_t count = 0;
- do {
- val >>= 7;
- ++count;
- } while (val != 0);
- return count;
-}
-
-/**
- * Write unsigned LEB128 data
- * @addr: the address where the ULEB128 data is to be stored
- * @val: value to be stored
- *
- * Encode an unsigned LEB128 encoded datum. The algorithm is taken
- * from Appendix C of the DWARF 3 spec. For information on the
- * encodings refer to section "7.6 - Variable Length Data". Return
- * the number of bytes written.
- */
-std::size_t WriteUleb128(llvm::SmallVectorImpl<char>& dest, unsigned long val) {
- std::size_t count = 0;
-
- do {
- unsigned char byte = val & 0x7f;
- val >>= 7;
-
- if (val != 0)
- byte |= 0x80; // mark this byte to show that more bytes will follow
-
- dest.push_back(byte);
- count++;
- } while (val != 0);
-
- return count;
-}
-
-/**
- * Read unsigned LEB128 data
- * @addr: the address where the ULEB128 data is stored
- * @ret: address to store the result
- *
- * Decode an unsigned LEB128 encoded datum. The algorithm is taken
- * from Appendix C of the DWARF 3 spec. For information on the
- * encodings refer to section "7.6 - Variable Length Data". Return
- * the number of bytes read.
- */
-std::size_t ReadUleb128(const char* addr, unsigned long* ret) {
- unsigned long result = 0;
- int shift = 0;
- std::size_t count = 0;
-
- while (1) {
- unsigned char byte = *reinterpret_cast<const unsigned char*>(addr);
- addr++;
- count++;
-
- result |= (byte & 0x7f) << shift;
- shift += 7;
-
- if (!(byte & 0x80)) break;
- }
-
- *ret = result;
-
- return count;
-}
-
-/**
- * Read unsigned LEB128 data from a stream
- * @is: the input stream where the ULEB128 data is to be read from
- * @ret: address to store the result
- *
- * Decode an unsigned LEB128 encoded datum. The algorithm is taken
- * from Appendix C of the DWARF 3 spec. For information on the
- * encodings refer to section "7.6 - Variable Length Data". Return
- * false on stream error, true on success.
- */
-bool ReadUleb128(raw_istream& is, unsigned long* ret) {
- unsigned long result = 0;
- int shift = 0;
-
- while (1) {
- unsigned char byte;
- is.read((char*)&byte, 1);
- if (is.has_error()) return false;
-
- result |= (byte & 0x7f) << shift;
- shift += 7;
-
- if (!(byte & 0x80)) break;
- }
-
- *ret = result;
-
- return true;
-}
-
-} // namespace wpi
diff --git a/third_party/ntcore_2017/wpiutil/src/support/raw_istream.cpp b/third_party/ntcore_2017/wpiutil/src/support/raw_istream.cpp
deleted file mode 100644
index 2863a61..0000000
--- a/third_party/ntcore_2017/wpiutil/src/support/raw_istream.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "support/raw_istream.h"
-
-#include <cstdlib>
-#include <cstring>
-
-#ifdef _WIN32
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-using namespace wpi;
-
-void raw_mem_istream::close() {}
-
-std::size_t raw_mem_istream::in_avail() const { return m_left; }
-
-void raw_mem_istream::read_impl(void* data, std::size_t len) {
- if (len > m_left) {
- error_detected();
- return;
- }
- std::memcpy(data, m_cur, len);
- m_cur += len;
- m_left -= len;
-}
-
-raw_fd_istream::raw_fd_istream(int fd, bool shouldClose, std::size_t bufSize)
- : m_bufSize(bufSize), m_fd(fd), m_shouldClose(shouldClose) {
- m_cur = m_end = m_buf = static_cast<char*>(std::malloc(bufSize));
-}
-
-raw_fd_istream::~raw_fd_istream() {
- if (m_shouldClose) close();
- std::free(m_buf);
-}
-
-void raw_fd_istream::close() {
- if (m_fd >= 0) {
- ::close(m_fd);
- m_fd = -1;
- }
-}
-
-std::size_t raw_fd_istream::in_avail() const { return m_end - m_cur; }
-
-void raw_fd_istream::read_impl(void* data, std::size_t len) {
- std::size_t left = m_end - m_cur;
- if (left < len) {
- // not enough data
- if (m_cur == m_end) {
-#ifdef _WIN32
- int count = ::_read(m_fd, m_buf, m_bufSize);
-#else
- ssize_t count = ::read(m_fd, m_buf, m_bufSize);
-#endif
- if (count < 0) {
- error_detected();
- return;
- }
- m_cur = m_buf;
- m_end = m_buf + count;
- return read_impl(data, len);
- }
-
- std::memcpy(data, m_cur, left);
- return read_impl(static_cast<char*>(data) + left, len - left);
- }
-
- std::memcpy(data, m_cur, len);
- m_cur += len;
-}
diff --git a/third_party/ntcore_2017/wpiutil/src/support/raw_socket_istream.cpp b/third_party/ntcore_2017/wpiutil/src/support/raw_socket_istream.cpp
deleted file mode 100644
index 4f27dfb..0000000
--- a/third_party/ntcore_2017/wpiutil/src/support/raw_socket_istream.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "support/raw_socket_istream.h"
-#include "tcpsockets/NetworkStream.h"
-
-using namespace wpi;
-
-void raw_socket_istream::read_impl(void* data, std::size_t len) {
- char* cdata = static_cast<char*>(data);
- std::size_t pos = 0;
-
- while (pos < len) {
- NetworkStream::Error err;
- std::size_t count =
- m_stream.receive(&cdata[pos], len - pos, &err, m_timeout);
- if (count == 0) {
- error_detected();
- return;
- }
- pos += count;
- }
-}
-
-void raw_socket_istream::close() { m_stream.close(); }
-
-std::size_t raw_socket_istream::in_avail() const { return 0; }
diff --git a/third_party/ntcore_2017/wpiutil/src/support/raw_socket_ostream.cpp b/third_party/ntcore_2017/wpiutil/src/support/raw_socket_ostream.cpp
deleted file mode 100644
index 67bcd8c..0000000
--- a/third_party/ntcore_2017/wpiutil/src/support/raw_socket_ostream.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "support/raw_socket_ostream.h"
-#include "tcpsockets/NetworkStream.h"
-
-using namespace wpi;
-
-raw_socket_ostream::~raw_socket_ostream() {
- flush();
- if (m_shouldClose) close();
-}
-
-void raw_socket_ostream::write_impl(const char* data, std::size_t len) {
- std::size_t pos = 0;
-
- while (pos < len) {
- NetworkStream::Error err;
- std::size_t count =
- m_stream.send(&data[pos], len - pos, &err);
- if (count == 0) {
- error_detected();
- return;
- }
- pos += count;
- }
-}
-
-uint64_t raw_socket_ostream::current_pos() const { return 0; }
-
-void raw_socket_ostream::close() {
- if (!m_shouldClose) return;
- flush();
- m_stream.close();
-}
diff --git a/third_party/ntcore_2017/wpiutil/src/support/timestamp.cpp b/third_party/ntcore_2017/wpiutil/src/support/timestamp.cpp
deleted file mode 100644
index 9b21e5e..0000000
--- a/third_party/ntcore_2017/wpiutil/src/support/timestamp.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-#include "support/timestamp.h"
-
-#ifdef _WIN32
-#include <cassert>
-#include <exception>
-#include <windows.h>
-#else
-#include <chrono>
-#endif
-
-// offset in microseconds
-static unsigned long long zerotime() {
-#ifdef _WIN32
- FILETIME ft;
- unsigned long long tmpres = 0;
- // 100-nanosecond intervals since January 1, 1601 (UTC)
- // which means 0.1 us
- GetSystemTimeAsFileTime(&ft);
- tmpres |= ft.dwHighDateTime;
- tmpres <<= 32;
- tmpres |= ft.dwLowDateTime;
- // January 1st, 1970 - January 1st, 1601 UTC ~ 369 years
- // or 116444736000000000 us
- static const unsigned long long deltaepoch = 116444736000000000ull;
- tmpres -= deltaepoch;
- return tmpres;
-#else
- // 100-ns intervals
- using namespace std::chrono;
- return duration_cast<nanoseconds>(
- high_resolution_clock::now().time_since_epoch()).count() / 100u;
-#endif
-}
-
-static unsigned long long timestamp() {
-#ifdef _WIN32
- LARGE_INTEGER li;
- QueryPerformanceCounter(&li);
- // there is an imprecision with the initial value,
- // but what matters is that timestamps are monotonic and consistent
- return static_cast<unsigned long long>(li.QuadPart);
-#else
- // 100-ns intervals
- using namespace std::chrono;
- return duration_cast<nanoseconds>(
- steady_clock::now().time_since_epoch()).count() / 100u;
-#endif
-}
-
-#ifdef _WIN32
-static unsigned long long update_frequency() {
- LARGE_INTEGER li;
- if (!QueryPerformanceFrequency(&li) || !li.QuadPart) {
- // log something
- std::terminate();
- }
- return static_cast<unsigned long long>(li.QuadPart);
-}
-#endif
-
-static const unsigned long long zerotime_val = zerotime();
-static const unsigned long long offset_val = timestamp();
-#ifdef _WIN32
-static const unsigned long long frequency_val = update_frequency();
-#endif
-
-unsigned long long wpi::Now() {
-#ifdef _WIN32
- assert(offset_val > 0u);
- assert(frequency_val > 0u);
- unsigned long long delta = timestamp() - offset_val;
- // because the frequency is in update per seconds, we have to multiply the
- // delta by 10,000,000
- unsigned long long delta_in_us = delta * 10000000ull / frequency_val;
- return delta_in_us + zerotime_val;
-#else
- return zerotime_val + timestamp() - offset_val;
-#endif
-}
-
-unsigned long long WPI_Now() {
- return wpi::Now();
-}
diff --git a/third_party/ntcore_2017/wpiutil/src/tcpsockets/SocketError.cpp b/third_party/ntcore_2017/wpiutil/src/tcpsockets/SocketError.cpp
deleted file mode 100644
index a2628fd..0000000
--- a/third_party/ntcore_2017/wpiutil/src/tcpsockets/SocketError.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "tcpsockets/SocketError.h"
-
-#ifdef _WIN32
-#include <windows.h>
-#else
-#include <string.h>
-#endif
-
-namespace wpi {
-
-std::string SocketStrerror(int code) {
-#ifdef _WIN32
- LPSTR errstr = nullptr;
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- 0, code, 0, (LPSTR)&errstr, 0, 0);
- std::string rv(errstr);
- LocalFree(errstr);
- return rv;
-#else
- return strerror(code);
-#endif
-}
-
-} // namespace wpi
diff --git a/third_party/ntcore_2017/wpiutil/src/tcpsockets/TCPAcceptor.cpp b/third_party/ntcore_2017/wpiutil/src/tcpsockets/TCPAcceptor.cpp
deleted file mode 100644
index db5d608..0000000
--- a/third_party/ntcore_2017/wpiutil/src/tcpsockets/TCPAcceptor.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- TCPAcceptor.cpp
-
- TCPAcceptor class definition. TCPAcceptor provides methods to passively
- establish TCP/IP connections with clients.
-
- ------------------------------------------
-
- Copyright © 2013 [Vic Hargrave - http://vichargrave.com]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-#include "tcpsockets/TCPAcceptor.h"
-
-#include <cstdio>
-#include <cstring>
-#ifdef _WIN32
-#include <WinSock2.h>
-#include <Ws2tcpip.h>
-#pragma comment(lib, "Ws2_32.lib")
-#else
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <unistd.h>
-#include <fcntl.h>
-#endif
-
-#include "llvm/SmallString.h"
-#include "support/Logger.h"
-#include "tcpsockets/SocketError.h"
-
-using namespace wpi;
-
-TCPAcceptor::TCPAcceptor(int port, const char* address, Logger& logger)
- : m_lsd(0),
- m_port(port),
- m_address(address),
- m_listening(false),
- m_logger(logger) {
- m_shutdown = false;
-#ifdef _WIN32
- WSAData wsaData;
- WORD wVersionRequested = MAKEWORD(2, 2);
- WSAStartup(wVersionRequested, &wsaData);
-#endif
-}
-
-TCPAcceptor::~TCPAcceptor() {
- if (m_lsd > 0) {
- shutdown();
-#ifdef _WIN32
- closesocket(m_lsd);
-#else
- close(m_lsd);
-#endif
- }
-#ifdef _WIN32
- WSACleanup();
-#endif
-}
-
-int TCPAcceptor::start() {
- if (m_listening) return 0;
-
- m_lsd = socket(PF_INET, SOCK_STREAM, 0);
- if (m_lsd < 0) {
- WPI_ERROR(m_logger, "could not create socket");
- return -1;
- }
- struct sockaddr_in address;
-
- std::memset(&address, 0, sizeof(address));
- address.sin_family = PF_INET;
- if (m_address.size() > 0) {
-#ifdef _WIN32
- llvm::SmallString<128> addr_copy(m_address);
- addr_copy.push_back('\0');
- int res = InetPton(PF_INET, addr_copy.data(), &(address.sin_addr));
-#else
- int res = inet_pton(PF_INET, m_address.c_str(), &(address.sin_addr));
-#endif
- if (res != 1) {
- WPI_ERROR(m_logger, "could not resolve " << m_address << " address");
- return -1;
- }
- } else {
- address.sin_addr.s_addr = INADDR_ANY;
- }
- address.sin_port = htons(m_port);
-
- int optval = 1;
- setsockopt(m_lsd, SOL_SOCKET, SO_REUSEADDR, (char*)&optval, sizeof optval);
-
- int result = bind(m_lsd, (struct sockaddr*)&address, sizeof(address));
- if (result != 0) {
- WPI_ERROR(m_logger, "bind() to port " << m_port
- << " failed: " << SocketStrerror());
- return result;
- }
-
- result = listen(m_lsd, 5);
- if (result != 0) {
- WPI_ERROR(m_logger, "listen() on port " << m_port
- << " failed: " << SocketStrerror());
- return result;
- }
- m_listening = true;
- return result;
-}
-
-void TCPAcceptor::shutdown() {
- m_shutdown = true;
-#ifdef _WIN32
- ::shutdown(m_lsd, SD_BOTH);
-
- // this is ugly, but the easiest way to do this
- // force wakeup of accept() with a non-blocking connect to ourselves
- struct sockaddr_in address;
-
- std::memset(&address, 0, sizeof(address));
- address.sin_family = PF_INET;
- llvm::SmallString<128> addr_copy;
- if (m_address.size() > 0)
- addr_copy = m_address;
- else
- addr_copy = "127.0.0.1";
- addr_copy.push_back('\0');
- int size = sizeof(address);
- if (WSAStringToAddress(addr_copy.data(), PF_INET, nullptr,
- (struct sockaddr*)&address, &size) != 0)
- return;
- address.sin_port = htons(m_port);
-
- fd_set sdset;
- struct timeval tv;
- int result = -1, valopt, sd = socket(AF_INET, SOCK_STREAM, 0);
- if (sd < 0) return;
-
- // Set socket to non-blocking
- u_long mode = 1;
- ioctlsocket(sd, FIONBIO, &mode);
-
- // Try to connect
- ::connect(sd, (struct sockaddr*)&address, sizeof(address));
-
- // Close
- ::closesocket(sd);
-
-#else
- ::shutdown(m_lsd, SHUT_RDWR);
- int nullfd = ::open("/dev/null", O_RDONLY);
- if (nullfd >= 0) {
- ::dup2(nullfd, m_lsd);
- ::close(nullfd);
- }
-#endif
-}
-
-std::unique_ptr<NetworkStream> TCPAcceptor::accept() {
- if (!m_listening || m_shutdown) return nullptr;
-
- struct sockaddr_in address;
-#ifdef _WIN32
- int len = sizeof(address);
-#else
- socklen_t len = sizeof(address);
-#endif
- std::memset(&address, 0, sizeof(address));
- int sd = ::accept(m_lsd, (struct sockaddr*)&address, &len);
- if (sd < 0) {
- if (!m_shutdown)
- WPI_ERROR(m_logger, "accept() on port "
- << m_port << " failed: " << SocketStrerror());
- return nullptr;
- }
- if (m_shutdown) {
-#ifdef _WIN32
- closesocket(sd);
-#else
- close(sd);
-#endif
- return nullptr;
- }
- return std::unique_ptr<NetworkStream>(new TCPStream(sd, &address));
-}
diff --git a/third_party/ntcore_2017/wpiutil/src/tcpsockets/TCPConnector.cpp b/third_party/ntcore_2017/wpiutil/src/tcpsockets/TCPConnector.cpp
deleted file mode 100644
index ac563d1..0000000
--- a/third_party/ntcore_2017/wpiutil/src/tcpsockets/TCPConnector.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- TCPConnector.h
-
- TCPConnector class definition. TCPConnector provides methods to actively
- establish TCP/IP connections with a server.
-
- ------------------------------------------
-
- Copyright © 2013 [Vic Hargrave - http://vichargrave.com]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License
-*/
-
-#include "tcpsockets/TCPConnector.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <cstdio>
-#include <cstring>
-#ifdef _WIN32
-#include <WinSock2.h>
-#include <WS2tcpip.h>
-#else
-#include <netdb.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/select.h>
-#include <unistd.h>
-#endif
-
-#include "tcpsockets/TCPStream.h"
-
-#include "llvm/SmallString.h"
-#include "support/Logger.h"
-#include "tcpsockets/SocketError.h"
-
-using namespace wpi;
-
-static int ResolveHostName(const char* hostname, struct in_addr* addr) {
- struct addrinfo hints;
- struct addrinfo* res;
-
- hints.ai_flags = 0;
- hints.ai_family = AF_INET;
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_protocol = 0;
- hints.ai_addrlen = 0;
- hints.ai_addr = nullptr;
- hints.ai_canonname = nullptr;
- hints.ai_next = nullptr;
- int result = getaddrinfo(hostname, nullptr, &hints, &res);
- if (result == 0) {
- std::memcpy(addr, &((struct sockaddr_in*)res->ai_addr)->sin_addr,
- sizeof(struct in_addr));
- freeaddrinfo(res);
- }
- return result;
-}
-
-std::unique_ptr<NetworkStream> TCPConnector::connect(const char* server,
- int port, Logger& logger,
- int timeout) {
-#ifdef _WIN32
- struct WSAHelper {
- WSAHelper() {
- WSAData wsaData;
- WORD wVersionRequested = MAKEWORD(2, 2);
- WSAStartup(wVersionRequested, &wsaData);
- }
- ~WSAHelper() { WSACleanup(); }
- };
- static WSAHelper helper;
-#endif
- struct sockaddr_in address;
-
- std::memset(&address, 0, sizeof(address));
- address.sin_family = AF_INET;
- if (ResolveHostName(server, &(address.sin_addr)) != 0) {
-#ifdef _WIN32
- llvm::SmallString<128> addr_copy(server);
- addr_copy.push_back('\0');
- int res = InetPton(PF_INET, addr_copy.data(), &(address.sin_addr));
-#else
- int res = inet_pton(PF_INET, server, &(address.sin_addr));
-#endif
- if (res != 1) {
- WPI_ERROR(logger, "could not resolve " << server << " address");
- return nullptr;
- }
- }
- address.sin_port = htons(port);
-
- if (timeout == 0) {
- int sd = socket(AF_INET, SOCK_STREAM, 0);
- if (sd < 0) {
- WPI_ERROR(logger, "could not create socket");
- return nullptr;
- }
- if (::connect(sd, (struct sockaddr*)&address, sizeof(address)) != 0) {
- WPI_ERROR(logger, "connect() to " << server << " port " << port << " failed: " << SocketStrerror());
-#ifdef _WIN32
- closesocket(sd);
-#else
- ::close(sd);
-#endif
- return nullptr;
- }
- return std::unique_ptr<NetworkStream>(new TCPStream(sd, &address));
- }
-
- fd_set sdset;
- struct timeval tv;
- socklen_t len;
- int result = -1, valopt, sd = socket(AF_INET, SOCK_STREAM, 0);
- if (sd < 0) {
- WPI_ERROR(logger, "could not create socket");
- return nullptr;
- }
-
- // Set socket to non-blocking
-#ifdef _WIN32
- u_long mode = 1;
- if (ioctlsocket(sd, FIONBIO, &mode) == SOCKET_ERROR)
- WPI_WARNING(logger,
- "could not set socket to non-blocking: " << SocketStrerror());
-#else
- long arg;
- arg = fcntl(sd, F_GETFL, nullptr);
- if (arg < 0) {
- WPI_WARNING(logger,
- "could not set socket to non-blocking: " << SocketStrerror());
- } else {
- arg |= O_NONBLOCK;
- if (fcntl(sd, F_SETFL, arg) < 0)
- WPI_WARNING(logger,
- "could not set socket to non-blocking: " << SocketStrerror());
- }
-#endif
-
- // Connect with time limit
- if ((result = ::connect(sd, (struct sockaddr*)&address, sizeof(address))) <
- 0) {
- int my_errno = SocketErrno();
-#ifdef _WIN32
- if (my_errno == WSAEWOULDBLOCK || my_errno == WSAEINPROGRESS) {
-#else
- if (my_errno == EWOULDBLOCK || my_errno == EINPROGRESS) {
-#endif
- tv.tv_sec = timeout;
- tv.tv_usec = 0;
- FD_ZERO(&sdset);
- FD_SET(sd, &sdset);
- if (select(sd + 1, nullptr, &sdset, nullptr, &tv) > 0) {
- len = sizeof(int);
- getsockopt(sd, SOL_SOCKET, SO_ERROR, (char*)(&valopt), &len);
- if (valopt) {
- WPI_ERROR(logger, "select() to " << server << " port " << port << " error " << valopt << " - " << SocketStrerror(valopt));
- }
- // connection established
- else
- result = 0;
- } else
- WPI_INFO(logger, "connect() to " << server << " port " << port << " timed out");
- } else
- WPI_ERROR(logger, "connect() to " << server << " port " << port << " error " << SocketErrno() << " - " << SocketStrerror());
- }
-
- // Return socket to blocking mode
-#ifdef _WIN32
- mode = 0;
- if (ioctlsocket(sd, FIONBIO, &mode) == SOCKET_ERROR)
- WPI_WARNING(logger,
- "could not set socket to blocking: " << SocketStrerror());
-#else
- arg = fcntl(sd, F_GETFL, nullptr);
- if (arg < 0) {
- WPI_WARNING(logger,
- "could not set socket to blocking: " << SocketStrerror());
- } else {
- arg &= (~O_NONBLOCK);
- if (fcntl(sd, F_SETFL, arg) < 0)
- WPI_WARNING(logger,
- "could not set socket to blocking: " << SocketStrerror());
- }
-#endif
-
- // Create stream object if connected, close if not.
- if (result == -1) {
-#ifdef _WIN32
- closesocket(sd);
-#else
- ::close(sd);
-#endif
- return nullptr;
- }
- return std::unique_ptr<NetworkStream>(new TCPStream(sd, &address));
-}
diff --git a/third_party/ntcore_2017/wpiutil/src/tcpsockets/TCPStream.cpp b/third_party/ntcore_2017/wpiutil/src/tcpsockets/TCPStream.cpp
deleted file mode 100644
index d738abe..0000000
--- a/third_party/ntcore_2017/wpiutil/src/tcpsockets/TCPStream.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- TCPStream.h
-
- TCPStream class definition. TCPStream provides methods to trasnfer
- data between peers over a TCP/IP connection.
-
- ------------------------------------------
-
- Copyright © 2013 [Vic Hargrave - http://vichargrave.com]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-#include "tcpsockets/TCPStream.h"
-
-#include <fcntl.h>
-#ifdef _WIN32
-#include <WinSock2.h>
-#include <Ws2tcpip.h>
-#else
-#include <arpa/inet.h>
-#include <netinet/tcp.h>
-#include <unistd.h>
-#endif
-
-using namespace wpi;
-
-TCPStream::TCPStream(int sd, sockaddr_in* address)
- : m_sd(sd), m_blocking(true) {
- char ip[50];
-#ifdef _WIN32
- InetNtop(PF_INET, &(address->sin_addr.s_addr), ip, sizeof(ip) - 1);
-#else
- inet_ntop(PF_INET, (in_addr*)&(address->sin_addr.s_addr), ip,
- sizeof(ip) - 1);
-#ifdef SO_NOSIGPIPE
- // disable SIGPIPE on Mac OS X
- int set = 1;
- setsockopt(m_sd, SOL_SOCKET, SO_NOSIGPIPE, (char*)&set, sizeof set);
-#endif
-#endif
- m_peerIP = ip;
- m_peerPort = ntohs(address->sin_port);
-}
-
-TCPStream::~TCPStream() { close(); }
-
-std::size_t TCPStream::send(const char* buffer, std::size_t len, Error* err) {
- if (m_sd < 0) {
- *err = kConnectionClosed;
- return 0;
- }
-#ifdef _WIN32
- WSABUF wsaBuf;
- wsaBuf.buf = const_cast<char*>(buffer);
- wsaBuf.len = (ULONG)len;
- DWORD rv;
- bool result = true;
- while (WSASend(m_sd, &wsaBuf, 1, &rv, 0, nullptr, nullptr) == SOCKET_ERROR) {
- if (WSAGetLastError() != WSAEWOULDBLOCK) {
- result = false;
- break;
- }
- if (!m_blocking) {
- *err = kWouldBlock;
- return 0;
- }
- Sleep(1);
- }
- if (!result) {
- char Buffer[128];
-#ifdef _MSC_VER
- sprintf_s(Buffer, "Send() failed: WSA error=%d\n", WSAGetLastError());
-#else
- std::snprintf(Buffer, 128, "Send() failed: WSA error=%d\n", WSAGetLastError());
-#endif
- OutputDebugStringA(Buffer);
- *err = kConnectionReset;
- return 0;
- }
-#else
-#ifdef MSG_NOSIGNAL
- // disable SIGPIPE on Linux
- ssize_t rv = ::send(m_sd, buffer, len, MSG_NOSIGNAL);
-#else
- ssize_t rv = ::send(m_sd, buffer, len, 0);
-#endif
- if (rv < 0) {
- if (!m_blocking && (errno == EAGAIN || errno == EWOULDBLOCK))
- *err = kWouldBlock;
- else
- *err = kConnectionReset;
- return 0;
- }
-#endif
- return static_cast<std::size_t>(rv);
-}
-
-std::size_t TCPStream::receive(char* buffer, std::size_t len, Error* err,
- int timeout) {
- if (m_sd < 0) {
- *err = kConnectionClosed;
- return 0;
- }
-#ifdef _WIN32
- int rv;
-#else
- ssize_t rv;
-#endif
- if (timeout <= 0) {
-#ifdef _WIN32
- rv = recv(m_sd, buffer, len, 0);
-#else
- rv = read(m_sd, buffer, len);
-#endif
- }
- else if (WaitForReadEvent(timeout)) {
-#ifdef _WIN32
- rv = recv(m_sd, buffer, len, 0);
-#else
- rv = read(m_sd, buffer, len);
-#endif
- } else {
- *err = kConnectionTimedOut;
- return 0;
- }
- if (rv < 0) {
-#ifdef _WIN32
- if (!m_blocking && WSAGetLastError() == WSAEWOULDBLOCK)
-#else
- if (!m_blocking && (errno == EAGAIN || errno == EWOULDBLOCK))
-#endif
- *err = kWouldBlock;
- else
- *err = kConnectionReset;
- return 0;
- }
- return static_cast<std::size_t>(rv);
-}
-
-void TCPStream::close() {
- if (m_sd >= 0) {
-#ifdef _WIN32
- ::shutdown(m_sd, SD_BOTH);
- closesocket(m_sd);
-#else
- ::shutdown(m_sd, SHUT_RDWR);
- ::close(m_sd);
-#endif
- }
- m_sd = -1;
-}
-
-llvm::StringRef TCPStream::getPeerIP() const { return m_peerIP; }
-
-int TCPStream::getPeerPort() const { return m_peerPort; }
-
-void TCPStream::setNoDelay() {
- if (m_sd < 0) return;
- int optval = 1;
- setsockopt(m_sd, IPPROTO_TCP, TCP_NODELAY, (char*)&optval, sizeof optval);
-}
-
-bool TCPStream::setBlocking(bool enabled) {
- if (m_sd < 0) return true; // silently accept
-#ifdef _WIN32
- u_long mode = enabled ? 0 : 1;
- if (ioctlsocket(m_sd, FIONBIO, &mode) == SOCKET_ERROR) return false;
-#else
- long flags = fcntl(m_sd, F_GETFL, nullptr);
- if (flags < 0) return false;
- if (enabled)
- flags &= ~O_NONBLOCK;
- else
- flags |= O_NONBLOCK;
- if (fcntl(m_sd, F_SETFL, flags) < 0) return false;
-#endif
- return true;
-}
-
-int TCPStream::getNativeHandle() const {
- return m_sd;
-}
-
-bool TCPStream::WaitForReadEvent(int timeout) {
- fd_set sdset;
- struct timeval tv;
-
- tv.tv_sec = timeout;
- tv.tv_usec = 0;
- FD_ZERO(&sdset);
- FD_SET(m_sd, &sdset);
- if (select(m_sd + 1, &sdset, NULL, NULL, &tv) > 0) {
- return true;
- }
- return false;
-}
diff --git a/third_party/ntcore_2017/wpiutil/unittest/Base64Test.cpp b/third_party/ntcore_2017/wpiutil/unittest/Base64Test.cpp
deleted file mode 100644
index 972ca48..0000000
--- a/third_party/ntcore_2017/wpiutil/unittest/Base64Test.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "support/Base64.h"
-
-#include "gtest/gtest.h"
-
-namespace wpi {
-
-struct Base64TestParam {
- int plain_len;
- const char* plain;
- const char* encoded;
-};
-
-std::ostream& operator<<(std::ostream& os, const Base64TestParam& param) {
- os << "Base64TestParam(Len: " << param.plain_len << ", "
- << "Plain: \"" << param.plain << "\", "
- << "Encoded: \"" << param.encoded << "\")";
- return os;
-}
-
-class Base64Test : public ::testing::TestWithParam<Base64TestParam> {
- protected:
- llvm::StringRef GetPlain() {
- if (GetParam().plain_len < 0)
- return llvm::StringRef(GetParam().plain);
- else
- return llvm::StringRef(GetParam().plain, GetParam().plain_len);
- }
-};
-
-TEST_P(Base64Test, Encode) {
- std::string s;
- Base64Encode(GetPlain(), &s);
- ASSERT_EQ(GetParam().encoded, s);
-}
-
-TEST_P(Base64Test, Decode) {
- std::string s;
- llvm::StringRef encoded = GetParam().encoded;
- EXPECT_EQ(encoded.size(), Base64Decode(encoded, &s));
- ASSERT_EQ(GetPlain(), s);
-}
-
-static Base64TestParam sample[] = {
- {-1, "Send reinforcements", "U2VuZCByZWluZm9yY2VtZW50cw=="},
- {-1, "Now is the time for all good coders\n to learn C++",
- "Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKIHRvIGxlYXJuIEMrKw=="},
- {-1,
- "This is line one\nThis is line two\nThis is line three\nAnd so on...\n",
- "VGhpcyBpcyBsaW5lIG9uZQpUaGlzIGlzIGxpbmUgdHdvClRoaXMgaXMgbGluZSB0aHJlZQpBb"
- "mQgc28gb24uLi4K"},
-};
-
-INSTANTIATE_TEST_CASE_P(Base64Sample, Base64Test, ::testing::ValuesIn(sample));
-
-static Base64TestParam standard[] = {
- {0, "", ""},
- {1, "\0", "AA=="},
- {2, "\0\0", "AAA="},
- {3, "\0\0\0", "AAAA"},
- {1, "\377", "/w=="},
- {2, "\377\377", "//8="},
- {3, "\377\377\377", "////"},
- {2, "\xff\xef", "/+8="},
-};
-
-INSTANTIATE_TEST_CASE_P(Base64Standard, Base64Test,
- ::testing::ValuesIn(standard));
-
-} // namespace wpi
diff --git a/third_party/ntcore_2017/wpiutil/unittest/leb128Test.cpp b/third_party/ntcore_2017/wpiutil/unittest/leb128Test.cpp
deleted file mode 100644
index 00a79ee..0000000
--- a/third_party/ntcore_2017/wpiutil/unittest/leb128Test.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-//===- llvm/unittest/Support/LEB128Test.cpp - LEB128 function tests -------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "support/leb128.h"
-
-#include "gtest/gtest.h"
-
-#include <cstdint>
-#include <string>
-
-#include "llvm/SmallString.h"
-#include "llvm/StringRef.h"
-
-#include "support/raw_istream.h"
-
-namespace wpi {
-
-TEST(LEB128Test, WriteUleb128) {
-#define EXPECT_ULEB128_EQ(EXPECTED, VALUE, PAD) \
- do { \
- llvm::StringRef expected(EXPECTED, sizeof(EXPECTED)-1); \
- llvm::SmallString<32> buf; \
- std::size_t size = WriteUleb128(buf, VALUE); \
- EXPECT_EQ(size, buf.size()); \
- EXPECT_EQ(expected, buf.str()); \
- } while (0)
-
- // Write ULEB128
- EXPECT_ULEB128_EQ("\x00", 0, 0);
- EXPECT_ULEB128_EQ("\x01", 1, 0);
- EXPECT_ULEB128_EQ("\x3f", 63, 0);
- EXPECT_ULEB128_EQ("\x40", 64, 0);
- EXPECT_ULEB128_EQ("\x7f", 0x7f, 0);
- EXPECT_ULEB128_EQ("\x80\x01", 0x80, 0);
- EXPECT_ULEB128_EQ("\x81\x01", 0x81, 0);
- EXPECT_ULEB128_EQ("\x90\x01", 0x90, 0);
- EXPECT_ULEB128_EQ("\xff\x01", 0xff, 0);
- EXPECT_ULEB128_EQ("\x80\x02", 0x100, 0);
- EXPECT_ULEB128_EQ("\x81\x02", 0x101, 0);
-
-#undef EXPECT_ULEB128_EQ
-}
-
-TEST(LEB128Test, ReadUleb128) {
-#define EXPECT_READ_ULEB128_EQ(EXPECTED, VALUE) \
- do { \
- unsigned long val = 0; \
- std::size_t size = ReadUleb128(VALUE, &val); \
- EXPECT_EQ(sizeof(VALUE) - 1, size); \
- EXPECT_EQ(EXPECTED, val); \
- } while (0)
-
- // Read ULEB128
- EXPECT_READ_ULEB128_EQ(0u, "\x00");
- EXPECT_READ_ULEB128_EQ(1u, "\x01");
- EXPECT_READ_ULEB128_EQ(63u, "\x3f");
- EXPECT_READ_ULEB128_EQ(64u, "\x40");
- EXPECT_READ_ULEB128_EQ(0x7fu, "\x7f");
- EXPECT_READ_ULEB128_EQ(0x80u, "\x80\x01");
- EXPECT_READ_ULEB128_EQ(0x81u, "\x81\x01");
- EXPECT_READ_ULEB128_EQ(0x90u, "\x90\x01");
- EXPECT_READ_ULEB128_EQ(0xffu, "\xff\x01");
- EXPECT_READ_ULEB128_EQ(0x100u, "\x80\x02");
- EXPECT_READ_ULEB128_EQ(0x101u, "\x81\x02");
- EXPECT_READ_ULEB128_EQ(8320u, "\x80\xc1\x80\x80\x10");
-
-#undef EXPECT_READ_ULEB128_EQ
-}
-
-TEST(LEB128Test, SizeUleb128) {
- // Testing Plan:
- // (1) 128 ^ n ............ need (n+1) bytes
- // (2) 128 ^ n * 64 ....... need (n+1) bytes
- // (3) 128 ^ (n+1) - 1 .... need (n+1) bytes
-
- EXPECT_EQ(1u, SizeUleb128(0)); // special case
-
- EXPECT_EQ(1u, SizeUleb128(0x1UL));
- EXPECT_EQ(1u, SizeUleb128(0x40UL));
- EXPECT_EQ(1u, SizeUleb128(0x7fUL));
-
- EXPECT_EQ(2u, SizeUleb128(0x80UL));
- EXPECT_EQ(2u, SizeUleb128(0x2000UL));
- EXPECT_EQ(2u, SizeUleb128(0x3fffUL));
-
- EXPECT_EQ(3u, SizeUleb128(0x4000UL));
- EXPECT_EQ(3u, SizeUleb128(0x100000UL));
- EXPECT_EQ(3u, SizeUleb128(0x1fffffUL));
-
- EXPECT_EQ(4u, SizeUleb128(0x200000UL));
- EXPECT_EQ(4u, SizeUleb128(0x8000000UL));
- EXPECT_EQ(4u, SizeUleb128(0xfffffffUL));
-
- EXPECT_EQ(5u, SizeUleb128(0x10000000UL));
- EXPECT_EQ(5u, SizeUleb128(0x40000000UL));
- EXPECT_EQ(5u, SizeUleb128(0x7fffffffUL));
-
- EXPECT_EQ(5u, SizeUleb128(UINT32_MAX));
-}
-
-} // namespace wpi
diff --git a/third_party/ntcore_2017/wpiutil/unittest/main.cpp b/third_party/ntcore_2017/wpiutil/unittest/main.cpp
deleted file mode 100644
index e380efd..0000000
--- a/third_party/ntcore_2017/wpiutil/unittest/main.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2015. 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. */
-/*----------------------------------------------------------------------------*/
-
-#include "gtest/gtest.h"
-
-int main(int argc, char **argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- int ret = RUN_ALL_TESTS();
- return ret;
-}
diff --git a/third_party/ntcore_2017/wpiutil/unittest/unittest.gradle b/third_party/ntcore_2017/wpiutil/unittest/unittest.gradle
deleted file mode 100644
index 89fc290..0000000
--- a/third_party/ntcore_2017/wpiutil/unittest/unittest.gradle
+++ /dev/null
@@ -1,39 +0,0 @@
-apply plugin: 'google-test'
-
-model {
- testSuites {
- wpiutilTest {
- sources {
- cpp {
- source {
- srcDirs = ["${rootDir}/wpiutil/unittest"]
- includes = ['**/*.cpp']
- }
- exportedHeaders {
- srcDirs = ["${rootDir}/wpiutil/include", "${rootDir}/gmock/include", "${rootDir}/gmock/gtest/include"]
- includes = ['**/*.h']
- }
- }
- }
- binaries.all {
- lib project: ':gmock', library: 'gmock', linkage: 'static'
- lib library: 'wpiutil', linkage: 'static'
- }
- }
- }
-}
-
-model {
- binaries {
- withType(GoogleTestTestSuiteBinarySpec) {
- lib project: ':gmock', library: "gmock", linkage: "static"
- lib library: 'wpiutil', linkage: 'static'
- if (targetPlatform.operatingSystem.windows) {
- cppCompiler.args '/EHsc', '/DNOMINMAX', '/D_SCL_SECURE_NO_WARNINGS', '/D_WINSOCK_DEPRECATED_NO_WARNINGS'
- } else {
- cppCompiler.args '-pthread', '-std=c++1y'
- linker.args '-pthread'
- }
- }
- }
-}