Skip to content

Commit 7d47fe7

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 0090975 commit 7d47fe7

10 files changed

+191
-191
lines changed

src/log.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using namespace rc_sot_system;
1616

1717
DataToLog::DataToLog() {}
1818

19-
void DataToLog::init(ProfileLog &aProfileLog) {
19+
void DataToLog::init(ProfileLog& aProfileLog) {
2020
profileLog_ = aProfileLog;
2121
motor_angle.resize(aProfileLog.nbDofs * aProfileLog.length);
2222
joint_angle.resize(aProfileLog.nbDofs * aProfileLog.length);
@@ -53,7 +53,7 @@ void DataToLog::init(ProfileLog &aProfileLog) {
5353

5454
Log::Log() : lref_(0), lrefts_(0) {}
5555

56-
void Log::init(ProfileLog &aProfileLog) {
56+
void Log::init(ProfileLog& aProfileLog) {
5757
profileLog_ = aProfileLog;
5858
lref_ = 0;
5959
lrefts_ = 0;
@@ -64,7 +64,7 @@ void Log::init(ProfileLog &aProfileLog) {
6464
timeorigin_ = (double)current.tv_sec + 0.000001 * ((double)current.tv_usec);
6565
}
6666

67-
void Log::record(DataToLog &aDataToLog) {
67+
void Log::record(DataToLog& aDataToLog) {
6868
if ((aDataToLog.motor_angle.size() != profileLog_.nbDofs) ||
6969
(aDataToLog.velocities.size() != profileLog_.nbDofs))
7070
return;
@@ -148,7 +148,7 @@ double Log::stop_it() {
148148
return time_stop_it_ - time_start_it_;
149149
}
150150

151-
void Log::save(std::string &fileName) {
151+
void Log::save(std::string& fileName) {
152152
assert(lref_ == lrefts_ * profileLog_.nbDofs);
153153

154154
std::string suffix("-mastate.log");
@@ -184,22 +184,22 @@ void Log::save(std::string &fileName) {
184184
saveVector(fileName, suffix, StoredData_.duration, 1);
185185
}
186186

187-
inline void writeHeaderToBinaryBuffer(ofstream &of, const std::size_t &nVector,
188-
const std::size_t &vectorSize) {
189-
of.write((const char *)(&nVector), sizeof(std::size_t));
190-
of.write((const char *)(&vectorSize), sizeof(std::size_t));
187+
inline void writeHeaderToBinaryBuffer(ofstream& of, const std::size_t& nVector,
188+
const std::size_t& vectorSize) {
189+
of.write((const char*)(&nVector), sizeof(std::size_t));
190+
of.write((const char*)(&vectorSize), sizeof(std::size_t));
191191
}
192192

193-
inline void writeToBinaryFile(ofstream &of, const double &t, const double &dt,
194-
const std::vector<double> &data,
195-
const std::size_t &idx, const std::size_t &size) {
196-
of.write((const char *)&t, sizeof(double));
197-
of.write((const char *)&dt, sizeof(double));
198-
of.write((const char *)(&data[idx]), size * (sizeof(double)));
193+
inline void writeToBinaryFile(ofstream& of, const double& t, const double& dt,
194+
const std::vector<double>& data,
195+
const std::size_t& idx, const std::size_t& size) {
196+
of.write((const char*)&t, sizeof(double));
197+
of.write((const char*)&dt, sizeof(double));
198+
of.write((const char*)(&data[idx]), size * (sizeof(double)));
199199
}
200200

201-
void Log::saveVector(std::string &fileName, std::string &suffix,
202-
const std::vector<double> &avector, std::size_t size) {
201+
void Log::saveVector(std::string& fileName, std::string& suffix,
202+
const std::vector<double>& avector, std::size_t size) {
203203
ostringstream oss;
204204
oss << fileName;
205205
oss << suffix.c_str();

src/log.hh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct DataToLog {
5050
ProfileLog profileLog_;
5151

5252
DataToLog();
53-
void init(ProfileLog &aProfileLog);
53+
void init(ProfileLog& aProfileLog);
5454
std::size_t nbDofs() { return profileLog_.nbDofs; }
5555
std::size_t nbForceSensors() { return profileLog_.nbForceSensors; }
5656
std::size_t length() { return profileLog_.length; }
@@ -78,16 +78,16 @@ class Log {
7878
// \param size number of contiguous values of avector that forms one line.
7979
// \note avector is a circular buffer. Data will be written from
8080
// start to N, and then from 0 to start.
81-
void saveVector(std::string &filename, std::string &suffix,
82-
const std::vector<double> &avector, std::size_t size);
81+
void saveVector(std::string& filename, std::string& suffix,
82+
const std::vector<double>& avector, std::size_t size);
8383

8484
public:
8585
Log();
8686

87-
void init(ProfileLog &aProfileLog);
88-
void record(DataToLog &aDataToLog);
87+
void init(ProfileLog& aProfileLog);
88+
void record(DataToLog& aDataToLog);
8989

90-
void save(std::string &fileName);
90+
void save(std::string& fileName);
9191
void start_it();
9292
/// \return the elapsed time since the previous \ref start_it
9393
double stop_it();

0 commit comments

Comments
 (0)