Major formatting changes (breaks diffs). No code changes.

The changes made in this commit do not affect any actual code,
    they are purely aesthetic. I ran clang-format with google style
    over all .h/.cpp files in wpilibc that weren't in wpilibC++Sim
    or gtest, and the eclipse formatter over all of the Java files
    using the Google eclipse formatting configuration.

Change-Id: I9627bca0bc103c398ecc1c5ba17467193291ae63
This commit is contained in:
James Kuszmaul
2015-06-25 15:07:55 -04:00
parent bd64d9a7ef
commit 7eb8550bdb
470 changed files with 89798 additions and 77287 deletions

View File

@@ -1,5 +1,6 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Copyright (c) FIRST 2008. All Rights Reserved.
*/
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
@@ -18,7 +19,7 @@ const uint32_t SensorBase::kPwmChannels;
const uint32_t SensorBase::kRelayChannels;
const uint32_t SensorBase::kPDPChannels;
const uint32_t SensorBase::kChassisSlots;
SensorBase *SensorBase::m_singletonList = NULL;
SensorBase* SensorBase::m_singletonList = NULL;
static bool portsInitialized = false;
void* SensorBase::m_digital_ports[kDigitalChannels];
@@ -28,41 +29,35 @@ void* SensorBase::m_pwm_ports[kPwmChannels];
/**
* Creates an instance of the sensor base and gets an FPGA handle
*/
SensorBase::SensorBase()
{
if(!portsInitialized) {
for (uint32_t i = 0; i < kDigitalChannels; i++)
{
void* port = getPort(i);
int32_t status = 0;
m_digital_ports[i] = initializeDigitalPort(port, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
}
SensorBase::SensorBase() {
if (!portsInitialized) {
for (uint32_t i = 0; i < kDigitalChannels; i++) {
void* port = getPort(i);
int32_t status = 0;
m_digital_ports[i] = initializeDigitalPort(port, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
}
for (uint32_t i = 0; i < kRelayChannels; i++)
{
void* port = getPort(i);
int32_t status = 0;
m_relay_ports[i] = initializeDigitalPort(port, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
}
for (uint32_t i = 0; i < kRelayChannels; i++) {
void* port = getPort(i);
int32_t status = 0;
m_relay_ports[i] = initializeDigitalPort(port, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
}
for (uint32_t i = 0; i < kPwmChannels; i++)
{
void* port = getPort(i);
int32_t status = 0;
m_pwm_ports[i] = initializeDigitalPort(port, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
}
}
for (uint32_t i = 0; i < kPwmChannels; i++) {
void* port = getPort(i);
int32_t status = 0;
m_pwm_ports[i] = initializeDigitalPort(port, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
}
}
}
/**
* Frees the resources for a SensorBase.
*/
SensorBase::~SensorBase()
{
}
SensorBase::~SensorBase() {}
/**
* Add sensor to the singleton list.
@@ -71,12 +66,12 @@ SensorBase::~SensorBase()
* that is they aren't allocated directly with new, but instead are allocated
* by the static GetInstance method. As a result, they are never deleted when
* the program exits. Consequently these sensors may still be holding onto
* resources and need to have their destructors called at the end of the program.
* resources and need to have their destructors called at the end of the
* program.
*/
void SensorBase::AddToSingletonList()
{
m_nextSingleton = m_singletonList;
m_singletonList = this;
void SensorBase::AddToSingletonList() {
m_nextSingleton = m_singletonList;
m_singletonList = this;
}
/**
@@ -84,15 +79,13 @@ void SensorBase::AddToSingletonList()
* All the classes that were allocated as singletons need to be deleted so
* their resources can be freed.
*/
void SensorBase::DeleteSingletons()
{
for (SensorBase *next = m_singletonList; next != NULL;)
{
SensorBase *tmp = next;
next = next->m_nextSingleton;
delete tmp;
}
m_singletonList = NULL;
void SensorBase::DeleteSingletons() {
for (SensorBase* next = m_singletonList; next != NULL;) {
SensorBase* tmp = next;
next = next->m_nextSingleton;
delete tmp;
}
m_singletonList = NULL;
}
/**
@@ -100,81 +93,74 @@ void SensorBase::DeleteSingletons()
*
* @return Solenoid module is valid and present
*/
bool SensorBase::CheckSolenoidModule(uint8_t moduleNumber)
{
if (moduleNumber < 64)
return true;
return false;
bool SensorBase::CheckSolenoidModule(uint8_t moduleNumber) {
if (moduleNumber < 64) 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
* 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(uint32_t channel)
{
if (channel < kDigitalChannels)
return true;
return false;
bool SensorBase::CheckDigitalChannel(uint32_t channel) {
if (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
* Verify that the channel number is one of the legal channel numbers. Channel
* numbers are
* 1-based.
*
* @return Relay channel is valid
*/
bool SensorBase::CheckRelayChannel(uint32_t channel)
{
if (channel < kRelayChannels)
return true;
return false;
bool SensorBase::CheckRelayChannel(uint32_t channel) {
if (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
* 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(uint32_t channel)
{
if (channel < kPwmChannels)
return true;
return false;
bool SensorBase::CheckPWMChannel(uint32_t channel) {
if (channel < kPwmChannels) return true;
return false;
}
/**
* Check that the analog input number is value.
* Verify that the analog input number is one of the legal channel numbers. Channel numbers
* 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::CheckAnalogInput(uint32_t channel)
{
if (channel < kAnalogInputs)
return true;
return false;
bool SensorBase::CheckAnalogInput(uint32_t channel) {
if (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
* 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::CheckAnalogOutput(uint32_t channel)
{
if (channel < kAnalogOutputs)
return true;
return false;
bool SensorBase::CheckAnalogOutput(uint32_t channel) {
if (channel < kAnalogOutputs) return true;
return false;
}
/**
@@ -182,11 +168,9 @@ bool SensorBase::CheckAnalogOutput(uint32_t channel)
*
* @return Solenoid channel is valid
*/
bool SensorBase::CheckSolenoidChannel(uint32_t channel)
{
if (channel < kSolenoidChannels)
return true;
return false;
bool SensorBase::CheckSolenoidChannel(uint32_t channel) {
if (channel < kSolenoidChannels) return true;
return false;
}
/**
@@ -194,9 +178,7 @@ bool SensorBase::CheckSolenoidChannel(uint32_t channel)
*
* @return PDP channel is valid
*/
bool SensorBase::CheckPDPChannel(uint32_t channel)
{
if (channel < kPDPChannels)
return true;
return false;
bool SensorBase::CheckPDPChannel(uint32_t channel) {
if (channel < kPDPChannels) return true;
return false;
}