Skip to content
Snippets Groups Projects
Unverified Commit c5ddeca6 authored by Guilhem Saurel's avatar Guilhem Saurel Committed by GitHub
Browse files

Merge pull request #92 from nim65s/devel

 reformat for clang-format-12
parents 4d6b4a9f ed589907
No related branches found
Tags v4.4.2
No related merge requests found
Pipeline #16017 passed
Showing
with 728 additions and 457 deletions
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: true
DisableFormat: false
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
StatementAttributeLikeMacros:
- Q_EMIT
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<pinocchio/fwd\.hpp>'
Priority: 1
SortPriority: 0
CaseSensitive: false
- Regex: '^<ext/.*\.h>'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*\.h>'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 4
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PenaltyIndentedWhitespace: 0
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
- ParseTestProto
- ParsePartialTestProto
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Auto
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...
Subproject commit a689714c0d0890ffff5649ba25cbaed44dd6e660
Subproject commit 9078d521dc23fabae72e3fe8d7c0068c68364eef
......@@ -15,4 +15,4 @@
#include <dynamic-graph/command-setter.h>
#include <dynamic-graph/command.h>
#endif //! DYNAMIC_GRAPH_ALL_COMMANDS_H
#endif //! DYNAMIC_GRAPH_ALL_COMMANDS_H
......@@ -12,4 +12,4 @@
#include <dynamic-graph/signal-time-dependent.h>
#include <dynamic-graph/signal.h>
#endif //! DYNAMIC_GRAPH_ALL_SIGNALS_H
#endif //! DYNAMIC_GRAPH_ALL_SIGNALS_H
This diff is collapsed.
......@@ -15,15 +15,17 @@
*
*/
#include "dynamic-graph/command.h"
#include <boost/assign/list_of.hpp>
#include "dynamic-graph/command.h"
/* --- GETTER --------------------------------------------------------- */
namespace dynamicgraph {
namespace command {
template <class E, typename T> class DirectGetter : public Command {
public:
template <class E, typename T>
class DirectGetter : public Command {
public:
/// Pointer to method that sets parameter of type T
typedef T (E::*GetterMethod)() const;
......@@ -31,10 +33,10 @@ public:
DirectGetter(E &entity, T *ptr, const std::string &docString)
: Command(entity, std::vector<Value::Type>(), docString), T_ptr(ptr) {}
protected:
protected:
virtual Value doExecute() { return Value(*T_ptr); }
private:
private:
T *T_ptr;
};
......@@ -50,7 +52,7 @@ inline std::string docDirectGetter(const std::string &name,
type + ".\n\n";
}
} // namespace command
} // namespace dynamicgraph
} // namespace command
} // namespace dynamicgraph
#endif // __dg_command_direct_getter_h__
#endif // __dg_command_direct_getter_h__
......@@ -15,29 +15,31 @@
*
*/
#include "dynamic-graph/command.h"
#include <boost/assign/list_of.hpp>
#include "dynamic-graph/command.h"
/* --- SETTER --------------------------------------------------------- */
namespace dynamicgraph {
namespace command {
template <class E, typename T> class DirectSetter : public Command {
public:
template <class E, typename T>
class DirectSetter : public Command {
public:
DirectSetter(E &entity, T *ptr, const std::string &docString)
: Command(entity, boost::assign::list_of(ValueHelper<T>::TypeID),
docString),
T_ptr(ptr) {}
protected:
protected:
virtual Value doExecute() {
const std::vector<Value> &values = getParameterValues();
T val = values[0].value();
(*T_ptr) = val;
return Value(); // void
return Value(); // void
}
private:
private:
T *T_ptr;
};
......@@ -53,7 +55,7 @@ inline std::string docDirectSetter(const std::string &name,
".\nVoid return.\n\n";
}
} // namespace command
} // namespace dynamicgraph
} // namespace command
} // namespace dynamicgraph
#endif // __dg_command_direct_setter_h__
#endif // __dg_command_direct_setter_h__
......@@ -41,21 +41,22 @@ namespace command {
/// \li T should be a type supported by class Value,
/// \li prototype of E::getParameter should be exactly as specified in this
/// example.
template <class E, typename T> class Getter : public Command {
public:
template <class E, typename T>
class Getter : public Command {
public:
/// Pointer to method that sets parameter of type T
typedef T (E::*GetterMethod)() const;
/// Constructor
Getter(E &entity, GetterMethod getterMethod, const std::string &docString);
protected:
protected:
virtual Value doExecute();
private:
private:
GetterMethod getterMethod_;
};
} // namespace command
} // namespace dynamicgraph
} // namespace command
} // namespace dynamicgraph
#include "dynamic-graph/command-getter.t.cpp"
#endif // DYNAMIC_GRAPH_COMMAND_GETTER_H
#endif // DYNAMIC_GRAPH_COMMAND_GETTER_H
......@@ -8,6 +8,7 @@
#define DYNAMIC_GRAPH_COMMAND_GETTER_T_CPP
#include "dynamic-graph/command-getter.h"
#include <sstream>
namespace dynamicgraph {
......@@ -20,12 +21,13 @@ Getter<E, T>::Getter(E &entity, GetterMethod getterMethod,
: Command(entity, std::vector<Value::Type>(), docstring),
getterMethod_(getterMethod) {}
template <class E, typename T> Value Getter<E, T>::doExecute() {
template <class E, typename T>
Value Getter<E, T>::doExecute() {
E &entity = static_cast<E &>(owner());
T value = (entity.*getterMethod_)();
return Value(value);
}
} // namespace command
} // namespace dynamicgraph
} // namespace command
} // namespace dynamicgraph
#endif // DYNAMIC_GRAPH_COMMAND_GETTER_T_CPP
#endif // DYNAMIC_GRAPH_COMMAND_GETTER_T_CPP
......@@ -41,21 +41,22 @@ namespace command {
/// \li T should be a type supported by class Value,
/// \li prototype of E::setParameter should be exactly as specified in this
/// example.
template <class E, typename T> class Setter : public Command {
public:
template <class E, typename T>
class Setter : public Command {
public:
/// Pointer to method that sets parameter of type T
typedef void (E::*SetterMethod)(const T &);
/// Constructor
Setter(E &entity, SetterMethod setterMethod, const std::string &docString);
protected:
protected:
virtual Value doExecute();
private:
private:
SetterMethod setterMethod_;
};
} // namespace command
} // namespace dynamicgraph
} // namespace command
} // namespace dynamicgraph
#include "dynamic-graph/command-setter.t.cpp"
#endif // DYNAMIC_GRAPH_COMMAND_SETTER_H
#endif // DYNAMIC_GRAPH_COMMAND_SETTER_H
......@@ -8,10 +8,12 @@
#define DYNAMIC_GRAPH_COMMAND_SETTER_T_CPP
#include "dynamic-graph/command-setter.h"
#include "dynamic-graph/linear-algebra.h"
#include <boost/assign/list_of.hpp>
#include <sstream>
#include "dynamic-graph/linear-algebra.h"
namespace dynamicgraph {
class Entity;
namespace command {
......@@ -19,19 +21,20 @@ namespace command {
//
// Template specialization: bool
//
template <class E> class Setter<E, bool> : public Command {
public:
template <class E>
class Setter<E, bool> : public Command {
public:
/// Pointer to method that sets parameter of type bool
typedef void (E::*SetterMethod)(const bool &);
/// Constructor
Setter(E &entity, SetterMethod setterMethod, const std::string &docString);
protected:
protected:
virtual Value doExecute();
private:
private:
SetterMethod setterMethod_;
}; // Class Setter
}; // Class Setter
template <class E>
Setter<E, bool>::Setter(E &entity, SetterMethod setterMethod,
......@@ -39,7 +42,8 @@ Setter<E, bool>::Setter(E &entity, SetterMethod setterMethod,
: Command(entity, boost::assign::list_of(Value::BOOL), docString),
setterMethod_(setterMethod) {}
template <class E> Value Setter<E, bool>::doExecute() {
template <class E>
Value Setter<E, bool>::doExecute() {
const std::vector<Value> &values = getParameterValues();
// Get parameter
bool value = values[0].value();
......@@ -51,19 +55,20 @@ template <class E> Value Setter<E, bool>::doExecute() {
//
// Template specialization: unsigned
//
template <class E> class Setter<E, unsigned> : public Command {
public:
template <class E>
class Setter<E, unsigned> : public Command {
public:
/// Pointer to method that sets parameter of type unsigned
typedef void (E::*SetterMethod)(const unsigned &);
/// Constructor
Setter(E &entity, SetterMethod setterMethod, const std::string &docString);
protected:
protected:
virtual Value doExecute();
private:
private:
SetterMethod setterMethod_;
}; // Class Setter
}; // Class Setter
template <class E>
Setter<E, unsigned>::Setter(E &entity, SetterMethod setterMethod,
......@@ -71,7 +76,8 @@ Setter<E, unsigned>::Setter(E &entity, SetterMethod setterMethod,
: Command(entity, boost::assign::list_of(Value::UNSIGNED), docString),
setterMethod_(setterMethod) {}
template <class E> Value Setter<E, unsigned>::doExecute() {
template <class E>
Value Setter<E, unsigned>::doExecute() {
const std::vector<Value> &values = getParameterValues();
// Get parameter
unsigned value = values[0].value();
......@@ -83,19 +89,20 @@ template <class E> Value Setter<E, unsigned>::doExecute() {
//
// Template specialization: int
//
template <class E> class Setter<E, int> : public Command {
public:
template <class E>
class Setter<E, int> : public Command {
public:
/// Pointer to method that sets parameter of type int
typedef void (E::*SetterMethod)(const int &);
/// Constructor
Setter(E &entity, SetterMethod setterMethod, const std::string &docString);
protected:
protected:
virtual Value doExecute();
private:
private:
SetterMethod setterMethod_;
}; // Class Setter
}; // Class Setter
template <class E>
Setter<E, int>::Setter(E &entity, SetterMethod setterMethod,
......@@ -103,7 +110,8 @@ Setter<E, int>::Setter(E &entity, SetterMethod setterMethod,
: Command(entity, boost::assign::list_of(Value::INT), docString),
setterMethod_(setterMethod) {}
template <class E> Value Setter<E, int>::doExecute() {
template <class E>
Value Setter<E, int>::doExecute() {
const std::vector<Value> &values = getParameterValues();
// Get parameter
int value = values[0].value();
......@@ -115,19 +123,20 @@ template <class E> Value Setter<E, int>::doExecute() {
//
// Template specialization: float
//
template <class E> class Setter<E, float> : public Command {
public:
template <class E>
class Setter<E, float> : public Command {
public:
/// Pointer to method that sets parameter of type float
typedef void (E::*SetterMethod)(const float &);
/// Constructor
Setter(E &entity, SetterMethod setterMethod, const std::string &docString);
protected:
protected:
virtual Value doExecute();
private:
private:
SetterMethod setterMethod_;
}; // Class Setter
}; // Class Setter
template <class E>
Setter<E, float>::Setter(E &entity, SetterMethod setterMethod,
......@@ -135,7 +144,8 @@ Setter<E, float>::Setter(E &entity, SetterMethod setterMethod,
: Command(entity, boost::assign::list_of(Value::FLOAT), docString),
setterMethod_(setterMethod) {}
template <class E> Value Setter<E, float>::doExecute() {
template <class E>
Value Setter<E, float>::doExecute() {
const std::vector<Value> &values = getParameterValues();
// Get parameter
float value = values[0].value();
......@@ -147,19 +157,20 @@ template <class E> Value Setter<E, float>::doExecute() {
//
// Template specialization: double
//
template <class E> class Setter<E, double> : public Command {
public:
template <class E>
class Setter<E, double> : public Command {
public:
/// Pointer to method that sets parameter of type double
typedef void (E::*SetterMethod)(const double &);
/// Constructor
Setter(E &entity, SetterMethod setterMethod, const std::string &docString);
protected:
protected:
virtual Value doExecute();
private:
private:
SetterMethod setterMethod_;
}; // Class Setter
}; // Class Setter
template <class E>
Setter<E, double>::Setter(E &entity, SetterMethod setterMethod,
......@@ -167,7 +178,8 @@ Setter<E, double>::Setter(E &entity, SetterMethod setterMethod,
: Command(entity, boost::assign::list_of(Value::DOUBLE), docString),
setterMethod_(setterMethod) {}
template <class E> Value Setter<E, double>::doExecute() {
template <class E>
Value Setter<E, double>::doExecute() {
const std::vector<Value> &values = getParameterValues();
// Get parameter
double value = values[0].value();
......@@ -179,19 +191,20 @@ template <class E> Value Setter<E, double>::doExecute() {
//
// Template specialization: std::string
//
template <class E> class Setter<E, std::string> : public Command {
public:
template <class E>
class Setter<E, std::string> : public Command {
public:
/// Pointer to method that sets parameter of type std::string
typedef void (E::*SetterMethod)(const std::string &);
/// Constructor
Setter(E &entity, SetterMethod setterMethod, const std::string &docString);
protected:
protected:
virtual Value doExecute();
private:
private:
SetterMethod setterMethod_;
}; // Class Setter
}; // Class Setter
template <class E>
Setter<E, std::string>::Setter(E &entity, SetterMethod setterMethod,
......@@ -199,7 +212,8 @@ Setter<E, std::string>::Setter(E &entity, SetterMethod setterMethod,
: Command(entity, boost::assign::list_of(Value::STRING), docString),
setterMethod_(setterMethod) {}
template <class E> Value Setter<E, std::string>::doExecute() {
template <class E>
Value Setter<E, std::string>::doExecute() {
const std::vector<Value> &values = getParameterValues();
// Get parameter
std::string value = values[0].value();
......@@ -211,19 +225,20 @@ template <class E> Value Setter<E, std::string>::doExecute() {
//
// Template specialization: Vector
//
template <class E> class Setter<E, Vector> : public Command {
public:
template <class E>
class Setter<E, Vector> : public Command {
public:
/// Pointer to method that sets parameter of type Vector
typedef void (E::*SetterMethod)(const Vector &);
/// Constructor
Setter(E &entity, SetterMethod setterMethod, const std::string &docString);
protected:
protected:
virtual Value doExecute();
private:
private:
SetterMethod setterMethod_;
}; // Class Setter
}; // Class Setter
template <class E>
Setter<E, Vector>::Setter(E &entity, SetterMethod setterMethod,
......@@ -231,7 +246,8 @@ Setter<E, Vector>::Setter(E &entity, SetterMethod setterMethod,
: Command(entity, boost::assign::list_of(Value::VECTOR), docString),
setterMethod_(setterMethod) {}
template <class E> Value Setter<E, Vector>::doExecute() {
template <class E>
Value Setter<E, Vector>::doExecute() {
const std::vector<Value> &values = getParameterValues();
// Get parameter
Vector value = values[0].value();
......@@ -243,19 +259,20 @@ template <class E> Value Setter<E, Vector>::doExecute() {
//
// Template specialization: Matrix
//
template <class E> class Setter<E, Matrix> : public Command {
public:
template <class E>
class Setter<E, Matrix> : public Command {
public:
/// Pointer to method that sets parameter of type Matrix
typedef void (E::*SetterMethod)(const Matrix &);
/// Constructor
Setter(E &entity, SetterMethod setterMethod, const std::string &docString);
protected:
protected:
virtual Value doExecute();
private:
private:
SetterMethod setterMethod_;
}; // Class Setter
}; // Class Setter
template <class E>
Setter<E, Matrix>::Setter(E &entity, SetterMethod setterMethod,
......@@ -263,7 +280,8 @@ Setter<E, Matrix>::Setter(E &entity, SetterMethod setterMethod,
: Command(entity, boost::assign::list_of(Value::MATRIX), docString),
setterMethod_(setterMethod) {}
template <class E> Value Setter<E, Matrix>::doExecute() {
template <class E>
Value Setter<E, Matrix>::doExecute() {
const std::vector<Value> &values = getParameterValues();
// Get parameter
Matrix value = values[0].value();
......@@ -272,7 +290,7 @@ template <class E> Value Setter<E, Matrix>::doExecute() {
return Value();
}
} // namespace command
} // namespace dynamicgraph
} // namespace command
} // namespace dynamicgraph
#endif // DYNAMIC_GRAPH_COMMAND_SETTER_T_CPP
#endif // DYNAMIC_GRAPH_COMMAND_SETTER_T_CPP
......@@ -7,9 +7,10 @@
#ifndef DYNAMIC_GRAPH_COMMAND_H
#define DYNAMIC_GRAPH_COMMAND_H
#include <vector>
#include "dynamic-graph/dynamic-graph-api.h"
#include "dynamic-graph/value.h"
#include <vector>
namespace dynamicgraph {
class Entity;
......@@ -32,7 +33,7 @@ namespace command {
/// vector of Values the types of which should fit the vector specified
/// at construction.
class DYNAMIC_GRAPH_DLLAPI Command {
public:
public:
virtual ~Command();
/// Store the owner entity and a vector of value types
/// \param entity reference to Entity owning this command.
......@@ -53,20 +54,20 @@ public:
/// Get documentation string
std::string getDocstring() const;
protected:
protected:
/// Specific action performed by the command
virtual Value doExecute() = 0;
private:
private:
Entity &owner_;
std::vector<Value::Type> valueTypeVector_;
std::vector<Value> valueVector_;
std::string docstring_;
public:
public:
static const std::vector<Value::Type> EMPTY_ARG;
};
} // namespace command
} // namespace dynamicgraph
} // namespace command
} // namespace dynamicgraph
#endif // DYNAMIC_GRAPH_COMMAND_H
#endif // DYNAMIC_GRAPH_COMMAND_H
......@@ -5,29 +5,29 @@
#ifndef DYNAMIC_GRAPH_DEBUG_HH
#define DYNAMIC_GRAPH_DEBUG_HH
#include <dynamic-graph/dynamic-graph-api.h>
#include <cstdarg>
#include <cstdio>
#include <dynamic-graph/fwd.hh>
#include <fstream>
#include <sstream>
#include <dynamic-graph/dynamic-graph-api.h>
#include <dynamic-graph/fwd.hh>
#ifndef VP_DEBUG_MODE
#define VP_DEBUG_MODE 0
#endif //! VP_DEBUG_MODE
#endif //! VP_DEBUG_MODE
#ifndef VP_TEMPLATE_DEBUG_MODE
#define VP_TEMPLATE_DEBUG_MODE 0
#endif //! VP_TEMPLATE_DEBUG_MODE
#define DG_COMMON_TRACES \
do { \
va_list arg; \
va_start(arg, format); \
vsnprintf(charbuffer, SIZE, format, arg); \
va_end(arg); \
outputbuffer << tmpbuffer.str() << charbuffer << std::endl; \
#endif //! VP_TEMPLATE_DEBUG_MODE
#define DG_COMMON_TRACES \
do { \
va_list arg; \
va_start(arg, format); \
vsnprintf(charbuffer, SIZE, format, arg); \
va_end(arg); \
outputbuffer << tmpbuffer.str() << charbuffer << std::endl; \
} while (0)
namespace dynamicgraph {
......@@ -38,7 +38,7 @@ namespace dynamicgraph {
/// This class should never be used directly, please use the
/// debugging macro instead.
class DYNAMIC_GRAPH_DLLAPI DebugTrace {
public:
public:
static const int SIZE = 512;
std::stringstream tmpbuffer;
......@@ -50,8 +50,7 @@ public:
DebugTrace(std::ostream &os) : outputbuffer(os) {}
inline void trace(const int level, const char *format, ...) {
if (level <= traceLevel)
DG_COMMON_TRACES;
if (level <= traceLevel) DG_COMMON_TRACES;
tmpbuffer.str("");
}
......@@ -68,8 +67,7 @@ public:
}
inline void traceTemplate(const int level, const char *format, ...) {
if (level <= traceLevelTemplate)
DG_COMMON_TRACES;
if (level <= traceLevelTemplate) DG_COMMON_TRACES;
tmpbuffer.str("");
}
......@@ -92,57 +90,57 @@ public:
DYNAMIC_GRAPH_DLLAPI extern DebugTrace dgDEBUGFLOW;
DYNAMIC_GRAPH_DLLAPI extern DebugTrace dgERRORFLOW;
} // end of namespace dynamicgraph
} // end of namespace dynamicgraph
#ifdef VP_DEBUG
#define dgPREDEBUG __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :"
#define dgPREERROR \
#define dgPREERROR \
"\t!! " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :"
#define dgDEBUG(level) \
if ((level > VP_DEBUG_MODE) || (!dgDEBUGFLOW.outputbuffer.good())) \
; \
else \
#define dgDEBUG(level) \
if ((level > VP_DEBUG_MODE) || (!dgDEBUGFLOW.outputbuffer.good())) \
; \
else \
dgDEBUGFLOW.outputbuffer << dgPREDEBUG
#define dgDEBUGMUTE(level) \
if ((level > VP_DEBUG_MODE) || (!dgDEBUGFLOW.outputbuffer.good())) \
; \
else \
#define dgDEBUGMUTE(level) \
if ((level > VP_DEBUG_MODE) || (!dgDEBUGFLOW.outputbuffer.good())) \
; \
else \
dgDEBUGFLOW.outputbuffer
#define dgERROR \
if (!dgDEBUGFLOW.outputbuffer.good()) \
; \
else \
#define dgERROR \
if (!dgDEBUGFLOW.outputbuffer.good()) \
; \
else \
dgERRORFLOW.outputbuffer << dgPREERROR
#define dgDEBUGF \
if (!dgDEBUGFLOW.outputbuffer.good()) \
; \
else \
#define dgDEBUGF \
if (!dgDEBUGFLOW.outputbuffer.good()) \
; \
else \
dgDEBUGFLOW.pre(dgDEBUGFLOW.tmpbuffer << dgPREDEBUG, VP_DEBUG_MODE).trace
#define dgERRORF \
if (!dgDEBUGFLOW.outputbuffer.good()) \
; \
else \
#define dgERRORF \
if (!dgDEBUGFLOW.outputbuffer.good()) \
; \
else \
dgERRORFLOW.pre(dgERRORFLOW.tmpbuffer << dgPREERROR).trace
// TEMPLATE
#define dgTDEBUG(level) \
if ((level > VP_TEMPLATE_DEBUG_MODE) || (!dgDEBUGFLOW.outputbuffer.good())) \
; \
else \
#define dgTDEBUG(level) \
if ((level > VP_TEMPLATE_DEBUG_MODE) || (!dgDEBUGFLOW.outputbuffer.good())) \
; \
else \
dgDEBUGFLOW.outputbuffer << dgPREDEBUG
#define dgTDEBUGF \
if (!dgDEBUGFLOW.outputbuffer.good()) \
; \
else \
dgDEBUGFLOW \
.pre(dgDEBUGFLOW.tmpbuffer << dgPREDEBUG, VP_TEMPLATE_DEBUG_MODE) \
#define dgTDEBUGF \
if (!dgDEBUGFLOW.outputbuffer.good()) \
; \
else \
dgDEBUGFLOW \
.pre(dgDEBUGFLOW.tmpbuffer << dgPREDEBUG, VP_TEMPLATE_DEBUG_MODE) \
.trace
inline bool dgDEBUG_ENABLE(const int &level) { return level <= VP_DEBUG_MODE; }
......@@ -151,19 +149,19 @@ inline bool dgTDEBUG_ENABLE(const int &level) {
return level <= VP_TEMPLATE_DEBUG_MODE;
}
#else // VP_DEBUG
#else // VP_DEBUG
#define dgPREERROR \
#define dgPREERROR \
"\t!! " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") :"
#define dgDEBUG(level) \
if (1) \
; \
else \
#define dgDEBUG(level) \
if (1) \
; \
else \
::dynamicgraph::__null_stream()
#define dgDEBUGMUTE \
(level) if (1); \
#define dgDEBUGMUTE \
(level) if (1); \
else ::dynamicgraph::__null_stream()
#define dgERROR dgERRORFLOW.outputbuffer << dgPREERROR
......@@ -183,13 +181,13 @@ inline std::ostream &__null_stream() {
static std::ostream os(NULL);
return os;
}
} // namespace dynamicgraph
} // namespace dynamicgraph
// TEMPLATE
#define dgTDEBUG(level) \
if (1) \
; \
else \
#define dgTDEBUG(level) \
if (1) \
; \
else \
::dynamicgraph::__null_stream()
inline void dgTDEBUGF(const int, const char *, ...) { return; }
......@@ -199,7 +197,7 @@ inline void dgTDEBUGF(const char *, ...) { return; }
#define dgDEBUG_ENABLE(level) false
#define dgTDEBUG_ENABLE(level) false
#endif //! VP_DEBUG
#endif //! VP_DEBUG
#define dgDEBUGIN(level) dgDEBUG(level) << "# In {" << std::endl
......@@ -213,4 +211,4 @@ inline void dgTDEBUGF(const char *, ...) { return; }
#define dgTDEBUGINOUT(level) dgTDEBUG(level) << "# In/Out { }" << std::endl
#endif //! DYNAMIC_GRAPH_DEBUG_HH
#endif //! DYNAMIC_GRAPH_DEBUG_HH
......@@ -6,4 +6,4 @@
#ifndef DYNAMIC_GRAPH_API_H
#define DYNAMIC_GRAPH_API_H
#include <dynamic-graph/config.hh>
#endif //! DYNAMIC_GRAPH_API_H
#endif //! DYNAMIC_GRAPH_API_H
......@@ -34,8 +34,9 @@ inline std::istringstream &operator>>(std::istringstream &iss,
unsigned int _size;
double _dbl_val;
char _ch;
boost::format fmt("Failed to enter %s as vector."
" Reenter as [N](val1,val2,val3,...,valN)");
boost::format fmt(
"Failed to enter %s as vector."
" Reenter as [N](val1,val2,val3,...,valN)");
fmt % iss.str();
if (iss >> _ch && _ch != '[') {
throw ExceptionSignal(ExceptionSignal::GENERIC, fmt.str());
......@@ -52,8 +53,7 @@ inline std::istringstream &operator>>(std::istringstream &iss,
else {
for (unsigned int i = 0; i < _size; i++) {
iss >> _dbl_val;
if (iss.peek() == ',' || iss.peek() == ' ')
iss.ignore();
if (iss.peek() == ',' || iss.peek() == ' ') iss.ignore();
inst(i) = _dbl_val;
}
if (iss >> _ch && _ch != ')')
......@@ -78,17 +78,17 @@ inline std::istringstream &operator>>(std::istringstream &iss,
unsigned int _rowsize;
double _dbl_val;
char _ch;
boost::format fmt("Failed to enter %s as matrix. Reenter as "
"((val11,val12,val13,...,val1N),"
"...,(valM1,valM2,...,valMN))");
boost::format fmt(
"Failed to enter %s as matrix. Reenter as "
"((val11,val12,val13,...,val1N),"
"...,(valM1,valM2,...,valMN))");
MatrixXd _tmp_matrix;
fmt % iss.str();
if (iss >> _ch && _ch != '[') {
throw ExceptionSignal(ExceptionSignal::GENERIC, fmt.str());
} else {
iss >> _rowsize;
if (iss.peek() == ',' || iss.peek() == ' ')
iss.ignore();
if (iss.peek() == ',' || iss.peek() == ' ') iss.ignore();
iss >> _colsize;
if (iss.fail())
throw ExceptionSignal(ExceptionSignal::GENERIC, fmt.str());
......@@ -105,14 +105,12 @@ inline std::istringstream &operator>>(std::istringstream &iss,
throw ExceptionSignal(ExceptionSignal::GENERIC, fmt.str());
for (unsigned int i = 0; i < _colsize; i++) {
iss >> _dbl_val;
if (iss.peek() == ',' || iss.peek() == ' ')
iss.ignore();
if (iss.peek() == ',' || iss.peek() == ' ') iss.ignore();
_tmp_matrix(j, i) = _dbl_val;
}
if (iss >> _ch && _ch != ')')
throw ExceptionSignal(ExceptionSignal::GENERIC, fmt.str());
if (iss.peek() == ',' || iss.peek() == ' ')
iss.ignore();
if (iss.peek() == ',' || iss.peek() == ' ') iss.ignore();
}
if (iss >> _ch && _ch != ')')
throw ExceptionSignal(ExceptionSignal::GENERIC, fmt.str());
......@@ -165,6 +163,6 @@ inline std::istringstream &operator>>(std::istringstream &iss,
return iss;
}
} // namespace Eigen
} // namespace Eigen
#endif // DYNAMIC_GRAPH_EIGEN_IO_H
#endif // DYNAMIC_GRAPH_EIGEN_IO_H
......@@ -8,11 +8,12 @@
namespace dynamicgraph {
template <typename Ent> struct EntityHelper {
template <typename Ent>
struct EntityHelper {
typedef Ent EntityClassName;
// static const std::string CLASS_NAME; TO BE ADDED IN DG DIRECTLY
};
} // namespace dynamicgraph
} // namespace dynamicgraph
#endif // __sot_core_entity_helper_H__
#endif // __sot_core_entity_helper_H__
......@@ -5,20 +5,19 @@
#ifndef DYNAMIC_GRAPH_ENTITY_H
#define DYNAMIC_GRAPH_ENTITY_H
#include <iosfwd>
#include <map>
#include <sstream>
#include <string>
#include <boost/noncopyable.hpp>
#include <dynamic-graph/dynamic-graph-api.h>
#include <dynamic-graph/exception-factory.h>
#include <dynamic-graph/fwd.hh>
#include <dynamic-graph/logger.h>
#include <dynamic-graph/signal-array.h>
#include <dynamic-graph/signal-base.h>
#include <boost/noncopyable.hpp>
#include <dynamic-graph/fwd.hh>
#include <iosfwd>
#include <map>
#include <sstream>
#include <string>
/// \brief Helper macro for entity declaration.
///
/// This macro should be called in the declaration of all entities.
......@@ -36,9 +35,9 @@
/// Caution: you *MUST* call DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN in the
/// associated source file to ensure that the attributes generated by
/// this macro are correctly initialized.
#define DYNAMIC_GRAPH_ENTITY_DECL() \
public: \
virtual const std::string &getClassName() const { return CLASS_NAME; } \
#define DYNAMIC_GRAPH_ENTITY_DECL() \
public: \
virtual const std::string &getClassName() const { return CLASS_NAME; } \
static const std::string CLASS_NAME
namespace dynamicgraph {
......@@ -51,7 +50,7 @@ namespace dynamicgraph {
/// computation graph. To declare a new entity, please see the
/// DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN macro in factory.h.
class DYNAMIC_GRAPH_DLLAPI Entity : private boost::noncopyable {
public:
public:
typedef std::map<std::string, SignalBase<int> *> SignalMap;
typedef std::map<const std::string, command::Command *> CommandMap_t;
......@@ -163,7 +162,7 @@ public:
/// \}
protected:
protected:
void addCommand(const std::string &name, command::Command *command);
void entityRegistration();
......@@ -180,6 +179,6 @@ protected:
DYNAMIC_GRAPH_DLLAPI std::ostream &operator<<(std::ostream &os,
const dynamicgraph::Entity &ent);
} // end of namespace dynamicgraph
} // end of namespace dynamicgraph
#endif //! DYNAMIC_GRAPH_ENTITY_H
#endif //! DYNAMIC_GRAPH_ENTITY_H
......@@ -5,42 +5,47 @@
#ifndef DYNAMIC_GRAPH_EXCEPTION_ABSTRACT_H
#define DYNAMIC_GRAPH_EXCEPTION_ABSTRACT_H
#include <string>
#include <dynamic-graph/dynamic-graph-api.h>
#include <dynamic-graph/fwd.hh>
#include <string>
// Uncomment this macros to have lines parameter on the throw display
// #define DYNAMIC-GRAPH_EXCEPTION_PASSING_PARAM
#define DG_RETHROW \
#define DG_RETHROW \
(const ::dynamicgraph::ExceptionAbstract &err) { throw err; }
#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM
#define DG_THROW \
throw ::dynamicgraph::ExceptionAbstract::Param(__LINE__, __FUNCTION__, \
#define DG_THROW \
throw ::dynamicgraph::ExceptionAbstract::Param(__LINE__, __FUNCTION__, \
__FILE__) +
#else
#define DG_THROW throw
#endif // DYNAMICGRAPH_EXCEPTION_PASSING_PARAM
#endif // DYNAMICGRAPH_EXCEPTION_PASSING_PARAM
namespace dynamicgraph {
/// \ingroup error
///
/// \brief Abstract root class for all dynamic-graph exceptions.
class DYNAMIC_GRAPH_DLLAPI ExceptionAbstract : public std::exception {
public:
public:
/// \ingroup error
///
/// \brief Class owned by exceptions to store error locations.
class Param {
public:
public:
static const int BUFFER_SIZE = 80;
Param(const int &_line, const char *_function, const char *_file);
Param()
: functionPTR(), function(), line(), filePTR(), file(),
pointersSet(false), set(false) {}
: functionPTR(),
function(),
line(),
filePTR(),
file(),
pointersSet(false),
set(false) {}
Param &initCopy(const Param &p);
const char *functionPTR;
......@@ -91,10 +96,10 @@ public:
}
/// \brief Print the error structure.
DYNAMIC_GRAPH_DLLAPI friend std::ostream &
operator<<(std::ostream &os, const ExceptionAbstract &err);
DYNAMIC_GRAPH_DLLAPI friend std::ostream &operator<<(
std::ostream &os, const ExceptionAbstract &err);
protected:
protected:
/// \brief Error code.
/// \sa ErrorCodeEnum
int code;
......@@ -121,12 +126,12 @@ protected:
return e;
}
#endif // DYNAMICGRAPH_EXCEPTION_PASSING_PARAM
#endif // DYNAMICGRAPH_EXCEPTION_PASSING_PARAM
private:
private:
/// \brief Forbid the empty constructor (private).
ExceptionAbstract();
};
} // end of namespace dynamicgraph
} // end of namespace dynamicgraph
#endif //! DYNAMIC_GRAPH_EXCEPTION_ABSTRACT_H
#endif //! DYNAMIC_GRAPH_EXCEPTION_ABSTRACT_H
......@@ -5,18 +5,18 @@
#ifndef DYNAMIC_GRAPH_EXCEPTION_FACTORY_H
#define DYNAMIC_GRAPH_EXCEPTION_FACTORY_H
#include <string>
#include <dynamic-graph/dynamic-graph-api.h>
#include <dynamic-graph/exception-abstract.h>
#include <dynamic-graph/fwd.hh>
#include <string>
namespace dynamicgraph {
/// \ingroup error
///
/// \brief Generic error class.
class DYNAMIC_GRAPH_DLLAPI ExceptionFactory : public ExceptionAbstract {
public:
public:
enum ErrorCodeEnum {
GENERIC = ExceptionAbstract::FACTORY,
UNREFERED_OBJECT,
......@@ -44,6 +44,6 @@ public:
return ExceptionFactory::EXCEPTION_NAME;
}
};
} // end of namespace dynamicgraph
} // end of namespace dynamicgraph
#endif //! DYNAMIC_GRAPH_EXCEPTION_FACTORY_H
#endif //! DYNAMIC_GRAPH_EXCEPTION_FACTORY_H
......@@ -8,6 +8,7 @@
#include <dynamic-graph/dynamic-graph-api.h>
#include <dynamic-graph/exception-abstract.h>
#include <dynamic-graph/fwd.hh>
namespace dynamicgraph {
......@@ -16,7 +17,7 @@ namespace dynamicgraph {
/// \brief Exceptions raised when an error related to signals
/// happen.
class DYNAMIC_GRAPH_DLLAPI ExceptionSignal : public ExceptionAbstract {
public:
public:
enum ErrorCodeEnum {
GENERIC = ExceptionAbstract::SIGNAL,
READWRITE_LOCK,
......@@ -38,6 +39,6 @@ public:
virtual const std::string &getExceptionName() const { return EXCEPTION_NAME; }
};
} // end of namespace dynamicgraph
} // end of namespace dynamicgraph
#endif //! DYNAMIC_GRAPH_EXCEPTION_SIGNAL_H
#endif //! DYNAMIC_GRAPH_EXCEPTION_SIGNAL_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment