Remove raw pointer deprecation warnings.

See discussion in 2016 beta forums for rationale.

Change-Id: I86a4c1bd61655f4895e2fe0e935f25dc8a89d830
This commit is contained in:
Peter Johnson
2015-12-10 21:54:31 -08:00
parent bafe4e56a7
commit c70e710caf
16 changed files with 4 additions and 114 deletions

View File

@@ -26,11 +26,6 @@ class AnalogAccelerometer : public SensorBase,
public LiveWindowSendable {
public:
explicit AnalogAccelerometer(int32_t channel);
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.")
explicit AnalogAccelerometer(AnalogInput *channel);
explicit AnalogAccelerometer(std::shared_ptr<AnalogInput> channel);
virtual ~AnalogAccelerometer() = default;

View File

@@ -37,9 +37,6 @@ class AnalogGyro : public GyroBase {
static constexpr float kDefaultVoltsPerDegreePerSecond = 0.007;
explicit AnalogGyro(int32_t channel);
DEPRECATED(
"Raw pointers are deprecated; consider calling the AnalogGyro constructor"
" with a channel number or passing a shared_ptr instead.")
explicit AnalogGyro(AnalogInput *channel);
explicit AnalogGyro(std::shared_ptr<AnalogInput> channel);
AnalogGyro(int32_t channel, uint32_t center, float offset);

View File

@@ -36,11 +36,6 @@ class AnalogPotentiometer : public Potentiometer, public LiveWindowSendable {
explicit AnalogPotentiometer(int channel, double fullRange = 1.0,
double offset = 0.0);
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.")
explicit AnalogPotentiometer(AnalogInput *input, double fullRange = 1.0,
double offset = 0.0);

View File

@@ -33,19 +33,11 @@ class Counter : public SensorBase,
public:
explicit Counter(Mode mode = kTwoPulse);
explicit Counter(int32_t channel);
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.")
explicit Counter(DigitalSource *source);
explicit Counter(std::shared_ptr<DigitalSource> source);
DEPRECATED(
"Raw pointers are deprecated. Use pass-by-reference instead.")
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.")
Counter(EncodingType encodingType, DigitalSource *upSource,
DigitalSource *downSource, bool inverted);
Counter(EncodingType encodingType, std::shared_ptr<DigitalSource> upSource,
@@ -53,32 +45,22 @@ class Counter : public SensorBase,
virtual ~Counter();
void SetUpSource(int32_t channel);
DEPRECATED(
"Raw pointers are deprecated; prefer to call either SetUpSource(int) or "
"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.")
void SetUpSource(DigitalSource *source);
void SetUpSource(std::shared_ptr<DigitalSource> source);
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(
"Raw pointers are deprecated; prefer to call either SetDownSource(int) "
"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.")
void SetDownSource(DigitalSource *source);
void SetDownSource(std::shared_ptr<DigitalSource> source);
DEPRECATED("References are deprecated. Use std::shared_ptr instead.")
void SetDownSource(DigitalSource &source);
void SetDownSourceEdge(bool risingEdge, bool fallingEdge);
void ClearDownSource();

View File

@@ -53,16 +53,8 @@ class Encoder : public SensorBase,
Encoder(std::shared_ptr<DigitalSource> aSource,
std::shared_ptr<DigitalSource> bSource,
bool reverseDirection = false, EncodingType encodingType = k4X);
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.")
Encoder(DigitalSource *aSource, DigitalSource *bSource,
bool reverseDirection = false, EncodingType encodingType = k4X);
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.")
Encoder(DigitalSource &aSource, DigitalSource &bSource,
bool reverseDirection = false, EncodingType encodingType = k4X);
virtual ~Encoder();
@@ -87,7 +79,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("Use pass-by-reference instead.")
void SetIndexSource(DigitalSource *source,
IndexingType type = kResetOnRisingEdge);
void SetIndexSource(const DigitalSource &source,

View File

@@ -44,16 +44,12 @@ 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.")
RobotDrive(SpeedController *leftMotor, SpeedController *rightMotor);
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.")
RobotDrive(SpeedController *frontLeftMotor, SpeedController *rearLeftMotor,
SpeedController *frontRightMotor, SpeedController *rearRightMotor);
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,9 @@ class Ultrasonic : public SensorBase,
public:
enum DistanceUnit { kInches = 0, kMilliMeters = 1 };
DEPRECATED(
"Raw pointers are deprecated; prefer either specifying the channel "
"numbers as integers or passing shared_ptrs.")
Ultrasonic(DigitalOutput *pingChannel, DigitalInput *echoChannel,
DistanceUnit units = kInches);
DEPRECATED(
"References are deprecated; prefer either specifying the channel numbers "
"as integers or passing shared_ptrs.")
Ultrasonic(DigitalOutput &pingChannel, DigitalInput &echoChannel,
DistanceUnit units = kInches);

View File

@@ -39,11 +39,6 @@ AnalogAccelerometer::AnalogAccelerometer(int32_t channel) {
* @param channel The existing AnalogInput object for the analog input the
* accelerometer is connected to
*/
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.")
AnalogAccelerometer::AnalogAccelerometer(AnalogInput *channel)
: m_analogInput(channel, NullDeleter<AnalogInput>()) {
if (channel == nullptr) {

View File

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

View File

@@ -25,11 +25,6 @@ AnalogPotentiometer::AnalogPotentiometer(int channel, double fullRange,
* @param offset The angular value (in desired units) representing the angular
* output at 0V.
*/
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.")
AnalogPotentiometer::AnalogPotentiometer(AnalogInput *input, double fullRange,
double offset)
: m_analog_input(input, NullDeleter<AnalogInput>()),

View File

@@ -46,10 +46,6 @@ Counter::Counter(Mode mode) {
* @param source A pointer to the existing DigitalSource object. It will be set
* as the Up Source.
*/
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.")
Counter::Counter(DigitalSource *source) : Counter(kTwoPulse) {
SetUpSource(source);
ClearDownSource();
@@ -93,8 +89,7 @@ Counter::Counter(int32_t channel) : Counter(kTwoPulse) {
* 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("Use pass-by-reference instead.")
Counter::Counter(AnalogTrigger *trigger) : Counter(kTwoPulse) {
SetUpSource(trigger->CreateOutput(kState));
ClearDownSource();
@@ -121,8 +116,6 @@ Counter::Counter(const AnalogTrigger &trigger) : Counter(kTwoPulse) {
* @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.")
Counter::Counter(EncodingType encodingType, DigitalSource *upSource,
DigitalSource *downSource, bool inverted)
: Counter(encodingType,
@@ -193,9 +186,6 @@ 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(
"Raw pointers are deprecated; prefer to call either SetUpSource(int) or "
"SetUpSource(shared_ptr).")
void Counter::SetUpSource(AnalogTrigger *analogTrigger,
AnalogTriggerType triggerType) {
SetUpSource(std::shared_ptr<AnalogTrigger>(analogTrigger,
@@ -232,7 +222,6 @@ void Counter::SetUpSource(std::shared_ptr<DigitalSource> source) {
}
}
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 +232,6 @@ 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.")
void Counter::SetUpSource(DigitalSource &source) {
SetUpSource(
std::shared_ptr<DigitalSource>(&source, NullDeleter<DigitalSource>()));
@@ -294,9 +282,6 @@ void Counter::SetDownSource(int32_t channel) {
* Source
* @param triggerType The analog trigger output that will trigger the counter.
*/
DEPRECATED(
"Raw pointers are deprecated; prefer to call either SetUpSource(int) or "
"SetUpSource(shared_ptr).")
void Counter::SetDownSource(AnalogTrigger *analogTrigger,
AnalogTriggerType triggerType) {
SetDownSource(std::shared_ptr<AnalogTrigger>(analogTrigger, NullDeleter<AnalogTrigger>()), triggerType);
@@ -332,7 +317,6 @@ void Counter::SetDownSource(std::shared_ptr<DigitalSource> source) {
}
}
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 +326,6 @@ 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.")
void Counter::SetDownSource(DigitalSource &source) {
SetDownSource(std::shared_ptr<DigitalSource>(&source, NullDeleter<DigitalSource>()));
}

View File

@@ -125,10 +125,6 @@ Encoder::Encoder(uint32_t aChannel, uint32_t bChannel, bool reverseDirection,
* match the spec'd count
* or be double (2x) the spec'd count.
*/
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.")
Encoder::Encoder(DigitalSource *aSource, DigitalSource *bSource,
bool reverseDirection, EncodingType encodingType)
: m_aSource(aSource, NullDeleter<DigitalSource>()),
@@ -174,10 +170,6 @@ Encoder::Encoder(std::shared_ptr<DigitalSource> aSource,
* match the spec'd count
* or be double (2x) the spec'd count.
*/
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.")
Encoder::Encoder(DigitalSource &aSource, DigitalSource &bSource,
bool reverseDirection, EncodingType encodingType)
: m_aSource(&aSource, NullDeleter<DigitalSource>()),
@@ -517,7 +509,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("Use pass-by-reference instead.")
void Encoder::SetIndexSource(DigitalSource *source,
Encoder::IndexingType type) {
SetIndexSource(*source, type);

View File

@@ -21,7 +21,6 @@
const int32_t RobotDrive::kMaxNumberOfMotors;
DEPRECATED("making shared pointer from raw pointer")
static auto make_shared_nodelete(SpeedController *ptr) {
return std::shared_ptr<SpeedController>(ptr, NullDeleter<SpeedController>());
}
@@ -98,7 +97,6 @@ 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.")
RobotDrive::RobotDrive(SpeedController *leftMotor,
SpeedController *rightMotor) {
InitRobotDrive();
@@ -112,7 +110,6 @@ RobotDrive::RobotDrive(SpeedController *leftMotor,
}
//TODO: Change to rvalue references & move syntax.
DEPRECATED("References are deprecated; use shared_ptr instead.")
RobotDrive::RobotDrive(SpeedController &leftMotor,
SpeedController &rightMotor) {
InitRobotDrive();
@@ -145,7 +142,6 @@ 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.")
RobotDrive::RobotDrive(SpeedController *frontLeftMotor,
SpeedController *rearLeftMotor,
SpeedController *frontRightMotor,
@@ -162,7 +158,6 @@ RobotDrive::RobotDrive(SpeedController *frontLeftMotor,
m_rearRightMotor = make_shared_nodelete(rearRightMotor);
}
DEPRECATED("References are deprecated; use shared_ptr instead.")
RobotDrive::RobotDrive(SpeedController &frontLeftMotor,
SpeedController &rearLeftMotor,
SpeedController &frontRightMotor,

View File

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

View File

@@ -54,11 +54,8 @@ ClassName(ClassName &&) = default
// 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
DEPRECATED("wrapping raw pointer in std::shared_ptr")
NullDeleter {
void operator()(T *) const noexcept {};
};

View File

@@ -32,18 +32,12 @@ class LiveWindow {
public:
static LiveWindow *GetInstance();
void Run();
DEPRECATED(
"Raw pointers are deprecated; pass the component using shared_ptr "
"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);
DEPRECATED(
"Raw pointers are deprecated; pass the component using shared_ptr "
"instead.")
void AddActuator(const std::string &subsystem, const std::string &name,
LiveWindowSendable *component);
void AddActuator(const std::string &subsystem, const std::string &name,
@@ -51,9 +45,6 @@ class LiveWindow {
void AddActuator(const std::string &subsystem, const std::string &name,
std::shared_ptr<LiveWindowSendable> component);
DEPRECATED(
"Raw pointers are deprecated; pass the component using shared_ptr "
"instead.")
void AddSensor(std::string type, int channel, LiveWindowSendable *component);
void AddActuator(std::string type, int channel,
LiveWindowSendable *component);