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.3 2012/08/03 18:08:11 wmtan Exp $
12 //
13 
14 // system include files
15 #include "TInterpreter.h"
16 #include "TVirtualMutex.h"
17 
19 
20 // user include files
23 
24 //
25 // constants, enums and typedefs
26 //
27 
28 namespace reco {
29  edm::MemberWithDict findDataMember(const edm::TypeWithDict& iType, const std::string& iName, int& oError) {
30  edm::MemberWithDict returnValue;
32  edm::TypeWithDict type = iType;
33  if(type) {
34  if(type.isPointer()) {
35  type = type.toType(); // for Pointers, I get the real type this way
36  }
37  returnValue = type.dataMemberByName(iName);
38  if(!returnValue) {
39  //check inheriting classes
40  R__LOCKGUARD(gCINTMutex);
41  edm::TypeBases bases(type);
42  for(auto const& base : bases) {
43  returnValue = findDataMember(edm::BaseWithDict(base).typeOf(), iName, oError);
44  //only stop if we found it or some other error happened
45  if(returnValue || parser::kNameDoesNotExist != oError) {
46  break;
47  }
48  }
49  }
50  if(returnValue && !returnValue.isPublic()) {
51  returnValue = edm::MemberWithDict();
52  oError = parser::kIsNotPublic;
53  }
54  }
55  if(returnValue) {
56  oError = parser::kNoError;
57  }
58  return returnValue;
59  }
60 }
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