From d9f67347ca13fdc5da871432165ee5ad66c6f3ff Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 7 Sep 2015 15:17:47 +0300 Subject: [PATCH] Make reordered event not grouped --- src/Model/Model_Events.cpp | 19 +------------------ src/Model/Model_Events.h | 12 +++--------- src/ModelAPI/ModelAPI_Events.cpp | 2 +- src/ModelAPI/ModelAPI_Events.h | 10 ++-------- 4 files changed, 7 insertions(+), 36 deletions(-) diff --git a/src/Model/Model_Events.cpp b/src/Model/Model_Events.cpp index fb5b650d1..7847f99b1 100644 --- a/src/Model/Model_Events.cpp +++ b/src/Model/Model_Events.cpp @@ -107,15 +107,8 @@ void Model_ObjectDeletedMessage::Join(const std::shared_ptr Model_OrderUpdatedMessage::Model_OrderUpdatedMessage( const std::shared_ptr& theDoc, const std::string& theGroup) : ModelAPI_OrderUpdatedMessage(messageId(), 0), - myDoc(theDoc) + myDoc(theDoc), myGroup(theGroup) { - if (!theGroup.empty()) - myGroups.insert(theGroup); -} - -std::shared_ptr Model_OrderUpdatedMessage::newEmpty() -{ - return std::shared_ptr(new Model_OrderUpdatedMessage(myDoc, "")); } const Events_ID Model_OrderUpdatedMessage::messageId() @@ -123,13 +116,3 @@ const Events_ID Model_OrderUpdatedMessage::messageId() static Events_ID MY_ID = Events_Loop::eventByName(EVENT_ORDER_UPDATED); return MY_ID; } - -void Model_OrderUpdatedMessage::Join(const std::shared_ptr& theJoined) -{ - std::shared_ptr aJoined = - std::dynamic_pointer_cast(theJoined); - std::set::iterator aGIter = aJoined->myGroups.begin(); - for (; aGIter != aJoined->myGroups.end(); aGIter++) { - myGroups.insert(*aGIter); - } -} diff --git a/src/Model/Model_Events.h b/src/Model/Model_Events.h index 7b5ffdce1..97f4170a4 100644 --- a/src/Model/Model_Events.h +++ b/src/Model/Model_Events.h @@ -91,7 +91,7 @@ class Model_ObjectDeletedMessage : public ModelAPI_ObjectDeletedMessage class Model_OrderUpdatedMessage : public ModelAPI_OrderUpdatedMessage { std::shared_ptr myDoc; ///< document owner of the feature - std::set myGroups; ///< group identifiers that contained the deleted feature + std::string myGroup; ///< group identifier that contained the deleted feature /// Use ModelAPI for creation of this event. Model_OrderUpdatedMessage(const std::shared_ptr& theDoc, @@ -106,19 +106,13 @@ class Model_OrderUpdatedMessage : public ModelAPI_OrderUpdatedMessage } /// Returns the group where the objects were reordered - virtual const std::set& groups() const + virtual const std::string& group() const { - return myGroups; + return myGroup; } - /// Returns the new empty message of this type - virtual std::shared_ptr newEmpty(); - /// Returns the identifier of this message virtual const Events_ID messageId(); - - /// Appends to this message the given one - virtual void Join(const std::shared_ptr& theJoined); }; #endif diff --git a/src/ModelAPI/ModelAPI_Events.cpp b/src/ModelAPI/ModelAPI_Events.cpp index 06068c8b6..85c6c02b7 100644 --- a/src/ModelAPI/ModelAPI_Events.cpp +++ b/src/ModelAPI/ModelAPI_Events.cpp @@ -36,7 +36,7 @@ ModelAPI_ObjectDeletedMessage::~ModelAPI_ObjectDeletedMessage() ModelAPI_OrderUpdatedMessage::ModelAPI_OrderUpdatedMessage(const Events_ID theID, const void* theSender) - : Events_MessageGroup(theID, theSender) + : Events_Message(theID, theSender) { } diff --git a/src/ModelAPI/ModelAPI_Events.h b/src/ModelAPI/ModelAPI_Events.h index ae84e6cbc..ef253f5be 100644 --- a/src/ModelAPI/ModelAPI_Events.h +++ b/src/ModelAPI/ModelAPI_Events.h @@ -101,7 +101,7 @@ public: }; /// Message that order changed (used for Object Browser update) -class MODELAPI_EXPORT ModelAPI_OrderUpdatedMessage : public Events_MessageGroup +class MODELAPI_EXPORT ModelAPI_OrderUpdatedMessage : public Events_Message { protected: /// Creates an empty message @@ -114,16 +114,10 @@ public: virtual std::shared_ptr document() const = 0; /// Returns the groups where the objects were reordered - virtual const std::set& groups() const = 0; - - /// Creates the new empty message of this kind - virtual std::shared_ptr newEmpty() = 0; + virtual const std::string& group() const = 0; /// Returns the identifier of the kind of a message virtual const Events_ID messageId() = 0; - - /// Appenad to this message the given one. - virtual void Join(const std::shared_ptr& theJoined) = 0; }; /// Allows to create ModelAPI messages -- 2.39.2