Skip to content

Commit

Permalink
Fix issues found by clang + clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkewley committed Aug 1, 2024
1 parent c0acb4a commit 18567e8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,43 @@ namespace osc::mow
}
};

class IdentityMeshWarpingStrategy final : public MeshWarpingStrategy {};
class ProduceErrorMeshWarpingStrategy final : public MeshWarpingStrategy {};
class IdentityMeshWarpingStrategy final : public MeshWarpingStrategy {
OpenSim_DECLARE_CONCRETE_OBJECT(IdentityMeshWarpingStrategy, MeshWarpingStrategy);
private:
std::unique_ptr<ComponentWarpingStrategy> implClone() const final
{
return std::make_unique<IdentityMeshWarpingStrategy>(*this);
}

std::vector<WarpDetail> implWarpDetails() const final
{
return {};
}

std::unique_ptr<IComponentWarper> implCreateWarper(const OpenSim::Model&, const OpenSim::Component&) final
{
return std::make_unique<IdentityComponentWarper>();
}
};

class ProduceErrorMeshWarpingStrategy final : public MeshWarpingStrategy {
OpenSim_DECLARE_CONCRETE_OBJECT(ProduceErrorMeshWarpingStrategy, MeshWarpingStrategy);
private:
std::unique_ptr<ComponentWarpingStrategy> implClone() const final
{
return std::make_unique<ProduceErrorMeshWarpingStrategy>(*this);
}

std::vector<WarpDetail> implWarpDetails() const final
{
return {};
}

std::unique_ptr<IComponentWarper> implCreateWarper(const OpenSim::Model&, const OpenSim::Component&) final
{
return std::make_unique<ExceptionThrowingComponentWarper>("ProduceErrorMeshWarpingStrategy: TODO: configuration-customizable error message");
}
};

// a configuration object that associatively stores a sequence of
// `ComponentWarpingStrategy`s that can be associatively matched
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ namespace

static_assert(StrategyMatchQuality::none() < StrategyMatchQuality::wildcard());
static_assert(StrategyMatchQuality::wildcard() < StrategyMatchQuality::exact());
static_assert(static_cast<bool>(StrategyMatchQuality::none()) == false);
static_assert(static_cast<bool>(StrategyMatchQuality::wildcard()) == true);
static_assert(static_cast<bool>(StrategyMatchQuality::exact()) == true);
static_assert(not static_cast<bool>(StrategyMatchQuality::none()));
static_assert(static_cast<bool>(StrategyMatchQuality::wildcard()));
static_assert(static_cast<bool>(StrategyMatchQuality::exact()));

TEST(RuntimeWarpParameters, ConstructedWithBlendFactorMakesGetBlendFactorReturnTheBlendFactor)
{
Expand Down Expand Up @@ -246,7 +246,7 @@ TEST(ModelWarperConfiguration, finalizeFromPropertiesDoesNotThrowWhenGivenConfig
TEST(ModelWarperConfiguration, MatchingAnOffsetFrameStrategyToExactPathWorksAsExpected)
{
OpenSim::Model model;
OpenSim::PhysicalOffsetFrame& pof = AddComponent<OpenSim::PhysicalOffsetFrame>(
auto& pof = AddComponent<OpenSim::PhysicalOffsetFrame>(
model,
"someoffsetframe",
model.getGround(),
Expand All @@ -265,7 +265,7 @@ TEST(ModelWarperConfiguration, MatchingAnOffsetFrameStrategyToExactPathWorksAsEx
TEST(ModelWarperConfiguration, MatchingAnOffsetFrameStrategyToWildcardWorksAsExpected)
{
OpenSim::Model model;
OpenSim::PhysicalOffsetFrame& pof = AddComponent<OpenSim::PhysicalOffsetFrame>(
auto& pof = AddComponent<OpenSim::PhysicalOffsetFrame>(
model,
"someoffsetframe",
model.getGround(),
Expand All @@ -284,7 +284,7 @@ TEST(ModelWarperConfiguration, MatchingAnOffsetFrameStrategyToWildcardWorksAsExp
TEST(ModelWarperConfiguration, MatchesExactlyEvenIfWildcardMatchIsAlsoPresent)
{
OpenSim::Model model;
OpenSim::PhysicalOffsetFrame& pof = AddComponent<OpenSim::PhysicalOffsetFrame>(
auto& pof = AddComponent<OpenSim::PhysicalOffsetFrame>(
model,
"someoffsetframe",
model.getGround(),
Expand All @@ -304,7 +304,7 @@ TEST(ModelWarperConfiguration, MatchesExactlyEvenIfWildcardMatchIsAlsoPresent)
TEST(ModelWarperConfiguration, MatchesWildcardIfInvalidPathPresent)
{
OpenSim::Model model;
OpenSim::PhysicalOffsetFrame& pof = AddComponent<OpenSim::PhysicalOffsetFrame>(
auto& pof = AddComponent<OpenSim::PhysicalOffsetFrame>(
model,
"someoffsetframe",
model.getGround(),
Expand All @@ -324,7 +324,7 @@ TEST(ModelWarperConfiguration, MatchesWildcardIfInvalidPathPresent)
TEST(ModelWarperConfiguration, MatchesMoreSpecificStrategyWhenTwoStrategiesAreAvailable)
{
OpenSim::Model model;
OpenSim::PhysicalOffsetFrame& pof = AddComponent<OpenSim::PhysicalOffsetFrame>(
auto& pof = AddComponent<OpenSim::PhysicalOffsetFrame>(
model,
"someoffsetframe",
model.getGround(),
Expand Down Expand Up @@ -357,7 +357,7 @@ TEST(ModelWarperConfiguration, MatchesMoreSpecificStrategyWhenTwoStrategiesAreAv
TEST(ModelWarperConfiguration, tryMatchStrategyDoesNotThrowIfTwoWildcardsForDifferentTargetsMatch)
{
OpenSim::Model model;
OpenSim::PhysicalOffsetFrame& pof = AddComponent<OpenSim::PhysicalOffsetFrame>(
auto& pof = AddComponent<OpenSim::PhysicalOffsetFrame>(
model,
"someoffsetframe",
model.getGround(),
Expand Down

0 comments on commit 18567e8

Please sign in to comment.