Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:31

0001 // -*- C++ -*-
0002 #ifndef Fireworks_Core_FWEventItemsManager_h
0003 #define Fireworks_Core_FWEventItemsManager_h
0004 //
0005 // Package:     Core
0006 // Class  :     FWEventItemsManager
0007 //
0008 /**\class FWEventItemsManager FWEventItemsManager.h Fireworks/Core/interface/FWEventItemsManager.h
0009 
0010    Description: Manages multiple FWEventItems
0011 
0012    Usage:
0013     <usage>
0014 
0015  */
0016 //
0017 // Original Author:
0018 //         Created:  Thu Jan  3 13:27:29 EST 2008
0019 //
0020 
0021 // system include files
0022 #include <vector>
0023 #include <memory>
0024 #include "sigc++/signal.h"
0025 
0026 // user include files
0027 #include "Fireworks/Core/interface/FWConfigurable.h"
0028 
0029 // forward declarations
0030 namespace edm {
0031   class EventBase;
0032 }
0033 namespace fireworks {
0034   class Context;
0035 }
0036 
0037 class FWEventItem;
0038 class FWPhysicsObjectDesc;
0039 class FWModelChangeManager;
0040 class FWSelectionManager;
0041 class FWItemAccessorFactory;
0042 class FWProxyBuilderConfiguration;
0043 
0044 class FWEventItemsManager : public FWConfigurable {
0045 public:
0046   //does not take ownership of the object to which it points but does keep reference
0047   FWEventItemsManager(FWModelChangeManager*);
0048   ~FWEventItemsManager() override;
0049 
0050   typedef std::vector<FWEventItem*>::const_iterator const_iterator;
0051 
0052   //configuration management interface
0053   void addTo(FWConfiguration&) const override;
0054   void setFrom(const FWConfiguration&) override;
0055 
0056   // ---------- const member functions ---------------------
0057   ///NOTE: iterator is allowed to return a null object for items that have been removed
0058   const_iterator begin() const;
0059   const_iterator end() const;
0060   // const std::vector<FWEventItem*> &items () const { return m_items; }
0061 
0062   const FWEventItem* find(const std::string& iName) const;
0063   // ---------- static member functions --------------------
0064 
0065   // ---------- member functions ---------------------------
0066   FWEventItem* add(const FWPhysicsObjectDesc& iItem, const FWConfiguration* pbConf = nullptr, bool doSetEvent = true);
0067   void clearItems();
0068 
0069   void newEvent(const edm::EventBase* iEvent);
0070 
0071   void setContext(fireworks::Context*);
0072 
0073   sigc::signal<void(FWEventItem*)> newItem_;
0074   sigc::signal<void(const FWEventItem*)> removingItem_;
0075   sigc::signal<void()> goingToClearItems_;
0076 
0077   FWEventItemsManager(const FWEventItemsManager&) = delete;  // stop default
0078 
0079   const FWEventItemsManager& operator=(const FWEventItemsManager&) = delete;  // stop default
0080 
0081 private:
0082   void removeItem(const FWEventItem*);
0083 
0084   // ---------- member data --------------------------------
0085   std::vector<FWEventItem*> m_items;
0086   FWModelChangeManager* m_changeManager;
0087   fireworks::Context* m_context;
0088 
0089   const edm::EventBase* m_event;
0090   std::shared_ptr<FWItemAccessorFactory> m_accessorFactory;
0091 };
0092 
0093 #endif