Add format script which invokes clang-format on the C++ source code (#41)

On Windows machines, clang-format.exe must be in the PATH environment variable.
This commit is contained in:
Tyler Veness
2016-05-20 17:30:37 -07:00
committed by Peter Johnson
parent 68690643d2
commit e14e45da76
383 changed files with 13787 additions and 13198 deletions

View File

@@ -20,13 +20,14 @@ void Clock::Load(physics::ModelPtr model, sdf::ElementPtr sdf) {
if (sdf->HasElement("topic")) {
topic = sdf->Get<std::string>("topic");
} else {
topic = "~/"+sdf->GetAttribute("name")->GetAsString();
topic = "~/" + sdf->GetAttribute("name")->GetAsString();
}
gzmsg << "Initializing clock: " << topic << std::endl;
// Connect to Gazebo transport for messaging
std::string scoped_name = model->GetWorld()->GetName()+"::"+model->GetScopedName();
std::string scoped_name =
model->GetWorld()->GetName() + "::" + model->GetScopedName();
boost::replace_all(scoped_name, "::", "/");
node = transport::NodePtr(new transport::Node());
node->Init(scoped_name);
@@ -34,10 +35,11 @@ void Clock::Load(physics::ModelPtr model, sdf::ElementPtr sdf) {
// Connect to the world update event.
// This will trigger the Update function every Gazebo iteration
updateConn = event::Events::ConnectWorldUpdateBegin(boost::bind(&Clock::Update, this, _1));
updateConn = event::Events::ConnectWorldUpdateBegin(
boost::bind(&Clock::Update, this, _1));
}
void Clock::Update(const common::UpdateInfo &info) {
void Clock::Update(const common::UpdateInfo& info) {
msgs::Float64 msg;
msg.set_data(info.simTime.Double());
pub->Publish(msg);

View File

@@ -7,13 +7,11 @@
#pragma once
#include "simulation/gz_msgs/msgs.h"
#include <gazebo/gazebo.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/transport.hh>
#include <gazebo/gazebo.hh>
using namespace gazebo;
@@ -34,8 +32,8 @@ using namespace gazebo;
*
* \todo Make WorldPlugin?
*/
class Clock: public ModelPlugin {
public:
class Clock : public ModelPlugin {
public:
Clock();
~Clock();
@@ -43,13 +41,13 @@ public:
void Load(physics::ModelPtr model, sdf::ElementPtr sdf);
/// \brief Sends out time each timestep.
void Update(const common::UpdateInfo &info);
void Update(const common::UpdateInfo& info);
private:
std::string topic; ///< \brief Publish the time on this topic.
physics::ModelPtr model; ///< \brief The model that this is attached to.
event::ConnectionPtr updateConn; ///< \brief Pointer to the world update function.
transport::NodePtr node; ///< \brief The node we're advertising on.
transport::PublisherPtr pub; ///< \brief Publisher handle.
private:
std::string topic; ///< \brief Publish the time on this topic.
physics::ModelPtr model; ///< \brief The model that this is attached to.
event::ConnectionPtr
updateConn; ///< \brief Pointer to the world update function.
transport::NodePtr node; ///< \brief The node we're advertising on.
transport::PublisherPtr pub; ///< \brief Publisher handle.
};