CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

FWParameterSetterBase Class Reference

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

Inheritance diagram for FWParameterSetterBase:
FWBoolParameterSetter FWDoubleParameterSetter FWEnumParameterSetter FWLongParameterSetter FWStringParameterSetter

List of all members.

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.

                                             :
   m_frame(0)
{
}
FWParameterSetterBase::~FWParameterSetterBase ( ) [virtual]

Definition at line 51 of file FWParameterSetterBase.cc.

{
}
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.

{
   m_frame=iFrame;
   attach(iBase);
}
virtual void FWParameterSetterBase::attach ( FWParameterBase ) [private, pure virtual]
virtual TGFrame* FWParameterSetterBase::build ( TGFrame *  iParent,
bool  labelBack = true 
) [pure virtual]
FWParameterSetterEditorBase* FWParameterSetterBase::frame ( ) const [inline, protected]
boost::shared_ptr< FWParameterSetterBase > FWParameterSetterBase::makeSetterFor ( FWParameterBase iParam) [static]

Definition at line 95 of file FWParameterSetterBase.cc.

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

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

{
   static std::map<edm::TypeID,edm::TypeWithDict> s_paramToSetterMap;
   edm::TypeID paramType( typeid(*iParam) );
   std::map<edm::TypeID,edm::TypeWithDict>::iterator itFind = s_paramToSetterMap.find(paramType);
   if (itFind == s_paramToSetterMap.end())
   {
      edm::TypeWithDict paramClass(typeid(*iParam));
      if (paramClass == edm::TypeWithDict())
      {
         fwLog(fwlog::kError) << " the type "<<typeid(*iParam).name()<< " is not known to Root" <<std::endl;
      }
      assert(paramClass != edm::TypeWithDict() );

      //the corresponding setter has the same name but with 'Setter' at the end
      std::string name = paramClass.name();
      // FIXME: there was a convention between parameter class names and associated
      //        setters. The following works around the problem introduced by
      //        the generic parameter class but it is clear that a better 
      //        way of doing the binding is required. Notice that there are only 5 
      //        different type of FW*Parameter.
      if (name == "FWGenericParameter<bool>")
         name = "FWBoolParameterSetter";
      else if (name == "FWGenericParameter<std::string>")
         name = "FWStringParameterSetter";
      else if (name == "FWGenericParameter<std::basic_string<char> >")
         name = "FWStringParameterSetter"; 
      else if (name == "FWGenericParameterWithRange<double>")
         name = "FWDoubleParameterSetter";
      else if (name == "FWGenericParameterWithRange<long int>")
         name = "FWLongParameterSetter";
      else if (name == "FWGenericParameterWithRange<long>")
         name = "FWLongParameterSetter";
      else
         name += "Setter";

      edm::TypeWithDict setterClass( edm::TypeWithDict::byName( name ) );
      if (setterClass == edm::TypeWithDict())
      {
         fwLog(fwlog::kError) << " the type "<<name<< " has no dictionary" <<std::endl;
      }
      assert(setterClass != edm::TypeWithDict());

      s_paramToSetterMap[paramType]=setterClass;
      itFind = s_paramToSetterMap.find(paramType);
   }
   //create the instance we want
   //NOTE: for some odd reason reflex 'Construct' uses 'malloc' to allocate the memory.  This means the object
   // can not be deleted using 'delete'!  So we must call Type::Destruct on the object
   edm::ObjectWithDict setterObj = itFind->second.construct();

   //make it into the base class
   edm::TypeWithDict s_setterBaseType(typeid(FWParameterSetterBase));
   assert(bool(s_setterBaseType));
   edm::ObjectWithDict castSetterObj(setterObj.castObject(s_setterBaseType));
   boost::shared_ptr<FWParameterSetterBase> ptr(reinterpret_cast<FWParameterSetterBase*>( castSetterObj.address() ),
                                                boost::bind(&edm::TypeWithDict::destruct,itFind->second,setterObj.address(),true));
   return ptr;
}
const FWParameterSetterBase& FWParameterSetterBase::operator= ( const FWParameterSetterBase ) [private]
void FWParameterSetterBase::setEnabled ( bool  ) [virtual]

Reimplemented in FWEnumParameterSetter, FWBoolParameterSetter, and FWDoubleParameterSetter.

Definition at line 157 of file FWParameterSetterBase.cc.

{
}
void FWParameterSetterBase::update ( void  ) const [protected]

Member Data Documentation

Definition at line 63 of file FWParameterSetterBase.h.

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