Skip to content

Commit 05d4ac5

Browse files
olivier-stasseOlivier Stasse
authored andcommitted
[clang] Format clang
1 parent 240df67 commit 05d4ac5

File tree

9 files changed

+82
-114
lines changed

9 files changed

+82
-114
lines changed

doc/additionalDoc/debug-real-time-logger.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

doc/additionalDoc/doc-command.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ std::map<const std::string, Command *> aCommandMap =
9797
std::string cmd_name = "4_args";
9898
9999
std::map<const std::string, Command *>::iterator it_map;
100-
100+
101101
it_map = aCommandMap.find(cmd_name);
102102
if (it_map == aCommandMap.end())
103103
@@ -107,7 +107,7 @@ std::vector<Value> values;
107107
108108
for (unsigned int i = 0; i < 4; i++)
109109
values.push_back(aValue);
110-
110+
111111
it_map->second->setParameterValues(values);
112112
it_map->second->execute();
113113
it_map->second->owner();

doc/additionalDoc/doc-debug-real-time-logger.h

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
either the entity method setLoggerVerbosityLevel()
1111
or the corresponding python bindings.
1212
13-
\section real_time_logger_modifying_entities Putting information in your entity.
13+
\section real_time_logger_modifying_entities Putting information in your
14+
entity.
1415
1516
It is possible to define the periodicity of the logger:
1617
\code
17-
logger_.setTimeSample(0.001);
18+
logger_.setTimeSample(0.001);
1819
\endcode
1920
2021
To define the periodicity at which one wants to print information:
@@ -36,23 +37,24 @@ level : ERROR</li>
3637
</ul>
3738
3839
It is specified by the enum LoggerVerbosity
39-
40+
4041
It is possible to display information according to various level of debug:
4142
\code
4243
sendMsg("This is a message of level MSG_TYPE_DEBUG", MSG_TYPE_DEBUG);
4344
\endcode
4445
or
4546
\code
46-
DYNAMIC_GRAPH_ENTITY_DEBUG (*this) << "This is a message of level MSG_TYPE_DEBUG\n";
47-
DYNAMIC_GRAPH_ENTITY_INFO (*this) << "This is a message of level MSG_TYPE_INFO\n";
48-
DYNAMIC_GRAPH_ENTITY_WARNING (*this) << "This is a message of level MSG_TYPE_WARNING\n";
49-
DYNAMIC_GRAPH_ENTITY_ERROR (*this) << "This is a message of level MSG_TYPE_ERROR\n";
50-
DYNAMIC_GRAPH_ENTITY_DEBUG_STREAM (*this) << "This is a message of level MSG_TYPE_DEBUG_STREAM\n";
51-
DYNAMIC_GRAPH_ENTITY_INFO_STREAM (*this) << "This is a message of level MSG_TYPE_INFO_STREAM\n";
52-
DYNAMIC_GRAPH_ENTITY_WARNING_STREAM (*this) << "This is a message of level MSG_TYPE_WARNING_STREAM\n";
53-
DYNAMIC_GRAPH_ENTITY_ERROR_STREAM (*this) << "This is a message of level MSG_TYPE_ERROR_STREAM\n";
54-
\endcode
55-
47+
DYNAMIC_GRAPH_ENTITY_DEBUG (*this) << "This is a message of level
48+
MSG_TYPE_DEBUG\n"; DYNAMIC_GRAPH_ENTITY_INFO (*this) << "This is a message of
49+
level MSG_TYPE_INFO\n"; DYNAMIC_GRAPH_ENTITY_WARNING (*this) << "This is a
50+
message of level MSG_TYPE_WARNING\n"; DYNAMIC_GRAPH_ENTITY_ERROR (*this) <<
51+
"This is a message of level MSG_TYPE_ERROR\n"; DYNAMIC_GRAPH_ENTITY_DEBUG_STREAM
52+
(*this) << "This is a message of level MSG_TYPE_DEBUG_STREAM\n";
53+
DYNAMIC_GRAPH_ENTITY_INFO_STREAM (*this) << "This is a message of level
54+
MSG_TYPE_INFO_STREAM\n"; DYNAMIC_GRAPH_ENTITY_WARNING_STREAM (*this) << "This is
55+
a message of level MSG_TYPE_WARNING_STREAM\n"; DYNAMIC_GRAPH_ENTITY_ERROR_STREAM
56+
(*this) << "This is a message of level MSG_TYPE_ERROR_STREAM\n"; \endcode
57+
5658
5759
\note Thread safety. This class expects to have:
5860
- only one reader: the one who take the log entries and write them somewhere.

