Skip to content

Commit

Permalink
Styled the code with clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoferigo committed Feb 25, 2018
1 parent 7e17667 commit fe4be7d
Show file tree
Hide file tree
Showing 55 changed files with 1,120 additions and 791 deletions.
108 changes: 108 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
Language: Cpp
# BasedOnStyle: WebKit
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: false
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: false
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
...
5 changes: 3 additions & 2 deletions toolbox/include/DiscreteFilter.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Block.h"
#include <memory>
#include <string>
#include <vector>
#include <memory>

#ifndef WBT_FILTER_H
#define WBT_FILTER_H
Expand All @@ -22,7 +22,8 @@ namespace yarp {
}
} // namespace yarp

class wbt::DiscreteFilter : public wbt::Block {
class wbt::DiscreteFilter : public wbt::Block
{
private:
unsigned inputSignalWidth;
std::unique_ptr<iCub::ctrl::IFilter> filter;
Expand Down
4 changes: 2 additions & 2 deletions toolbox/include/DotJNu.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#define WBT_DOTJDOTQ_H

#include "WBBlock.h"
#include <memory>
#include <iDynTree/Model/Indices.h>
#include <iDynTree/Core/VectorFixSize.h>
#include <iDynTree/Model/Indices.h>
#include <memory>

namespace wbt {
class DotJNu;
Expand Down
2 changes: 1 addition & 1 deletion toolbox/include/ForwardKinematics.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define WBT_FORWARDKINEMATICS_H

#include "WBBlock.h"
#include <memory>
#include <iDynTree/Model/Indices.h>
#include <memory>

namespace wbt {
class ForwardKinematics;
Expand Down
14 changes: 7 additions & 7 deletions toolbox/include/GetLimits.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
namespace wbt {
class GetLimits;
struct Limit;
}
} // namespace wbt

struct wbt::Limit
{
std::vector<double> min;
std::vector<double> max;
std::vector<double> min;
std::vector<double> max;

Limit(unsigned size = 0)
: min(size)
, max(size)
{}
Limit(unsigned size = 0)
: min(size)
, max(size)
{}
};

class wbt::GetLimits : public wbt::WBBlock
Expand Down
6 changes: 3 additions & 3 deletions toolbox/include/GetMeasurement.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

namespace wbt {
class GetMeasurement;
enum MeasuredType {
enum MeasuredType
{
MEASUREMENT_JOINT_POS,
MEASUREMENT_JOINT_VEL,
MEASUREMENT_JOINT_ACC,
ESTIMATE_JOINT_TORQUE
};
}

} // namespace wbt

class wbt::GetMeasurement : public wbt::WBBlock
{
Expand Down
7 changes: 3 additions & 4 deletions toolbox/include/InverseDynamics.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define WBT_INVERSEDYNAMICS_H

#include "WBBlock.h"
#include <memory>
#include <iDynTree/Core/VectorFixSize.h>
#include <memory>

namespace wbt {
class InverseDynamics;
Expand All @@ -12,12 +12,12 @@ namespace wbt {
namespace iDynTree {
class VectorDynSize;
class FreeFloatingGeneralizedTorques;
}
} // namespace iDynTree

class wbt::InverseDynamics : public wbt::WBBlock
{
private:
std::unique_ptr<iDynTree::Vector6> m_baseAcceleration;
std::unique_ptr<iDynTree::Vector6> m_baseAcceleration;
std::unique_ptr<iDynTree::VectorDynSize> m_jointsAcceleration;

// Output
Expand All @@ -43,7 +43,6 @@ class wbt::InverseDynamics : public wbt::WBBlock
bool initialize(const BlockInformation* blockInfo) override;
bool terminate(const BlockInformation* blockInfo) override;
bool output(const BlockInformation* blockInfo) override;

};

#endif /* WBT_INVERSEDYNAMICS_H */
16 changes: 7 additions & 9 deletions toolbox/include/InverseKinematics.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,22 @@ namespace wbt {
class InverseKinematics;
}

class wbt::InverseKinematics : public wbt::WBIModelBlock {
class wbt::InverseKinematics : public wbt::WBIModelBlock
{

struct InverseKinematicsPimpl;
InverseKinematicsPimpl *m_piml;
InverseKinematicsPimpl* m_piml;

public:
static std::string ClassName;
InverseKinematics();

virtual unsigned numberOfParameters();
virtual bool configureSizeAndPorts(BlockInformation *blockInfo, wbt::Error *error);
virtual bool configureSizeAndPorts(BlockInformation* blockInfo, wbt::Error* error);

virtual bool initialize(BlockInformation *blockInfo, wbt::Error *error);
virtual bool terminate(BlockInformation *blockInfo, wbt::Error *error);
virtual bool output(BlockInformation *blockInfo, wbt::Error *error);


virtual bool initialize(BlockInformation* blockInfo, wbt::Error* error);
virtual bool terminate(BlockInformation* blockInfo, wbt::Error* error);
virtual bool output(BlockInformation* blockInfo, wbt::Error* error);
};


#endif /* end of include guard: WBT_INVERSEKINEMATICS_H */
2 changes: 1 addition & 1 deletion toolbox/include/Jacobian.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define WBT_JACOBIAN_H

#include "WBBlock.h"
#include <memory>
#include <iDynTree/Model/Indices.h>
#include <memory>

namespace wbt {
class Jacobian;
Expand Down
24 changes: 12 additions & 12 deletions toolbox/include/MinimumJerkTrajectoryGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@
namespace wbt {
class MinimumJerkTrajectoryGenerator;
class BlockInformation;
}
} // namespace wbt

namespace iCub {
namespace ctrl {
class minJerkTrajGen;
}
}
} // namespace iCub

namespace yarp {
namespace sig {
class Vector;
}
}
} // namespace yarp

class wbt::MinimumJerkTrajectoryGenerator : public wbt::Block {
class wbt::MinimumJerkTrajectoryGenerator : public wbt::Block
{
public:
static const std::string ClassName;

Expand All @@ -35,7 +36,6 @@ class wbt::MinimumJerkTrajectoryGenerator : public wbt::Block {
bool output(const BlockInformation* blockInfo) override;

private:

std::unique_ptr<iCub::ctrl::minJerkTrajGen> m_generator;

int m_outputFirstDerivativeIndex;
Expand All @@ -50,15 +50,15 @@ class wbt::MinimumJerkTrajectoryGenerator : public wbt::Block {
std::unique_ptr<yarp::sig::Vector> m_initialValues;
std::unique_ptr<yarp::sig::Vector> m_reference;

static const unsigned PARAM_IDX_SAMPLE_TIME; // Sample Time (double)
static const unsigned PARAM_IDX_SETTLING_TIME; // Settling Time (double)
static const unsigned PARAM_IDX_SAMPLE_TIME; // Sample Time (double)
static const unsigned PARAM_IDX_SETTLING_TIME; // Settling Time (double)
static const unsigned PARAM_IDX_OUTPUT_1ST_DERIVATIVE; // Output first derivative (boolean)
static const unsigned PARAM_IDX_OUTPUT_2ND_DERIVATIVE; // Output second derivative (boolean)
static const unsigned PARAM_IDX_INITIAL_VALUE; // Initial signal value as input (boolean)
static const unsigned PARAM_IDX_EXT_SETTLINGTIME; // Control if the settling time comes from
// external port or static parameter
static const unsigned PARAM_IDX_RESET_CHANGEST; // True if the block should reset the traj
// generator in case settling time changes
static const unsigned PARAM_IDX_INITIAL_VALUE; // Initial signal value as input (boolean)
static const unsigned PARAM_IDX_EXT_SETTLINGTIME; // Control if the settling time comes from
// external port or static parameter
static const unsigned PARAM_IDX_RESET_CHANGEST; // True if the block should reset the traj
// generator in case settling time changes
};

#endif /* end of include guard: WBT_MINJERKTRAJGENERATOR_H */
4 changes: 2 additions & 2 deletions toolbox/include/ModelPartitioner.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef WBT_MODELPARTITIONER_H
#define WBT_MODELPARTITIONER_H

#include "WBBlock.h"
#include "RobotInterface.h"
#include <vector>
#include "WBBlock.h"
#include <memory>
#include <vector>

namespace wbt {
class ModelPartitioner;
Expand Down
18 changes: 8 additions & 10 deletions toolbox/include/RemoteInverseKinematics.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,25 @@
namespace wbt {
class RemoteInverseKinematics;
class BlockInformation;
}
} // namespace wbt

class wbt::RemoteInverseKinematics : public wbt::Block {
class wbt::RemoteInverseKinematics : public wbt::Block
{

struct RemoteInverseKinematicsPimpl;
RemoteInverseKinematicsPimpl *m_piml;
RemoteInverseKinematicsPimpl* m_piml;

public:
static std::string ClassName;
RemoteInverseKinematics();

virtual unsigned numberOfParameters();
virtual unsigned numberOfDiscreteStates();
virtual bool configureSizeAndPorts(BlockInformation *blockInfo, wbt::Error *error);
virtual bool configureSizeAndPorts(BlockInformation* blockInfo, wbt::Error* error);

virtual bool initialize(BlockInformation *blockInfo, wbt::Error *error);
virtual bool terminate(BlockInformation *blockInfo, wbt::Error *error);
virtual bool output(BlockInformation *blockInfo, wbt::Error *error);


virtual bool initialize(BlockInformation* blockInfo, wbt::Error* error);
virtual bool terminate(BlockInformation* blockInfo, wbt::Error* error);
virtual bool output(BlockInformation* blockInfo, wbt::Error* error);
};


#endif /* end of include guard: REMOTEINVERSEKINEMATICS_H */
7 changes: 4 additions & 3 deletions toolbox/include/SetLowLevelPID.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@

namespace wbt {
class SetLowLevelPID;
enum PidDataIndex {
enum PidDataIndex
{
PGAIN = 0,
IGAIN = 1,
DGAIN = 2
};
typedef std::tuple<double, double, double> PidData;
}
} // namespace wbt

namespace yarp {
namespace dev {
class Pid;
}
}
} // namespace yarp

class wbt::SetLowLevelPID : public wbt::WBBlock
{
Expand Down
Loading

0 comments on commit fe4be7d

Please sign in to comment.