+bool checkPyDump(const std::string& theFilenameNaming,
+ const std::string& theFilenameGeo,
+ const std::string& theFilenameWeak,
+ const checkDumpType theCheckType)
+{
+ static const std::string anErrorByNaming("checkPythonDump by naming");
+ static const std::string anErrorByGeometry("checkPythonDump by geometry");
+ static const std::string anErrorByWeak("checkPythonDump by weak naming");
+
+#ifdef _DEBUG
+ std::string aFileForNamingDump("./check_dump.py");
+ std::string aFileForGeometryDump("./check_dump_geo.py");
+ std::string aFileForWeakDump("./check_dump_weak.py");
+#else
+ std::string aFileForNamingDump = theFilenameNaming;
+ std::string aFileForGeometryDump = theFilenameGeo;
+ std::string aFileForWeakDump = theFilenameWeak;
+#endif
+
+ SessionPtr aSession = ModelAPI_Session::get();
+ // dump with the specified types
+ std::string aFileName = theCheckType == CHECK_GEOMETRICAL ? aFileForGeometryDump :
+ (theCheckType == CHECK_WEAK ? aFileForWeakDump : aFileForNamingDump);
+ if (!dumpToPython(aSession, aFileName, theCheckType, anErrorByNaming))
+ return false;
+
+ // map from document name to feature name to feature data
+ std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> > aStore;
+ std::string anError = storeFeatures(
+ aSession->moduleDocument()->kind(), aSession->moduleDocument(), aStore, false);
+ if (!anError.empty()) {
+ Events_InfoMessage anErrorMsg(std::string("checkPythonDump"), anError);
+ anErrorMsg.send();
+ return false;
+ }
+
+ bool isOk = true;
+ if (theCheckType & CHECK_NAMING) {
+ // check dump with the selection by names
+ isOk = checkDump(aSession, aFileForNamingDump.c_str(), aStore, anErrorByNaming);
+ }
+ if (theCheckType & CHECK_GEOMETRICAL) {
+ // check dump with the selection by geometry
+ isOk = isOk && checkDump(aSession, aFileForGeometryDump.c_str(), aStore, anErrorByGeometry);
+ }
+ if (theCheckType & CHECK_WEAK) {
+ isOk = isOk && checkDump(aSession, aFileForWeakDump.c_str(), aStore, anErrorByWeak);
+ }
+
+ return isOk;
+}
+