include/dynamic-graph/command-bind.h

Lines changed: 33 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ template <class E, typename T> struct CommandVoid1 : public Command {
8080
typedef boost::function<void(const T &)> function_t;
8181

8282
CommandVoid1(E &entity, function_t function, const std::string &docString)
83-
: Command(entity,
84-
boost::assign::list_of
85-
(ValueHelper<T>::TypeID),
83+
: Command(entity, boost::assign::list_of(ValueHelper<T>::TypeID),
8684
docString),
8785
fptr(function) {}
8886

@@ -107,12 +105,12 @@ makeCommandVoid1(E &entity, boost::function<void(const T &)> function,
107105
}
108106

109107
template <class E, typename T>
110-
CommandVoid1<E, T> *makeCommandVoid1(
111-
E &entity,
112-
// The following syntaxt don't compile when not specializing the template
113-
// arg... why ???
114-
boost::function<void(E *, const T &)> function,
115-
const std::string &docString) {
108+
CommandVoid1<E, T> *
109+
makeCommandVoid1(E &entity,
110+
// The following syntaxt don't compile when not specializing
111+
// the template arg... why ???
112+
boost::function<void(E *, const T &)> function,
113+
const std::string &docString) {
116114
return new CommandVoid1<E, T>(entity, boost::bind(function, &entity, _1),
117115
docString);
118116
}
@@ -144,9 +142,8 @@ struct CommandVoid2 : public Command {
144142

145143
CommandVoid2(E &entity, function_t function, const std::string &docString)
146144
: Command(entity,
147-
boost::assign::list_of
148-
(ValueHelper<T1>::TypeID)
149-
(ValueHelper<T2>::TypeID),
145+
boost::assign::list_of(ValueHelper<T1>::TypeID)(
146+
ValueHelper<T2>::TypeID),
150147
docString),
151148
fptr(function) {}
152149

@@ -172,12 +169,12 @@ makeCommandVoid2(E &entity,
172169
}
173170

174171
template <class E, typename T1, typename T2>
175-
CommandVoid2<E, T1, T2> *makeCommandVoid2(
176-
E &entity,
177-
// The following syntaxt don't compile when not specializing the template
178-
// arg... why ???
179-
boost::function<void(E *, const T1 &, const T2 &)> function,
180-
const std::string &docString) {
172+
CommandVoid2<E, T1, T2> *
173+
makeCommandVoid2(E &entity,
174+
// The following syntaxt don't compile when not specializing
175+
// the template arg... why ???
176+
boost::function<void(E *, const T1 &, const T2 &)> function,
177+
const std::string &docString) {
181178
return new CommandVoid2<E, T1, T2>(
182179
entity, boost::bind(function, &entity, _1, _2), docString);
183180
}
@@ -211,10 +208,8 @@ struct CommandVoid3 : public Command {
211208

212209
CommandVoid3(E &entity, function_t function, const std::string &docString)
213210
: Command(entity,
214-
boost::assign::list_of
215-
(ValueHelper<T1>::TypeID)
216-
(ValueHelper<T2>::TypeID)
217-
(ValueHelper<T3>::TypeID),
211+
boost::assign::list_of(ValueHelper<T1>::TypeID)(
212+
ValueHelper<T2>::TypeID)(ValueHelper<T3>::TypeID),
218213
docString),
219214
fptr(function) {}
220215

@@ -286,11 +281,9 @@ struct CommandVoid4 : public Command {
286281

287282
CommandVoid4(E &entity, function_t function, const std::string &docString)
288283
: Command(entity,
289-
boost::assign::list_of
290-
(ValueHelper<T1>::TypeID)
291-
(ValueHelper<T2>::TypeID)
292-
(ValueHelper<T3>::TypeID)
293-
(ValueHelper<T4>::TypeID),
284+
boost::assign::list_of(ValueHelper<T1>::TypeID)(
285+
ValueHelper<T2>::TypeID)(ValueHelper<T3>::TypeID)(
286+
ValueHelper<T4>::TypeID),
294287
docString),
295288
fptr(function) {}
296289

@@ -382,14 +375,11 @@ makeCommandVerbose(E &entity, typename CommandVerbose<E>::function_t function,
382375
return NULL;
383376
}
384377

385-
386378
template <class E>
387-
CommandVerbose<E> *
388-
makeCommandVerbose(E &entity,
389-
void (E::*function)(std::ostream &),
390-
const std::string &docString) {
391-
return new CommandVerbose<E>(entity,
392-
boost::bind(function, &entity,_1),
379+
CommandVerbose<E> *makeCommandVerbose(E &entity,
380+
void (E::*function)(std::ostream &),
381+
const std::string &docString) {
382+
return new CommandVerbose<E>(entity, boost::bind(function, &entity, _1),
393383
docString);
394384
return NULL;
395385
}
@@ -462,9 +452,7 @@ struct CommandReturnType1 : public Command {
462452

463453
CommandReturnType1(E &entity, function_t function,
464454
const std::string &docString)
465-
: Command(entity,
466-
boost::assign::list_of
467-
(ValueHelper<T>::TypeID),
455+
: Command(entity, boost::assign::list_of(ValueHelper<T>::TypeID),
468456
docString),
469457
fptr(function) {}
470458

@@ -489,12 +477,12 @@ makeCommandReturnType1(E &entity,
489477
}
490478

491479
template <class E, typename ReturnType, typename T>
492-
CommandReturnType1<E, ReturnType, T> *makeCommandReturnType1(
493-
E &entity,
494-
// The following syntaxt don't compile when not specializing the template
495-
// arg... why ???
496-
boost::function<ReturnType(E *, const T &)> function,
497-
const std::string &docString) {
480+
CommandReturnType1<E, ReturnType, T> *
481+
makeCommandReturnType1(E &entity,
482+
// The following syntaxt don't compile when not
483+
// specializing the template arg... why ???
484+
boost::function<ReturnType(E *, const T &)> function,
485+
const std::string &docString) {
498486
return new CommandReturnType1<E, ReturnType, T>(
499487
entity, boost::bind(function, &entity, _1), docString);
500488
}
@@ -529,9 +517,8 @@ struct CommandReturnType2 : public Command {
529517
CommandReturnType2(E &entity, function_t function,
530518
const std::string &docString)
531519
: Command(entity,
532-
boost::assign::list_of
533-
(ValueHelper<T1>::TypeID)
534-
(ValueHelper<T2>::TypeID),
520+
boost::assign::list_of(ValueHelper<T1>::TypeID)(
521+
ValueHelper<T2>::TypeID),
535522
docString),
536523
fptr(function) {}
537524

@@ -589,5 +576,4 @@ inline std::string docCommandReturnType2(const std::string &doc,
589576
} // namespace command
590577
} // namespace dynamicgraph
591578

592-
593579
#endif // __dg_command_bind_h__

include/dynamic-graph/value.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ class DYNAMIC_GRAPH_DLLAPI EitherType {
3939
};
4040

4141
/** \ingroup dgraph
42-
\brief This class implements a variant design pattern to handle basic types in Command.
42+
\brief This class implements a variant design pattern to handle basic types
43+
in Command.
4344
4445
*/
4546
class DYNAMIC_GRAPH_DLLAPI Value {

src/traces/tracer-real-time.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ void TracerRealTime::openFile(const SignalBase<int> &sig,
127127
std::ofstream *newfile = new std::ofstream(filename.c_str());
128128
if (!newfile->good()) {
129129
delete newfile;
130-
DG_THROW ExceptionTraces(ExceptionTraces::NOT_OPEN,
130+
DG_THROW ExceptionTraces(
131+
ExceptionTraces::NOT_OPEN,
131132
"Could not open file " + filename + " for signal " + signame, "");
132133
}
133134
dgDEBUG(5) << "Newfile:" << (void *)newfile << endl;

tests/command-test.cpp

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CustomEntity : public Entity {
3737
bool test_four_args_;
3838
bool test_one_arg_ret_;
3939
bool test_two_args_ret_;
40-
40+
4141
virtual const std::string &getClassName() const { return CLASS_NAME; }
4242
explicit CustomEntity(const std::string &n) : Entity(n) {
4343
test_zero_arg_ = false;
@@ -47,7 +47,7 @@ class CustomEntity : public Entity {
4747
test_four_args_ = false;
4848
test_one_arg_ret_ = false;
4949
test_two_args_ret_ = false;
50-
50+
5151
addCommand("0_arg", makeCommandVoid0(*this, &CustomEntity::zero_arg,
5252
docCommandVoid0("zero arg")));
5353

@@ -68,20 +68,17 @@ class CustomEntity : public Entity {
6868
docCommandVoid4("four args", "int", "int", "int", "int")));
6969

7070
addCommand("1_arg_r",
71-
makeCommandReturnType1(
72-
*this, &CustomEntity::one_arg_ret,
73-
docCommandVoid1("one arg", "int")));
71+
makeCommandReturnType1(*this, &CustomEntity::one_arg_ret,
72+
docCommandVoid1("one arg", "int")));
7473

75-
addCommand("2_args_r",
76-
makeCommandReturnType2(
77-
*this, &CustomEntity::two_args_ret,
78-
docCommandVoid2("two args", "int","int")));
74+
addCommand("2_args_r", makeCommandReturnType2(
75+
*this, &CustomEntity::two_args_ret,
76+
docCommandVoid2("two args", "int", "int")));
7977

80-
81-
addCommand("cmd_verbose",
82-
makeCommandVerbose(
83-
*this,&CustomEntity::cmd_verbose,
84-
docCommandVerbose("Display some information")));
78+
addCommand(
79+
"cmd_verbose",
80+
makeCommandVerbose(*this, &CustomEntity::cmd_verbose,
81+
docCommandVerbose("Display some information")));
8582

8683
/// Generating an exception by adding a command which already exist
8784
bool res = false;
@@ -110,13 +107,18 @@ class CustomEntity : public Entity {
110107
test_four_args_ = true;
111108
}
112109

113-
int one_arg_ret(const int &) { test_one_arg_ret_ = true; return 2;}
110+
int one_arg_ret(const int &) {
111+
test_one_arg_ret_ = true;
112+
return 2;
113+
}
114114

115-
std::string two_args_ret(const int &, const int &)
116-
{ test_two_args_ret_ = true; return std::string("return");}
115+
std::string two_args_ret(const int &, const int &) {
116+
test_two_args_ret_ = true;
117+
return std::string("return");
118+
}
117119

118-
void cmd_verbose(std::ostream &oss)
119-
{ std::string as("print verbose");
120+
void cmd_verbose(std::ostream &oss) {
121+
std::string as("print verbose");
120122
oss << as;
121123
}
122124
};
@@ -171,17 +173,16 @@ BOOST_AUTO_TEST_CASE(command_test) {
171173
vec_fname.push_back(std::string("1_arg_r"));
172174
vec_fname.push_back(std::string("2_args_r"));
173175
values.clear();
174-
176+
175177
for (unsigned int i = 0; i < 2; i++) {
176178
it_map = aCommandMap.find(vec_fname[i]);
177-
if (it_map == aCommandMap.end())
178-
{
179+
if (it_map == aCommandMap.end()) {
179180
BOOST_CHECK(false);
180181
exit(-1);
181182
}
182183
values.push_back(aValue);
183184
it_map->second->setParameterValues(values);
184-
Value aValue =it_map->second->execute();
185+
Value aValue = it_map->second->execute();
185186
it_map->second->owner();
186187
it_map->second->getDocstring();
187188
}

tests/debug-real-time-tracer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@ BOOST_AUTO_TEST_CASE(test_tracer) {
6565
std::string basename("my-tracer");
6666
std::string suffix(".dat");
6767

68-
atracer.setBufferSize(1<<14);
68+
atracer.setBufferSize(1 << 14);
6969

7070
// Check that an exception is thrown if the filename is invalid.
7171
atracer.openFiles(rootdir, "invalid/filename", suffix);
72-
BOOST_CHECK_THROW(atracer.addSignalToTraceByName("my-entity.out_double", "output"),
72+
BOOST_CHECK_THROW(
73+
atracer.addSignalToTraceByName("my-entity.out_double", "output"),
7374
ExceptionTraces);
7475

7576
// Test openfiles

tests/signal-ptr.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,7 @@ BOOST_AUTO_TEST_CASE(set_signal_string) {
306306
std::istringstream value(os.str());
307307
try {
308308
s.set(value);
309-
}
310-
catch(const std::exception& exc)
311-
{
309+
} catch (const std::exception &exc) {
312310
std::cout << exc.what() << std::endl;
313311
BOOST_CHECK(!"Tentative to set signal to empty string");
314312
}

0 commit comments

Comments
 (0)