WPILibC++  unspecified
Utility.h File Reference

Contains global utility functions. More...

#include <stdint.h>
#include <string>
#include <llvm/StringRef.h>
Include dependency graph for Utility.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define wpi_assert(condition)   wpi_assert_impl(condition, #condition, "", __FILE__, __LINE__, __FUNCTION__)
 
#define wpi_assertWithMessage(condition, message)
 
#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)
 

Functions

bool wpi_assert_impl (bool conditionValue, llvm::StringRef conditionText, llvm::StringRef message, llvm::StringRef fileName, int lineNumber, llvm::StringRef funcName)
 Assert implementation. More...
 
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)
 Assert equal implementation. More...
 
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)
 Assert not equal implementation. More...
 
void wpi_suspendOnAssertEnabled (bool enabled)
 
int frc::GetFPGAVersion ()
 Return the FPGA Version number. More...
 
int64_t frc::GetFPGARevision ()
 Return the FPGA Revision number. More...
 
uint64_t frc::GetFPGATime ()
 Read the microsecond-resolution timer on the FPGA. More...
 
bool frc::GetUserButton ()
 Get the state of the "USER" button on the roboRIO. More...
 
std::string frc::GetStackTrace (int offset)
 Get a stack trace, ignoring the first "offset" symbols. More...
 

Detailed Description

Contains global utility functions.

Macro Definition Documentation

#define wpi_assertNotEqualWithMessage (   a,
  b,
  message 
)
Value:
wpi_assertNotEqual_impl(a, b, #a, #b, message, __FILE__, __LINE__, \
__FUNCTION__)
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)
Assert not equal implementation.
Definition: Utility.cpp:158
#define wpi_assertWithMessage (   condition,
  message 
)
Value:
wpi_assert_impl(condition, #condition, message, __FILE__, __LINE__, \
__FUNCTION__)
bool wpi_assert_impl(bool conditionValue, llvm::StringRef conditionText, llvm::StringRef message, llvm::StringRef fileName, int lineNumber, llvm::StringRef funcName)
Assert implementation.
Definition: Utility.cpp:33

Function Documentation

int64_t frc::GetFPGARevision ( )

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.

Returns
FPGA Revision number.
uint64_t frc::GetFPGATime ( )

Read the microsecond-resolution timer on the FPGA.

Returns
The current time in microseconds according to the FPGA (since FPGA reset).
int frc::GetFPGAVersion ( )

Return the FPGA Version number.

For now, expect this to be competition year.

Returns
FPGA Version number.
std::string frc::GetStackTrace ( int  offset)

Get a stack trace, ignoring the first "offset" symbols.

Parameters
offsetThe number of symbols at the top of the stack to ignore
bool frc::GetUserButton ( )

Get the state of the "USER" button on the roboRIO.

Returns
True if the button is currently pressed down
bool wpi_assert_impl ( bool  conditionValue,
llvm::StringRef  conditionText,
llvm::StringRef  message,
llvm::StringRef  fileName,
int  lineNumber,
llvm::StringRef  funcName 
)

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_assertEqual_impl ( int  valueA,
int  valueB,
llvm::StringRef  valueAString,
llvm::StringRef  valueBString,
llvm::StringRef  message,
llvm::StringRef  fileName,
int  lineNumber,
llvm::StringRef  funcName 
)

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_assertNotEqual_impl ( int  valueA,
int  valueB,
llvm::StringRef  valueAString,
llvm::StringRef  valueBString,
llvm::StringRef  message,
llvm::StringRef  fileName,
int  lineNumber,
llvm::StringRef  funcName 
)

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.