Provide DEPRECATED macro as portable version of [[deprecated]].

The [[deprecated]] attribute is a C++14 feature not supported by MSVC or
GCC < 4.9, but can be simulated on both of these compilers through the
use of alternative (compiler-specific) attribute methods.

Change-Id: I34aed5705db2407c592f7cabd5274358c48d34fe
This commit is contained in:
Peter Johnson
2015-09-23 23:44:54 -07:00
committed by Brad Miller (WPI)
parent ef3fa53fc3
commit f64b055499
17 changed files with 92 additions and 92 deletions

View File

@@ -26,17 +26,29 @@ ClassName(ClassName &&) = default
#define noexcept throw()
#endif
// [[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.
#if defined(_MSC_VER)
#define DEPRECATED(msg) __declspec(deprecated(msg))
#elif defined(__GNUC__)
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)
#define DEPRECATED(msg) [[deprecated(msg)]]
#else
#define DEPRECATED(msg) __attribute__((deprecated(msg)))
#endif
#elif __cplusplus > 201103L
#define DEPRECATED(msg) [[deprecated(msg)]]
#else
#define DEPRECATED(msg) /*nothing*/
#endif
// A struct to use as a deleter when a std::shared_ptr must wrap a raw pointer
// that is being deleted by someone else.
// This should only be called in deprecated functions; using it anywhere else
// will throw warnings.
template<class T>
struct
#if !defined(_MSC_VER)
[[deprecated]]
#else
__declspec(deprecated)
#endif
DEPRECATED("wrapping raw pointer in std::shared_ptr")
NullDeleter {
void operator()(T *) const noexcept {};
};

View File

@@ -32,26 +32,18 @@ class LiveWindow {
public:
static LiveWindow *GetInstance();
void Run();
#if !defined(_MSC_VER)
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; pass the component using shared_ptr "
"instead.")]]
#else
__declspec(deprecated("**Raw pointers are deprecated; pass the component using shared_ptr instead**"))
#endif
"instead.")
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);
#if !defined(_MSC_VER)
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; pass the component using shared_ptr "
"instead.")]]
#else
__declspec(deprecated("**Raw pointers are deprecated; pass the component using shared_ptr instead**"))
#endif
"instead.")
void AddActuator(const std::string &subsystem, const std::string &name,
LiveWindowSendable *component);
void AddActuator(const std::string &subsystem, const std::string &name,
@@ -59,13 +51,9 @@ class LiveWindow {
void AddActuator(const std::string &subsystem, const std::string &name,
std::shared_ptr<LiveWindowSendable> component);
#if !defined(_MSC_VER)
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; pass the component using shared_ptr "
"instead.")]]
#else
__declspec(deprecated("**Raw pointers are deprecated; pass the component using shared_ptr instead**"))
#endif
"instead.")
void AddSensor(std::string type, int channel, LiveWindowSendable *component);
void AddActuator(std::string type, int channel,
LiveWindowSendable *component);

View File

@@ -26,11 +26,11 @@ class AnalogAccelerometer : public SensorBase,
public LiveWindowSendable {
public:
explicit AnalogAccelerometer(int32_t channel);
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; if you just want to construct an "
"AnalogAccelerometer with its own AnalogInput, then call the "
"AnalogAccelerometer(int channel). If you want to keep your own copy of "
"the AnalogInput, use std::shared_ptr.")]]
"the AnalogInput, use std::shared_ptr.")
explicit AnalogAccelerometer(AnalogInput *channel);
explicit AnalogAccelerometer(std::shared_ptr<AnalogInput> channel);
virtual ~AnalogAccelerometer() = default;

View File

@@ -36,11 +36,11 @@ class AnalogPotentiometer : public Potentiometer, public LiveWindowSendable {
explicit AnalogPotentiometer(int channel, double fullRange = 1.0,
double offset = 0.0);
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; if you just want to construct an "
"AnalogPotentiometer with its own AnalogInput, then call the "
"AnalogPotentiometer(int channel). If you want to keep your own copy of "
"the AnalogInput, use std::shared_ptr.")]]
"the AnalogInput, use std::shared_ptr.")
explicit AnalogPotentiometer(AnalogInput *input, double fullRange = 1.0,
double offset = 0.0);

