CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
findDataMember.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Utilities
4 // Class : findDataMember
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Wed Aug 13 10:07:46 EDT 2008
11 // $Id: findDataMember.cc,v 1.4 2013/02/10 22:15:06 wmtan Exp $
12 //
13 
14 // system include files
16 
17 // user include files
20 
21 //
22 // constants, enums and typedefs
23 //
24 
25 namespace reco {
26  edm::MemberWithDict findDataMember(const edm::TypeWithDict& iType, const std::string& iName, int& oError) {
27  edm::MemberWithDict returnValue;
29  edm::TypeWithDict type = iType;
30  if(type) {
31  if(type.isPointer()) {
32  type = type.toType(); // for Pointers, I get the real type this way
33  }
34  returnValue = type.dataMemberByName(iName);
35  if(!returnValue) {
36  //check inheriting classes
37  edm::TypeBases bases(type);
38  for(auto const& base : bases) {
39  returnValue = findDataMember(edm::BaseWithDict(base).typeOf(), iName, oError);
40  //only stop if we found it or some other error happened
41  if(returnValue || parser::kNameDoesNotExist != oError) {
42  break;
43  }
44  }
45  }
46  if(returnValue && !returnValue.isPublic()) {
47  returnValue = edm::MemberWithDict();
48  oError = parser::kIsNotPublic;
49  }
50  }
51  if(returnValue) {
52  oError = parser::kNoError;
53  }
54  return returnValue;
55  }
56 }
tuple base
Main Program
Definition: newFWLiteAna.py:92
type
Definition: HCALResponse.h:21
edm::MemberWithDict findDataMember(const edm::TypeWithDict &iType, const std::string &iName, int &oError)
TypeWithDict toType() const
bool isPublic() const
MemberWithDict dataMemberByName(std::string const &member) const
bool isPointer() const