CMS 3D CMS Logo

findDataMember.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     Utilities
00004 // Class  :     findDataMember
00005 // 
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  Chris Jones
00010 //         Created:  Wed Aug 13 10:07:46 EDT 2008
00011 // $Id: findDataMember.cc,v 1.1 2008/08/13 19:38:18 chrjones Exp $
00012 //
00013 
00014 // system include files
00015 #include "Reflex/Base.h"
00016 
00017 // user include files
00018 #include "PhysicsTools/Utilities/src/findDataMember.h"
00019 #include "PhysicsTools/Utilities/src/ErrorCodes.h"
00020 
00021 
00022 //
00023 // constants, enums and typedefs
00024 //
00025 
00026 namespace reco {
00027    ROOT::Reflex::Member findDataMember(const ROOT::Reflex::Type& iType, const std::string& iName, int& oError) {
00028       using namespace ROOT::Reflex;
00029       Member returnValue;
00030       oError = parser::kNameDoesNotExist;
00031       Type type = iType;
00032       if(type) {
00033          if(type.IsPointer()) {
00034             type = type.ToType();
00035          }
00036          returnValue = type.DataMemberByName(iName);
00037          if(!returnValue) {
00038             //check inheriting classes
00039             for(Base_Iterator b = type.Base_Begin(); b != type.Base_End(); ++ b) {
00040                returnValue = findDataMember(b->ToType(), iName, oError);
00041                //only stop if we found it or some other error happened
00042                if(returnValue || parser::kNameDoesNotExist != oError) {
00043                   break;
00044                }
00045             }
00046          }
00047          if(returnValue && !returnValue.IsPublic()) {
00048             returnValue = Member();
00049             oError = parser::kIsNotPublic;
00050          }
00051       }
00052       if(returnValue) {
00053          oError = parser::kNoError;
00054       }
00055       return returnValue;
00056    }
00057 }

Generated on Tue Jun 9 17:42:52 2009 for CMSSW by  doxygen 1.5.4