File indexing completed on 2024-04-06 12:11:31
0001 #ifndef Fireworks_Core_FWEventItem_h
0002 #define Fireworks_Core_FWEventItem_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include <string>
0023 #include <vector>
0024 #include "FWCore/Reflection/interface/TypeWithDict.h"
0025 #include <memory>
0026 #include <sigc++/connection.h>
0027
0028
0029 #include "Fireworks/Core/interface/FWDisplayProperties.h"
0030 #include "Fireworks/Core/interface/FWPhysicsObjectDesc.h"
0031 #include "Fireworks/Core/interface/FWModelChangeSignal.h"
0032 #include "Fireworks/Core/interface/FWItemChangeSignal.h"
0033
0034 #include "Fireworks/Core/interface/FWModelFilter.h"
0035 #include "Fireworks/Core/interface/FWItemValueGetter.h"
0036
0037 #include "Fireworks/Core/interface/Context.h"
0038
0039
0040 class TClass;
0041 class FWModelChangeManager;
0042 class FWSelectionManager;
0043 class FWGeometry;
0044 class TVirtualCollectionProxy;
0045 class FWItemAccessorBase;
0046 class FWProxyBuilderConfiguration;
0047 class FWConfiguration;
0048
0049 namespace edm {
0050 class EventBase;
0051 }
0052 namespace fireworks {
0053 class Context;
0054 }
0055
0056 class FWEventItem {
0057 public:
0058 struct ModelInfo {
0059 FWDisplayProperties m_displayProperties;
0060 bool m_isSelected;
0061 ModelInfo(const FWDisplayProperties& iProps, bool iIsSelected)
0062 : m_displayProperties(iProps), m_isSelected(iIsSelected) {}
0063
0064 const FWDisplayProperties& displayProperties() const { return m_displayProperties; }
0065 bool isSelected() const { return m_isSelected; }
0066 };
0067
0068 FWEventItem(fireworks::Context* iContext,
0069 unsigned int iItemId,
0070 std::shared_ptr<FWItemAccessorBase> iAccessor,
0071 const FWPhysicsObjectDesc& iDesc,
0072 const FWConfiguration* pbConf = nullptr);
0073 virtual ~FWEventItem();
0074
0075
0076 #if !defined(__CINT__) && !defined(__MAKECINT__)
0077 template <class T>
0078 void get(const T*& oData) const {
0079 oData = reinterpret_cast<const T*>(data(typeid(T)));
0080 }
0081 #endif
0082 const void* data(const std::type_info&) const;
0083 const FWDisplayProperties& defaultDisplayProperties() const;
0084
0085
0086 int layer() const;
0087
0088 bool isInFront() const;
0089
0090 bool isInBack() const;
0091
0092 const std::string& filterExpression() const;
0093
0094
0095 unsigned int id() const;
0096 const std::string& name() const;
0097 const TClass* type() const;
0098
0099 const std::string& purpose() const;
0100
0101 const std::string& moduleLabel() const;
0102 const std::string& productInstanceLabel() const;
0103 const std::string& processName() const;
0104
0105 const TClass* modelType() const;
0106 ModelInfo modelInfo(int iIndex) const;
0107 size_t size() const;
0108 const void* modelData(int iIndex) const;
0109 std::string modelName(int iIndex) const;
0110
0111
0112 const FWItemValueGetter& valueGetter() const { return m_interestingValueGetter; }
0113 bool haveInterestingValue() const;
0114 const std::string& modelInterestingValueAsString(int iIndex) const;
0115
0116 bool isCollection() const;
0117
0118 void resetColor();
0119
0120
0121 const fireworks::Context& context() const { return *m_context; }
0122
0123 FWModelChangeManager* changeManager() const { return m_context->modelChangeManager(); }
0124 FWSelectionManager* selectionManager() const { return m_context->selectionManager(); }
0125
0126 FWColorManager* colorManager() const { return m_context->colorManager(); }
0127
0128 bool hasEvent() const { return nullptr != m_event; }
0129
0130
0131 const edm::EventBase* getEvent() const { return m_event; }
0132
0133
0134 bool hasError() const;
0135
0136 const std::string& errorMessage() const;
0137
0138
0139
0140 static int minLayerValue();
0141 static int maxLayerValue();
0142
0143
0144 void setEvent(const edm::EventBase* iEvent);
0145
0146 void setData(const edm::ObjectWithDict&) const;
0147
0148 void getPrimaryData() const;
0149 const FWGeometry* getGeom() const;
0150 FWProxyBuilderConfiguration* getConfig() const { return m_proxyBuilderConfig; }
0151
0152 void setLabels(const std::string& iModule, const std::string& iProductInstance, const std::string& iProcess);
0153 void setName(const std::string& iName);
0154 void setDefaultDisplayProperties(const FWDisplayProperties&);
0155
0156 void setFilterExpression(const std::string&);
0157
0158
0159 void selectItem();
0160 void unselectItem();
0161 void toggleSelectItem();
0162 bool itemIsSelected() const;
0163
0164
0165 void moveToFront();
0166 void moveToBack();
0167 void moveToLayer(int layer);
0168
0169 void proxyConfigChanged(bool k = false);
0170
0171 void unselect(int iIndex) const;
0172 void select(int iIndex) const;
0173 void toggleSelect(int iIndex) const;
0174 void setDisplayProperties(int iIndex, const FWDisplayProperties&) const;
0175
0176 void destroy() const;
0177
0178 mutable FWModelChangeSignal changed_;
0179
0180
0181 mutable FWItemChangeSignal itemChanged_;
0182
0183
0184
0185
0186 mutable FWItemChangeSignal preItemChanged_;
0187
0188
0189
0190 mutable FWItemChangeSignal defaultDisplayPropertiesChanged_;
0191
0192
0193 mutable FWItemChangeSignal filterChanged_;
0194
0195
0196
0197 mutable FWItemChangeSignal goingToBeDestroyed_;
0198
0199 private:
0200
0201
0202
0203
0204 void runFilter();
0205 void handleChange();
0206
0207 const fireworks::Context* m_context;
0208 unsigned int m_id;
0209 std::string m_name;
0210 const TClass* m_type;
0211 std::string m_purpose;
0212 std::shared_ptr<FWItemAccessorBase> m_accessor;
0213 FWDisplayProperties m_displayProperties;
0214 int m_layer;
0215 mutable std::vector<ModelInfo> m_itemInfos;
0216
0217
0218 std::string m_moduleLabel;
0219 std::string m_productInstanceLabel;
0220 std::string m_processName;
0221 const edm::EventBase* m_event;
0222 edm::TypeWithDict m_wrapperType;
0223 FWItemValueGetter m_interestingValueGetter;
0224
0225 FWModelFilter m_filter;
0226 mutable bool m_printedErrorThisEvent;
0227 mutable std::string m_errorMessage;
0228
0229 bool m_isSelected;
0230 Color_t m_origColor;
0231
0232 FWProxyBuilderConfiguration* m_proxyBuilderConfig;
0233 };
0234
0235 #endif