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.44 2010/08/18 10:30:09 amraktad 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;
47 
48 namespace edm {
49  class EventBase;
50 }
51 namespace fireworks {
52  class Context;
53 }
54 
56 {
57 
58 public:
59  struct ModelInfo {
62  ModelInfo(const FWDisplayProperties& iProps, bool iIsSelected) :
63  m_displayProperties(iProps),
64  m_isSelected(iIsSelected) {
65  }
66 
68  return m_displayProperties;
69  }
70  bool isSelected() const {
71  return m_isSelected;
72  }
73  };
74 
76  unsigned int iItemId,
77  boost::shared_ptr<FWItemAccessorBase> iAccessor,
78  const FWPhysicsObjectDesc& iDesc);
79  //virtual ~FWEventItem();
80 
81  // ---------- const member functions ---------------------
82 #if !defined(__CINT__) && !defined(__MAKECINT__)
83  template<class T>
84  void get(const T*& oData) const {
85  oData=reinterpret_cast<const T*>(data(typeid(T)));
86  }
87 #endif
88  const void* data(const std::type_info&) const;
90 
92  int layer() const;
94  bool isInFront() const;
96  bool isInBack() const;
97 
98  const std::string& filterExpression() const;
101  unsigned int id() const;
102  const std::string& name() const;
103  const TClass* type() const;
105  const std::string& purpose() const;
106 
107  const std::string& moduleLabel() const;
108  const std::string& productInstanceLabel() const;
109  const std::string& processName() const;
110 
111  const TClass* modelType() const;
112  ModelInfo modelInfo(int iIndex) const; //return copy for now since want to be able to change visibility
113  size_t size() const;
114  const void* modelData(int iIndex) const;
115  std::string modelName(int iIndex) const;
116 
118  bool haveInterestingValue() const;
119  double modelInterestingValue(int iIndex) const;
120  const std::string& modelInterestingValueAsString(int iIndex) const;
121 
122  bool isCollection() const;
123 
124  //convenience methods
125 
126  const fireworks::Context& context () const {
127  return *m_context;
128  }
129 
131  return m_context->modelChangeManager();
132  }
134  return m_context->selectionManager();
135  }
136 
138  return m_context->colorManager();
139  }
140 
141  bool hasEvent() const {
142  return 0 != m_event;
143  }
144 
145  // hackery methods
146  const edm::EventBase *getEvent () const {
147  return m_event;
148  }
149 
150 
152  bool hasError() const;
154  const std::string& errorMessage() const;
155 
156  // ---------- static member functions --------------------
157 
158  static int minLayerValue();
159  static int maxLayerValue();
160 
161  // ---------- member functions ---------------------------
162  void setEvent(const edm::EventBase* iEvent);
163 
164  const FWGeometry* getGeom() const;
165 
166  void setLabels(const std::string& iModule,
167  const std::string& iProductInstance,
168  const std::string& iProcess);
169  void setName(const std::string& iName);
172  void setFilterExpression(const std::string& );
173 
175  void selectItem();
176  void unselectItem();
177  void toggleSelectItem();
178  bool itemIsSelected() const;
179 
181  void moveToFront();
182  void moveToBack();
183  void moveToLayer(int layer);
184 
185  void unselect(int iIndex) const;
186  void select(int iIndex) const;
187  void toggleSelect(int iIndex) const;
188  void setDisplayProperties(int iIndex, const FWDisplayProperties&) const;
189 
190  void destroy() const;
193 
196 
201 
205 
208 
212 private:
213  //FWEventItem(const FWEventItem&); // stop default
214 
215  //const FWEventItem& operator=(const FWEventItem&); // stop default
216  void setData(const Reflex::Object& ) const;
217 
218  void getPrimaryData() const;
219  void runFilter();
220  void handleChange();
221  // ---------- member data --------------------------------
223  unsigned int m_id;
224  std::string m_name;
225  const TClass* m_type;
226  std::string m_purpose;
227  boost::shared_ptr<FWItemAccessorBase> m_accessor;
229  int m_layer;
230  mutable std::vector<ModelInfo> m_itemInfos;
231 
232  //This will probably moved to a FWEventItemRetriever class
233  std::string m_moduleLabel;
235  std::string m_processName;
239 
242  mutable std::string m_errorMessage;
243 
245 };
246 
247 
248 #endif
const TClass * m_type
Definition: FWEventItem.h:225
FWItemChangeSignal preItemChanged_
Definition: FWEventItem.h:200
const FWDisplayProperties & defaultDisplayProperties() const
Definition: FWEventItem.cc:452
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:130
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:67
void destroy() const
Definition: FWEventItem.cc:615
void moveToBack()
Definition: FWEventItem.cc:344
void moveToFront()
Definition: FWEventItem.cc:321
void setData(const Reflex::Object &) const
Definition: FWEventItem.cc:431
void moveToLayer(int layer)
Definition: FWEventItem.cc:367
std::string modelName(int iIndex) const
Definition: FWEventItem.cc:575
void setEvent(const edm::EventBase *iEvent)
Definition: FWEventItem.cc:131
const std::string & name() const
Definition: FWEventItem.cc:501
FWColorManager * colorManager() const
Definition: FWEventItem.h:137
FWItemValueGetter m_interestingValueGetter
Definition: FWEventItem.h:238
FWEventItem(fireworks::Context *iContext, unsigned int iItemId, boost::shared_ptr< FWItemAccessorBase > iAccessor, const FWPhysicsObjectDesc &iDesc)
Definition: FWEventItem.cc:65
bool isSelected() const
Definition: FWEventItem.h:70
FWColorManager * colorManager() const
Definition: Context.h:66
void setDisplayProperties(int iIndex, const FWDisplayProperties &) const
Definition: FWEventItem.cc:287
const std::string & filterExpression() const
Definition: FWEventItem.cc:609
FWItemChangeSignal defaultDisplayPropertiesChanged_
Definition: FWEventItem.h:204
bool haveInterestingValue() const
one value from the model which is normally used for the popup
Definition: FWEventItem.cc:588
void getPrimaryData() const
Definition: FWEventItem.cc:444
void unselect(int iIndex) const
Definition: FWEventItem.cc:250
FWItemChangeSignal goingToBeDestroyed_
Definition: FWEventItem.h:211
boost::shared_ptr< FWItemAccessorBase > m_accessor
Definition: FWEventItem.h:227
const fireworks::Context * m_context
Definition: FWEventItem.h:222
bool itemIsSelected() const
Definition: FWEventItem.cc:668
const std::string & processName() const
Definition: FWEventItem.cc:530
void setLabels(const std::string &iModule, const std::string &iProductInstance, const std::string &iProcess)
Definition: FWEventItem.cc:141
std::string m_moduleLabel
Definition: FWEventItem.h:233
static int maxLayerValue()
Definition: FWEventItem.cc:56
const void * data(const std::type_info &) const
Definition: FWEventItem.cc:393
int layer() const
Definition: FWEventItem.cc:458
unsigned int m_id
Definition: FWEventItem.h:223
FWModelFilter m_filter
Definition: FWEventItem.h:240
int iEvent
Definition: GenABIO.cc:243
void setDefaultDisplayProperties(const FWDisplayProperties &)
Definition: FWEventItem.cc:166
const std::string & productInstanceLabel() const
Definition: FWEventItem.cc:524
std::string m_processName
Definition: FWEventItem.h:235
const TClass * type() const
Definition: FWEventItem.cc:507
const fireworks::Context & context() const
Definition: FWEventItem.h:126
FWItemChangeSignal itemChanged_
Definition: FWEventItem.h:195
unsigned int id() const
Definition: FWEventItem.cc:495
double modelInterestingValue(int iIndex) const
Definition: FWEventItem.cc:594
FWSelectionManager * selectionManager() const
Definition: Context.h:58
FWModelChangeManager * modelChangeManager() const
Definition: Context.h:55
const std::string & modelInterestingValueAsString(int iIndex) const
Definition: FWEventItem.cc:601
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:60
static int minLayerValue()
Definition: FWEventItem.cc:51
bool m_printedErrorThisEvent
Definition: FWEventItem.h:241
bool hasError() const
returns true if failed to get data for this event
Definition: FWEventItem.cc:674
FWSelectionManager * selectionManager() const
Definition: FWEventItem.h:133
const edm::EventBase * getEvent() const
Definition: FWEventItem.h:146
void toggleSelect(int iIndex) const
Definition: FWEventItem.cc:275
bool isInBack() const
returns true if item is behind all other items
Definition: FWEventItem.cc:479
size_t size() const
Definition: FWEventItem.cc:549
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:228
void selectItem()
Definition: FWEventItem.cc:639
void handleChange()
Definition: FWEventItem.cc:379
bool hasEvent() const
Definition: FWEventItem.h:141
bool isInFront() const
returns true if item is in front of all other items
Definition: FWEventItem.cc:464
void setFilterExpression(const std::string &)
Definition: FWEventItem.cc:210
void unselectItem()
Definition: FWEventItem.cc:648
const edm::EventBase * m_event
Definition: FWEventItem.h:236
FWModelChangeSignal changed_
Definition: FWEventItem.h:192
std::string m_errorMessage
Definition: FWEventItem.h:242
bool isCollection() const
Definition: FWEventItem.cc:556
const TClass * modelType() const
Definition: FWEventItem.cc:562
const std::string & errorMessage() const
returns error string if there was a problem this event
Definition: FWEventItem.cc:679
std::vector< ModelInfo > m_itemInfos
Definition: FWEventItem.h:230
void toggleSelectItem()
Definition: FWEventItem.cc:657
ModelInfo(const FWDisplayProperties &iProps, bool iIsSelected)
Definition: FWEventItem.h:62
void select(int iIndex) const
Definition: FWEventItem.cc:261
bool m_isSelected
Definition: FWEventItem.h:244
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:568
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:536
const std::string & purpose() const
Definition: FWEventItem.cc:513
void setName(const std::string &iName)
Definition: FWEventItem.cc:154
void runFilter()
Definition: FWEventItem.cc:218
std::string m_purpose
Definition: FWEventItem.h:226
ROOT::Reflex::Type m_wrapperType
Definition: FWEventItem.h:237
std::string m_productInstanceLabel
Definition: FWEventItem.h:234
std::string m_name
Definition: FWEventItem.h:224
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:688
const std::string & moduleLabel() const
Definition: FWEventItem.cc:519
FWItemChangeSignal filterChanged_
Definition: FWEventItem.h:207