CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWEventItem.h
Go to the documentation of this file.
1 #ifndef Fireworks_Core_FWEventItem_h
2 #define Fireworks_Core_FWEventItem_h
3 // -*- C++ -*-
4 //
5 // Package: Core
6 // Class : FWEventItem
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Thu Jan 3 14:02:21 EST 2008
19 // $Id: FWEventItem.h,v 1.50 2012/06/26 22:13:03 wmtan Exp $
20 //
21 
22 // system include files
23 #include <string>
24 #include <vector>
25 #include "Reflex/Type.h"
26 #include <boost/shared_ptr.hpp>
27 #include <sigc++/connection.h>
28 
29 // user include files
34 
37 
39 
40 // forward declarations
41 class TClass;
43 class FWSelectionManager;
44 class FWGeometry;
45 class TVirtualCollectionProxy;
46 class FWItemAccessorBase;
48 class FWConfiguration;
49 
50 namespace edm {
51  class EventBase;
52 }
53 namespace fireworks {
54  class Context;
55 }
56 
58 {
59 public:
60  struct ModelInfo {
63  ModelInfo(const FWDisplayProperties& iProps, bool iIsSelected) :
64  m_displayProperties(iProps),
65  m_isSelected(iIsSelected) {
66  }
67 
69  return m_displayProperties;
70  }
71  bool isSelected() const {
72  return m_isSelected;
73  }
74  };
75 
77  unsigned int iItemId,
78  boost::shared_ptr<FWItemAccessorBase> iAccessor,
79  const FWPhysicsObjectDesc& iDesc, const FWConfiguration* pbConf = 0);
80  virtual ~FWEventItem();
81 
82  // ---------- const member functions ---------------------
83 #if !defined(__CINT__) && !defined(__MAKECINT__)
84  template<class T>
85  void get(const T*& oData) const {
86  oData=reinterpret_cast<const T*>(data(typeid(T)));
87  }
88 #endif
89  const void* data(const std::type_info&) const;
91 
93  int layer() const;
95  bool isInFront() const;
97  bool isInBack() const;
98 
99  const std::string& filterExpression() const;
102  unsigned int id() const;
103  const std::string& name() const;
104  const TClass* type() const;
106  const std::string& purpose() const;
107 
108  const std::string& moduleLabel() const;
109  const std::string& productInstanceLabel() const;
110  const std::string& processName() const;
111 
112  const TClass* modelType() const;
113  ModelInfo modelInfo(int iIndex) const; //return copy for now since want to be able to change visibility
114  size_t size() const;
115  const void* modelData(int iIndex) const;
116  std::string modelName(int iIndex) const;
117 
120  bool haveInterestingValue() const;
121  const std::string& modelInterestingValueAsString(int iIndex) const;
122 
123  bool isCollection() const;
124 
125  //convenience methods
126 
127  const fireworks::Context& context () const {
128  return *m_context;
129  }
130 
132  return m_context->modelChangeManager();
133  }
135  return m_context->selectionManager();
136  }
137 
139  return m_context->colorManager();
140  }
141 
142  bool hasEvent() const {
143  return 0 != m_event;
144  }
145 
146  // hackery methods
147  const edm::EventBase *getEvent () const {
148  return m_event;
149  }
150 
151 
153  bool hasError() const;
155  const std::string& errorMessage() const;
156 
157  // ---------- static member functions --------------------
158 
159  static int minLayerValue();
160  static int maxLayerValue();
161 
162  // ---------- member functions ---------------------------
163  void setEvent(const edm::EventBase* iEvent);
164 
165  const FWGeometry* getGeom() const;
167 
168  void setLabels(const std::string& iModule,
169  const std::string& iProductInstance,
170  const std::string& iProcess);
171  void setName(const std::string& iName);
174  void setFilterExpression(const std::string& );
175 
177  void selectItem();
178  void unselectItem();
179  void toggleSelectItem();
180  bool itemIsSelected() const;
181 
183  void moveToFront();
184  void moveToBack();
185  void moveToLayer(int layer);
186 
187  void proxyConfigChanged();
188 
189  void unselect(int iIndex) const;
190  void select(int iIndex) const;
191  void toggleSelect(int iIndex) const;
192  void setDisplayProperties(int iIndex, const FWDisplayProperties&) const;
193 
194  void destroy() const;
197 
200 
205 
209 
212 
216 private:
217  //FWEventItem(const FWEventItem&); // stop default
218 
219  //const FWEventItem& operator=(const FWEventItem&); // stop default
220  void setData(const Reflex::Object& ) const;
221 
222  void getPrimaryData() const;
223  void runFilter();
224  void handleChange();
225  // ---------- member data --------------------------------
227  unsigned int m_id;
228  std::string m_name;
229  const TClass* m_type;
230  std::string m_purpose;
231  boost::shared_ptr<FWItemAccessorBase> m_accessor;
233  int m_layer;
234  mutable std::vector<ModelInfo> m_itemInfos;
235 
236  //This will probably moved to a FWEventItemRetriever class
237  std::string m_moduleLabel;
239  std::string m_processName;
243 
246  mutable std::string m_errorMessage;
247 
249 
250 
252 };
253 
254 
255 #endif
const TClass * m_type
Definition: FWEventItem.h:229
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:166
const FWItemValueGetter & valueGetter() const
one value from the model which is normally used for the popup
Definition: FWEventItem.h:119
FWItemChangeSignal preItemChanged_
Definition: FWEventItem.h:204
const FWDisplayProperties & defaultDisplayProperties() const
Definition: FWEventItem.cc:451
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:131
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:68
void destroy() const
Definition: FWEventItem.cc:608
void moveToBack()
Definition: FWEventItem.cc:334
void moveToFront()
Definition: FWEventItem.cc:311
void setData(const Reflex::Object &) const
Definition: FWEventItem.cc:430
void moveToLayer(int layer)
Definition: FWEventItem.cc:357
std::string modelName(int iIndex) const
Definition: FWEventItem.cc:574
void setEvent(const edm::EventBase *iEvent)
Definition: FWEventItem.cc:121
const std::string & name() const
Definition: FWEventItem.cc:500
FWColorManager * colorManager() const
Definition: FWEventItem.h:138
FWItemValueGetter m_interestingValueGetter
Definition: FWEventItem.h:242
bool isSelected() const
Definition: FWEventItem.h:71
void proxyConfigChanged()
Definition: FWEventItem.cc:369
FWColorManager * colorManager() const
Definition: Context.h:66
void setDisplayProperties(int iIndex, const FWDisplayProperties &) const
Definition: FWEventItem.cc:277
const std::string & filterExpression() const
Definition: FWEventItem.cc:602
FWItemChangeSignal defaultDisplayPropertiesChanged_
Definition: FWEventItem.h:208
bool haveInterestingValue() const
Definition: FWEventItem.cc:587
void getPrimaryData() const
Definition: FWEventItem.cc:443
void unselect(int iIndex) const
Definition: FWEventItem.cc:240
FWItemChangeSignal goingToBeDestroyed_
Definition: FWEventItem.h:215
boost::shared_ptr< FWItemAccessorBase > m_accessor
Definition: FWEventItem.h:231
const fireworks::Context * m_context
Definition: FWEventItem.h:226
bool itemIsSelected() const
Definition: FWEventItem.cc:661
const std::string & processName() const
Definition: FWEventItem.cc:529
void setLabels(const std::string &iModule, const std::string &iProductInstance, const std::string &iProcess)
Definition: FWEventItem.cc:131
std::string m_moduleLabel
Definition: FWEventItem.h:237
static int maxLayerValue()
Definition: FWEventItem.cc:44
const void * data(const std::type_info &) const
Definition: FWEventItem.cc:393
int layer() const
Definition: FWEventItem.cc:457
unsigned int m_id
Definition: FWEventItem.h:227
FWModelFilter m_filter
Definition: FWEventItem.h:244
int iEvent
Definition: GenABIO.cc:243
void setDefaultDisplayProperties(const FWDisplayProperties &)
Definition: FWEventItem.cc:156
const std::string & productInstanceLabel() const
Definition: FWEventItem.cc:523
std::string m_processName
Definition: FWEventItem.h:239
const TClass * type() const
Definition: FWEventItem.cc:506
FWProxyBuilderConfiguration * m_proxyBuilderConfig
Definition: FWEventItem.h:251
const fireworks::Context & context() const
Definition: FWEventItem.h:127
FWItemChangeSignal itemChanged_
Definition: FWEventItem.h:199
unsigned int id() const
Definition: FWEventItem.cc:494
FWSelectionManager * selectionManager() const
Definition: Context.h:58
FWModelChangeManager * modelChangeManager() const
Definition: Context.h:55
const std::string & modelInterestingValueAsString(int iIndex) const
Definition: FWEventItem.cc:594
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:61
static int minLayerValue()
Definition: FWEventItem.cc:39
bool m_printedErrorThisEvent
Definition: FWEventItem.h:245
bool hasError() const
returns true if failed to get data for this event
Definition: FWEventItem.cc:667
FWSelectionManager * selectionManager() const
Definition: FWEventItem.h:134
const edm::EventBase * getEvent() const
Definition: FWEventItem.h:147
void toggleSelect(int iIndex) const
Definition: FWEventItem.cc:265
bool isInBack() const
returns true if item is behind all other items
Definition: FWEventItem.cc:478
size_t size() const
Definition: FWEventItem.cc:548
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:232
void selectItem()
Definition: FWEventItem.cc:632
void handleChange()
Definition: FWEventItem.cc:379
virtual ~FWEventItem()
Definition: FWEventItem.cc:100
bool hasEvent() const
Definition: FWEventItem.h:142
bool isInFront() const
returns true if item is in front of all other items
Definition: FWEventItem.cc:463
void setFilterExpression(const std::string &)
Definition: FWEventItem.cc:200
Reflex::Type m_wrapperType
Definition: FWEventItem.h:241
void unselectItem()
Definition: FWEventItem.cc:641
FWEventItem(fireworks::Context *iContext, unsigned int iItemId, boost::shared_ptr< FWItemAccessorBase > iAccessor, const FWPhysicsObjectDesc &iDesc, const FWConfiguration *pbConf=0)
Definition: FWEventItem.cc:53
const edm::EventBase * m_event
Definition: FWEventItem.h:240
FWModelChangeSignal changed_
Definition: FWEventItem.h:196
std::string m_errorMessage
Definition: FWEventItem.h:246
bool isCollection() const
Definition: FWEventItem.cc:555
const TClass * modelType() const
Definition: FWEventItem.cc:561
const std::string & errorMessage() const
returns error string if there was a problem this event
Definition: FWEventItem.cc:672
std::vector< ModelInfo > m_itemInfos
Definition: FWEventItem.h:234
void toggleSelectItem()
Definition: FWEventItem.cc:650
ModelInfo(const FWDisplayProperties &iProps, bool iIsSelected)
Definition: FWEventItem.h:63
void select(int iIndex) const
Definition: FWEventItem.cc:251
bool m_isSelected
Definition: FWEventItem.h:248
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:567
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:535
const std::string & purpose() const
Definition: FWEventItem.cc:512
long double T
void setName(const std::string &iName)
Definition: FWEventItem.cc:144
void runFilter()
Definition: FWEventItem.cc:208
std::string m_purpose
Definition: FWEventItem.h:230
std::string m_productInstanceLabel
Definition: FWEventItem.h:238
std::string m_name
Definition: FWEventItem.h:228
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681
const std::string & moduleLabel() const
Definition: FWEventItem.cc:518
FWItemChangeSignal filterChanged_
Definition: FWEventItem.h:211