CMS 3D CMS Logo

Public Member Functions | Private Attributes

FWItemValueGetter Class Reference

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

List of all members.

Public Member Functions

 FWItemValueGetter (const ROOT::Reflex::Type &, const std::vector< std::pair< std::string, std::string > > &iFindValueFrom)
bool isValid () const
void setValueAndUnit (const std::string &iValue, const std::string &iUnit)
const std::string & stringValueFor (const void *) const
const std::string & unit () const
double valueFor (const void *) const
std::string valueName () const

Private Attributes

ROOT::Reflex::Member m_memberFunction
ROOT::Reflex::Type m_type
std::string m_unit

Detailed Description

Description: Retrieves a particular value from an item

Usage: <usage>

Definition at line 31 of file FWItemValueGetter.h.


Constructor & Destructor Documentation

FWItemValueGetter::FWItemValueGetter ( const ROOT::Reflex::Type &  iType,
const std::vector< std::pair< std::string, std::string > > &  iFindValueFrom 
)

Definition at line 139 of file FWItemValueGetter.cc.

References m_memberFunction, m_unit, recursiveFindMember(), and cond::rpcobtemp::temp.

                                                                                                      :
   m_type(iType)
{
   using namespace ROOT::Reflex;
   for(std::vector<std::pair<std::string,std::string> >::const_iterator it = iFindValueFrom.begin(), itEnd=iFindValueFrom.end();
       it != itEnd;
       ++it) {
      //std::cout <<" trying function "<<*it<<std::endl;
      Member temp = recursiveFindMember(it->first,iType);
      if(temp) {
         if(0==temp.FunctionParameterSize(true)) {
            //std::cout <<"    FOUND "<<temp.Name()<<std::endl;
            //std::cout <<"     in type "<<temp.DeclaringType().Name(SCOPED)<<std::endl;
            m_memberFunction = temp;
            m_unit = it->second;
            break;
         }
      }
   }
}

Member Function Documentation

bool FWItemValueGetter::isValid ( void  ) const

Definition at line 209 of file FWItemValueGetter.cc.

References m_memberFunction.

Referenced by FWEventItem::haveInterestingValue().

{
   return bool(m_memberFunction);
}
void FWItemValueGetter::setValueAndUnit ( const std::string &  iValue,
const std::string &  iUnit 
)
const std::string & FWItemValueGetter::stringValueFor ( const void *  iObject) const

Definition at line 199 of file FWItemValueGetter.cc.

References m_memberFunction, m_type, m_unit, VarParsing::obj, and cond::rpcobtemp::temp.

Referenced by FWEventItem::modelInterestingValueAsString().

{
   ROOT::Reflex::Object temp(m_type,
                             const_cast<void*>(iObject));
   ROOT::Reflex::Object obj= temp.CastObject(m_memberFunction.DeclaringType());

   return ::stringValueFor(obj,m_memberFunction,m_unit);
}
const std::string & FWItemValueGetter::unit ( ) const

Definition at line 221 of file FWItemValueGetter.cc.

References m_unit.

{
   return m_unit;
}
double FWItemValueGetter::valueFor ( const void *  iObject) const

Definition at line 190 of file FWItemValueGetter.cc.

References doubleValueFor(), m_memberFunction, m_type, VarParsing::obj, and cond::rpcobtemp::temp.

Referenced by FWEventItem::modelInterestingValue().

{
   ROOT::Reflex::Object temp(m_type,
                             const_cast<void*>(iObject));
   ROOT::Reflex::Object obj= temp.CastObject(m_memberFunction.DeclaringType());
   return ::doubleValueFor(obj,m_memberFunction);
}
std::string FWItemValueGetter::valueName ( ) const

Definition at line 215 of file FWItemValueGetter.cc.

References m_memberFunction.

{
   return m_memberFunction.Name();
}

Member Data Documentation

ROOT::Reflex::Member FWItemValueGetter::m_memberFunction [private]

Definition at line 58 of file FWItemValueGetter.h.

Referenced by FWItemValueGetter(), isValid(), stringValueFor(), valueFor(), and valueName().

ROOT::Reflex::Type FWItemValueGetter::m_type [private]

Definition at line 57 of file FWItemValueGetter.h.

Referenced by stringValueFor(), and valueFor().

std::string FWItemValueGetter::m_unit [private]

Definition at line 59 of file FWItemValueGetter.h.

Referenced by FWItemValueGetter(), stringValueFor(), and unit().