View File

@@ -31,19 +31,19 @@ class Counter : public SensorBase,
public:
explicit Counter(Mode mode = kTwoPulse);
explicit Counter(int32_t channel);
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; if you just want to construct a Counter "
"with its own DigitalSource, then call the Counter(int channel). If you "
"want to keep your own copy of the DigitalSource, use "
"std::shared_ptr.")]]
"std::shared_ptr.")
explicit Counter(DigitalSource *source);
explicit Counter(std::shared_ptr<DigitalSource> source);
[[deprecated(
"Raw pointers are deprecated. Use pass-by-reference instead.")]]
DEPRECATED(
"Raw pointers are deprecated. Use pass-by-reference instead.")
explicit Counter(AnalogTrigger *trigger);
explicit Counter(const AnalogTrigger &trigger);
[[deprecated(
"Raw pointers are deprecated; prefer to use shared_ptr instead.")]]
DEPRECATED(
"Raw pointers are deprecated; prefer to use shared_ptr instead.")
Counter(EncodingType encodingType, DigitalSource *upSource,
DigitalSource *downSource, bool inverted);
Counter(EncodingType encodingType, std::shared_ptr<DigitalSource> upSource,
@@ -51,32 +51,32 @@ class Counter : public SensorBase,
virtual ~Counter();
void SetUpSource(int32_t channel);
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; prefer to call either SetUpSource(int) or "
"SetUpSource(shared_ptr).")]]
"SetUpSource(shared_ptr).")
void SetUpSource(AnalogTrigger *analogTrigger, AnalogTriggerType triggerType);
void SetUpSource(std::shared_ptr<AnalogTrigger> analogTrigger,
AnalogTriggerType triggerType);
[[deprecated("Raw pointers are deprecated. Use std::shared_ptr instead.")]]
DEPRECATED("Raw pointers are deprecated. Use std::shared_ptr instead.")
void SetUpSource(DigitalSource *source);
void SetUpSource(std::shared_ptr<DigitalSource> source);
[[deprecated("References are deprecated. Use std::shared_ptr instead.")]]
DEPRECATED("References are deprecated. Use std::shared_ptr instead.")
void SetUpSource(DigitalSource &source);
void SetUpSourceEdge(bool risingEdge, bool fallingEdge);
void ClearUpSource();
void SetDownSource(int32_t channel);
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; prefer to call either SetDownSource(int) "
"or SetDownSource(shared_ptr).")]]
"or SetDownSource(shared_ptr).")
void SetDownSource(AnalogTrigger *analogTrigger,
AnalogTriggerType triggerType);
void SetDownSource(std::shared_ptr<AnalogTrigger> analogTrigger,
AnalogTriggerType triggerType);
[[deprecated("Raw pointers are deprecated. Use std::shared_ptr instead.")]]
DEPRECATED("Raw pointers are deprecated. Use std::shared_ptr instead.")
void SetDownSource(DigitalSource *source);
void SetDownSource(std::shared_ptr<DigitalSource> source);
[[deprecated("References are deprecated. Use std::shared_ptr instead.")]]
DEPRECATED("References are deprecated. Use std::shared_ptr instead.")
void SetDownSource(DigitalSource &source);
void SetDownSourceEdge(bool risingEdge, bool fallingEdge);
void ClearDownSource();

View File

