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.1 2009/02/24 14:10:22 llista Exp $
12 //
13 
14 // system include files
15 #include "Reflex/Base.h"
16 
17 // user include files
20 
21 //
22 // constants, enums and typedefs
23 //
24 
25 namespace reco {
26  Reflex::Member findDataMember(const Reflex::Type& iType, const std::string& iName, int& oError) {
27  using namespace Reflex;
28  Member returnValue;
30  Type type = iType;
31  if(type) {
32  if(type.IsPointer()) {
33  type = type.ToType();
34  }
35  returnValue = type.DataMemberByName(iName);
36  if(!returnValue) {
37  //check inheriting classes
38  for(Base_Iterator b = type.Base_Begin(); b != type.Base_End(); ++ b) {
39  returnValue = findDataMember(b->ToType(), 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 = Member();
48  oError = parser::kIsNotPublic;
49  }
50  }
51  if(returnValue) {
52  oError = parser::kNoError;
53  }
54  return returnValue;
55  }
56 }
type
Definition: HCALResponse.h:22
double b
Definition: hdecay.h:120
Reflex::Member findDataMember(const Reflex::Type &iType, const std::string &iName, int &oError)