From: mpv Date: Wed, 12 Dec 2018 14:18:21 +0000 (+0300) Subject: Improve coverage for ModelAPI and Config packages X-Git-Tag: End2018~71 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eff1842480409939adfafb5b39bca801e834aedd;p=modules%2Fshaper.git Improve coverage for ModelAPI and Config packages --- diff --git a/src/Config/Config_PointerMessage.cpp b/src/Config/Config_PointerMessage.cpp index 3c8407876..28bd58bd4 100644 --- a/src/Config/Config_PointerMessage.cpp +++ b/src/Config/Config_PointerMessage.cpp @@ -20,6 +20,7 @@ #include +// LCOV_EXCL_START Config_PointerMessage::Config_PointerMessage(const Events_ID theId, const void* theParent) : Events_Message(theId, theParent), myPointer(0) @@ -41,3 +42,4 @@ void Config_PointerMessage::setPointer(void* pointer) { myPointer = pointer; } +// LCOV_EXCL_STOP diff --git a/src/Config/Config_Translator.cpp b/src/Config/Config_Translator.cpp index 5edd8d3dd..f215213e1 100644 --- a/src/Config/Config_Translator.cpp +++ b/src/Config/Config_Translator.cpp @@ -29,6 +29,7 @@ #pragma warning(disable : 4996) // for sprintf #endif +// LCOV_EXCL_START /** * \class Config_TSReader * \ingroup Config @@ -76,6 +77,7 @@ void Config_TSReader::processNode(xmlNodePtr theNode) myTranslator[aName][aSource] = aTranslat; } } +// LCOV_EXCL_STOP //****************************************************************************** //****************************************************************************** diff --git a/src/Model/Model_Application.cpp b/src/Model/Model_Application.cpp index a5688b66e..6248cf069 100644 --- a/src/Model/Model_Application.cpp +++ b/src/Model/Model_Application.cpp @@ -143,26 +143,6 @@ bool Model_Application::isLoadByDemand(std::string theID, const int theDocIndex) } //======================================================================= -void Model_Application::removeUselessDocuments( - std::list > theUsedDocs) -{ - std::map >::iterator aDoc = myDocs.begin(); - while(aDoc != myDocs.end()) { - bool aFound = false; - std::list >::iterator aUsed = theUsedDocs.begin(); - for(; !aFound && aUsed != theUsedDocs.end(); aUsed++) { - aFound = aDoc->second == *aUsed; - } - if (!aFound) { // remove the useless - aDoc->second->close(); - myDocs.erase(aDoc); - aDoc = myDocs.begin(); - } else { - aDoc++; - } - } -} - int Model_Application::generateDocumentId() { int aResult; diff --git a/src/Model/Model_Application.h b/src/Model/Model_Application.h index b91f69a81..a4e3c5475 100644 --- a/src/Model/Model_Application.h +++ b/src/Model/Model_Application.h @@ -77,9 +77,6 @@ public: void setLoadByDemand(std::string theID, const int theDocID); //! Returns true if specified document must be loaded by demand bool isLoadByDemand(std::string theID, const int theDocIndex); - //! Closes and removes the documents that are not loaded by demand and - //! not in the given list - void removeUselessDocuments(std::list > theUsedDocs); //! produces new unique identifier of the document int generateDocumentId(); diff --git a/src/Model/Model_AttributeRefList.cpp b/src/Model/Model_AttributeRefList.cpp index e6564b60a..4dca9ad93 100644 --- a/src/Model/Model_AttributeRefList.cpp +++ b/src/Model/Model_AttributeRefList.cpp @@ -251,38 +251,6 @@ void Model_AttributeRefList::substitute(const ObjectPtr& theCurrent, const Objec } } -void Model_AttributeRefList::exchange(const ObjectPtr& theObject1, const ObjectPtr& theObject2) -{ - std::shared_ptr aDoc = std::dynamic_pointer_cast( - owner()->document()); - if (aDoc) { - std::shared_ptr aData1 = std::dynamic_pointer_cast(theObject1->data()); - if (aData1.get() && aData1->isValid()) { - TDF_Label aLab1 = aData1->label().Father(); - if (theObject2.get() && theObject2->data()->isValid()) { // the new may be null - std::shared_ptr aData2 = - std::dynamic_pointer_cast(theObject2->data()); - if (aData2.get() && aData2->isValid()) { - eraseHash(); - TDF_Label aLab2 = aData2->label().Father(); - // do the substitution: use the temporary label, as usually in exchange - TDF_Label aTmpLab = aLab1.Root(); - if (myRef->InsertAfter(aTmpLab, aLab1)) { - myRef->Remove(aLab1); - } - if (myRef->InsertAfter(aLab1, aLab2)) { - myRef->Remove(aLab2); - } - if (myRef->InsertAfter(aLab2, aTmpLab)) { - myRef->Remove(aTmpLab); - } - owner()->data()->sendAttributeUpdated(this); - } - } - } - } -} - void Model_AttributeRefList::removeLast() { std::shared_ptr aDoc = std::dynamic_pointer_cast( diff --git a/src/Model/Model_AttributeRefList.h b/src/Model/Model_AttributeRefList.h index da674ff49..9780013ef 100644 --- a/src/Model/Model_AttributeRefList.h +++ b/src/Model/Model_AttributeRefList.h @@ -75,10 +75,6 @@ public: /// Does not support the external documents objects yet. MODEL_EXPORT virtual void substitute(const ObjectPtr& theCurrent, const ObjectPtr& theNew); - /// Substitutes the object by another one and back. So, features will become exchanged in the list - /// Does not support the external documents objects yet. - MODEL_EXPORT virtual void exchange(const ObjectPtr& theObject1, const ObjectPtr& theObject2); - /// Removes the last element in the list. /// Does not support the external documents objects yet. MODEL_EXPORT virtual void removeLast(); diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 6ba5fd910..6b8eaffd0 100755 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -144,6 +144,7 @@ bool Model_Document::isRoot() const return this == Model_Session::get()->moduleDocument().get(); } +// LCOV_EXCL_START /// Makes all modification and generation naming shapes that have old shapes corresponding to /// shapes in a root document be equal to this root document static void updateShapesFromRoot(const TDF_Label theThisAccess, const TDF_Label theRootAccess) @@ -219,6 +220,7 @@ static void updateShapesFromRoot(const TDF_Label theThisAccess, const TDF_Label } } } +// LCOV_EXCL_STOP bool Model_Document::load(const char* theDirName, const char* theFileName, DocumentPtr theThis) { @@ -238,6 +240,7 @@ bool Model_Document::load(const char* theDirName, const char* theFileName, Docum } bool isError = aStatus != PCDM_RS_OK; if (isError) { + // LCOV_EXCL_START switch (aStatus) { case PCDM_RS_UnknownDocument: Events_InfoMessage("Model_Document", "Can not open document").send(); @@ -292,6 +295,7 @@ bool Model_Document::load(const char* theDirName, const char* theFileName, Docum Events_InfoMessage("Model_Document", "Can not open document: unknown error").send(); break; } + // LCOV_EXCL_STOP } std::shared_ptr aSession = std::dynamic_pointer_cast(Model_Session::get()); @@ -949,7 +953,8 @@ void Model_Document::redo() // update the current features status setCurrentFeature(currentFeature(false), false); } - +// this is used for creation of undo/redo1-list by GUI +// LCOV_EXCL_START std::list Model_Document::undoList() const { std::list aResult; @@ -975,6 +980,7 @@ std::list Model_Document::redoList() const } return aResult; } +// LCOV_EXCL_STOP void Model_Document::operationId(const std::string& theId) { @@ -1988,6 +1994,8 @@ bool Model_Document::isLater(FeaturePtr theLater, FeaturePtr theCurrent) const return myObjs->isLater(theLater, theCurrent); } +// Object Browser nodes states +// LCOV_EXCL_START void Model_Document::storeNodesState(const std::list& theStates) { TDF_Label aLab = generalLabel().FindChild(TAG_NODES_STATE); @@ -2013,6 +2021,7 @@ void Model_Document::restoreNodesState(std::list& theStates) const } } } +// LCOV_EXCL_STOP void Model_Document::eraseAllFeatures() { diff --git a/src/Model/Model_ResultField.cpp b/src/Model/Model_ResultField.cpp index 40f7aa5a4..114985176 100644 --- a/src/Model/Model_ResultField.cpp +++ b/src/Model/Model_ResultField.cpp @@ -43,6 +43,7 @@ Model_ResultField::~Model_ResultField() } } +// LCOV_EXCL_START void Model_ResultField::colorConfigInfo(std::string& theSection, std::string& theName, std::string& theDefault) { @@ -50,6 +51,7 @@ void Model_ResultField::colorConfigInfo(std::string& theSection, std::string& th theName = "result_field_color"; theDefault = DEFAULT_COLOR(); } +// LCOV_EXCL_STOP std::shared_ptr Model_ResultField::shape() { @@ -140,7 +142,8 @@ std::string Model_ResultField::textLine(int theLine) const return ""; } - +// used by GUI only +// LCOV_EXCL_START ModelAPI_ResultField::ModelAPI_FieldStep* Model_ResultField::step(int theId) const { if (theId < mySteps.size()) { @@ -148,3 +151,4 @@ ModelAPI_ResultField::ModelAPI_FieldStep* Model_ResultField::step(int theId) con } return NULL; } +// LCOV_EXCL_STOP diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index 5e2ccff5f..4f6828473 100755 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -987,6 +987,8 @@ void Model_Update::executeFeature(FeaturePtr theFeature) redisplayWithResults(theFeature, aState); } +// it is called on GUI edit of feature start +// LCOV_EXCL_START void Model_Update::updateStability(void* theSender) { static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); @@ -1039,6 +1041,7 @@ void Model_Update::updateStability(void* theSender) } } } +// LCOV_EXCL_STOP void Model_Update::updateSelection(const std::set >& theObjects) { diff --git a/src/ModelAPI/ModelAPI_AttributeRefList.h b/src/ModelAPI/ModelAPI_AttributeRefList.h index 27b2427b9..9b326bbe4 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefList.h +++ b/src/ModelAPI/ModelAPI_AttributeRefList.h @@ -69,9 +69,6 @@ class ModelAPI_AttributeRefList : public ModelAPI_Attribute /// Substitutes the object by another one. Does nothing if such object is not found. virtual void substitute(const ObjectPtr& theCurrent, const ObjectPtr& theNew) = 0; - /// Substitutes the object by another one and back. So, features wil become exchanged in the list - virtual void exchange(const ObjectPtr& theObject1, const ObjectPtr& theObject2) = 0; - /// Removes the last element in the list. virtual void removeLast() = 0; diff --git a/src/ModelAPI/ModelAPI_Events.cpp b/src/ModelAPI/ModelAPI_Events.cpp index 0a425d8c2..8ed07b5fb 100644 --- a/src/ModelAPI/ModelAPI_Events.cpp +++ b/src/ModelAPI/ModelAPI_Events.cpp @@ -31,39 +31,29 @@ ModelAPI_ObjectUpdatedMessage::ModelAPI_ObjectUpdatedMessage(const Events_ID theID, const void* theSender) : Events_MessageGroup(theID, theSender) -{ - -} +{} ModelAPI_ObjectUpdatedMessage::~ModelAPI_ObjectUpdatedMessage() -{ - -} +{} ModelAPI_ObjectDeletedMessage::ModelAPI_ObjectDeletedMessage(const Events_ID theID, const void* theSender) : Events_MessageGroup(theID, theSender) -{ - -} +{} ModelAPI_ObjectDeletedMessage::~ModelAPI_ObjectDeletedMessage() -{ - -} +{} ModelAPI_OrderUpdatedMessage::ModelAPI_OrderUpdatedMessage(const Events_ID theID, const void* theSender) : Events_Message(theID, theSender) -{ - -} +{} ModelAPI_OrderUpdatedMessage::~ModelAPI_OrderUpdatedMessage() -{ - -} +{} +// used by GUI only +// LCOV_EXCL_START ModelAPI_FeatureStateMessage::ModelAPI_FeatureStateMessage(const Events_ID theID, const void* theSender) : Events_Message(theID, theSender) @@ -72,9 +62,7 @@ ModelAPI_FeatureStateMessage::ModelAPI_FeatureStateMessage(const Events_ID theID } ModelAPI_FeatureStateMessage::~ModelAPI_FeatureStateMessage() -{ - -} +{} std::shared_ptr ModelAPI_FeatureStateMessage::feature() const { @@ -113,7 +101,7 @@ std::list ModelAPI_FeatureStateMessage::features() const } return result; } - +// LCOV_EXCL_STOP ModelAPI_DocumentCreatedMessage::ModelAPI_DocumentCreatedMessage( const Events_ID theID, const void* theSender) @@ -240,14 +228,10 @@ const std::list >& ModelAPI_ComputePositionsMessage::positio ModelAPI_ObjectRenamedMessage::ModelAPI_ObjectRenamedMessage(const Events_ID theID, const void* theSender) : Events_Message(theID, theSender) -{ - -} +{} ModelAPI_ObjectRenamedMessage::~ModelAPI_ObjectRenamedMessage() -{ - -} +{} void ModelAPI_ObjectRenamedMessage::send(ObjectPtr theObject, const std::string& theOldName, @@ -295,14 +279,10 @@ void ModelAPI_ObjectRenamedMessage::setNewName(const std::string& theNewName) ModelAPI_ReplaceParameterMessage::ModelAPI_ReplaceParameterMessage(const Events_ID theID, const void* theSender) : Events_Message(theID, theSender) -{ - -} +{} ModelAPI_ReplaceParameterMessage::~ModelAPI_ReplaceParameterMessage() -{ - -} +{} void ModelAPI_ReplaceParameterMessage::send(ObjectPtr theObject, const void* theSender) @@ -329,12 +309,10 @@ ModelAPI_SolverFailedMessage::ModelAPI_SolverFailedMessage(const Events_ID theID const void* theSender) : Events_Message(theID, theSender), myDOF(-1) -{ -} +{} ModelAPI_SolverFailedMessage::~ModelAPI_SolverFailedMessage() -{ -} +{} void ModelAPI_SolverFailedMessage::setObjects(const std::set& theObjects) { @@ -350,8 +328,7 @@ const std::set& ModelAPI_SolverFailedMessage::objects() const // ===== ModelAPI_ObjectMovedMessage ===== ModelAPI_ObjectMovedMessage::ModelAPI_ObjectMovedMessage(const void* theSender) : Events_Message(Events_Loop::eventByName(EVENT_OBJECT_MOVED), theSender) -{ -} +{} void ModelAPI_ObjectMovedMessage::setMovedObject(const ObjectPtr& theMovedObject) { diff --git a/src/ModelAPI/ModelAPI_Feature.cpp b/src/ModelAPI/ModelAPI_Feature.cpp index 5f1e3c989..d02bded7f 100644 --- a/src/ModelAPI/ModelAPI_Feature.cpp +++ b/src/ModelAPI/ModelAPI_Feature.cpp @@ -88,15 +88,6 @@ void ModelAPI_Feature::setResult(const std::shared_ptr& theResu theResult->setDisabled(theResult, false); } -void ModelAPI_Feature::removeResult(const std::shared_ptr& theResult) -{ - theResult->setDisabled(theResult, true); - // flush visualization changes - static Events_Loop* aLoop = Events_Loop::loop(); - static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - aLoop->flush(aRedispEvent); -} - void ModelAPI_Feature::eraseResultFromList(const std::shared_ptr& theResult) { std::list >::iterator aResIter = myResults.begin(); @@ -234,6 +225,7 @@ bool ModelAPI_Feature::isDisabled() return myIsDisabled; } +// LCOV_EXCL_START bool ModelAPI_Feature::setStable(const bool theFlag) { if (myIsStable != theFlag) { @@ -247,6 +239,7 @@ bool ModelAPI_Feature::setStable(const bool theFlag) } return false; } +// LCOV_EXCL_STOP bool ModelAPI_Feature::isStable() { diff --git a/src/ModelAPI/ModelAPI_Feature.h b/src/ModelAPI/ModelAPI_Feature.h index 1e44a2b9e..c56376562 100644 --- a/src/ModelAPI/ModelAPI_Feature.h +++ b/src/ModelAPI/ModelAPI_Feature.h @@ -97,8 +97,6 @@ class ModelAPI_Feature : public ModelAPI_Object /// sets the result by index (zero based), results before this must be set before MODELAPI_EXPORT void setResult(const std::shared_ptr& theResult, const int theIndex); - /// removes the result from the feature - MODELAPI_EXPORT void removeResult(const std::shared_ptr& theResult); /// removes all results starting from the given index (zero-based) /// \param theSinceIndex - index of the deleted result and all after also will be deleted /// \param theForever - removes results for long period (not just because of feature disabling) diff --git a/src/ModelAPI/ModelAPI_ResultBody.cpp b/src/ModelAPI/ModelAPI_ResultBody.cpp index 9129f0638..ab0e703e7 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.cpp +++ b/src/ModelAPI/ModelAPI_ResultBody.cpp @@ -116,6 +116,7 @@ void ModelAPI_ResultBody::loadFirstLevel(GeomShapePtr theShape, myBuilder->loadFirstLevel(theShape, theName); } +// LCOV_EXCL_START bool ModelAPI_ResultBody::isConnectedTopology() { if (myConnect == ConnectionNotComputed) { @@ -130,3 +131,4 @@ void ModelAPI_ResultBody::setDisplayed(const bool theDisplay) for (int i = 0; i < numberOfSubs(); i++) subResult(i)->setDisplayed(theDisplay); } +// LCOV_EXCL_STOP diff --git a/src/ModelAPI/ModelAPI_Tools.cpp b/src/ModelAPI/ModelAPI_Tools.cpp index 0b58e5596..9dc5e4e9a 100755 --- a/src/ModelAPI/ModelAPI_Tools.cpp +++ b/src/ModelAPI/ModelAPI_Tools.cpp @@ -119,6 +119,7 @@ const char* toString(ModelAPI_ExecState theExecState) } } +// LCOV_EXCL_START std::string getFeatureError(const FeaturePtr& theFeature) { std::string anError; @@ -159,6 +160,7 @@ std::string getFeatureError(const FeaturePtr& theFeature) return anError; } +// LCOV_EXCL_STOP ObjectPtr objectByName(const DocumentPtr& theDocument, const std::string& theGroup, const std::string& theName)