Skip to content

Commit

Permalink
Part/Toponaming: Move new functions to anonymous namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
chennes committed Jan 12, 2024
1 parent b900c9b commit 57bebb0
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/Mod/Part/App/TopoShapeExpansion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,23 +200,13 @@ std::vector<TopoDS_Shape> TopoShape::findAncestorsShapes(const TopoDS_Shape& sub
return shapes;
}


// inline void ThrowOnNullShape()
//{
// The following lines should be used for now to replace the original macros (in the future we can
// refactor to use std::source_location and eliminate the use of the macros entirely).
// FC_THROWM(NullShapeException, "Null shape");
// }

// inline void ThrowOnNullInput()
//{
// FC_THROWM(NullShapeException, "Null input shape");
// }

// inline void WarnOnNullInput()
//{
// FC_WARN("Null input shape"); // NOLINT
// }

// The above methods replace these macros from the original Toponaming branch
//
// The original macros:
// #define HANDLE_NULL_SHAPE _HANDLE_NULL_SHAPE("Null shape",true)
// #define HANDLE_NULL_INPUT _HANDLE_NULL_SHAPE("Null input shape",true)
// #define WARN_NULL_INPUT _HANDLE_NULL_SHAPE("Null input shape",false)
Expand All @@ -241,8 +231,10 @@ bool TopoShape::canMapElement(const TopoShape& other) const
return true;
}

size_t checkSubshapeCount(const TopoShape & topoShape1,
const TopoShape & topoShape2,
namespace
{
size_t checkSubshapeCount(const TopoShape& topoShape1,
const TopoShape& topoShape2,
TopAbs_ShapeEnum elementType)
{
auto count = topoShape1.countSubShapes(elementType);
Expand All @@ -255,6 +247,7 @@ size_t checkSubshapeCount(const TopoShape & topoShape1,
}
return count;
}
}

void TopoShape::setupChild(Data::ElementMap::MappedChildElements &child,
TopAbs_ShapeEnum elementType,
Expand Down Expand Up @@ -300,6 +293,8 @@ void TopoShape::copyElementMap(const TopoShape & topoShape, const char *op)
setMappedChildElements(children);
}

namespace
{
void warnIfLogging()
{
if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
Expand All @@ -312,7 +307,8 @@ void hasherMismatchError()
FC_ERR("hasher mismatch"); // NOLINT
}

void checkAndMatchHasher(TopoShape &topoShape1, const TopoShape &topoShape2)

void checkAndMatchHasher(TopoShape& topoShape1, const TopoShape& topoShape2)
{
if (topoShape1.Hasher) {
if (topoShape2.Hasher != topoShape1.Hasher) {
Expand All @@ -329,6 +325,7 @@ void checkAndMatchHasher(TopoShape &topoShape1, const TopoShape &topoShape2)
topoShape1.Hasher = topoShape2.Hasher;
}
}
}

void TopoShape::mapSubElement(const TopoShape& other, const char* op, bool forceHasher)

Check warning on line 330 in src/Mod/Part/App/TopoShapeExpansion.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

function 'mapSubElement' has cognitive complexity of 81 (threshold 25) [readability-function-cognitive-complexity]
{
Expand Down Expand Up @@ -476,6 +473,8 @@ void TopoShape::mapSubElement(const std::vector<TopoShape>& shapes, const char*
}
}

namespace
{
void addShapesToBuilder(const std::vector<TopoShape>& shapes,
BRep_Builder& builder,
TopoDS_Compound& comp)
Expand All @@ -493,6 +492,7 @@ void addShapesToBuilder(const std::vector<TopoShape>& shapes,
FC_THROWM(NullShapeException, "Null shape");
}
}
}

TopoShape&
TopoShape::makeElementCompound(const std::vector<TopoShape>& shapes, const char* op, bool force)
Expand Down

0 comments on commit 57bebb0

Please sign in to comment.