SHAPER 9.16.0
Model_Events.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef Model_Events_H_
21#define Model_Events_H_
22
23#include <Model.h>
24#include <ModelAPI_Events.h>
25
26#include <memory>
27
30{
31 public:
33 virtual void sendUpdated(const ObjectPtr& theObject, const Events_ID& theEvent,
34 const bool isGroupped = true) const;
35
37 virtual void sendUpdated(const std::list<ObjectPtr>& theObjects, const Events_ID& theEvent,
38 const bool isGroupped = true) const;
40 virtual void sendDeleted(const std::shared_ptr<ModelAPI_Document>& theDoc,
41 const std::string& theGroup) const;
42
44 virtual void sendReordered(const std::shared_ptr<ModelAPI_Feature>& theReordered) const;
45
48};
49
52{
53 std::set<ObjectPtr> myObjects;
54
57 Model_ObjectUpdatedMessage(const ObjectPtr& theObject, const Events_ID& theEvent);
58
59 friend class Model_EventCreator;
60 public:
61
63 virtual const std::set<ObjectPtr>& objects() const;
64
66 virtual std::shared_ptr<Events_MessageGroup> newEmpty();
67
69 virtual void Join(const std::shared_ptr<Events_MessageGroup>& theJoined);
70};
71
74{
76 std::list<std::pair<std::shared_ptr<ModelAPI_Document>, std::string> > myGroups;
77
79 Model_ObjectDeletedMessage(const std::shared_ptr<ModelAPI_Document>& theDoc,
80 const std::string& theGroup);
81
82 friend class Model_EventCreator;
83 public:
85 virtual const std::list<std::pair<std::shared_ptr<ModelAPI_Document>, std::string> >&
86 groups() const
87 {
88 return myGroups;
89 }
90
92 virtual std::shared_ptr<Events_MessageGroup> newEmpty();
93
95 virtual const Events_ID messageId();
96
98 virtual void Join(const std::shared_ptr<Events_MessageGroup>& theJoined);
99};
100
103{
104 std::shared_ptr<ModelAPI_Feature> myReordered;
105
107 Model_OrderUpdatedMessage(FeaturePtr theReordered,
108 const void* theSender = 0);
109
110 friend class Model_EventCreator;
111 public:
113 virtual std::shared_ptr<ModelAPI_Feature> reordered()
114 {
115 return myReordered;
116 }
117
119 virtual const Events_ID messageId();
120};
121
122#endif
Identifier of the event kind.
Definition: Events_Message.h:36
Allows to create ModelAPI messages.
Definition: ModelAPI_Events.h:201
Message that feature was deleted (used for Object Browser update)
Definition: ModelAPI_Events.h:160
Message that feature was changed (used for Object Browser update): moved, updated and deleted.
Definition: ModelAPI_Events.h:140
Message that order changed (used for Object Browser update)
Definition: ModelAPI_Events.h:184
Allows to create ModelAPI messages.
Definition: Model_Events.h:30
virtual void sendUpdated(const ObjectPtr &theObject, const Events_ID &theEvent, const bool isGroupped=true) const
creates created, updated or moved messages and sends to the loop
Definition: Model_Events.cpp:27
virtual void sendReordered(const std::shared_ptr< ModelAPI_Feature > &theReordered) const
creates reordered message and sends to the loop
Definition: Model_Events.cpp:59
virtual void sendDeleted(const std::shared_ptr< ModelAPI_Document > &theDoc, const std::string &theGroup) const
creates deleted message and sends to the loop
Definition: Model_Events.cpp:51
Model_EventCreator()
must be one per application, the constructor for internal usage only
Definition: Model_Events.cpp:66
Message that feature was deleted (used for Object Browser update)
Definition: Model_Events.h:74
virtual void Join(const std::shared_ptr< Events_MessageGroup > &theJoined)
Appends to this message the given one.
Definition: Model_Events.cpp:126
virtual std::shared_ptr< Events_MessageGroup > newEmpty()
Returns the new empty message of this type.
Definition: Model_Events.cpp:114
virtual const std::list< std::pair< std::shared_ptr< ModelAPI_Document >, std::string > > & groups() const
Returns the group where the objects were deleted.
Definition: Model_Events.h:86
virtual const Events_ID messageId()
Returns the identifier of this message.
Definition: Model_Events.cpp:120
Message that feature was changed (used for Object Browser update): moved, updated and deleted.
Definition: Model_Events.h:52
virtual const std::set< ObjectPtr > & objects() const
Returns the feature that has been updated.
Definition: Model_Events.cpp:81
virtual void Join(const std::shared_ptr< Events_MessageGroup > &theJoined)
Allows to join the given message with the current one.
Definition: Model_Events.cpp:93
virtual std::shared_ptr< Events_MessageGroup > newEmpty()
Creates a new empty group (to store it in the loop before flush)
Definition: Model_Events.cpp:86
Message that feature was deleted (used for Object Browser update)
Definition: Model_Events.h:103
virtual std::shared_ptr< ModelAPI_Feature > reordered()
Returns the document that has been updated.
Definition: Model_Events.h:113
virtual const Events_ID messageId()
Returns the identifier of this message.
Definition: Model_Events.cpp:154