Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-14 11:45:01

0001 #ifndef Fireworks_Core_FWModelChangeManager_h
0002 #define Fireworks_Core_FWModelChangeManager_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Core
0006 // Class  :     FWModelChangeManager
0007 //
0008 /**\class FWModelChangeManager FWModelChangeManager.h Fireworks/Core/interface/FWModelChangeManager.h
0009 
0010    Description: Manages propagating announcements of changes to Models to any interested party
0011 
0012    Usage:
0013     <usage>
0014 
0015  */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Thu Jan 17 17:37:49 EST 2008
0019 //
0020 
0021 // system include files
0022 #include "sigc++/signal.h"
0023 #include <set>
0024 
0025 // user include files
0026 #include "Fireworks/Core/interface/FWModelId.h"
0027 #include "Fireworks/Core/interface/FWModelChangeSignal.h"
0028 #include "Fireworks/Core/interface/FWItemChangeSignal.h"
0029 
0030 // forward declarations
0031 class FWEventItem;
0032 
0033 class FWModelChangeManager {
0034 public:
0035   FWModelChangeManager();
0036   virtual ~FWModelChangeManager();
0037 
0038   // ---------- const member functions ---------------------
0039 
0040   // ---------- static member functions --------------------
0041 
0042   // ---------- member functions ---------------------------
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;  // stop default
0056 
0057   const FWModelChangeManager& operator=(const FWModelChangeManager&) = delete;  // stop default
0058 
0059 private:
0060   // ---------- member data --------------------------------
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