FWEventItemsManager

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
// -*- C++ -*-
#ifndef Fireworks_Core_FWEventItemsManager_h
#define Fireworks_Core_FWEventItemsManager_h
//
// Package:     Core
// Class  :     FWEventItemsManager
//
/**\class FWEventItemsManager FWEventItemsManager.h Fireworks/Core/interface/FWEventItemsManager.h

   Description: Manages multiple FWEventItems

   Usage:
    <usage>

 */
//
// Original Author:
//         Created:  Thu Jan  3 13:27:29 EST 2008
//

// system include files
#include <vector>
#include <memory>
#include "sigc++/signal.h"

// user include files
#include "Fireworks/Core/interface/FWConfigurable.h"

// forward declarations
namespace edm {
  class EventBase;
}
namespace fireworks {
  class Context;
}

class FWEventItem;
class FWPhysicsObjectDesc;
class FWModelChangeManager;
class FWSelectionManager;
class FWItemAccessorFactory;
class FWProxyBuilderConfiguration;

class FWEventItemsManager : public FWConfigurable {
public:
  //does not take ownership of the object to which it points but does keep reference
  FWEventItemsManager(FWModelChangeManager*);
  ~FWEventItemsManager() override;

  typedef std::vector<FWEventItem*>::const_iterator const_iterator;

  //configuration management interface
  void addTo(FWConfiguration&) const override;
  void setFrom(const FWConfiguration&) override;

  // ---------- const member functions ---------------------
  ///NOTE: iterator is allowed to return a null object for items that have been removed
  const_iterator begin() const;
  const_iterator end() const;
  // const std::vector<FWEventItem*> &items () const { return m_items; }

  const FWEventItem* find(const std::string& iName) const;
  // ---------- static member functions --------------------

  // ---------- member functions ---------------------------
  FWEventItem* add(const FWPhysicsObjectDesc& iItem, const FWConfiguration* pbConf = nullptr, bool doSetEvent = true);
  void clearItems();

  void newEvent(const edm::EventBase* iEvent);

  void setContext(fireworks::Context*);

  sigc::signal<void(FWEventItem*)> newItem_;
  sigc::signal<void(const FWEventItem*)> removingItem_;
  sigc::signal<void()> goingToClearItems_;

  FWEventItemsManager(const FWEventItemsManager&) = delete;  // stop default

  const FWEventItemsManager& operator=(const FWEventItemsManager&) = delete;  // stop default

private:
  void removeItem(const FWEventItem*);

  // ---------- member data --------------------------------
  std::vector<FWEventItem*> m_items;
  FWModelChangeManager* m_changeManager;
  fireworks::Context* m_context;

  const edm::EventBase* m_event;
  std::shared_ptr<FWItemAccessorFactory> m_accessorFactory;
};

#endif