Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reformat bondcpp for better readability #52

Open
wants to merge 5 commits into
base: kinetic-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions bondcpp/include/bondcpp/bond.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
#include <vector>

#ifdef ROS_BUILD_SHARED_LIBS // ros is being built around shared libraries
#ifdef bondcpp_EXPORTS // we are building a shared lib/dll
#define BONDCPP_DECL ROS_HELPER_EXPORT
#else // we are using shared lib/dll
#define BONDCPP_DECL ROS_HELPER_IMPORT
#endif
#ifdef bondcpp_EXPORTS // we are building a shared lib/dll
#define BONDCPP_DECL ROS_HELPER_EXPORT
#else // we are using shared lib/dll
#define BONDCPP_DECL ROS_HELPER_IMPORT
#endif
#else // ros is being built around static libraries
#define BONDCPP_DECL
#define BONDCPP_DECL
#endif

namespace bond {
Expand All @@ -76,7 +76,8 @@ class BONDCPP_DECL Bond
* \param on_broken callback that will be called when the bond is broken.
* \param on_formed callback that will be called when the bond is formed.
*/
Bond(const std::string &topic, const std::string &id,
Bond(const std::string& topic,
const std::string& id,
boost::function<void(void)> on_broken = boost::function<void(void)>(),
boost::function<void(void)> on_formed = boost::function<void(void)>());

Expand All @@ -93,7 +94,7 @@ class BONDCPP_DECL Bond
double getHeartbeatPeriod() const { return heartbeat_period_; }
void setHeartbeatPeriod(double dur);

void setCallbackQueue(ros::CallbackQueueInterface *queue);
void setCallbackQueue(ros::CallbackQueueInterface* queue);

/** \brief Starts the bond and connects to the sister process.
*/
Expand Down Expand Up @@ -184,30 +185,29 @@ class BONDCPP_DECL Bond
void onHeartbeatTimeout();
void onDisconnectTimeout();

void bondStatusCB(const bond::Status::ConstPtr &msg);
void bondStatusCB(const bond::Status::ConstPtr& msg);

void doPublishing(const ros::SteadyTimerEvent &e);
void doPublishing(const ros::SteadyTimerEvent& e);
void publishStatus(bool active);

std::vector<boost::function<void(void)> > pending_callbacks_;
void flushPendingCallbacks();
};

} // namespace bond

} // namespace bond

// Internal use only
struct BondSM
{
BondSM(bond::Bond *b_) : b(b_) {}
BondSM(bond::Bond* b_) : b(b_) {}
void Connected();
void SisterDied();
void Death();
void Heartbeat();
void StartDying();

private:
bond::Bond *b;
bond::Bond* b;
};

#endif // BONDCPP__BOND_H_
#endif // BONDCPP__BOND_H_
19 changes: 9 additions & 10 deletions bondcpp/include/bondcpp/timeout.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ class Timeout
{
public:
Timeout(
const ros::Duration &d,
boost::function<void(void)> on_timeout = boost::function<void(void)>());
const ros::Duration& d,
boost::function<void(void)> on_timeout = boost::function<void(void)>());
Timeout(
const ros::WallDuration &d,
boost::function<void(void)> on_timeout = boost::function<void(void)>());
const ros::WallDuration& d,
boost::function<void(void)> on_timeout = boost::function<void(void)>());
~Timeout();

// Undefined what these do to a running timeout
void setDuration(const ros::Duration &d);
void setDuration(const ros::WallDuration &d);
void setDuration(const ros::Duration& d);
void setDuration(const ros::WallDuration& d);

void reset();
void cancel();
Expand All @@ -60,10 +60,9 @@ class Timeout
ros::WallDuration duration_;
boost::function<void(void)> on_timeout_;

void timerCallback(const ros::SteadyTimerEvent &e);
void timerCallback(const ros::SteadyTimerEvent& e);
};

} // namespace bond

} // namespace bond

#endif // BONDCPP__TIMEOUT_H_
#endif // BONDCPP__TIMEOUT_H_
Loading