Skip to content

Commit

Permalink
Use more auto
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Nov 7, 2023
1 parent f89c44e commit 7b6e966
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/systems/diff_drive/DiffDrive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void DiffDrive::Configure(const Entity &_entity,
}

// Get params from SDF
sdf::ElementConstPtr sdfElem = _sdf->FindElement("left_joint");
auto sdfElem = _sdf->FindElement("left_joint");
while (sdfElem)
{
this->dataPtr->leftJointNames.push_back(sdfElem->Get<std::string>());
Expand Down
2 changes: 1 addition & 1 deletion src/systems/joint_state_publisher/JointStatePublisher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void JointStatePublisher::Configure(
// specified joints. Otherwise, publish all the joints.
if (_sdf->HasElement("joint_name"))
{
sdf::ElementConstPtr elem = _sdf->FindElement("joint_name");
auto elem = _sdf->FindElement("joint_name");
while (elem)
{
std::string jointName = elem->Get<std::string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ std::vector<T> JointParameters::Parse(

if (_sdf->HasElement(_parameterName))
{
sdf::ElementConstPtr param = _sdf->FindElement(_parameterName);
auto param = _sdf->FindElement(_parameterName);
while (param)
{
output.push_back(param->Get<T>());
Expand Down
3 changes: 1 addition & 2 deletions src/systems/log/LogRecord.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,7 @@ bool LogRecordPrivate::Start(const std::string &_logPath,
// Get the topics to record, if any.
if (this->sdf->HasElement("record_topic"))
{
sdf::ElementConstPtr recordTopicElem =
this->sdf->FindElement("record_topic");
auto recordTopicElem = this->sdf->FindElement("record_topic");

// This is used to determine if a topic is a regular expression.
std::regex regexMatch(".*[\\*\\?\\[\\]\\(\\)\\.]+.*");
Expand Down
2 changes: 1 addition & 1 deletion src/systems/log_video_recorder/LogVideoRecorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void LogVideoRecorder::Configure(

if (_sdf->HasElement("region"))
{
sdf::ElementConstPtr regionElem = _sdf->FindElement("region");
auto regionElem = _sdf->FindElement("region");
while (regionElem)
{
auto min = regionElem->Get<math::Vector3d>("min");
Expand Down
2 changes: 1 addition & 1 deletion src/systems/mecanum_drive/MecanumDrive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ void MecanumDrive::Configure(const Entity &_entity,
}

// Get params from SDF
sdf::ElementConstPtr sdfElem = _sdf->FindElement("front_left_joint");
auto sdfElem = _sdf->FindElement("front_left_joint");
while (sdfElem)
{
this->dataPtr->frontLeftJointNames.push_back(sdfElem->Get<std::string>());
Expand Down
10 changes: 5 additions & 5 deletions src/systems/shader_param/ShaderParam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void ShaderParam::Configure(const Entity &_entity,
if (_sdf->HasElement("param"))
{
// loop and parse all shader params
sdf::ElementConstPtr paramElem = _sdf->FindElement("param");
auto paramElem = _sdf->FindElement("param");
while (paramElem)
{
if (!paramElem->HasElement("shader") ||
Expand All @@ -173,7 +173,7 @@ void ShaderParam::Configure(const Entity &_entity,

if (paramElem->HasElement("arg"))
{
sdf::ElementConstPtr argElem = paramElem->FindElement("arg");
auto argElem = paramElem->FindElement("arg");
while (argElem)
{
spv.args.push_back(argElem->Get<std::string>());
Expand Down Expand Up @@ -201,7 +201,7 @@ void ShaderParam::Configure(const Entity &_entity,
return;
}
// allow mulitple shader SDF element for different shader languages
sdf::ElementConstPtr shaderElem = _sdf->FindElement("shader");
auto shaderElem = _sdf->FindElement("shader");
while (shaderElem)
{
if (!shaderElem->HasElement("vertex") ||
Expand All @@ -220,11 +220,11 @@ void ShaderParam::Configure(const Entity &_entity,
ShaderParamPrivate::ShaderUri shader;
shader.language = api;

sdf::ElementConstPtr vertexElem = shaderElem->FindElement("vertex");
auto vertexElem = shaderElem->FindElement("vertex");
shader.vertexShaderUri = common::findFile(
asFullPath(vertexElem->Get<std::string>(),
this->dataPtr->modelPath));
sdf::ElementConstPtr fragmentElem = shaderElem->FindElement("fragment");
auto fragmentElem = shaderElem->FindElement("fragment");
shader.fragmentShaderUri = common::findFile(
asFullPath(fragmentElem->Get<std::string>(),
this->dataPtr->modelPath));
Expand Down
2 changes: 1 addition & 1 deletion src/systems/tracked_vehicle/TrackedVehicle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void TrackedVehicle::Configure(const Entity &_entity,
this->dataPtr->bodyLinkName = _sdf->Get<std::string>("body_link");

// Get params from SDF
sdf::ElementConstPtr sdfElem = _sdf->FindElement("left_track");
auto sdfElem = _sdf->FindElement("left_track");
while (sdfElem)
{
const auto& linkName = sdfElem->Get<std::string>("link");
Expand Down
2 changes: 1 addition & 1 deletion src/systems/velocity_control/VelocityControl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void VelocityControl::Configure(const Entity &_entity,
if (!_sdf->HasElement("link_name"))
return;

sdf::ElementConstPtr sdfElem = _sdf->FindElement("link_name");
auto sdfElem = _sdf->FindElement("link_name");
while (sdfElem)
{
this->dataPtr->linkNames.push_back(sdfElem->Get<std::string>());
Expand Down

0 comments on commit 7b6e966

Please sign in to comment.