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 32 of file FWParameterSetterBase.h.

Constructor & Destructor Documentation

FWParameterSetterBase::FWParameterSetterBase ( )

Definition at line 41 of file FWParameterSetterBase.cc.

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

Definition at line 51 of file FWParameterSetterBase.cc.

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

Member Function Documentation

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

Definition at line 72 of file FWParameterSetterBase.cc.

References m_frame.

73 {
74  m_frame=iFrame;
75  attach(iBase);
76 }
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 95 of file FWParameterSetterBase.cc.

References fwLog, fwlog::kError, and mergeVDriftHistosByStation::name.

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

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

Definition at line 84 of file FWParameterSetterBase.cc.

References m_frame, and FWParameterSetterEditorBase::updateEditor().

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.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(), relval_steps.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().

85 {
86  if (m_frame != 0)
88 }
FWParameterSetterEditorBase * m_frame

Member Data Documentation

FWParameterSetterEditorBase* FWParameterSetterBase::m_frame
private

Definition at line 63 of file FWParameterSetterBase.h.

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