@@ -52,16 +52,16 @@ class Encoder : public SensorBase,
Encoder(std::shared_ptr<DigitalSource> aSource,
std::shared_ptr<DigitalSource> bSource,
bool reverseDirection = false, EncodingType encodingType = k4X);
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; if you wish to construct your own copy of "
"the DigitalSource and pass it to the constructor, use an "
"std::shared_ptr instead.")]]
"std::shared_ptr instead.")
Encoder(DigitalSource *aSource, DigitalSource *bSource,
bool reverseDirection = false, EncodingType encodingType = k4X);
[[deprecated(
DEPRECATED(
"References are deprecated; if you wish to construct your own copy of "
"the DigitalSource and pass it to the constructor, use an "
"std::shared_ptr instead.")]]
"std::shared_ptr instead.")
Encoder(DigitalSource &aSource, DigitalSource &bSource,
bool reverseDirection = false, EncodingType encodingType = k4X);
virtual ~Encoder();
@@ -86,7 +86,7 @@ class Encoder : public SensorBase,
double PIDGet() override;
void SetIndexSource(uint32_t channel, IndexingType type = kResetOnRisingEdge);
[[deprecated("Raw pointers are deprecated; use references instead.")]]
DEPRECATED("Raw pointers are deprecated; use references instead.")
void SetIndexSource(DigitalSource *source,
IndexingType type = kResetOnRisingEdge);
void SetIndexSource(const DigitalSource &source,

View File

@@ -39,9 +39,9 @@ class Gyro : public SensorBase, public PIDSource, public LiveWindowSendable {
static constexpr float kDefaultVoltsPerDegreePerSecond = 0.007;
explicit Gyro(int32_t channel);
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; consider calling the Gyro constructor with "
"a channel number or passing a shared_ptr instead.")]]
"a channel number or passing a shared_ptr instead.")
explicit Gyro(AnalogInput *channel);
explicit Gyro(std::shared_ptr<AnalogInput> channel);
virtual ~Gyro() = default;

View File

@@ -48,8 +48,8 @@ class Preferences : public ErrorBase {
void PutFloat(llvm::StringRef key, float value);
void PutBoolean(llvm::StringRef key, bool value);
void PutLong(llvm::StringRef key, int64_t value);
[[deprecated(
"Saving is now automatically performed by the NetworkTables server.")]]
DEPRECATED(
"Saving is now automatically performed by the NetworkTables server.")
void Save();
bool ContainsKey(llvm::StringRef key);
void Remove(llvm::StringRef key);

View File

@@ -44,16 +44,16 @@ class RobotDrive : public MotorSafety, public ErrorBase {
RobotDrive(uint32_t leftMotorChannel, uint32_t rightMotorChannel);
RobotDrive(uint32_t frontLeftMotorChannel, uint32_t rearLeftMotorChannel,
uint32_t frontRightMotorChannel, uint32_t rearRightMotorChannel);
[[deprecated("Raw pointers are deprecated; use shared_ptr instead.")]]
DEPRECATED("Raw pointers are deprecated; use shared_ptr instead.")
RobotDrive(SpeedController *leftMotor, SpeedController *rightMotor);
[[deprecated("References are deprecated; use shared_ptr instead.")]]
DEPRECATED("References are deprecated; use shared_ptr instead.")
RobotDrive(SpeedController &leftMotor, SpeedController &rightMotor);
RobotDrive(std::shared_ptr<SpeedController> leftMotor,
std::shared_ptr<SpeedController> rightMotor);
[[deprecated("Raw pointers are deprecated; use shared_ptr instead.")]]
DEPRECATED("Raw pointers are deprecated; use shared_ptr instead.")
RobotDrive(SpeedController *frontLeftMotor, SpeedController *rearLeftMotor,
SpeedController *frontRightMotor, SpeedController *rearRightMotor);
[[deprecated("References are deprecated; use shared_ptr instead.")]]
DEPRECATED("References are deprecated; use shared_ptr instead.")
RobotDrive(SpeedController &frontLeftMotor, SpeedController &rearLeftMotor,
SpeedController &frontRightMotor, SpeedController &rearRightMotor);
RobotDrive(std::shared_ptr<SpeedController> frontLeftMotor,

View File

@@ -42,15 +42,15 @@ class Ultrasonic : public SensorBase,
public:
enum DistanceUnit { kInches = 0, kMilliMeters = 1 };
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; prefer either specifying the channel "
"numbers as integers or passing shared_ptrs.")]]
"numbers as integers or passing shared_ptrs.")
Ultrasonic(DigitalOutput *pingChannel, DigitalInput *echoChannel,
DistanceUnit units = kInches);
[[deprecated(
DEPRECATED(
"References are deprecated; prefer either specifying the channel numbers "
"as integers or passing shared_ptrs.")]]
"as integers or passing shared_ptrs.")
Ultrasonic(DigitalOutput &pingChannel, DigitalInput &echoChannel,
DistanceUnit units = kInches);

