CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
FWParameterSetterBase Class Referenceabstract

#include <Fireworks/Core/interface/FWParameterSetterBase.h>

Inheritance diagram for FWParameterSetterBase:
FWBoolParameterSetter FWDoubleParameterSetter FWEnumParameterSetter FWLongParameterSetter FWStringParameterSetter

Public Member Functions

void attach (FWParameterBase *, FWParameterSetterEditorBase *)
 
virtual TGFrame * build (TGFrame *iParent, bool labelBack=true)=0
 
 FWParameterSetterBase ()
 
virtual void setEnabled (bool)
 
virtual ~FWParameterSetterBase ()
 

Static Public Member Functions

static boost::shared_ptr
< FWParameterSetterBase
makeSetterFor (FWParameterBase *)
 

Protected Member Functions

FWParameterSetterEditorBaseframe () const
 
void update () const
 

Private Member Functions

virtual void attach (FWParameterBase *)=0
 
 FWParameterSetterBase (const FWParameterSetterBase &)
 
const FWParameterSetterBaseoperator= (const FWParameterSetterBase &)
 

Private Attributes

FWParameterSetterEditorBasem_frame
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 31 of file FWParameterSetterBase.h.

Constructor & Destructor Documentation

FWParameterSetterBase::FWParameterSetterBase ( )

Definition at line 40 of file FWParameterSetterBase.cc.

40  :
41  m_frame(0)
42 {
43 }
FWParameterSetterEditorBase * m_frame
FWParameterSetterBase::~FWParameterSetterBase ( )
virtual

Definition at line 50 of file FWParameterSetterBase.cc.

51 {
52 }
FWParameterSetterBase::FWParameterSetterBase ( const FWParameterSetterBase )
private

Member Function Documentation

void FWParameterSetterBase::attach ( FWParameterBase iBase,
FWParameterSetterEditorBase iFrame 
)

Definition at line 71 of file FWParameterSetterBase.cc.

References m_frame.

72 {
73  m_frame=iFrame;
74  attach(iBase);
75 }
void attach(FWParameterBase *, FWParameterSetterEditorBase *)
FWParameterSetterEditorBase * m_frame
virtual void FWParameterSetterBase::attach ( FWParameterBase )
privatepure virtual
virtual TGFrame* FWParameterSetterBase::build ( TGFrame *  iParent,
bool  labelBack = true 
)
pure virtual
FWParameterSetterEditorBase* FWParameterSetterBase::frame ( ) const
inlineprotected
boost::shared_ptr< FWParameterSetterBase > FWParameterSetterBase::makeSetterFor ( FWParameterBase iParam)
static

Definition at line 94 of file FWParameterSetterBase.cc.

References edm::ObjectWithDict::address(), assert(), edm::TypeWithDict::byName(), edm::TypeWithDict::destruct(), fwLog, fwlog::kError, mergeVDriftHistosByStation::name, edm::TypeWithDict::name(), AlCaHLTBitMon_ParallelJobs::p, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FWViewEnergyScaleEditor::addParam(), ViewerParameterGUI::addParam(), FWGeometryTableView::FWGeometryTableView(), CmsShowCommonPopup::makeSetter(), and FWProxyBuilderConfiguration::makeSetter().

95 {
96  static std::map<edm::TypeID,edm::TypeWithDict> s_paramToSetterMap;
97  edm::TypeID paramType( typeid(*iParam) );
98  std::map<edm::TypeID,edm::TypeWithDict>::iterator itFind = s_paramToSetterMap.find(paramType);
99  if (itFind == s_paramToSetterMap.end())
100  {
101  edm::TypeWithDict paramClass(typeid(*iParam));
102  if (paramClass == edm::TypeWithDict())
103  {
104  fwLog(fwlog::kError) << " the type "<<typeid(*iParam).name()<< " is not known to Root" <<std::endl;
105  }
106  assert(paramClass != edm::TypeWithDict() );
107 
108  //the corresponding setter has the same name but with 'Setter' at the end
109  std::string name = paramClass.name();
110  // FIXME: there was a convention between parameter class names and associated
111  // setters. The following works around the problem introduced by
112  // the generic parameter class but it is clear that a better
113  // way of doing the binding is required. Notice that there are only 5
114  // different type of FW*Parameter.
115  if (name == "FWGenericParameter<bool>")
116  name = "FWBoolParameterSetter";
117  else if (name == "FWGenericParameter<std::string>")
118  name = "FWStringParameterSetter";
119  else if (name == "FWGenericParameter<std::basic_string<char> >")
120  name = "FWStringParameterSetter";
121  else if (name == "FWGenericParameterWithRange<double>")
122  name = "FWDoubleParameterSetter";
123  else if (name == "FWGenericParameterWithRange<long int>")
124  name = "FWLongParameterSetter";
125  else if (name == "FWGenericParameterWithRange<long>")
126  name = "FWLongParameterSetter";
127  else
128  name += "Setter";
129 
130  edm::TypeWithDict setterClass( edm::TypeWithDict::byName( name ) );
131  if (setterClass == edm::TypeWithDict())
132  {
133  fwLog(fwlog::kError) << " the type "<<name<< " has no dictionary" <<std::endl;
134  }
135  assert(setterClass != edm::TypeWithDict());
136 
137  s_paramToSetterMap[paramType]=setterClass;
138  itFind = s_paramToSetterMap.find(paramType);
139  }
140  //create the instance we want
141  //NOTE: 'construct' will use 'malloc' to allocate the memory if the object is not of class type.
142  // This means the object cannot be deleted using 'delete'! So we must call destruct on the object.
143  edm::ObjectWithDict setterObj = itFind->second.construct();
144 
145  //make it into the base class
146  FWParameterSetterBase* p = static_cast<FWParameterSetterBase*>(setterObj.address());
147  //Make a shared pointer to the base class that uses a destructor for the derived class, in order to match the above construct call.
148  boost::shared_ptr<FWParameterSetterBase> ptr(p, boost::bind(&edm::TypeWithDict::destruct,itFind->second,setterObj.address(),true));
149  return ptr;
150 }
void * address() const
assert(m_qm.get())
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:60
#define fwLog(_level_)
Definition: fwLog.h:50
void destruct(void *address, bool dealloc=true) const
const FWParameterSetterBase& FWParameterSetterBase::operator= ( const FWParameterSetterBase )
private
void FWParameterSetterBase::setEnabled ( bool  )
virtual
void FWParameterSetterBase::update ( void  ) const
protected

Definition at line 83 of file FWParameterSetterBase.cc.

References m_frame, and FWParameterSetterEditorBase::updateEditor().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), FWStringParameterSetter::doUpdate(), FWBoolParameterSetter::doUpdate(), FWLongParameterSetter::doUpdate(), FWEnumParameterSetter::doUpdate(), FWDoubleParameterSetter::doUpdate(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

84 {
85  if (m_frame != 0)
87 }
FWParameterSetterEditorBase * m_frame

Member Data Documentation

FWParameterSetterEditorBase* FWParameterSetterBase::m_frame
private

Definition at line 62 of file FWParameterSetterBase.h.

Referenced by attach(), frame(), and update().