Skip to content

Commit 48e05f1

Browse files
Fix typo. Enforce 80 columns policy.
1 parent db1c58f commit 48e05f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+5103
-3963
lines changed

include/dynamic-graph/command-bind.h

Lines changed: 433 additions & 323 deletions
Large diffs are not rendered by default.

include/dynamic-graph/command-direct-getter.h

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,45 @@
1919
#include <boost/assign/list_of.hpp>
2020

2121
/* --- GETTER --------------------------------------------------------- */
22-
namespace dynamicgraph {
23-
namespace command {
24-
25-
template <class E, typename T>
26-
class DirectGetter : public Command {
27-
public:
28-
/// Pointer to method that sets parameter of type T
29-
typedef T (E::*GetterMethod)() const;
30-
31-
/// Constructor
32-
DirectGetter(E& entity, T* ptr, const std::string& docString)
33-
: Command(entity, std::vector<Value::Type>(), docString), T_ptr(ptr) {}
34-
35-
protected:
36-
virtual Value doExecute() { return Value(*T_ptr); }
37-
38-
private:
39-
T* T_ptr;
40-
};
41-
42-
template <class E, typename T>
43-
DirectGetter<E, T>* makeDirectGetter(E& entity, T* ptr, const std::string& docString) {
44-
return new DirectGetter<E, T>(entity, ptr, docString);
45-
}
46-
47-
inline std::string docDirectGetter(const std::string& name, const std::string& type) {
48-
return std::string("\nGet the ") + name + ".\n\nNo input.\nReturn an " + type + ".\n\n";
49-
}
50-
51-
} // namespace command
22+
namespace dynamicgraph
23+
{
24+
namespace command
25+
{
26+
27+
template <class E, typename T>
28+
class DirectGetter : public Command
29+
{
30+
public:
31+
/// Pointer to method that sets parameter of type T
32+
typedef T (E::*GetterMethod)() const;
33+
34+
/// Constructor
35+
DirectGetter(E& entity, T* ptr, const std::string& docString)
36+
: Command(entity, std::vector<Value::Type>(), docString), T_ptr(ptr)
37+
{}
38+
39+
protected:
40+
virtual Value doExecute() { return Value(*T_ptr); }
41+
42+
private:
43+
T* T_ptr;
44+
};
45+
46+
template <class E, typename T>
47+
DirectGetter<E, T>* makeDirectGetter
48+
(E& entity, T* ptr, const std::string& docString)
49+
{
50+
return new DirectGetter<E, T>(entity, ptr, docString);
51+
}
52+
53+
inline std::string docDirectGetter
54+
(const std::string& name, const std::string& type)
55+
{
56+
return std::string("\nGet the ") + name +
57+
".\n\nNo input.\nReturn an " + type + ".\n\n";
58+
}
59+
60+
} // namespace command
5261
} // namespace dynamicgraph
5362

5463
#endif // __dg_command_direct_getter_h__

include/dynamic-graph/command-direct-setter.h

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,47 @@
1919
#include <boost/assign/list_of.hpp>
2020

2121
/* --- SETTER --------------------------------------------------------- */
22-
namespace dynamicgraph {
23-
namespace command {
24-
25-
template <class E, typename T>
26-
class DirectSetter : public Command {
27-
public:
28-
DirectSetter(E& entity, T* ptr, const std::string& docString)
29-
: Command(entity, boost::assign::list_of(ValueHelper<T>::TypeID), docString), T_ptr(ptr) {}
30-
31-
protected:
32-
virtual Value doExecute() {
33-
const std::vector<Value>& values = getParameterValues();
34-
T val = values[0].value();
35-
(*T_ptr) = val;
36-
return Value(); // void
37-
}
38-
39-
private:
40-
T* T_ptr;
41-
};
42-
43-
template <class E, typename T>
44-
DirectSetter<E, T>* makeDirectSetter(E& entity, T* ptr, const std::string& docString) {
45-
return new DirectSetter<E, T>(entity, ptr, docString);
46-
}
47-
48-
inline std::string docDirectSetter(const std::string& name, const std::string& type) {
49-
return std::string("\nSet the ") + name + ".\n\nInput:\n - a " + type + ".\nVoid return.\n\n";
50-
}
51-
52-
} // namespace command
22+
namespace dynamicgraph
23+
{
24+
namespace command
25+
{
26+
27+
template <class E, typename T>
28+
class DirectSetter : public Command
29+
{
30+
public:
31+
DirectSetter(E& entity, T* ptr, const std::string& docString)
32+
: Command(entity, boost::assign::list_of(ValueHelper<T>::TypeID),
33+
docString), T_ptr(ptr) {}
34+
35+
protected:
36+
virtual Value doExecute()
37+
{
38+
const std::vector<Value>& values = getParameterValues();
39+
T val = values[0].value();
40+
(*T_ptr) = val;
41+
return Value(); // void
42+
}
43+
44+
private:
45+
T* T_ptr;
46+
};
47+
48+
template <class E, typename T>
49+
DirectSetter<E, T>* makeDirectSetter
50+
(E& entity, T* ptr, const std::string& docString)
51+
{
52+
return new DirectSetter<E, T>(entity, ptr, docString);
53+
}
54+
55+
inline std::string docDirectSetter
56+
(const std::string& name, const std::string& type)
57+
{
58+
return std::string("\nSet the ") + name + ".\n\nInput:\n - a " + type +
59+
".\nVoid return.\n\n";
60+
}
61+
62+
} // namespace command
5363
} // namespace dynamicgraph
5464

5565
#endif // __dg_command_direct_setter_h__

include/dynamic-graph/command-getter.t.cpp

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,28 @@
99

1010
#include <sstream>
1111

12-
namespace dynamicgraph {
13-
class Entity;
14-
namespace command {
15-
16-
template <class E, typename T>
17-
Getter<E, T>::Getter(E& entity, GetterMethod getterMethod, const std::string& docstring)
18-
: Command(entity, std::vector<Value::Type>(), docstring), getterMethod_(getterMethod) {}
19-
20-
template <class E, typename T>
21-
Value Getter<E, T>::doExecute() {
22-
E& entity = static_cast<E&>(owner());
23-
T value = (entity.*getterMethod_)();
24-
return Value(value);
25-
}
26-
} // namespace command
12+
namespace dynamicgraph
13+
{
14+
class Entity;
15+
namespace command
16+
{
17+
18+
template <class E, typename T>
19+
Getter<E, T>::Getter
20+
(E& entity, GetterMethod getterMethod,
21+
const std::string& docstring)
22+
: Command(entity, std::vector<Value::Type>(), docstring),
23+
getterMethod_(getterMethod)
24+
{}
25+
26+
template <class E, typename T>
27+
Value Getter<E, T>::doExecute()
28+
{
29+
E& entity = static_cast<E&>(owner());
30+
T value = (entity.*getterMethod_)();
31+
return Value(value);
32+
}
33+
} // namespace command
2734
} // namespace dynamicgraph
2835

2936
#endif // DYNAMIC_GRAPH_COMMAND_GETTER_T_CPP

0 commit comments

Comments
 (0)