Commit Graph

7 Commits

Author SHA1 Message Date
Tyler Veness
e14e45da76 Add format script which invokes clang-format on the C++ source code (#41)
On Windows machines, clang-format.exe must be in the PATH environment variable.
2016-05-20 17:30:37 -07:00
Tyler Veness
3cd1253977 artf2612: Update license in source files.
Years update, references to WIND_BASE were removed, and WPILib license was
moved to the root directory of the project.

If there was already a comment block, a year range through 2016 was created
using the first year in the comment. If there was no comment block, a block
with just the year 2016 was added.

Comments were not added to files from external sources (NI, CTRE).

Change-Id: Iff4f098ab908b90b8d929902dea903de2f596acc
2016-01-05 00:35:05 -08:00
Tyler Veness
c0ecde302f Replaced instances of std::unique_lock with std::lock_guard where possible
If a lock is used with a mutex that doesn't need to be unlocked again before the lock is destroyed, std::lock_guard can be more efficient than std::unique_lock due to less overhead.

This commit also removes a redundant set of curly braces in PIDController.cpp intended to constrain a lock's scope.

Change-Id: Idd692ce439528ddb319a4c62c40c7351a664eb97
2015-10-04 13:20:11 -07:00
James Kuszmaul
534ea134a4 artf4154: Get rid of raw pointers in C++.
This deals with the majority of the user-facing code
in wpilibC++Devices and a substantial portion of it in
wpilibC++. wpilibC++Sim and wpilibC++IntegrationTests
are untouched except where it is necessary to make them
work with the rest of the libraries.

There is still a lot to do in the following areas:
-The HAL (which we may not want to touch at all).
-The I2C, Serial, and SPI interfaces in wpilibC++Devices,
  which I haven't gotten around to doing yet.
-Most wpilibC++Devices classes have void* pointers
  for interacting with the HAL.
-InterruptableSensorBase passes a void *params for
  the interrupt handler.
-I haven't converted all the const char* to std::strings.
-There are plenty of other cases of raw pointers still
  existing.
-This doesn't fall directly under raw pointer stuff,
  but move syntax and rvalue references could be introduced
  in many places.
-I haven't touched vision code.
-The Resource classes conflict (one is in the hal, the other
  in wpilibC++). Someone should figure out a more
  permanent fix (eg, just renaming them), then doing
  what I did (making a new namespace for one of them,
  essentially the same as renaming it).

A few other things:
-I created a NullDeleter class which is marked as deprecated.
  What this does is it can be passed as the deleter to a
  std::shared_ptr so that when you are converting raw pointers
  to shared_ptrs the shared_ptr doesn't do any deletion if
  someone else owns the raw pointer. This should only be
  used in making old raw pointer UIs.
-I had to alter the build.gradle so that it did not
  emit errors when deprecated functions called deprecated
  functions. Unfortunately, gradle doesn't appear to be
  actually printing out gcc warnigns for some reason.
  The best way I have found to fix this is to patch
  the toolchains (https://bitbucket.org/byteit101/toolchain-builder/pull-request/5/make-gcc-not-throw-warnings-for-nested/diff)
  so that a deprecated function calling a deprecated
  function is fine but a non-deprecated function calling
  a deprecated function will throw a warning (which we
  then elevate with -Werror). I believe that clang
  deals with this properly, although I have not
  tried it myself.

Change-Id: Ib8090c66893576fe73654f4e9d268f9d37be06a2
2015-07-20 13:18:29 -04:00
Tyler Veness
3f59f3472a artf4156: Replaced synchronization primitives with C++11 equivalents
Change-Id: I90da739347e875efda2a29dd5484b6dda3cd4753
2015-07-20 10:06:08 -04:00
Patrick Plenefisch
9b831ed34c Reverting back to static .a files for C++ and fixing lots of other assorted items 2014-05-27 21:26:10 -04:00
Brad Miller
69d9ad70ab CMake Changes
This is the changes made by Patrick Plenefisch converting the native
code to use CMake and the CMake Maven Plugin, as opposed to the
native Maven plugin. This is to allow for compatibility with newer
versions of the GCC toolchain. All the cpp sources were moved from
maven style directories to cpp style directories for CMake.

Change-Id: I67f5e3608948f37c83b0990d232105a3784f8593
2014-04-01 11:18:29 -04:00