CMS 3D CMS Logo

Public Member Functions | Static Private Member Functions

edm::TypeID Class Reference

#include <TypeID.h>

Inheritance diagram for edm::TypeID:
edm::TypeIDBase

List of all members.

Public Member Functions

std::string className () const
std::string friendlyClassName () const
bool hasDictionary () const
bool operator< (TypeID const &b) const
bool operator== (TypeID const &b) const
void print (std::ostream &os) const
template<typename T >
 TypeID (T const &t)
 TypeID (TypeID const &other)
 TypeID ()
 TypeID (std::type_info const &t)
std::string userClassName () const

Static Private Member Functions

static bool stripNamespace (std::string &theName)
static bool stripTemplate (std::string &theName)

Detailed Description

Definition at line 19 of file TypeID.h.


Constructor & Destructor Documentation

edm::TypeID::TypeID ( ) [inline]

Definition at line 22 of file TypeID.h.

: TypeIDBase() {}
edm::TypeID::TypeID ( TypeID const &  other) [inline]

Definition at line 24 of file TypeID.h.

                                : TypeIDBase(other) {
    }
edm::TypeID::TypeID ( std::type_info const &  t) [inline, explicit]

Definition at line 27 of file TypeID.h.

                                           : TypeIDBase(t) {
    }
template<typename T >
edm::TypeID::TypeID ( T const &  t) [inline, explicit]

Definition at line 31 of file TypeID.h.

                                : TypeIDBase(typeid(t)) {
    }

Member Function Documentation

std::string edm::TypeID::className ( ) const

Definition at line 51 of file TypeID.cc.

References edm::TypeIDBase::typeInfo().

Referenced by friendlyClassName(), print(), fwlite::Event::throwProductNotFoundException(), fwlite::LuminosityBlock::throwProductNotFoundException(), fwlite::Run::throwProductNotFoundException(), fwlite::DataGetterHelper::throwProductNotFoundException(), and userClassName().

                          {
    typedef std::map<edm::TypeID, std::string> Map;
    static boost::thread_specific_ptr<Map> s_typeToName;
    if(0 == s_typeToName.get()){
      s_typeToName.reset(new Map);
    }
    Map::const_iterator itFound = s_typeToName->find(*this);
    if(s_typeToName->end() == itFound) {
      itFound = s_typeToName->insert(Map::value_type(*this, typeToClassName(typeInfo()))).first;
    }
    return itFound->second;
  }
std::string edm::TypeID::friendlyClassName ( ) const
bool edm::TypeID::hasDictionary ( ) const

Definition at line 115 of file TypeID.cc.

References edm::TypeIDBase::typeInfo().

Referenced by pat::UserData::checkDictionaries().

                              {
    return bool(Reflex::Type::ByTypeInfo(typeInfo()));
  }
bool edm::TypeID::operator< ( TypeID const &  b) const [inline]

Definition at line 47 of file TypeID.h.

{ return this->TypeIDBase::operator<(b); }
bool edm::TypeID::operator== ( TypeID const &  b) const [inline]

Definition at line 49 of file TypeID.h.

{return this->TypeIDBase::operator==(b);}
void edm::TypeID::print ( std::ostream &  os) const

Definition at line 16 of file TypeID.cc.

References className(), and edm::TypeIDBase::typeInfo().

                                    {
    try {
      os << className();
    } catch (cms::Exception const& e) {
      os << typeInfo().name();
    }
  }
bool edm::TypeID::stripNamespace ( std::string &  theName) [static, private]

Definition at line 104 of file TypeID.cc.

References runTheMatrix::ret.

                                           {
    std::string::size_type idx = theName.rfind(':');
    bool ret = (idx != std::string::npos);
    if (ret) {
      ++idx;
      theName = theName.substr(idx);
    }
    return ret;
  }
bool edm::TypeID::stripTemplate ( std::string &  theName) [static, private]

Definition at line 79 of file TypeID.cc.

References edm::first().

Referenced by userClassName().

                                          {
    std::string const spec("<,>");
    char const space = ' ';
    std::string::size_type idx = theName.find_first_of(spec);
    if (idx == std::string::npos) {
      return false;
    }
    std::string::size_type first = 0;
    std::string::size_type after = idx;
    if (theName[idx] == '<') {
      after = theName.rfind('>');
      assert (after != std::string::npos);
      first = ++idx;
    } else {
      theName = theName.substr(0, idx);
    }
    std::string::size_type idxa = after;
    while (space == theName[--idxa]) --after;
    std::string::size_type idxf = first;
    while (space == theName[idxf++]) ++first;
    theName = theName.substr(first, after - first);
    return true;
  }
std::string edm::TypeID::userClassName ( ) const

Definition at line 65 of file TypeID.cc.

References className(), and stripTemplate().

                              {
    std::string theName = className();
    if (theName.find("edm::Wrapper") == 0) {
      stripTemplate(theName);
    }
    return theName;
  }