File indexing completed on 2024-04-06 12:11:32
0001 #ifndef Fireworks_Core_FWModelChangeManager_h
0002 #define Fireworks_Core_FWModelChangeManager_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include "sigc++/signal.h"
0023 #include <set>
0024
0025
0026 #include "Fireworks/Core/interface/FWModelId.h"
0027 #include "Fireworks/Core/interface/FWModelChangeSignal.h"
0028 #include "Fireworks/Core/interface/FWItemChangeSignal.h"
0029
0030
0031 class FWEventItem;
0032
0033 class FWModelChangeManager {
0034 public:
0035 FWModelChangeManager();
0036 virtual ~FWModelChangeManager();
0037
0038
0039
0040
0041
0042
0043
0044 void beginChanges();
0045 void changed(const FWModelId&);
0046 void changed(const FWEventItem*);
0047 void endChanges();
0048
0049 sigc::signal<void()> changeSignalsAreComing_;
0050 sigc::signal<void()> changeSignalsAreDone_;
0051
0052 void newItemSlot(FWEventItem*);
0053 void itemsGoingToBeClearedSlot(void);
0054
0055 FWModelChangeManager(const FWModelChangeManager&) = delete;
0056
0057 const FWModelChangeManager& operator=(const FWModelChangeManager&) = delete;
0058
0059 private:
0060
0061 unsigned int m_depth;
0062 std::vector<FWModelIds> m_changes;
0063 std::set<const FWEventItem*> m_itemChanges;
0064 std::vector<FWModelChangeSignal> m_changeSignals;
0065 std::vector<FWItemChangeSignal> m_itemChangeSignals;
0066 };
0067
0068 class FWChangeSentry {
0069 public:
0070 FWChangeSentry(FWModelChangeManager& iM) : m_manager(&iM) { m_manager->beginChanges(); }
0071 ~FWChangeSentry() { m_manager->endChanges(); }
0072
0073 private:
0074 FWModelChangeManager* m_manager;
0075 };
0076
0077 #endif