View File

@@ -39,11 +39,11 @@ AnalogAccelerometer::AnalogAccelerometer(int32_t channel) {
* @param channel The existing AnalogInput object for the analog input the
* accelerometer is connected to
*/
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; if you just want to construct an "
"AnalogAccelerometer with its own AnalogInput, then call the "
"AnalogAccelerometer(int channel). If you want to keep your own copy of "
"the AnalogInput, use std::shared_ptr.")]]
"the AnalogInput, use std::shared_ptr.")
AnalogAccelerometer::AnalogAccelerometer(AnalogInput *channel)
: m_analogInput(channel, NullDeleter<AnalogInput>()) {
if (channel == nullptr) {

View File

@@ -25,11 +25,11 @@ AnalogPotentiometer::AnalogPotentiometer(int channel, double fullRange,
* @param offset The angular value (in desired units) representing the angular
* output at 0V.
*/
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; if you just want to construct an "
"AnalogPotentiometer with its own AnalogInput, then call the "
"AnalogPotentiometer(int channel). If you want to keep your own copy of "
"the AnalogInput, use std::shared_ptr.")]]
"the AnalogInput, use std::shared_ptr.")
AnalogPotentiometer::AnalogPotentiometer(AnalogInput *input, double fullRange,
double offset)
: m_analog_input(input, NullDeleter<AnalogInput>()),

View File

