From c123bd018e25e5c9e7ea7081bb2ad7c57511a330 Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 15 Sep 2014 12:24:54 +0400 Subject: [PATCH] Move Events messages to boost pointers: SketchSolver --- src/SketchSolver/SketchSolver_ConstraintManager.cpp | 11 ++++++----- src/SketchSolver/SketchSolver_ConstraintManager.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/SketchSolver/SketchSolver_ConstraintManager.cpp b/src/SketchSolver/SketchSolver_ConstraintManager.cpp index 480fae603..45ead10f9 100644 --- a/src/SketchSolver/SketchSolver_ConstraintManager.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintManager.cpp @@ -59,13 +59,14 @@ SketchSolver_ConstraintManager::~SketchSolver_ConstraintManager() // Class: SketchSolver_Session // Purpose: listen the event loop and process the message // ============================================================================ -void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessage) +void SketchSolver_ConstraintManager::processEvent( + const boost::shared_ptr& theMessage) { if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED) || theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED) || theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_MOVED)) { - const ModelAPI_ObjectUpdatedMessage* anUpdateMsg = - dynamic_cast(theMessage); + boost::shared_ptr anUpdateMsg = + boost::dynamic_pointer_cast(theMessage); std::set aFeatures = anUpdateMsg->objects(); bool isModifiedEvt = theMessage->eventID() @@ -102,8 +103,8 @@ void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessa // Solve the set of constraints resolveConstraints(); } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) { - const ModelAPI_ObjectDeletedMessage* aDeleteMsg = - dynamic_cast(theMessage); + boost::shared_ptr aDeleteMsg = + boost::dynamic_pointer_cast(theMessage); const std::set& aFeatureGroups = aDeleteMsg->groups(); // Find SketchPlugin_Sketch::ID() in groups. The constraint groups should be updated when an object removed from Sketch diff --git a/src/SketchSolver/SketchSolver_ConstraintManager.h b/src/SketchSolver/SketchSolver_ConstraintManager.h index 4101906ab..11e610b63 100644 --- a/src/SketchSolver/SketchSolver_ConstraintManager.h +++ b/src/SketchSolver/SketchSolver_ConstraintManager.h @@ -42,7 +42,7 @@ class SketchSolver_ConstraintManager : public Events_Listener /** \brief Implementation of Event Listener method * \param[in] theMessage the data of the event */ - virtual void processEvent(const Events_Message* theMessage); + virtual void processEvent(const boost::shared_ptr& theMessage); protected: SketchSolver_ConstraintManager(); -- 2.39.2