CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/Fireworks/Core/interface/FWModelChangeManager.h

Go to the documentation of this file.
00001 #ifndef Fireworks_Core_FWModelChangeManager_h
00002 #define Fireworks_Core_FWModelChangeManager_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Core
00006 // Class  :     FWModelChangeManager
00007 //
00016 //
00017 // Original Author:  Chris Jones
00018 //         Created:  Thu Jan 17 17:37:49 EST 2008
00019 // $Id: FWModelChangeManager.h,v 1.6 2010/05/27 08:39:34 eulisse Exp $
00020 //
00021 
00022 // system include files
00023 #include "sigc++/signal.h"
00024 #include <set>
00025 
00026 // user include files
00027 #include "Fireworks/Core/interface/FWModelId.h"
00028 #include "Fireworks/Core/interface/FWModelChangeSignal.h"
00029 #include "Fireworks/Core/interface/FWItemChangeSignal.h"
00030 
00031 // forward declarations
00032 class FWEventItem;
00033 
00034 class FWModelChangeManager
00035 {
00036 
00037 public:
00038    FWModelChangeManager();
00039    virtual ~FWModelChangeManager();
00040 
00041    // ---------- const member functions ---------------------
00042 
00043    // ---------- static member functions --------------------
00044 
00045    // ---------- member functions ---------------------------
00046 
00047    void beginChanges();
00048    void changed(const FWModelId&);
00049    void changed(const FWEventItem*);
00050    void endChanges();
00051 
00052    sigc::signal<void> changeSignalsAreComing_;
00053    sigc::signal<void> changeSignalsAreDone_;
00054 
00055    void newItemSlot(FWEventItem*);
00056    void itemsGoingToBeClearedSlot(void);
00057 
00058 private:
00059    FWModelChangeManager(const FWModelChangeManager&);    // stop default
00060 
00061    const FWModelChangeManager& operator=(const FWModelChangeManager&);    // stop default
00062 
00063    // ---------- member data --------------------------------
00064    unsigned int m_depth;
00065    std::vector<FWModelIds> m_changes;
00066    std::set<const FWEventItem*> m_itemChanges;
00067    std::vector<FWModelChangeSignal> m_changeSignals;
00068    std::vector<FWItemChangeSignal> m_itemChangeSignals;
00069 };
00070 
00071 class FWChangeSentry {
00072 public:
00073    FWChangeSentry(FWModelChangeManager& iM) :
00074       m_manager(&iM)
00075    {
00076       m_manager->beginChanges();
00077    }
00078    ~FWChangeSentry()
00079    {
00080       m_manager->endChanges();
00081    }
00082 private:
00083    FWModelChangeManager* m_manager;
00084 };
00085 
00086 #endif