@@ -46,10 +46,10 @@ Counter::Counter(Mode mode) {
* @param source A pointer to the existing DigitalSource object. It will be set
* as the Up Source.
*/
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; if you just want to construct a Counter with "
"its own DigitalSource, then call the Counter(int channel). If you want to "
"keep your own copy of the DigitalSource, use std::shared_ptr.")]]
"keep your own copy of the DigitalSource, use std::shared_ptr.")
Counter::Counter(DigitalSource *source) : Counter() {
SetUpSource(source);
ClearDownSource();
@@ -93,8 +93,8 @@ Counter::Counter(int32_t channel) : Counter() {
* The counter will start counting immediately.
* @param trigger The pointer to the existing AnalogTrigger object.
*/
[[deprecated(
"Raw pointers are deprecated. Use pass-by-reference instead.")]]
DEPRECATED(
"Raw pointers are deprecated. Use pass-by-reference instead.")
Counter::Counter(AnalogTrigger *trigger) : Counter() {
SetUpSource(trigger->CreateOutput(kState));
ClearDownSource();
@@ -121,8 +121,8 @@ Counter::Counter(const AnalogTrigger &trigger) : Counter() {
* @param downSource The pointer to the DigitalSource to set as the down source
* @param inverted True to invert the output (reverse the direction)
*/
[[deprecated(
"Raw pointers are deprecated; prefer to use shared_ptr instead.")]]
DEPRECATED(
"Raw pointers are deprecated; prefer to use shared_ptr instead.")
Counter::Counter(EncodingType encodingType, DigitalSource *upSource,
DigitalSource *downSource, bool inverted)
: Counter(encodingType,
@@ -193,9 +193,9 @@ void Counter::SetUpSource(int32_t channel) {
* @param analogTrigger The analog trigger object that is used for the Up Source
* @param triggerType The analog trigger output that will trigger the counter.
*/
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; prefer to call either SetUpSource(int) or "
"SetUpSource(shared_ptr).")]]
"SetUpSource(shared_ptr).")
void Counter::SetUpSource(AnalogTrigger *analogTrigger,
AnalogTriggerType triggerType) {
SetUpSource(std::shared_ptr<AnalogTrigger>(analogTrigger,
@@ -232,7 +232,7 @@ void Counter::SetUpSource(std::shared_ptr<DigitalSource> source) {
}
}
[[deprecated("Raw pointers are deprecated. Use std::shared_ptr instead.")]]
DEPRECATED("Raw pointers are deprecated. Use std::shared_ptr instead.")
void Counter::SetUpSource(DigitalSource *source) {
SetUpSource(
std::shared_ptr<DigitalSource>(source, NullDeleter<DigitalSource>()));
@@ -243,7 +243,7 @@ void Counter::SetUpSource(DigitalSource *source) {
* Set the up counting DigitalSource.
* @param source Reference to the DigitalSource object to set as the up source
*/
[[deprecated("References are deprecated. Use std::shared_ptr instead.")]]
DEPRECATED("References are deprecated. Use std::shared_ptr instead.")
void Counter::SetUpSource(DigitalSource &source) {
SetUpSource(
std::shared_ptr<DigitalSource>(&source, NullDeleter<DigitalSource>()));
@@ -294,9 +294,9 @@ void Counter::SetDownSource(int32_t channel) {
* Source
* @param triggerType The analog trigger output that will trigger the counter.
*/
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; prefer to call either SetUpSource(int) or "
"SetUpSource(shared_ptr).")]]
"SetUpSource(shared_ptr).")
void Counter::SetDownSource(AnalogTrigger *analogTrigger,
AnalogTriggerType triggerType) {
SetDownSource(std::shared_ptr<AnalogTrigger>(analogTrigger, NullDeleter<AnalogTrigger>()), triggerType);
@@ -332,7 +332,7 @@ void Counter::SetDownSource(std::shared_ptr<DigitalSource> source) {
}
}
[[deprecated("Raw pointers are deprecated. Use std::shared_ptr instead.")]]
DEPRECATED("Raw pointers are deprecated. Use std::shared_ptr instead.")
void Counter::SetDownSource(DigitalSource *source) {
SetDownSource(std::shared_ptr<DigitalSource>(source, NullDeleter<DigitalSource>()));
}
@@ -342,7 +342,7 @@ void Counter::SetDownSource(DigitalSource *source) {
* Set the down counting DigitalSource.
* @param source Reference to the DigitalSource object to set as the down source
*/
[[deprecated("References are deprecated. Use std::shared_ptr instead.")]]
DEPRECATED("References are deprecated. Use std::shared_ptr instead.")
void Counter::SetDownSource(DigitalSource &source) {
SetDownSource(std::shared_ptr<DigitalSource>(&source, NullDeleter<DigitalSource>()));
}

View File

@@ -125,10 +125,10 @@ Encoder::Encoder(uint32_t aChannel, uint32_t bChannel, bool reverseDirection,
* match the spec'd count
* or be double (2x) the spec'd count.
*/
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; if you wish to construct your own copy of "
"the DigitalSource and pass it to the constructor, use an std::shared_ptr "
"instead.")]]
"instead.")
Encoder::Encoder(DigitalSource *aSource, DigitalSource *bSource,
bool reverseDirection, EncodingType encodingType)
: m_aSource(aSource, NullDeleter<DigitalSource>()),
@@ -174,10 +174,10 @@ Encoder::Encoder(std::shared_ptr<DigitalSource> aSource,
* match the spec'd count
* or be double (2x) the spec'd count.
*/
[[deprecated(
DEPRECATED(
"References are deprecated; if you wish to construct your own copy of "
"the DigitalSource and pass it to the constructor, use an std::shared_ptr "
"instead.")]]
"instead.")
Encoder::Encoder(DigitalSource &aSource, DigitalSource &bSource,
bool reverseDirection, EncodingType encodingType)
: m_aSource(&aSource, NullDeleter<DigitalSource>()),
@@ -517,7 +517,7 @@ void Encoder::SetIndexSource(uint32_t channel, Encoder::IndexingType type) {
* @param channel A digital source to set as the encoder index
* @param type The state that will cause the encoder to reset
*/
[[deprecated("Raw pointers are dperecated; use references instead.")]]
DEPRECATED("Raw pointers are dperecated; use references instead.")
void Encoder::SetIndexSource(DigitalSource *source,
Encoder::IndexingType type) {
SetIndexSource(*source, type);

View File

@@ -88,9 +88,9 @@ Gyro::Gyro(int32_t channel) {
* @param channel A pointer to the AnalogInput object that the gyro is connected
* to.
*/
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; consider calling the Gyro constructor with "
"a channel number or passing a shared_ptr instead.")]]
"a channel number or passing a shared_ptr instead.")
Gyro::Gyro(AnalogInput *channel)
: Gyro(std::shared_ptr<AnalogInput>(channel,
NullDeleter<AnalogInput>())) {}

View File

@@ -21,7 +21,7 @@
const int32_t RobotDrive::kMaxNumberOfMotors;
[[deprecated]]
DEPRECATED("making shared pointer from raw pointer")
static auto make_shared_nodelete(SpeedController *ptr) {
return std::shared_ptr<SpeedController>(ptr, NullDeleter<SpeedController>());
}
@@ -98,7 +98,7 @@ RobotDrive::RobotDrive(uint32_t frontLeftMotor, uint32_t rearLeftMotor,
* @param leftMotor The left SpeedController object used to drive the robot.
* @param rightMotor the right SpeedController object used to drive the robot.
*/
[[deprecated("Raw pointers are deprecated; use shared_ptr instead.")]]
DEPRECATED("Raw pointers are deprecated; use shared_ptr instead.")
RobotDrive::RobotDrive(SpeedController *leftMotor,
SpeedController *rightMotor) {
InitRobotDrive();
@@ -112,7 +112,7 @@ RobotDrive::RobotDrive(SpeedController *leftMotor,
}
//TODO: Change to rvalue references & move syntax.
[[deprecated("References are deprecated; use shared_ptr instead.")]]
DEPRECATED("References are deprecated; use shared_ptr instead.")
RobotDrive::RobotDrive(SpeedController &leftMotor,
SpeedController &rightMotor) {
InitRobotDrive();
@@ -145,7 +145,7 @@ RobotDrive::RobotDrive(std::shared_ptr<SpeedController> leftMotor,
* @param frontRightMotor The front right SpeedController object used to drive
* the robot.
*/
[[deprecated("Raw pointers are deprecated; use shared_ptr instead.")]]
DEPRECATED("Raw pointers are deprecated; use shared_ptr instead.")
RobotDrive::RobotDrive(SpeedController *frontLeftMotor,
SpeedController *rearLeftMotor,
SpeedController *frontRightMotor,
@@ -162,7 +162,7 @@ RobotDrive::RobotDrive(SpeedController *frontLeftMotor,
m_rearRightMotor = make_shared_nodelete(rearRightMotor);
}
[[deprecated("References are deprecated; use shared_ptr instead.")]]
DEPRECATED("References are deprecated; use shared_ptr instead.")
RobotDrive::RobotDrive(SpeedController &frontLeftMotor,
SpeedController &rearLeftMotor,
SpeedController &frontRightMotor,

View File

@@ -116,9 +116,9 @@ Ultrasonic::Ultrasonic(uint32_t pingChannel, uint32_t echoChannel,
* determine the range.
* @param units The units returned in either kInches or kMilliMeters
*/
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; prefer either specifying the channel numbers "
"as integers or passing shared_ptrs.")]]
"as integers or passing shared_ptrs.")
Ultrasonic::Ultrasonic(DigitalOutput *pingChannel, DigitalInput *echoChannel,
DistanceUnit units)
: m_pingChannel(pingChannel, NullDeleter<DigitalOutput>()),
@@ -142,9 +142,9 @@ Ultrasonic::Ultrasonic(DigitalOutput *pingChannel, DigitalInput *echoChannel,
* determine the range.
* @param units The units returned in either kInches or kMilliMeters
*/
[[deprecated(
DEPRECATED(
"References are deprecated; prefer either specifying the channel numbers "
"as integers or passing shared_ptrs.")]]
"as integers or passing shared_ptrs.")
Ultrasonic::Ultrasonic(DigitalOutput &pingChannel, DigitalInput &echoChannel,
DistanceUnit units)
: m_pingChannel(&pingChannel, NullDeleter<DigitalOutput>()),