From ac2411cd8e08ba0e40357eceb526072f19798af4 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Tue, 31 Mar 2015 12:16:21 +0200 Subject: [PATCH] Move CMSSW_7_4_X to use CMSSW_7_4_ROOT6_X. --- .../SUSYBSMObjects/src/classes_def.xml | 2 +- .../TrackInfo/src/classes_def.xml | 2 +- .../plugins/DTT0CalibrationNew.cc | 2 +- .../ParticleFlow/test/Macros/isolation.C | 2 - .../ParticleFlow/test/Macros/plotVertex.py | 2 - CommonTools/ParticleFlow/test/Macros/ptJets.C | 2 - CommonTools/ParticleFlow/test/Macros/ptMus.C | 2 - .../ParticleFlow/test/Macros/rootlogon.C | 2 - .../test/Macros/testMuonTopProjection.C | 2 - .../Utils/interface/StringToEnumValue.h | 18 +- CommonTools/Utils/src/ExpressionVar.cc | 4 +- CommonTools/Utils/src/MethodInvoker.cc | 2 +- CommonTools/Utils/src/findMethod.cc | 40 +- CommonTools/Utils/test/testCutParser.cc | 5 +- .../Utils/test/testCutParserThreaded.cc | 4 - .../Utils/test/testExpressionParser.cc | 3 +- CondCore/CondDB/src/Serialization.cc | 11 +- CondCore/CondDB/test/MyTestData.h | 2 +- .../CondDB/test/testConditionDatabase_0.cpp | 42 +- CondCore/CondDB/test/testPayloadProxy.cpp | 2 +- CondCore/CondDB/test/testRootStreaming.cpp | 2 - .../DBCommon/plugins/BlobStreamingService.cc | 17 +- .../plugins/TBufferBlobStreamingService.cc | 40 +- .../plugins/TBufferBlobStreamingService.h | 10 +- CondCore/DBCommon/test/testBlobStreaming.cpp | 4 +- CondCore/IOVService/test/testIOVCopy.cc | 2 +- .../IOVService/test/testqueryPContainer.cc | 2 +- CondCore/ORA/bin/reflex_dict_get_tree.cpp | 39 +- .../ORA/interface/IBlobStreamingService.h | 8 +- CondCore/ORA/interface/Object.h | 9 +- CondCore/ORA/src/ArrayHandlerFactory.cc | 13 +- CondCore/ORA/src/ArrayHandlerFactory.h | 6 +- CondCore/ORA/src/BlobStreamer.cc | 10 +- CondCore/ORA/src/BlobStreamer.h | 18 +- CondCore/ORA/src/CArrayHandler.cc | 18 +- CondCore/ORA/src/CArrayHandler.h | 16 +- CondCore/ORA/src/CArrayStreamer.cc | 36 +- CondCore/ORA/src/CArrayStreamer.h | 16 +- CondCore/ORA/src/ClassUtils.cc | 312 +++-- CondCore/ORA/src/ClassUtils.h | 64 +- CondCore/ORA/src/Container.cc | 18 +- CondCore/ORA/src/ContainerSchema.cc | 34 +- CondCore/ORA/src/ContainerSchema.h | 20 +- CondCore/ORA/src/DataElement.cc | 19 +- CondCore/ORA/src/DataElement.h | 8 +- CondCore/ORA/src/Database.cc | 20 +- CondCore/ORA/src/DatabaseContainer.cc | 64 +- CondCore/ORA/src/DatabaseContainer.h | 20 +- CondCore/ORA/src/DatabaseSession.cc | 4 +- CondCore/ORA/src/DatabaseSession.h | 8 +- CondCore/ORA/src/DatabaseUtilitySession.cc | 6 +- CondCore/ORA/src/IArrayHandler.h | 8 +- CondCore/ORA/src/InlineCArrayStreamer.cc | 18 +- CondCore/ORA/src/InlineCArrayStreamer.h | 18 +- CondCore/ORA/src/MappingDatabase.cc | 22 +- CondCore/ORA/src/MappingDatabase.h | 10 +- CondCore/ORA/src/MappingGenerator.cc | 14 +- CondCore/ORA/src/MappingGenerator.h | 12 +- CondCore/ORA/src/MappingRules.cc | 8 +- CondCore/ORA/src/MappingRules.h | 6 +- CondCore/ORA/src/NamedRefStreamer.cc | 34 +- CondCore/ORA/src/NamedRefStreamer.h | 16 +- CondCore/ORA/src/Object.cc | 16 +- CondCore/ORA/src/ObjectStreamer.cc | 87 +- CondCore/ORA/src/ObjectStreamer.h | 26 +- CondCore/ORA/src/OraPtrStreamer.cc | 65 +- CondCore/ORA/src/OraPtrStreamer.h | 18 +- CondCore/ORA/src/OraReferenceStreamer.cc | 28 +- CondCore/ORA/src/OraReferenceStreamer.h | 16 +- CondCore/ORA/src/PVectorHandler.cc | 91 +- CondCore/ORA/src/PVectorHandler.h | 42 +- CondCore/ORA/src/PVectorStreamer.cc | 8 +- CondCore/ORA/src/PVectorStreamer.h | 10 +- CondCore/ORA/src/PoolToken.cc | 10 +- CondCore/ORA/src/PrimitiveStreamer.cc | 13 +- CondCore/ORA/src/PrimitiveStreamer.h | 16 +- CondCore/ORA/src/QueryableVectorStreamer.cc | 79 +- CondCore/ORA/src/QueryableVectorStreamer.h | 18 +- CondCore/ORA/src/RelationalMapping.cc | 207 ++- CondCore/ORA/src/RelationalMapping.h | 52 +- CondCore/ORA/src/RelationalStreamerFactory.cc | 30 +- CondCore/ORA/src/RelationalStreamerFactory.h | 12 +- CondCore/ORA/src/STLContainerHandler.cc | 342 +++-- CondCore/ORA/src/STLContainerHandler.h | 259 ++-- CondCore/ORA/src/STLContainerStreamer.cc | 912 +++++++------- CondCore/ORA/src/STLContainerStreamer.h | 16 +- CondCore/ORA/src/UniqueRefStreamer.cc | 55 +- CondCore/ORA/src/UniqueRefStreamer.h | 16 +- CondCore/ORA/src/classes.h | 2 + CondCore/ORA/src/classes_def.xml | 4 + CondCore/ORA/test/TestBase.h | 4 +- CondCore/ORA/test/classes_def.xml | 4 +- CondCore/ORA/test/testORA_7.cc | 87 +- CondCore/Utilities/bin/cmscond_2XML.cpp | 3 - CondCore/Utilities/bin/cmscond_list_iov.cpp | 3 - CondCore/Utilities/bin/conddb_migrate.cpp | 8 +- CondCore/Utilities/bin/conddb_migrate_gt.cpp | 3 - CondCore/Utilities/bin/conddb_validate.cpp | 7 +- .../Utilities/interface/PayLoadInspector.h | 2 - .../BTauObjects/src/BTagCalibration.cc | 2 +- CondFormats/BTauObjects/src/BTagEntry.cc | 4 +- .../interface/MVAComputer.h | 30 - .../SiStripObjects/src/classes_def.xml | 2 +- .../src/SiStripPulseShape.cc | 2 +- DQM/SiStripMonitorClient/bin/BuildFile.xml | 1 + .../Trigger/interface/HLTMuonMatchAndPlot.h | 7 +- DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc | 21 +- DataFormats/BTauReco/src/classes_def.xml | 2 +- DataFormats/BeamSpot/src/classes_def.xml | 2 +- DataFormats/CSCDigi/src/classes_def.xml | 17 + DataFormats/CSCRecHit/src/classes_def.xml | 4 + DataFormats/CaloRecHit/src/classes_def.xml | 2 +- DataFormats/Candidate/src/classes_def.xml | 8 +- DataFormats/Candidate/test/testParticle.cc | 6 - DataFormats/Common/interface/BasicHandle.h | 1 - .../Common/interface/DetSetLazyVector.h | 1 - .../Common/interface/DetSetVectorNew.h | 6 +- .../Common/interface/EDProductGetter.h | 6 +- DataFormats/Common/interface/EDProductfwd.h | 2 - DataFormats/Common/interface/HandleBase.h | 1 - .../Common/interface/HandleExceptionFactory.h | 1 - DataFormats/Common/interface/IndirectHolder.h | 1 - .../Common/interface/IndirectVectorHolder.h | 1 - .../Common/interface/MultiAssociation.h | 1 - DataFormats/Common/interface/RefToBase.h | 1 - .../Common/interface/RefToBaseVector.h | 1 - DataFormats/Common/interface/RefVector.h | 2 +- DataFormats/Common/interface/RefVectorBase.h | 2 +- .../Common/interface/RefVectorHolder.h | 1 - .../Common/interface/RefVectorHolderBase.h | 1 - DataFormats/Common/src/classes_def.xml | 4 +- DataFormats/Common/test/BuildFile.xml | 2 +- DataFormats/Common/test/DictionaryTools_t.cpp | 5 +- DataFormats/Common/test/ptr_t.cppunit.cc | 4 +- DataFormats/DTDigi/src/classes_def.xml | 2 + DataFormats/DTRecHit/src/classes_def.xml | 10 +- DataFormats/DetId/BuildFile.xml | 2 +- .../EgammaCandidates/src/classes_def.xml | 6 +- DataFormats/EgammaReco/src/classes_def.xml | 8 +- DataFormats/FEDRawData/BuildFile.xml | 1 - DataFormats/FEDRawData/src/classes_def.xml | 4 +- DataFormats/FWLite/interface/ChainEvent.h | 1 - .../FWLite/interface/DataGetterHelper.h | 2 - DataFormats/FWLite/interface/ESHandle.h | 1 - DataFormats/FWLite/interface/Event.h | 1 - .../FWLite/interface/InternalDataKey.h | 2 +- .../FWLite/interface/LuminosityBlock.h | 1 - .../FWLite/interface/MultiChainEvent.h | 1 - DataFormats/FWLite/interface/Run.h | 1 - DataFormats/FWLite/interface/RunFactory.h | 1 - DataFormats/FWLite/python/__init__.py | 3 +- DataFormats/FWLite/src/Record.cc | 2 +- DataFormats/FWLite/test/record.cppunit.cpp | 2 - DataFormats/GsfTrackReco/src/classes_def.xml | 4 +- .../HepMCCandidate/src/classes_def.xml | 4 +- .../JetReco/interface/TrackExtrapolation.h | 7 +- DataFormats/JetReco/src/classes_def_4.xml | 19 + .../L1GlobalCaloTrigger/src/classes_def.xml | 8 +- .../L1GlobalTrigger/src/classes_def.xml | 2 +- DataFormats/L1Trigger/src/classes_def.xml | 12 +- DataFormats/Math/BuildFile.xml | 1 - DataFormats/Math/src/classes.h | 3 - DataFormats/Math/src/classes_def.xml | 105 +- DataFormats/MuonDetId/src/classes_def.xml | 1 - DataFormats/MuonReco/src/classes_def.xml | 2 +- DataFormats/MuonSeed/src/classes_def.xml | 4 +- .../ParticleFlowCandidate/src/classes_def.xml | 6 +- .../ParticleFlowReco/interface/PFCluster.h | 5 +- .../ParticleFlowReco/interface/PFRecHit.h | 5 +- .../interface/PFTrajectoryPoint.h | 5 +- .../ParticleFlowReco/src/classes_def_1.xml | 2 +- .../ParticleFlowReco/src/classes_def_2.xml | 30 +- DataFormats/ParticleFlowReco/test/init.C | 2 - DataFormats/PatCandidates/src/UserData.cc | 3 +- .../PatCandidates/src/classes_def_objects.xml | 24 +- .../PatCandidates/src/classes_def_other.xml | 2 +- .../PatCandidates/src/classes_def_trigger.xml | 2 +- DataFormats/Provenance/interface/Hash.h | 4 +- .../Provenance/interface/IndexIntoFile.h | 2 - .../Provenance/interface/ProductProvenance.h | 1 - .../interface/ProductProvenanceRetriever.h | 1 - .../Provenance/interface/ProductRegistry.h | 8 +- DataFormats/Provenance/interface/Provenance.h | 1 - .../interface/WrapperInterfaceBase.h | 1 - .../Provenance/src/BranchDescription.cc | 71 +- DataFormats/Provenance/src/ProductRegistry.cc | 16 +- DataFormats/Provenance/src/classes_def.xml | 4 +- DataFormats/Provenance/test/BuildFile.xml | 2 - .../test/productHolderIndexHelperTest.cc | 4 - .../productHolderIndexHelper_t.cppunit.cc | 9 - DataFormats/RPCDigi/src/classes_def.xml | 1 + DataFormats/RPCRecHit/src/classes_def.xml | 3 + DataFormats/RecoCandidate/src/classes_def.xml | 2 +- DataFormats/SiStripCommon/src/classes_def.xml | 12 +- DataFormats/StdDictionaries/BuildFile.xml | 3 +- .../StdDictionaries/src/classes_def_map.xml | 1 + .../src/classes_def_vector.xml | 6 +- .../StdDictionaries/src/classes_vector.h | 1 - DataFormats/Streamer/src/classes_def.xml | 2 +- DataFormats/TauReco/src/classes_def_2.xml | 8 +- .../TestObjects/interface/ToyProducts.h | 5 + DataFormats/TestObjects/src/classes.h | 5 + DataFormats/TestObjects/src/classes_def.xml | 15 +- DataFormats/TestObjects/test/Enum_t.cpp | 26 + .../TrackCandidate/src/classes_def.xml | 2 +- DataFormats/TrackReco/src/classes_def.xml | 26 +- DataFormats/TrackerRecHit2D/src/classes.h | 0 .../TrackerRecHit2D/src/classes_def.xml | 6 +- .../TrackingRecHit/src/classes_def.xml | 1 + .../TrajectorySeed/src/classes_def.xml | 2 +- DataFormats/TrajectoryState/BuildFile.xml | 1 - FWCore/Common/src/classes_def.xml | 2 +- FWCore/FWLite/BuildFile.xml | 1 - FWCore/FWLite/src/AutoLibraryLoader.cc | 5 +- FWCore/FWLite/src/FWCoreFWLiteLinkDef.h | 6 - FWCore/FWLite/src/classes.h | 2 + FWCore/FWLite/src/classes_def.xml | 5 + FWCore/FWLite/test/BuildFile.xml | 2 +- .../test/stdnamespaceadder_t.cppunit.cpp | 51 - FWCore/Framework/src/EventProcessor.cc | 6 - FWCore/Framework/src/Principal.cc | 18 +- FWCore/Framework/src/ProductRegistryHelper.cc | 24 +- FWCore/Framework/test/BuildFile.xml | 5 - FWCore/Framework/test/Event_t.cpp | 6 +- .../test/edconsumerbase_t.cppunit.cc | 8 - .../test/event_getrefbeforeput_t.cppunit.cc | 2 - .../test/eventprincipal_t.cppunit.cc | 3 - .../test/eventprocessor2_t.cppunit.cc | 2 - .../test/eventprocessor_t.cppunit.cc | 1 - .../Framework/test/generichandle_t.cppunit.cc | 2 - .../Framework/test/productregistry.cppunit.cc | 2 - .../MessageLogger/interface/MessageSender.h | 1 - FWCore/Modules/src/EventContentAnalyzer.cc | 2 +- FWCore/PluginManager/bin/refresh.cc | 2 +- FWCore/PluginManager/src/PluginManager.cc | 26 +- FWCore/ROOTTests/test/BuildFile.xml | 16 + FWCore/ROOTTests/test/read_threaded_t.cc | 145 +++ .../test/tclass_methods_threaded_t.cc | 81 ++ FWCore/ROOTTests/test/tformula_threaded_t.cc | 74 ++ FWCore/ROOTTests/test/tprofile_threaded_t.cc | 78 ++ FWCore/ROOTTests/test/write_threaded_t.cc | 126 ++ FWCore/RootAutoLibraryLoader/BuildFile.xml | 7 - .../interface/RootAutoLibraryLoader.h | 45 - .../src/RootAutoLibraryLoader.cc | 441 ------- .../src/stdNamespaceAdder.cc | 35 - .../src/stdNamespaceAdder.h | 32 - .../RootAutoLibraryLoader/test/BuildFile.xml | 7 - .../test/rootautolibraryloader_t.cppunit.cpp | 53 - .../test/stdnamespaceadder_t.cppunit.cpp | 51 - FWCore/Services/BuildFile.xml | 1 - FWCore/Services/src/InitRootHandlers.cc | 22 +- FWCore/Services/src/LoadAllDictionaries.cc | 3 - FWCore/Services/test/fpe_test_2.sh | 20 +- .../interface/TFWLiteSelector.h | 1 - .../interface/TFWLiteSelectorBasic.h | 2 - .../src/TFWLiteSelectorBasic.cc | 20 +- .../src/ThingsTSelector2.h | 1 - FWCore/Utilities/BuildFile.xml | 4 +- FWCore/Utilities/interface/BaseWithDict.h | 47 +- FWCore/Utilities/interface/DictionaryTools.h | 30 +- .../Utilities/interface/ExceptionPropagate.h | 13 + FWCore/Utilities/interface/FunctionWithDict.h | 98 +- .../interface/HideStdSharedPtrFromRoot.h | 52 - FWCore/Utilities/interface/IterWithDict.h | 62 +- FWCore/Utilities/interface/MemberWithDict.h | 72 +- FWCore/Utilities/interface/ObjectWithDict.h | 69 +- FWCore/Utilities/interface/TypeWithDict.h | 378 +++--- .../interface/thread_safety_macros.h | 2 +- FWCore/Utilities/scripts/edmAddClassVersion | 3 - FWCore/Utilities/scripts/edmCheckClassVersion | 10 +- FWCore/Utilities/src/BaseWithDict.cc | 23 +- FWCore/Utilities/src/DictionaryTools.cc | 315 ++--- FWCore/Utilities/src/ExceptionPropagate.cc | 15 + FWCore/Utilities/src/FunctionWithDict.cc | 118 +- FWCore/Utilities/src/IterWithDict.cc | 47 +- FWCore/Utilities/src/MemberWithDict.cc | 61 +- FWCore/Utilities/src/ObjectWithDict.cc | 108 +- FWCore/Utilities/src/TypeDemangler.cc | 6 +- FWCore/Utilities/src/TypeWithDict.cc | 1110 +++++++++++------ .../External/src/classes_def.xml | 2 +- .../NuclearInteractions/src/classes_def.xml | 4 +- FastSimDataFormats/PileUpEvents/BuildFile.xml | 3 +- FastSimulation/MaterialEffects/test/init.C | 2 - .../Core/src/FWModelContextMenuHandler.cc | 25 +- Fireworks/Core/test/unittest_changemanager.cc | 2 - .../Core/test/unittest_eventitemsmanager.cc | 2 - .../test/unittest_modelexpressionselector.cc | 2 - Fireworks/Core/test/unittest_modelfilter.cc | 2 - .../Core/test/unittest_selectionmanager.cc | 2 - IOPool/Common/bin/EdmFileUtil.cpp | 2 - IOPool/Common/bin/EdmProvDump.cc | 4 - IOPool/Input/src/InputFile.cc | 9 +- IOPool/Output/src/PoolOutputModule.cc | 6 +- IOPool/Output/src/RootOutputFile.cc | 22 +- IOPool/Output/src/RootOutputTree.cc | 2 + IOPool/Streamer/src/ClassFiller.cc | 21 +- IOPool/TFileAdaptor/BuildFile.xml | 4 +- IOPool/TFileAdaptor/src/TFileAdaptor.cc | 19 - IOPool/TFileAdaptor/src/TFileAdaptor.h | 23 + IOPool/TFileAdaptor/src/TFileAdaptorLinkDef.h | 37 - .../TFileAdaptor/src/TStorageFactoryFile.cc | 18 +- IOPool/TFileAdaptor/src/classes.h | 3 + IOPool/TFileAdaptor/src/classes_def.xml | 7 + IOPool/TFileAdaptor/test/BuildFile.xml | 1 + .../CondLiteIO/test/recordwriter.cppunit.cpp | 3 +- PhysicsTools/Heppy/python/loadlibs.py | 2 - .../MVAComputer/bin/mvaConvertTMVAWeights.cpp | 2 - .../MVAComputer/bin/mvaExtractPDFs.cpp | 3 - PhysicsTools/MVAComputer/test/rootlogon.C | 2 - PhysicsTools/MVATrainer/bin/mvaExtractor.cpp | 2 - .../MVATrainer/bin/mvaTreeComputer.cpp | 3 - .../MVATrainer/bin/mvaTreeTrainer.cpp | 4 - PhysicsTools/MVATrainer/test/rootlogon.C | 2 - PhysicsTools/PatExamples/bin/BuildFile.xml | 2 + .../bin/TestPerformanceFWLite_ES.cc | 1 - .../PerformanceDB/bin/getbtagPerformance.cc | 1 - .../test/BTagCalibrationStandalone.cc | 6 +- .../interface/PixelHitMatcher.h | 5 +- RecoMuon/MuonIdentification/test/rootlogon.C | 2 - .../PFClusterProducer/test/init.C | 2 - .../test/src/clusterCalibrate.C | 2 - .../test/src/clusterCalibrationExample.C | 4 +- .../PFClusterTools/test/src/compareCalib.C | 2 - .../PFClusterTools/test/src/doCalib.C | 2 - .../PFClusterTools/test/src/doCalibTestbeam.C | 2 - .../PFClusterTools/test/src/exportCSV.C | 2 - .../PFClusterTools/test/src/init.C | 2 - .../PFClusterTools/test/src/testConversion.C | 4 +- .../PFClusterTools/test/src/testWrappers.C | 4 - .../TauTagTools/test/trainMVA_template.C | 2 - .../TrackProducer/test/analyze_tracks.C | 2 - .../HcalSimAlgos/test/readHPDLibrary.cc | 2 - .../HcalSimAlgos/test/writeHPDLibrary.cc | 2 - .../CaloHit/interface/CastorShowerEvent.h | 2 +- .../CaloHit/src/CastorEventLinkDef.h | 8 - SimDataFormats/CaloHit/src/classes_def.xml | 10 + SimDataFormats/EncodedEventId/BuildFile.xml | 1 - .../GeneratorProducts/src/classes_def.xml | 4 +- .../bin/TtSemiLRSignalSel_PurityLoop.cpp | 1 - .../bin/TtSemiLRSignalSel_SoverSplusBLoop.cpp | 1 - .../bin/TtSemiLRJetComb_PurityLoop.cpp | 1 - .../bin/TtSemiLRJetComb_SoverSplusBLoop.cpp | 1 - .../PatternTools/src/classes_def.xml | 2 + .../TrackAssociator/test/rootlogon.C | 2 - .../TrajectoryState/src/classes_def.xml | 2 +- Validation/EcalHits/test/rootlogon.C | 2 - Validation/GlobalDigis/test/rootlogon.C | 2 - Validation/GlobalHits/test/rootlogon.C | 2 - Validation/GlobalRecHits/test/rootlogon.C | 2 - .../MuonIdentification/test/rootlogon.C | 2 - .../ElectronBenchmarkGeneric/plot.C | 2 - .../ElectronRejectionBenchmark/plot.C | 2 - .../JetBenchmarkSpecific/Fractions.C | 2 - .../JetBenchmarkSpecific/TrackMult.C | 2 - .../Benchmarks/JetBenchmarkSpecific/plot.C | 2 - .../Benchmarks/METBenchmarkGeneric/compare.C | 2 - .../Benchmarks/METBenchmarkGeneric/plot.C | 2 - .../Benchmarks/METBenchmarkGeneric/plot_QCD.C | 2 - .../Benchmarks/PFCandidateBenchmark/plot.C | 2 - Validation/RecoParticleFlow/BuildFile.xml | 1 - .../RecoParticleFlow/test/testTH2Analyzer.C | 2 - Validation/TrackerHits/test/rootlogon.C | 2 - 362 files changed, 4570 insertions(+), 4350 deletions(-) mode change 100755 => 100644 AnalysisDataFormats/TrackInfo/src/classes_def.xml create mode 100644 CondCore/ORA/src/classes.h create mode 100644 CondCore/ORA/src/classes_def.xml mode change 100755 => 100644 DataFormats/HepMCCandidate/src/classes_def.xml delete mode 100644 DataFormats/Provenance/interface/WrapperInterfaceBase.h mode change 100755 => 100644 DataFormats/TrackerRecHit2D/src/classes.h mode change 100755 => 100644 DataFormats/TrackerRecHit2D/src/classes_def.xml delete mode 100644 FWCore/FWLite/src/FWCoreFWLiteLinkDef.h create mode 100644 FWCore/FWLite/src/classes.h create mode 100644 FWCore/FWLite/src/classes_def.xml delete mode 100644 FWCore/FWLite/test/stdnamespaceadder_t.cppunit.cpp create mode 100644 FWCore/ROOTTests/test/BuildFile.xml create mode 100644 FWCore/ROOTTests/test/read_threaded_t.cc create mode 100644 FWCore/ROOTTests/test/tclass_methods_threaded_t.cc create mode 100644 FWCore/ROOTTests/test/tformula_threaded_t.cc create mode 100644 FWCore/ROOTTests/test/tprofile_threaded_t.cc create mode 100644 FWCore/ROOTTests/test/write_threaded_t.cc delete mode 100644 FWCore/RootAutoLibraryLoader/BuildFile.xml delete mode 100644 FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h delete mode 100644 FWCore/RootAutoLibraryLoader/src/RootAutoLibraryLoader.cc delete mode 100644 FWCore/RootAutoLibraryLoader/src/stdNamespaceAdder.cc delete mode 100644 FWCore/RootAutoLibraryLoader/src/stdNamespaceAdder.h delete mode 100644 FWCore/RootAutoLibraryLoader/test/BuildFile.xml delete mode 100644 FWCore/RootAutoLibraryLoader/test/rootautolibraryloader_t.cppunit.cpp delete mode 100644 FWCore/RootAutoLibraryLoader/test/stdnamespaceadder_t.cppunit.cpp create mode 100644 FWCore/Utilities/interface/ExceptionPropagate.h delete mode 100644 FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h create mode 100644 FWCore/Utilities/src/ExceptionPropagate.cc delete mode 100644 IOPool/TFileAdaptor/src/TFileAdaptorLinkDef.h create mode 100644 IOPool/TFileAdaptor/src/classes.h create mode 100644 IOPool/TFileAdaptor/src/classes_def.xml delete mode 100644 SimDataFormats/CaloHit/src/CastorEventLinkDef.h diff --git a/AnalysisDataFormats/SUSYBSMObjects/src/classes_def.xml b/AnalysisDataFormats/SUSYBSMObjects/src/classes_def.xml index c9bd06e508dbe..f0a73307deeb4 100644 --- a/AnalysisDataFormats/SUSYBSMObjects/src/classes_def.xml +++ b/AnalysisDataFormats/SUSYBSMObjects/src/classes_def.xml @@ -22,7 +22,7 @@ - + diff --git a/AnalysisDataFormats/TrackInfo/src/classes_def.xml b/AnalysisDataFormats/TrackInfo/src/classes_def.xml old mode 100755 new mode 100644 index 7165214147222..46fe958041886 --- a/AnalysisDataFormats/TrackInfo/src/classes_def.xml +++ b/AnalysisDataFormats/TrackInfo/src/classes_def.xml @@ -1,7 +1,7 @@ - + diff --git a/CalibMuon/DTCalibration/plugins/DTT0CalibrationNew.cc b/CalibMuon/DTCalibration/plugins/DTT0CalibrationNew.cc index 33b2203e9683e..3ed2ea470b105 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0CalibrationNew.cc +++ b/CalibMuon/DTCalibration/plugins/DTT0CalibrationNew.cc @@ -277,7 +277,7 @@ void DTT0CalibrationNew::analyze(const edm::Event & event, const edm::EventSetup //int npeaks = spectrum->Search((*lHisto).second,(tpPeakWidthPerLayer/2.),"goff",0.3); int npeaks = spectrum->Search((*lHisto).second,(tpPeakWidthPerLayer/2.),"",0.3); - float *peaks = spectrum->GetPositionX(); + double *peaks = spectrum->GetPositionX(); //Put in a std::vector vector peakMeans(peaks,peaks + npeaks); //Sort the peaks in ascending order diff --git a/CommonTools/ParticleFlow/test/Macros/isolation.C b/CommonTools/ParticleFlow/test/Macros/isolation.C index 79a97e67f0c90..79d5c9b134b5d 100644 --- a/CommonTools/ParticleFlow/test/Macros/isolation.C +++ b/CommonTools/ParticleFlow/test/Macros/isolation.C @@ -3,8 +3,6 @@ gSystem->Load("libFWCoreFWLite.so"); AutoLibraryLoader::enable(); -gSystem->Load("libCintex.so"); -ROOT::Cintex::Cintex::Enable(); TFile f("testPFPAT.root"); Events.Draw("recoIsolatedPFCandidates_pfPionsIsolation__PFPAT.obj.isolation_>>h2"); diff --git a/CommonTools/ParticleFlow/test/Macros/plotVertex.py b/CommonTools/ParticleFlow/test/Macros/plotVertex.py index 403ebbb85aeff..7d4ff1b449990 100644 --- a/CommonTools/ParticleFlow/test/Macros/plotVertex.py +++ b/CommonTools/ParticleFlow/test/Macros/plotVertex.py @@ -8,8 +8,6 @@ def loadFWLite(): gSystem.Load("libFWCoreFWLite") gROOT.ProcessLine('AutoLibraryLoader::enable();') gSystem.Load("libFWCoreFWLite") - gSystem.Load("libCintex") - gROOT.ProcessLine('ROOT::Cintex::Cintex::Enable();') diff --git a/CommonTools/ParticleFlow/test/Macros/ptJets.C b/CommonTools/ParticleFlow/test/Macros/ptJets.C index dd4d495788549..d47015e96bfd2 100644 --- a/CommonTools/ParticleFlow/test/Macros/ptJets.C +++ b/CommonTools/ParticleFlow/test/Macros/ptJets.C @@ -3,8 +3,6 @@ gSystem->Load("libFWCoreFWLite.so"); AutoLibraryLoader::enable(); - gSystem->Load("libCintex.so"); - ROOT::Cintex::Cintex::Enable(); TFile f("patTuple_PF2PAT.root"); Events.Draw("patJets_selectedPatJets__PAT.obj.pt()>>h1"); diff --git a/CommonTools/ParticleFlow/test/Macros/ptMus.C b/CommonTools/ParticleFlow/test/Macros/ptMus.C index 0085bffa1bec2..a8dbc70977ed0 100644 --- a/CommonTools/ParticleFlow/test/Macros/ptMus.C +++ b/CommonTools/ParticleFlow/test/Macros/ptMus.C @@ -3,8 +3,6 @@ gSystem->Load("libFWCoreFWLite.so"); AutoLibraryLoader::enable(); - gSystem->Load("libCintex.so"); - ROOT::Cintex::Cintex::Enable(); TFile f("patTuple_PF2PAT.root"); Events.Draw("patMuons_selectedPatMuons__PAT.obj.pt()>>h1"); diff --git a/CommonTools/ParticleFlow/test/Macros/rootlogon.C b/CommonTools/ParticleFlow/test/Macros/rootlogon.C index 5c443612797a0..4205978a8682b 100644 --- a/CommonTools/ParticleFlow/test/Macros/rootlogon.C +++ b/CommonTools/ParticleFlow/test/Macros/rootlogon.C @@ -10,8 +10,6 @@ void rootlogon() { void loadFWLite() { gSystem->Load("libFWCoreFWLite.so"); AutoLibraryLoader::enable(); - gSystem->Load("libCintex.so"); - ROOT::Cintex::Cintex::Enable(); } void initAOD(const char* process) { diff --git a/CommonTools/ParticleFlow/test/Macros/testMuonTopProjection.C b/CommonTools/ParticleFlow/test/Macros/testMuonTopProjection.C index 6cb3a906b29f0..a5bd55113ed54 100644 --- a/CommonTools/ParticleFlow/test/Macros/testMuonTopProjection.C +++ b/CommonTools/ParticleFlow/test/Macros/testMuonTopProjection.C @@ -2,8 +2,6 @@ gSystem->Load("libFWCoreFWLite.so"); AutoLibraryLoader::enable(); - gSystem->Load("libCintex.so"); - ROOT::Cintex::Cintex::Enable(); TFile fDisabled("tpDisabled.root"); TTree *tDisabled = (TTree*) fDisabled.Get("Events"); diff --git a/CommonTools/Utils/interface/StringToEnumValue.h b/CommonTools/Utils/interface/StringToEnumValue.h index 0fb35f664bd8e..3c26c53647ff1 100644 --- a/CommonTools/Utils/interface/StringToEnumValue.h +++ b/CommonTools/Utils/interface/StringToEnumValue.h @@ -3,7 +3,9 @@ #include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Utilities/interface/TypeWithDict.h" +#include "TEnum.h" +#include "TEnumConstant.h" +#include #include #include #include @@ -21,10 +23,16 @@ \date 04 Mar 2011 */ -template -int StringToEnumValue(const std::string & enumMemberName){ - edm::TypeWithDict dataType(typeid(MyType), kIsEnum); - return dataType.stringToEnumValue(enumMemberName); +template +int StringToEnumValue(std::string const& enumConstName){ + TEnum* en = TEnum::GetEnum(typeid(MyEnum)); + if (en != nullptr){ + if (TEnumConstant const* enc = en->GetConstant(enumConstName.c_str())){ + return enc->GetValue(); + } + } + assert(0); + return -1; } diff --git a/CommonTools/Utils/src/ExpressionVar.cc b/CommonTools/Utils/src/ExpressionVar.cc index 155aed6fca144..9be62bb85b10c 100755 --- a/CommonTools/Utils/src/ExpressionVar.cc +++ b/CommonTools/Utils/src/ExpressionVar.cc @@ -152,7 +152,7 @@ double ExpressionVar::value(const edm::ObjectWithDict& obj) const std::vector::const_reverse_iterator RIB = needsDestructor_.rbegin(); for (std::vector::reverse_iterator RI = objects_.rbegin(), RE = objects_.rend(); RI != RE; ++RIB, ++RI) { if (*RIB) { - RI->typeOf().destruct(RI->address(), false); + RI->destruct(false); } } return ret; @@ -231,7 +231,7 @@ ExpressionLazyVar::value(const edm::ObjectWithDict& o) const double ret = I->invokeLast(val, objects_); for (std::vector::reverse_iterator RI = objects_.rbegin(), RE = objects_.rend(); RI != RE; ++RI) { - RI->typeOf().destruct(RI->address(), false); + RI->destruct(false); } objects_.clear(); return ret; diff --git a/CommonTools/Utils/src/MethodInvoker.cc b/CommonTools/Utils/src/MethodInvoker.cc index 37512a4c8aaa5..be96b3380aed0 100755 --- a/CommonTools/Utils/src/MethodInvoker.cc +++ b/CommonTools/Utils/src/MethodInvoker.cc @@ -159,7 +159,7 @@ invoke(const edm::ObjectWithDict& o, edm::ObjectWithDict& retstore) const // strip cv & ref flags // FIXME: This is only true if the propery passed to the constructor // overrides the const and reference flags. - retType = edm::TypeWithDict(retType, 0L); + retType = retType.stripConstRef(); } ret = edm::ObjectWithDict(retType, *static_cast(addr)); //std::cout << "Now type is " << retType.qualifiedName() << std::endl; diff --git a/CommonTools/Utils/src/findMethod.cc b/CommonTools/Utils/src/findMethod.cc index 1b3b5f8d7953b..50aeb42067dcc 100755 --- a/CommonTools/Utils/src/findMethod.cc +++ b/CommonTools/Utils/src/findMethod.cc @@ -5,8 +5,6 @@ #include "FWCore/Utilities/interface/BaseWithDict.h" #include "FWCore/Utilities/interface/TypeWithDict.h" #include "FWCore/Utilities/interface/TypeID.h" -#include "TInterpreter.h" -#include "TVirtualMutex.h" #include @@ -157,18 +155,44 @@ findMethod(const edm::TypeWithDict& t, /*class=in*/ throw parser::Exception(iIterator) << "No dictionary for class \"" << type.name() << "\"."; } - while(type.isPointer() || type.isTypedef()) { + while (type.isPointer() || type.isReference()) { type = type.toType(); } - type = edm::TypeWithDict(type, 0L); // strip const, volatile, c++ ref, .. - + while (type.isTypedef()) { + edm::TypeWithDict theType = type.finalType(); + if(theType == type) { + break; + } + type = theType; + } + // strip const, volatile, c++ ref, .. + type = type.stripConstRef(); + // Create our return value. std::pair mem; //FIXME: We must initialize mem.first! mem.second = false; // suitable members and number of integer->real casts required to get them std::vector > oks; - - // first look in base scope + std::string theArgs; + for(auto const& item : args) { + if(!theArgs.empty()) { + theArgs += ','; + } + theArgs += edm::TypeID(item.type()).className(); + } + edm::FunctionWithDict f = type.functionMemberByName(name, theArgs, true); + if(bool(f)) { + int casts = checkMethod(f, type, args, fixuppedArgs); + if (casts > -1) { + oks.push_back(std::make_pair(casts, f)); + } else { + oError = -1 * casts; + //is this a show stopper error? + if (fatalErrorCondition(oError)) { + return mem; + } + } + } else { edm::TypeFunctionMembers functions(type); for (auto const& F : functions) { edm::FunctionWithDict f(F); @@ -186,6 +210,7 @@ findMethod(const edm::TypeWithDict& t, /*class=in*/ } } } + } //std::cout << "At base scope (type " << (type.name()) << ") found " << // oks.size() << " methods." << std::endl; // found at least one method @@ -213,7 +238,6 @@ findMethod(const edm::TypeWithDict& t, /*class=in*/ // allowed int baseError = parser::kNameDoesNotExist; if (!bool(mem.first)) { - R__LOCKGUARD(gCINTMutex); edm::TypeBases bases(type); for (auto const& B : bases) { mem = findMethod(edm::BaseWithDict(B).typeOf(), name, args, diff --git a/CommonTools/Utils/test/testCutParser.cc b/CommonTools/Utils/test/testCutParser.cc index afa4e37e10ece..134201114c652 100755 --- a/CommonTools/Utils/test/testCutParser.cc +++ b/CommonTools/Utils/test/testCutParser.cc @@ -8,7 +8,6 @@ #include "FWCore/Utilities/interface/ObjectWithDict.h" #include "FWCore/Utilities/interface/TypeWithDict.h" #include -#include "Cintex/Cintex.h" @@ -42,7 +41,7 @@ class testCutParser : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE_END(); public: - void setUp() {ROOT::Cintex::Cintex::Enable();} + void setUp() {} void tearDown() {} void checkAll(); void check(const std::string &, bool); @@ -229,7 +228,7 @@ void testCutParser::checkAll() { CPPUNIT_ASSERT_THROW((*sel)(o), reco::parser::Exception); // it throws wen called sel.reset(); - CPPUNIT_ASSERT_THROW(reco::parser::cutParser("quality('notAnEnum')",sel, false), cms::Exception); + CPPUNIT_ASSERT_THROW(reco::parser::cutParser("quality('notAnEnum')",sel, false), edm::Exception); // check hits (for re-implemented virtual functions and exception handling) CPPUNIT_ASSERT(hitOk.hasPositionAndError()); diff --git a/CommonTools/Utils/test/testCutParserThreaded.cc b/CommonTools/Utils/test/testCutParserThreaded.cc index 01356ec4f60e3..a70eb859e0711 100644 --- a/CommonTools/Utils/test/testCutParserThreaded.cc +++ b/CommonTools/Utils/test/testCutParserThreaded.cc @@ -7,8 +7,6 @@ #include "TObject.h" #include "TVirtualStreamerInfo.h" -#include "Cintex/Cintex.h" - #include #include #include @@ -41,8 +39,6 @@ int main() { std::atomic failed{false}; std::vector threads; - ROOT::Cintex::Cintex::Enable(); - TThread::Initialize(); //When threading, also have to keep ROOT from logging all TObjects into a list TObject::SetObjectStat(false); diff --git a/CommonTools/Utils/test/testExpressionParser.cc b/CommonTools/Utils/test/testExpressionParser.cc index d4169418bea26..88cff79d65b83 100755 --- a/CommonTools/Utils/test/testExpressionParser.cc +++ b/CommonTools/Utils/test/testExpressionParser.cc @@ -14,7 +14,6 @@ #include "FWCore/Utilities/interface/TypeWithDict.h" #include #include "DataFormats/Common/interface/TestHandle.h" -#include "Cintex/Cintex.h" class testExpressionParser : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(testExpressionParser); @@ -23,7 +22,7 @@ class testExpressionParser : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE_END(); public: - void setUp() {ROOT::Cintex::Cintex::Enable();} + void setUp() {} void tearDown() {} void checkAll(); void testStringToEnum(); diff --git a/CondCore/CondDB/src/Serialization.cc b/CondCore/CondDB/src/Serialization.cc index a0178ea875d87..dd771672c7727 100644 --- a/CondCore/CondDB/src/Serialization.cc +++ b/CondCore/CondDB/src/Serialization.cc @@ -7,21 +7,12 @@ // root includes #include "TStreamerInfo.h" #include "TClass.h" -#include "TList.h" #include "TBufferFile.h" -#include "Cintex/Cintex.h" namespace cond { - struct CintexIntializer { - CintexIntializer(){ - ROOT::Cintex::Cintex::Enable(); - } - }; - - // initialize Cintex and load dictionary when required + // load dictionary when required TClass* lookUpDictionary( const std::type_info& sourceType ){ - static const CintexIntializer initializer; TClass* rc = TClass::GetClass(sourceType); if( !rc ){ static std::string const prefix("LCGReflex/"); diff --git a/CondCore/CondDB/test/MyTestData.h b/CondCore/CondDB/test/MyTestData.h index e7786af681d4d..74e8ffa1f8e4d 100644 --- a/CondCore/CondDB/test/MyTestData.h +++ b/CondCore/CondDB/test/MyTestData.h @@ -12,7 +12,7 @@ class MyTestData { MyTestData(): a( 0 ), b( 0. ), - s(""){ + s(" "){ for( size_t i=0;i<2;i++) for( size_t j=0;j<2;j++){ d[i][j]=0; diff --git a/CondCore/CondDB/test/testConditionDatabase_0.cpp b/CondCore/CondDB/test/testConditionDatabase_0.cpp index 05f4081eaad30..3c9ea9bdc454c 100644 --- a/CondCore/CondDB/test/testConditionDatabase_0.cpp +++ b/CondCore/CondDB/test/testConditionDatabase_0.cpp @@ -22,14 +22,14 @@ int run( const std::string& connectionString ){ try{ //************* - std::cout <<"# Connecting with db in "< Connecting with db in "< Storing payload ptr="<<&d0< inserted 2 iovs..."< iov changes flushed..."< iov changes committed!..."< iov loaded size="< iov sequence size="<[0] not found!"< @@ -16,7 +15,6 @@ int main (int argc, char** argv) edmplugin::PluginManager::Config config; edmplugin::PluginManager::configure(edmplugin::standard::config()); - ROOT::Cintex::Cintex::Enable(); static std::string const prefix("LCGReflex/"); edmplugin::PluginCapabilities::get()->load(prefix + "MyTestData"); diff --git a/CondCore/DBCommon/plugins/BlobStreamingService.cc b/CondCore/DBCommon/plugins/BlobStreamingService.cc index dbf318cc55dcb..ac6f0f6e6173c 100644 --- a/CondCore/DBCommon/plugins/BlobStreamingService.cc +++ b/CondCore/DBCommon/plugins/BlobStreamingService.cc @@ -28,9 +28,9 @@ namespace cond { virtual ~BlobStreamingService(); - boost::shared_ptr write( const void* addressOfInputData, Reflex::Type const & classDictionary, bool useCompression=true ) override; + boost::shared_ptr write( const void* addressOfInputData, edm::TypeWithDict const & classDictionary, bool useCompression=true ) override; - void read( const coral::Blob& blobData, void* addressOfContainer, Reflex::Type const & classDictionary ) override; + void read( const coral::Blob& blobData, void* addressOfContainer, edm::TypeWithDict const & classDictionary ) override; private: @@ -46,7 +46,7 @@ namespace cond { static Variant findVariant(const void* address); - static int isVectorChar(Reflex::Type const & classDictionary); + static int isVectorChar(edm::TypeWithDict const & classDictionary); static boost::shared_ptr compress(const void* addr, size_t isize); @@ -62,7 +62,7 @@ namespace cond { BlobStreamingService::~BlobStreamingService(){} - boost::shared_ptr BlobStreamingService::write( const void* addressOfInputData, Reflex::Type const & classDictionary, bool useCompression ) { + boost::shared_ptr BlobStreamingService::write( const void* addressOfInputData, edm::TypeWithDict const & classDictionary, bool useCompression ) { boost::shared_ptr blobOut; int const k = isVectorChar(classDictionary); switch (k) { @@ -108,7 +108,7 @@ namespace cond { } - void BlobStreamingService::read( const coral::Blob& blobData, void* addressOfContainer, Reflex::Type const & classDictionary ) { + void BlobStreamingService::read( const coral::Blob& blobData, void* addressOfContainer, edm::TypeWithDict const & classDictionary ) { // protect against small blobs... Variant v = (size_t(blobData.size()) < m_offset) ? OLD : findVariant(blobData.startingAddress()); switch (v) { @@ -164,10 +164,9 @@ namespace cond { }; - int BlobStreamingService::isVectorChar(Reflex::Type const & classDictionary) { - std::type_info const & t = classDictionary.TypeInfo(); - if (t==typeid(std::vector) ) return 1; - if (t==typeid(std::vector) ) return 2; + int BlobStreamingService::isVectorChar(edm::TypeWithDict const& classDictionary) { + if (classDictionary == typeid(std::vector)) return 1; + if (classDictionary == typeid(std::vector)) return 2; return 0; } diff --git a/CondCore/DBCommon/plugins/TBufferBlobStreamingService.cc b/CondCore/DBCommon/plugins/TBufferBlobStreamingService.cc index 6c156e329b8db..48981f659197d 100644 --- a/CondCore/DBCommon/plugins/TBufferBlobStreamingService.cc +++ b/CondCore/DBCommon/plugins/TBufferBlobStreamingService.cc @@ -8,8 +8,8 @@ #include // #include "TBufferFile.h" -#include "Reflex/Reflex.h" -#include "Cintex/Cintex.h" + +#include "FWCore/Utilities/interface/TypeWithDict.h" typedef void (TBuffer::*WriteArrayFn_t)(const void *obj, Int_t n); typedef void (TBuffer::*ReadArrayFn_t)(void *obj, Int_t n); @@ -50,48 +50,42 @@ static const std::size_t nPrimitives = #undef PRIMTIVE -cond::TBufferBlobTypeInfo::TBufferBlobTypeInfo( Reflex::Type const & type_) +cond::TBufferBlobTypeInfo::TBufferBlobTypeInfo( edm::TypeWithDict const & type_) : m_arraySize(0), m_class(0), m_primitive(0) { - static bool cintexInitialized = false; - if (!cintexInitialized) { - cintexInitialized = true; - ROOT::Cintex::Cintex::Enable(); - } - - Reflex::Type type = type_; + edm::TypeWithDict type = type_; while(true) { - type = type.FinalType(); + type = type.finalType(); - if (!type.IsArray()) + if (!type.isArray()) break; if (!m_arraySize) m_arraySize = 1; - m_arraySize *= type.ArrayLength(); - type = type.ToType(); + m_arraySize *= type.arrayLength(); + type = type.toType(); } - if (type.IsClass()) { - const std::type_info &typeInfo = type.TypeInfo(); + if (type.isClass()) { + const std::type_info &typeInfo = type.typeInfo(); m_class = TClass::GetClass(typeInfo); if (!m_class) throw cond::Exception("TBufferBlobTypeInfo::TBufferBlobTypeInfo " - "No ROOT class registered for " + type.Name()); - } else if (type.IsFundamental()) { + "No ROOT class registered for " + type.name()); + } else if (type.isFundamental()) { if (!m_arraySize) throw cond::Exception("TBufferBlobTypeInfo::TBufferBlobTypeInfo " "Only arrays of primitive types supported. " "Please to not use a Blob for this member."); m_primitive = std::find(primitives, primitives + nPrimitives, - type.TypeInfo()) - primitives; + type.typeInfo()) - primitives; if (m_primitive >= nPrimitives) throw cond::Exception("TBufferBlobTypeInfo::TBufferBlobTypeInfo " - "Cannot handle primitive type " + type.Name()); + "Cannot handle primitive type " + type.name()); } else throw cond::Exception("TBufferBlobTypeInfo::TBufferBlobTypeInfo " - "Cannot handle C++ type " + type.Name()); + "Cannot handle C++ type " + type.name()); } @@ -112,7 +106,7 @@ namespace { } boost::shared_ptr cond::TBufferBlobStreamingService::write( const void* addr, - Reflex::Type const & classDictionary, + edm::TypeWithDict const & classDictionary, bool ){ TBufferBlobTypeInfo theType( classDictionary ); if (theType.m_class && theType.m_class->GetActualClass(addr) != theType.m_class) @@ -145,7 +139,7 @@ boost::shared_ptr cond::TBufferBlobStreamingService::write( const v void cond::TBufferBlobStreamingService::read( const coral::Blob& blobData, void* addr, - Reflex::Type const & classDictionary ){ + edm::TypeWithDict const & classDictionary ){ TBufferBlobTypeInfo theType( classDictionary ); const void *startingAddress = blobData.startingAddress(); size_t size = blobData.size(); diff --git a/CondCore/DBCommon/plugins/TBufferBlobStreamingService.h b/CondCore/DBCommon/plugins/TBufferBlobStreamingService.h index dbaa1f22e16be..33deb51d803d6 100644 --- a/CondCore/DBCommon/plugins/TBufferBlobStreamingService.h +++ b/CondCore/DBCommon/plugins/TBufferBlobStreamingService.h @@ -6,13 +6,15 @@ #include // #include "CoralBase/Blob.h" -#include "Reflex/Type.h" + +#include "FWCore/Utilities/interface/TypeWithDict.h" + #include "TClass.h" namespace cond { class TBufferBlobTypeInfo { public: - TBufferBlobTypeInfo( const Reflex::Type& type ); + TBufferBlobTypeInfo( const edm::TypeWithDict& type ); /// length of the plain C array (zero otherwise) std::size_t m_arraySize; @@ -30,9 +32,9 @@ namespace cond { virtual ~TBufferBlobStreamingService(); - boost::shared_ptr write( const void* addressOfInputData, Reflex::Type const & classDictionary, bool useCompression=false ); + boost::shared_ptr write( const void* addressOfInputData, edm::TypeWithDict const & classDictionary, bool useCompression=false ); - void read( const coral::Blob& blobData, void* addressOfContainer, Reflex::Type const & classDictionary ); + void read( const coral::Blob& blobData, void* addressOfContainer, edm::TypeWithDict const & classDictionary ); }; diff --git a/CondCore/DBCommon/test/testBlobStreaming.cpp b/CondCore/DBCommon/test/testBlobStreaming.cpp index 66b336f207f5b..7708f662e6608 100644 --- a/CondCore/DBCommon/test/testBlobStreaming.cpp +++ b/CondCore/DBCommon/test/testBlobStreaming.cpp @@ -51,7 +51,7 @@ int main() { for(size_t i=0; i!=vf.size(); ++i) vf[i] = float(i)+float(i)/1000.; - Reflex::Type vType = Reflex::Type::ByTypeInfo( typeid(std::vector)); + edm::TypeWithDict vType = edm::TypeWithDict( typeid(std::vector) ); { // old mode @@ -81,7 +81,7 @@ int main() { // CBLOB... std::vector vc = crap; - Reflex::Type cType = Reflex::Type::ByTypeInfo( typeid(std::vector)); + edm::TypeWithDict cType = edm::TypeWithDict( typeid(std::vector) ); { // old mode diff --git a/CondCore/IOVService/test/testIOVCopy.cc b/CondCore/IOVService/test/testIOVCopy.cc index 81f32380bd8c2..a72314a05871a 100644 --- a/CondCore/IOVService/test/testIOVCopy.cc +++ b/CondCore/IOVService/test/testIOVCopy.cc @@ -17,7 +17,7 @@ int main(){ std::string sourceConnect("sqlite_file:source.db"); std::string destConnect("sqlite_file:dest.db"); cond::DbConnection connection; - connection.configuration().setMessageLevel(coral::Debug); + //connection.configuration().setMessageLevel(coral::Debug); connection.configure(); cond::DbSession sourcedb = connection.createSession(); sourcedb.open("sqlite_file:source.db"); diff --git a/CondCore/IOVService/test/testqueryPContainer.cc b/CondCore/IOVService/test/testqueryPContainer.cc index d30a55d551959..5b0adeceb92f8 100644 --- a/CondCore/IOVService/test/testqueryPContainer.cc +++ b/CondCore/IOVService/test/testqueryPContainer.cc @@ -12,7 +12,7 @@ int main(){ try{ edmplugin::PluginManager::configure(edmplugin::standard::config()); cond::DbConnection connection; - connection.configuration().setMessageLevel( coral::Debug ); + //connection.configuration().setMessageLevel( coral::Debug ); std::cout<<"#0 "< #include #include #include +#ifdef AP_NOT_FOR_RIGHT_NOW + static std::string const prefix("LCGReflex/"); -Reflex::Type resolvedType(const Reflex::Type& typ){ - Reflex::Type resolvedType = typ; +edm::TypeWithDict resolvedType(const edm::TypeWithDict& typ){ + edm::TypeWithDict resolvedType = typ; while(resolvedType.IsTypedef()){ resolvedType = resolvedType.ToType(); } @@ -43,17 +46,17 @@ bool isSTLContainer( const std::string& contName ){ return false; } -bool isBasic( const Reflex::Type& typ ){ +bool isBasic( const edm::TypeWithDict& typ ){ return ( typ.IsFundamental() || typ.IsEnum() || typ.Name(Reflex::SCOPED|Reflex::FINAL) == "std::string" || typ.Name(Reflex::SCOPED|Reflex::FINAL) == "std::basic_string" ); } -void processType( const Reflex::Type& t, +void processType( const edm::TypeWithDict& t, std::map,std::set > >& outList, std::set& doneList ){ - Reflex::Type objType = t; + edm::TypeWithDict objType = t; std::string className = objType.Name( Reflex::SCOPED|Reflex::FINAL ); auto iD = doneList.find( className ); if( iD != doneList.end() ) return; @@ -63,9 +66,9 @@ void processType( const Reflex::Type& t, std::set bases; std::set members; - while( objType.IsArray() ) objType = objType.ToType(); + while( objType.isArray() ) objType = objType.ToType(); if( isBasic( objType ) ) return; - Reflex::TypeTemplate templ = objType.TemplateFamily(); + edm::TypeWithDictTemplate templ = objType.TemplateFamily(); if ( templ ) { className = templ.Name(Reflex::SCOPED|Reflex::FINAL); if( isSTLContainer( className ) ) return; @@ -73,13 +76,13 @@ void processType( const Reflex::Type& t, for ( size_t i=0;iload(prefix + line); - Reflex::Type t = Reflex::Type::ByName( line ); + edm::TypeWithDict t = edm::TypeWithDict::ByName( line ); if( ! t ) throw std::runtime_error("Class "+line+" is not known by the dictionary"); processType( t, outList, doneList ); } @@ -166,3 +169,11 @@ int main ( int argc, char *argv[] ) } } } +#else // AP_NOT_FOR_RIGHT_NOW + +int main() +{ + return 0; +} + +#endif // defined AP_NOT_FOR_RIGHT_NOW diff --git a/CondCore/ORA/interface/IBlobStreamingService.h b/CondCore/ORA/interface/IBlobStreamingService.h index 1bed13c30a4b3..f2cee28c188a8 100644 --- a/CondCore/ORA/interface/IBlobStreamingService.h +++ b/CondCore/ORA/interface/IBlobStreamingService.h @@ -7,8 +7,8 @@ namespace coral { class Blob; } -namespace Reflex { - class Type; +namespace edm { + class TypeWithDict; } namespace ora { @@ -20,10 +20,10 @@ namespace ora { /// Empty destructor virtual ~IBlobStreamingService() {} - virtual boost::shared_ptr write( const void* addressOfInputData, const Reflex::Type& classDictionary, bool useCompression = true ) = 0; + virtual boost::shared_ptr write( const void* addressOfInputData, const edm::TypeWithDict & classDictionary, bool useCompression = true ) = 0; /// Reads an object from a Blob and fills-in the container - virtual void read( const coral::Blob& blobData, void* addressOfContainer, const Reflex::Type& classDictionary ) = 0; + virtual void read( const coral::Blob& blobData, void* addressOfContainer, const edm::TypeWithDict& classDictionary ) = 0; }; } diff --git a/CondCore/ORA/interface/Object.h b/CondCore/ORA/interface/Object.h index 4588b4778ddcf..21edcc22fcc3c 100644 --- a/CondCore/ORA/interface/Object.h +++ b/CondCore/ORA/interface/Object.h @@ -1,11 +1,12 @@ #ifndef INCLUDE_ORA_OBJECT_H #define INCLUDE_ORA_OBJECT_H +#include // #include #include // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { @@ -15,7 +16,7 @@ namespace ora { template explicit Object( const T& obj ); Object( const void* ptr, const std::type_info& typeInfo ); - Object( const void* ptr, const Reflex::Type& type ); + Object( const void* ptr, const edm::TypeWithDict& type ); Object( const void* ptr, const std::string& typeName ); Object( const Object& rhs); virtual ~Object(); @@ -23,7 +24,7 @@ namespace ora { bool operator==( const Object& rhs) const; bool operator!=( const Object& rhs) const; void* address() const; - const Reflex::Type& type() const; + const edm::TypeWithDict& type() const; std::string typeName() const; void* cast( const std::type_info& asType ) const; template T* cast() const; @@ -31,7 +32,7 @@ namespace ora { void destruct(); private: void* m_ptr; - Reflex::Type m_type; + edm::TypeWithDict m_type; }; template<> diff --git a/CondCore/ORA/src/ArrayHandlerFactory.cc b/CondCore/ORA/src/ArrayHandlerFactory.cc index b907e3ff37c72..26a8fe99f506f 100644 --- a/CondCore/ORA/src/ArrayHandlerFactory.cc +++ b/CondCore/ORA/src/ArrayHandlerFactory.cc @@ -4,17 +4,16 @@ #include "CArrayHandler.h" #include "PVectorHandler.h" // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" ora::IArrayHandler* -ora::ArrayHandlerFactory::newArrayHandler( const Reflex::Type& arrayType ) +ora::ArrayHandlerFactory::newArrayHandler( const edm::TypeWithDict& arrayType ) { - if(arrayType.IsArray()){ + if(arrayType.isArray()){ return new CArrayHandler( arrayType ); } else { - Reflex::TypeTemplate templ = arrayType.TemplateFamily(); - if ( templ ) { - std::string contName = templ.Name(Reflex::SCOPED|Reflex::FINAL); + if ( arrayType.isTemplateInstance() ) { + std::string contName = arrayType.templateName(); if( contName == "std::vector" || contName == "std::list" || contName == "std::set" || @@ -36,7 +35,7 @@ ora::ArrayHandlerFactory::newArrayHandler( const Reflex::Type& arrayType ) } } - throwException( "No Array Handler available for class \""+arrayType.Name(Reflex::SCOPED)+"\"", + throwException( "No Array Handler available for class \""+arrayType.templateName()+"\"", "ArrayHandlerFactory::newArrayHandler"); return 0; } diff --git a/CondCore/ORA/src/ArrayHandlerFactory.h b/CondCore/ORA/src/ArrayHandlerFactory.h index 05f03b64cff3e..150764fe87c51 100644 --- a/CondCore/ORA/src/ArrayHandlerFactory.h +++ b/CondCore/ORA/src/ArrayHandlerFactory.h @@ -1,8 +1,8 @@ #ifndef INCLUDE_ORA_ARRAYHANDLERFACTORY_H #define INCLUDE_ORA_ARRAYHANDLERFACTORY_H -namespace Reflex { - class Type; +namespace edm { + class TypeWithDict; } namespace ora { @@ -16,7 +16,7 @@ namespace ora { class ArrayHandlerFactory { public: - static IArrayHandler* newArrayHandler( const Reflex::Type& arrayType ); + static IArrayHandler* newArrayHandler( const edm::TypeWithDict& arrayType ); }; } diff --git a/CondCore/ORA/src/BlobStreamer.cc b/CondCore/ORA/src/BlobStreamer.cc index 1a228bd2f07ba..14df640bcf10c 100644 --- a/CondCore/ORA/src/BlobStreamer.cc +++ b/CondCore/ORA/src/BlobStreamer.cc @@ -13,7 +13,7 @@ #include "CoralBase/Attribute.h" #include "CoralBase/Blob.h" -ora::BlobWriterBase::BlobWriterBase( const Reflex::Type& objectType, +ora::BlobWriterBase::BlobWriterBase( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), @@ -64,7 +64,7 @@ void ora::BlobWriterBase::bindData( const void* data ){ relDataElement.bind( *blobData ); } -ora::BlobWriter::BlobWriter( const Reflex::Type& objectType, +ora::BlobWriter::BlobWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): BlobWriterBase( objectType, mapping, contSchema ){ @@ -87,7 +87,7 @@ void ora::BlobWriter::write( int, bindData( data ); } -ora::BlobUpdater::BlobUpdater( const Reflex::Type& objectType, +ora::BlobUpdater::BlobUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): BlobWriterBase( objectType, mapping, contSchema ){ @@ -111,7 +111,7 @@ void ora::BlobUpdater::update( int, } -ora::BlobReader::BlobReader( const Reflex::Type& objectType, +ora::BlobReader::BlobReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), @@ -165,7 +165,7 @@ void ora::BlobReader::read( void* data ){ void ora::BlobReader::clear(){ } -ora::BlobStreamer::BlobStreamer( const Reflex::Type& objectType, +ora::BlobStreamer::BlobStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), diff --git a/CondCore/ORA/src/BlobStreamer.h b/CondCore/ORA/src/BlobStreamer.h index 2238cd1d442b7..cf199899e6d36 100644 --- a/CondCore/ORA/src/BlobStreamer.h +++ b/CondCore/ORA/src/BlobStreamer.h @@ -3,7 +3,7 @@ #include "IRelationalStreamer.h" // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { @@ -15,7 +15,7 @@ namespace ora { class BlobWriterBase { public: - BlobWriterBase( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + BlobWriterBase( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~BlobWriterBase(); @@ -24,7 +24,7 @@ namespace ora { void bindData( const void* data ); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; int m_columnIndex; ContainerSchema& m_schema; @@ -40,7 +40,7 @@ namespace ora { class BlobWriter : public BlobWriterBase, public IRelationalWriter { public: - BlobWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + BlobWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~BlobWriter(); @@ -56,7 +56,7 @@ namespace ora { class BlobUpdater : public BlobWriterBase, public IRelationalUpdater { public: - BlobUpdater( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + BlobUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~BlobUpdater(); @@ -71,7 +71,7 @@ namespace ora { class BlobReader : public IRelationalReader { public: - BlobReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + BlobReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~BlobReader(); @@ -86,7 +86,7 @@ namespace ora { void clear(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; int m_columnIndex; ContainerSchema& m_schema; @@ -101,7 +101,7 @@ namespace ora { class BlobStreamer : public IRelationalStreamer { public: - BlobStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + BlobStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); ~BlobStreamer(); @@ -112,7 +112,7 @@ namespace ora { IRelationalReader* newReader(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; ContainerSchema& m_schema; }; diff --git a/CondCore/ORA/src/CArrayHandler.cc b/CondCore/ORA/src/CArrayHandler.cc index e7f9845d4f6ab..dac6c8b4256e2 100644 --- a/CondCore/ORA/src/CArrayHandler.cc +++ b/CondCore/ORA/src/CArrayHandler.cc @@ -1,10 +1,10 @@ #include "CArrayHandler.h" #include "ClassUtils.h" // externals -#include "Reflex/Object.h" +#include "FWCore/Utilities/interface/ObjectWithDict.h" ora::CArrayIteratorHandler::CArrayIteratorHandler( const void* startAddress, - const Reflex::Type& iteratorReturnType ): + const edm::TypeWithDict& iteratorReturnType ): m_returnType(iteratorReturnType), m_currentElement(startAddress){ @@ -15,7 +15,7 @@ ora::CArrayIteratorHandler::~CArrayIteratorHandler(){} void ora::CArrayIteratorHandler::increment() { - m_currentElement = static_cast< const char* >( m_currentElement) + m_returnType.SizeOf(); + m_currentElement = static_cast< const char* >( m_currentElement) + m_returnType.size(); } void* @@ -24,19 +24,19 @@ ora::CArrayIteratorHandler::object() return const_cast(m_currentElement); } -Reflex::Type& +edm::TypeWithDict& ora::CArrayIteratorHandler::returnType() { return m_returnType; } -ora::CArrayHandler::CArrayHandler( const Reflex::Type& dictionary ): +ora::CArrayHandler::CArrayHandler( const edm::TypeWithDict& dictionary ): m_type( dictionary ), m_elementType() { // find the iterator return type - Reflex::Type elementType = m_type.ToType(); + edm::TypeWithDict elementType = m_type.toType(); m_elementType = ClassUtils::resolvedType( elementType ); } @@ -46,8 +46,8 @@ ora::CArrayHandler::~CArrayHandler(){ size_t ora::CArrayHandler::size( const void* ) -{ - return m_type.ArrayLength(); +{ + return ClassUtils::arrayLength( m_type ); } @@ -68,7 +68,7 @@ ora::CArrayHandler::clear( const void* ) { } -Reflex::Type& +edm::TypeWithDict& ora::CArrayHandler::iteratorReturnType() { return m_elementType; diff --git a/CondCore/ORA/src/CArrayHandler.h b/CondCore/ORA/src/CArrayHandler.h index 17d858880ebc8..70482626bd04f 100644 --- a/CondCore/ORA/src/CArrayHandler.h +++ b/CondCore/ORA/src/CArrayHandler.h @@ -3,14 +3,14 @@ #include "IArrayHandler.h" // externals -#include "Reflex/Reflex.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { class CArrayIteratorHandler : virtual public IArrayIteratorHandler { public: /// Constructor - CArrayIteratorHandler( const void* startAddress, const Reflex::Type& iteratorReturnType ); + CArrayIteratorHandler( const void* startAddress, const edm::TypeWithDict& iteratorReturnType ); /// Destructor ~CArrayIteratorHandler(); @@ -22,12 +22,12 @@ namespace ora { void* object(); /// Returns the return type of the iterator dereference method - Reflex::Type& returnType(); + edm::TypeWithDict& returnType(); private: /// The return type of the iterator dereference method - Reflex::Type m_returnType; + edm::TypeWithDict m_returnType; /// Current element object pointer const void* m_currentElement; @@ -38,7 +38,7 @@ namespace ora { public: /// Constructor - explicit CArrayHandler( const Reflex::Type& dictionary ); + explicit CArrayHandler( const edm::TypeWithDict& dictionary ); /// Destructor ~CArrayHandler(); @@ -56,17 +56,17 @@ namespace ora { void clear( const void* address ); /// Returns the iterator return type - Reflex::Type& iteratorReturnType(); + edm::TypeWithDict& iteratorReturnType(); /// Returns the associativeness of the container bool isAssociative() const { return false; } private: /// The dictionary information - Reflex::Type m_type; + edm::TypeWithDict m_type; /// The iterator return type - Reflex::Type m_elementType; + edm::TypeWithDict m_elementType; }; diff --git a/CondCore/ORA/src/CArrayStreamer.cc b/CondCore/ORA/src/CArrayStreamer.cc index 9290dbb33a41f..954dd09010904 100644 --- a/CondCore/ORA/src/CArrayStreamer.cc +++ b/CondCore/ORA/src/CArrayStreamer.cc @@ -12,9 +12,9 @@ // externals #include "CoralBase/Attribute.h" #include "RelationalAccess/IBulkOperation.h" -#include "Reflex/Object.h" +#include "FWCore/Utilities/interface/ObjectWithDict.h" -ora::CArrayWriter::CArrayWriter( const Reflex::Type& objectType, +ora::CArrayWriter::CArrayWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), @@ -41,12 +41,12 @@ bool ora::CArrayWriter::build( DataElement& offset, m_recordId.push_back(0); // Check the array type - Reflex::Type arrayType = m_objectType.ToType(); - Reflex::Type arrayResolvedType = ClassUtils::resolvedType(arrayType); + edm::TypeWithDict arrayType = m_objectType.toType(); + edm::TypeWithDict arrayResolvedType = ClassUtils::resolvedType(arrayType); // Check the component type if ( ! arrayType || !arrayResolvedType ) { throwException( "Missing dictionary information for the element type of the array \"" + - m_objectType.Name(Reflex::SCOPED|Reflex::FINAL) + "\"", + m_objectType.cppName() + "\"", "CArrayWriter::build" ); } @@ -67,7 +67,7 @@ bool ora::CArrayWriter::build( DataElement& offset, m_arrayHandler.reset( ArrayHandlerFactory::newArrayHandler( m_objectType ) ); - std::string arrayTypeName = arrayType.Name(); + std::string arrayTypeName = arrayType.name(); // Retrieve the relevant mapping element MappingElement::iterator iMe = m_mappingElement.find( arrayTypeName ); if ( iMe == m_mappingElement.end() ) { @@ -138,7 +138,7 @@ void ora::CArrayWriter::write( int oid, } -ora::CArrayUpdater::CArrayUpdater(const Reflex::Type& objectType, +ora::CArrayUpdater::CArrayUpdater(const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_deleter( mapping ), @@ -166,7 +166,7 @@ void ora::CArrayUpdater::update( int oid, m_writer.write( oid, data ); } -ora::CArrayReader::CArrayReader(const Reflex::Type& objectType, +ora::CArrayReader::CArrayReader(const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), @@ -193,12 +193,12 @@ bool ora::CArrayReader::build( DataElement& offset, m_recordId.push_back(0); // Check the array type - Reflex::Type arrayType = m_objectType.ToType(); - Reflex::Type arrayResolvedType = ClassUtils::resolvedType(arrayType); + edm::TypeWithDict arrayType = m_objectType.toType(); + edm::TypeWithDict arrayResolvedType = ClassUtils::resolvedType(arrayType); // Check the component type if ( ! arrayType || !arrayResolvedType ) { throwException( "Missing dictionary information for the element type of the array \"" + - m_objectType.Name(Reflex::SCOPED|Reflex::FINAL) + "\"", + m_objectType.cppName() + "\"", "CArrayReader::build" ); } @@ -217,7 +217,7 @@ bool ora::CArrayReader::build( DataElement& offset, m_arrayHandler.reset( ArrayHandlerFactory::newArrayHandler( m_objectType ) ); - std::string arrayTypeName = arrayType.Name(); + std::string arrayTypeName = arrayType.name(); // Retrieve the relevant mapping element MappingElement::iterator iMe = m_mappingElement.find( arrayTypeName ); @@ -258,13 +258,13 @@ void ora::CArrayReader::read( void* destinationData ) { } void* address = m_offset->address( destinationData ); - Reflex::Type iteratorDereferenceReturnType = m_arrayHandler->iteratorReturnType(); + edm::TypeWithDict iteratorDereferenceReturnType = m_arrayHandler->iteratorReturnType(); - bool isElementFundamental = iteratorDereferenceReturnType.IsFundamental(); + bool isElementFundamental = iteratorDereferenceReturnType.isFundamental(); std::string positionColumn = m_mappingElement.posColumn(); - size_t arraySize = m_objectType.ArrayLength(); + size_t arraySize = ClassUtils::arrayLength( m_objectType ); m_arrayHandler->clear( address ); @@ -288,11 +288,11 @@ void ora::CArrayReader::read( void* destinationData ) { } // the memory has been allocated already! - objectData = static_cast(address)+arrayIndex*iteratorDereferenceReturnType.SizeOf(); + objectData = static_cast(address)+arrayIndex*iteratorDereferenceReturnType.size(); if(!isElementFundamental){ // in this case the initialization is required: use default constructor... - iteratorDereferenceReturnType.Construct(Reflex::Type(0,0),std::vector< void* >(),objectData); + iteratorDereferenceReturnType.construct();// edm::TypeWithDict(0,0),std::vector< void* >(),objectData); } m_dataReader->setRecordId( m_recordId ); @@ -309,7 +309,7 @@ void ora::CArrayReader::clear(){ if(m_dataReader.get()) m_dataReader->clear(); } -ora::CArrayStreamer::CArrayStreamer( const Reflex::Type& objectType, +ora::CArrayStreamer::CArrayStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), diff --git a/CondCore/ORA/src/CArrayStreamer.h b/CondCore/ORA/src/CArrayStreamer.h index df01f45c931c4..bc78a89cdd53a 100644 --- a/CondCore/ORA/src/CArrayStreamer.h +++ b/CondCore/ORA/src/CArrayStreamer.h @@ -7,7 +7,7 @@ // #include // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { @@ -22,7 +22,7 @@ namespace ora { public: /// Constructor - CArrayWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + CArrayWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~CArrayWriter(); bool build( DataElement& offset, IRelationalData& relationalData, RelationalBuffer& operationBuffer ); @@ -33,7 +33,7 @@ namespace ora { void write( int oid,const void* data ); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mappingElement; ContainerSchema& m_schema; std::vector m_recordId; @@ -52,7 +52,7 @@ namespace ora { public: /// Constructor - CArrayUpdater(const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + CArrayUpdater(const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~CArrayUpdater(); @@ -74,7 +74,7 @@ namespace ora { public: /// Constructor - CArrayReader(const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + CArrayReader(const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~CArrayReader(); @@ -90,7 +90,7 @@ namespace ora { void clear(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mappingElement; ContainerSchema& m_schema; std::vector m_recordId; @@ -106,7 +106,7 @@ namespace ora { class CArrayStreamer : public IRelationalStreamer { public: - CArrayStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + CArrayStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); ~CArrayStreamer(); @@ -117,7 +117,7 @@ namespace ora { IRelationalReader* newReader(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; ContainerSchema& m_schema; }; diff --git a/CondCore/ORA/src/ClassUtils.cc b/CondCore/ORA/src/ClassUtils.cc index 90374b06213dc..c313ecb683d07 100644 --- a/CondCore/ORA/src/ClassUtils.cc +++ b/CondCore/ORA/src/ClassUtils.cc @@ -4,12 +4,15 @@ #include "FWCore/PluginManager/interface/PluginCapabilities.h" #include "ClassUtils.h" // +#include #include // externals -#include "Reflex/Object.h" -#include "Reflex/Base.h" +#include "FWCore/Utilities/interface/ObjectWithDict.h" +#include "FWCore/Utilities/interface/BaseWithDict.h" +#include "TROOT.h" +#include "TDictAttributeMap.h" -ora::RflxDeleter::RflxDeleter( const Reflex::Type& type ): +ora::RflxDeleter::RflxDeleter( const edm::TypeWithDict& type ): m_type( type ){ } @@ -21,7 +24,7 @@ ora::RflxDeleter::~RflxDeleter(){ } void ora::RflxDeleter::operator()( void* ptr ){ - m_type.Destruct( ptr ); + m_type.destruct( ptr ); } void ora::ClassUtils::loadDictionary( const std::string& className ){ @@ -29,46 +32,116 @@ void ora::ClassUtils::loadDictionary( const std::string& className ){ edmplugin::PluginCapabilities::get()->load(prefix + className); } -void* ora::ClassUtils::upCast( const Reflex::Type& type, +void* ora::ClassUtils::upCast( const edm::TypeWithDict& type, void* ptr, - const Reflex::Type& castType ){ + const edm::TypeWithDict& castType ){ void* ret = 0; if( type == castType ){ ret = ptr; - } else if( type.HasBase( castType )){ - Reflex::Object theObj( type, ptr ); - ret = theObj.CastObject( castType ).Address(); + } else if( type.hasBase( castType )){ + ret = reinterpret_cast(reinterpret_cast(ptr) + type.getBaseClassOffset(castType)); } return ret; } -bool ora::ClassUtils::isType( const Reflex::Type& type, - const Reflex::Type& baseType ){ +bool ora::ClassUtils::isType( const edm::TypeWithDict& type, + const edm::TypeWithDict& baseType ){ bool ret = false; - if( type == baseType || type.HasBase( baseType )){ + if( type == baseType || type.hasBase( baseType )){ ret = true; } return ret; } -bool ora::ClassUtils::checkMappedType( const Reflex::Type& type, - const std::string& mappedTypeName ){ +static +void +replaceString(std::string& name, std::string const& from, std::string const& to) { + // from must not be a substring of to. + std::string::size_type length = from.size(); + std::string::size_type pos = 0; + while((pos = name.find(from, pos)) != std::string::npos) { + name.replace(pos, length, to); + } +} + +static +bool +compareWithSuffixes(std::string const& name, std::string const& other) { + size_t pos = name.find('<'); + if(pos == std::string::npos) { + // Not a template instance + return false; + } + size_t nameSize = name.size(); + if(other.size() >= nameSize) { + // Can't be a case with ull qualifiers no name. + return false; + } + if(name.substr(0, pos) != other.substr(0, pos)) { + return false; + } + int nesting = 0; + size_t j = pos; + for(size_t i = pos; i < nameSize; ++i) { + char c = name[i]; + if (c == '<') ++nesting; + if(c != other[j]) { + if(c != 'u' && c != 'l') return false; + if(nesting == 0) return false; + if(!isdigit(name[i-1])) return false; + for(size_t n = i-2; n >= pos; --n) { + char q = name[n]; + if(q == '<' || q == ',') break; + if(!isdigit(q)) return false; + } + for(size_t n = i+1; n < nameSize; ++n) { + char q = name[n]; + if(q == '>' || q == ',') break; + if(q != 'l') return false; + ++i; + } + continue; + } + if (c == '>') --nesting; + ++j; + } + return true; +} + +bool ora::ClassUtils::checkMappedType( const edm::TypeWithDict& type, + const std::string& mappedTypeName ){ if( isTypeString( type ) ){ return (mappedTypeName=="std::basic_string" || mappedTypeName=="basic_string" || mappedTypeName=="std::string" || mappedTypeName=="string"); - } else if ( type.IsEnum() ){ + } else if ( type.isEnum() ){ return mappedTypeName=="int"; } else if ( isTypeOraVector( type ) ){ return isTypeNameOraVector( mappedTypeName ); - } else { - return type.Name(Reflex::SCOPED)==mappedTypeName; + } else if ( type.cppName() == mappedTypeName ) { + return true; + } + // ROOT 6 uses these typedefs in names. + std::string typeName(mappedTypeName); + replaceString(typeName, "std::basic_string ", "std::string"); + replaceString(typeName, "std::basic_string", "std::string"); + if ( type.cppName() == typeName ) { + return true; } + // Ignore u and l qualifiers off of integer template parameters for comparison + return ( compareWithSuffixes( type.cppName(), typeName ) ); } -bool ora::ClassUtils::findBaseType( Reflex::Type& type, Reflex::Type& baseType, Reflex::OffsetFunction& func ){ +bool ora::ClassUtils::findBaseType( edm::TypeWithDict& type, edm::TypeWithDict& baseType, size_t& func ){ bool found = false; + if ( ! type.hasBase(baseType) ) { + return found; // no inheritance, nothing to do + } else { + func = type.getBaseClassOffset(baseType); + found = true; + } +/*-ap old code for ( unsigned int i=0;i" ){ // ugly, but no other way with Reflex... - type = Reflex::Type::ByName("std::string"); + type = edm::TypeWithDict::byName("std::string"); } if( !type ){ loadDictionary( className ); - type = Reflex::Type::ByName( className ); + type = edm::TypeWithDict::byName( className ); } if( !type && throwFlag ){ throwException( "Class \""+className+"\" has not been found in the dictionary.", @@ -124,32 +199,31 @@ Reflex::Type ora::ClassUtils::lookupDictionary( const std::string& className, bo return type; } -void* ora::ClassUtils::constructObject( const Reflex::Type& typ ){ +void* ora::ClassUtils::constructObject( const edm::TypeWithDict& typ ){ void* ptr = 0; - if( typ.Name(Reflex::SCOPED)=="std::string"){ + if( typ.cppName()=="std::string"){ ptr = new std::string(""); } else { - ptr = typ.Construct().Address(); + ptr = typ.construct().address(); } return ptr; } -bool ora::ClassUtils::isTypeString(const Reflex::Type& typ){ - std::string name = typ.Name(Reflex::SCOPED|Reflex::FINAL); +bool ora::ClassUtils::isTypeString(const edm::TypeWithDict& typ){ + std::string name = typ.cppName(); return ( name == "std::string" || name == "std::basic_string" ); } -bool ora::ClassUtils::isTypePrimitive(const Reflex::Type& typ){ - return ( typ.IsFundamental() || typ.IsEnum() || isTypeString( typ ) ); +bool ora::ClassUtils::isTypePrimitive(const edm::TypeWithDict& typ){ + return ( typ.isFundamental() || typ.isEnum() || isTypeString( typ ) ); } -bool ora::ClassUtils::isTypeContainer(const Reflex::Type& typ){ - Reflex::TypeTemplate templ = typ.TemplateFamily(); - if (! templ) { +bool ora::ClassUtils::isTypeContainer(const edm::TypeWithDict& typ){ + if ( ! typ.isTemplateInstance() ) { return false; } else { - std::string contName = templ.Name(Reflex::SCOPED|Reflex::FINAL); + std::string contName = typ.templateName(); if( contName == "std::vector" || contName == "std::list" || contName == "std::deque" || @@ -170,12 +244,11 @@ bool ora::ClassUtils::isTypeContainer(const Reflex::Type& typ){ return false; } -bool ora::ClassUtils::isTypeKeyedContainer(const Reflex::Type& typ){ - Reflex::TypeTemplate tt = typ.TemplateFamily(); - if (! tt) { +bool ora::ClassUtils::isTypeKeyedContainer(const edm::TypeWithDict& typ){ + if ( ! typ.isTemplateInstance() ) { return false; } else { - std::string contName = tt.Name(Reflex::SCOPED|Reflex::FINAL); + std::string contName = typ.templateName(); if( contName == "std::map" || contName == "std::multimap" || contName == "std::set" || @@ -190,12 +263,11 @@ bool ora::ClassUtils::isTypeKeyedContainer(const Reflex::Type& typ){ return false; } -bool ora::ClassUtils::isTypeNonKeyedContainer(const Reflex::Type& typ){ - Reflex::TypeTemplate templ = typ.TemplateFamily(); - if (! templ) { +bool ora::ClassUtils::isTypeNonKeyedContainer(const edm::TypeWithDict& typ){ + if ( ! typ.isTemplateInstance() ) { return false; } else { - std::string contName = templ.Name(Reflex::SCOPED|Reflex::FINAL); + std::string contName = typ.templateName(); if( contName == "std::vector" || contName == "std::list" || contName == "std::deque" || @@ -208,12 +280,11 @@ bool ora::ClassUtils::isTypeNonKeyedContainer(const Reflex::Type& typ){ return false; } -bool ora::ClassUtils::isTypeAssociativeContainer(const Reflex::Type& typ){ - Reflex::TypeTemplate tt = typ.TemplateFamily(); - if (! tt) { +bool ora::ClassUtils::isTypeAssociativeContainer(const edm::TypeWithDict& typ){ + if ( ! typ.isTemplateInstance() ) { return false; } else { - std::string contName = tt.Name(Reflex::SCOPED|Reflex::FINAL); + std::string contName = typ.templateName(); if( contName == "std::map" || contName == "std::multimap" || contName == "__gnu_cxx::hash_map" || @@ -224,12 +295,11 @@ bool ora::ClassUtils::isTypeAssociativeContainer(const Reflex::Type& typ){ return false; } -bool ora::ClassUtils::isTypeNonAssociativeContainer(const Reflex::Type& typ){ - Reflex::TypeTemplate tt = typ.TemplateFamily(); - if (! tt) { +bool ora::ClassUtils::isTypeNonAssociativeContainer(const edm::TypeWithDict& typ){ + if ( ! typ.isTemplateInstance() ) { return false; } else { - std::string contName = tt.Name(Reflex::SCOPED|Reflex::FINAL); + std::string contName = typ.templateName(); if( contName == "std::vector" || contName == "std::list" || contName == "std::deque" || @@ -247,12 +317,11 @@ bool ora::ClassUtils::isTypeNonAssociativeContainer(const Reflex::Type& typ){ } -bool ora::ClassUtils::isTypeOraPointer( const Reflex::Type& typ){ - Reflex::TypeTemplate templ = typ.TemplateFamily(); - if (! templ) { +bool ora::ClassUtils::isTypeOraPointer( const edm::TypeWithDict& typ){ + if ( ! typ.isTemplateInstance() ) { return false; } else { - std::string contName = templ.Name(Reflex::SCOPED|Reflex::FINAL); + std::string contName = typ.templateName(); if( contName == "ora::Ptr" ){ return true; } @@ -260,20 +329,19 @@ bool ora::ClassUtils::isTypeOraPointer( const Reflex::Type& typ){ return false; } -bool ora::ClassUtils::isTypeOraReference( const Reflex::Type& typ){ - return typ.HasBase(Reflex::Type::ByTypeInfo(typeid(ora::Reference))); +bool ora::ClassUtils::isTypeOraReference( const edm::TypeWithDict& typ){ + return typ.hasBase( edm::TypeWithDict(typeid(ora::Reference)) ); } -bool ora::ClassUtils::isTypeNamedReference( const Reflex::Type& typ){ - return typ.HasBase(Reflex::Type::ByTypeInfo(typeid(ora::NamedReference))); +bool ora::ClassUtils::isTypeNamedReference( const edm::TypeWithDict& typ){ + return typ.hasBase( edm::TypeWithDict(typeid(ora::NamedReference)) ); } -bool ora::ClassUtils::isTypeUniqueReference( const Reflex::Type& typ){ - Reflex::TypeTemplate templ = typ.TemplateFamily(); - if (! templ) { +bool ora::ClassUtils::isTypeUniqueReference( const edm::TypeWithDict& typ){ + if ( ! typ.isTemplateInstance() ) { return false; } else { - std::string contName = templ.Name(Reflex::SCOPED|Reflex::FINAL); + std::string contName = typ.templateName(); if( contName == "ora::UniqueRef" ){ return true; } @@ -281,12 +349,11 @@ bool ora::ClassUtils::isTypeUniqueReference( const Reflex::Type& typ){ return false; } -bool ora::ClassUtils::isTypePVector( const Reflex::Type& typ){ - Reflex::TypeTemplate templ = typ.TemplateFamily(); - if (! templ) { +bool ora::ClassUtils::isTypePVector( const edm::TypeWithDict& typ){ + if ( ! typ.isTemplateInstance() ) { return false; } else { - std::string contName = templ.Name(Reflex::SCOPED|Reflex::FINAL); + std::string contName = typ.templateName(); if( contName == "ora::PVector" ){ return true; } @@ -294,12 +361,11 @@ bool ora::ClassUtils::isTypePVector( const Reflex::Type& typ){ return false; } -bool ora::ClassUtils::isTypeQueryableVector( const Reflex::Type& typ){ - Reflex::TypeTemplate templ = typ.TemplateFamily(); - if (! templ) { +bool ora::ClassUtils::isTypeQueryableVector( const edm::TypeWithDict& typ){ + if ( ! typ.isTemplateInstance() ) { return false; } else { - std::string contName = templ.Name(Reflex::SCOPED|Reflex::FINAL); + std::string contName = typ.templateName(); if( contName == "ora::QueryableVector" ){ return true; } @@ -307,7 +373,7 @@ bool ora::ClassUtils::isTypeQueryableVector( const Reflex::Type& typ){ return false; } -bool ora::ClassUtils::isTypeOraVector( const Reflex::Type& typ){ +bool ora::ClassUtils::isTypeOraVector( const edm::TypeWithDict& typ){ if( isTypePVector( typ ) || isTypeQueryableVector( typ ) ){ return true; } @@ -323,28 +389,29 @@ bool ora::ClassUtils::isTypeNameOraVector( const std::string& typeName ){ return false; } -bool ora::ClassUtils::isTypeObject( const Reflex::Type& typ){ - Reflex::Type resType = ClassUtils::resolvedType( typ ); +bool ora::ClassUtils::isTypeObject( const edm::TypeWithDict& typ){ + edm::TypeWithDict resType = ClassUtils::resolvedType( typ ); if( isTypePrimitive( resType ) ) { //if ( resType.IsFundamental() || resType.IsEnum() || isTypeString(resType) ) { return false; } else { - if( resType.IsArray() ) return false; - if( isTypeContainer( resType ) ) return false; - if( isTypeOraPointer( resType ) ) return false; + if( resType.isArray( ) ) return false; + if( isTypeContainer( resType ) ) return false; + if( isTypeOraPointer( resType ) ) return false; if( isTypeUniqueReference( resType ) ) return false; - if( isTypeOraVector( resType ) ) return false; + if( isTypeOraVector( resType ) ) return false; } return true; } -Reflex::Type ora::ClassUtils::containerValueType(const Reflex::Type& typ){ - Reflex::Type valueType; +edm::TypeWithDict ora::ClassUtils::containerValueType(const edm::TypeWithDict& typ){ + /*-ap old code + edm::TypeWithDict valueType; // find the iterator return type as the member value_type of the containers size_t subTypeSize = typ.SubTypeSize(); size_t i=0; while(iGetAttributeMap(); + if( classProps && classProps->HasKey( propertyName.c_str() ) ){ + ret = classProps->GetPropertyAsString( propertyName.c_str() ); + } + } + return ret; +} + +std::string ora::ClassUtils::getDataMemberProperty( const std::string& propertyName, + const edm::MemberWithDict& dataMember ){ + std::string ret(""); + TClass* declaringClass = dataMember.declaringType().getClass(); + if( declaringClass ){ + auto dm = declaringClass->GetDataMember( dataMember.name().c_str() ); + if( dm ) { + TDictAttributeMap* memberProps = dm->GetAttributeMap(); + if( memberProps && memberProps->HasKey( propertyName.c_str() ) ){ + ret = memberProps->GetPropertyAsString( propertyName.c_str() ); + } + } + } + return ret; } diff --git a/CondCore/ORA/src/ClassUtils.h b/CondCore/ORA/src/ClassUtils.h index 7c8848aac0408..cde2d71a2d4b5 100644 --- a/CondCore/ORA/src/ClassUtils.h +++ b/CondCore/ORA/src/ClassUtils.h @@ -2,14 +2,14 @@ #define INCLUDE_ORA_CLASSUTILS_H // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { class RflxDeleter{ public: - RflxDeleter( const Reflex::Type& type ); + RflxDeleter( const edm::TypeWithDict& type ); RflxDeleter( const RflxDeleter& rhs ); @@ -18,7 +18,7 @@ namespace ora { void operator()( void* ptr ); private: - Reflex::Type m_type; + edm::TypeWithDict m_type; }; @@ -26,64 +26,68 @@ namespace ora { void loadDictionary( const std::string& className ); - void* upCast( const Reflex::Type& type, void* ptr, const Reflex::Type& asType ); + void* upCast( const edm::TypeWithDict& type, void* ptr, const edm::TypeWithDict& asType ); - bool isType( const Reflex::Type& type, const Reflex::Type& baseType ); + bool isType( const edm::TypeWithDict& type, const edm::TypeWithDict& baseType ); - bool checkMappedType( const Reflex::Type& type, const std::string& mappedTypeName ); + bool checkMappedType( const edm::TypeWithDict& type, const std::string& mappedTypeName ); - bool findBaseType( Reflex::Type& type, Reflex::Type& baseType, Reflex::OffsetFunction& func ); + bool findBaseType( edm::TypeWithDict& type, edm::TypeWithDict& baseType, size_t& func ); std::string demangledName( const std::type_info& typeInfo ); - Reflex::Type lookupDictionary( const std::type_info& typeInfo, bool throwFlag = true ); + edm::TypeWithDict lookupDictionary( const std::type_info& typeInfo, bool throwFlag = true ); - Reflex::Type lookupDictionary( const std::string& className, bool throwFlag = true ); + edm::TypeWithDict lookupDictionary( const std::string& className, bool throwFlag = true ); - void* constructObject( const Reflex::Type& typ ); + void* constructObject( const edm::TypeWithDict& typ ); - bool isTypeString(const Reflex::Type& typ); + bool isTypeString(const edm::TypeWithDict& typ); - bool isTypePrimitive(const Reflex::Type& typ); + bool isTypePrimitive(const edm::TypeWithDict& typ); - bool isTypeContainer(const Reflex::Type& typ); + bool isTypeContainer(const edm::TypeWithDict& typ); - bool isTypeKeyedContainer(const Reflex::Type& typ); + bool isTypeKeyedContainer(const edm::TypeWithDict& typ); - bool isTypeNonKeyedContainer(const Reflex::Type& typ); + bool isTypeNonKeyedContainer(const edm::TypeWithDict& typ); - bool isTypeAssociativeContainer(const Reflex::Type& typ); + bool isTypeAssociativeContainer(const edm::TypeWithDict& typ); - bool isTypeNonAssociativeContainer(const Reflex::Type& typ); + bool isTypeNonAssociativeContainer(const edm::TypeWithDict& typ); - Reflex::Type containerValueType(const Reflex::Type& typ); + edm::TypeWithDict containerValueType(const edm::TypeWithDict& typ); - Reflex::Type containerKeyType(const Reflex::Type& typ); + edm::TypeWithDict containerKeyType(const edm::TypeWithDict& typ); - Reflex::Type containerDataType(const Reflex::Type& typ); + edm::TypeWithDict containerDataType(const edm::TypeWithDict& typ); - Reflex::Type containerSubType(const Reflex::Type& typ, const std::string& subTypeName); + edm::TypeWithDict containerSubType(const edm::TypeWithDict& typ, const std::string& subTypeName); - Reflex::Type resolvedType(const Reflex::Type& typ); + edm::TypeWithDict resolvedType(const edm::TypeWithDict& typ); - bool isTypeOraReference( const Reflex::Type& typ); + bool isTypeOraReference( const edm::TypeWithDict& typ); - bool isTypeNamedReference( const Reflex::Type& typ); + bool isTypeNamedReference( const edm::TypeWithDict& typ); - bool isTypeOraPointer( const Reflex::Type& typ); + bool isTypeOraPointer( const edm::TypeWithDict& typ); - bool isTypeUniqueReference( const Reflex::Type& typ); + bool isTypeUniqueReference( const edm::TypeWithDict& typ); - bool isTypePVector( const Reflex::Type& typ); + bool isTypePVector( const edm::TypeWithDict& typ); - bool isTypeQueryableVector( const Reflex::Type& typ); + bool isTypeQueryableVector( const edm::TypeWithDict& typ); - bool isTypeOraVector( const Reflex::Type& typ); + bool isTypeOraVector( const edm::TypeWithDict& typ); bool isTypeNameOraVector( const std::string& typeName ); - bool isTypeObject( const Reflex::Type& typ); + bool isTypeObject( const edm::TypeWithDict& typ); + size_t arrayLength( const edm::TypeWithDict& typ ); + + std::string getClassProperty( const std::string& propertyName, const edm::TypeWithDict& type ); + std::string getDataMemberProperty( const std::string& propertyName, const edm::MemberWithDict& dataMember ); } diff --git a/CondCore/ORA/src/Container.cc b/CondCore/ORA/src/Container.cc index 7ca6363b5c030..6d7ab33592c99 100644 --- a/CondCore/ORA/src/Container.cc +++ b/CondCore/ORA/src/Container.cc @@ -39,7 +39,7 @@ ora::Object ora::ContainerIterator::getItem(){ } boost::shared_ptr ora::ContainerIterator::getItemAsType( const std::type_info& asTypeInfo ){ - Reflex::Type castType = ClassUtils::lookupDictionary( asTypeInfo ); + edm::TypeWithDict castType = ClassUtils::lookupDictionary( asTypeInfo ); void* ptr = m_buffer->getItemAsType( castType ); return boost::shared_ptr( ptr, RflxDeleter( m_buffer->type() ) ); } @@ -77,8 +77,8 @@ const std::string& ora::Container::className(){ } std::string ora::Container::realClassName(){ - Reflex::Type type = ClassUtils::lookupDictionary( className() ); - std::string ret = ClassUtils::demangledName( type.TypeInfo() ); + edm::TypeWithDict type = ClassUtils::lookupDictionary( className() ); + std::string ret = ClassUtils::demangledName( type.typeInfo() ); ret.erase( std::remove( ret.begin(), ret.end(), ' ' ), ret.end() ); return ret; } @@ -97,7 +97,7 @@ ora::ContainerIterator ora::Container::iterator(){ } void ora::Container::extendSchema( const std::type_info& typeInfo ){ - Reflex::Type type = ClassUtils::lookupDictionary( typeInfo ); + edm::TypeWithDict type = ClassUtils::lookupDictionary( typeInfo ); m_dbContainer->extendSchema( type ); } @@ -112,7 +112,7 @@ ora::Object ora::Container::fetchItem(int itemId){ boost::shared_ptr ora::Container::fetchItemAsType(int itemId, const std::type_info& asTypeInfo){ - Reflex::Type asType = ClassUtils::lookupDictionary( asTypeInfo ); + edm::TypeWithDict asType = ClassUtils::lookupDictionary( asTypeInfo ); void* ptr = m_dbContainer->fetchItemAsType(itemId, asType ); if(!ptr) return boost::shared_ptr(); return boost::shared_ptr( ptr, RflxDeleter( m_dbContainer->type() ) ); @@ -127,7 +127,7 @@ bool ora::Container::isLocked(){ } int ora::Container::insertItem( const Object& data ){ - const Reflex::Type& objType = data.type(); + const edm::TypeWithDict& objType = data.type(); if(!objType){ throwException("Object class has not been found in the dictionary.", "Container::insertItem"); @@ -137,13 +137,13 @@ int ora::Container::insertItem( const Object& data ){ int ora::Container::insertItem( const void* data, const std::type_info& typeInfo ){ - Reflex::Type type = ClassUtils::lookupDictionary( typeInfo ); + edm::TypeWithDict type = ClassUtils::lookupDictionary( typeInfo ); return m_dbContainer->insertItem( data, type ); } void ora::Container::updateItem( int itemId, const Object& data ){ - const Reflex::Type& objType = data.type(); + const edm::TypeWithDict& objType = data.type(); if(!objType){ throwException("Object class has not been found in the dictionary.", "Container::updateItem"); @@ -154,7 +154,7 @@ void ora::Container::updateItem( int itemId, void ora::Container::updateItem( int itemId, const void* data, const std::type_info& typeInfo ){ - Reflex::Type type = ClassUtils::lookupDictionary( typeInfo ); + edm::TypeWithDict type = ClassUtils::lookupDictionary( typeInfo ); m_dbContainer->updateItem( itemId, data, type ); } diff --git a/CondCore/ORA/src/ContainerSchema.cc b/CondCore/ORA/src/ContainerSchema.cc index e50df442f5c4e..2780aacab40c3 100644 --- a/CondCore/ORA/src/ContainerSchema.cc +++ b/CondCore/ORA/src/ContainerSchema.cc @@ -49,11 +49,11 @@ namespace ora { ora::ContainerSchema::ContainerSchema( int containerId, const std::string& containerName, - const Reflex::Type& containerType, + const edm::TypeWithDict& containerType, DatabaseSession& session ): m_containerId( containerId ), m_containerName( containerName ), - m_className( containerType.Name( Reflex::SCOPED ) ), + m_className( containerType.cppName( ) ), m_classDict( containerType ), m_session( session ), m_loaded( false ), @@ -172,7 +172,7 @@ void ora::ContainerSchema::evolve(){ MappingGenerator mapGen( m_session.schema().storageSchema() ); // retrieve the base mapping MappingTree baseMapping; - if( !m_session.mappingDatabase().getBaseMappingForContainer( m_classDict.Name(Reflex::SCOPED), m_containerId, baseMapping )){ + if( !m_session.mappingDatabase().getBaseMappingForContainer( m_classDict.cppName(), m_containerId, baseMapping )){ throwException("Base mapping has not been found in the database.", "ContainerSchema::evolve"); } @@ -186,13 +186,13 @@ void ora::ContainerSchema::evolve(){ m_loaded = true; } -void ora::ContainerSchema::evolve( const Reflex::Type& dependentClass, MappingTree& baseMapping ){ - std::string className = dependentClass.Name(Reflex::SCOPED); +void ora::ContainerSchema::evolve( const edm::TypeWithDict& dependentClass, MappingTree& baseMapping ){ + std::string className = dependentClass.cppName(); MappingGenerator mapGen( m_session.schema().storageSchema() ); std::map::iterator iDep = m_dependentMappings.insert( std::make_pair( className, new MappingTree ) ).first; - if( baseMapping.className() != dependentClass.Name(Reflex::SCOPED) ){ - throwException("Provided base mapping does not map class \""+dependentClass.Name(Reflex::SCOPED)+"\".", + if( baseMapping.className() != dependentClass.cppName() ){ + throwException("Provided base mapping does not map class \""+dependentClass.cppName()+"\".", "ContainerSchema::evolve"); } mapGen.createNewDependentMapping( dependentClass, m_mapping, baseMapping, *iDep->second ); @@ -214,7 +214,7 @@ void ora::ContainerSchema::setAccessPermission( const std::string& principal, } } -const Reflex::Type& ora::ContainerSchema::type(){ +const edm::TypeWithDict& ora::ContainerSchema::type(){ initClassDict(); return m_classDict; } @@ -244,10 +244,10 @@ ora::MappingTree& ora::ContainerSchema::mapping( bool writeEnabled ){ return m_mapping; } -bool ora::ContainerSchema::loadMappingForDependentClass( const Reflex::Type& dependentClassDict ){ +bool ora::ContainerSchema::loadMappingForDependentClass( const edm::TypeWithDict& dependentClassDict ){ if( !dependentClassDict ) throwException("The dependent class has not been found in the dictionary.", "ContainerSchema::loadMappingForDependentClass"); - std::string className = dependentClassDict.Name(Reflex::SCOPED); + std::string className = dependentClassDict.cppName(); std::map::iterator iDep = m_dependentMappings.find( className ); if( iDep == m_dependentMappings.end() ){ // not in cache, search the database... @@ -263,8 +263,8 @@ bool ora::ContainerSchema::loadMappingForDependentClass( const Reflex::Type& dep return true; } -void ora::ContainerSchema::create( const Reflex::Type& dependentClassDict ){ - std::string className = dependentClassDict.Name(Reflex::SCOPED); +void ora::ContainerSchema::create( const edm::TypeWithDict& dependentClassDict ){ + std::string className = dependentClassDict.cppName(); std::map::iterator iDep = m_dependentMappings.insert( std::make_pair( className, new MappingTree ) ).first; MappingGenerator mapGen( m_session.schema().storageSchema() ); @@ -278,8 +278,8 @@ void ora::ContainerSchema::create( const Reflex::Type& dependentClassDict ){ m_containerSchemaSequences.create( MappingRules::sequenceNameForDependentClass( m_containerName, className )); } -void ora::ContainerSchema::extend( const Reflex::Type& dependentClassDict ){ - std::string className = dependentClassDict.Name(Reflex::SCOPED); +void ora::ContainerSchema::extend( const edm::TypeWithDict& dependentClassDict ){ + std::string className = dependentClassDict.cppName(); MappingTree baseMapping; if( !m_session.mappingDatabase().getBaseMappingForContainer( className, m_containerId, baseMapping ) ){ @@ -289,7 +289,7 @@ void ora::ContainerSchema::extend( const Reflex::Type& dependentClassDict ){ } } -bool ora::ContainerSchema::extendIfRequired( const Reflex::Type& dependentClassDict ){ +bool ora::ContainerSchema::extendIfRequired( const edm::TypeWithDict& dependentClassDict ){ bool ret = false; if( ! loadMappingForDependentClass( dependentClassDict ) ){ extend( dependentClassDict ); @@ -298,9 +298,9 @@ bool ora::ContainerSchema::extendIfRequired( const Reflex::Type& dependentClassD return ret; } -ora::MappingElement& ora::ContainerSchema::mappingForDependentClass( const Reflex::Type& dependentClassDict, +ora::MappingElement& ora::ContainerSchema::mappingForDependentClass( const edm::TypeWithDict& dependentClassDict, bool writeEnabled ){ - std::string className = dependentClassDict.Name(Reflex::SCOPED); + std::string className = dependentClassDict.cppName(); if( ! loadMappingForDependentClass( dependentClassDict ) ){ if( writeEnabled ){ // check if a base is available: diff --git a/CondCore/ORA/src/ContainerSchema.h b/CondCore/ORA/src/ContainerSchema.h index b2a73519708fb..8bd16a4343d23 100644 --- a/CondCore/ORA/src/ContainerSchema.h +++ b/CondCore/ORA/src/ContainerSchema.h @@ -4,7 +4,7 @@ #include "MappingTree.h" #include "Sequences.h" // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace coral { class ISchema; @@ -21,7 +21,7 @@ namespace ora { ContainerSchema( int containerId, const std::string& containerName, - const Reflex::Type& containerType, + const edm::TypeWithDict& containerType, DatabaseSession& session ); ContainerSchema( int containerId, @@ -37,19 +37,19 @@ namespace ora { void evolve(); - void create( const Reflex::Type& dependentClass ); + void create( const edm::TypeWithDict& dependentClass ); - void evolve( const Reflex::Type& dependentClass, MappingTree& baseMapping ); + void evolve( const edm::TypeWithDict& dependentClass, MappingTree& baseMapping ); void setAccessPermission( const std::string& principal, bool forWrite ); - const Reflex::Type& type(); + const edm::TypeWithDict& type(); MappingTree& mapping( bool writeEnabled=false); - bool extendIfRequired( const Reflex::Type& dependentClass ); + bool extendIfRequired( const edm::TypeWithDict& dependentClass ); - MappingElement& mappingForDependentClass( const Reflex::Type& dependentClass, bool writeEnabled=false ); + MappingElement& mappingForDependentClass( const edm::TypeWithDict& dependentClass, bool writeEnabled=false ); bool mappingForDependentClasses( std::vector& destination ); @@ -73,15 +73,15 @@ namespace ora { private: void initClassDict(); - bool loadMappingForDependentClass( const Reflex::Type& dependentClass ); - void extend( const Reflex::Type& dependentClass ); + bool loadMappingForDependentClass( const edm::TypeWithDict& dependentClass ); + void extend( const edm::TypeWithDict& dependentClass ); void getTableHierarchy( const std::set& containerMappingVersions, std::vector& destination ); private: int m_containerId; std::string m_containerName; std::string m_className; - Reflex::Type m_classDict; + edm::TypeWithDict m_classDict; DatabaseSession& m_session; bool m_loaded; Sequences m_containerSchemaSequences; diff --git a/CondCore/ORA/src/DataElement.cc b/CondCore/ORA/src/DataElement.cc index b09cd8a9e1856..2ed69613b2b40 100644 --- a/CondCore/ORA/src/DataElement.cc +++ b/CondCore/ORA/src/DataElement.cc @@ -1,18 +1,19 @@ #include "DataElement.h" +#include /* offsetof */ ora::DataElement::DataElement(): m_parent(0), m_children(), m_declaringScopeOffset(0), - m_offsetFunction(0){ + /*m_offsetFunction(0)*/ m_offset(0){ } ora::DataElement::DataElement( size_t declaringScopeOffset, - Reflex::OffsetFunction offsetFunc ): + size_t /*offsetFunc*/ offset ): m_parent(0), m_children(), m_declaringScopeOffset(declaringScopeOffset), - m_offsetFunction(offsetFunc){ + /*m_offsetFunction(offsetFunc)*/ m_offset(offset){ } ora::DataElement::~DataElement(){ @@ -24,23 +25,23 @@ ora::DataElement::~DataElement(){ ora::DataElement& ora::DataElement::addChild( size_t declaringScopeOffset, - Reflex::OffsetFunction offsetFunction ){ - DataElement* child = new DataElement( declaringScopeOffset, offsetFunction ); + size_t /*offsetFunction*/ offset ){ + DataElement* child = new DataElement( declaringScopeOffset, /*offsetFunction*/ offset ); child->m_parent = this; m_children.push_back(child); return *child; } size_t ora::DataElement::offset( const void* topLevelAddress ) const { - const void* address = topLevelAddress; + //const void* address = topLevelAddress; size_t offset = m_declaringScopeOffset; if(m_parent){ size_t parentOffset = m_parent->offset( topLevelAddress ); offset += parentOffset; - address = static_cast(const_cast(topLevelAddress))+parentOffset; + //address = static_cast(const_cast(topLevelAddress))+parentOffset; } - if(m_offsetFunction){ - offset += m_offsetFunction( const_cast(address)); + if(/*m_offsetFunction*/ m_offset){ + offset += /*m_offsetFunction( const_cast(address))*/ m_offset; } return offset; } diff --git a/CondCore/ORA/src/DataElement.h b/CondCore/ORA/src/DataElement.h index e7b8e3b71ba1d..8e9ef52d83075 100644 --- a/CondCore/ORA/src/DataElement.h +++ b/CondCore/ORA/src/DataElement.h @@ -2,7 +2,7 @@ #define INCLUDE_ORA_DATAELEMENT_H // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { @@ -10,10 +10,10 @@ namespace ora { class DataElement { public: DataElement(); - DataElement( size_t declaringScopeOffset, Reflex::OffsetFunction offsetFunction ); + DataElement( size_t declaringScopeOffset, size_t /*offsetFunction*/ offset ); virtual ~DataElement(); - DataElement& addChild( size_t declaringScopeOffset, Reflex::OffsetFunction offsetFunction ); + DataElement& addChild( size_t declaringScopeOffset, size_t /*offsetFunction*/ offset ); size_t offset( const void* topLevelAddress ) const; void* address( const void* topLevelAddress ) const; @@ -26,7 +26,7 @@ namespace ora { const DataElement* m_parent; std::vector m_children; size_t m_declaringScopeOffset; - Reflex::OffsetFunction m_offsetFunction; + /*Reflex::OffsetFunction m_offsetFunction*/ size_t m_offset; }; } diff --git a/CondCore/ORA/src/Database.cc b/CondCore/ORA/src/Database.cc index bba026e8b540f..efe96d403e40e 100644 --- a/CondCore/ORA/src/Database.cc +++ b/CondCore/ORA/src/Database.cc @@ -34,11 +34,11 @@ namespace ora { std::auto_ptr m_transaction; }; - std::string nameFromClass( const Reflex::Type& contType ){ - return contType.Name( Reflex::SCOPED ); + std::string nameFromClass( const edm::TypeWithDict& contType ){ + return contType.cppName(); } - Container getContainerFromSession( const std::string& name, const Reflex::Type& contType, DatabaseSession& session ){ + Container getContainerFromSession( const std::string& name, const edm::TypeWithDict& contType, DatabaseSession& session ){ Handle contHandle = session.containerHandle( name ); if( !contHandle ){ if( session.configuration().properties().getFlag( Configuration::automaticDatabaseCreation()) || @@ -55,7 +55,7 @@ namespace ora { } std::string ora::Database::nameForContainer( const std::type_info& typeInfo ){ - Reflex::Type contType = ClassUtils::lookupDictionary( typeInfo ); + edm::TypeWithDict contType = ClassUtils::lookupDictionary( typeInfo ); return nameFromClass( contType ); } @@ -209,14 +209,14 @@ ora::Container ora::Database::createContainer( const std::string& name, throwException("Container with name \""+name+"\" already exists in the database.", "Database::createContainer"); } - Reflex::Type contType = ClassUtils::lookupDictionary( typeInfo ); + edm::TypeWithDict contType = ClassUtils::lookupDictionary( typeInfo ); Handle cont = m_impl->m_session->createContainer( name, contType ); return Container( cont ); } ora::Container ora::Database::createContainer( const std::type_info& typeInfo ){ open( true ); - Reflex::Type contType = ClassUtils::lookupDictionary( typeInfo ); + edm::TypeWithDict contType = ClassUtils::lookupDictionary( typeInfo ); std::string name = nameFromClass( contType ); if( m_impl->m_session->containerHandle( name ) ){ throwException("Container with name \""+name+"\" already exists in the database.", @@ -229,7 +229,7 @@ ora::Container ora::Database::createContainer( const std::type_info& typeInfo ){ ora::Container ora::Database::createContainer( const std::string& className, std::string name ){ open( true ); - Reflex::Type contType = ClassUtils::lookupDictionary( className ); + edm::TypeWithDict contType = ClassUtils::lookupDictionary( className ); if( name.empty() ) name = nameForContainer( className ); if( m_impl->m_session->containerHandle( name ) ){ throwException("Container with name \""+name+"\" already exists in the database.", @@ -242,13 +242,13 @@ ora::Container ora::Database::createContainer( const std::string& className, ora::Container ora::Database::getContainer( const std::string& containerName, const std::type_info& typeInfo){ open( true ); - Reflex::Type objType = ClassUtils::lookupDictionary( typeInfo ); + edm::TypeWithDict objType = ClassUtils::lookupDictionary( typeInfo ); return getContainerFromSession( containerName, objType, *m_impl->m_session ); } ora::Container ora::Database::getContainer( const std::type_info& typeInfo ){ open( true ); - Reflex::Type objType = ClassUtils::lookupDictionary( typeInfo ); + edm::TypeWithDict objType = ClassUtils::lookupDictionary( typeInfo ); std::string contName = nameFromClass( objType ); return getContainerFromSession( contName, objType, *m_impl->m_session); } @@ -351,7 +351,7 @@ bool ora::Database::getItemId( const std::string& name, ora::OId& destination ){ boost::shared_ptr ora::Database::getTypedObjectByName( const std::string& name, const std::type_info& typeInfo ){ open(); - Reflex::Type objType = ClassUtils::lookupDictionary( typeInfo ); + edm::TypeWithDict objType = ClassUtils::lookupDictionary( typeInfo ); return m_impl->m_session->fetchTypedObjectByName( name, objType ); } diff --git a/CondCore/ORA/src/DatabaseContainer.cc b/CondCore/ORA/src/DatabaseContainer.cc index 0a82c43f8c1cf..8254e896f083a 100644 --- a/CondCore/ORA/src/DatabaseContainer.cc +++ b/CondCore/ORA/src/DatabaseContainer.cc @@ -40,12 +40,12 @@ namespace ora { RelationalBuffer operationBuffer( m_contSchema.storageSchema() ); InsertOperation* topLevelInsert = &operationBuffer.newInsert( topLevelMapping.tableName() ); topLevelInsert->addId( topLevelMapping.columnNames()[ 0 ] ); - const Reflex::Type& type = m_contSchema.type(); - MappingElement::iterator iMap = topLevelMapping.find( type.Name(Reflex::SCOPED) ); + const edm::TypeWithDict& type = m_contSchema.type(); + MappingElement::iterator iMap = topLevelMapping.find( type.cppName() ); // the first inner mapping is the relevant... if( iMap == topLevelMapping.end()){ throwException("Could not find a mapping element for class \""+ - type.Name(Reflex::SCOPED)+"\"", + type.cppName()+"\"", "WriteBuffer::flush"); } MappingElement& mapping = iMap->second; @@ -105,12 +105,12 @@ namespace ora { UpdateOperation* topLevelUpdate = &operationBuffer.newUpdate( topLevelMapping.tableName(), true ); topLevelUpdate->addId( topLevelMapping.columnNames()[ 0 ] ); topLevelUpdate->addWhereId( topLevelMapping.columnNames()[ 0 ] ); - const Reflex::Type& type = m_contSchema.type(); - MappingElement::iterator iMap = topLevelMapping.find( type.Name(Reflex::SCOPED) ); + const edm::TypeWithDict& type = m_contSchema.type(); + MappingElement::iterator iMap = topLevelMapping.find( type.cppName() ); // the first inner mapping is the relevant... if( iMap == topLevelMapping.end()){ throwException("Could not find a mapping element for class \""+ - type.Name(Reflex::SCOPED)+"\"", + type.cppName()+"\"", "UpdateBuffer::flush"); } MappingElement& mapping = iMap->second; @@ -151,11 +151,11 @@ namespace ora { MappingElement& topLevelMapping = contSchema.mapping().topElement(); m_topLevelQuery.addWhereId( topLevelMapping.columnNames()[ 0 ] ); - MappingElement::iterator iMap = topLevelMapping.find( m_type.Name(Reflex::SCOPED) ); + MappingElement::iterator iMap = topLevelMapping.find( m_type.cppName() ); // the first inner mapping is the good one ... if( iMap == topLevelMapping.end()){ throwException("Could not find a mapping element for class \""+ - m_type.Name(Reflex::SCOPED)+"\"", + m_type.cppName()+"\"", "ReadBuffer::ReadBuffer"); } MappingElement& mapping = iMap->second; @@ -185,13 +185,13 @@ namespace ora { return destination; } - const Reflex::Type& type(){ + const edm::TypeWithDict& type(){ return m_type; } private: DataElement m_topLevelElement; - const Reflex::Type& m_type; + const edm::TypeWithDict& m_type; std::auto_ptr m_reader; SelectOperation m_topLevelQuery; }; @@ -280,10 +280,10 @@ void* ora::IteratorBuffer::getItem(){ return ret; } -void* ora::IteratorBuffer::getItemAsType( const Reflex::Type& asType ){ +void* ora::IteratorBuffer::getItemAsType( const edm::TypeWithDict& asType ){ if( !ClassUtils::isType( type(), asType ) ){ - throwException("Provided output object type \""+asType.Name(Reflex::SCOPED)+"\" does not match with the container type \""+ - type().Name(Reflex::SCOPED)+"\"","IteratorBuffer::getItemAsType"); + throwException("Provided output object type \""+asType.cppName()+"\" does not match with the container type \""+type().cppName(), + "ora::IteratorBuffer::getItemsAsType" ); } return getItem(); } @@ -292,7 +292,7 @@ int ora::IteratorBuffer::itemId(){ return m_itemId; } -const Reflex::Type& ora::IteratorBuffer::type(){ +const edm::TypeWithDict& ora::IteratorBuffer::type(){ return m_readBuffer.type(); } @@ -315,7 +315,7 @@ ora::DatabaseContainer::DatabaseContainer( int contId, ora::DatabaseContainer::DatabaseContainer( int contId, const std::string& containerName, - const Reflex::Type& containerType, + const edm::TypeWithDict& containerType, DatabaseSession& session ): m_dbSchema( session.schema() ), m_schema( new ContainerSchema(contId, containerName, containerType, session) ), @@ -345,7 +345,7 @@ const std::string& ora::DatabaseContainer::className(){ return m_schema->className(); } -const Reflex::Type& ora::DatabaseContainer::type(){ +const edm::TypeWithDict& ora::DatabaseContainer::type(){ return m_schema->type(); } @@ -396,7 +396,7 @@ void ora::DatabaseContainer::drop(){ m_containerUpdateTable.remove( m_schema->containerId() ); } -void ora::DatabaseContainer::extendSchema( const Reflex::Type& dependentType ){ +void ora::DatabaseContainer::extendSchema( const edm::TypeWithDict& dependentType ){ m_schema->extendIfRequired( dependentType ); } @@ -414,27 +414,27 @@ void* ora::DatabaseContainer::fetchItem(int itemId){ } void* ora::DatabaseContainer::fetchItemAsType(int itemId, - const Reflex::Type& asType){ + const edm::TypeWithDict& asType){ if(!m_readBuffer.get()){ m_readBuffer.reset( new ReadBuffer( *m_schema ) ); } if( !ClassUtils::isType( type(), asType ) ){ - throwException("Provided output object type \""+asType.Name(Reflex::SCOPED)+"\" does not match with the container type \""+ - type().Name(Reflex::SCOPED)+"\"","DatabaseContainer::fetchItemAsType"); + throwException("Provided output object type \""+asType.cppName()+"\" does not match with the container type \""+type().cppName(), + "ora::DatabaseContainer::fetchItemAsType" ); } return m_readBuffer->read( itemId ); } int ora::DatabaseContainer::insertItem( const void* data, - const Reflex::Type& dataType ){ + const edm::TypeWithDict& dataType ){ if(!m_writeBuffer.get()){ m_writeBuffer.reset( new WriteBuffer( *m_schema ) ); } - Reflex::Type inputResType = ClassUtils::resolvedType( dataType ); - Reflex::Type contType = ClassUtils::resolvedType(m_schema->type()); - if( inputResType.Name()!= contType.Name() && !inputResType.HasBase( contType ) ){ - throwException( "Provided input object type=\""+inputResType.Name()+ - "\" does not match with the container type=\""+contType.Name()+"\"", + edm::TypeWithDict inputResType = ClassUtils::resolvedType( dataType ); + edm::TypeWithDict contType = ClassUtils::resolvedType(m_schema->type()); + if( inputResType.name()!= contType.name() && !inputResType.hasBase( contType ) ){ + throwException( "Provided input object type=\""+inputResType.name()+ + "\" does not match with the container type=\""+contType.name()+"\"", "DatabaseContainer::insertItem" ); } @@ -445,15 +445,15 @@ int ora::DatabaseContainer::insertItem( const void* data, void ora::DatabaseContainer::updateItem( int itemId, const void* data, - const Reflex::Type& dataType ){ + const edm::TypeWithDict& dataType ){ if(!m_updateBuffer.get()){ m_updateBuffer.reset( new UpdateBuffer( *m_schema ) ); } - Reflex::Type inputResType = ClassUtils::resolvedType( dataType ); - Reflex::Type contType = ClassUtils::resolvedType(m_schema->type()); - if( inputResType.Name()!= contType.Name() && !inputResType.HasBase( contType ) ){ - throwException( "Provided input object type=\""+inputResType.Name()+"\" does not match with the container type=\""+ - contType.Name()+"\".", + edm::TypeWithDict inputResType = ClassUtils::resolvedType( dataType ); + edm::TypeWithDict contType = ClassUtils::resolvedType(m_schema->type()); + if( inputResType.name()!= contType.name() && !inputResType.hasBase( contType ) ){ + throwException( "Provided input object type=\""+inputResType.name()+"\" does not match with the container type=\""+ + contType.name()+"\".", "DatabaseContainer::updateItem" ); } diff --git a/CondCore/ORA/src/DatabaseContainer.h b/CondCore/ORA/src/DatabaseContainer.h index 491837e1ff464..1e2c8c74dcb50 100644 --- a/CondCore/ORA/src/DatabaseContainer.h +++ b/CondCore/ORA/src/DatabaseContainer.h @@ -9,8 +9,8 @@ #include #include -namespace Reflex { - class Type; +namespace edm { + class TypeWithDict; } namespace ora { @@ -36,11 +36,11 @@ namespace ora { void* getItem(); - void* getItemAsType( const Reflex::Type& type ); + void* getItemAsType( const edm::TypeWithDict& type ); int itemId(); - const Reflex::Type& type(); + const edm::TypeWithDict& type(); private: SelectOperation m_query; @@ -54,7 +54,7 @@ namespace ora { DatabaseContainer( int contId, const std::string& containerName, const std::string& className, unsigned int containerSize, DatabaseSession& session ); - DatabaseContainer( int contId, const std::string& containerName, const Reflex::Type& containerType, + DatabaseContainer( int contId, const std::string& containerName, const edm::TypeWithDict& containerType, DatabaseSession& session ); virtual ~DatabaseContainer(); @@ -65,7 +65,7 @@ namespace ora { const std::string& className(); - const Reflex::Type& type(); + const edm::TypeWithDict& type(); const std::string& mappingVersion(); @@ -75,7 +75,7 @@ namespace ora { void drop(); - void extendSchema( const Reflex::Type& dependentType ); + void extendSchema( const edm::TypeWithDict& dependentType ); void setAccessPermission( const std::string& principal, bool forWrite ); @@ -87,11 +87,11 @@ namespace ora { void* fetchItem(int itemId); - void* fetchItemAsType(int itemId, const Reflex::Type& asType); + void* fetchItemAsType(int itemId, const edm::TypeWithDict& asType); - int insertItem( const void* data, const Reflex::Type& type ); + int insertItem( const void* data, const edm::TypeWithDict& type ); - void updateItem( int itemId, const void* data, const Reflex::Type& type ); + void updateItem( int itemId, const void* data, const edm::TypeWithDict& type ); void erase( int itemId ); diff --git a/CondCore/ORA/src/DatabaseSession.cc b/CondCore/ORA/src/DatabaseSession.cc index 68da50762f382..8a6dd3576143f 100644 --- a/CondCore/ORA/src/DatabaseSession.cc +++ b/CondCore/ORA/src/DatabaseSession.cc @@ -265,7 +265,7 @@ ora::Handle ora::DatabaseSession::addContainer( const st ora::Handle ora::DatabaseSession::createContainer( const std::string& containerName, - const Reflex::Type& type ){ + const edm::TypeWithDict& type ){ // create the container int newContId = m_contIdSequence->getNextId( true ); Handle newCont ( new DatabaseContainer( newContId, containerName, type, *this ) ); @@ -326,7 +326,7 @@ bool ora::DatabaseSession::getItemId( const std::string& name, ora::OId& destina } boost::shared_ptr ora::DatabaseSession::fetchTypedObjectByName( const std::string& name, - const Reflex::Type& asType ){ + const edm::TypeWithDict& asType ){ boost::shared_ptr ret = m_transactionCache->getNamedReference( name ); if( !ret.get() ){ std::pair oid; diff --git a/CondCore/ORA/src/DatabaseSession.h b/CondCore/ORA/src/DatabaseSession.h index b5577c5f8a0c5..b3fa624b05495 100644 --- a/CondCore/ORA/src/DatabaseSession.h +++ b/CondCore/ORA/src/DatabaseSession.h @@ -11,8 +11,8 @@ #include #include -namespace Reflex { - class Type; +namespace edm { + class TypeWithDict; } namespace coral { class ISessionProxy; @@ -83,7 +83,7 @@ namespace ora { std::string schemaVersion( bool userSchema ); - Handle createContainer( const std::string& containerName, const Reflex::Type& type ); + Handle createContainer( const std::string& containerName, const edm::TypeWithDict& type ); Handle addContainer( const std::string& containerName, const std::string& className ); @@ -105,7 +105,7 @@ namespace ora { Object fetchObjectByName( const std::string& name ); - boost::shared_ptr fetchTypedObjectByName( const std::string& name, const Reflex::Type& asType ); + boost::shared_ptr fetchTypedObjectByName( const std::string& name, const edm::TypeWithDict& asType ); bool getNamesForContainer( int containerId, std::vector& destination ); diff --git a/CondCore/ORA/src/DatabaseUtilitySession.cc b/CondCore/ORA/src/DatabaseUtilitySession.cc index 65eaf5450b29c..1556ba6bf1e12 100644 --- a/CondCore/ORA/src/DatabaseUtilitySession.cc +++ b/CondCore/ORA/src/DatabaseUtilitySession.cc @@ -8,7 +8,7 @@ #include "IDatabaseSchema.h" #include "MappingTree.h" // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" ora::DatabaseUtilitySession::DatabaseUtilitySession( DatabaseSession& dbSession ): m_session( dbSession ){ @@ -202,7 +202,7 @@ void ora::DatabaseUtilitySession::importContainer( const std::string& sourceConn Handle cont = sourceSession.containerHandle( containerName ); Handle iterator = cont->iteratorBuffer(); std::vector objects; - const Reflex::Type& contType = cont->type(); + const edm::TypeWithDict& contType = cont->type(); while( iterator->next() ){ void* data = iterator->getItem(); objects.push_back( data ); @@ -210,7 +210,7 @@ void ora::DatabaseUtilitySession::importContainer( const std::string& sourceConn } newCont->flush(); for( std::vector::const_iterator iO = objects.begin(); iO != objects.end(); iO++ ){ - contType.Destruct( *iO ); + contType.destruct( *iO ); } sourceSession.commitTransaction(); } diff --git a/CondCore/ORA/src/IArrayHandler.h b/CondCore/ORA/src/IArrayHandler.h index a0a6c5f9956be..c1c73314b9eab 100644 --- a/CondCore/ORA/src/IArrayHandler.h +++ b/CondCore/ORA/src/IArrayHandler.h @@ -3,8 +3,8 @@ #include -namespace Reflex { - class Type; +namespace edm { + class TypeWithDict; } namespace ora { @@ -21,7 +21,7 @@ namespace ora { virtual void* object() = 0; /// Returns the return type of the iterator dereference method - virtual Reflex::Type& returnType() = 0; + virtual edm::TypeWithDict& returnType() = 0; }; @@ -56,7 +56,7 @@ namespace ora { virtual void finalize( void* ){ } /// Returns the iterator return type - virtual Reflex::Type& iteratorReturnType() = 0; + virtual edm::TypeWithDict& iteratorReturnType() = 0; }; } diff --git a/CondCore/ORA/src/InlineCArrayStreamer.cc b/CondCore/ORA/src/InlineCArrayStreamer.cc index 2ee5f0c1c8caf..65fb85ec89f8c 100644 --- a/CondCore/ORA/src/InlineCArrayStreamer.cc +++ b/CondCore/ORA/src/InlineCArrayStreamer.cc @@ -9,7 +9,7 @@ #include "CoralBase/Attribute.h" -ora::InlineCArrayStreamerBase::InlineCArrayStreamerBase( const Reflex::Type& objectType, +ora::InlineCArrayStreamerBase::InlineCArrayStreamerBase( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema): m_objectType( objectType ), @@ -25,14 +25,14 @@ ora::InlineCArrayStreamerBase::~InlineCArrayStreamerBase(){ bool ora::InlineCArrayStreamerBase::buildDataElement(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer* operationBuffer){ - m_arrayType = ClassUtils::resolvedType( m_objectType.ToType() ); + m_arrayType = ClassUtils::resolvedType( m_objectType.toType() ); if ( ! m_arrayType ) { throwException( "Missing dictionary information for the element of array \"" + - m_objectType.Name(Reflex::SCOPED) + "\"", + m_objectType.cppName() + "\"", "InlineCArrayStreamerBase::buildDataElement" ); } // Loop over the elements of the array. - for ( unsigned int i=0;isecond; - DataElement& arrayElement = dataElement.addChild( i*m_arrayType.SizeOf(), 0 ); + DataElement& arrayElement = dataElement.addChild( i*m_arrayType.size(), 0 ); processArrayElement( arrayElement, relationalData, arrayElementMapping, operationBuffer ); } return true; } -ora::InlineCArrayWriter::InlineCArrayWriter( const Reflex::Type& objectType, +ora::InlineCArrayWriter::InlineCArrayWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): InlineCArrayStreamerBase( objectType, mapping, contSchema ), @@ -95,7 +95,7 @@ void ora::InlineCArrayWriter::write( int oid, const void* data ){ } } -ora::InlineCArrayUpdater::InlineCArrayUpdater( const Reflex::Type& objectType, +ora::InlineCArrayUpdater::InlineCArrayUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): InlineCArrayStreamerBase( objectType, mapping, contSchema ), @@ -140,7 +140,7 @@ void ora::InlineCArrayUpdater::update( int oid, } } -ora::InlineCArrayReader::InlineCArrayReader( const Reflex::Type& objectType, +ora::InlineCArrayReader::InlineCArrayReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): InlineCArrayStreamerBase( objectType, mapping, contSchema ), @@ -197,7 +197,7 @@ void ora::InlineCArrayReader::clear(){ } } -ora::InlineCArrayStreamer::InlineCArrayStreamer( const Reflex::Type& objectType, +ora::InlineCArrayStreamer::InlineCArrayStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& schema ): m_objectType( objectType ), diff --git a/CondCore/ORA/src/InlineCArrayStreamer.h b/CondCore/ORA/src/InlineCArrayStreamer.h index e5f896ea9dd9b..400aaa7b1f127 100644 --- a/CondCore/ORA/src/InlineCArrayStreamer.h +++ b/CondCore/ORA/src/InlineCArrayStreamer.h @@ -4,7 +4,7 @@ #include "IRelationalStreamer.h" #include "RelationalStreamerFactory.h" // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { @@ -16,7 +16,7 @@ namespace ora { public: - InlineCArrayStreamerBase( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + InlineCArrayStreamerBase( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~InlineCArrayStreamerBase(); @@ -26,8 +26,8 @@ namespace ora { protected: - Reflex::Type m_objectType; - Reflex::Type m_arrayType; + edm::TypeWithDict m_objectType; + edm::TypeWithDict m_arrayType; RelationalStreamerFactory m_streamerFactory; private: @@ -36,7 +36,7 @@ namespace ora { class InlineCArrayWriter : public InlineCArrayStreamerBase, public IRelationalWriter { public: - InlineCArrayWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + InlineCArrayWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~InlineCArrayWriter(); @@ -55,7 +55,7 @@ namespace ora { class InlineCArrayUpdater : public InlineCArrayStreamerBase, public IRelationalUpdater { public: - InlineCArrayUpdater( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + InlineCArrayUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~InlineCArrayUpdater(); @@ -73,7 +73,7 @@ namespace ora { class InlineCArrayReader : public InlineCArrayStreamerBase, public IRelationalReader { public: - InlineCArrayReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + InlineCArrayReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~InlineCArrayReader(); @@ -96,7 +96,7 @@ namespace ora { class InlineCArrayStreamer : public IRelationalStreamer { public: - InlineCArrayStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + InlineCArrayStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); ~InlineCArrayStreamer(); @@ -107,7 +107,7 @@ namespace ora { IRelationalReader* newReader(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; ContainerSchema& m_schema; diff --git a/CondCore/ORA/src/MappingDatabase.cc b/CondCore/ORA/src/MappingDatabase.cc index 55976addd59d7..d944a29366bbe 100644 --- a/CondCore/ORA/src/MappingDatabase.cc +++ b/CondCore/ORA/src/MappingDatabase.cc @@ -1,4 +1,5 @@ #include "CondCore/ORA/interface/Exception.h" +#include "ClassUtils.h" #include "MappingDatabase.h" #include "IDatabaseSchema.h" #include "MappingTree.h" @@ -6,16 +7,13 @@ // #include // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" std::string -ora::MappingDatabase::versionOfClass( const Reflex::Type& dictionary ){ - std::string className = dictionary.Name(Reflex::SCOPED); - Reflex::PropertyList classProps = dictionary.Properties(); - std::string classVersion = MappingRules::defaultClassVersion(className); - if(classProps.HasProperty(MappingRules::classVersionPropertyNameInDictionary())){ - classVersion = classProps.PropertyAsString(MappingRules::classVersionPropertyNameInDictionary()); - } +ora::MappingDatabase::versionOfClass( const edm::TypeWithDict& dictionary ){ + std::string className = dictionary.cppName(); + std::string classVersion = ClassUtils::getClassProperty( MappingRules::classVersionPropertyNameInDictionary(), dictionary ); + if( classVersion.empty() ) classVersion = MappingRules::defaultClassVersion(className); return classVersion; } @@ -266,21 +264,21 @@ bool ora::MappingDatabase::getClassVersionListForContainer( int containerId, return m_schema.mappingSchema().getClassVersionListForContainer( containerId, versionMap ); } -void ora::MappingDatabase::insertClassVersion( const Reflex::Type& dictionaryEntry, +void ora::MappingDatabase::insertClassVersion( const edm::TypeWithDict& dictionaryEntry, int depIndex, int containerId, const std::string& mappingVersion, bool asBase ){ - std::string className = dictionaryEntry.Name( Reflex::SCOPED ); + std::string className = dictionaryEntry.cppName(); std::string classVersion = versionOfClass( dictionaryEntry ); insertClassVersion( className, classVersion, depIndex, containerId, mappingVersion, asBase ); } -void ora::MappingDatabase::setMappingVersionForClass( const Reflex::Type& dictionaryEntry, +void ora::MappingDatabase::setMappingVersionForClass( const edm::TypeWithDict& dictionaryEntry, int containerId, const std::string& mappingVersion, bool dependency ){ - std::string className = dictionaryEntry.Name( Reflex::SCOPED ); + std::string className = dictionaryEntry.cppName(); std::string classVersion = versionOfClass( dictionaryEntry ); std::string classId = MappingRules::classId( className, classVersion ); std::string mv(""); diff --git a/CondCore/ORA/src/MappingDatabase.h b/CondCore/ORA/src/MappingDatabase.h index 15e47aca16b08..5e10b7a21f432 100644 --- a/CondCore/ORA/src/MappingDatabase.h +++ b/CondCore/ORA/src/MappingDatabase.h @@ -8,8 +8,8 @@ #include #include -namespace Reflex{ - class Type; +namespace edm { + class TypeWithDict; } namespace ora { @@ -28,7 +28,7 @@ namespace ora { public: - static std::string versionOfClass( const Reflex::Type& dictionary ); + static std::string versionOfClass( const edm::TypeWithDict& dictionary ); public: /// Constructor explicit MappingDatabase( IDatabaseSchema& schema ); @@ -58,11 +58,11 @@ namespace ora { bool getClassVersionListForContainer( int containerId, std::map& versionMap ); - void insertClassVersion( const Reflex::Type& dictionaryEntry, int dependencyIndex, int containerId, const std::string& mappingVersion, bool asBase=false ); + void insertClassVersion( const edm::TypeWithDict& dictionaryEntry, int dependencyIndex, int containerId, const std::string& mappingVersion, bool asBase=false ); void insertClassVersion( const std::string& className, const std::string& classVersion, int dependencyIndex, int containerId, const std::string& mappingVersion, bool asBase=false ); - void setMappingVersionForClass( const Reflex::Type& dictionaryEntry, int containerId, const std::string& mappingVersion , bool dependency=false); + void setMappingVersionForClass( const edm::TypeWithDict& dictionaryEntry, int containerId, const std::string& mappingVersion , bool dependency=false); void storeMapping( const MappingTree& mappingStructure ); diff --git a/CondCore/ORA/src/MappingGenerator.cc b/CondCore/ORA/src/MappingGenerator.cc index 58c246d674b30..d8f0bc4f1a149 100644 --- a/CondCore/ORA/src/MappingGenerator.cc +++ b/CondCore/ORA/src/MappingGenerator.cc @@ -4,7 +4,7 @@ #include "MappingTree.h" #include "MappingRules.h" // externals -#include "Reflex/Reflex.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" ora::MappingGenerator::MappingGenerator( coral::ISchema& schema ): m_schema( schema ), @@ -14,9 +14,9 @@ ora::MappingGenerator::MappingGenerator( coral::ISchema& schema ): ora::MappingGenerator::~MappingGenerator(){} void ora::MappingGenerator::createNewMapping( const std::string& containerName, - const Reflex::Type& classDictionary, + const edm::TypeWithDict& classDictionary, MappingTree& destination ){ - std::string className = classDictionary.Name(Reflex::SCOPED); + std::string className = classDictionary.cppName(); size_t sz = RelationalMapping::sizeInColumns( classDictionary ); if(sz > MappingRules::MaxColumnsPerTable){ @@ -44,7 +44,7 @@ void ora::MappingGenerator::createNewMapping( const std::string& containerName, } void ora::MappingGenerator::createNewMapping( const std::string& containerName, - const Reflex::Type& classDictionary, + const edm::TypeWithDict& classDictionary, const MappingTree& baseMapping, MappingTree& destination ){ createNewMapping( containerName, classDictionary, destination ); @@ -55,10 +55,10 @@ void ora::MappingGenerator::createNewMapping( const std::string& containerName, destination.override( baseMapping ); } -void ora::MappingGenerator::createNewDependentMapping( const Reflex::Type& classDictionary, +void ora::MappingGenerator::createNewDependentMapping( const edm::TypeWithDict& classDictionary, const MappingTree& parentClassMapping, MappingTree& destination ){ - std::string className = classDictionary.Name(Reflex::SCOPED); + std::string className = classDictionary.cppName(); size_t sz = RelationalMapping::sizeInColumns( classDictionary ); if(sz > MappingRules::MaxColumnsPerTable){ @@ -93,7 +93,7 @@ void ora::MappingGenerator::createNewDependentMapping( const Reflex::Type& class processor->process( classElement, className, nameForSchema, scope ); } -void ora::MappingGenerator::createNewDependentMapping( const Reflex::Type& classDictionary, +void ora::MappingGenerator::createNewDependentMapping( const edm::TypeWithDict& classDictionary, const MappingTree& parentClassMapping, const MappingTree& dependentClassBaseMapping, MappingTree& destination ){ diff --git a/CondCore/ORA/src/MappingGenerator.h b/CondCore/ORA/src/MappingGenerator.h index df652ed8b2e23..580901939c984 100644 --- a/CondCore/ORA/src/MappingGenerator.h +++ b/CondCore/ORA/src/MappingGenerator.h @@ -8,8 +8,8 @@ #include #include -namespace Reflex{ - class Type; +namespace edm { + class TypeWithDict; } namespace coral { @@ -29,15 +29,15 @@ namespace ora { /// Destructor ~MappingGenerator(); - void createNewMapping( const std::string& containerName, const Reflex::Type& classDictionary, MappingTree& destination ); + void createNewMapping( const std::string& containerName, const edm::TypeWithDict& classDictionary, MappingTree& destination ); - void createNewMapping( const std::string& containerName, const Reflex::Type& classDictionary, + void createNewMapping( const std::string& containerName, const edm::TypeWithDict& classDictionary, const MappingTree& baseMapping, MappingTree& destination ); - void createNewDependentMapping( const Reflex::Type& dependentClassDictionary, const MappingTree& parentClassMapping, + void createNewDependentMapping( const edm::TypeWithDict& dependentClassDictionary, const MappingTree& parentClassMapping, MappingTree& destination ); - void createNewDependentMapping( const Reflex::Type& dependentClassDictionary, const MappingTree& parentClassMapping, + void createNewDependentMapping( const edm::TypeWithDict& dependentClassDictionary, const MappingTree& parentClassMapping, const MappingTree& dependentClassBaseMapping, MappingTree& destination ); private: diff --git a/CondCore/ORA/src/MappingRules.cc b/CondCore/ORA/src/MappingRules.cc index a873811b6bec5..7baa7d1bcafbb 100644 --- a/CondCore/ORA/src/MappingRules.cc +++ b/CondCore/ORA/src/MappingRules.cc @@ -1,10 +1,11 @@ #include "MappingRules.h" +#include "ClassUtils.h" // #include #include #include // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" std::string ora::MappingRules::sequenceNameForContainerId(){ static const std::string s_sequenceName("CONTAINER_ID"); @@ -169,9 +170,10 @@ ora::MappingRules::variableNameForArrayColumn( unsigned int arrayIndex ){ } std::string -ora::MappingRules::variableNameForArrayColumn( const Reflex::Type& array ){ +ora::MappingRules::variableNameForArrayColumn( const edm::TypeWithDict& array ){ std::stringstream contentTypeName; - contentTypeName << "A" << array.ArrayLength(); + size_t arraySize = ClassUtils::arrayLength( array ); + contentTypeName << "A" << arraySize; return contentTypeName.str(); } diff --git a/CondCore/ORA/src/MappingRules.h b/CondCore/ORA/src/MappingRules.h index 1486537de1213..f13fd394232f4 100644 --- a/CondCore/ORA/src/MappingRules.h +++ b/CondCore/ORA/src/MappingRules.h @@ -6,8 +6,8 @@ #include #include -namespace Reflex{ - class Type; +namespace edm { + class TypeWithDict; } namespace ora { @@ -50,7 +50,7 @@ namespace ora { static std::string scopedVariableName( const std::string& variableName, const std::string& scope ); static std::string variableNameForArrayIndex( const std::string& arrayVariable, unsigned int index ); static std::string variableNameForArrayColumn( unsigned int arrayIndex ); - static std::string variableNameForArrayColumn( const Reflex::Type& array ); + static std::string variableNameForArrayColumn( const edm::TypeWithDict& array ); static std::string variableNameForContainerValue(); static std::string variableNameForContainerKey(); static std::string scopedVariableForSchemaObjects( const std::string& variableName, const std::string& scope ); diff --git a/CondCore/ORA/src/NamedRefStreamer.cc b/CondCore/ORA/src/NamedRefStreamer.cc index 97d27d04ba7c0..105b0f1ad355e 100644 --- a/CondCore/ORA/src/NamedRefStreamer.cc +++ b/CondCore/ORA/src/NamedRefStreamer.cc @@ -9,14 +9,14 @@ #include "RelationalStreamerFactory.h" // externals #include "CoralBase/Attribute.h" -#include "Reflex/Member.h" +#include "FWCore/Utilities/interface/MemberWithDict.h" std::string ora::namedRefNullLabel(){ static const std::string nullLabel("ora::NamedRef::Null"); return nullLabel; } -ora::NamedReferenceStreamerBase::NamedReferenceStreamerBase( const Reflex::Type& objectType, +ora::NamedReferenceStreamerBase::NamedReferenceStreamerBase( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& schema): m_objectType( objectType ), @@ -37,25 +37,25 @@ ora::NamedReferenceStreamerBase::~NamedReferenceStreamerBase(){ bool ora::NamedReferenceStreamerBase::buildDataElement(DataElement& dataElement, IRelationalData& relationalData){ m_dataElement = &dataElement; - m_objectType.UpdateMembers(); - Reflex::Member nameMember = m_objectType.DataMemberByName("m_name"); + //-ap m_objectType.UpdateMembers(); + edm::MemberWithDict nameMember = m_objectType.dataMemberByName("m_name"); if( !nameMember ){ - throwException("Data member \"m_name\" not found in class \""+m_objectType.Name()+"\".", + throwException("Data member \"m_name\" not found in class \""+m_objectType.name()+"\".", "NamedReferenceStreamerBase::buildDataElement"); } - m_refNameDataElement = &dataElement.addChild( nameMember.Offset(), 0 ); - Reflex::Member ptrMember = m_objectType.DataMemberByName("m_ptr"); + m_refNameDataElement = &dataElement.addChild( nameMember.offset(), 0 ); + edm::MemberWithDict ptrMember = m_objectType.dataMemberByName("m_ptr"); if( !ptrMember ){ - throwException("Data member \"m_ptr\" not found in class \""+m_objectType.Name()+"\".", + throwException("Data member \"m_ptr\" not found in class \""+m_objectType.name()+"\".", "NamedReferenceStreamerBase::buildDataElement"); } - m_ptrDataElement = &dataElement.addChild( ptrMember.Offset(), 0 ); - Reflex::Member flagMember = m_objectType.DataMemberByName("m_isPersistent"); + m_ptrDataElement = &dataElement.addChild( ptrMember.offset(), 0 ); + edm::MemberWithDict flagMember = m_objectType.dataMemberByName("m_isPersistent"); if( !flagMember ){ - throwException("Data member \"m_isPersistent\" not found in class \""+m_objectType.Name()+"\".", + throwException("Data member \"m_isPersistent\" not found in class \""+m_objectType.name()+"\".", "NamedReferenceStreamerBase::buildDataElement"); } - m_flagDataElement = &dataElement.addChild( flagMember.Offset(), 0 ); + m_flagDataElement = &dataElement.addChild( flagMember.offset(), 0 ); // then book the column in the data attribute... const std::vector& columns = m_mapping.columnNames(); if( columns.size()==0 ){ @@ -94,7 +94,7 @@ void ora::NamedReferenceStreamerBase::bindDataForRead( void* data ){ name = std::string(""); } if(!name.empty()){ - Reflex::Type namedRefType = m_objectType.TemplateArgumentAt(0); + edm::TypeWithDict namedRefType = m_objectType.templateArgumentAt(0); boost::shared_ptr ptr = m_schema.dbSession().fetchTypedObjectByName( name, namedRefType ); *static_cast*>(ptrAddress) = ptr; *static_cast(flagAddress) = true; @@ -102,7 +102,7 @@ void ora::NamedReferenceStreamerBase::bindDataForRead( void* data ){ *static_cast(refNameAddress) = name; } -ora::NamedRefWriter::NamedRefWriter( const Reflex::Type& objectType, +ora::NamedRefWriter::NamedRefWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): NamedReferenceStreamerBase( objectType, mapping, contSchema ){ @@ -126,7 +126,7 @@ void ora::NamedRefWriter::write( int oid, bindDataForUpdate( data ); } -ora::NamedRefUpdater::NamedRefUpdater( const Reflex::Type& objectType, +ora::NamedRefUpdater::NamedRefUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): NamedReferenceStreamerBase( objectType, mapping, contSchema ){ @@ -150,7 +150,7 @@ void ora::NamedRefUpdater::update( int oid, bindDataForUpdate( data ); } -ora::NamedRefReader::NamedRefReader( const Reflex::Type& objectType, +ora::NamedRefReader::NamedRefReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): NamedReferenceStreamerBase( objectType, mapping, contSchema ){ @@ -179,7 +179,7 @@ void ora::NamedRefReader::clear(){ } -ora::NamedRefStreamer::NamedRefStreamer( const Reflex::Type& objectType, +ora::NamedRefStreamer::NamedRefStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), diff --git a/CondCore/ORA/src/NamedRefStreamer.h b/CondCore/ORA/src/NamedRefStreamer.h index 463761b98627f..99bb69cabde25 100644 --- a/CondCore/ORA/src/NamedRefStreamer.h +++ b/CondCore/ORA/src/NamedRefStreamer.h @@ -7,7 +7,7 @@ #include #include // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { @@ -21,7 +21,7 @@ namespace ora { public: - explicit NamedReferenceStreamerBase( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema ); + explicit NamedReferenceStreamerBase( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& schema ); virtual ~NamedReferenceStreamerBase(); @@ -33,7 +33,7 @@ namespace ora { private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; int m_columnIndex; ContainerSchema& m_schema; @@ -48,7 +48,7 @@ namespace ora { public: - NamedRefWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + NamedRefWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~NamedRefWriter(); @@ -65,7 +65,7 @@ namespace ora { public: - NamedRefUpdater( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + NamedRefUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~NamedRefUpdater(); @@ -83,7 +83,7 @@ namespace ora { public: - NamedRefReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + NamedRefReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~NamedRefReader(); @@ -103,7 +103,7 @@ namespace ora { class NamedRefStreamer : public IRelationalStreamer { public: - NamedRefStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + NamedRefStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); ~NamedRefStreamer(); @@ -114,7 +114,7 @@ namespace ora { IRelationalReader* newReader(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; ContainerSchema& m_schema; }; diff --git a/CondCore/ORA/src/Object.cc b/CondCore/ORA/src/Object.cc index e7f8396126f56..216306603ed7d 100644 --- a/CondCore/ORA/src/Object.cc +++ b/CondCore/ORA/src/Object.cc @@ -2,7 +2,7 @@ #include "CondCore/ORA/interface/Exception.h" #include "ClassUtils.h" // externals -#include "Reflex/Object.h" +#include "FWCore/Utilities/interface/ObjectWithDict.h" ora::Object::Object(): m_ptr(0), @@ -14,14 +14,14 @@ ora::Object::Object( const void* ptr, const std::type_info& typeInfo ): m_type = ClassUtils::lookupDictionary( typeInfo, true ); } -ora::Object::Object( const void* ptr, const Reflex::Type& type ): +ora::Object::Object( const void* ptr, const edm::TypeWithDict& type ): m_ptr( const_cast(ptr) ), m_type( type ){ } ora::Object::Object( const void* ptr, const std::string& typeName ): - m_ptr( const_cast(ptr) ){ - m_type = ClassUtils::lookupDictionary( typeName, true ); + m_ptr( const_cast(ptr) ), + m_type(edm::TypeWithDict::byName( typeName )){ } ora::Object::Object( const Object& rhs): @@ -52,16 +52,16 @@ void* ora::Object::address() const { return m_ptr; } -const Reflex::Type& ora::Object::type() const { +const edm::TypeWithDict& ora::Object::type() const { return m_type; } std::string ora::Object::typeName() const { - return m_type.Name( Reflex::SCOPED ); + return m_type.cppName(); } void* ora::Object::cast( const std::type_info& typeInfo ) const{ - Reflex::Type castType = ClassUtils::lookupDictionary( typeInfo ); + edm::TypeWithDict castType = ClassUtils::lookupDictionary( typeInfo ); if( ! m_type ){ throwException( "Object input class has not been found in the dictionary.", "Object::cast" ); @@ -85,7 +85,7 @@ void ora::Object::destruct() { } if( m_ptr ){ - m_type.Destruct( m_ptr ); + m_type.destruct( m_ptr ); m_ptr = 0; } } diff --git a/CondCore/ORA/src/ObjectStreamer.cc b/CondCore/ORA/src/ObjectStreamer.cc index 0c7d8d839ee7a..049a7619755b9 100644 --- a/CondCore/ORA/src/ObjectStreamer.cc +++ b/CondCore/ORA/src/ObjectStreamer.cc @@ -5,23 +5,19 @@ #include "ClassUtils.h" #include "MappingRules.h" // externals -#include "Reflex/Base.h" -#include "Reflex/Member.h" +#include "FWCore/Utilities/interface/BaseWithDict.h" +#include "FWCore/Utilities/interface/MemberWithDict.h" namespace ora { - bool isLoosePersistencyDataMember( const Reflex::Member& dataMember ){ - std::string persistencyType(""); - Reflex::PropertyList memberProps = dataMember.Properties(); - if( memberProps.HasProperty(ora::MappingRules::persistencyPropertyNameInDictionary())){ - persistencyType = memberProps.PropertyAsString(ora::MappingRules::persistencyPropertyNameInDictionary()); - } + bool isLoosePersistencyDataMember( const edm::MemberWithDict& dataMember ){ + std::string persistencyType = ClassUtils::getDataMemberProperty( ora::MappingRules::persistencyPropertyNameInDictionary(), dataMember ); return ora::MappingRules::isLooseOnWriting( persistencyType ) || ora::MappingRules::isLooseOnReading( persistencyType ) ; } } -ora::ObjectStreamerBase::ObjectStreamerBase( const Reflex::Type& objectType, +ora::ObjectStreamerBase::ObjectStreamerBase( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_streamerFactory( contSchema ), @@ -32,40 +28,47 @@ ora::ObjectStreamerBase::ObjectStreamerBase( const Reflex::Type& objectType, ora::ObjectStreamerBase::~ObjectStreamerBase(){ } + void ora::ObjectStreamerBase::buildBaseDataMembers( DataElement& dataElement, IRelationalData& relationalData, - const Reflex::Type& objType, + const edm::TypeWithDict& objType, RelationalBuffer* operationBuffer ){ - for ( unsigned int i=0;isecond; if( !ClassUtils::checkMappedType(dataMemberType,dataMemberMapping.variableType()) ){ - throwException( "Data member \""+dataMemberName +"\" type \"" + dataMemberType.Name(Reflex::SCOPED|Reflex::FINAL) + + throwException( "Data member \""+dataMemberName +"\" type \"" + dataMemberType.cppName() + "\" does not match with the expected type in the mapping \""+dataMemberMapping.variableType()+"\".", "ObjectStreamerBase::buildBaseDataMembers" ); } @@ -87,39 +90,39 @@ bool ora::ObjectStreamerBase::buildDataMembers( DataElement& dataElement, RelationalBuffer* operationBuffer ){ buildBaseDataMembers( dataElement, relationalData, m_objectType, operationBuffer ); // Loop over the data members of the class. - for ( unsigned int i=0;isecond; if( !ClassUtils::checkMappedType(dataMemberType,dataMemberMapping.variableType())){ - throwException( "Data member \""+dataMemberName +"\" type \"" + dataMemberType.Name(Reflex::SCOPED|Reflex::FINAL) + + throwException( "Data member \""+dataMemberName +"\" type \"" + dataMemberType.cppName() + "\" does not match with the expected type in the mapping \""+dataMemberMapping.variableType()+"\".", "ObjectStreamerBase::buildDataMembers" ); } @@ -135,7 +138,7 @@ bool ora::ObjectStreamerBase::buildDataMembers( DataElement& dataElement, return true; } -ora::ObjectWriter::ObjectWriter( const Reflex::Type& objectType, +ora::ObjectWriter::ObjectWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): ObjectStreamerBase( objectType, mapping, contSchema ), @@ -174,7 +177,7 @@ void ora::ObjectWriter::write( int oid, void ora::ObjectWriter::processDataMember( DataElement& dataMemberElement, IRelationalData& relationalData, - Reflex::Type& dataMemberType, + edm::TypeWithDict& dataMemberType, MappingElement& dataMemberMapping, RelationalBuffer* operationBuffer ){ IRelationalWriter* dataMemberWriter = m_streamerFactory.newWriter( dataMemberType, dataMemberMapping ); @@ -183,7 +186,7 @@ void ora::ObjectWriter::processDataMember( DataElement& dataMemberElement, } -ora::ObjectUpdater::ObjectUpdater( const Reflex::Type& objectType, +ora::ObjectUpdater::ObjectUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): ObjectStreamerBase( objectType, mapping, contSchema ), @@ -222,7 +225,7 @@ void ora::ObjectUpdater::update( int oid, void ora::ObjectUpdater::processDataMember( DataElement& dataMemberElement, IRelationalData& relationalData, - Reflex::Type& dataMemberType, + edm::TypeWithDict& dataMemberType, MappingElement& dataMemberMapping, RelationalBuffer* operationBuffer ){ IRelationalUpdater* dataMemberUpdater = m_streamerFactory.newUpdater( dataMemberType, dataMemberMapping ); @@ -230,7 +233,7 @@ void ora::ObjectUpdater::processDataMember( DataElement& dataMemberElement, dataMemberUpdater->build( dataMemberElement, relationalData, *operationBuffer ); } -ora::ObjectReader::ObjectReader( const Reflex::Type& objectType, +ora::ObjectReader::ObjectReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): ObjectStreamerBase( objectType, mapping, contSchema ), @@ -281,7 +284,7 @@ void ora::ObjectReader::clear(){ void ora::ObjectReader::processDataMember( DataElement& dataMemberElement, IRelationalData& relationalData, - Reflex::Type& dataMemberType, + edm::TypeWithDict& dataMemberType, MappingElement& dataMemberMapping, RelationalBuffer*){ IRelationalReader* dataMemberReader = m_streamerFactory.newReader( dataMemberType, dataMemberMapping ); @@ -290,7 +293,7 @@ void ora::ObjectReader::processDataMember( DataElement& dataMemberElement, } -ora::ObjectStreamer::ObjectStreamer( const Reflex::Type& objectType, +ora::ObjectStreamer::ObjectStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), diff --git a/CondCore/ORA/src/ObjectStreamer.h b/CondCore/ORA/src/ObjectStreamer.h index 0a15566e9c02d..bb55c6c60a172 100644 --- a/CondCore/ORA/src/ObjectStreamer.h +++ b/CondCore/ORA/src/ObjectStreamer.h @@ -4,7 +4,7 @@ #include "IRelationalStreamer.h" #include "RelationalStreamerFactory.h" // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { @@ -14,15 +14,15 @@ namespace ora { class ObjectStreamerBase { public: - ObjectStreamerBase( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + ObjectStreamerBase( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~ObjectStreamerBase(); - virtual void processDataMember( DataElement& dataElement, IRelationalData& relationalData, Reflex::Type& dataMemberType, MappingElement& dataMemberMapping, RelationalBuffer* operationBuffer ) = 0; - void buildBaseDataMembers( DataElement& dataElement, IRelationalData& relationalData, const Reflex::Type& objType, RelationalBuffer* operationBuffer ); + virtual void processDataMember( DataElement& dataElement, IRelationalData& relationalData, edm::TypeWithDict& dataMemberType, MappingElement& dataMemberMapping, RelationalBuffer* operationBuffer ) = 0; + void buildBaseDataMembers( DataElement& dataElement, IRelationalData& relationalData, const edm::TypeWithDict& objType, RelationalBuffer* operationBuffer ); bool buildDataMembers( DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer* operationBuffer ); protected: RelationalStreamerFactory m_streamerFactory; private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; }; @@ -30,7 +30,7 @@ namespace ora { public: - ObjectWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + ObjectWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~ObjectWriter(); @@ -43,7 +43,7 @@ namespace ora { public: - void processDataMember( DataElement& dataElement, IRelationalData& relationalData, Reflex::Type& dataMemberType, MappingElement& dataMemberMapping, RelationalBuffer* operationBuffer ); + void processDataMember( DataElement& dataElement, IRelationalData& relationalData, edm::TypeWithDict& dataMemberType, MappingElement& dataMemberMapping, RelationalBuffer* operationBuffer ); private: @@ -54,7 +54,7 @@ namespace ora { public: - ObjectUpdater( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + ObjectUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~ObjectUpdater(); @@ -68,7 +68,7 @@ namespace ora { public: - void processDataMember( DataElement& dataElement, IRelationalData& relationalData, Reflex::Type& dataMemberType, MappingElement& dataMemberMapping, RelationalBuffer* operationBuffer ); + void processDataMember( DataElement& dataElement, IRelationalData& relationalData, edm::TypeWithDict& dataMemberType, MappingElement& dataMemberMapping, RelationalBuffer* operationBuffer ); private: @@ -79,7 +79,7 @@ namespace ora { public: - ObjectReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + ObjectReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~ObjectReader(); @@ -96,7 +96,7 @@ namespace ora { public: - void processDataMember( DataElement& dataElement, IRelationalData& relationalData, Reflex::Type& dataMemberType, MappingElement& dataMemberMapping, RelationalBuffer* operationBuffer ); + void processDataMember( DataElement& dataElement, IRelationalData& relationalData, edm::TypeWithDict& dataMemberType, MappingElement& dataMemberMapping, RelationalBuffer* operationBuffer ); private: @@ -106,7 +106,7 @@ namespace ora { class ObjectStreamer : public IRelationalStreamer { public: - ObjectStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + ObjectStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); ~ObjectStreamer(); @@ -117,7 +117,7 @@ namespace ora { IRelationalReader* newReader(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; ContainerSchema& m_schema; }; diff --git a/CondCore/ORA/src/OraPtrStreamer.cc b/CondCore/ORA/src/OraPtrStreamer.cc index aa2ca5812f84a..99c455dceff44 100644 --- a/CondCore/ORA/src/OraPtrStreamer.cc +++ b/CondCore/ORA/src/OraPtrStreamer.cc @@ -8,13 +8,14 @@ #include "RelationalStreamerFactory.h" // externals #include "CoralBase/Attribute.h" -#include "Reflex/Object.h" -#include "Reflex/Member.h" +#include "FWCore/Utilities/interface/ObjectWithDict.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" +#include "FWCore/Utilities/interface/MemberWithDict.h" namespace ora { class OraPtrReadBuffer { public: - OraPtrReadBuffer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ): + OraPtrReadBuffer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), m_mapping( mapping ), m_schema( contSchema ), @@ -38,16 +39,16 @@ namespace ora { } // Check the type - Reflex::Type ptrType = m_objectType.TemplateArgumentAt(0); - Reflex::Type ptrResolvedType = ClassUtils::resolvedType(ptrType); + edm::TypeWithDict ptrType = m_objectType.templateArgumentAt(0); + edm::TypeWithDict ptrResolvedType = ClassUtils::resolvedType(ptrType); // Check the component type if ( ! ptrType || !ptrResolvedType ) { throwException( "Missing dictionary information for the type of the pointer \"" + - m_objectType.Name(Reflex::SCOPED|Reflex::FINAL) + "\"", + m_objectType.cppName() + "\"", "OraPtrReadBuffer::build" ); } - std::string ptrTypeName = ptrType.Name(); + std::string ptrTypeName = ptrType.name(); // Retrieve the relevant mapping element MappingElement::iterator iMe = m_mapping.find( ptrTypeName ); if ( iMe == m_mapping.end() ) { @@ -84,7 +85,7 @@ namespace ora { m_reader->select( fullId[0] ); void* destination = 0; if( m_query.nextCursorRow() ){ - destination = ClassUtils::constructObject( m_objectType.TemplateArgumentAt(0) ); + destination = ClassUtils::constructObject( m_objectType.templateArgumentAt(0) ); m_reader->setRecordId( recordId ); m_reader->read( destination ); } @@ -94,7 +95,7 @@ namespace ora { } private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; ContainerSchema& m_schema; DataElement m_localElement; @@ -138,7 +139,7 @@ namespace ora { }; } -ora::OraPtrWriter::OraPtrWriter( const Reflex::Type& objectType, +ora::OraPtrWriter::OraPtrWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), @@ -159,16 +160,16 @@ bool ora::OraPtrWriter::build(DataElement& dataElement, m_localElement.clear(); // Check the type - Reflex::Type ptrType = m_objectType.TemplateArgumentAt(0); - Reflex::Type ptrResolvedType = ClassUtils::resolvedType(ptrType); + edm::TypeWithDict ptrType = m_objectType.templateArgumentAt(0); + edm::TypeWithDict ptrResolvedType = ClassUtils::resolvedType(ptrType); // Check the component type if ( ! ptrType || !ptrResolvedType ) { throwException( "Missing dictionary information for the type of the pointer \"" + - m_objectType.Name(Reflex::SCOPED|Reflex::FINAL) + "\"", + m_objectType.cppName() + "\"", "OraPtrWriter::build" ); } - std::string ptrTypeName = ptrType.Name(); + std::string ptrTypeName = ptrType.name(); // Retrieve the relevant mapping element MappingElement::iterator iMe = m_mappingElement.find( ptrTypeName ); if ( iMe == m_mappingElement.end() ) { @@ -193,16 +194,17 @@ void ora::OraPtrWriter::write( int oid, "OraPtrWriter::write"); } - Reflex::Object ptrObject( m_objectType, m_dataElement->address( data ) ); + edm::ObjectWithDict ptrObject( m_objectType, m_dataElement->address( data ) ); // first load if required - ptrObject.Invoke("load",0); + m_objectType.functionMemberByName("load").invoke(ptrObject,nullptr); // then get the data... - void* ptrAddress = 0; - ptrObject.Invoke("address",ptrAddress); + void* ptrAddress = nullptr; + edm::ObjectWithDict ptrAddrObj = edm::ObjectWithDict( edm::TypeWithDict(typeid(void*)), &ptrAddress ); + m_objectType.functionMemberByName("address").invoke(ptrObject, &ptrAddrObj); m_writer->write( oid, ptrAddress ); } -ora::OraPtrUpdater::OraPtrUpdater( const Reflex::Type& objectType, +ora::OraPtrUpdater::OraPtrUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), @@ -223,16 +225,16 @@ bool ora::OraPtrUpdater::build(DataElement& dataElement, m_localElement.clear(); // Check the type - Reflex::Type ptrType = m_objectType.TemplateArgumentAt(0); - Reflex::Type ptrResolvedType = ClassUtils::resolvedType(ptrType); + edm::TypeWithDict ptrType = m_objectType.templateArgumentAt(0); + edm::TypeWithDict ptrResolvedType = ClassUtils::resolvedType(ptrType); // Check the component type if ( ! ptrType || !ptrResolvedType ) { throwException( "Missing dictionary information for the type of the pointer \"" + - m_objectType.Name(Reflex::SCOPED|Reflex::FINAL) + "\"", + m_objectType.cppName() + "\"", "OraPtrUpdater::build" ); } - std::string ptrTypeName = ptrType.Name(); + std::string ptrTypeName = ptrType.name(); // Retrieve the relevant mapping element MappingElement::iterator iMe = m_mappingElement.find( ptrTypeName ); if ( iMe == m_mappingElement.end() ) { @@ -255,15 +257,16 @@ void ora::OraPtrUpdater::update( int oid, throwException("The streamer has not been built.", "OraPtrUpdater::update"); } - Reflex::Object ptrObject( m_objectType, m_dataElement->address( data ) ); + edm::ObjectWithDict ptrObject( m_objectType, m_dataElement->address( data ) ); // first load if required - ptrObject.Invoke("load",0); - void* ptrAddress = 0; - ptrObject.Invoke("address",ptrAddress); + m_objectType.functionMemberByName("load").invoke(ptrObject, nullptr); + void *ptrAddress = nullptr; + edm::ObjectWithDict ptrAddrObj = edm::ObjectWithDict( edm::TypeWithDict(typeid(void*)), &ptrAddress ); + m_objectType.functionMemberByName("address").invoke(ptrObject, &ptrAddrObj); m_updater->update( oid, ptrAddress ); } -ora::OraPtrReader::OraPtrReader( const Reflex::Type& objectType, +ora::OraPtrReader::OraPtrReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), @@ -308,8 +311,8 @@ void ora::OraPtrReader::read( void* data ){ "OraPtrReader::read"); } // resolving loader address - Reflex::Member loaderMember = m_objectType.MemberByName("m_loader"); - DataElement& loaderElement = m_dataElement->addChild( loaderMember.Offset(), 0 ); + edm::MemberWithDict loaderMember = m_objectType.dataMemberByName("m_loader"); + DataElement& loaderElement = m_dataElement->addChild( loaderMember.offset(), 0 ); void* loaderAddress = loaderElement.address( data ); boost::shared_ptr* loaderPtr = static_cast*>( loaderAddress ); // creating new loader @@ -323,7 +326,7 @@ void ora::OraPtrReader::clear(){ } -ora::OraPtrStreamer::OraPtrStreamer( const Reflex::Type& objectType, +ora::OraPtrStreamer::OraPtrStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), diff --git a/CondCore/ORA/src/OraPtrStreamer.h b/CondCore/ORA/src/OraPtrStreamer.h index 78119cf1ecaa8..bfbef56d36338 100644 --- a/CondCore/ORA/src/OraPtrStreamer.h +++ b/CondCore/ORA/src/OraPtrStreamer.h @@ -7,7 +7,7 @@ #include #include // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { @@ -21,7 +21,7 @@ namespace ora { public: - OraPtrWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + OraPtrWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~OraPtrWriter(); @@ -34,7 +34,7 @@ namespace ora { private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mappingElement; ContainerSchema& m_schema; DataElement m_localElement; @@ -46,7 +46,7 @@ namespace ora { public: - OraPtrUpdater( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + OraPtrUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~OraPtrUpdater(); @@ -60,7 +60,7 @@ namespace ora { private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mappingElement; ContainerSchema& m_schema; DataElement m_localElement; @@ -72,7 +72,7 @@ namespace ora { public: - OraPtrReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + OraPtrReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~OraPtrReader(); @@ -89,7 +89,7 @@ namespace ora { private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; DataElement* m_dataElement; std::auto_ptr m_readBuffer; std::vector > m_loaders; @@ -99,7 +99,7 @@ namespace ora { class OraPtrStreamer : public IRelationalStreamer { public: - OraPtrStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + OraPtrStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); ~OraPtrStreamer(); @@ -110,7 +110,7 @@ namespace ora { IRelationalReader* newReader(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; ContainerSchema& m_schema; }; diff --git a/CondCore/ORA/src/OraReferenceStreamer.cc b/CondCore/ORA/src/OraReferenceStreamer.cc index 483ae2172df86..3c91e25611a98 100644 --- a/CondCore/ORA/src/OraReferenceStreamer.cc +++ b/CondCore/ORA/src/OraReferenceStreamer.cc @@ -9,9 +9,9 @@ #include "ClassUtils.h" // externals #include "CoralBase/Attribute.h" -#include "Reflex/Member.h" +#include "FWCore/Utilities/interface/MemberWithDict.h" -ora::OraReferenceStreamerBase::OraReferenceStreamerBase( const Reflex::Type& objectType, +ora::OraReferenceStreamerBase::OraReferenceStreamerBase( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& schema): m_objectType( objectType ), @@ -33,24 +33,24 @@ bool ora::OraReferenceStreamerBase::buildDataElement(DataElement& dataElement, IRelationalData& relationalData){ m_dataElement = &dataElement; // first resolve the oid0 and oid2 data elements... - Reflex::Type refType = Reflex::Type::ByTypeInfo( typeid(Reference) ); - //Reflex::Type oidType = Reflex::Type::ByTypeInfo( typeid(OId) ); - Reflex::OffsetFunction baseOffsetFunc = 0; + edm::TypeWithDict refType( typeid(Reference) ); + //edm::TypeWithDict oidType = edm::TypeWithDict::ByTypeInfo( typeid(OId) ); + size_t baseOffsetFunc = 0; if( m_objectType != refType ){ bool foundRef = ClassUtils::findBaseType( m_objectType, refType, baseOffsetFunc ); if(!foundRef){ - throwException("Type \""+m_objectType.Name(Reflex::SCOPED)+"\" is not an Ora Reference.", + throwException("Type \""+m_objectType.cppName()+"\" is not an Ora Reference.", "OraReferenceStreamerBase::buildDataElement"); } } - Reflex::Member contIdMember = refType.DataMemberByName("m_containerId"); - Reflex::Member itemIdMember = refType.DataMemberByName("m_itemId"); + edm::MemberWithDict contIdMember = refType.dataMemberByName("m_containerId"); + edm::MemberWithDict itemIdMember = refType.dataMemberByName("m_itemId"); if( !contIdMember || !itemIdMember ){ throwException("Data members for class OId not found.", "OraReferenceStreamerBase::buildDataElement"); } - m_dataElemOId0 = &dataElement.addChild( contIdMember.Offset(), baseOffsetFunc ); - m_dataElemOId1 = &dataElement.addChild( itemIdMember.Offset(), baseOffsetFunc); + m_dataElemOId0 = &dataElement.addChild( contIdMember.offset(), baseOffsetFunc ); + m_dataElemOId1 = &dataElement.addChild( itemIdMember.offset(), baseOffsetFunc); // then book the columns in the data attribute... const std::vector& columns = m_mapping.columnNames(); if( columns.size() < 2 ){ @@ -100,7 +100,7 @@ void ora::OraReferenceStreamerBase::bindDataForRead( void* data ){ if(refHandler) refHandler->onLoad( *static_cast( refPtr ) ); } -ora::OraReferenceWriter::OraReferenceWriter( const Reflex::Type& objectType, +ora::OraReferenceWriter::OraReferenceWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& schema ): OraReferenceStreamerBase( objectType, mapping, schema ){ @@ -123,7 +123,7 @@ void ora::OraReferenceWriter::write( int, bindDataForUpdate( data ); } -ora::OraReferenceUpdater::OraReferenceUpdater( const Reflex::Type& objectType, +ora::OraReferenceUpdater::OraReferenceUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& schema): OraReferenceStreamerBase( objectType, mapping, schema ){ @@ -146,7 +146,7 @@ void ora::OraReferenceUpdater::update( int, bindDataForUpdate( data ); } -ora::OraReferenceReader::OraReferenceReader( const Reflex::Type& objectType, +ora::OraReferenceReader::OraReferenceReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& schema ): OraReferenceStreamerBase( objectType, mapping, schema ){ @@ -174,7 +174,7 @@ void ora::OraReferenceReader::clear(){ } -ora::OraReferenceStreamer::OraReferenceStreamer( const Reflex::Type& objectType, +ora::OraReferenceStreamer::OraReferenceStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& schema ): m_objectType( objectType ), diff --git a/CondCore/ORA/src/OraReferenceStreamer.h b/CondCore/ORA/src/OraReferenceStreamer.h index 67f17c435914e..323beb2db3e52 100644 --- a/CondCore/ORA/src/OraReferenceStreamer.h +++ b/CondCore/ORA/src/OraReferenceStreamer.h @@ -3,7 +3,7 @@ #include "IRelationalStreamer.h" // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { @@ -14,7 +14,7 @@ namespace ora { public: - explicit OraReferenceStreamerBase( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema ); + explicit OraReferenceStreamerBase( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& schema ); virtual ~OraReferenceStreamerBase(); @@ -26,7 +26,7 @@ namespace ora { private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; int m_columnIndexes[2]; ContainerSchema& m_schema; @@ -38,7 +38,7 @@ namespace ora { class OraReferenceWriter : public OraReferenceStreamerBase, public IRelationalWriter { public: - explicit OraReferenceWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema ); + explicit OraReferenceWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& schema ); virtual ~OraReferenceWriter(); @@ -53,7 +53,7 @@ namespace ora { class OraReferenceUpdater : public OraReferenceStreamerBase, public IRelationalUpdater { public: - explicit OraReferenceUpdater( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema ); + explicit OraReferenceUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& schema ); virtual ~OraReferenceUpdater(); @@ -67,7 +67,7 @@ namespace ora { class OraReferenceReader : public OraReferenceStreamerBase, public IRelationalReader { public: - explicit OraReferenceReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema ); + explicit OraReferenceReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& schema ); virtual ~OraReferenceReader(); @@ -86,7 +86,7 @@ namespace ora { class OraReferenceStreamer : public IRelationalStreamer { public: - explicit OraReferenceStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema ); + explicit OraReferenceStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& schema ); ~OraReferenceStreamer(); @@ -97,7 +97,7 @@ namespace ora { IRelationalReader* newReader(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; ContainerSchema& m_schema; }; diff --git a/CondCore/ORA/src/PVectorHandler.cc b/CondCore/ORA/src/PVectorHandler.cc index dc1c744fa9b6c..f5d1004bf31b7 100644 --- a/CondCore/ORA/src/PVectorHandler.cc +++ b/CondCore/ORA/src/PVectorHandler.cc @@ -1,20 +1,25 @@ #include "CondCore/ORA/interface/Exception.h" +#include "CondCore/ORA/interface/PVector.h" +#include "CondFormats/Common/interface/IOVElement.h" +#include "FWCore/Utilities/interface/MemberWithDict.h" #include "PVectorHandler.h" #include "ClassUtils.h" // externals #include "RVersion.h" +#include +#include -ora::PVectorIteratorHandler::PVectorIteratorHandler( const Reflex::Environ& collEnv, - Reflex::CollFuncTable& collProxy, - const Reflex::Type& iteratorReturnType, - size_t startElement): +ora::PVectorIteratorHandler::PVectorIteratorHandler( void* address, + TVirtualCollectionProxy& collProxy, + const edm::TypeWithDict& iteratorReturnType, + size_t startElement): m_returnType(iteratorReturnType), - m_collEnv(collEnv), m_collProxy(collProxy), m_currentElement(0), + m_Iterators(TGenericCollectionIterator::New(address, &collProxy)), m_startElement(startElement){ - // retrieve the first element - m_currentElement = m_collProxy.first_func(&m_collEnv); + + m_currentElement = m_Iterators->Next(); if(startElement){ size_t i = 0; @@ -30,9 +35,7 @@ ora::PVectorIteratorHandler::~PVectorIteratorHandler(){ void ora::PVectorIteratorHandler::increment(){ - // this is requiredd! It sets the number of memory slots (of size sizeof(Class)) to be used for the step - m_collEnv.fIdx = 1; - m_currentElement = m_collProxy.next_func(&m_collEnv); + m_currentElement = m_Iterators->Next(); } void* @@ -40,42 +43,36 @@ ora::PVectorIteratorHandler::object(){ return m_currentElement; } -Reflex::Type& +edm::TypeWithDict& ora::PVectorIteratorHandler::returnType(){ return m_returnType; } -ora::PVectorHandler::PVectorHandler( const Reflex::Type& dictionary ): +ora::PVectorHandler::PVectorHandler( const edm::TypeWithDict& dictionary ): m_type( dictionary ), m_iteratorReturnType(), - m_isAssociative( false ), - m_collEnv(), m_collProxy(), m_persistentSizeAttributeOffset(0), m_vecAttributeOffset(0) { - Reflex::Member privateVectorAttribute = m_type.DataMemberByName("m_vec"); + edm::MemberWithDict privateVectorAttribute = m_type.dataMemberByName("m_vec"); if(privateVectorAttribute){ - m_vecAttributeOffset = privateVectorAttribute.Offset(); - Reflex::Member method = privateVectorAttribute.TypeOf().MemberByName("createCollFuncTable"); - if(method){ - Reflex::CollFuncTable* collProxyPtr; - method.Invoke(collProxyPtr); - m_collProxy.reset( collProxyPtr ); - } - if(! m_collProxy.get() ){ - throwException( "Cannot find \"createCollFuncTable\" function for type \""+m_type.Name(Reflex::SCOPED)+"\"", - "PVectorHandler::PVectorHandler"); + m_vecAttributeOffset = privateVectorAttribute.offset(); + TClass* cl = privateVectorAttribute.typeOf().getClass(); + m_collProxy = cl->GetCollectionProxy(); + if( !m_collProxy ){ + throwException( "Cannot create \"TVirtualCollectionProxy\" for type \""+m_type.cppName()+"\"", + "PVectorHandler::PVectorHandler"); } } - - Reflex::Member persistentSizeAttribute = m_type.DataMemberByName("m_persistentSize"); + + edm::MemberWithDict persistentSizeAttribute = m_type.dataMemberByName("m_persistentSize"); if( persistentSizeAttribute ){ - m_persistentSizeAttributeOffset = persistentSizeAttribute.Offset(); + m_persistentSizeAttributeOffset = persistentSizeAttribute.offset(); } // find the iterator return type as the member type_value of the containers - Reflex::Type valueType = ClassUtils::containerValueType( m_type ); + edm::TypeWithDict valueType = ClassUtils::containerValueType( m_type ); m_iteratorReturnType = ClassUtils::resolvedType( valueType ); } @@ -84,16 +81,18 @@ ora::PVectorHandler::~PVectorHandler(){ size_t ora::PVectorHandler::size( const void* address ){ - m_collEnv.fObject = static_cast(const_cast(address))+m_vecAttributeOffset; - size_t transientSize = *(static_cast(m_collProxy->size_func(&m_collEnv))); - return transientSize; + TVirtualCollectionProxy::TPushPop helper(m_collProxy, static_cast(const_cast(address))+m_vecAttributeOffset ); + return m_collProxy->Size(); } size_t ora::PVectorHandler::startElementIndex( const void* address ){ const void* persistentSizeAddress = static_cast(address) + m_persistentSizeAttributeOffset; size_t persistentSize = *static_cast(persistentSizeAddress); - size_t transientSize = *(static_cast(m_collProxy->size_func(&m_collEnv))); + + TVirtualCollectionProxy::TPushPop helper(m_collProxy, static_cast(const_cast(address))+m_vecAttributeOffset ); + size_t transientSize = m_collProxy->Size(); + size_t startElement = 0; if(persistentSize < transientSize) startElement = persistentSize; return startElement; @@ -108,33 +107,29 @@ ora::IArrayIteratorHandler* ora::PVectorHandler::iterate( const void* address ){ if ( ! m_iteratorReturnType ) { throwException( "Missing the dictionary information for the value_type member of the container \"" + - m_type.Name(Reflex::SCOPED|Reflex::FINAL) + "\"", + m_type.cppName() + "\"", "PVectorHandler" ); } - m_collEnv.fObject = static_cast(const_cast(address))+m_vecAttributeOffset; - return new PVectorIteratorHandler( m_collEnv,*m_collProxy,m_iteratorReturnType,startElementIndex(address) ); + void *addr = static_cast(const_cast(address))+m_vecAttributeOffset; + + return new PVectorIteratorHandler( addr,*m_collProxy,m_iteratorReturnType,startElementIndex(address) ); } void ora::PVectorHandler::appendNewElement( void* address, void* data ){ - void* dest_address = static_cast(address)+m_vecAttributeOffset; -#if ROOT_VERSION_CODE < ROOT_VERSION(5,28,0) - m_collEnv.fObject = dest_address; - m_collEnv.fSize = 1; - m_collEnv.fStart = data; - m_collProxy->feed_func(&m_collEnv); -#else - m_collProxy->feed_func(data,dest_address,1); -#endif + + void* addr = static_cast(const_cast(address))+m_vecAttributeOffset; + m_collProxy->Insert(data, addr, 1); } void ora::PVectorHandler::clear( const void* address ){ - m_collEnv.fObject = static_cast(const_cast(address))+m_vecAttributeOffset; - m_collProxy->clear_func(&m_collEnv); + void* addr = static_cast(const_cast(address))+m_vecAttributeOffset; + TVirtualCollectionProxy::TPushPop helper(m_collProxy, const_cast(addr)); + m_collProxy->Clear(); } -Reflex::Type& +edm::TypeWithDict& ora::PVectorHandler::iteratorReturnType() { return m_iteratorReturnType; } diff --git a/CondCore/ORA/src/PVectorHandler.h b/CondCore/ORA/src/PVectorHandler.h index fcf4df0491f9e..5135e6c08f712 100644 --- a/CondCore/ORA/src/PVectorHandler.h +++ b/CondCore/ORA/src/PVectorHandler.h @@ -5,8 +5,10 @@ // #include // externals -#include "Reflex/Reflex.h" -#include "Reflex/Builder/CollectionProxy.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" + +#include "TVirtualCollectionIterators.h" +#include "TVirtualCollectionProxy.h" namespace ora { @@ -15,9 +17,9 @@ namespace ora { public: /// Constructor - PVectorIteratorHandler( const Reflex::Environ& collEnv, - Reflex::CollFuncTable& collProxy, - const Reflex::Type& iteratorReturnType, + PVectorIteratorHandler( void* address, + TVirtualCollectionProxy& collProxy, + const edm::TypeWithDict& iteratorReturnType, size_t startElement ); /// Destructor @@ -30,22 +32,22 @@ namespace ora { void* object(); /// Returns the return type of the iterator dereference method - Reflex::Type& returnType(); + edm::TypeWithDict& returnType(); private: /// The return type of the iterator dereference method - Reflex::Type m_returnType; - - /// Structure containing parameters of the collection instance - Reflex::Environ m_collEnv; + edm::TypeWithDict m_returnType; /// Proxy of the generic collection - Reflex::CollFuncTable& m_collProxy; + TVirtualCollectionProxy& m_collProxy; /// Current element object pointer void* m_currentElement; + // holds the iterators when the branch is of fType==4. + TGenericCollectionIterator *m_Iterators; + size_t m_startElement; }; @@ -54,7 +56,7 @@ namespace ora { public: /// Constructor - explicit PVectorHandler( const Reflex::Type& dictionary ); + explicit PVectorHandler( const edm::TypeWithDict& dictionary ); /// Destructor virtual ~PVectorHandler(); @@ -75,11 +77,11 @@ namespace ora { void clear( const void* address ); /// Returns the iterator return type - Reflex::Type& iteratorReturnType(); + edm::TypeWithDict& iteratorReturnType(); /// Returns the associativeness of the container bool isAssociative() const { - return m_isAssociative; + return false; } /// Returns the persistent size of the container @@ -90,19 +92,13 @@ namespace ora { private: /// The dictionary information - Reflex::Type m_type; + edm::TypeWithDict m_type; /// The iterator return type - Reflex::Type m_iteratorReturnType; - - /// Flag indicating whether the container is associative - bool m_isAssociative; - - /// Structure containing parameters of the collection instance - Reflex::Environ m_collEnv; + edm::TypeWithDict m_iteratorReturnType; /// Proxy of the generic collection - std::auto_ptr m_collProxy; + TVirtualCollectionProxy* m_collProxy; size_t m_persistentSizeAttributeOffset; diff --git a/CondCore/ORA/src/PVectorStreamer.cc b/CondCore/ORA/src/PVectorStreamer.cc index 0d1da2d62b0a0..9947bda5738b6 100644 --- a/CondCore/ORA/src/PVectorStreamer.cc +++ b/CondCore/ORA/src/PVectorStreamer.cc @@ -3,7 +3,7 @@ #include "ArrayCommonImpl.h" #include "IArrayHandler.h" -ora::PVectorWriter::PVectorWriter( const Reflex::Type& objectType, +ora::PVectorWriter::PVectorWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_writer( objectType, mapping, contSchema ){ @@ -28,7 +28,7 @@ void ora::PVectorWriter::write( int oid, m_writer.write( oid, inputData ); } -ora::PVectorUpdater::PVectorUpdater(const Reflex::Type& objectType, +ora::PVectorUpdater::PVectorUpdater(const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_buffer(0), @@ -70,7 +70,7 @@ void ora::PVectorUpdater::update( int oid, *persistentSize = arraySize; } -ora::PVectorReader::PVectorReader(const Reflex::Type& objectType, +ora::PVectorReader::PVectorReader(const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_reader( objectType, mapping, contSchema ){ @@ -101,7 +101,7 @@ void ora::PVectorReader::clear(){ m_reader.clear(); } -ora::PVectorStreamer::PVectorStreamer( const Reflex::Type& objectType, +ora::PVectorStreamer::PVectorStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), diff --git a/CondCore/ORA/src/PVectorStreamer.h b/CondCore/ORA/src/PVectorStreamer.h index 0aa7c38226b67..4acdd0b601547 100644 --- a/CondCore/ORA/src/PVectorStreamer.h +++ b/CondCore/ORA/src/PVectorStreamer.h @@ -9,7 +9,7 @@ namespace ora { public: /// Constructor - PVectorWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + PVectorWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~PVectorWriter(); bool build( DataElement& offset, IRelationalData& relationalData, RelationalBuffer& operationBuffer ); @@ -25,7 +25,7 @@ namespace ora { public: /// Constructor - PVectorUpdater(const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + PVectorUpdater(const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~PVectorUpdater(); bool build( DataElement& offset, IRelationalData& relationalData, RelationalBuffer& operationBuffer); @@ -42,7 +42,7 @@ namespace ora { public: /// Constructor - PVectorReader(const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + PVectorReader(const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~PVectorReader(); @@ -59,7 +59,7 @@ namespace ora { class PVectorStreamer : public IRelationalStreamer { public: - PVectorStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + PVectorStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); ~PVectorStreamer(); @@ -70,7 +70,7 @@ namespace ora { IRelationalReader* newReader(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; ContainerSchema& m_schema; }; diff --git a/CondCore/ORA/src/PoolToken.cc b/CondCore/ORA/src/PoolToken.cc index c90d8f4f8ab10..24b8c4c843c98 100755 --- a/CondCore/ORA/src/PoolToken.cc +++ b/CondCore/ORA/src/PoolToken.cc @@ -1,11 +1,12 @@ #include "CondCore/ORA/interface/PoolToken.h" #include "CondCore/ORA/interface/Exception.h" #include "CondCore/ORA/interface/Guid.h" +#include "ClassUtils.h" // #include #include // externals -#include "Reflex/Reflex.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace cond { @@ -58,12 +59,9 @@ namespace cond { char buff[20]; std::string clguid(""); // first lookup the class guid in the dictionary - Reflex::Type containerType = Reflex::Type::ByName( className ); + edm::TypeWithDict containerType = edm::TypeWithDict::byName( className ); if( containerType ){ - Reflex::PropertyList props = containerType.Properties(); - if( props.HasProperty("ClassID")){ - clguid = props.PropertyAsString("ClassID"); - } + clguid = ora::ClassUtils::getClassProperty( std::string("ClassID"),containerType ); } // if not found, generate one... if( clguid.empty() ){ diff --git a/CondCore/ORA/src/PrimitiveStreamer.cc b/CondCore/ORA/src/PrimitiveStreamer.cc index a737a4c23dc7c..9ea17ccb65327 100644 --- a/CondCore/ORA/src/PrimitiveStreamer.cc +++ b/CondCore/ORA/src/PrimitiveStreamer.cc @@ -8,7 +8,7 @@ #include "CoralBase/Attribute.h" -ora::PrimitiveStreamerBase::PrimitiveStreamerBase( const Reflex::Type& objectType, +ora::PrimitiveStreamerBase::PrimitiveStreamerBase( const edm::TypeWithDict& objectType, MappingElement& mapping ): m_objectType( objectType ), m_mapping(mapping), @@ -27,8 +27,7 @@ bool ora::PrimitiveStreamerBase::buildDataElement(DataElement& dataElement, "PrimitiveStreamerBase::buildDataElement"); } - const std::type_info* attrType = &m_objectType.TypeInfo(); - if(m_objectType.IsEnum()) attrType = &typeid(int); + const std::type_info* attrType = m_objectType.isEnum() ? &typeid(int) : &m_objectType.typeInfo(); if(ClassUtils::isTypeString( m_objectType )) attrType = &typeid(std::string); std::string columnName = m_mapping.columnNames()[0]; m_columnIndex = relationalData.addData( columnName, *attrType ); @@ -64,7 +63,7 @@ void ora::PrimitiveStreamerBase::bindDataForRead( void* data ){ } -ora::PrimitiveWriter::PrimitiveWriter( const Reflex::Type& objectType, +ora::PrimitiveWriter::PrimitiveWriter( const edm::TypeWithDict& objectType, MappingElement& mapping ): PrimitiveStreamerBase( objectType, mapping ){ } @@ -85,7 +84,7 @@ void ora::PrimitiveWriter::write( int, const void* data ){ bindDataForUpdate( data ); } -ora::PrimitiveUpdater::PrimitiveUpdater( const Reflex::Type& objectType, +ora::PrimitiveUpdater::PrimitiveUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping ): PrimitiveStreamerBase( objectType, mapping ){ } @@ -107,7 +106,7 @@ void ora::PrimitiveUpdater::update( int, bindDataForUpdate( data ); } -ora::PrimitiveReader::PrimitiveReader( const Reflex::Type& objectType, +ora::PrimitiveReader::PrimitiveReader( const edm::TypeWithDict& objectType, MappingElement& mapping ): PrimitiveStreamerBase( objectType, mapping ){ } @@ -134,7 +133,7 @@ void ora::PrimitiveReader::clear(){ } -ora::PrimitiveStreamer::PrimitiveStreamer( const Reflex::Type& objectType, +ora::PrimitiveStreamer::PrimitiveStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping ): m_objectType( objectType ), m_mapping( mapping ){ diff --git a/CondCore/ORA/src/PrimitiveStreamer.h b/CondCore/ORA/src/PrimitiveStreamer.h index b0aa9a18f1fb1..2a2afaae74f5e 100644 --- a/CondCore/ORA/src/PrimitiveStreamer.h +++ b/CondCore/ORA/src/PrimitiveStreamer.h @@ -3,7 +3,7 @@ #include "IRelationalStreamer.h" // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { @@ -14,7 +14,7 @@ namespace ora { public: - PrimitiveStreamerBase( const Reflex::Type& objectType, MappingElement& mapping ); + PrimitiveStreamerBase( const edm::TypeWithDict& objectType, MappingElement& mapping ); virtual ~PrimitiveStreamerBase(); @@ -26,7 +26,7 @@ namespace ora { private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; int m_columnIndex; DataElement* m_dataElement; @@ -35,7 +35,7 @@ namespace ora { class PrimitiveWriter : public PrimitiveStreamerBase, public IRelationalWriter { public: - PrimitiveWriter( const Reflex::Type& objectType, MappingElement& mapping ); + PrimitiveWriter( const edm::TypeWithDict& objectType, MappingElement& mapping ); virtual ~PrimitiveWriter(); @@ -50,7 +50,7 @@ namespace ora { class PrimitiveUpdater : public PrimitiveStreamerBase, public IRelationalUpdater { public: - PrimitiveUpdater( const Reflex::Type& objectType, MappingElement& mapping ); + PrimitiveUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping ); virtual ~PrimitiveUpdater(); @@ -64,7 +64,7 @@ namespace ora { class PrimitiveReader : public PrimitiveStreamerBase, public IRelationalReader { public: - PrimitiveReader( const Reflex::Type& objectType, MappingElement& mapping ); + PrimitiveReader( const edm::TypeWithDict& objectType, MappingElement& mapping ); virtual ~PrimitiveReader(); @@ -83,7 +83,7 @@ namespace ora { class PrimitiveStreamer : public IRelationalStreamer { public: - PrimitiveStreamer( const Reflex::Type& objectType, MappingElement& mapping ); + PrimitiveStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping ); ~PrimitiveStreamer(); @@ -94,7 +94,7 @@ namespace ora { IRelationalReader* newReader(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; }; diff --git a/CondCore/ORA/src/QueryableVectorStreamer.cc b/CondCore/ORA/src/QueryableVectorStreamer.cc index ca402c204ab10..322ce04b87183 100644 --- a/CondCore/ORA/src/QueryableVectorStreamer.cc +++ b/CondCore/ORA/src/QueryableVectorStreamer.cc @@ -13,15 +13,15 @@ #include "RelationalBuffer.h" // externals #include "RelationalAccess/IBulkOperation.h" -#include "Reflex/Member.h" -#include "Reflex/Base.h" +#include "FWCore/Utilities/interface/MemberWithDict.h" +#include "FWCore/Utilities/interface/BaseWithDict.h" #include "CoralBase/Attribute.h" namespace ora { class QVReader { public: - QVReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ): + QVReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), m_localElement(), m_reader( ClassUtils::containerSubType(objectType,"store_base_type"), mapping, contSchema ){ @@ -42,14 +42,14 @@ namespace ora { } private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; DataElement m_localElement; PVectorReader m_reader; }; class QVQueryMaker { public: - QVQueryMaker( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ): + QVQueryMaker( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), m_mappingElement( mapping ), m_schema( contSchema ), @@ -80,28 +80,27 @@ namespace ora { m_query->addOrderId( recIdCols[ i ] ); } - Reflex::Type storeBaseType = ClassUtils::containerSubType(m_objectType,"range_store_base_type"); + edm::TypeWithDict storeBaseType = ClassUtils::containerSubType(m_objectType,"range_store_base_type"); if( !storeBaseType ){ throwException( "Missing dictionary information for the range store base type of the container \"" + - m_objectType.Name(Reflex::SCOPED) + "\"", + m_objectType.cppName() + "\"", "QVQueryMaker::build" ); } m_arrayHandler.reset( ArrayHandlerFactory::newArrayHandler( storeBaseType ) ); - Reflex::Type valueType = ClassUtils::containerValueType(m_objectType); - Reflex::Type valueResolvedType = ClassUtils::resolvedType(valueType); + edm::TypeWithDict valueType = ClassUtils::containerValueType(m_objectType); + edm::TypeWithDict valueResolvedType = ClassUtils::resolvedType(valueType); // Check the component type if ( ! valueType ||!valueResolvedType ) { throwException( "Missing dictionary information for the content type of the container \"" + - m_objectType.Name(Reflex::SCOPED) + "\"", + m_objectType.cppName() + "\"", "QVQueryMaker::build" ); } - std::string valueName = valueType.Name(); // Retrieve the relevant mapping element - MappingElement::iterator iMe = m_mappingElement.find( valueName ); + MappingElement::iterator iMe = m_mappingElement.find( "value_type" ); if ( iMe == m_mappingElement.end() ) { - throwException( "Item for \"" + valueName + "\" not found in the mapping element", + throwException( "Item for \"value_type\" not found in the mapping element", "QVQueryMaker::build" ); } @@ -222,17 +221,17 @@ namespace ora { throwException("The reader has not been built.", "QVReader::read"); } - Reflex::Type iteratorDereferenceReturnType = m_arrayHandler->iteratorReturnType(); - Reflex::Member firstMember = iteratorDereferenceReturnType.MemberByName( "first" ); + edm::TypeWithDict iteratorDereferenceReturnType = m_arrayHandler->iteratorReturnType(); + edm::MemberWithDict firstMember = iteratorDereferenceReturnType.dataMemberByName( "first" ); if ( ! firstMember ) { throwException( "Could not retrieve the data member \"first\" of the class \"" + - iteratorDereferenceReturnType.Name(Reflex::SCOPED) + "\"", + iteratorDereferenceReturnType.cppName() + "\"", "QVQueryMakerAndLoad::read" ); } - Reflex::Member secondMember = iteratorDereferenceReturnType.MemberByName( "second" ); + edm::MemberWithDict secondMember = iteratorDereferenceReturnType.dataMemberByName( "second" ); if ( ! secondMember ) { throwException( "Could not retrieve the data member \"second\" of the class \"" + - iteratorDereferenceReturnType.Name(Reflex::SCOPED) + "\"", + iteratorDereferenceReturnType.cppName() + "\"", "QVQueryMakerAndLoad::read" ); } @@ -242,9 +241,9 @@ namespace ora { while ( m_query->nextCursorRow() ){ // Create a new element for the array - void* objectData = iteratorDereferenceReturnType.Construct().Address(); - void* positionData = static_cast< char* >( objectData ) + firstMember.Offset(); - void* containerData = static_cast< char* >( objectData ) + secondMember.Offset(); + void* objectData = iteratorDereferenceReturnType.construct().address(); + void* positionData = static_cast< char* >( objectData ) + firstMember.offset(); + void* containerData = static_cast< char* >( objectData ) + secondMember.offset(); m_recordId[m_recordId.size()-1] = (int)i; coral::AttributeList& row = m_query->data(); @@ -259,10 +258,10 @@ namespace ora { m_arrayHandler->appendNewElement( address, objectData ); bool inserted = m_arrayHandler->size( address )>prevSize; - iteratorDereferenceReturnType.Destruct( objectData ); + iteratorDereferenceReturnType.destruct( objectData ); if ( !inserted ) { throwException( "Could not insert a new element in the array type \"" + - m_objectType.Name(Reflex::SCOPED|Reflex::FINAL) + "\"", + m_objectType.cppName() + "\"", "QVQueryMakerAndLoad::executeAndLoad" ); } ++i; @@ -273,7 +272,7 @@ namespace ora { } private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mappingElement; ContainerSchema& m_schema; std::vector m_recordId; @@ -289,7 +288,7 @@ namespace ora { public: // constructor - QueryableVectorLoader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema, + QueryableVectorLoader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema, const std::vector& fullId ): m_isValid(true), m_reader( objectType, mapping, contSchema ), @@ -349,7 +348,7 @@ namespace ora { } -ora::QueryableVectorWriter::QueryableVectorWriter( const Reflex::Type& objectType, +ora::QueryableVectorWriter::QueryableVectorWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), @@ -380,14 +379,15 @@ void ora::QueryableVectorWriter::write( int oid, "QueryableVectorWriter::write"); } void* vectorAddress = m_offset->address( inputData ); - Reflex::Object vectorObj( m_objectType,const_cast(vectorAddress)); - vectorObj.Invoke("load",0); - void* storageAddress = 0; - vectorObj.Invoke("storageAddress",storageAddress); + edm::ObjectWithDict vectorObj( m_objectType, const_cast(vectorAddress) ); + m_objectType.functionMemberByName("load").invoke(vectorObj,nullptr); + void* storageAddress = nullptr; + edm::ObjectWithDict storAddObj = edm::ObjectWithDict( edm::TypeWithDict(typeid(void*)), &storageAddress ); + m_objectType.functionMemberByName("storageAddress").invoke(vectorObj, &storAddObj); m_writer.write( oid, storageAddress ); } -ora::QueryableVectorUpdater::QueryableVectorUpdater(const Reflex::Type& objectType, +ora::QueryableVectorUpdater::QueryableVectorUpdater(const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), @@ -418,14 +418,15 @@ void ora::QueryableVectorUpdater::update( int oid, "QueryableVectorUpdater::update"); } void* vectorAddress = m_offset->address( data ); - Reflex::Object vectorObj( m_objectType,const_cast(vectorAddress)); - vectorObj.Invoke("load",0); - void* storageAddress = 0; - vectorObj.Invoke("storageAddress",storageAddress); + edm::ObjectWithDict vectorObj( m_objectType,const_cast(vectorAddress)); + m_objectType.functionMemberByName("load").invoke(vectorObj, nullptr); + void* storageAddress = nullptr; + edm::ObjectWithDict storAddObj = edm::ObjectWithDict( edm::TypeWithDict(typeid(void*)), &storageAddress ); + m_objectType.functionMemberByName("storageAddress").invoke(vectorObj, &storAddObj); m_updater.update( oid, storageAddress ); } -ora::QueryableVectorReader::QueryableVectorReader(const Reflex::Type& objectType, +ora::QueryableVectorReader::QueryableVectorReader(const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType(objectType), @@ -469,12 +470,12 @@ void ora::QueryableVectorReader::read( void* destinationData ) { } // finding the address (on the instance) where to install the loader - Reflex::Member loaderMember = m_objectType.DataMemberByName("m_loader"); + edm::MemberWithDict loaderMember = m_objectType.dataMemberByName("m_loader"); if(!loaderMember){ throwException("The loader member has not been found.", "QueryableVectorReader::read"); } - DataElement& loaderMemberElement = m_dataElement->addChild( loaderMember.Offset(), 0 ); + DataElement& loaderMemberElement = m_dataElement->addChild( loaderMember.offset(), 0 ); void* loaderAddress = loaderMemberElement.address( destinationData ); // creating and registering the new loader to assign @@ -488,7 +489,7 @@ void ora::QueryableVectorReader::clear(){ } -ora::QueryableVectorStreamer::QueryableVectorStreamer( const Reflex::Type& objectType, +ora::QueryableVectorStreamer::QueryableVectorStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), diff --git a/CondCore/ORA/src/QueryableVectorStreamer.h b/CondCore/ORA/src/QueryableVectorStreamer.h index a2668c17cc645..f653d68d18e11 100644 --- a/CondCore/ORA/src/QueryableVectorStreamer.h +++ b/CondCore/ORA/src/QueryableVectorStreamer.h @@ -7,7 +7,7 @@ #include #include // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { @@ -22,14 +22,14 @@ namespace ora { public: /// Constructor - QueryableVectorWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + QueryableVectorWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~QueryableVectorWriter(); bool build( DataElement& offset, IRelationalData& relationalData, RelationalBuffer& operationBuffer ); void setRecordId( const std::vector& identity ); void write( int oid,const void* data ); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; DataElement* m_offset; DataElement m_localElement; private: @@ -41,7 +41,7 @@ namespace ora { public: /// Constructor - QueryableVectorUpdater(const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + QueryableVectorUpdater(const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~QueryableVectorUpdater(); bool build( DataElement& offset, IRelationalData& relationalData, RelationalBuffer& operationBuffer); @@ -49,7 +49,7 @@ namespace ora { void update( int oid,const void* data ); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; DataElement* m_offset; DataElement m_localElement; private: @@ -61,7 +61,7 @@ namespace ora { public: /// Constructor - QueryableVectorReader(const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + QueryableVectorReader(const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~QueryableVectorReader(); @@ -72,7 +72,7 @@ namespace ora { void clear(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; ContainerSchema& m_schema; DataElement* m_dataElement; @@ -83,7 +83,7 @@ namespace ora { class QueryableVectorStreamer : public IRelationalStreamer { public: - QueryableVectorStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + QueryableVectorStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); ~QueryableVectorStreamer(); @@ -94,7 +94,7 @@ namespace ora { IRelationalReader* newReader(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; ContainerSchema& m_schema; }; diff --git a/CondCore/ORA/src/RelationalMapping.cc b/CondCore/ORA/src/RelationalMapping.cc index d49b1e9112e17..1e5a4f2634133 100644 --- a/CondCore/ORA/src/RelationalMapping.cc +++ b/CondCore/ORA/src/RelationalMapping.cc @@ -7,11 +7,12 @@ #include "MappingRules.h" #include "ClassUtils.h" // externals -#include "Reflex/Reflex.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" +#include "FWCore/Utilities/interface/BaseWithDict.h" #include "CoralBase/AttributeSpecification.h" size_t -ora::RelationalMapping::sizeInColumns(const Reflex::Type& topLevelClassType ){ +ora::RelationalMapping::sizeInColumns(const edm::TypeWithDict& topLevelClassType ){ size_t sz=0; bool hasDependencies = false; _sizeInColumns(topLevelClassType, sz, hasDependencies ); @@ -19,7 +20,7 @@ ora::RelationalMapping::sizeInColumns(const Reflex::Type& topLevelClassType ){ } std::pair -ora::RelationalMapping::sizeInColumnsForCArray(const Reflex::Type& topLevelClassType ){ +ora::RelationalMapping::sizeInColumnsForCArray(const edm::TypeWithDict& topLevelClassType ){ size_t sz=0; bool hasDependencies = false; _sizeInColumnsForCArray(topLevelClassType, sz, hasDependencies ); @@ -28,24 +29,24 @@ ora::RelationalMapping::sizeInColumnsForCArray(const Reflex::Type& topLevelClass void -ora::RelationalMapping::_sizeInColumns(const Reflex::Type& topLevelClassType, +ora::RelationalMapping::_sizeInColumns(const edm::TypeWithDict& topLevelClassType, size_t& sz, bool& hasDependencies ){ // resolve possible typedef chains - Reflex::Type typ = ClassUtils::resolvedType( topLevelClassType ); + edm::TypeWithDict typ = ClassUtils::resolvedType( topLevelClassType ); bool isOraPolyPointer = ora::ClassUtils::isTypeUniqueReference(typ); bool isPrimitive = ora::ClassUtils::isTypePrimitive( typ ); // primitive and string if( isPrimitive || isOraPolyPointer || ora::ClassUtils::isTypeNamedReference( typ)) { ++sz; - } else if (typ.IsArray()){ + } else if (typ.isArray()){ size_t arraySize = 0; _sizeInColumnsForCArray( typ,arraySize, hasDependencies ); if( arraySize < MappingRules::MaxColumnsForInlineCArray ) sz += arraySize; else hasDependencies = true; - } else if (typ.TypeInfo() == typeid(ora::Reference) || - typ.HasBase( Reflex::Type::ByTypeInfo( typeid(ora::Reference) ) )){ + } else if (typ == typeid(ora::Reference) || + typ.hasBase( edm::TypeWithDict( typeid(ora::Reference) ) )){ sz += 2; } else { @@ -55,16 +56,17 @@ ora::RelationalMapping::_sizeInColumns(const Reflex::Type& topLevelClassType, if( !isContainer && !isOraPointer ){ // loop over the data members - typ.UpdateMembers(); - //std::vector carrays; - for ( size_t i=0; i< typ.DataMemberSize(); i++){ - Reflex::Member objMember = typ.DataMemberAt(i); + //-ap ignore for now: typ.UpdateMembers(); + //std::vector carrays; + edm::TypeDataMembers members(typ); + for (auto const & member : members) { + edm::MemberWithDict objMember(member); // Skip the transient ones - if ( objMember.IsTransient() ) continue; + if ( objMember.isTransient() ) continue; // Retrieve the field type - Reflex::Type objMemberType = objMember.TypeOf(); + edm::TypeWithDict objMemberType = objMember.typeOf(); _sizeInColumns(objMemberType,sz, hasDependencies ); } @@ -75,17 +77,17 @@ ora::RelationalMapping::_sizeInColumns(const Reflex::Type& topLevelClassType, } void -ora::RelationalMapping::_sizeInColumnsForCArray(const Reflex::Type& topLevelClassType, +ora::RelationalMapping::_sizeInColumnsForCArray(const edm::TypeWithDict& topLevelClassType, size_t& sz, bool& hasDependencies){ // resolve possible typedef chains - Reflex::Type typ = ClassUtils::resolvedType( topLevelClassType ); - if( !typ.IsArray()){ + edm::TypeWithDict typ = ClassUtils::resolvedType( topLevelClassType ); + if( !typ.isArray()){ return; } - size_t arraySize = typ.ArrayLength(); - Reflex::Type arrayType = typ.ToType(); + size_t arraySize = ClassUtils::arrayLength( typ ); + edm::TypeWithDict arrayType = typ.toType(); size_t arrayElementSize = 0; _sizeInColumns(arrayType, arrayElementSize, hasDependencies); size_t totSize = arraySize*arrayElementSize; @@ -100,22 +102,22 @@ ora::RelationalMappingFactory::RelationalMappingFactory( TableRegister& tableReg ora::RelationalMappingFactory::~RelationalMappingFactory(){ } -ora::IRelationalMapping* ora::RelationalMappingFactory::newProcessor( const Reflex::Type& attributeType, +ora::IRelationalMapping* ora::RelationalMappingFactory::newProcessor( const edm::TypeWithDict& attributeType, bool blobStreaming ){ if( blobStreaming ){ return new BlobMapping( attributeType, m_tableRegister ); } - Reflex::Type resType = ClassUtils::resolvedType( attributeType ); + edm::TypeWithDict resType = ClassUtils::resolvedType( attributeType ); if ( ora::ClassUtils::isTypePrimitive(resType) ) { return new PrimitiveMapping( attributeType, m_tableRegister ); } - else if ( resType.IsArray() ){ + else if ( resType.isArray() ){ return new CArrayMapping( attributeType, m_tableRegister ); } else if ( ora::ClassUtils::isTypeContainer( resType ) ) { return new ArrayMapping( attributeType, m_tableRegister ); } - else if ( resType.IsPointer() || resType.IsReference() ){ + else if ( resType.isPointer() || resType.isReference() ){ return new EmptyMapping(); } else if ( ora::ClassUtils::isTypeOraPointer( resType )){ @@ -124,17 +126,18 @@ ora::IRelationalMapping* ora::RelationalMappingFactory::newProcessor( const Refl else if ( ora::ClassUtils::isTypeUniqueReference( resType )){ return new UniqueReferenceMapping( attributeType, m_tableRegister ); } - else if ( resType.TypeInfo() == typeid(ora::Reference) || - resType.HasBase( Reflex::Type::ByTypeInfo( typeid(ora::Reference) ) ) ){ + else if ( resType == typeid(ora::Reference) || + resType.hasBase( edm::TypeWithDict( typeid(ora::Reference) ) ) ){ return new OraReferenceMapping( attributeType, m_tableRegister ); } - else if ( resType.TypeInfo() == typeid(ora::NamedReference) || - resType.HasBase( Reflex::Type::ByTypeInfo( typeid(ora::NamedReference) ) ) ){ + else if ( resType == typeid(ora::NamedReference) || + resType.hasBase( edm::TypeWithDict( typeid(ora::NamedReference) ) ) ){ return new NamedRefMapping( attributeType, m_tableRegister ); } else { // embeddedobject return new ObjectMapping( attributeType, m_tableRegister ); } + return 0; // make the compiler happy -- we should never come here !! } namespace ora { @@ -170,7 +173,7 @@ namespace ora { } } -ora::PrimitiveMapping::PrimitiveMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ): +ora::PrimitiveMapping::PrimitiveMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ): m_type(attributeType),m_tableRegister( tableRegister ){ } @@ -181,9 +184,8 @@ void ora::PrimitiveMapping::process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ){ - Reflex::Type t = ClassUtils::resolvedType( m_type ); - const std::type_info* attrType = &t.TypeInfo(); - if(t.IsEnum()) attrType = &typeid(int); + edm::TypeWithDict t = ClassUtils::resolvedType( m_type ); + const std::type_info* attrType = t.isEnum() ? &typeid(int) : &t.typeInfo(); //std::string tn = ClassUtils::demangledName(*attrType); if(ClassUtils::isTypeString( t )) attrType = &typeid(std::string); std::string typeName = coral::AttributeSpecification::typeNameForId(*attrType); @@ -197,7 +199,7 @@ void ora::PrimitiveMapping::process( MappingElement& parentElement, m_tableRegister); } -ora::BlobMapping::BlobMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ): +ora::BlobMapping::BlobMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ): m_type(attributeType),m_tableRegister( tableRegister ){ } @@ -207,7 +209,7 @@ void ora::BlobMapping::process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ){ - std::string className = m_type.Name(Reflex::SCOPED); + std::string className = m_type.cppName(); processLeafElement(parentElement, ora::MappingElement::blobMappingElementType(), className, @@ -217,7 +219,7 @@ void ora::BlobMapping::process( MappingElement& parentElement, m_tableRegister); } -ora::OraReferenceMapping::OraReferenceMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ): +ora::OraReferenceMapping::OraReferenceMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ): m_type(attributeType),m_tableRegister( tableRegister ){ } @@ -228,7 +230,7 @@ void ora::OraReferenceMapping::process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ){ - std::string className = m_type.Name(Reflex::SCOPED); + std::string className = m_type.cppName(); std::string elementType = ora::MappingElement::OraReferenceMappingElementType(); if(!m_tableRegister.checkTable( parentElement.tableName())){ throwException("Table \""+parentElement.tableName()+"\" has not been allocated.", @@ -251,7 +253,7 @@ void ora::OraReferenceMapping::process( MappingElement& parentElement, me.setColumnNames( cols ); } -ora::UniqueReferenceMapping::UniqueReferenceMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ): +ora::UniqueReferenceMapping::UniqueReferenceMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ): m_type(attributeType),m_tableRegister( tableRegister ){ } @@ -263,7 +265,7 @@ void ora::UniqueReferenceMapping::process( MappingElement& parentElement, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ){ - std::string typeName = m_type.Name(Reflex::SCOPED); + std::string typeName = m_type.cppName(); if(!m_tableRegister.checkTable( parentElement.tableName())){ throwException("Table \""+parentElement.tableName()+"\" has not been allocated.", "UniqueReferenceMapping::process"); @@ -294,7 +296,7 @@ void ora::UniqueReferenceMapping::process( MappingElement& parentElement, me.setColumnNames( cols ); } -ora::OraPtrMapping::OraPtrMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ): +ora::OraPtrMapping::OraPtrMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ): m_type(attributeType), m_tableRegister( tableRegister ){ } @@ -306,19 +308,19 @@ void ora::OraPtrMapping::process( MappingElement& parentElement, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ){ - std::string typeName = m_type.Name(Reflex::SCOPED); + std::string typeName = m_type.cppName(); ora::MappingElement& me = parentElement.appendSubElement( ora::MappingElement::OraPointerMappingElementType(), attributeName, typeName, parentElement.tableName() ); me.setColumnNames( parentElement.columnNames() ); - Reflex::Type ptrType = m_type.TemplateArgumentAt(0); - std::string ptrTypeName = ptrType.Name(); + edm::TypeWithDict ptrType = m_type.templateArgumentAt(0); + std::string ptrTypeName = ptrType.name(); RelationalMappingFactory factory( m_tableRegister ); std::auto_ptr processor( factory.newProcessor( ptrType ) ); processor->process( me, ptrTypeName, attributeNameForSchema, scopeNameForSchema ); } -ora::NamedRefMapping::NamedRefMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ): +ora::NamedRefMapping::NamedRefMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ): m_type( attributeType ), m_tableRegister( tableRegister ){ } @@ -330,7 +332,7 @@ void ora::NamedRefMapping::process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ){ - std::string typeName = m_type.Name(Reflex::SCOPED); + std::string typeName = m_type.cppName(); ora::MappingElement& me = parentElement.appendSubElement( ora::MappingElement::namedReferenceMappingElementType(), attributeName, typeName, parentElement.tableName() ); std::vector< std::string > cols; @@ -348,7 +350,7 @@ void ora::NamedRefMapping::process( MappingElement& parentElement, } -ora::ArrayMapping::ArrayMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ): +ora::ArrayMapping::ArrayMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ): m_type(attributeType), m_tableRegister( tableRegister ){ } @@ -370,7 +372,7 @@ void ora::ArrayMapping::process( MappingElement& parentElement, } m_tableRegister.insertTable(arrayTable); - std::string className = m_type.Name(Reflex::SCOPED); + std::string className = m_type.cppName(); std::string elementType = ora::MappingElement::arrayMappingElementType(); if(ora::ClassUtils::isTypePVector(m_type) || ora::ClassUtils::isTypeQueryableVector(m_type)){ @@ -405,44 +407,46 @@ void ora::ArrayMapping::process( MappingElement& parentElement, bool singleItemContainer = ora::ClassUtils::isTypeNonAssociativeContainer(m_type); bool associativeContainer = ora::ClassUtils::isTypeAssociativeContainer(m_type); - Reflex::Type contentType; - Reflex::Type keyType; + edm::TypeWithDict contentType; + edm::TypeWithDict keyType; + std::string contentTypeName; if( singleItemContainer ){ contentType = ClassUtils::containerValueType(m_type); + contentTypeName = "value_type"; } else if ( associativeContainer ) { // This is an associative container type contentType = ClassUtils::containerDataType( m_type ); + contentTypeName = "mapped_type"; keyType = ClassUtils::containerKeyType( m_type ); if( !keyType || !ClassUtils::resolvedType(keyType) ){ - throwException( "Cannot not resolve the type of the key item of container \""+m_type.Name(Reflex::SCOPED)+"\".", + throwException( "Cannot not resolve the type of the key item of container \""+m_type.cppName()+"\".", "ArrayMapping::process"); } } else { // Not supported container - throwException( "Container type=\""+m_type.Name(Reflex::SCOPED)+"\".is not supported.", + throwException( "Container type=\""+m_type.cppName()+"\".is not supported.", "ArrayMapping::process"); } if( !contentType || !ClassUtils::resolvedType(contentType) ){ - throwException( "Cannot not resolve the type of the content item of container \""+m_type.Name(Reflex::SCOPED)+"\".", + throwException( "Cannot not resolve the type of the content item of container \""+m_type.cppName()+"\".", "ArrayMapping::process"); } RelationalMappingFactory mappingFactory( m_tableRegister ); if ( keyType ) { - std::string keyTypeName = keyType.Name(); + std::string keyTypeName = "key_type"; std::string keyTypeNameForSchema = MappingRules::variableNameForContainerKey(); std::auto_ptr keyProcessor( mappingFactory.newProcessor( keyType ) ); keyProcessor->process( me, keyTypeName, keyTypeNameForSchema, arrayScopeNameForSchema ); } - std::string contentTypeName = contentType.Name(); std::string contentTypeNameForSchema = MappingRules::variableNameForContainerValue(); std::auto_ptr contentProcessor( mappingFactory.newProcessor( contentType ) ); contentProcessor->process( me, contentTypeName, contentTypeNameForSchema, arrayScopeNameForSchema ); } -ora::CArrayMapping::CArrayMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ): +ora::CArrayMapping::CArrayMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ): m_type(attributeType), m_tableRegister( tableRegister ){ } @@ -453,9 +457,9 @@ void ora::CArrayMapping::process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ){ - Reflex::Type arrayElementType = m_type.ToType(); + edm::TypeWithDict arrayElementType = m_type.toType(); if( !arrayElementType || !ClassUtils::resolvedType( arrayElementType ) ){ - throwException("Cannot resolve the type of the content of the array \""+m_type.Name(Reflex::SCOPED)+"\".", + throwException("Cannot resolve the type of the content of the array \""+m_type.cppName()+"\".", "CArrayMapping::process"); } @@ -463,7 +467,7 @@ void ora::CArrayMapping::process( MappingElement& parentElement, throwException("Table \""+parentElement.tableName()+"\" has not been allocated.", "CArrayMapping::process"); } - std::string className = m_type.Name(Reflex::SCOPED); + std::string className = m_type.cppName(); RelationalMappingFactory mappingFactory( m_tableRegister ); std::string arrayScopeNameForSchema = scopeNameForSchema; @@ -471,15 +475,17 @@ void ora::CArrayMapping::process( MappingElement& parentElement, arrayScopeNameForSchema += attributeNameForSchema; std::pair arraySizeInColumns = RelationalMapping::sizeInColumnsForCArray( m_type ); + if( !arraySizeInColumns.first && arraySizeInColumns.second < MappingRules::MaxColumnsForInlineCArray ) { size_t columnsInTable = m_tableRegister.numberOfColumns(parentElement.tableName()) + arraySizeInColumns.second; - if( columnsInTable < MappingRules::MaxColumnsPerTable ){ + if( columnsInTable < MappingRules::MaxColumnsPerTable ){ // Inline C-Array std::string mappingElementType = ora::MappingElement::inlineCArrayMappingElementType(); ora::MappingElement& me = parentElement.appendSubElement( mappingElementType, attributeName, className, parentElement.tableName() ); me.setColumnNames( parentElement.columnNames() ); std::auto_ptr processor( mappingFactory.newProcessor( arrayElementType ) ); - for(size_t i=0;iprocess( me, MappingRules::variableNameForArrayIndex(attributeName,i), MappingRules::variableNameForArrayColumn(i), arrayScopeNameForSchema ); } @@ -517,13 +523,13 @@ void ora::CArrayMapping::process( MappingElement& parentElement, me.setColumnNames( columns ); m_tableRegister.insertColumns(arrayTable, columns ); - std::string contentTypeName = arrayElementType.Name(); + std::string contentTypeName = arrayElementType.name(); std::string variableNameForSchema = MappingRules::variableNameForArrayColumn( m_type ); std::auto_ptr processor( mappingFactory.newProcessor( arrayElementType ) ); processor->process( me, contentTypeName, variableNameForSchema, arrayScopeNameForSchema ); } -ora::ObjectMapping::ObjectMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ): +ora::ObjectMapping::ObjectMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ): m_type(attributeType), m_tableRegister( tableRegister ){ } @@ -532,47 +538,43 @@ ora::ObjectMapping::~ObjectMapping(){ namespace ora { - bool isLoosePersistencyOnWriting( const Reflex::Member& dataMember ){ - std::string persistencyType(""); - Reflex::PropertyList memberProps = dataMember.Properties(); - if( memberProps.HasProperty(ora::MappingRules::persistencyPropertyNameInDictionary())){ - persistencyType = memberProps.PropertyAsString(ora::MappingRules::persistencyPropertyNameInDictionary()); - } - return ora::MappingRules::isLooseOnWriting( persistencyType ); + bool isLoosePersistencyOnWriting( const edm::MemberWithDict& dataMember ){ + return ora::MappingRules::isLooseOnWriting( ClassUtils::getDataMemberProperty(ora::MappingRules::persistencyPropertyNameInDictionary(), dataMember ) ); + } + + bool isMappedToBlob( const edm::MemberWithDict& dataMember ){ + return ora::MappingRules::isMappedToBlob( ClassUtils::getDataMemberProperty( ora::MappingRules::mappingPropertyNameInDictionary(), dataMember ) ); } void processBaseClasses( MappingElement& mappingElement, - const Reflex::Type& objType, + const edm::TypeWithDict& objType, const std::string& scopeNameForSchema, TableRegister& tableRegister ){ - std::string className = objType.Name(Reflex::SCOPED); - for ( size_t i=0; i< objType.BaseSize(); i++){ - Reflex::Base base = objType.BaseAt(i); - Reflex::Type baseType = ClassUtils::resolvedType( base.ToType() ); + std::string className = objType.cppName(); + edm::TypeBases bases(objType); + for (auto const & b : bases) { + edm::BaseWithDict base(b); + edm::TypeWithDict baseType = ClassUtils::resolvedType( base.typeOf().toType() ); if(!baseType){ - throwException( "Class for base \""+base.Name()+"\" is not in the dictionary.","ObjectMapping::process"); + throwException( "Class for base \""+base.name()+"\" is not in the dictionary.","ObjectMapping::process"); } // TO BE FIXED:: here there is still to fix the right scopeName to pass processBaseClasses( mappingElement, baseType, scopeNameForSchema, tableRegister ); - for ( size_t j=0; j< baseType.DataMemberSize(); j++){ - Reflex::Member baseMember = baseType.DataMemberAt(j); + edm::TypeDataMembers members(baseType); + for (auto const & member : members) { + edm::MemberWithDict baseMember(member); // Skip the transient and the static ones - if ( baseMember.IsTransient() || baseMember.IsStatic() || isLoosePersistencyOnWriting( baseMember ) ) continue; + if ( baseMember.isTransient() || baseMember.isStatic() || isLoosePersistencyOnWriting( baseMember ) ) continue; // Retrieve the data member type - Reflex::Type type = ClassUtils::resolvedType( baseMember.TypeOf() ); - Reflex::Type declaringType = ClassUtils::resolvedType( baseMember.DeclaringType()); - std::string scope = declaringType.Name(Reflex::SCOPED); + edm::TypeWithDict type = ClassUtils::resolvedType( baseMember.typeOf() ); + edm::TypeWithDict declaringType = ClassUtils::resolvedType( baseMember.declaringType()); + std::string scope = declaringType.cppName(); // Retrieve the field name - std::string objectMemberName = ora::MappingRules::scopedVariableName( baseMember.Name(), scope ); - std::string objectMemberNameForSchema = ora::MappingRules::scopedVariableForSchemaObjects( baseMember.Name(), scope ); - - std::string mappingType(""); - Reflex::PropertyList memberProps = baseMember.Properties(); - if( memberProps.HasProperty(ora::MappingRules::mappingPropertyNameInDictionary())){ - mappingType = memberProps.PropertyAsString(ora::MappingRules::mappingPropertyNameInDictionary()); - } - bool blobStreaming = ora::MappingRules::isMappedToBlob( mappingType ); + std::string objectMemberName = ora::MappingRules::scopedVariableName( baseMember.name(), scope ); + std::string objectMemberNameForSchema = ora::MappingRules::scopedVariableForSchemaObjects( baseMember.name(), scope ); + + bool blobStreaming = isMappedToBlob( baseMember ); RelationalMappingFactory mappingFactory( tableRegister ); std::auto_ptr processor( mappingFactory.newProcessor( type, blobStreaming ) ); @@ -586,13 +588,13 @@ void ora::ObjectMapping::process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ){ - std::string className = m_type.Name(Reflex::SCOPED); + std::string className = m_type.cppName(); std::string elementType = ora::MappingElement::objectMappingElementType(); ora::MappingElement& me = parentElement.appendSubElement( elementType, attributeName, className, parentElement.tableName() ); me.setColumnNames( parentElement.columnNames() ); // resolve possible typedef chains - Reflex::Type objectType = ClassUtils::resolvedType(m_type); + edm::TypeWithDict objectType = ClassUtils::resolvedType(m_type); // process base class data members processBaseClasses( me, m_type, scopeNameForSchema, m_tableRegister ); RelationalMappingFactory mappingFactory( m_tableRegister ); @@ -602,36 +604,31 @@ void ora::ObjectMapping::process( MappingElement& parentElement, objectScopeNameForSchema += attributeNameForSchema; // loop over the data members - for ( size_t i=0; i< objectType.DataMemberSize(); i++){ - - Reflex::Member objectMember = m_type.DataMemberAt(i); + edm::TypeDataMembers members(objectType); + for (auto const & member : members) { + edm::MemberWithDict objectMember(member); // Skip the transient and the static ones - if ( objectMember.IsTransient() || objectMember.IsStatic() || isLoosePersistencyOnWriting( objectMember )) continue; + if ( objectMember.isTransient() || objectMember.isStatic() || isLoosePersistencyOnWriting( objectMember )) continue; // Retrieve the field type - Reflex::Type type = ClassUtils::resolvedType( objectMember.TypeOf() ); + edm::TypeWithDict type = ClassUtils::resolvedType( objectMember.typeOf() ); // Check for the existence of the dictionary information if ( !type ){ - throwException( "Type for data member \""+objectMember.Name()+"\" of class \""+className+ + throwException( "Type for data member \""+objectMember.name()+"\" of class \""+className+ "\" has not been found in the dictionary.", "ObjectMapping::process"); } // check if the member is from a class in the inheritance tree - Reflex::Type declaringType = ClassUtils::resolvedType( objectMember.DeclaringType()); + edm::TypeWithDict declaringType = ClassUtils::resolvedType( objectMember.declaringType()); if( declaringType != objectType ){ continue; } // Retrieve the field name - std::string objectMemberName = objectMember.Name(); - std::string objectNameForSchema = objectMember.Name(); + std::string objectMemberName = objectMember.name(); + std::string objectNameForSchema = objectMember.name(); - std::string mappingType(""); - Reflex::PropertyList memberProps = objectMember.Properties(); - if( memberProps.HasProperty(ora::MappingRules::mappingPropertyNameInDictionary())){ - mappingType = memberProps.PropertyAsString(ora::MappingRules::mappingPropertyNameInDictionary()); - } - bool blobStreaming = ora::MappingRules::isMappedToBlob( mappingType ); + bool blobStreaming = isMappedToBlob( objectMember ); std::auto_ptr processor( mappingFactory.newProcessor( type, blobStreaming ) ); processor->process( me, objectMemberName, objectNameForSchema, objectScopeNameForSchema ); diff --git a/CondCore/ORA/src/RelationalMapping.h b/CondCore/ORA/src/RelationalMapping.h index c8e56fa089d9e..037749d1bfa64 100644 --- a/CondCore/ORA/src/RelationalMapping.h +++ b/CondCore/ORA/src/RelationalMapping.h @@ -5,19 +5,19 @@ #include #include // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" -namespace Reflex { - class Type; +namespace edm { + class TypeWithDict; } namespace ora { namespace RelationalMapping { - size_t sizeInColumns(const Reflex::Type& topLevelClassType ); - std::pair sizeInColumnsForCArray( const Reflex::Type& arrayType ); - void _sizeInColumns(const Reflex::Type& typ, size_t& sz, bool& hasDependencies ); - void _sizeInColumnsForCArray(const Reflex::Type& typ, size_t& sz, bool& hasDependencies ); + size_t sizeInColumns(const edm::TypeWithDict& topLevelClassType ); + std::pair sizeInColumnsForCArray( const edm::TypeWithDict& arrayType ); + void _sizeInColumns(const edm::TypeWithDict& typ, size_t& sz, bool& hasDependencies ); + void _sizeInColumnsForCArray(const edm::TypeWithDict& typ, size_t& sz, bool& hasDependencies ); } class MappingElement; @@ -38,7 +38,7 @@ namespace ora { virtual ~RelationalMappingFactory(); public: - IRelationalMapping* newProcessor( const Reflex::Type& attributeType, bool blobStreaming=false ); + IRelationalMapping* newProcessor( const edm::TypeWithDict& attributeType, bool blobStreaming=false ); private: TableRegister& m_tableRegister; @@ -46,124 +46,124 @@ namespace ora { class PrimitiveMapping : public IRelationalMapping { public: - PrimitiveMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ); + PrimitiveMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ); ~PrimitiveMapping(); void process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ); private: - Reflex::Type m_type; + edm::TypeWithDict m_type; TableRegister& m_tableRegister; }; class BlobMapping : public IRelationalMapping { public: - BlobMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ); + BlobMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ); ~BlobMapping(); void process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ); private: - Reflex::Type m_type; + edm::TypeWithDict m_type; TableRegister& m_tableRegister; }; class OraReferenceMapping : public IRelationalMapping { public: - OraReferenceMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ); + OraReferenceMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ); ~OraReferenceMapping(); void process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ); private: - Reflex::Type m_type; + edm::TypeWithDict m_type; TableRegister& m_tableRegister; }; class UniqueReferenceMapping : public IRelationalMapping { public: - UniqueReferenceMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ); + UniqueReferenceMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ); ~UniqueReferenceMapping(); void process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ); private: - Reflex::Type m_type; + edm::TypeWithDict m_type; TableRegister& m_tableRegister; }; class OraPtrMapping : public IRelationalMapping { public: - OraPtrMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ); + OraPtrMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ); ~OraPtrMapping(); void process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ); private: - Reflex::Type m_type; + edm::TypeWithDict m_type; TableRegister& m_tableRegister; }; class NamedRefMapping: public IRelationalMapping { public: - NamedRefMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ); + NamedRefMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ); ~NamedRefMapping(); void process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ); private: - Reflex::Type m_type; + edm::TypeWithDict m_type; TableRegister& m_tableRegister; }; class ArrayMapping : public IRelationalMapping { public: - ArrayMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ); + ArrayMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ); ~ArrayMapping(); void process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ); private: - Reflex::Type m_type; + edm::TypeWithDict m_type; TableRegister& m_tableRegister; }; class CArrayMapping : public IRelationalMapping { public: - CArrayMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ); + CArrayMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ); ~CArrayMapping(); void process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ); private: - Reflex::Type m_type; + edm::TypeWithDict m_type; TableRegister& m_tableRegister; }; class ObjectMapping : public IRelationalMapping { public: - ObjectMapping( const Reflex::Type& attributeType, TableRegister& tableRegister ); + ObjectMapping( const edm::TypeWithDict& attributeType, TableRegister& tableRegister ); ~ObjectMapping(); void process( MappingElement& parentElement, const std::string& attributeName, const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ); private: - Reflex::Type m_type; + edm::TypeWithDict m_type; TableRegister& m_tableRegister; }; diff --git a/CondCore/ORA/src/RelationalStreamerFactory.cc b/CondCore/ORA/src/RelationalStreamerFactory.cc index cf0a2fa5b2f65..93b9b7a4bee2f 100644 --- a/CondCore/ORA/src/RelationalStreamerFactory.cc +++ b/CondCore/ORA/src/RelationalStreamerFactory.cc @@ -24,13 +24,13 @@ ora::RelationalStreamerFactory::RelationalStreamerFactory( ContainerSchema& cont ora::RelationalStreamerFactory::~RelationalStreamerFactory(){ } -ora::IRelationalStreamer* ora::RelationalStreamerFactory::newStreamer( const Reflex::Type& type, +ora::IRelationalStreamer* ora::RelationalStreamerFactory::newStreamer( const edm::TypeWithDict& type, MappingElement& mapping ){ IRelationalStreamer* newStreamer = 0; if ( mapping.elementType() == MappingElement::Primitive ) { // Primitives if( ! ClassUtils::isTypePrimitive( type ) ){ throwException( "Mapped variable \"" + mapping.variableName() + - "\", declared as Primitive, is associated to non-primitive type \""+type.Name()+"\"", + "\", declared as Primitive, is associated to non-primitive type \""+type.name()+"\"", "RelationalStreamerFactory::newStreamer" ); } newStreamer = new PrimitiveStreamer( type, mapping ); @@ -43,25 +43,25 @@ ora::IRelationalStreamer* ora::RelationalStreamerFactory::newStreamer( const Ref throwException( "Mapped variable \"" + mapping.variableName() +" of type "+ mapping.variableType() + "\", declared as Array, is associated to the non-container type \""+ - type.Name()+"\".", + type.name()+"\".", "RelationalStreamerFactory::newStreamer" ); } newStreamer = new STLContainerStreamer( type, mapping, m_containerSchema ); } else if ( mapping.elementType() == MappingElement::CArray ) { - if ( ! type.IsArray() ) { + if ( ! type.isArray() ) { throwException( "Mapped variable \"" + mapping.variableName() +" of type "+ mapping.variableType() + "\", declared as C-Array, is associated to the non-array type \""+ - type.Name()+"\".", + type.name()+"\".", "RelationalStreamerFactory::newStreamer" ); } newStreamer = new CArrayStreamer( type, mapping, m_containerSchema ); } else if ( mapping.elementType() == MappingElement::InlineCArray ) { - if ( ! type.IsArray() ) { + if ( ! type.isArray() ) { throwException( "Mapped variable \"" + mapping.variableName() +" of type "+ mapping.variableType() + "\", declared as Inline C-Array, is associated to the non-array type \""+ - type.Name()+"\".", + type.name()+"\".", "RelationalStreamerFactory::newStreamer" ); } newStreamer = new InlineCArrayStreamer( type, mapping, m_containerSchema ); @@ -70,7 +70,7 @@ ora::IRelationalStreamer* ora::RelationalStreamerFactory::newStreamer( const Ref throwException( "Mapped variable \"" + mapping.variableName() +" of type "+ mapping.variableType() + "\", declared as OraArray, is associated to the non-array type \""+ - type.Name()+"\".", + type.name()+"\".", "RelationalStreamerFactory::newStreamer" ); } if( ClassUtils::isTypePVector( type ) ) @@ -82,7 +82,7 @@ ora::IRelationalStreamer* ora::RelationalStreamerFactory::newStreamer( const Ref throwException( "Mapped variable \"" + mapping.variableName() +" of type "+ mapping.variableType() + "\", declared as a OraPointer, is associated to the type \""+ - type.Name()+"\".", + type.name()+"\".", "RelationalStreamerFactory::newStreamer" ); } newStreamer = new OraPtrStreamer( type, mapping, m_containerSchema ); @@ -91,7 +91,7 @@ ora::IRelationalStreamer* ora::RelationalStreamerFactory::newStreamer( const Ref throwException( "Mapped variable \"" + mapping.variableName() +" of type "+ mapping.variableType() + "\", declared as a OraReference, is associated to the type \""+ - type.Name()+"\".", + type.name()+"\".", "RelationalStreamerFactory::newStreamer" ); } newStreamer = new OraReferenceStreamer( type, mapping, m_containerSchema ); @@ -100,7 +100,7 @@ ora::IRelationalStreamer* ora::RelationalStreamerFactory::newStreamer( const Ref throwException( "Mapped variable \"" + mapping.variableName() +" of type "+ mapping.variableType() + "\", declared as a NamedReference, is associated to the type \""+ - type.Name()+"\".", + type.name()+"\".", "RelationalStreamerFactory::newStreamer" ); } newStreamer = new NamedRefStreamer( type, mapping, m_containerSchema ); @@ -109,7 +109,7 @@ ora::IRelationalStreamer* ora::RelationalStreamerFactory::newStreamer( const Ref throwException( "Mapped variable \"" + mapping.variableName() +" of type "+ mapping.variableType() + "\", declared as a UniqueReference, is associated to the type \""+ - type.Name()+"\".", + type.name()+"\".", "RelationalStreamerFactory::newStreamer" ); } newStreamer = new UniqueRefStreamer( type, mapping, m_containerSchema ); @@ -125,19 +125,19 @@ ora::IRelationalStreamer* ora::RelationalStreamerFactory::newStreamer( const Ref -ora::IRelationalWriter* ora::RelationalStreamerFactory::newWriter(const Reflex::Type& type, +ora::IRelationalWriter* ora::RelationalStreamerFactory::newWriter(const edm::TypeWithDict& type, MappingElement& mapping ){ std::auto_ptr streamer( newStreamer( type, mapping ) ); return streamer->newWriter(); } -ora::IRelationalUpdater* ora::RelationalStreamerFactory::newUpdater(const Reflex::Type& type, +ora::IRelationalUpdater* ora::RelationalStreamerFactory::newUpdater(const edm::TypeWithDict& type, MappingElement& mapping ){ std::auto_ptr streamer( newStreamer( type, mapping ) ); return streamer->newUpdater(); } -ora::IRelationalReader* ora::RelationalStreamerFactory::newReader(const Reflex::Type& type, +ora::IRelationalReader* ora::RelationalStreamerFactory::newReader(const edm::TypeWithDict& type, MappingElement& mapping ){ std::auto_ptr streamer( newStreamer( type, mapping ) ); return streamer->newReader(); diff --git a/CondCore/ORA/src/RelationalStreamerFactory.h b/CondCore/ORA/src/RelationalStreamerFactory.h index f95fff939bc03..cc26ffd79beae 100644 --- a/CondCore/ORA/src/RelationalStreamerFactory.h +++ b/CondCore/ORA/src/RelationalStreamerFactory.h @@ -1,8 +1,8 @@ #ifndef INCLUDE_ORA_RELATIONALSTREAMERFACTORY_H #define INCLUDE_ORA_RELATIONALSTREAMERFACTORY_H -namespace Reflex { - class Type; +namespace edm { + class TypeWithDict; } namespace ora { @@ -22,15 +22,15 @@ namespace ora { ~RelationalStreamerFactory(); - IRelationalWriter* newWriter(const Reflex::Type& dataType,MappingElement& dataMapping ); + IRelationalWriter* newWriter(const edm::TypeWithDict& dataType,MappingElement& dataMapping ); - IRelationalUpdater* newUpdater(const Reflex::Type& dataType,MappingElement& dataMapping ); + IRelationalUpdater* newUpdater(const edm::TypeWithDict& dataType,MappingElement& dataMapping ); - IRelationalReader* newReader(const Reflex::Type& dataType,MappingElement& dataMapping ); + IRelationalReader* newReader(const edm::TypeWithDict& dataType,MappingElement& dataMapping ); private: - IRelationalStreamer* newStreamer( const Reflex::Type& dataType,MappingElement& dataMapping ); + IRelationalStreamer* newStreamer( const edm::TypeWithDict& dataType,MappingElement& dataMapping ); private: ContainerSchema& m_containerSchema; diff --git a/CondCore/ORA/src/STLContainerHandler.cc b/CondCore/ORA/src/STLContainerHandler.cc index 7496e5044d903..d580cb8dc356b 100644 --- a/CondCore/ORA/src/STLContainerHandler.cc +++ b/CondCore/ORA/src/STLContainerHandler.cc @@ -1,175 +1,167 @@ -#include "CondCore/ORA/interface/Exception.h" -#include "STLContainerHandler.h" -#include "ClassUtils.h" -// externals -#include "RVersion.h" - -ora::STLContainerIteratorHandler::STLContainerIteratorHandler( const Reflex::Environ& collEnv, - Reflex::CollFuncTable& collProxy, - const Reflex::Type& iteratorReturnType ): - m_returnType(iteratorReturnType), - m_collEnv(collEnv), - m_collProxy(collProxy), - m_currentElement(0){ - - // retrieve the first element - m_currentElement = m_collProxy.first_func(&m_collEnv); -} - -ora::STLContainerIteratorHandler::~STLContainerIteratorHandler(){} - -void -ora::STLContainerIteratorHandler::increment(){ - // this is required! It sets the number of memory slots (of size sizeof(Class)) to be used for the step - m_collEnv.fIdx = 1; - m_currentElement = m_collProxy.next_func(&m_collEnv); -} - -void* -ora::STLContainerIteratorHandler::object() -{ - return m_currentElement; -} - - -Reflex::Type& -ora::STLContainerIteratorHandler::returnType() -{ - return m_returnType; -} - -ora::STLContainerHandler::STLContainerHandler( const Reflex::Type& dictionary ): - m_type( dictionary ), - m_iteratorReturnType(), - m_isAssociative( false ), - m_collEnv(), - m_collProxy(){ - m_isAssociative = ClassUtils::isTypeKeyedContainer( m_type ); - - Reflex::Member method = m_type.MemberByName("createCollFuncTable"); - if(method){ - Reflex::CollFuncTable* collProxyPtr; - method.Invoke( collProxyPtr ); - m_collProxy.reset( collProxyPtr ); - } - if( !m_collProxy.get() ){ - throwException( "Cannot find \"createCollFuncTable\" function for type \""+m_type.Name(Reflex::SCOPED)+"\"", - "STLContainerHandler::STLContainerHandler"); - } - - // find the iterator return type as the member type_value of the containers - Reflex::Type valueType = ClassUtils::containerValueType( m_type ); - m_iteratorReturnType = ClassUtils::resolvedType( valueType ); - -} - -ora::STLContainerHandler::~STLContainerHandler(){ -} - -size_t -ora::STLContainerHandler::size( const void* address ){ - m_collEnv.fObject = const_cast(address); - return *(static_cast(m_collProxy->size_func(&m_collEnv))); -} - - -ora::IArrayIteratorHandler* -ora::STLContainerHandler::iterate( const void* address ){ - if ( ! m_iteratorReturnType ) { - throwException( "Missing the dictionary information for the value_type member of the container \"" + - m_type.Name(Reflex::SCOPED|Reflex::FINAL) + "\"", - "STLContainerHandler::iterate" ); - } - m_collEnv.fObject = const_cast(address); - return new STLContainerIteratorHandler( m_collEnv,*m_collProxy,m_iteratorReturnType ); -} - - -void -ora::STLContainerHandler::appendNewElement( void* address, void* data ){ -#if ROOT_VERSION_CODE < ROOT_VERSION(5,28,0) - m_collEnv.fObject = address; - m_collEnv.fSize = 1; - m_collEnv.fStart = data; - m_collProxy->feed_func(&m_collEnv); -#else - m_collProxy->feed_func(data,address,1); -#endif -} - -void -ora::STLContainerHandler::clear( const void* address ){ - m_collEnv.fObject = const_cast(address); - m_collProxy->clear_func(&m_collEnv); -} - -Reflex::Type& -ora::STLContainerHandler::iteratorReturnType(){ - return m_iteratorReturnType; -} - -ora::SpecialSTLContainerHandler::SpecialSTLContainerHandler( const Reflex::Type& dictionary ): - m_containerHandler(), - m_containerOffset( 0 ) -{ - // update dictionary to include base classes members - dictionary.UpdateMembers(); - for ( unsigned int i=0;isize( static_cast< const char* >( address ) + m_containerOffset ); -} - - -ora::IArrayIteratorHandler* -ora::SpecialSTLContainerHandler::iterate( const void* address ) -{ - return m_containerHandler->iterate( static_cast< const char* >( address ) + m_containerOffset ); -} - - -void -ora::SpecialSTLContainerHandler::appendNewElement( void* address, void* data ) -{ - m_containerHandler->appendNewElement( static_cast< char* >( address ) + m_containerOffset, data ); -} - -void -ora::SpecialSTLContainerHandler::clear( const void* address ) -{ - m_containerHandler->clear( static_cast< const char* >( address ) + m_containerOffset ); -} - -Reflex::Type& -ora::SpecialSTLContainerHandler::iteratorReturnType() -{ - return m_containerHandler->iteratorReturnType(); -} +#include "CondCore/ORA/interface/Exception.h" + +#include "ClassUtils.h" +#include "STLContainerHandler.h" +// externals +#include "RVersion.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" + +ora::STLContainerIteratorHandler::STLContainerIteratorHandler( void* address, + TVirtualCollectionProxy& collProxy, + const edm::TypeWithDict& iteratorReturnType ): + m_returnType(iteratorReturnType), + m_collProxy(collProxy), + m_currentElement(nullptr), + m_Iterators(TGenericCollectionIterator::New(address, &collProxy)) +{ + m_currentElement = m_Iterators->Next(); +} + +ora::STLContainerIteratorHandler::~STLContainerIteratorHandler(){} + +void +ora::STLContainerIteratorHandler::increment(){ + m_currentElement = m_Iterators->Next(); +} + +void* +ora::STLContainerIteratorHandler::object() +{ + return m_currentElement; +} + + +edm::TypeWithDict& +ora::STLContainerIteratorHandler::returnType() +{ + return m_returnType; +} + +ora::STLContainerHandler::STLContainerHandler( const edm::TypeWithDict& dictionary ): + m_type( dictionary ), + m_iteratorReturnType(), + m_isAssociative( false ), + m_collProxy(){ + m_isAssociative = ClassUtils::isTypeKeyedContainer( m_type ); + + TClass* cl = dictionary.getClass(); + m_collProxy = cl->GetCollectionProxy(); + if( !m_collProxy ){ + throwException( "Cannot create \"TVirtualCollectionProxy\" for type \""+m_type.cppName()+"\"", + "STLContainerHandler::STLContainerHandler"); + } + + // find the iterator return type as the member type_value of the containers + edm::TypeWithDict valueType = ClassUtils::containerValueType( m_type ); + m_iteratorReturnType = ClassUtils::resolvedType( valueType ); + +} + +ora::STLContainerHandler::~STLContainerHandler(){ +} + +size_t +ora::STLContainerHandler::size( const void* address ){ + //m_collEnv.fObject = const_cast(address); + //return *(static_cast(m_collProxy->size_func(&m_collEnv))); + TVirtualCollectionProxy::TPushPop helper(m_collProxy, const_cast(address)); + return m_collProxy->Size(); +} + + +ora::IArrayIteratorHandler* +ora::STLContainerHandler::iterate( const void* address ){ + if ( ! m_iteratorReturnType ) { + throwException( "Missing the dictionary information for the value_type member of the container \"" + + m_type.cppName() + "\"", + "STLContainerHandler::iterate" ); + } + void *addr = const_cast(address); + return new STLContainerIteratorHandler( addr,*m_collProxy,m_iteratorReturnType ); +} + + +void +ora::STLContainerHandler::appendNewElement( void* address, void* data ){ + // m_collProxy->feed_func(data,address,1); + m_collProxy->Insert(data, address, 1); +} + +void +ora::STLContainerHandler::clear( const void* address ){ + //m_collEnv.fObject = const_cast(address); + //m_collProxy->clear_func(&m_collEnv); + TVirtualCollectionProxy::TPushPop helper(m_collProxy, const_cast(address)); + return m_collProxy->Clear(); +} + +edm::TypeWithDict& +ora::STLContainerHandler::iteratorReturnType(){ + return m_iteratorReturnType; +} + +ora::SpecialSTLContainerHandler::SpecialSTLContainerHandler( const edm::TypeWithDict& dictionary ): + m_containerHandler(), + m_containerOffset( 0 ) +{ + // update dictionary to include base classes members + //-ap ignore for now: dictionary.UpdateMembers(); + edm::TypeDataMembers members(dictionary); + for (auto const & member : members) { + edm::MemberWithDict field(member); + edm::TypeWithDict fieldType = field.typeOf(); + if ( ! fieldType ) { + throwException( "The dictionary of the underlying container of \"" + + dictionary.cppName() + "\" is not available", + "SpecialSTLContainerHandler" ); + } + if ( ClassUtils::isTypeContainer(fieldType) ) { + m_containerHandler.reset( new STLContainerHandler( fieldType ) ); + m_containerOffset = field.offset(); + break; + } + } + if ( !m_containerHandler.get() ) { + throwException( "Could not retrieve the underlying container of \"" + + dictionary.cppName() + "\" is not available", + "SpecialSTLContainerHandler" ); + } +} + + +ora::SpecialSTLContainerHandler::~SpecialSTLContainerHandler() +{ +} + + +size_t +ora::SpecialSTLContainerHandler::size( const void* address ) +{ + return m_containerHandler->size( static_cast< const char* >( address ) + m_containerOffset ); +} + + +ora::IArrayIteratorHandler* +ora::SpecialSTLContainerHandler::iterate( const void* address ) +{ + return m_containerHandler->iterate( static_cast< const char* >( address ) + m_containerOffset ); +} + + +void +ora::SpecialSTLContainerHandler::appendNewElement( void* address, void* data ) +{ + m_containerHandler->appendNewElement( static_cast< char* >( address ) + m_containerOffset, data ); +} + +void +ora::SpecialSTLContainerHandler::clear( const void* address ) +{ + m_containerHandler->clear( static_cast< const char* >( address ) + m_containerOffset ); +} + +edm::TypeWithDict& +ora::SpecialSTLContainerHandler::iteratorReturnType() +{ + return m_containerHandler->iteratorReturnType(); +} diff --git a/CondCore/ORA/src/STLContainerHandler.h b/CondCore/ORA/src/STLContainerHandler.h index 02a14e55dd6fb..3ab077ed75c8b 100644 --- a/CondCore/ORA/src/STLContainerHandler.h +++ b/CondCore/ORA/src/STLContainerHandler.h @@ -1,129 +1,130 @@ -#ifndef INCLUDE_ORA_STLCONTAINERHANDLER_H -#define INCLUDE_ORA_STLCONTAINERHANDLER_H - -#include "IArrayHandler.h" -// -#include -// externals -#include "Reflex/Reflex.h" -#include "Reflex/Builder/CollectionProxy.h" - -namespace ora { - - class STLContainerIteratorHandler : virtual public IArrayIteratorHandler { - public: - /// Constructor - STLContainerIteratorHandler( const Reflex::Environ& collEnv, - Reflex::CollFuncTable& collProxy, - const Reflex::Type& iteratorReturnType ); - - /// Destructor - ~STLContainerIteratorHandler(); - - /// Increments itself - void increment(); - - /// Returns the current object - void* object(); - - /// Returns the return type of the iterator dereference method - Reflex::Type& returnType(); - - private: - - /// The return type of the iterator dereference method - Reflex::Type m_returnType; - - /// Structure containing parameters of the collection instance - Reflex::Environ m_collEnv; - - /// Proxy of the generic collection - Reflex::CollFuncTable& m_collProxy; - - /// Current element object pointer - void* m_currentElement; - }; - - - class STLContainerHandler : virtual public IArrayHandler { - - public: - /// Constructor - explicit STLContainerHandler( const Reflex::Type& dictionary ); - - /// Destructor - ~STLContainerHandler(); - - /// Returns the size of the container - size_t size( const void* address ); - - /// Returns an initialized iterator - IArrayIteratorHandler* iterate( const void* address ); - - /// Appends a new element and returns its address of the object reference - void appendNewElement( void* address, void* data ); - - /// Clear the content of the container - void clear( const void* address ); - - /// Returns the iterator return type - Reflex::Type& iteratorReturnType(); - - /// Returns the associativeness of the container - bool isAssociative() const { return m_isAssociative; } - - private: - /// The dictionary information - Reflex::Type m_type; - - /// The iterator return type - Reflex::Type m_iteratorReturnType; - - /// Flag indicating whether the container is associative - bool m_isAssociative; - - /// Structure containing parameters of the collection instance - Reflex::Environ m_collEnv; - - /// Proxy of the generic collection - std::auto_ptr m_collProxy; - - }; - - - class SpecialSTLContainerHandler : virtual public IArrayHandler { - - public: - /// Constructor - explicit SpecialSTLContainerHandler( const Reflex::Type& dictionary ); - - /// Destructor - ~SpecialSTLContainerHandler(); - - /// Returns the size of the container - size_t size( const void* address ); - - /// Returns an initialized iterator - IArrayIteratorHandler* iterate( const void* address ); - - /// Appends a new element and returns its address of the object reference - void appendNewElement( void* address, void* data ); - - /// Clear the content of the container - void clear( const void* address ); - - /// Returns the iterator return type - Reflex::Type& iteratorReturnType(); - - private: - /// The handler of the unserlying container - std::auto_ptr m_containerHandler; - - /// The offset of the underlying container - int m_containerOffset; - }; - - -} - -#endif +#ifndef INCLUDE_ORA_STLCONTAINERHANDLER_H +#define INCLUDE_ORA_STLCONTAINERHANDLER_H + +#include "IArrayHandler.h" +// +#include +// externals +#include "FWCore/Utilities/interface/TypeWithDict.h" +#include "FWCore/Utilities/interface/FunctionWithDict.h" + +#include "TVirtualCollectionIterators.h" +#include "TVirtualCollectionProxy.h" + +namespace ora { + + class STLContainerIteratorHandler : virtual public IArrayIteratorHandler { + public: + /// Constructor + STLContainerIteratorHandler( void* address, + TVirtualCollectionProxy& collProxy, + const edm::TypeWithDict& iteratorReturnType ); + + /// Destructor + ~STLContainerIteratorHandler(); + + /// Increments itself + void increment(); + + /// Returns the current object + void* object(); + + /// Returns the return type of the iterator dereference method + edm::TypeWithDict& returnType(); + + private: + + /// The return type of the iterator dereference method + edm::TypeWithDict m_returnType; + + /// Proxy of the generic collection + TVirtualCollectionProxy& m_collProxy; + + /// Current element object pointer + void* m_currentElement; + + // holds the iterator when the branch is of fType==4. + TGenericCollectionIterator *m_Iterators; + + }; + + + class STLContainerHandler : virtual public IArrayHandler { + + public: + /// Constructor + explicit STLContainerHandler( const edm::TypeWithDict& dictionary ); + + /// Destructor + ~STLContainerHandler(); + + /// Returns the size of the container + size_t size( const void* address ); + + /// Returns an initialized iterator + IArrayIteratorHandler* iterate( const void* address ); + + /// Appends a new element and returns its address of the object reference + void appendNewElement( void* address, void* data ); + + /// Clear the content of the container + void clear( const void* address ); + + /// Returns the iterator return type + edm::TypeWithDict& iteratorReturnType(); + + /// Returns the associativeness of the container + bool isAssociative() const { return m_isAssociative; } + + private: + /// The dictionary information + edm::TypeWithDict m_type; + + /// The iterator return type + edm::TypeWithDict m_iteratorReturnType; + + /// Flag indicating whether the container is associative + bool m_isAssociative; + + /// Proxy of the generic collection + TVirtualCollectionProxy* m_collProxy; + + }; + + + class SpecialSTLContainerHandler : virtual public IArrayHandler { + + public: + /// Constructor + explicit SpecialSTLContainerHandler( const edm::TypeWithDict& dictionary ); + + /// Destructor + ~SpecialSTLContainerHandler(); + + /// Returns the size of the container + size_t size( const void* address ); + + /// Returns an initialized iterator + IArrayIteratorHandler* iterate( const void* address ); + + /// Appends a new element and returns its address of the object reference + void appendNewElement( void* address, void* data ); + + /// Clear the content of the container + void clear( const void* address ); + + /// Returns the iterator return type + edm::TypeWithDict& iteratorReturnType(); + + private: + /// The handler of the unserlying container + std::auto_ptr m_containerHandler; + + /// The offset of the underlying container + int m_containerOffset; + }; + + +} + +#endif diff --git a/CondCore/ORA/src/STLContainerStreamer.cc b/CondCore/ORA/src/STLContainerStreamer.cc index 615aceab7cf65..129b308427626 100644 --- a/CondCore/ORA/src/STLContainerStreamer.cc +++ b/CondCore/ORA/src/STLContainerStreamer.cc @@ -1,451 +1,461 @@ -#include "CondCore/ORA/interface/Exception.h" -#include "STLContainerStreamer.h" -#include "ClassUtils.h" -#include "MappingElement.h" -#include "DataElement.h" -#include "ContainerSchema.h" -#include "RelationalBuffer.h" -#include "MultiRecordInsertOperation.h" -#include "MultiRecordSelectOperation.h" -#include "RelationalStreamerFactory.h" -#include "ArrayHandlerFactory.h" -#include "IArrayHandler.h" -#include "ArrayCommonImpl.h" -// externals -#include "CoralBase/Attribute.h" -#include "RelationalAccess/IBulkOperation.h" -#include "Reflex/Member.h" - -ora::STLContainerWriter::STLContainerWriter( const Reflex::Type& objectType, - MappingElement& mapping, - ContainerSchema& contSchema ): - m_objectType( objectType ), - m_mappingElement( mapping ), - m_schema( contSchema ), - m_recordId(), - m_localElement(), - m_associative( ClassUtils::isTypeAssociativeContainer( objectType ) ), - m_offset( 0 ), - m_insertOperation( 0 ), - m_arrayHandler(), - m_keyWriter(), - m_dataWriter(){ -} - -ora::STLContainerWriter::~STLContainerWriter(){ -} - -bool ora::STLContainerWriter::build( DataElement& offset, - IRelationalData&, - RelationalBuffer& operationBuffer ){ - if( !m_objectType ){ - throwException( "Missing dictionary information for the type of the container \"" + - m_objectType.Name(Reflex::SCOPED|Reflex::FINAL) + "\"", - "STLContainerWriter::build" ); - } - m_localElement.clear(); - m_recordId.clear(); - // allocate for the index... - m_recordId.push_back(0); - - RelationalStreamerFactory streamerFactory( m_schema ); - - // first open the insert on the extra table... - m_insertOperation = &operationBuffer.newMultiRecordInsert( m_mappingElement.tableName() ); - const std::vector& columns = m_mappingElement.columnNames(); - if( !columns.size() ){ - throwException( "Id columns not found in the mapping.", - "STLContainerWriter::build"); - } - for( size_t i=0; iaddId( columns[ i ] ); - } - - m_offset = &offset; - - m_arrayHandler.reset( ArrayHandlerFactory::newArrayHandler( m_objectType ) ); - - Reflex::Type valueType; - if ( m_associative ){ - - Reflex::Type keyType = ClassUtils::containerKeyType(m_objectType); - Reflex::Type keyResolvedType = ClassUtils::resolvedType(keyType); - if ( ! keyType || !keyResolvedType ) { - throwException( "Missing dictionary information for the key type of the container \"" + - m_objectType.Name(Reflex::SCOPED) + "\"", - "STLContainerWriter::build" ); - } - std::string keyName = keyType.Name(); - // Retrieve the relevant mapping element - MappingElement::iterator iMe = m_mappingElement.find( keyName ); - if ( iMe == m_mappingElement.end() ) { - throwException( "Item for \"" + keyName + "\" not found in the mapping element", - "STLContainerWriter::build" ); - } - - m_keyWriter.reset( streamerFactory.newWriter( keyResolvedType, iMe->second ) ); - m_keyWriter->build( m_localElement, *m_insertOperation, operationBuffer ); - valueType = ClassUtils::containerDataType(m_objectType); - } else { - valueType = ClassUtils::containerValueType(m_objectType); - } - - Reflex::Type valueResolvedType = ClassUtils::resolvedType(valueType); - // Check the component type - if ( ! valueType || !valueResolvedType ) { - throwException( "Missing dictionary information for the content type of the container \"" + - m_objectType.Name(Reflex::SCOPED) + "\"", - "STLContainerWriter::build" ); - } - - std::string valueName = valueType.Name(); - // Retrieve the relevant mapping element - MappingElement::iterator iMe = m_mappingElement.find( valueName ); - if ( iMe == m_mappingElement.end() ) { - throwException( "Item for \"" + valueName + "\" not found in the mapping element", - "STLContainerWriter::build" ); - } - - m_dataWriter.reset( streamerFactory.newWriter( valueResolvedType, iMe->second ) ); - m_dataWriter->build( m_localElement, *m_insertOperation, operationBuffer ); - //operationBuffer.addToExecutionBuffer( *m_insertOperation ); - return true; -} - -void ora::STLContainerWriter::setRecordId( const std::vector& identity ){ - m_recordId.clear(); - for(size_t i=0;i& columns = m_mappingElement.columnNames(); - if( columns.size() != m_recordId.size()+1){ - throwException( "Object id elements provided are not matching with the mapped id columns.", - "STLContainerWriter::write"); - } - - const Reflex::Type& iteratorReturnType = m_arrayHandler->iteratorReturnType(); - // Retrieve the container type - Reflex::Type keyType; - if ( m_associative ) keyType = m_objectType.TemplateArgumentAt(0); - Reflex::Member firstMember; - Reflex::Member secondMember; - if( keyType ){ - firstMember = iteratorReturnType.MemberByName( "first" ); - if ( ! firstMember ) { - throwException( "Could not find the data member \"first\" for the class \"" + - iteratorReturnType.Name(Reflex::SCOPED) + "\"", - "STLContainerWriter::write" ); - } - secondMember = iteratorReturnType.MemberByName( "second" ); - if ( ! secondMember ) { - throwException( "Could not retrieve the data member \"second\" for the class \"" + - iteratorReturnType.Name(Reflex::SCOPED) + "\"", - "STLContainerWriter::write" ); - } - } - - void* data = m_offset->address( inputData ); - - // Use the iterator to loop over the elements of the container. - size_t containerSize = m_arrayHandler->size( data ); - - if ( containerSize == 0 ) return; - - size_t startElementIndex = m_arrayHandler->startElementIndex( data ); - std::auto_ptr iteratorHandler( m_arrayHandler->iterate( data ) ); - - InsertCache& bulkInsert = m_insertOperation->setUp( containerSize-startElementIndex+1 ); - - for ( size_t iIndex = startElementIndex; iIndex < containerSize; ++iIndex ) { - - m_recordId[m_recordId.size()-1] = iIndex; - coral::AttributeList& dataBuff = m_insertOperation->data(); - - dataBuff[ columns[0] ].data() = oid; - for( size_t i = 1;i < columns.size(); i++ ){ - dataBuff[ columns[i] ].data() = m_recordId[i-1]; - } - - void* objectReference = iteratorHandler->object(); - void* componentData = objectReference; - - if ( keyType ) { // treat the key object first - void* keyData = static_cast< char* >( objectReference ) + firstMember.Offset(); - m_keyWriter->setRecordId( m_recordId ); - m_keyWriter->write( oid, keyData ); - - componentData = static_cast< char* >( objectReference ) + secondMember.Offset(); - } - m_dataWriter->setRecordId( m_recordId ); - - m_dataWriter->write( oid, componentData ); - bulkInsert.processNextIteration(); - - // Increment the iterator - iteratorHandler->increment(); - } - - // execute the insert... - m_arrayHandler->finalize( const_cast( data ) ); - -} - -ora::STLContainerUpdater::STLContainerUpdater(const Reflex::Type& objectType, - MappingElement& mapping, - ContainerSchema& contSchema ): - m_deleter( mapping ), - m_writer( objectType, mapping, contSchema ){ -} - -ora::STLContainerUpdater::~STLContainerUpdater(){ -} - -bool ora::STLContainerUpdater::build( DataElement& offset, - IRelationalData& relationalData, - RelationalBuffer& operationBuffer){ - m_deleter.build( operationBuffer ); - m_writer.build( offset, relationalData, operationBuffer ); - return true; -} - -void ora::STLContainerUpdater::setRecordId( const std::vector& identity ){ - m_writer.setRecordId( identity ); -} - -void ora::STLContainerUpdater::update( int oid, - const void* data ){ - m_deleter.erase( oid ); - m_writer.write( oid, data ); -} - -ora::STLContainerReader::STLContainerReader(const Reflex::Type& objectType, - MappingElement& mapping, - ContainerSchema& contSchema ): - m_objectType( objectType ), - m_mappingElement( mapping ), - m_schema( contSchema ), - m_recordId(), - m_localElement(), - m_associative( ClassUtils::isTypeAssociativeContainer( objectType ) ), - m_offset(0 ), - m_query(), - m_arrayHandler(), - m_keyReader(), - m_dataReader(){ -} - -ora::STLContainerReader::~STLContainerReader(){ -} - -bool ora::STLContainerReader::build( DataElement& offset, IRelationalData& ){ - m_localElement.clear(); - m_recordId.clear(); - // allocate for the index... - m_recordId.push_back(0); - - RelationalStreamerFactory streamerFactory( m_schema ); - - // first open the insert on the extra table... - m_query.reset( new MultiRecordSelectOperation( m_mappingElement.tableName(), m_schema.storageSchema() )); - - m_query->addWhereId( m_mappingElement.pkColumn() ); - std::vector recIdCols = m_mappingElement.recordIdColumns(); - for( size_t i=0; iaddId( recIdCols[ i ] ); - m_query->addOrderId( recIdCols[ i ] ); - } - - m_offset = &offset; - - m_arrayHandler.reset( ArrayHandlerFactory::newArrayHandler( m_objectType ) ); - - Reflex::Type valueType; - if ( m_associative ){ - - Reflex::Type keyType = ClassUtils::containerKeyType( m_objectType ); - Reflex::Type keyResolvedType = ClassUtils::resolvedType(keyType); - - if ( ! keyType ||!keyResolvedType ) { - throwException( "Missing dictionary information for the key type of the container \"" + - m_objectType.Name(Reflex::SCOPED) + "\"", - "STLContainerReader::build" ); - } - - std::string keyName = keyType.Name(); - // Retrieve the relevant mapping element - MappingElement::iterator iMe = m_mappingElement.find( keyName ); - if ( iMe == m_mappingElement.end() ) { - throwException( "Item for \"" + keyName + "\" not found in the mapping element", - "STLContainerReader::build" ); - } - - m_keyReader.reset( streamerFactory.newReader( keyResolvedType, iMe->second ) ); - m_keyReader->build( m_localElement, *m_query ); - - valueType = ClassUtils::containerDataType(m_objectType); - } else { - valueType = ClassUtils::containerValueType(m_objectType); - } - - Reflex::Type valueResolvedType = ClassUtils::resolvedType(valueType); - // Check the component type - if ( ! valueType ||!valueResolvedType ) { - throwException( "Missing dictionary information for the content type of the container \"" + - m_objectType.Name(Reflex::SCOPED) + "\"", - "STLContainerReader::build" ); - } - - std::string valueName = valueType.Name(); - // Retrieve the relevant mapping element - MappingElement::iterator iMe = m_mappingElement.find( valueName ); - if ( iMe == m_mappingElement.end() ) { - throwException( "Item for \"" + valueName + "\" not found in the mapping element", - "STLContainerReader::build" ); - } - - m_dataReader.reset( streamerFactory.newReader( valueResolvedType, iMe->second ) ); - m_dataReader->build( m_localElement, *m_query ); - return true; -} - -void ora::STLContainerReader::select( int oid ){ - if(!m_query.get()){ - throwException("The streamer has not been built.", - "STLContainerReader::read"); - } - coral::AttributeList& whereData = m_query->whereData(); - whereData[ m_mappingElement.pkColumn() ].data() = oid; - m_query->execute(); - if(m_keyReader.get()) m_keyReader->select( oid ); - m_dataReader->select( oid ); -} - -void ora::STLContainerReader::setRecordId( const std::vector& identity ){ - m_recordId.clear(); - for(size_t i=0;iaddress( destinationData ); - - const Reflex::Type& iteratorReturnType = m_arrayHandler->iteratorReturnType(); - U_Primitives primitiveStub; - - Reflex::Type keyType; - Reflex::Member firstMember; - Reflex::Member secondMember; - if ( m_associative ) { - keyType = m_objectType.TemplateArgumentAt(0); - firstMember = iteratorReturnType.MemberByName( "first" ); - if ( ! firstMember ) { - throwException("Could not retrieve the data member \"first\" of the class \"" + - iteratorReturnType.Name(Reflex::SCOPED) + "\"", - "STLContainerReader::read" ); - } - secondMember = iteratorReturnType.MemberByName( "second" ); - if ( ! secondMember ) { - throwException( "Could not retrieve the data member \"second\" of the class \"" + - iteratorReturnType.Name(Reflex::SCOPED) + "\"", - "STLContainerReader::read" ); - } - } - - bool isElementFundamental = iteratorReturnType.IsFundamental(); - - m_arrayHandler->clear( address ); - - size_t cursorSize = m_query->selectionSize(m_recordId, m_recordId.size()-1); - unsigned int i=0; - while ( i< cursorSize ){ - - m_recordId[m_recordId.size()-1] = (int)i; - m_query->selectRow( m_recordId ); - - // Create a new element for the array - void* objectData = 0; - if(isElementFundamental){ - objectData = &primitiveStub; - } else { - objectData = iteratorReturnType.Construct().Address(); - } - - void* componentData = objectData; - void* keyData = 0; - - if ( keyType ) { // treat the key object first - keyData = static_cast< char* >( objectData ) + firstMember.Offset(); - m_keyReader->setRecordId( m_recordId ); - m_keyReader->read( keyData ); - - componentData = static_cast< char* >( objectData ) + secondMember.Offset(); - } - m_dataReader->setRecordId( m_recordId ); - m_dataReader->read( componentData ); - - size_t prevSize = m_arrayHandler->size( address ); - m_arrayHandler->appendNewElement( address, objectData ); - bool inserted = m_arrayHandler->size( address )>prevSize; - if ( ! ( iteratorReturnType.IsFundamental() ) ) { - iteratorReturnType.Destruct( objectData ); - } - if ( !inserted ) { - throwException( "Could not insert a new element in the array type \"" + - m_objectType.Name(Reflex::SCOPED) + "\"", - "STLContainerReader::read" ); - } - ++i; - } - - m_arrayHandler->finalize( address ); - -} - -void ora::STLContainerReader::clear(){ - if(m_query.get()) m_query->clear(); - if(m_keyReader.get()) m_keyReader->clear(); - if(m_dataReader.get()) m_dataReader->clear(); -} - -ora::STLContainerStreamer::STLContainerStreamer( const Reflex::Type& objectType, - MappingElement& mapping, - ContainerSchema& contSchema ): - m_objectType( objectType ), - m_mapping( mapping ), - m_schema( contSchema ){ -} - -ora::STLContainerStreamer::~STLContainerStreamer(){ -} - -ora::IRelationalWriter* ora::STLContainerStreamer::newWriter(){ - return new STLContainerWriter( m_objectType, m_mapping, m_schema ); -} - -ora::IRelationalUpdater* ora::STLContainerStreamer::newUpdater(){ - return new STLContainerUpdater( m_objectType, m_mapping, m_schema ); -} - -ora::IRelationalReader* ora::STLContainerStreamer::newReader(){ - return new STLContainerReader( m_objectType, m_mapping, m_schema ); -} +#include "CondCore/ORA/interface/Exception.h" +#include "STLContainerStreamer.h" +#include "ClassUtils.h" +#include "MappingElement.h" +#include "DataElement.h" +#include "ContainerSchema.h" +#include "RelationalBuffer.h" +#include "MultiRecordInsertOperation.h" +#include "MultiRecordSelectOperation.h" +#include "RelationalStreamerFactory.h" +#include "ArrayHandlerFactory.h" +#include "IArrayHandler.h" +#include "ArrayCommonImpl.h" +// externals +#include "CoralBase/Attribute.h" +#include "RelationalAccess/IBulkOperation.h" +#include "FWCore/Utilities/interface/MemberWithDict.h" + +ora::STLContainerWriter::STLContainerWriter( const edm::TypeWithDict& objectType, + MappingElement& mapping, + ContainerSchema& contSchema ): + m_objectType( objectType ), + m_mappingElement( mapping ), + m_schema( contSchema ), + m_recordId(), + m_localElement(), + m_associative( ClassUtils::isTypeAssociativeContainer( objectType ) ), + m_offset( 0 ), + m_insertOperation( 0 ), + m_arrayHandler(), + m_keyWriter(), + m_dataWriter(){ +} + +ora::STLContainerWriter::~STLContainerWriter(){ +} + +bool ora::STLContainerWriter::build( DataElement& offset, + IRelationalData&, + RelationalBuffer& operationBuffer ){ + if( !m_objectType ){ + throwException( "Missing dictionary information for the type of the container \"" + + m_objectType.cppName() + "\"", + "STLContainerWriter::build" ); + } + m_localElement.clear(); + m_recordId.clear(); + // allocate for the index... + m_recordId.push_back(0); + + RelationalStreamerFactory streamerFactory( m_schema ); + + // first open the insert on the extra table... + m_insertOperation = &operationBuffer.newMultiRecordInsert( m_mappingElement.tableName() ); + const std::vector& columns = m_mappingElement.columnNames(); + if( !columns.size() ){ + throwException( "Id columns not found in the mapping.", + "STLContainerWriter::build"); + } + for( size_t i=0; iaddId( columns[ i ] ); + } + + m_offset = &offset; + + m_arrayHandler.reset( ArrayHandlerFactory::newArrayHandler( m_objectType ) ); + + edm::TypeWithDict valueType; + if ( m_associative ){ + + edm::TypeWithDict keyType = ClassUtils::containerKeyType(m_objectType); + edm::TypeWithDict keyResolvedType = ClassUtils::resolvedType(keyType); + if ( ! keyType || !keyResolvedType ) { + throwException( "Missing dictionary information for the key type of the container \"" + + m_objectType.cppName() + "\"", + "STLContainerWriter::build" ); + } + std::string keyName("key_type"); + // Retrieve the relevant mapping element + MappingElement::iterator iMe = m_mappingElement.find( keyName ); + if ( iMe == m_mappingElement.end() ) { + throwException( "Item for \"" + keyName + "\" not found in the mapping element", + "STLContainerWriter::build" ); + } + + m_keyWriter.reset( streamerFactory.newWriter( keyResolvedType, iMe->second ) ); + m_keyWriter->build( m_localElement, *m_insertOperation, operationBuffer ); + valueType = ClassUtils::containerDataType(m_objectType); + } else { + valueType = ClassUtils::containerValueType(m_objectType); + } + + edm::TypeWithDict valueResolvedType = ClassUtils::resolvedType(valueType); + // Check the component type + if ( ! valueType || !valueResolvedType ) { + throwException( "Missing dictionary information for the content type of the container \"" + + m_objectType.cppName() + "\"", + "STLContainerWriter::build" ); + } + + std::string valueName(m_associative ? "mapped_type" : "value_type"); + // Retrieve the relevant mapping element + MappingElement::iterator iMe = m_mappingElement.find( valueName ); + if ( iMe == m_mappingElement.end() ) { + // Try again with the name of a possible typedef + std::string valueName2 = valueType.unscopedName(); + iMe = m_mappingElement.find( valueName2 ); + if ( iMe == m_mappingElement.end() ) { + throwException( "Item for \"" + valueName + "\" not found in the mapping element", + "STLContainerWriter::build" ); + } + } + + m_dataWriter.reset( streamerFactory.newWriter( valueResolvedType, iMe->second ) ); + m_dataWriter->build( m_localElement, *m_insertOperation, operationBuffer ); + //operationBuffer.addToExecutionBuffer( *m_insertOperation ); + return true; +} + +void ora::STLContainerWriter::setRecordId( const std::vector& identity ){ + m_recordId.clear(); + for(size_t i=0;i& columns = m_mappingElement.columnNames(); + if( columns.size() != m_recordId.size()+1){ + throwException( "Object id elements provided are not matching with the mapped id columns.", + "STLContainerWriter::write"); + } + + const edm::TypeWithDict& iteratorReturnType = m_arrayHandler->iteratorReturnType(); + // Retrieve the container type + edm::TypeWithDict keyType; + if ( m_associative ) keyType = m_objectType.templateArgumentAt(0); + edm::MemberWithDict firstMember; + edm::MemberWithDict secondMember; + if( keyType ){ + firstMember = iteratorReturnType.dataMemberByName( "first" ); + if ( ! firstMember ) { + throwException( "Could not find the data member \"first\" for the class \"" + + iteratorReturnType.cppName() + "\"", + "STLContainerWriter::write" ); + } + secondMember = iteratorReturnType.dataMemberByName( "second" ); + if ( ! secondMember ) { + throwException( "Could not retrieve the data member \"second\" for the class \"" + + iteratorReturnType.cppName() + "\"", + "STLContainerWriter::write" ); + } + } + + void* data = m_offset->address( inputData ); + + // Use the iterator to loop over the elements of the container. + size_t containerSize = m_arrayHandler->size( data ); + + if ( containerSize == 0 ) return; + + size_t startElementIndex = m_arrayHandler->startElementIndex( data ); + std::auto_ptr iteratorHandler( m_arrayHandler->iterate( data ) ); + + InsertCache& bulkInsert = m_insertOperation->setUp( containerSize-startElementIndex+1 ); + + for ( size_t iIndex = startElementIndex; iIndex < containerSize; ++iIndex ) { + + m_recordId[m_recordId.size()-1] = iIndex; + coral::AttributeList& dataBuff = m_insertOperation->data(); + + dataBuff[ columns[0] ].data() = oid; + for( size_t i = 1;i < columns.size(); i++ ){ + dataBuff[ columns[i] ].data() = m_recordId[i-1]; + } + + void* objectReference = iteratorHandler->object(); + void* componentData = objectReference; + + if ( keyType ) { // treat the key object first + void* keyData = static_cast< char* >( objectReference ) + firstMember.offset(); + m_keyWriter->setRecordId( m_recordId ); + m_keyWriter->write( oid, keyData ); + + componentData = static_cast< char* >( objectReference ) + secondMember.offset(); + } + m_dataWriter->setRecordId( m_recordId ); + + m_dataWriter->write( oid, componentData ); + bulkInsert.processNextIteration(); + + // Increment the iterator + iteratorHandler->increment(); + } + + // execute the insert... + m_arrayHandler->finalize( const_cast( data ) ); + +} + +ora::STLContainerUpdater::STLContainerUpdater(const edm::TypeWithDict& objectType, + MappingElement& mapping, + ContainerSchema& contSchema ): + m_deleter( mapping ), + m_writer( objectType, mapping, contSchema ){ +} + +ora::STLContainerUpdater::~STLContainerUpdater(){ +} + +bool ora::STLContainerUpdater::build( DataElement& offset, + IRelationalData& relationalData, + RelationalBuffer& operationBuffer){ + m_deleter.build( operationBuffer ); + m_writer.build( offset, relationalData, operationBuffer ); + return true; +} + +void ora::STLContainerUpdater::setRecordId( const std::vector& identity ){ + m_writer.setRecordId( identity ); +} + +void ora::STLContainerUpdater::update( int oid, + const void* data ){ + m_deleter.erase( oid ); + m_writer.write( oid, data ); +} + +ora::STLContainerReader::STLContainerReader(const edm::TypeWithDict& objectType, + MappingElement& mapping, + ContainerSchema& contSchema ): + m_objectType( objectType ), + m_mappingElement( mapping ), + m_schema( contSchema ), + m_recordId(), + m_localElement(), + m_associative( ClassUtils::isTypeAssociativeContainer( objectType ) ), + m_offset(0 ), + m_query(), + m_arrayHandler(), + m_keyReader(), + m_dataReader(){ +} + +ora::STLContainerReader::~STLContainerReader(){ +} + +bool ora::STLContainerReader::build( DataElement& offset, IRelationalData& ){ + m_localElement.clear(); + m_recordId.clear(); + // allocate for the index... + m_recordId.push_back(0); + + RelationalStreamerFactory streamerFactory( m_schema ); + + // first open the insert on the extra table... + m_query.reset( new MultiRecordSelectOperation( m_mappingElement.tableName(), m_schema.storageSchema() )); + + m_query->addWhereId( m_mappingElement.pkColumn() ); + std::vector recIdCols = m_mappingElement.recordIdColumns(); + for( size_t i=0; iaddId( recIdCols[ i ] ); + m_query->addOrderId( recIdCols[ i ] ); + } + + m_offset = &offset; + + m_arrayHandler.reset( ArrayHandlerFactory::newArrayHandler( m_objectType ) ); + + edm::TypeWithDict valueType; + if ( m_associative ){ + + edm::TypeWithDict keyType = ClassUtils::containerKeyType( m_objectType ); + edm::TypeWithDict keyResolvedType = ClassUtils::resolvedType(keyType); + + if ( ! keyType ||!keyResolvedType ) { + throwException( "Missing dictionary information for the key type of the container \"" + + m_objectType.cppName() + "\"", + "STLContainerReader::build" ); + } + + std::string keyName("key_type"); + // Retrieve the relevant mapping element + MappingElement::iterator iMe = m_mappingElement.find( keyName ); + if ( iMe == m_mappingElement.end() ) { + throwException( "Item for \"" + keyName + "\" not found in the mapping element", + "STLContainerReader::build" ); + } + + m_keyReader.reset( streamerFactory.newReader( keyResolvedType, iMe->second ) ); + m_keyReader->build( m_localElement, *m_query ); + + valueType = ClassUtils::containerDataType(m_objectType); + } else { + valueType = ClassUtils::containerValueType(m_objectType); + } + + edm::TypeWithDict valueResolvedType = ClassUtils::resolvedType(valueType); + // Check the component type + if ( ! valueType ||!valueResolvedType ) { + throwException( "Missing dictionary information for the content type of the container \"" + + m_objectType.cppName() + "\"", + "STLContainerReader::build" ); + } + + std::string valueName(m_associative ? "mapped_type" : "value_type"); + // Retrieve the relevant mapping element + MappingElement::iterator iMe = m_mappingElement.find( valueName ); + if ( iMe == m_mappingElement.end() ) { + // Try again with the name of a possible typedef + std::string valueName2 = valueType.unscopedName(); + iMe = m_mappingElement.find( valueName2 ); + if ( iMe == m_mappingElement.end() ) { + throwException( "Item for \"" + valueName + "\" not found in the mapping element", + "STLContainerReader::build" ); + } + } + + m_dataReader.reset( streamerFactory.newReader( valueResolvedType, iMe->second ) ); + m_dataReader->build( m_localElement, *m_query ); + return true; +} + +void ora::STLContainerReader::select( int oid ){ + if(!m_query.get()){ + throwException("The streamer has not been built.", + "STLContainerReader::read"); + } + coral::AttributeList& whereData = m_query->whereData(); + whereData[ m_mappingElement.pkColumn() ].data() = oid; + m_query->execute(); + if(m_keyReader.get()) m_keyReader->select( oid ); + m_dataReader->select( oid ); +} + +void ora::STLContainerReader::setRecordId( const std::vector& identity ){ + m_recordId.clear(); + for(size_t i=0;iaddress( destinationData ); + + const edm::TypeWithDict& iteratorReturnType = m_arrayHandler->iteratorReturnType(); + U_Primitives primitiveStub; + + edm::TypeWithDict keyType; + edm::MemberWithDict firstMember; + edm::MemberWithDict secondMember; + if ( m_associative ) { + keyType = m_objectType.templateArgumentAt(0); + firstMember = iteratorReturnType.dataMemberByName( "first" ); + if ( ! firstMember ) { + throwException("Could not retrieve the data member \"first\" of the class \"" + + iteratorReturnType.cppName() + "\"", + "STLContainerReader::read" ); + } + secondMember = iteratorReturnType.dataMemberByName( "second" ); + if ( ! secondMember ) { + throwException( "Could not retrieve the data member \"second\" of the class \"" + + iteratorReturnType.cppName() + "\"", + "STLContainerReader::read" ); + } + } + + bool isElementFundamental = iteratorReturnType.isFundamental(); + + m_arrayHandler->clear( address ); + + size_t cursorSize = m_query->selectionSize(m_recordId, m_recordId.size()-1); + unsigned int i=0; + // Create a new element for the array + void* objectData = 0; + if(isElementFundamental){ + objectData = &primitiveStub; + } else { + objectData = iteratorReturnType.construct().address(); + } + + while ( i< cursorSize ){ + + m_recordId[m_recordId.size()-1] = (int)i; + m_query->selectRow( m_recordId ); + + void* componentData = objectData; + void* keyData = 0; + + if ( keyType ) { // treat the key object first + keyData = static_cast< char* >( objectData ) + firstMember.offset(); + m_keyReader->setRecordId( m_recordId ); + m_keyReader->read( keyData ); + + componentData = static_cast< char* >( objectData ) + secondMember.offset(); + } + m_dataReader->setRecordId( m_recordId ); + m_dataReader->read( componentData ); + + size_t prevSize = m_arrayHandler->size( address ); + m_arrayHandler->appendNewElement( address, objectData ); + bool inserted = m_arrayHandler->size( address )>prevSize; + if ( !inserted ) { + throwException( "Could not insert a new element in the array type \"" + + m_objectType.cppName() + "\"", + "STLContainerReader::read" ); + } + ++i; + } + if ( ! ( iteratorReturnType.isFundamental() ) ) { + iteratorReturnType.destruct( objectData ); + } + + m_arrayHandler->finalize( address ); + +} + +void ora::STLContainerReader::clear(){ + if(m_query.get()) m_query->clear(); + if(m_keyReader.get()) m_keyReader->clear(); + if(m_dataReader.get()) m_dataReader->clear(); +} + +ora::STLContainerStreamer::STLContainerStreamer( const edm::TypeWithDict& objectType, + MappingElement& mapping, + ContainerSchema& contSchema ): + m_objectType( objectType ), + m_mapping( mapping ), + m_schema( contSchema ){ +} + +ora::STLContainerStreamer::~STLContainerStreamer(){ +} + +ora::IRelationalWriter* ora::STLContainerStreamer::newWriter(){ + return new STLContainerWriter( m_objectType, m_mapping, m_schema ); +} + +ora::IRelationalUpdater* ora::STLContainerStreamer::newUpdater(){ + return new STLContainerUpdater( m_objectType, m_mapping, m_schema ); +} + +ora::IRelationalReader* ora::STLContainerStreamer::newReader(){ + return new STLContainerReader( m_objectType, m_mapping, m_schema ); +} diff --git a/CondCore/ORA/src/STLContainerStreamer.h b/CondCore/ORA/src/STLContainerStreamer.h index d936e77afaed1..16d9dc6194f2b 100644 --- a/CondCore/ORA/src/STLContainerStreamer.h +++ b/CondCore/ORA/src/STLContainerStreamer.h @@ -7,7 +7,7 @@ // #include // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { @@ -22,7 +22,7 @@ namespace ora { public: /// Constructor - STLContainerWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + STLContainerWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~STLContainerWriter(); MappingElement& mapping(); @@ -39,7 +39,7 @@ namespace ora { void write( int oid,const void* data ); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mappingElement; ContainerSchema& m_schema; std::vector m_recordId; @@ -59,7 +59,7 @@ namespace ora { public: /// Constructor - STLContainerUpdater(const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + STLContainerUpdater(const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~STLContainerUpdater(); @@ -81,7 +81,7 @@ namespace ora { public: /// Constructor - STLContainerReader(const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + STLContainerReader(const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~STLContainerReader(); @@ -97,7 +97,7 @@ namespace ora { void clear(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mappingElement; ContainerSchema& m_schema; std::vector m_recordId; @@ -115,7 +115,7 @@ namespace ora { class STLContainerStreamer : public IRelationalStreamer { public: - STLContainerStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + STLContainerStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); ~STLContainerStreamer(); @@ -126,7 +126,7 @@ namespace ora { IRelationalReader* newReader(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; ContainerSchema& m_schema; }; diff --git a/CondCore/ORA/src/UniqueRefStreamer.cc b/CondCore/ORA/src/UniqueRefStreamer.cc index 6dee90b32b05f..deac2903dec92 100644 --- a/CondCore/ORA/src/UniqueRefStreamer.cc +++ b/CondCore/ORA/src/UniqueRefStreamer.cc @@ -9,8 +9,8 @@ #include "RelationalStreamerFactory.h" // externals #include "CoralBase/Attribute.h" -#include "Reflex/Object.h" -#include "Reflex/Member.h" +#include "FWCore/Utilities/interface/ObjectWithDict.h" +#include "FWCore/Utilities/interface/MemberWithDict.h" namespace ora { @@ -23,7 +23,7 @@ namespace ora { m_depInsert( 0 ){ } - void build( const Reflex::Type& objectType, MappingElement& mapping, + void build( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema, RelationalBuffer& operationBuffer ){ m_depInsert = &operationBuffer.newInsert( mapping.tableName()); @@ -33,11 +33,11 @@ namespace ora { m_depInsert->addId( *iC ); } - MappingElement::iterator iMe = mapping.find( objectType.Name(Reflex::SCOPED) ); + MappingElement::iterator iMe = mapping.find( objectType.cppName() ); // the first inner mapping is the relevant... if( iMe == mapping.end()){ throwException("Could not find a mapping element for class \""+ - objectType.Name(Reflex::SCOPED)+"\"", + objectType.cppName()+"\"", "DependentClassWriter::write"); } RelationalStreamerFactory streamerFactory( contSchema ); @@ -80,16 +80,16 @@ namespace ora { m_depQuery(){ } - void build( const Reflex::Type& objectType, MappingElement& depMapping, ContainerSchema& contSchema ){ + void build( const edm::TypeWithDict& objectType, MappingElement& depMapping, ContainerSchema& contSchema ){ m_type = objectType; m_depQuery.reset( new SelectOperation( depMapping.tableName(), contSchema.storageSchema())); m_depQuery->addWhereId( depMapping.columnNames()[ 1 ] ); - MappingElement::iterator iMap = depMapping.find( m_type.Name(Reflex::SCOPED) ); + MappingElement::iterator iMap = depMapping.find( m_type.cppName() ); // the first inner mapping is the good one ... if( iMap == depMapping.end()){ throwException("Could not find a mapping element for class \""+ - m_type.Name(Reflex::SCOPED)+"\"", + m_type.cppName()+"\"", "DependentClassReadBuffer::ReadBuffer"); } MappingElement& mapping = iMap->second; @@ -123,7 +123,7 @@ namespace ora { private: DataElement m_dataElement; - Reflex::Type m_type; + edm::TypeWithDict m_type; std::auto_ptr m_reader; std::auto_ptr m_depQuery; }; @@ -140,7 +140,7 @@ namespace ora { } public: - void build( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ){ + void build( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ){ m_reader.build( objectType, mapping, contSchema ); m_valid = true; } @@ -168,7 +168,7 @@ namespace ora { }; } -ora::UniqueRefWriter::UniqueRefWriter( const Reflex::Type& objectType, +ora::UniqueRefWriter::UniqueRefWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), @@ -222,20 +222,23 @@ void ora::UniqueRefWriter::write( int oid, void* refAddress = m_dataElement->address( data ); - Reflex::Object refObj( m_objectType, const_cast(refAddress)); + edm::ObjectWithDict refObj( m_objectType, const_cast(refAddress)); bool isNull; - refObj.Invoke("operator!",isNull); + edm::ObjectWithDict resObj = edm::ObjectWithDict(edm::TypeWithDict(typeid(bool)), &isNull); + refObj.typeOf().functionMemberByName("operator!").invoke(refObj, &resObj); int refId = 0; std::string className = uniqueRefNullLabel(); if(!isNull){ // resolving the ref type - std::type_info* refTypeInfo = 0; - refObj.Invoke("typeInfo",refTypeInfo); - Reflex::Type refType = ClassUtils::lookupDictionary(*refTypeInfo); - className = refType.Name(Reflex::SCOPED); + const std::type_info *refTypeInfo = 0; + edm::TypeWithDict typeInfoDict( typeid(std::type_info*) ); + edm::ObjectWithDict refTIObj( typeInfoDict, &refTypeInfo ); + m_objectType.functionMemberByName("typeInfo").invoke( refObj, &refTIObj); + edm::TypeWithDict refType = ClassUtils::lookupDictionary( *refTypeInfo ); + className = refType.cppName(); // building the dependent buffer MappingElement& depMapping = m_schema.mappingForDependentClass( refType, true ); @@ -245,8 +248,10 @@ void ora::UniqueRefWriter::write( int oid, DependentClassWriter writer; writer.build( refType, depMapping, m_schema, m_operationBuffer->addVolatileBuffer() ); - void* refData; - refObj.Invoke("operator*",refData); + void* refData = 0; + edm::ObjectWithDict refDataObj(edm::TypeWithDict(typeid(void*)), &refData); + m_objectType.functionMemberByName("operator*").invoke( refObj, &refDataObj ); + writer.write( oid, refId, refData ); } @@ -256,7 +261,7 @@ void ora::UniqueRefWriter::write( int oid, parentData[m_columnIndexes[1]].data()=refId; } -ora::UniqueRefUpdater::UniqueRefUpdater( const Reflex::Type& objectType, +ora::UniqueRefUpdater::UniqueRefUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_writer( objectType, mapping, contSchema ){ @@ -281,7 +286,7 @@ void ora::UniqueRefUpdater::update( int oid, m_writer.write( oid, data ); } -ora::UniqueRefReader::UniqueRefReader( const Reflex::Type& objectType, +ora::UniqueRefReader::UniqueRefReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), @@ -333,14 +338,14 @@ void ora::UniqueRefReader::read( void* data ){ std::string className = row[m_columnIndexes[0]].data(); int refId = row[m_columnIndexes[1]].data(); - Reflex::Type refType = ClassUtils::lookupDictionary(className); + edm::TypeWithDict refType = ClassUtils::lookupDictionary(className); // building the dependent buffer MappingElement& depMapping = m_schema.mappingForDependentClass( refType ); // resolving loader address - Reflex::Member loaderMember = m_objectType.MemberByName("m_loader"); - DataElement& loaderElement = m_dataElement->addChild( loaderMember.Offset(), 0 ); + edm::MemberWithDict loaderMember = m_objectType.dataMemberByName("m_loader"); + DataElement& loaderElement = m_dataElement->addChild( loaderMember.offset(), 0 ); void* loaderAddress = loaderElement.address( data ); boost::shared_ptr* loaderPtr = static_cast*>( loaderAddress ); // creating new loader @@ -355,7 +360,7 @@ void ora::UniqueRefReader::read( void* data ){ void ora::UniqueRefReader::clear(){ } -ora::UniqueRefStreamer::UniqueRefStreamer( const Reflex::Type& objectType, +ora::UniqueRefStreamer::UniqueRefStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ): m_objectType( objectType ), diff --git a/CondCore/ORA/src/UniqueRefStreamer.h b/CondCore/ORA/src/UniqueRefStreamer.h index 015589591de7a..261dfa4bc8de2 100644 --- a/CondCore/ORA/src/UniqueRefStreamer.h +++ b/CondCore/ORA/src/UniqueRefStreamer.h @@ -8,7 +8,7 @@ #include #include // externals -#include "Reflex/Type.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" namespace ora { @@ -24,7 +24,7 @@ namespace ora { public: - UniqueRefWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + UniqueRefWriter( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~UniqueRefWriter(); @@ -37,7 +37,7 @@ namespace ora { private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mappingElement; int m_columnIndexes[2]; ContainerSchema& m_schema; @@ -50,7 +50,7 @@ namespace ora { public: - UniqueRefUpdater( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + UniqueRefUpdater( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~UniqueRefUpdater(); @@ -72,7 +72,7 @@ namespace ora { public: - UniqueRefReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + UniqueRefReader( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); virtual ~UniqueRefReader(); @@ -89,7 +89,7 @@ namespace ora { private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mappingElement; int m_columnIndexes[2]; ContainerSchema& m_schema; @@ -101,7 +101,7 @@ namespace ora { class UniqueRefStreamer : public IRelationalStreamer { public: - UniqueRefStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema ); + UniqueRefStreamer( const edm::TypeWithDict& objectType, MappingElement& mapping, ContainerSchema& contSchema ); ~UniqueRefStreamer(); @@ -112,7 +112,7 @@ namespace ora { IRelationalReader* newReader(); private: - Reflex::Type m_objectType; + edm::TypeWithDict m_objectType; MappingElement& m_mapping; ContainerSchema& m_schema; }; diff --git a/CondCore/ORA/src/classes.h b/CondCore/ORA/src/classes.h new file mode 100644 index 0000000000000..4f14fbbca9163 --- /dev/null +++ b/CondCore/ORA/src/classes.h @@ -0,0 +1,2 @@ +#include "CondCore/ORA/interface/Reference.h" +#include "CondCore/ORA/interface/NamedRef.h" diff --git a/CondCore/ORA/src/classes_def.xml b/CondCore/ORA/src/classes_def.xml new file mode 100644 index 0000000000000..4ef73631d064d --- /dev/null +++ b/CondCore/ORA/src/classes_def.xml @@ -0,0 +1,4 @@ + + + + diff --git a/CondCore/ORA/test/TestBase.h b/CondCore/ORA/test/TestBase.h index ad7adac2b48a2..924b3da7343c9 100644 --- a/CondCore/ORA/test/TestBase.h +++ b/CondCore/ORA/test/TestBase.h @@ -28,7 +28,7 @@ namespace ora { void run( const std::string& connectionString ){ const char* authEnv = ::getenv( "CORAL_AUTH_PATH" ); - std::string defaultPath("/afs/cern.ch/cms/DB/conddb/int9r"); + std::string defaultPath("/afs/cern.ch/cms/DB/conddb"); std::string pathEnv(std::string("CORAL_AUTH_PATH=")+defaultPath); if( !authEnv ){ //setting environment variable: if pathEnv is defined in this scope (as it should be), it does not work!! (??) @@ -49,7 +49,7 @@ namespace ora { } void run(){ - std::string connStr("oracle://cms_orcoff_int/CMS_COND_UNIT_TESTS"); + std::string connStr("oracle://cms_orcoff_prep/CMS_COND_UNIT_TESTS"); const char* envVar = ::getenv( "ORA_TEST_DB" ); if( envVar ){ connStr = std::string(envVar); diff --git a/CondCore/ORA/test/classes_def.xml b/CondCore/ORA/test/classes_def.xml index 3c871823de8a1..8e23bec098dbd 100644 --- a/CondCore/ORA/test/classes_def.xml +++ b/CondCore/ORA/test/classes_def.xml @@ -32,7 +32,6 @@ - @@ -55,11 +54,10 @@ - + - diff --git a/CondCore/ORA/test/testORA_7.cc b/CondCore/ORA/test/testORA_7.cc index 8d8b9b333ad84..e406c6e9c0d2b 100644 --- a/CondCore/ORA/test/testORA_7.cc +++ b/CondCore/ORA/test/testORA_7.cc @@ -11,8 +11,10 @@ #include #include // externals -#include "Reflex/Member.h" -#include "Reflex/Object.h" + +#include "FWCore/Utilities/interface/TypeWithDict.h" +#include "FWCore/Utilities/interface/MemberWithDict.h" +#include "FWCore/Utilities/interface/ObjectWithDict.h" #include "CoralBase/Blob.h" using namespace testORA; @@ -25,9 +27,9 @@ class PrimitiveContainerStreamingService : public ora::IBlobStreamingService { virtual ~PrimitiveContainerStreamingService(); - boost::shared_ptr write( const void* addressOfInputData, const Reflex::Type& classDictionary, bool ); + boost::shared_ptr write( const void* addressOfInputData, const edm::TypeWithDict& classDictionary, bool ); - void read( const coral::Blob& blobData, void* addressOfContainer, const Reflex::Type& classDictionary ); + void read( const coral::Blob& blobData, void* addressOfContainer, const edm::TypeWithDict& classDictionary ); }; PrimitiveContainerStreamingService::PrimitiveContainerStreamingService(){ @@ -37,73 +39,75 @@ PrimitiveContainerStreamingService::~PrimitiveContainerStreamingService(){ } boost::shared_ptr PrimitiveContainerStreamingService::write( const void* addressOfInputData, - const Reflex::Type& type, + const edm::TypeWithDict& type, bool ){ // The actual object - Reflex::Object theContainer( type, const_cast( addressOfInputData ) ); + edm::ObjectWithDict theContainer( type, const_cast( addressOfInputData ) ); // Retrieve the size of the container - Reflex::Member sizeMethod = type.MemberByName( "size" ); + edm::FunctionWithDict sizeMethod = type.functionMemberByName( "size" ); if ( ! sizeMethod ) throw std::runtime_error( "No size method is defined for the container" ); size_t containerSize = 0; - sizeMethod.Invoke(theContainer, containerSize); + edm::ObjectWithDict sizeObj = edm::ObjectWithDict( edm::TypeWithDict(typeid(size_t)), &containerSize ); + sizeMethod.invoke(theContainer, &sizeObj); // Retrieve the element size - Reflex::Member beginMethod = type.MemberByName( "begin" ); + edm::FunctionWithDict beginMethod = type.functionMemberByName( "begin" ); if ( ! beginMethod ) throw std::runtime_error( "No begin method is defined for the container" ); - Reflex::Type iteratorType = beginMethod.TypeOf().ReturnType(); - Reflex::Member dereferenceMethod = iteratorType.MemberByName( "operator*" ); + edm::TypeWithDict iteratorType = beginMethod.finalReturnType(); + edm::FunctionWithDict dereferenceMethod = iteratorType.functionMemberByName( "operator*" ); if ( ! dereferenceMethod ) throw std::runtime_error( "Could not retrieve the dereference method of the container's iterator" ); - size_t elementSize = dereferenceMethod.TypeOf().ReturnType().SizeOf(); + size_t elementSize = dereferenceMethod.finalReturnType().size(); boost::shared_ptr blob( new coral::Blob( containerSize * elementSize ) ); // allocate the blob void* startingAddress = blob->startingAddress(); // Create an iterator - Reflex::Type retType2 = beginMethod.TypeOf().ReturnType(); - char* retbuf2 = ::new char[retType2.SizeOf()]; - Reflex::Object iteratorObject(retType2, retbuf2); - beginMethod.Invoke( Reflex::Object( type, const_cast< void * > ( addressOfInputData ) ), &iteratorObject ); + edm::TypeWithDict retType2 = beginMethod.finalReturnType(); + char* retbuf2 = ::new char[retType2.size()]; + edm::ObjectWithDict iteratorObject(retType2, retbuf2); + beginMethod.invoke( edm::ObjectWithDict( type, const_cast< void * > ( addressOfInputData ) ), &iteratorObject ); // Loop over the elements of the container - Reflex::Member incrementMethod = iteratorObject.TypeOf().MemberByName( "operator++" ); + edm::FunctionWithDict incrementMethod = iteratorObject.typeOf().functionMemberByName( "operator++" ); if ( ! incrementMethod ) throw std::runtime_error( "Could not retrieve the increment method of the container's iterator" ); for ( size_t i = 0; i < containerSize; ++i ) { void* elementAddress = 0; - dereferenceMethod.Invoke( iteratorObject, elementAddress); + edm::ObjectWithDict elemAddrObj = edm::ObjectWithDict( edm::TypeWithDict(typeid(void*)), &elementAddress ); + dereferenceMethod.invoke( iteratorObject, &elemAddrObj); ::memcpy( startingAddress, elementAddress, elementSize ); char* cstartingAddress = static_cast( startingAddress ); cstartingAddress += elementSize; startingAddress = cstartingAddress; - incrementMethod.Invoke( iteratorObject, 0); + incrementMethod.invoke( iteratorObject, 0); } - // Destroy the iterator - iteratorObject.Destruct(); + // Destroy - and deallocate - the iterator + iteratorObject.destruct(true); return blob; } void PrimitiveContainerStreamingService::read( const coral::Blob& blobData, void* addressOfContainer, - const Reflex::Type& type ){ + const edm::TypeWithDict& type ){ // Retrieve the element size - Reflex::Member beginMethod = type.MemberByName( "begin" ); + edm::FunctionWithDict beginMethod = type.functionMemberByName( "begin" ); if ( ! beginMethod ) throw std::runtime_error( "No begin method is defined for the container" ); - Reflex::Type iteratorType = beginMethod.TypeOf().ReturnType(); - Reflex::Member dereferenceMethod = iteratorType.MemberByName( "operator*" ); + edm::TypeWithDict iteratorType = beginMethod.finalReturnType(); + edm::FunctionWithDict dereferenceMethod = iteratorType.functionMemberByName( "operator*" ); if ( ! dereferenceMethod ) throw std::runtime_error( "Could not retrieve the dereference method of the container's iterator" ); - size_t elementSize = dereferenceMethod.TypeOf().ReturnType().SizeOf(); + size_t elementSize = dereferenceMethod.finalReturnType().size(); if( ! elementSize ) return; @@ -111,29 +115,22 @@ void PrimitiveContainerStreamingService::read( const coral::Blob& blobData, size_t contrainerSize = blobData.size() / elementSize; // Retrieve the end method - Reflex::Member endMethod = type.MemberByName( "end" ); + edm::FunctionWithDict endMethod = type.functionMemberByName( "end" ); if ( ! endMethod ) throw std::runtime_error( "Could not retrieve the end method of the container" ); // Retrieve the insert method - Reflex::Member insertMethod; - for( unsigned int i = 0; i < type.FunctionMemberSize();i++){ - Reflex::Member im = type.FunctionMemberAt(i); - if( im.Name() != std::string( "insert" ) ) continue; - if( im.TypeOf().FunctionParameterSize() != 2) continue; - insertMethod = im; - break; - } + edm::FunctionWithDict insertMethod = type.functionMemberByName("insert"); // Retrieve the clear method - Reflex::Member clearMethod = type.MemberByName( "clear" ); + edm::FunctionWithDict clearMethod = type.functionMemberByName( "clear" ); if ( ! clearMethod ) throw std::runtime_error( "Could not retrieve the clear method of the container" ); // Clear the container - Reflex::Object containerObject( type, addressOfContainer ); + edm::ObjectWithDict containerObject( type, addressOfContainer ); - clearMethod.Invoke( containerObject ,0 ); + clearMethod.invoke( containerObject ,0 ); // Fill-in the elements const void* startingAddress = blobData.startingAddress(); @@ -141,19 +138,19 @@ void PrimitiveContainerStreamingService::read( const coral::Blob& blobData, std::vector< void* > args( 2 ); // call container.end() - Reflex::Type retType = endMethod.TypeOf().ReturnType(); - char* retbuf = ::new char[retType.SizeOf()]; - Reflex::Object ret(retType, retbuf); - endMethod.Invoke(containerObject, &ret); - args[0] = ret.Address(); + edm::TypeWithDict retType = endMethod.finalReturnType(); + char* retbuf = ::new char[retType.size()]; + edm::ObjectWithDict ret(retType, retbuf); + endMethod.invoke(containerObject, &ret); + args[0] = ret.address(); // delete [] retbuf; // call container.insert( container.end(), data ) args[1] = const_cast( startingAddress ); - insertMethod.Invoke( containerObject, 0, args ); + insertMethod.invoke( containerObject, 0, args ); // this is required! (as it was in Reflect). - iteratorType.Destruct( args[0] ); + iteratorType.destruct( args[0] ); const char* cstartingAddress = static_cast( startingAddress ); cstartingAddress += elementSize; diff --git a/CondCore/Utilities/bin/cmscond_2XML.cpp b/CondCore/Utilities/bin/cmscond_2XML.cpp index 8e665fb51431b..79aee0dd7d6c0 100644 --- a/CondCore/Utilities/bin/cmscond_2XML.cpp +++ b/CondCore/Utilities/bin/cmscond_2XML.cpp @@ -16,7 +16,6 @@ #include #include #include "TFile.h" -#include "Cintex/Cintex.h" namespace cond { class XMLUtilities : public Utilities { @@ -114,8 +113,6 @@ cond::XMLUtilities::XMLUtilities():Utilities("cmscond_2XML"){ addOption("beginTime","b","begin time (first since) (optional)"); addOption("endTime","e","end time (last till) (optional)"); addOption("tag","t","list info of the specified tag"); - - ROOT::Cintex::Cintex::Enable(); } cond::XMLUtilities::~XMLUtilities(){ diff --git a/CondCore/Utilities/bin/cmscond_list_iov.cpp b/CondCore/Utilities/bin/cmscond_list_iov.cpp index 165d34a0a242b..2563d8720887b 100644 --- a/CondCore/Utilities/bin/cmscond_list_iov.cpp +++ b/CondCore/Utilities/bin/cmscond_list_iov.cpp @@ -18,7 +18,6 @@ #include #include #include "TFile.h" -#include "Cintex/Cintex.h" namespace cond { class ListIOVUtilities : public Utilities { @@ -117,8 +116,6 @@ cond::ListIOVUtilities::ListIOVUtilities():Utilities("cmscond_list_iov"){ addOption("outputfile","o","dump iov content for loading"); addOption("tag","t","list info of the specified tag"); - ROOT::Cintex::Cintex::Enable(); - } cond::ListIOVUtilities::~ListIOVUtilities(){ diff --git a/CondCore/Utilities/bin/conddb_migrate.cpp b/CondCore/Utilities/bin/conddb_migrate.cpp index f6422f670a4c7..7528e8f94d09e 100644 --- a/CondCore/Utilities/bin/conddb_migrate.cpp +++ b/CondCore/Utilities/bin/conddb_migrate.cpp @@ -16,7 +16,8 @@ #include "CondCore/Utilities/interface/CondDBTools.h" #include -#include "Cintex/Cintex.h" +// for the xml dump +#include "TFile.h" #include namespace cond { @@ -35,10 +36,7 @@ cond::MigrateUtilities::MigrateUtilities():Utilities("conddb_migrate"){ addConnectOption("destConnect","d","destionation connection string(required)"); addAuthenticationOptions(); addOption("tag","t","migrate only the tag (optional)"); - addOption("replace","r","replace the tag already migrated (optional)"); - addOption("fast","f","fast run without validation (optional)"); - addOption("log","l","log connection string (required"); - ROOT::Cintex::Cintex::Enable(); + addOption("newTag","n","name for the destination tag (optional)"); } cond::MigrateUtilities::~MigrateUtilities(){ diff --git a/CondCore/Utilities/bin/conddb_migrate_gt.cpp b/CondCore/Utilities/bin/conddb_migrate_gt.cpp index 2937794a4b520..f670eeb8c43b7 100644 --- a/CondCore/Utilities/bin/conddb_migrate_gt.cpp +++ b/CondCore/Utilities/bin/conddb_migrate_gt.cpp @@ -27,11 +27,8 @@ #include "CoralBase/Attribute.h" #include "CoralBase/AttributeList.h" -#include - // for the xml dump #include "TFile.h" -#include "Cintex/Cintex.h" #include #include #include diff --git a/CondCore/Utilities/bin/conddb_validate.cpp b/CondCore/Utilities/bin/conddb_validate.cpp index 88cac6f4de5d9..3255657358f23 100644 --- a/CondCore/Utilities/bin/conddb_validate.cpp +++ b/CondCore/Utilities/bin/conddb_validate.cpp @@ -16,7 +16,8 @@ #include "CondCore/Utilities/interface/CondDBTools.h" #include -#include "Cintex/Cintex.h" +// for the xml dump +#include "TFile.h" #include namespace cond { @@ -34,8 +35,8 @@ cond::ValidateUtilities::ValidateUtilities():Utilities("conddb_validate2"){ addConnectOption("sourceConnect","s","source connection string(required)"); addConnectOption("destConnect","d","destionation connection string(required)"); addAuthenticationOptions(); - addOption("tag","t","validate only the tag (optional)"); - ROOT::Cintex::Cintex::Enable(); + addOption("tag","t","migrate only the tag (optional)"); + addOption("dir","d","tmp folder to dump the temporary files for the comparison (optional)"); } cond::ValidateUtilities::~ValidateUtilities(){ diff --git a/CondCore/Utilities/interface/PayLoadInspector.h b/CondCore/Utilities/interface/PayLoadInspector.h index 4bbac1adeb5dd..aa2953a886d02 100644 --- a/CondCore/Utilities/interface/PayLoadInspector.h +++ b/CondCore/Utilities/interface/PayLoadInspector.h @@ -5,7 +5,6 @@ #include "CondCore/DBCommon/interface/DbSession.h" #include "CondCore/Utilities/interface/CondPyInterface.h" #include "TFile.h" -#include "Cintex/Cintex.h" #include #include //#include @@ -75,7 +74,6 @@ namespace cond { } PayLoadInspector(cond::CondDB const & conddb): m_session(conddb.session()), m_since(cond::invalidTime), m_token("") { - ROOT::Cintex::Cintex::Enable(); } std::string dumpXML(std::string filename) const { diff --git a/CondFormats/BTauObjects/src/BTagCalibration.cc b/CondFormats/BTauObjects/src/BTagCalibration.cc index 3ffe64118473c..fc3f24295a4ad 100644 --- a/CondFormats/BTauObjects/src/BTagCalibration.cc +++ b/CondFormats/BTauObjects/src/BTagCalibration.cc @@ -60,7 +60,7 @@ void BTagCalibration::readCSV(std::istream &s) } } -void BTagCalibration::makeCSV(ostream &s) const +void BTagCalibration::makeCSV(std::ostream &s) const { s << tagger_ << ";" << BTagEntry::makeCSVHeader(); for (std::map >::const_iterator i diff --git a/CondFormats/BTauObjects/src/BTagEntry.cc b/CondFormats/BTauObjects/src/BTagEntry.cc index e21304baadf25..56c240e287cfa 100644 --- a/CondFormats/BTauObjects/src/BTagEntry.cc +++ b/CondFormats/BTauObjects/src/BTagEntry.cc @@ -124,7 +124,7 @@ BTagEntry::BTagEntry(const TF1* func, BTagEntry::Parameters p): // e.g. "x<0 ? 1 : x<1 ? 2 : x<2 ? 3 : 4" std::string th1ToFormulaLin(const TH1* hist) { int nbins = hist->GetNbinsX(); - TAxis * axis = hist->GetXaxis(); + TAxis const* axis = hist->GetXaxis(); std::stringstream buff; buff << "x<" << axis->GetBinLowEdge(1) << " ? 0. : "; // default value for (int i=1; iGetNbinsX(); - TAxis * axis = hist->GetXaxis(); + TAxis const* axis = hist->GetXaxis(); // overwrite bounds with histo values if (params.operatingPoint == BTagEntry::OP_RESHAPING) { diff --git a/CondFormats/PhysicsToolsObjects/interface/MVAComputer.h b/CondFormats/PhysicsToolsObjects/interface/MVAComputer.h index 8d656cd816dab..3897fe79259fc 100644 --- a/CondFormats/PhysicsToolsObjects/interface/MVAComputer.h +++ b/CondFormats/PhysicsToolsObjects/interface/MVAComputer.h @@ -55,9 +55,7 @@ class VarProcessor { virtual ~VarProcessor() {} virtual std::string getInstanceName() const; -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif COND_SERIALIZABLE; }; @@ -77,9 +75,7 @@ class Variable { class ProcOptional : public VarProcessor { public: -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif std::vector neutralPos; COND_SERIALIZABLE; @@ -87,17 +83,13 @@ class ProcOptional : public VarProcessor { class ProcCount : public VarProcessor { public: -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif COND_SERIALIZABLE; }; class ProcClassed : public VarProcessor { public: -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif unsigned int nClasses; COND_SERIALIZABLE; @@ -105,9 +97,7 @@ class ProcClassed : public VarProcessor { class ProcSplitter : public VarProcessor { public: -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif unsigned int nFirst; COND_SERIALIZABLE; @@ -115,9 +105,7 @@ class ProcSplitter : public VarProcessor { class ProcForeach : public VarProcessor { public: -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif unsigned int nProcs; COND_SERIALIZABLE; @@ -125,9 +113,7 @@ class ProcForeach : public VarProcessor { class ProcSort : public VarProcessor { public: -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif unsigned int sortByIndex; bool descending; @@ -136,9 +122,7 @@ class ProcSort : public VarProcessor { class ProcCategory : public VarProcessor { public: -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif typedef std::vector BinLimits; std::vector variableBinLimits; @@ -149,9 +133,7 @@ class ProcCategory : public VarProcessor { class ProcNormalize : public VarProcessor { public: -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif std::vector distr; int categoryIdx; @@ -160,9 +142,7 @@ class ProcNormalize : public VarProcessor { class ProcLikelihood : public VarProcessor { public: -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif class SigBkg { public: HistogramF background; @@ -185,9 +165,7 @@ class ProcLikelihood : public VarProcessor { class ProcLinear : public VarProcessor { public: -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif std::vector coeffs; double offset; @@ -196,9 +174,7 @@ class ProcLinear : public VarProcessor { class ProcMultiply : public VarProcessor { public: -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif typedef std::vector Config; unsigned int in; @@ -209,9 +185,7 @@ class ProcMultiply : public VarProcessor { class ProcMatrix : public VarProcessor { public: -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif Matrix matrix; COND_SERIALIZABLE; @@ -219,9 +193,7 @@ class ProcMatrix : public VarProcessor { class ProcExternal : public VarProcessor { public: -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif virtual std::string getInstanceName() const; std::string method; @@ -232,9 +204,7 @@ class ProcExternal : public VarProcessor { class ProcMLP : public VarProcessor { public: -#ifndef __GCCXML__ virtual std::unique_ptr clone() const; -#endif typedef std::pair > Neuron; typedef std::pair, bool> Layer; diff --git a/CondFormats/SiStripObjects/src/classes_def.xml b/CondFormats/SiStripObjects/src/classes_def.xml index 86a78a87ae20c..27ff1ee58e235 100644 --- a/CondFormats/SiStripObjects/src/classes_def.xml +++ b/CondFormats/SiStripObjects/src/classes_def.xml @@ -95,7 +95,7 @@ - + diff --git a/DQM/SiStripCommissioningAnalysis/src/SiStripPulseShape.cc b/DQM/SiStripCommissioningAnalysis/src/SiStripPulseShape.cc index f8293178832bf..ecfd91018f09f 100644 --- a/DQM/SiStripCommissioningAnalysis/src/SiStripPulseShape.cc +++ b/DQM/SiStripCommissioningAnalysis/src/SiStripPulseShape.cc @@ -19,7 +19,7 @@ double fdeconv(double *x, double *par) double fpeak_convoluted(double *x, double *par) { TF1 f("peak_convoluted",fpeak,0,200,4); - return f.Integral(x[0]-par[4]/2.,x[0]+par[4]/2.,par,1.)/(par[4]); + return f.IntegralError(x[0]-par[4]/2.,x[0]+par[4]/2.,par,0,1.)/(par[4]); } double fdeconv_convoluted(double *x, double *par) diff --git a/DQM/SiStripMonitorClient/bin/BuildFile.xml b/DQM/SiStripMonitorClient/bin/BuildFile.xml index 29e7feb65a05f..f34d2f0b60dcb 100644 --- a/DQM/SiStripMonitorClient/bin/BuildFile.xml +++ b/DQM/SiStripMonitorClient/bin/BuildFile.xml @@ -1,4 +1,5 @@ + diff --git a/DQMOffline/Trigger/interface/HLTMuonMatchAndPlot.h b/DQMOffline/Trigger/interface/HLTMuonMatchAndPlot.h index 96d8931ec5f5c..b228fc997bf1c 100755 --- a/DQMOffline/Trigger/interface/HLTMuonMatchAndPlot.h +++ b/DQMOffline/Trigger/interface/HLTMuonMatchAndPlot.h @@ -92,10 +92,12 @@ class HLTMuonMatchAndPlot bool, const StringCutObjectSelector &, double, double); + trigger::TriggerObjectCollection selectedTriggerObjects( const trigger::TriggerObjectCollection &, const trigger::TriggerEvent &, - const edm::ParameterSet &); + bool hasTriggerCuts, + const StringCutObjectSelector triggerSelector); // Input from Configuration File std::string hltProcessName_; @@ -124,6 +126,9 @@ class HLTMuonMatchAndPlot double probeZ0Cut_; double probeD0Cut_; + StringCutObjectSelector triggerSelector_; + bool hasTriggerCuts_; + }; #endif diff --git a/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc b/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc index 5e3c9bd69f145..4c9436e64c7ba 100644 --- a/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc +++ b/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc @@ -48,9 +48,10 @@ HLTMuonMatchAndPlot::HLTMuonMatchAndPlot(const ParameterSet & pset, targetD0Cut_(targetParams_.getUntrackedParameter("d0Cut",0.)), probeMuonSelector_(probeParams_.getUntrackedParameter("recoCuts", "")), probeZ0Cut_(probeParams_.getUntrackedParameter("z0Cut",0.)), - probeD0Cut_(probeParams_.getUntrackedParameter("d0Cut",0.)) + probeD0Cut_(probeParams_.getUntrackedParameter("d0Cut",0.)), + triggerSelector_(targetParams_.getUntrackedParameter("hltCuts","")), + hasTriggerCuts_(targetParams_.exists("hltCuts")) { - // Create std::map from ParameterSets. fillMapFromPSet(binParams_, pset, "binParams"); fillMapFromPSet(plotCuts_, pset, "plotCuts"); @@ -204,12 +205,13 @@ void HLTMuonMatchAndPlot::analyze(Handle & allMuons, return; } + // Select objects based on the configuration. MuonCollection targetMuons = selectedMuons(* allMuons, * beamSpot, hasTargetRecoCuts, targetMuonSelector_, targetD0Cut_, targetZ0Cut_); MuonCollection probeMuons = selectedMuons(* allMuons, * beamSpot, hasProbeRecoCuts, probeMuonSelector_, probeD0Cut_, probeZ0Cut_); TriggerObjectCollection allTriggerObjects = triggerSummary->getObjects(); TriggerObjectCollection hltMuons = - selectedTriggerObjects(allTriggerObjects, * triggerSummary, targetParams_); + selectedTriggerObjects(allTriggerObjects, * triggerSummary, hasTriggerCuts_,triggerSelector_); // Fill plots for HLT muons. for (size_t i = 0; i < hltMuons.size(); i++) { @@ -475,15 +477,10 @@ TriggerObjectCollection HLTMuonMatchAndPlot::selectedTriggerObjects( const TriggerObjectCollection & triggerObjects, const TriggerEvent & triggerSummary, - const ParameterSet & pset) + bool hasTriggerCuts, + const StringCutObjectSelector triggerSelector) { - - // If pset is empty, return an empty collection. - if (!pset.exists("hltCuts")) - return TriggerObjectCollection(); - - StringCutObjectSelector selector - (pset.getUntrackedParameter("hltCuts")); + if ( !hasTriggerCuts) return TriggerObjectCollection(); InputTag filterTag(moduleLabels_[moduleLabels_.size() - 1], "", hltProcessName_); @@ -495,7 +492,7 @@ HLTMuonMatchAndPlot::selectedTriggerObjects( const Keys &keys = triggerSummary.filterKeys(filterIndex); for (size_t j = 0; j < keys.size(); j++ ){ TriggerObject foundObject = triggerObjects[keys[j]]; - if (selector(foundObject)) + if (triggerSelector(foundObject)) selectedObjects.push_back(foundObject); } } diff --git a/DataFormats/BTauReco/src/classes_def.xml b/DataFormats/BTauReco/src/classes_def.xml index 6d27f63f001d1..12b1f5623dad9 100644 --- a/DataFormats/BTauReco/src/classes_def.xml +++ b/DataFormats/BTauReco/src/classes_def.xml @@ -32,7 +32,7 @@ - + diff --git a/DataFormats/BeamSpot/src/classes_def.xml b/DataFormats/BeamSpot/src/classes_def.xml index aea8807bf4318..9c99903ae8bd4 100644 --- a/DataFormats/BeamSpot/src/classes_def.xml +++ b/DataFormats/BeamSpot/src/classes_def.xml @@ -1,5 +1,5 @@ - + diff --git a/DataFormats/CSCDigi/src/classes_def.xml b/DataFormats/CSCDigi/src/classes_def.xml index 2a422a7d3f1d3..282299c92a82e 100644 --- a/DataFormats/CSCDigi/src/classes_def.xml +++ b/DataFormats/CSCDigi/src/classes_def.xml @@ -73,6 +73,23 @@ + + + + + + + + + + + + + + + + + diff --git a/DataFormats/CSCRecHit/src/classes_def.xml b/DataFormats/CSCRecHit/src/classes_def.xml index fef23c0b96cdf..30f3aea4a1a20 100644 --- a/DataFormats/CSCRecHit/src/classes_def.xml +++ b/DataFormats/CSCRecHit/src/classes_def.xml @@ -11,7 +11,10 @@ + + + @@ -23,6 +26,7 @@ + diff --git a/DataFormats/CaloRecHit/src/classes_def.xml b/DataFormats/CaloRecHit/src/classes_def.xml index 896798d013d65..dd6174f965605 100644 --- a/DataFormats/CaloRecHit/src/classes_def.xml +++ b/DataFormats/CaloRecHit/src/classes_def.xml @@ -2,7 +2,7 @@ - + diff --git a/DataFormats/Candidate/src/classes_def.xml b/DataFormats/Candidate/src/classes_def.xml index d6a080c9ff962..6030fb50b79b1 100644 --- a/DataFormats/Candidate/src/classes_def.xml +++ b/DataFormats/Candidate/src/classes_def.xml @@ -49,19 +49,19 @@ - + - + - + @@ -101,7 +101,7 @@ - + diff --git a/DataFormats/Candidate/test/testParticle.cc b/DataFormats/Candidate/test/testParticle.cc index 5191576c97d7a..f75d183656115 100755 --- a/DataFormats/Candidate/test/testParticle.cc +++ b/DataFormats/Candidate/test/testParticle.cc @@ -2,7 +2,6 @@ #include "DataFormats/Candidate/interface/Particle.h" #include "TBufferFile.h" #include "TClass.h" -#include "Cintex/Cintex.h" #include class testParticle : public CppUnit::TestFixture { @@ -16,11 +15,6 @@ class testParticle : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE_END(); public: void setUp() { - static bool cintexInitialized = false; - if (!cintexInitialized) { - cintexInitialized = true; - ROOT::Cintex::Cintex::Enable(); - } } void tearDown() {} void checkXYZ(); diff --git a/DataFormats/Common/interface/BasicHandle.h b/DataFormats/Common/interface/BasicHandle.h index 5e00e7be688bd..260a6cc282af2 100644 --- a/DataFormats/Common/interface/BasicHandle.h +++ b/DataFormats/Common/interface/BasicHandle.h @@ -32,7 +32,6 @@ If failedToGet() returns false but isValid() is also false then no attempt #include "FWCore/Utilities/interface/GCC11Compatibility.h" #include -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" namespace cms { class Exception; diff --git a/DataFormats/Common/interface/DetSetLazyVector.h b/DataFormats/Common/interface/DetSetLazyVector.h index ba17c58606670..264cbd4e198f5 100644 --- a/DataFormats/Common/interface/DetSetLazyVector.h +++ b/DataFormats/Common/interface/DetSetLazyVector.h @@ -36,7 +36,6 @@ to be returned, *not* the ordinal number of the T to be returned. #include "DataFormats/Common/interface/DetSet.h" #include "FWCore/Utilities/interface/EDMException.h" #include "DataFormats/Common/interface/Ref.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" namespace edm { diff --git a/DataFormats/Common/interface/DetSetVectorNew.h b/DataFormats/Common/interface/DetSetVectorNew.h index 2f79f1c773070..7ae5f8762fbb7 100644 --- a/DataFormats/Common/interface/DetSetVectorNew.h +++ b/DataFormats/Common/interface/DetSetVectorNew.h @@ -12,7 +12,6 @@ #include #include #include "FWCore/Utilities/interface/GCC11Compatibility.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" #include @@ -405,7 +404,10 @@ namespace edmNew { int m_subdetId; - IdContainer m_ids; + // Workaround for ROOT 6 bug. + // ROOT6 has a problem with this IdContainer typedef + //IdContainer m_ids; + std::vector m_ids; DataContainer m_data; }; diff --git a/DataFormats/Common/interface/EDProductGetter.h b/DataFormats/Common/interface/EDProductGetter.h index 5d952a0d72ebb..0a9d81fff7d04 100644 --- a/DataFormats/Common/interface/EDProductGetter.h +++ b/DataFormats/Common/interface/EDProductGetter.h @@ -31,13 +31,17 @@ namespace edm { class ProductID; class WrapperBase; - class EDProductGetter : private boost::noncopyable { + class EDProductGetter { public: EDProductGetter(); virtual ~EDProductGetter(); + EDProductGetter(EDProductGetter const&) = delete; // stop default + + EDProductGetter const& operator=(EDProductGetter const&) = delete; // stop default + // ---------- const member functions --------------------- virtual WrapperBase const* getIt(ProductID const&) const = 0; diff --git a/DataFormats/Common/interface/EDProductfwd.h b/DataFormats/Common/interface/EDProductfwd.h index e9837759bae1e..163f3bdc38bac 100644 --- a/DataFormats/Common/interface/EDProductfwd.h +++ b/DataFormats/Common/interface/EDProductfwd.h @@ -8,8 +8,6 @@ Forward declarations of types in the EDM. ----------------------------------------------------------------------*/ #include -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" - namespace edm { class BasicHandle; diff --git a/DataFormats/Common/interface/HandleBase.h b/DataFormats/Common/interface/HandleBase.h index 9b8e7db7ce2fe..695dcae1dcbee 100644 --- a/DataFormats/Common/interface/HandleBase.h +++ b/DataFormats/Common/interface/HandleBase.h @@ -33,7 +33,6 @@ If failedToGet() returns false but isValid() is also false then no attempt #include -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" namespace cms { class Exception; diff --git a/DataFormats/Common/interface/HandleExceptionFactory.h b/DataFormats/Common/interface/HandleExceptionFactory.h index af8d06dbd8b2c..120a7714fbe13 100644 --- a/DataFormats/Common/interface/HandleExceptionFactory.h +++ b/DataFormats/Common/interface/HandleExceptionFactory.h @@ -26,7 +26,6 @@ // system include files #include -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" // user include files diff --git a/DataFormats/Common/interface/IndirectHolder.h b/DataFormats/Common/interface/IndirectHolder.h index 7d9da298e3871..758995ae7c914 100644 --- a/DataFormats/Common/interface/IndirectHolder.h +++ b/DataFormats/Common/interface/IndirectHolder.h @@ -4,7 +4,6 @@ #include "DataFormats/Common/interface/BaseHolder.h" #include "DataFormats/Common/interface/RefHolderBase.h" #include "DataFormats/Provenance/interface/ProductID.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" #include diff --git a/DataFormats/Common/interface/IndirectVectorHolder.h b/DataFormats/Common/interface/IndirectVectorHolder.h index 7f4ce2a66fc12..6f31d15c23222 100644 --- a/DataFormats/Common/interface/IndirectVectorHolder.h +++ b/DataFormats/Common/interface/IndirectVectorHolder.h @@ -5,7 +5,6 @@ #include "DataFormats/Common/interface/RefVectorHolderBase.h" #include "DataFormats/Common/interface/IndirectHolder.h" #include -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" namespace edm { namespace reftobase { diff --git a/DataFormats/Common/interface/MultiAssociation.h b/DataFormats/Common/interface/MultiAssociation.h index ef666b661bf8c..8584e5fdce8b7 100644 --- a/DataFormats/Common/interface/MultiAssociation.h +++ b/DataFormats/Common/interface/MultiAssociation.h @@ -56,7 +56,6 @@ #include "DataFormats/Common/interface/CMS_CLASS_VERSION.h" #include "DataFormats/Provenance/interface/ProductID.h" #include "FWCore/Utilities/interface/GCC11Compatibility.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" namespace edm { namespace helper { diff --git a/DataFormats/Common/interface/RefToBase.h b/DataFormats/Common/interface/RefToBase.h index cfbe046d9ee89..bd3216dcb8fd1 100644 --- a/DataFormats/Common/interface/RefToBase.h +++ b/DataFormats/Common/interface/RefToBase.h @@ -46,7 +46,6 @@ reference type. #include "DataFormats/Common/interface/Holder.h" #include "DataFormats/Common/interface/IndirectHolder.h" #include "DataFormats/Common/interface/RefHolder.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" namespace edm { //-------------------------------------------------------------------- diff --git a/DataFormats/Common/interface/RefToBaseVector.h b/DataFormats/Common/interface/RefToBaseVector.h index 3556ae8bfab4b..e8c45a00487e7 100644 --- a/DataFormats/Common/interface/RefToBaseVector.h +++ b/DataFormats/Common/interface/RefToBaseVector.h @@ -9,7 +9,6 @@ #include "DataFormats/Provenance/interface/ProductID.h" #include #include -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" namespace edm { template class RefToBase; diff --git a/DataFormats/Common/interface/RefVector.h b/DataFormats/Common/interface/RefVector.h index f5af8dd7cd63d..8d313e486278e 100644 --- a/DataFormats/Common/interface/RefVector.h +++ b/DataFormats/Common/interface/RefVector.h @@ -151,7 +151,7 @@ namespace edm { helper_vector& helpers) const; //Needed for ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(11) private: contents_type refVector_; }; diff --git a/DataFormats/Common/interface/RefVectorBase.h b/DataFormats/Common/interface/RefVectorBase.h index 15bf7705d5dc3..e3a984b6ac617 100644 --- a/DataFormats/Common/interface/RefVectorBase.h +++ b/DataFormats/Common/interface/RefVectorBase.h @@ -92,7 +92,7 @@ namespace edm { #endif //Needed for ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(11) private: RefCore product_; diff --git a/DataFormats/Common/interface/RefVectorHolder.h b/DataFormats/Common/interface/RefVectorHolder.h index bcdcd10612ed5..2fb0c7032de34 100644 --- a/DataFormats/Common/interface/RefVectorHolder.h +++ b/DataFormats/Common/interface/RefVectorHolder.h @@ -5,7 +5,6 @@ #include "DataFormats/Common/interface/RefVectorHolderBase.h" #include "FWCore/Utilities/interface/EDMException.h" #include "DataFormats/Provenance/interface/ProductID.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" namespace edm { namespace reftobase { diff --git a/DataFormats/Common/interface/RefVectorHolderBase.h b/DataFormats/Common/interface/RefVectorHolderBase.h index c877511e94786..229bc5c38a804 100644 --- a/DataFormats/Common/interface/RefVectorHolderBase.h +++ b/DataFormats/Common/interface/RefVectorHolderBase.h @@ -3,7 +3,6 @@ #include "DataFormats/Common/interface/RefHolderBase.h" #include "FWCore/Utilities/interface/EDMException.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" #include diff --git a/DataFormats/Common/src/classes_def.xml b/DataFormats/Common/src/classes_def.xml index 6a4fffbfcada4..78473cb8bd506 100644 --- a/DataFormats/Common/src/classes_def.xml +++ b/DataFormats/Common/src/classes_def.xml @@ -4,7 +4,7 @@ - + @@ -88,7 +88,7 @@ - + diff --git a/DataFormats/Common/test/BuildFile.xml b/DataFormats/Common/test/BuildFile.xml index 74cdcd67cc082..c6994a7d6daff 100644 --- a/DataFormats/Common/test/BuildFile.xml +++ b/DataFormats/Common/test/BuildFile.xml @@ -1,7 +1,7 @@ - + diff --git a/DataFormats/Common/test/DictionaryTools_t.cpp b/DataFormats/Common/test/DictionaryTools_t.cpp index e0ffd2e92a38e..8f31c0ac78d77 100644 --- a/DataFormats/Common/test/DictionaryTools_t.cpp +++ b/DataFormats/Common/test/DictionaryTools_t.cpp @@ -10,8 +10,6 @@ #include "cppunit/extensions/HelperMacros.h" -#include "Cintex/Cintex.h" - #include #include #include @@ -27,7 +25,7 @@ class TestDictionaries: public CppUnit::TestFixture { public: TestDictionaries() {} ~TestDictionaries() {} - void setUp() {ROOT::Cintex::Cintex::Enable();} + void setUp() {} void tearDown() {} void default_is_invalid(); @@ -85,6 +83,7 @@ namespace { checkIt >(); checkIt > >(); checkIt(); + checkIt(); } } diff --git a/DataFormats/Common/test/ptr_t.cppunit.cc b/DataFormats/Common/test/ptr_t.cppunit.cc index 8551a081d2017..a0fc4d9156fa6 100644 --- a/DataFormats/Common/test/ptr_t.cppunit.cc +++ b/DataFormats/Common/test/ptr_t.cppunit.cc @@ -22,8 +22,6 @@ #include "DataFormats/Common/interface/IntValues.h" #include -#include "Cintex/Cintex.h" - using namespace edm; using namespace test_with_dictionaries; @@ -36,7 +34,7 @@ class testPtr: public CppUnit::TestFixture { CPPUNIT_TEST_SUITE_END(); public: - void setUp(){ROOT::Cintex::Cintex::Enable();} + void setUp(){} void tearDown(){} void constructTest(); diff --git a/DataFormats/DTDigi/src/classes_def.xml b/DataFormats/DTDigi/src/classes_def.xml index 03f896d21178e..f7e9d13d5e2f9 100644 --- a/DataFormats/DTDigi/src/classes_def.xml +++ b/DataFormats/DTDigi/src/classes_def.xml @@ -4,6 +4,7 @@ + @@ -12,6 +13,7 @@ + diff --git a/DataFormats/DTRecHit/src/classes_def.xml b/DataFormats/DTRecHit/src/classes_def.xml index 3c85bdfd67c6e..18dbbd42c3364 100644 --- a/DataFormats/DTRecHit/src/classes_def.xml +++ b/DataFormats/DTRecHit/src/classes_def.xml @@ -1,6 +1,6 @@ - + @@ -11,8 +11,11 @@ + + + @@ -43,15 +46,18 @@ - + + + + diff --git a/DataFormats/DetId/BuildFile.xml b/DataFormats/DetId/BuildFile.xml index f153484c89cca..84a7030b182f2 100644 --- a/DataFormats/DetId/BuildFile.xml +++ b/DataFormats/DetId/BuildFile.xml @@ -1,5 +1,5 @@ - + diff --git a/DataFormats/EgammaCandidates/src/classes_def.xml b/DataFormats/EgammaCandidates/src/classes_def.xml index a3357520c23dc..4ad0c39bb7225 100644 --- a/DataFormats/EgammaCandidates/src/classes_def.xml +++ b/DataFormats/EgammaCandidates/src/classes_def.xml @@ -54,7 +54,7 @@ - + @@ -166,7 +166,7 @@ - + @@ -219,7 +219,7 @@ - + diff --git a/DataFormats/EgammaReco/src/classes_def.xml b/DataFormats/EgammaReco/src/classes_def.xml index ce8bfecc9a600..83988dc33baaa 100644 --- a/DataFormats/EgammaReco/src/classes_def.xml +++ b/DataFormats/EgammaReco/src/classes_def.xml @@ -17,7 +17,7 @@ - + @@ -35,7 +35,7 @@ - + @@ -86,7 +86,7 @@ - + @@ -104,7 +104,7 @@ - + diff --git a/DataFormats/FEDRawData/BuildFile.xml b/DataFormats/FEDRawData/BuildFile.xml index 4ac1a9bdd716e..48f03d75dbe31 100644 --- a/DataFormats/FEDRawData/BuildFile.xml +++ b/DataFormats/FEDRawData/BuildFile.xml @@ -1,6 +1,5 @@ - diff --git a/DataFormats/FEDRawData/src/classes_def.xml b/DataFormats/FEDRawData/src/classes_def.xml index db756b085f687..003df79ac1f9e 100644 --- a/DataFormats/FEDRawData/src/classes_def.xml +++ b/DataFormats/FEDRawData/src/classes_def.xml @@ -8,11 +8,11 @@ - + - + diff --git a/DataFormats/FWLite/interface/ChainEvent.h b/DataFormats/FWLite/interface/ChainEvent.h index 6353b5feb6c5c..2debf7e45520c 100644 --- a/DataFormats/FWLite/interface/ChainEvent.h +++ b/DataFormats/FWLite/interface/ChainEvent.h @@ -27,7 +27,6 @@ // user include files #include "DataFormats/FWLite/interface/Event.h" #include "DataFormats/FWLite/interface/EventBase.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" // forward declarations namespace edm { diff --git a/DataFormats/FWLite/interface/DataGetterHelper.h b/DataFormats/FWLite/interface/DataGetterHelper.h index a71957850a30d..54f3e6768dd74 100644 --- a/DataFormats/FWLite/interface/DataGetterHelper.h +++ b/DataFormats/FWLite/interface/DataGetterHelper.h @@ -35,8 +35,6 @@ #include #include -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" - // forward declarations class TTreeCache; class TTree; diff --git a/DataFormats/FWLite/interface/ESHandle.h b/DataFormats/FWLite/interface/ESHandle.h index 139df0b734c80..11f7aa5761954 100644 --- a/DataFormats/FWLite/interface/ESHandle.h +++ b/DataFormats/FWLite/interface/ESHandle.h @@ -25,7 +25,6 @@ // user include files #include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" // forward declarations namespace fwlite { diff --git a/DataFormats/FWLite/interface/Event.h b/DataFormats/FWLite/interface/Event.h index ea526e70b3a07..9fa9f28a20431 100644 --- a/DataFormats/FWLite/interface/Event.h +++ b/DataFormats/FWLite/interface/Event.h @@ -62,7 +62,6 @@ #include "DataFormats/Provenance/interface/EventProcessHistoryID.h" #include "DataFormats/Provenance/interface/EventAuxiliary.h" #include "DataFormats/Provenance/interface/EventID.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" // forward declarations namespace edm { diff --git a/DataFormats/FWLite/interface/InternalDataKey.h b/DataFormats/FWLite/interface/InternalDataKey.h index b4d53c576002c..c0a2274e19781 100644 --- a/DataFormats/FWLite/interface/InternalDataKey.h +++ b/DataFormats/FWLite/interface/InternalDataKey.h @@ -86,7 +86,7 @@ namespace fwlite { edm::WrapperBase const* pProd_; // WrapperBase of the wrapped object ~Data() { - obj_.typeOf().destruct(obj_.address(), true); + obj_.destruct(true); } }; diff --git a/DataFormats/FWLite/interface/LuminosityBlock.h b/DataFormats/FWLite/interface/LuminosityBlock.h index eb5fbae4cc41f..a630e8aed95e0 100644 --- a/DataFormats/FWLite/interface/LuminosityBlock.h +++ b/DataFormats/FWLite/interface/LuminosityBlock.h @@ -34,7 +34,6 @@ #include "DataFormats/FWLite/interface/EntryFinder.h" #include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h" #include "DataFormats/Provenance/interface/LuminosityBlockAuxiliary.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" // forward declarations namespace edm { diff --git a/DataFormats/FWLite/interface/MultiChainEvent.h b/DataFormats/FWLite/interface/MultiChainEvent.h index 5b39dcb1df9bb..0cbb73f1dead0 100644 --- a/DataFormats/FWLite/interface/MultiChainEvent.h +++ b/DataFormats/FWLite/interface/MultiChainEvent.h @@ -27,7 +27,6 @@ // user include files #include "DataFormats/FWLite/interface/EventBase.h" #include "DataFormats/FWLite/interface/ChainEvent.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" // forward declarations namespace edm { diff --git a/DataFormats/FWLite/interface/Run.h b/DataFormats/FWLite/interface/Run.h index addbeb584b6f7..6da993f1e4ab5 100644 --- a/DataFormats/FWLite/interface/Run.h +++ b/DataFormats/FWLite/interface/Run.h @@ -36,7 +36,6 @@ #include "DataFormats/Provenance/interface/RunID.h" #include "FWCore/FWLite/interface/BranchMapReader.h" #include "DataFormats/FWLite/interface/DataGetterHelper.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" // forward declarations namespace edm { diff --git a/DataFormats/FWLite/interface/RunFactory.h b/DataFormats/FWLite/interface/RunFactory.h index bf698ba767f58..a5eda1b509425 100644 --- a/DataFormats/FWLite/interface/RunFactory.h +++ b/DataFormats/FWLite/interface/RunFactory.h @@ -23,7 +23,6 @@ #include #include "DataFormats/FWLite/interface/Run.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" namespace fwlite { class RunFactory { diff --git a/DataFormats/FWLite/python/__init__.py b/DataFormats/FWLite/python/__init__.py index 29886e326506a..d86c8ffa92e7b 100644 --- a/DataFormats/FWLite/python/__init__.py +++ b/DataFormats/FWLite/python/__init__.py @@ -60,6 +60,7 @@ def __init__ (self, if kwargs.get ('noDelete'): print "Not deleting wrapper" del kwargs['noDelete'] + else: self._nodel = True self._type = typeString self._resetWrapper() @@ -102,7 +103,7 @@ def _resetWrapper (self): # So, we've created it and grabbed the type info. Since we # don't want a memory leak, we destroy it. if not self._nodel : - self._wrapper.IsA().Destructor( self._wrapper ) + ROOT.TClass.GetClass("edm::Wrapper<"+self._type+">").Destructor( self._wrapper ) def _typeInfoGetter (self): """(Internal) Return the type info""" diff --git a/DataFormats/FWLite/src/Record.cc b/DataFormats/FWLite/src/Record.cc index 789a200bb4319..d512b354d11f9 100644 --- a/DataFormats/FWLite/src/Record.cc +++ b/DataFormats/FWLite/src/Record.cc @@ -183,7 +183,7 @@ Record::get(const edm::TypeID& iType, std::pair& branch = m_branches[std::make_pair(iType,iLabel)]; if(0==branch.first){ branch.second=0; - if(!edm::TypeWithDict(iType.typeInfo()).hasDictionary()){ + if(!edm::hasDictionary(iType.typeInfo())){ returnValue = new cms::Exception("UnknownType"); (*returnValue)<<"The type " < #include -#include "Cintex/Cintex.h" #include "TFile.h" #include @@ -44,7 +43,6 @@ bool testRecord::s_firstSetup =true; void testRecord::setUp() { if( s_firstSetup) { - ROOT::Cintex::Cintex::Enable(); s_firstSetup = false; //create the test file diff --git a/DataFormats/GsfTrackReco/src/classes_def.xml b/DataFormats/GsfTrackReco/src/classes_def.xml index a08d273e2cd3b..3947c444aae3d 100644 --- a/DataFormats/GsfTrackReco/src/classes_def.xml +++ b/DataFormats/GsfTrackReco/src/classes_def.xml @@ -4,7 +4,7 @@ - + @@ -24,7 +24,7 @@ - + diff --git a/DataFormats/HepMCCandidate/src/classes_def.xml b/DataFormats/HepMCCandidate/src/classes_def.xml old mode 100755 new mode 100644 index a8b80c11937cb..f7525b1cb3897 --- a/DataFormats/HepMCCandidate/src/classes_def.xml +++ b/DataFormats/HepMCCandidate/src/classes_def.xml @@ -29,7 +29,7 @@ - + @@ -38,7 +38,7 @@ - + diff --git a/DataFormats/JetReco/interface/TrackExtrapolation.h b/DataFormats/JetReco/interface/TrackExtrapolation.h index 99e5dc6aa6c9e..7dea397e274af 100644 --- a/DataFormats/JetReco/interface/TrackExtrapolation.h +++ b/DataFormats/JetReco/interface/TrackExtrapolation.h @@ -20,8 +20,11 @@ namespace reco { class TrackExtrapolation { - typedef ROOT::Math::PositionVector3D > Point; - typedef ROOT::Math::DisplacementVector3D > Vector; + // Next two typedefs use double in ROOT 6 rather than Double32_t due to a bug in ROOT 5, + // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase + // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5. + typedef ROOT::Math::PositionVector3D > Point; + typedef ROOT::Math::DisplacementVector3D > Vector; public: diff --git a/DataFormats/JetReco/src/classes_def_4.xml b/DataFormats/JetReco/src/classes_def_4.xml index 1254c14c45e6b..c6dd55169373b 100644 --- a/DataFormats/JetReco/src/classes_def_4.xml +++ b/DataFormats/JetReco/src/classes_def_4.xml @@ -137,4 +137,23 @@ + + + + + + + + + + + + + + + + + + + diff --git a/DataFormats/L1GlobalCaloTrigger/src/classes_def.xml b/DataFormats/L1GlobalCaloTrigger/src/classes_def.xml index aa820a2fcc87c..6784870eef0bc 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/classes_def.xml +++ b/DataFormats/L1GlobalCaloTrigger/src/classes_def.xml @@ -5,19 +5,19 @@ - + - + - + - + diff --git a/DataFormats/L1GlobalTrigger/src/classes_def.xml b/DataFormats/L1GlobalTrigger/src/classes_def.xml index 125bf817d95cd..964d1b86e47a3 100644 --- a/DataFormats/L1GlobalTrigger/src/classes_def.xml +++ b/DataFormats/L1GlobalTrigger/src/classes_def.xml @@ -102,7 +102,7 @@ - + diff --git a/DataFormats/L1Trigger/src/classes_def.xml b/DataFormats/L1Trigger/src/classes_def.xml index 1805153038c16..86fbc65101ea3 100644 --- a/DataFormats/L1Trigger/src/classes_def.xml +++ b/DataFormats/L1Trigger/src/classes_def.xml @@ -23,7 +23,7 @@ - + @@ -48,7 +48,7 @@ - + @@ -57,13 +57,13 @@ - + - + @@ -74,13 +74,13 @@ - + - + diff --git a/DataFormats/Math/BuildFile.xml b/DataFormats/Math/BuildFile.xml index 776b2740ac222..6aa1d86287860 100644 --- a/DataFormats/Math/BuildFile.xml +++ b/DataFormats/Math/BuildFile.xml @@ -1,6 +1,5 @@ - diff --git a/DataFormats/Math/src/classes.h b/DataFormats/Math/src/classes.h index b67228118b2c3..54c318241c2b4 100755 --- a/DataFormats/Math/src/classes.h +++ b/DataFormats/Math/src/classes.h @@ -224,9 +224,6 @@ namespace DataFormats_Math { ROOT::Math::MatRepStd smdcw; ROOT::Math::MatRepStd smdcw1; - //Used by MET Significance matrix - ROOT::Math::SMatrix smat; - //Used by TauReco std::pair,ROOT::Math::DefaultCoordinateSystemTag>,float> calotti_ppf; std::vector,ROOT::Math::DefaultCoordinateSystemTag>,float> > vcalotti_ppf; diff --git a/DataFormats/Math/src/classes_def.xml b/DataFormats/Math/src/classes_def.xml index b1a90482e40fe..73c7811662edf 100755 --- a/DataFormats/Math/src/classes_def.xml +++ b/DataFormats/Math/src/classes_def.xml @@ -1,23 +1,82 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DataFormats/MuonDetId/src/classes_def.xml b/DataFormats/MuonDetId/src/classes_def.xml index da0da9d9d451e..61369e7f5716d 100644 --- a/DataFormats/MuonDetId/src/classes_def.xml +++ b/DataFormats/MuonDetId/src/classes_def.xml @@ -28,7 +28,6 @@ - diff --git a/DataFormats/MuonReco/src/classes_def.xml b/DataFormats/MuonReco/src/classes_def.xml index 276f95704978e..38611de36f191 100644 --- a/DataFormats/MuonReco/src/classes_def.xml +++ b/DataFormats/MuonReco/src/classes_def.xml @@ -1,5 +1,5 @@ - + diff --git a/DataFormats/MuonSeed/src/classes_def.xml b/DataFormats/MuonSeed/src/classes_def.xml index 3c60f1a750158..08e72f177479a 100644 --- a/DataFormats/MuonSeed/src/classes_def.xml +++ b/DataFormats/MuonSeed/src/classes_def.xml @@ -1,5 +1,5 @@ - + @@ -24,7 +24,7 @@ - + diff --git a/DataFormats/ParticleFlowCandidate/src/classes_def.xml b/DataFormats/ParticleFlowCandidate/src/classes_def.xml index 8346fcaec284d..78ecf09a38c6a 100644 --- a/DataFormats/ParticleFlowCandidate/src/classes_def.xml +++ b/DataFormats/ParticleFlowCandidate/src/classes_def.xml @@ -1,6 +1,6 @@ - + @@ -45,7 +45,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/DataFormats/ParticleFlowReco/interface/PFCluster.h b/DataFormats/ParticleFlowReco/interface/PFCluster.h index b7fafbc0d93e4..d59ed32fc6779 100644 --- a/DataFormats/ParticleFlowReco/interface/PFCluster.h +++ b/DataFormats/ParticleFlowReco/interface/PFCluster.h @@ -48,7 +48,10 @@ namespace reco { public: typedef std::vector > > EEtoPSAssociation; - typedef ROOT::Math::PositionVector3D > REPPoint; + // Next typedef uses double in ROOT 6 rather than Double32_t due to a bug in ROOT 5, + // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase + // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5. + typedef ROOT::Math::PositionVector3D > REPPoint; PFCluster() : CaloCluster(CaloCluster::particleFlow), time_(-99.0), layer_(PFLayer::NONE), color_(1) {} diff --git a/DataFormats/ParticleFlowReco/interface/PFRecHit.h b/DataFormats/ParticleFlowReco/interface/PFRecHit.h index 03d32d680ff0c..4e625eba21a18 100644 --- a/DataFormats/ParticleFlowReco/interface/PFRecHit.h +++ b/DataFormats/ParticleFlowReco/interface/PFRecHit.h @@ -36,7 +36,10 @@ namespace reco { public: - typedef ROOT::Math::PositionVector3D > REPPoint; + // Next typedef uses double in ROOT 6 rather than Double32_t due to a bug in ROOT 5, + // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase + // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5. + typedef ROOT::Math::PositionVector3D > REPPoint; typedef std::vector REPPointVector; diff --git a/DataFormats/ParticleFlowReco/interface/PFTrajectoryPoint.h b/DataFormats/ParticleFlowReco/interface/PFTrajectoryPoint.h index d390609b46839..be32fc3440034 100644 --- a/DataFormats/ParticleFlowReco/interface/PFTrajectoryPoint.h +++ b/DataFormats/ParticleFlowReco/interface/PFTrajectoryPoint.h @@ -26,7 +26,10 @@ namespace reco { class PFTrajectoryPoint { public: - typedef ROOT::Math::PositionVector3D > REPPoint; + // Next typedef uses double in ROOT 6 rather than Double32_t due to a bug in ROOT 5, + // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase + // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5. + typedef ROOT::Math::PositionVector3D > REPPoint; /// Define the different layers where the track can be propagated enum LayerType { diff --git a/DataFormats/ParticleFlowReco/src/classes_def_1.xml b/DataFormats/ParticleFlowReco/src/classes_def_1.xml index 1413983268637..58b21e59e3c35 100644 --- a/DataFormats/ParticleFlowReco/src/classes_def_1.xml +++ b/DataFormats/ParticleFlowReco/src/classes_def_1.xml @@ -42,7 +42,7 @@ - + diff --git a/DataFormats/ParticleFlowReco/src/classes_def_2.xml b/DataFormats/ParticleFlowReco/src/classes_def_2.xml index 434ccdc2d8836..bf21346860e09 100644 --- a/DataFormats/ParticleFlowReco/src/classes_def_2.xml +++ b/DataFormats/ParticleFlowReco/src/classes_def_2.xml @@ -1,7 +1,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -75,7 +75,7 @@ --> - + @@ -137,7 +137,7 @@ - + @@ -147,7 +147,7 @@ --> - + @@ -157,7 +157,7 @@ --> - + @@ -168,7 +168,7 @@ - + @@ -195,7 +195,7 @@ - + @@ -232,7 +232,7 @@ - + @@ -254,7 +254,7 @@ - + @@ -280,7 +280,7 @@ - + diff --git a/DataFormats/ParticleFlowReco/test/init.C b/DataFormats/ParticleFlowReco/test/init.C index dffe5e36d2f9c..4f0d6396243ab 100644 --- a/DataFormats/ParticleFlowReco/test/init.C +++ b/DataFormats/ParticleFlowReco/test/init.C @@ -4,7 +4,5 @@ gSystem->Load("libFWCoreFWLite.so"); gSystem->Load("libDataFormatsParticleFlowReco.so"); AutoLibraryLoader::enable(); -gSystem->Load("libCintex.so"); -ROOT::Cintex::Cintex::Enable(); } diff --git a/DataFormats/PatCandidates/src/UserData.cc b/DataFormats/PatCandidates/src/UserData.cc index 60d9a376e79bd..6c65c817b1dd9 100644 --- a/DataFormats/PatCandidates/src/UserData.cc +++ b/DataFormats/PatCandidates/src/UserData.cc @@ -4,8 +4,7 @@ #include "FWCore/Utilities/interface/EDMException.h" void pat::UserData::checkDictionaries(const std::type_info &type) { - edm::TypeWithDict edmType(type); - if (!edmType.hasDictionary()) { + if (!edm::hasDictionary(type)) { int status = 0; char * demangled = abi::__cxa_demangle(type.name(), 0, 0, &status); std::string typeName(status == 0 ? demangled : type.name()); diff --git a/DataFormats/PatCandidates/src/classes_def_objects.xml b/DataFormats/PatCandidates/src/classes_def_objects.xml index 66bf12f5b1ccd..aeb2d13138037 100644 --- a/DataFormats/PatCandidates/src/classes_def_objects.xml +++ b/DataFormats/PatCandidates/src/classes_def_objects.xml @@ -16,7 +16,7 @@ - + @@ -39,7 +39,9 @@ - + + + @@ -54,7 +56,7 @@ - + @@ -96,8 +98,12 @@ - - + + + + + + @@ -198,7 +204,7 @@ - + @@ -249,7 +255,7 @@ - + @@ -269,7 +275,7 @@ - + @@ -310,7 +316,7 @@ ]]> - + diff --git a/DataFormats/PatCandidates/src/classes_def_other.xml b/DataFormats/PatCandidates/src/classes_def_other.xml index fe85fdc939f7c..21fe720059310 100644 --- a/DataFormats/PatCandidates/src/classes_def_other.xml +++ b/DataFormats/PatCandidates/src/classes_def_other.xml @@ -48,7 +48,7 @@ - + diff --git a/DataFormats/PatCandidates/src/classes_def_trigger.xml b/DataFormats/PatCandidates/src/classes_def_trigger.xml index 814f53ca3f269..615262cc3d723 100644 --- a/DataFormats/PatCandidates/src/classes_def_trigger.xml +++ b/DataFormats/PatCandidates/src/classes_def_trigger.xml @@ -72,7 +72,7 @@ - + diff --git a/DataFormats/Provenance/interface/Hash.h b/DataFormats/Provenance/interface/Hash.h index 57a9586328ff8..4dcba9d898b1d 100644 --- a/DataFormats/Provenance/interface/Hash.h +++ b/DataFormats/Provenance/interface/Hash.h @@ -76,8 +76,8 @@ namespace edm { size_t smallHash() const; //Used by ROOT storage - // CMS_CLASS_VERSION(10) // This macro is not defined here, so expand it. - static short Class_Version() {return 10;} + // CMS_CLASS_VERSION(11) // This macro is not defined here, so expand it. + static short Class_Version() {return 11;} private: diff --git a/DataFormats/Provenance/interface/IndexIntoFile.h b/DataFormats/Provenance/interface/IndexIntoFile.h index 6eb7cef3de069..b10c4ff86297f 100644 --- a/DataFormats/Provenance/interface/IndexIntoFile.h +++ b/DataFormats/Provenance/interface/IndexIntoFile.h @@ -176,8 +176,6 @@ The interface is too complex for general use. #include #include -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" - namespace edm { class ProcessHistoryRegistry; diff --git a/DataFormats/Provenance/interface/ProductProvenance.h b/DataFormats/Provenance/interface/ProductProvenance.h index c189cc8722baa..5113597c98121 100644 --- a/DataFormats/Provenance/interface/ProductProvenance.h +++ b/DataFormats/Provenance/interface/ProductProvenance.h @@ -10,7 +10,6 @@ and how it came into existence. #include "DataFormats/Provenance/interface/BranchID.h" #include "DataFormats/Provenance/interface/ParentageID.h" #include "DataFormats/Provenance/interface/ProvenanceFwd.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" #include diff --git a/DataFormats/Provenance/interface/ProductProvenanceRetriever.h b/DataFormats/Provenance/interface/ProductProvenanceRetriever.h index 258f959b1d364..8e7c2eb11c6f7 100644 --- a/DataFormats/Provenance/interface/ProductProvenanceRetriever.h +++ b/DataFormats/Provenance/interface/ProductProvenanceRetriever.h @@ -16,7 +16,6 @@ ProductProvenanceRetriever: Manages the per event/lumi/run per product provenanc #include #include #include -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" /* ProductProvenanceRetriever diff --git a/DataFormats/Provenance/interface/ProductRegistry.h b/DataFormats/Provenance/interface/ProductRegistry.h index 3ee7874e4f61b..e8b8199dafb8a 100644 --- a/DataFormats/Provenance/interface/ProductRegistry.h +++ b/DataFormats/Provenance/interface/ProductRegistry.h @@ -13,6 +13,7 @@ #include "DataFormats/Provenance/interface/BranchListIndex.h" #include "DataFormats/Provenance/interface/BranchType.h" #include "FWCore/Utilities/interface/ProductHolderIndex.h" +#include "FWCore/Utilities/interface/TypeID.h" #include "boost/array.hpp" #include @@ -22,7 +23,6 @@ #include #include #include -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" namespace edm { class ProductHolderIndexHelper; @@ -111,11 +111,11 @@ namespace edm { bool productProduced(BranchType branchType) const {return transient_.productProduced_[branchType];} bool anyProductProduced() const {return transient_.anyProductProduced_;} - std::vector const& missingDictionaries() const { + std::vector const& missingDictionaries() const { return transient_.missingDictionaries_; } - std::vector& missingDictionariesForUpdate() { + std::vector& missingDictionariesForUpdate() { return transient_.missingDictionaries_; } @@ -148,7 +148,7 @@ namespace edm { std::map branchIDToIndex_; - std::vector missingDictionaries_; + std::vector missingDictionaries_; std::vector > aliasToOriginal_; }; diff --git a/DataFormats/Provenance/interface/Provenance.h b/DataFormats/Provenance/interface/Provenance.h index 8d9878553f19c..b54b07d3ea35e 100644 --- a/DataFormats/Provenance/interface/Provenance.h +++ b/DataFormats/Provenance/interface/Provenance.h @@ -19,7 +19,6 @@ existence. #include #include -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" /* Provenance diff --git a/DataFormats/Provenance/interface/WrapperInterfaceBase.h b/DataFormats/Provenance/interface/WrapperInterfaceBase.h deleted file mode 100644 index 09c7cfafd0cb2..0000000000000 --- a/DataFormats/Provenance/interface/WrapperInterfaceBase.h +++ /dev/null @@ -1 +0,0 @@ -#error diff --git a/DataFormats/Provenance/src/BranchDescription.cc b/DataFormats/Provenance/src/BranchDescription.cc index cddcc2b3c0ae2..d622f335c0e90 100644 --- a/DataFormats/Provenance/src/BranchDescription.cc +++ b/DataFormats/Provenance/src/BranchDescription.cc @@ -1,19 +1,19 @@ #include "DataFormats/Provenance/interface/BranchDescription.h" -#include "FWCore/Utilities/interface/Exception.h" + #include "FWCore/Utilities/interface/EDMException.h" +#include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/FriendlyName.h" +#include "FWCore/Utilities/interface/FunctionWithDict.h" #include "FWCore/Utilities/interface/TypeWithDict.h" #include "FWCore/Utilities/interface/WrappedClassName.h" +#include "TDictAttributeMap.h" + #include #include #include -#include -/*---------------------------------------------------------------------- - - -----------------------------------------------------------------------*/ +class TClass; namespace edm { BranchDescription::Transients::Transients() : @@ -162,52 +162,55 @@ namespace edm { try { setWrappedName(wrappedClassName(fullClassName())); - // unwrapped type. setUnwrappedType(TypeWithDict::byName(fullClassName())); if(!bool(unwrappedType())) { - setSplitLevel(invalidSplitLevel); - setBasketSize(invalidBasketSize); - setTransient(false); - return; + setSplitLevel(invalidSplitLevel); + setBasketSize(invalidBasketSize); + setTransient(false); + return; } + } catch( edm::Exception& caughtException) { + caughtException.addContext(std::string{"While initializing meta data for branch: "}+branchName()); + throw; + } - - setWrappedType(TypeWithDict::byName(wrappedName())); + edm::TypeWithDict wrType(TypeWithDict::byName(wrappedName())); + try { + setWrappedType(wrType); if(!bool(wrappedType())) { - setSplitLevel(invalidSplitLevel); - setBasketSize(invalidBasketSize); - return; + setSplitLevel(invalidSplitLevel); + setBasketSize(invalidBasketSize); + return; } } catch( edm::Exception& caughtException) { caughtException.addContext(std::string{"While initializing meta data for branch: "}+branchName()); throw; } - Reflex::PropertyList wp = Reflex::Type::ByTypeInfo(wrappedType().typeInfo()).Properties(); - setTransient((wp.HasProperty("persistent") ? wp.PropertyAsString("persistent") == std::string("false") : false)); - if(transient()) { - setSplitLevel(invalidSplitLevel); - setBasketSize(invalidBasketSize); + + setTransient(false); + setSplitLevel(invalidSplitLevel); + setBasketSize(invalidBasketSize); + TDictAttributeMap* wp = wrappedType().getClass()->GetAttributeMap(); + if (wp && wp->HasKey("persistent") && !strcmp(wp->GetPropertyAsString("persistent"), "false")) { + // Set transient if persistent == "false". + setTransient(true); return; } - if(wp.HasProperty("splitLevel")) { - setSplitLevel(strtol(wp.PropertyAsString("splitLevel").c_str(), 0, 0)); - if(splitLevel() < 0) { + if (wp && wp->HasKey("splitLevel")) { + setSplitLevel(strtol(wp->GetPropertyAsString("splitLevel"), 0, 0)); + if (splitLevel() < 0) { throw cms::Exception("IllegalSplitLevel") << "' An illegal ROOT split level of " << - splitLevel() << " is specified for class " << wrappedName() << ".'\n"; + splitLevel() << " is specified for class " << wrappedName() << ".'\n"; } setSplitLevel(splitLevel() + 1); //Compensate for wrapper - } else { - setSplitLevel(invalidSplitLevel); } - if(wp.HasProperty("basketSize")) { - setBasketSize(strtol(wp.PropertyAsString("basketSize").c_str(), 0, 0)); - if(basketSize() <= 0) { + if (wp && wp->HasKey("basketSize")) { + setBasketSize(strtol(wp->GetPropertyAsString("basketSize"), 0, 0)); + if (basketSize() <= 0) { throw cms::Exception("IllegalBasketSize") << "' An illegal ROOT basket size of " << - basketSize() << " is specified for class " << wrappedName() << "'.\n"; + basketSize() << " is specified for class " << wrappedName() << "'.\n"; } - } else { - setBasketSize(invalidBasketSize); } } @@ -336,4 +339,4 @@ namespace edm { } return differences.str(); } -} +} // namespace edm diff --git a/DataFormats/Provenance/src/ProductRegistry.cc b/DataFormats/Provenance/src/ProductRegistry.cc index 53967d48aee64..7018c2520e516 100644 --- a/DataFormats/Provenance/src/ProductRegistry.cc +++ b/DataFormats/Provenance/src/ProductRegistry.cc @@ -15,6 +15,7 @@ #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/Utilities/interface/DictionaryTools.h" +#include "FWCore/Utilities/interface/TypeID.h" #include "FWCore/Utilities/interface/TypeWithDict.h" #include "FWCore/Utilities/interface/WrappedClassName.h" @@ -28,10 +29,9 @@ namespace edm { namespace { void checkDicts(BranchDescription const& productDesc) { if(productDesc.transient()) { - checkDictionaries(productDesc.fullClassName(), true); - checkDictionaries(wrappedClassName(productDesc.fullClassName()), true); + checkClassDictionaries(TypeID(productDesc.wrappedType().typeInfo()), false); } else { - checkDictionaries(wrappedClassName(productDesc.fullClassName()), false); + checkClassDictionaries(TypeID(productDesc.wrappedType().typeInfo()), true); } } } @@ -269,8 +269,10 @@ namespace edm { } void ProductRegistry::initializeLookupTables() { + std::map containedTypeMap; - StringSet missingDicts; + TypeSet missingDicts; + transient_.branchIDToIndex_.clear(); constProductList().clear(); @@ -286,8 +288,10 @@ namespace edm { //only do the following if the data is supposed to be available in the event if(desc.present()) { - if(!bool(desc.unwrappedType()) || !bool(desc.wrappedType())) { - missingDicts.insert(desc.className()); + if(!bool(desc.unwrappedType())) { + missingDicts.insert(TypeID(desc.unwrappedType().typeInfo())); + } else if(!bool(desc.wrappedType())) { + missingDicts.insert(TypeID(desc.wrappedType().typeInfo())); } else { TypeID wrappedTypeID(desc.wrappedType().typeInfo()); TypeID typeID(desc.unwrappedType().typeInfo()); diff --git a/DataFormats/Provenance/src/classes_def.xml b/DataFormats/Provenance/src/classes_def.xml index 02d74608ec4ee..c944b96bd85ff 100644 --- a/DataFormats/Provenance/src/classes_def.xml +++ b/DataFormats/Provenance/src/classes_def.xml @@ -32,7 +32,7 @@ - + @@ -80,7 +80,7 @@ - + diff --git a/DataFormats/Provenance/test/BuildFile.xml b/DataFormats/Provenance/test/BuildFile.xml index f4a6d0de969cc..3b2ea8821f37e 100644 --- a/DataFormats/Provenance/test/BuildFile.xml +++ b/DataFormats/Provenance/test/BuildFile.xml @@ -6,10 +6,8 @@ - - diff --git a/DataFormats/Provenance/test/productHolderIndexHelperTest.cc b/DataFormats/Provenance/test/productHolderIndexHelperTest.cc index e2398f65025f8..6db202939a0aa 100644 --- a/DataFormats/Provenance/test/productHolderIndexHelperTest.cc +++ b/DataFormats/Provenance/test/productHolderIndexHelperTest.cc @@ -3,7 +3,6 @@ #include "FWCore/Utilities/interface/TypeID.h" #include "FWCore/Utilities/interface/CPUTimer.h" #include "DataFormats/Provenance/interface/EventID.h" -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" #include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/Utilities/interface/ProductKindOfType.h" @@ -119,9 +118,6 @@ int main() { std::cout << "vNames.size = " << vNames.size() << "\n"; - - edm::RootAutoLibraryLoader::enable(); - edm::CPUTimer timer; timer.start(); diff --git a/DataFormats/Provenance/test/productHolderIndexHelper_t.cppunit.cc b/DataFormats/Provenance/test/productHolderIndexHelper_t.cppunit.cc index aa1603465f02d..ca8bd67a8326e 100644 --- a/DataFormats/Provenance/test/productHolderIndexHelper_t.cppunit.cc +++ b/DataFormats/Provenance/test/productHolderIndexHelper_t.cppunit.cc @@ -8,7 +8,6 @@ #include "DataFormats/Provenance/interface/ProductID.h" #include "DataFormats/Provenance/interface/ProductHolderIndexHelper.h" #include "DataFormats/TestObjects/interface/ToyProducts.h" -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/ProductKindOfType.h" @@ -17,8 +16,6 @@ #include #include -static bool alreadyCalledLoader_productHolderIndexHelper_t = false; - using namespace edm; class TestProductHolderIndexHelper: public CppUnit::TestFixture @@ -46,12 +43,6 @@ class TestProductHolderIndexHelper: public CppUnit::TestFixture CPPUNIT_TEST_SUITE_REGISTRATION(TestProductHolderIndexHelper); void TestProductHolderIndexHelper::setUp() { - - if (!alreadyCalledLoader_productHolderIndexHelper_t) { - edm::RootAutoLibraryLoader::enable(); - alreadyCalledLoader_productHolderIndexHelper_t = true; - } - typeID_ProductID = TypeID(typeid(ProductID)); typeID_EventID = TypeID(typeid(EventID)); } diff --git a/DataFormats/RPCDigi/src/classes_def.xml b/DataFormats/RPCDigi/src/classes_def.xml index 2f687a3333668..57b0571f5ce7b 100644 --- a/DataFormats/RPCDigi/src/classes_def.xml +++ b/DataFormats/RPCDigi/src/classes_def.xml @@ -4,6 +4,7 @@ + diff --git a/DataFormats/RPCRecHit/src/classes_def.xml b/DataFormats/RPCRecHit/src/classes_def.xml index 454a0a1c8d48d..e411707cdd29d 100644 --- a/DataFormats/RPCRecHit/src/classes_def.xml +++ b/DataFormats/RPCRecHit/src/classes_def.xml @@ -8,7 +8,10 @@ + + + diff --git a/DataFormats/RecoCandidate/src/classes_def.xml b/DataFormats/RecoCandidate/src/classes_def.xml index ad929cc05a903..3e56dec146da3 100644 --- a/DataFormats/RecoCandidate/src/classes_def.xml +++ b/DataFormats/RecoCandidate/src/classes_def.xml @@ -31,7 +31,7 @@ - + diff --git a/DataFormats/SiStripCommon/src/classes_def.xml b/DataFormats/SiStripCommon/src/classes_def.xml index c003001b6b35f..a73d519113847 100644 --- a/DataFormats/SiStripCommon/src/classes_def.xml +++ b/DataFormats/SiStripCommon/src/classes_def.xml @@ -1,26 +1,26 @@ - + - + - + - + - + @@ -28,7 +28,7 @@ - + diff --git a/DataFormats/StdDictionaries/BuildFile.xml b/DataFormats/StdDictionaries/BuildFile.xml index 9fa5c3bbd2eae..064be47671c5b 100644 --- a/DataFormats/StdDictionaries/BuildFile.xml +++ b/DataFormats/StdDictionaries/BuildFile.xml @@ -1,5 +1,4 @@ - - + diff --git a/DataFormats/StdDictionaries/src/classes_def_map.xml b/DataFormats/StdDictionaries/src/classes_def_map.xml index 29cb619b05568..f747babf2785e 100644 --- a/DataFormats/StdDictionaries/src/classes_def_map.xml +++ b/DataFormats/StdDictionaries/src/classes_def_map.xml @@ -32,6 +32,7 @@ + diff --git a/DataFormats/StdDictionaries/src/classes_def_vector.xml b/DataFormats/StdDictionaries/src/classes_def_vector.xml index c73a842886523..8c5183ecb2ad4 100644 --- a/DataFormats/StdDictionaries/src/classes_def_vector.xml +++ b/DataFormats/StdDictionaries/src/classes_def_vector.xml @@ -4,14 +4,12 @@ - +// - - - +// diff --git a/DataFormats/StdDictionaries/src/classes_vector.h b/DataFormats/StdDictionaries/src/classes_vector.h index 8146e11f1b1da..84ef3a0c21009 100644 --- a/DataFormats/StdDictionaries/src/classes_vector.h +++ b/DataFormats/StdDictionaries/src/classes_vector.h @@ -44,7 +44,6 @@ namespace DataFormats_StdDictionaries { std::vector > dummyvpuu; std::vector > > v_ull_s; std::vector dummy5; - std::vector::iterator itstring; std::vector > v_v_d; std::vector > v_v_f; std::vector > v_v_i; diff --git a/DataFormats/Streamer/src/classes_def.xml b/DataFormats/Streamer/src/classes_def.xml index 01f28ea636ddb..b1c61d85df505 100644 --- a/DataFormats/Streamer/src/classes_def.xml +++ b/DataFormats/Streamer/src/classes_def.xml @@ -1,6 +1,6 @@ - + diff --git a/DataFormats/TauReco/src/classes_def_2.xml b/DataFormats/TauReco/src/classes_def_2.xml index c5a83009e4690..364601d4fe7c2 100644 --- a/DataFormats/TauReco/src/classes_def_2.xml +++ b/DataFormats/TauReco/src/classes_def_2.xml @@ -1,6 +1,6 @@ - + @@ -248,7 +248,7 @@ isolationTauChargedHadronCandidates_.clear(); - + @@ -265,7 +265,7 @@ isolationTauChargedHadronCandidates_.clear(); - + @@ -279,7 +279,7 @@ isolationTauChargedHadronCandidates_.clear(); - + diff --git a/DataFormats/TestObjects/interface/ToyProducts.h b/DataFormats/TestObjects/interface/ToyProducts.h index 530387f995651..4dc1898eeb868 100644 --- a/DataFormats/TestObjects/interface/ToyProducts.h +++ b/DataFormats/TestObjects/interface/ToyProducts.h @@ -28,6 +28,11 @@ namespace edmtest { struct DummyProduct { }; + struct ArrayProduct { + explicit ArrayProduct(int i = 0) : value{i} {} + int value[1]; + }; + struct EnumProduct { enum TheEnumProduct { TheZero = 0, diff --git a/DataFormats/TestObjects/src/classes.h b/DataFormats/TestObjects/src/classes.h index 00dc46edcddb8..3e4895826e956 100644 --- a/DataFormats/TestObjects/src/classes.h +++ b/DataFormats/TestObjects/src/classes.h @@ -21,6 +21,9 @@ #include "DataFormats/Common/interface/RefToBaseProd.h" #include "DataFormats/Common/interface/RefToBaseVector.h" +#include "DataFormats/Provenance/interface/EventID.h" +#include "DataFormats/Provenance/interface/ProductID.h" + namespace DataFormats_TestObjects { struct dictionary { edm::Wrapper dummyw12; @@ -82,5 +85,7 @@ struct dictionary { edm::reftobase::VectorHolder > > vectorHolderThing; edm::Wrapper wrapperDeleteEarly; + edm::Wrapper wrapperEventID; + edm::Wrapper wrapperProductID; }; } diff --git a/DataFormats/TestObjects/src/classes_def.xml b/DataFormats/TestObjects/src/classes_def.xml index 787819187d72f..12e4ac93fe97a 100644 --- a/DataFormats/TestObjects/src/classes_def.xml +++ b/DataFormats/TestObjects/src/classes_def.xml @@ -9,11 +9,14 @@ - + + + + @@ -115,10 +118,10 @@ - - - + + + @@ -145,6 +148,8 @@ - + + + diff --git a/DataFormats/TestObjects/test/Enum_t.cpp b/DataFormats/TestObjects/test/Enum_t.cpp index 2810e80e14c3e..b30a621988c50 100644 --- a/DataFormats/TestObjects/test/Enum_t.cpp +++ b/DataFormats/TestObjects/test/Enum_t.cpp @@ -16,6 +16,8 @@ class TestDictionaries: public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(TestDictionaries); CPPUNIT_TEST(enum_is_valid); CPPUNIT_TEST(enum_by_name_is_valid); + CPPUNIT_TEST(enum_member_is_valid); + CPPUNIT_TEST(array_member_is_valid); CPPUNIT_TEST(demangling); CPPUNIT_TEST_SUITE_END(); @@ -27,6 +29,8 @@ class TestDictionaries: public CppUnit::TestFixture { void enum_is_valid(); void enum_by_name_is_valid(); + void enum_member_is_valid(); + void array_member_is_valid(); void demangling(); private: @@ -44,6 +48,28 @@ void TestDictionaries::enum_by_name_is_valid() { CPPUNIT_ASSERT(t); } +void TestDictionaries::enum_member_is_valid() { + edm::TypeWithDict t = edm::TypeWithDict::byName("edmtest::EnumProduct"); + edm::MemberWithDict m = t.dataMemberByName("value"); + edm::TypeWithDict t2 = m.typeOf(); + edm::TypeWithDict t3 = edm::TypeWithDict::byName("edmtest::EnumProduct::TheEnumProduct"); + CPPUNIT_ASSERT(t2); + CPPUNIT_ASSERT(t3); + CPPUNIT_ASSERT(t2 == t3); +} + +void TestDictionaries::array_member_is_valid() { + edm::TypeWithDict t = edm::TypeWithDict::byName("edmtest::ArrayProduct"); + edm::MemberWithDict m = t.dataMemberByName("value"); + CPPUNIT_ASSERT(m.isArray()); + edm::TypeWithDict t2 = m.typeOf(); + edm::TypeWithDict t3 = edm::TypeWithDict::byName("int[1]"); + CPPUNIT_ASSERT(t2); + CPPUNIT_ASSERT(t3); + CPPUNIT_ASSERT(t2.qualifiedName() == "int[1]"); + CPPUNIT_ASSERT(t2 == t3); +} + namespace { template void checkIt() { diff --git a/DataFormats/TrackCandidate/src/classes_def.xml b/DataFormats/TrackCandidate/src/classes_def.xml index e6e2911ff5ece..232993b9b293f 100644 --- a/DataFormats/TrackCandidate/src/classes_def.xml +++ b/DataFormats/TrackCandidate/src/classes_def.xml @@ -1,5 +1,5 @@ - + diff --git a/DataFormats/TrackReco/src/classes_def.xml b/DataFormats/TrackReco/src/classes_def.xml index 4e52bc63ed839..7e3da74748cc7 100644 --- a/DataFormats/TrackReco/src/classes_def.xml +++ b/DataFormats/TrackReco/src/classes_def.xml @@ -3,13 +3,12 @@ - - + + + + - - - @@ -24,16 +23,7 @@ targetClass="reco::HitPattern" target="hitPattern" version="[-11]" - include="utility; - DataFormats/SiPixelDetId/interface/PXBDetId.h; - DataFormats/SiPixelDetId/interface/PXFDetId.h; - DataFormats/SiStripDetId/interface/TIBDetId.h; - DataFormats/SiStripDetId/interface/TIDDetId.h; - DataFormats/SiStripDetId/interface/TOBDetId.h; - DataFormats/SiStripDetId/interface/TECDetId.h; - DataFormats/MuonDetId/interface/DTLayerId.h; - DataFormats/MuonDetId/interface/CSCDetId.h; - DataFormats/MuonDetId/interface/RPCDetId.h" + include="utility,DataFormats/SiPixelDetId/interface/PXBDetId.h,DataFormats/SiPixelDetId/interface/PXFDetId.h,DataFormats/SiStripDetId/interface/TIBDetId.h,DataFormats/SiStripDetId/interface/TIDDetId.h,DataFormats/SiStripDetId/interface/TOBDetId.h,DataFormats/SiStripDetId/interface/TECDetId.h,DataFormats/MuonDetId/interface/DTLayerId.h,DataFormats/MuonDetId/interface/CSCDetId.h,DataFormats/MuonDetId/interface/RPCDetId.h" > - + @@ -361,7 +351,7 @@ - + @@ -489,7 +479,7 @@ - + diff --git a/DataFormats/TrackerRecHit2D/src/classes.h b/DataFormats/TrackerRecHit2D/src/classes.h old mode 100755 new mode 100644 diff --git a/DataFormats/TrackerRecHit2D/src/classes_def.xml b/DataFormats/TrackerRecHit2D/src/classes_def.xml old mode 100755 new mode 100644 index 069f9a2b037d3..2d5f499e495ed --- a/DataFormats/TrackerRecHit2D/src/classes_def.xml +++ b/DataFormats/TrackerRecHit2D/src/classes_def.xml @@ -9,7 +9,7 @@ - + @@ -34,6 +34,7 @@ + @@ -41,6 +42,7 @@ + @@ -118,6 +120,7 @@ + @@ -132,6 +135,7 @@ + diff --git a/DataFormats/TrackingRecHit/src/classes_def.xml b/DataFormats/TrackingRecHit/src/classes_def.xml index de0b7905e9305..ebcc945f617b4 100644 --- a/DataFormats/TrackingRecHit/src/classes_def.xml +++ b/DataFormats/TrackingRecHit/src/classes_def.xml @@ -28,6 +28,7 @@ + diff --git a/DataFormats/TrajectorySeed/src/classes_def.xml b/DataFormats/TrajectorySeed/src/classes_def.xml index 72ed71719028c..80a0a0c36de6f 100644 --- a/DataFormats/TrajectorySeed/src/classes_def.xml +++ b/DataFormats/TrajectorySeed/src/classes_def.xml @@ -1,5 +1,5 @@ - + diff --git a/DataFormats/TrajectoryState/BuildFile.xml b/DataFormats/TrajectoryState/BuildFile.xml index 2d963da825b6c..8f301c6e9ff0c 100644 --- a/DataFormats/TrajectoryState/BuildFile.xml +++ b/DataFormats/TrajectoryState/BuildFile.xml @@ -1,5 +1,4 @@ - diff --git a/FWCore/Common/src/classes_def.xml b/FWCore/Common/src/classes_def.xml index dc019d828bb47..aa88ec655b24c 100644 --- a/FWCore/Common/src/classes_def.xml +++ b/FWCore/Common/src/classes_def.xml @@ -11,7 +11,7 @@ - + diff --git a/FWCore/FWLite/BuildFile.xml b/FWCore/FWLite/BuildFile.xml index 1a162bf9c1910..26c9e943da7b1 100644 --- a/FWCore/FWLite/BuildFile.xml +++ b/FWCore/FWLite/BuildFile.xml @@ -1,7 +1,6 @@ - diff --git a/FWCore/FWLite/src/AutoLibraryLoader.cc b/FWCore/FWLite/src/AutoLibraryLoader.cc index 0eb24745ecc07..a52da38383734 100644 --- a/FWCore/FWLite/src/AutoLibraryLoader.cc +++ b/FWCore/FWLite/src/AutoLibraryLoader.cc @@ -18,7 +18,6 @@ // user include files #include "FWCore/FWLite/interface/AutoLibraryLoader.h" -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" #include "FWCore/FWLite/src/BareRootProductGetter.h" #include "FWCore/PluginManager/interface/PluginManager.h" #include "FWCore/PluginManager/interface/standard.h" @@ -54,8 +53,7 @@ AutoLibraryLoader::enable() edmplugin::PluginManager::configure(edmplugin::standard::config()); static BareRootProductGetter s_getter; - edm::RootAutoLibraryLoader::enable(); - //this function must be called after enabling the autoloader + //this function must be called // so that the TClass we need will be available fwlite::setRefStreamer(&s_getter); @@ -107,6 +105,5 @@ AutoLibraryLoader::loadAll() { // std::cout <<"LoadAllDictionaries"< + + + + diff --git a/FWCore/FWLite/test/BuildFile.xml b/FWCore/FWLite/test/BuildFile.xml index b7372445b911e..1882b1147bd6a 100644 --- a/FWCore/FWLite/test/BuildFile.xml +++ b/FWCore/FWLite/test/BuildFile.xml @@ -2,7 +2,7 @@ - + diff --git a/FWCore/FWLite/test/stdnamespaceadder_t.cppunit.cpp b/FWCore/FWLite/test/stdnamespaceadder_t.cppunit.cpp deleted file mode 100644 index ff811adc1989c..0000000000000 --- a/FWCore/FWLite/test/stdnamespaceadder_t.cppunit.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/*---------------------------------------------------------------------- - -Test program for edm::TypeIDBase class. -Changed by Viji on 29-06-2005 - - ----------------------------------------------------------------------*/ - -#include -#include -#include -#include -#include "FWCore/RootAutoLibraryLoader/src/stdNamespaceAdder.h" - -class testSTDNamespaceAdder: public CppUnit::TestFixture -{ -CPPUNIT_TEST_SUITE(testSTDNamespaceAdder); - -CPPUNIT_TEST(tests); - -CPPUNIT_TEST_SUITE_END(); -public: - void setUp(){} - void tearDown(){} - - void tests(); -}; - -///registration of the test so that the runner can find it -CPPUNIT_TEST_SUITE_REGISTRATION(testSTDNamespaceAdder); - -void testSTDNamespaceAdder::tests() -{ - using edm::root::stdNamespaceAdder; - - static const std::string kVectorBlahNoNS("vector"); - static const std::string kVectorBlahNS("std::vector"); - static const std::string kTVectorBlah("Tvector"); - static const std::string kVectorVectorBlahNoNS("vector >"); - static const std::string kVectorVectorBlahNS("std::vector >"); - - //cout <<" substitution \""< diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index aaa4cc9a2a47f..c7087fc5f872b 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -86,10 +86,6 @@ #include #endif -//Needed for introspection -#include "Cintex/Cintex.h" - - namespace { //Sentry class to only send a signal if an // exception occurs. An exception is identified @@ -400,8 +396,6 @@ namespace edm { //std::cerr << processDesc->dump() << std::endl; - ROOT::Cintex::Cintex::Enable(); - // register the empty parentage vector , once and for all ParentageRegistry::instance()->insertMapped(Parentage()); diff --git a/FWCore/Framework/src/Principal.cc b/FWCore/Framework/src/Principal.cc index 144070443b399..2184dea86403c 100644 --- a/FWCore/Framework/src/Principal.cc +++ b/FWCore/Framework/src/Principal.cc @@ -20,6 +20,7 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "TClass.h" #include #include @@ -35,10 +36,19 @@ namespace edm { static void - maybeThrowMissingDictionaryException(TypeID const& productType, bool isElement, std::vector const& missingDictionaries) { - if(binary_search_all(missingDictionaries, productType.className())) { - checkDictionaries(isElement ? productType.className() : wrappedClassName(productType.className()), false); - throwMissingDictionariesException(); + maybeThrowMissingDictionaryException(TypeID const& productType, bool isElement, std::vector const& missingDictionaries) { + if(isElement) { + if(binary_search_all(missingDictionaries, productType)) { + checkTypeDictionary(productType); + throwMissingDictionariesException(); + } + } else { + TClass* cl = TClass::GetClass(wrappedClassName(productType.className()).c_str()); + TypeID wrappedProductType = TypeID(cl->GetTypeInfo()); + if(binary_search_all(missingDictionaries, wrappedProductType)) { + checkClassDictionary(wrappedProductType); + throwMissingDictionariesException(); + } } } diff --git a/FWCore/Framework/src/ProductRegistryHelper.cc b/FWCore/Framework/src/ProductRegistryHelper.cc index 9f5ffe898eaa6..cc2d29138cb70 100644 --- a/FWCore/Framework/src/ProductRegistryHelper.cc +++ b/FWCore/Framework/src/ProductRegistryHelper.cc @@ -8,7 +8,9 @@ #include "DataFormats/Provenance/interface/BranchDescription.h" #include "DataFormats/Provenance/interface/ModuleDescription.h" #include "FWCore/Utilities/interface/DictionaryTools.h" +#include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/Utilities/interface/TypeWithDict.h" +#include "TClass.h" namespace edm { ProductRegistryHelper::~ProductRegistryHelper() { } @@ -25,11 +27,27 @@ namespace edm { bool iIsListener) { std::string const& prefix = dictionaryPlugInPrefix(); for(TypeLabelList::const_iterator p = iBegin; p != iEnd; ++p) { - TypeWithDict type(p->typeID_.typeInfo()); - if(!type.hasDictionary()) { - //attempt to load + // This should load the dictionary if not already loaded. + TClass::GetClass(p->typeID_.typeInfo()); + if(!hasDictionary(p->typeID_.typeInfo())) { + // a second attempt to load edmplugin::PluginCapabilities::get()->tryToLoad(prefix + p->typeID_.userClassName()); } + if(!hasDictionary(p->typeID_.typeInfo())) { + throw Exception(errors::DictionaryNotFound) + << "No data dictionary found for class:\n\n" + << p->typeID_.className() + << "\nMost likely the dictionary was never generated,\n" + << "but it may be that it was generated in the wrong package.\n" + << "Please add (or move) the specification\n" + << "\n" + << "to the appropriate classes_def.xml file.\n" + << "If the class is a template instance, you may need\n" + << "to define a dummy variable of this type in classes.h.\n" + << "Also, if this class has any transient members,\n" + << "you need to specify them in classes_def.xml."; + } + TypeWithDict type(p->typeID_.typeInfo()); BranchDescription pdesc(p->branchType_, iDesc.moduleLabel(), iDesc.processName(), diff --git a/FWCore/Framework/test/BuildFile.xml b/FWCore/Framework/test/BuildFile.xml index 858a7487d814f..a25ae7e7c991f 100644 --- a/FWCore/Framework/test/BuildFile.xml +++ b/FWCore/Framework/test/BuildFile.xml @@ -155,7 +155,6 @@ - @@ -164,7 +163,6 @@ - @@ -174,7 +172,6 @@ - @@ -185,7 +182,6 @@ - @@ -197,7 +193,6 @@ - diff --git a/FWCore/Framework/test/Event_t.cpp b/FWCore/Framework/test/Event_t.cpp index 16f0c7c18e85c..21a82c7b53f08 100644 --- a/FWCore/Framework/test/Event_t.cpp +++ b/FWCore/Framework/test/Event_t.cpp @@ -28,7 +28,6 @@ Test program for edm::Event. #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/Framework/interface/EDConsumerBase.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" #include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h" #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/EDMException.h" @@ -43,7 +42,7 @@ Test program for edm::Event. #include "cppunit/extensions/HelperMacros.h" -#include "Cintex/Cintex.h" +#include "boost/shared_ptr.hpp" #include #include @@ -244,8 +243,6 @@ testEvent::testEvent() : processHistoryRegistry_(), processConfigurations_() { - ROOT::Cintex::Cintex::Enable(); - typedef edmtest::IntProduct prod_t; typedef std::vector vec_t; @@ -305,7 +302,6 @@ testEvent::~testEvent() { void testEvent::setUp() { - edm::RootAutoLibraryLoader::enable(); // First build a fake process history, that says there // were previous processes named "EARLY" and "LATE". // This takes several lines of code but other than diff --git a/FWCore/Framework/test/edconsumerbase_t.cppunit.cc b/FWCore/Framework/test/edconsumerbase_t.cppunit.cc index 7fab71de16819..9fdd8b5482861 100644 --- a/FWCore/Framework/test/edconsumerbase_t.cppunit.cc +++ b/FWCore/Framework/test/edconsumerbase_t.cppunit.cc @@ -25,7 +25,6 @@ #include "DataFormats/Provenance/interface/ProductHolderIndexHelper.h" #include "DataFormats/TestObjects/interface/ToyProducts.h" -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" #include "DataFormats/Provenance/interface/EventID.h" #include "DataFormats/Provenance/interface/ProductID.h" @@ -54,17 +53,10 @@ class TestEDConsumerBase : public CppUnit::TestFixture { }; -static bool s_alreadyCalledLoader = false; - ///registration of the test so that the runner can find it CPPUNIT_TEST_SUITE_REGISTRATION(TestEDConsumerBase); void TestEDConsumerBase::setUp() { - - if (!s_alreadyCalledLoader) { - edm::RootAutoLibraryLoader::enable(); - s_alreadyCalledLoader = true; - } } namespace { diff --git a/FWCore/Framework/test/event_getrefbeforeput_t.cppunit.cc b/FWCore/Framework/test/event_getrefbeforeput_t.cppunit.cc index 11976ddb7a9c7..d7cda0ebc927e 100644 --- a/FWCore/Framework/test/event_getrefbeforeput_t.cppunit.cc +++ b/FWCore/Framework/test/event_getrefbeforeput_t.cppunit.cc @@ -21,7 +21,6 @@ Test of the EventPrincipal class. #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" #include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/Utilities/interface/GetPassID.h" #include "FWCore/Utilities/interface/GlobalIdentifier.h" @@ -49,7 +48,6 @@ CPPUNIT_TEST(getRefTest); CPPUNIT_TEST_SUITE_END(); public: void setUp(){ - edm::RootAutoLibraryLoader::enable(); } void tearDown(){} void failGetProductNotRegisteredTest(); diff --git a/FWCore/Framework/test/eventprincipal_t.cppunit.cc b/FWCore/Framework/test/eventprincipal_t.cppunit.cc index e6d3cc15a7c96..2d92d5a944076 100644 --- a/FWCore/Framework/test/eventprincipal_t.cppunit.cc +++ b/FWCore/Framework/test/eventprincipal_t.cppunit.cc @@ -27,7 +27,6 @@ Test of the EventPrincipal class. #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/Framework/interface/HistoryAppender.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" #include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/Utilities/interface/GetPassID.h" #include "FWCore/Utilities/interface/GlobalIdentifier.h" @@ -140,8 +139,6 @@ test_ep::fake_single_process_branch(std::string const& tag, void test_ep::setUp() { - edm::RootAutoLibraryLoader::enable(); - // Making a functional EventPrincipal is not trivial, so we do it // all here. eventID_ = edm::EventID(101, 1, 20); diff --git a/FWCore/Framework/test/eventprocessor2_t.cppunit.cc b/FWCore/Framework/test/eventprocessor2_t.cppunit.cc index b84118826abe9..9ffd3f243c402 100644 --- a/FWCore/Framework/test/eventprocessor2_t.cppunit.cc +++ b/FWCore/Framework/test/eventprocessor2_t.cppunit.cc @@ -12,14 +12,12 @@ Test of the EventProcessor class. #include "cppunit/extensions/HelperMacros.h" #include "FWCore/PluginManager/interface/PluginManager.h" #include "FWCore/PluginManager/interface/standard.h" -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" // to be called also by the other cppunit... void doInit() { static bool firstTime=true; if(firstTime) { //std::cout << "common init" << std::endl; - edm::RootAutoLibraryLoader::enable(); if(not edmplugin::PluginManager::isAvailable()) { edmplugin::PluginManager::configure(edmplugin::standard::config()); } diff --git a/FWCore/Framework/test/eventprocessor_t.cppunit.cc b/FWCore/Framework/test/eventprocessor_t.cppunit.cc index 537252675038e..7d9f777b9c091 100644 --- a/FWCore/Framework/test/eventprocessor_t.cppunit.cc +++ b/FWCore/Framework/test/eventprocessor_t.cppunit.cc @@ -13,7 +13,6 @@ Test of the EventProcessor class. #include "FWCore/PluginManager/interface/PresenceFactory.h" #include "FWCore/PluginManager/interface/ProblemTracker.h" #include "FWCore/PythonParameterSet/interface/PythonProcessDesc.h" -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" //I need to open a 'back door' in order to test the functionality #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" #define private public diff --git a/FWCore/Framework/test/generichandle_t.cppunit.cc b/FWCore/Framework/test/generichandle_t.cppunit.cc index f5c36c33064a9..1dd158864ce89 100644 --- a/FWCore/Framework/test/generichandle_t.cppunit.cc +++ b/FWCore/Framework/test/generichandle_t.cppunit.cc @@ -22,7 +22,6 @@ Test of GenericHandle class. #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" #include "FWCore/Utilities/interface/GetPassID.h" #include "FWCore/Utilities/interface/GlobalIdentifier.h" #include "FWCore/Utilities/interface/TypeWithDict.h" @@ -50,7 +49,6 @@ CPPUNIT_TEST(failWrongType); CPPUNIT_TEST_SUITE_END(); public: void setUp(){ - edm::RootAutoLibraryLoader::enable(); } void tearDown(){} void failgetbyLabelTest(); diff --git a/FWCore/Framework/test/productregistry.cppunit.cc b/FWCore/Framework/test/productregistry.cppunit.cc index fc1542663caef..246fc2fc62ea4 100644 --- a/FWCore/Framework/test/productregistry.cppunit.cc +++ b/FWCore/Framework/test/productregistry.cppunit.cc @@ -14,7 +14,6 @@ #include "FWCore/Framework/src/SignallingProductRegistry.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/PluginManager/interface/ProblemTracker.h" -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/TypeWithDict.h" @@ -99,7 +98,6 @@ testProductRegistry::testProductRegistry() : void testProductRegistry::setUp() { - edm::RootAutoLibraryLoader::enable(); edm::ParameterSet dummyProcessPset; dummyProcessPset.registerIt(); auto processConfiguration = std::make_shared(); diff --git a/FWCore/MessageLogger/interface/MessageSender.h b/FWCore/MessageLogger/interface/MessageSender.h index 53423448a32ff..11a91496b64e9 100644 --- a/FWCore/MessageLogger/interface/MessageSender.h +++ b/FWCore/MessageLogger/interface/MessageSender.h @@ -8,7 +8,6 @@ #include #include -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" // Change log // diff --git a/FWCore/Modules/src/EventContentAnalyzer.cc b/FWCore/Modules/src/EventContentAnalyzer.cc index 7a60d075d017a..f1941e0dd0327 100644 --- a/FWCore/Modules/src/EventContentAnalyzer.cc +++ b/FWCore/Modules/src/EventContentAnalyzer.cc @@ -228,7 +228,7 @@ namespace edm { << iEx.what() << ")>\n"; } if(!isRef) { - atReturnType.destruct(contained.address(), true); + contained.destruct(true); } } return true; diff --git a/FWCore/PluginManager/bin/refresh.cc b/FWCore/PluginManager/bin/refresh.cc index 5d39abe88fe50..4532f69a276c6 100644 --- a/FWCore/PluginManager/bin/refresh.cc +++ b/FWCore/PluginManager/bin/refresh.cc @@ -38,7 +38,7 @@ using namespace edmplugin; #ifdef __APPLE__ #define PER_PROCESS_DSO 20 #else -#define PER_PROCESS_DSO 200 +#define PER_PROCESS_DSO 2000 #endif namespace std { diff --git a/FWCore/PluginManager/src/PluginManager.cc b/FWCore/PluginManager/src/PluginManager.cc index d0f23e7e0b631..23f6fb0a53349 100644 --- a/FWCore/PluginManager/src/PluginManager.cc +++ b/FWCore/PluginManager/src/PluginManager.cc @@ -264,14 +264,11 @@ PluginManager::load(const std::string& iCategory, Sentry s(loadingLibraryNamed_(), p.string()); //boost::filesystem::path native(p.string()); std::shared_ptr ptr; - try { - //TEMPORARY: to avoid possible deadlocks from ROOT, we must - // take the lock ourselves - R__LOCKGUARD2(gCINTMutex); - ptr.reset( new SharedLibrary(p) ); - } catch(cms::Exception& iException) { - iException.addContext(std::string("while trying to load ")+iPlugin); - throw; + { + //TEMPORARY: to avoid possible deadlocks from ROOT, we must + // take the lock ourselves + R__LOCKGUARD2(gInterpreterMutex); + ptr.reset( new SharedLibrary(p) ); } loadables_[p]=ptr; justLoaded_(*ptr); @@ -307,14 +304,11 @@ PluginManager::tryToLoad(const std::string& iCategory, Sentry s(loadingLibraryNamed_(), p.string()); //boost::filesystem::path native(p.string()); std::shared_ptr ptr; - try { - //TEMPORARY: to avoid possible deadlocks from ROOT, we must - // take the lock ourselves - R__LOCKGUARD(gCINTMutex); - ptr.reset( new SharedLibrary(p) ); - } catch(cms::Exception& iException) { - iException.addContext(std::string("while trying to load ")+iPlugin); - throw; + { + //TEMPORARY: to avoid possible deadlocks from ROOT, we must + // take the lock ourselves + R__LOCKGUARD(gInterpreterMutex); + ptr.reset( new SharedLibrary(p) ); } loadables_[p]=ptr; justLoaded_(*ptr); diff --git a/FWCore/ROOTTests/test/BuildFile.xml b/FWCore/ROOTTests/test/BuildFile.xml new file mode 100644 index 0000000000000..c88de7345120b --- /dev/null +++ b/FWCore/ROOTTests/test/BuildFile.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/FWCore/ROOTTests/test/read_threaded_t.cc b/FWCore/ROOTTests/test/read_threaded_t.cc new file mode 100644 index 0000000000000..4f5d6cabc23d0 --- /dev/null +++ b/FWCore/ROOTTests/test/read_threaded_t.cc @@ -0,0 +1,145 @@ +#include "TFile.h" +#include "TTree.h" +#include "TBranch.h" +#include "TClass.h" +#include "TThread.h" +#include "TVirtualStreamerInfo.h" + +#include "TList.h" +#include "TMap.h" +#include "TObjString.h" +#include "TH1F.h" + +#include "FWCore/FWLite/interface/AutoLibraryLoader.h" + +#include +#include +#include +#include +#include + +std::atomic waitToStart{true}; + +void printHelp(const char* iName, int iDefaultNThreads) +{ + std::cout << iName <<" [number of threads] [filename] [gDebug value]\n\n" + <<"[number of threads] number of threads to use in test\n" + <<"[filename] name of CMSSW file to read\n" + <<"[gDebug value] value of gDebug to pass to ROOT (gDebug=1 is useful)\n" + <<"If no arguments are given "< parseOptions(int argc, char** argv) +{ + constexpr int kDefaultNThreads = 4; + int kDefaultgDebug = gDebug; + int nThreads = kDefaultNThreads; + int newGDebug = kDefaultgDebug; + std::string fileName(kDefaultFileName); + if( argc >= 2 ) { + if(strcmp("-h",argv[1]) ==0) { + printHelp(argv[0],kDefaultNThreads); + exit( 0 ); + } + + nThreads = atoi(argv[1]); + } + if(argc >=3) { + fileName = argv[2]; + } + if(argc == 4) { + newGDebug = atoi(argv[3]); + } + + if( argc > 4) { + printHelp(argv[0],kDefaultNThreads); + exit(1); + } + return std::make_tuple(nThreads, fileName, newGDebug) ; +} + +void createDummyFile() { + auto theList = new TList(); + + for(unsigned int i=0; i<10;++i) { + theList->Add(new TList()); + theList->Add(new TMap()); + theList->Add(new TObjString()); + theList->Add(new TH1F()); + theList->Add(new TH1D()); + } + + + TFile f(kDefaultFileName.c_str(), "RECREATE","test"); + + auto listTree = new TTree("Events","TheList"); + listTree->Branch("theList","TList",&theList); + + for(unsigned int i = 0; i<100;++i) { + listTree->Fill(); + } + f.Write(); + f.Close(); +} + + +int main(int argc, char** argv) { + + auto options = parseOptions(argc,argv); + + const int kNThreads = std::get<0>(options); + + auto const kFileName = std::get<1>(options); + + gDebug = std::get<2>(options); + + + + AutoLibraryLoader::enable(); + + //Tell Root we want to be multi-threaded + TThread::Initialize(); + //When threading, also have to keep ROOT from logging all TObjects into a list + TObject::SetObjectStat(false); + //Have to avoid having Streamers modify themselves after they have been used + TVirtualStreamerInfo::Optimize(false); + + + if(kFileName == kDefaultFileName) { + createDummyFile(); + } + + + std::vector> threads; + threads.reserve(kNThreads); + + for(int i=0; i< kNThreads; ++i) { + threads.push_back(std::make_shared( std::thread([&kFileName]() { + static thread_local TThread s_thread_guard; + while(waitToStart) ; + std::unique_ptr f{ TFile::Open(kFileName.c_str()) }; + assert(f.get()); + + TTree* eventTree = dynamic_cast(f.get()->Get("Events")); + assert(eventTree); + + for(Long64_t i = 0, iEnd = eventTree->GetEntries(); + i != iEnd; + ++i) { + eventTree->GetEntry(i,1); + } + + f.get()->Close(); + }) ) ); + + } + waitToStart = false; + for(auto& t : threads) { + t->join(); + } + + return 0; +} + diff --git a/FWCore/ROOTTests/test/tclass_methods_threaded_t.cc b/FWCore/ROOTTests/test/tclass_methods_threaded_t.cc new file mode 100644 index 0000000000000..a8e81217f722f --- /dev/null +++ b/FWCore/ROOTTests/test/tclass_methods_threaded_t.cc @@ -0,0 +1,81 @@ +#include "TClass.h" +#include "TThread.h" +#include "TObject.h" +#include "TVirtualStreamerInfo.h" +#include +#include +#include +#include +#include + +void printHelp(const char* iName, int iDefaultNThreads) +{ + std::cout << iName <<" [number of threads] \n\n" + <<"If no arguments are given "< 2) { + printHelp(argv[0],kDefaultNThreads); + exit(1); + } + return returnValue ; +} + +int main(int argc, char** argv) +{ + const int kNThreads = parseOptionsForNumberOfThreads(argc,argv); + + std::atomic canStart{false}; + std::vector threads; + + std::atomic classWasGotten{0}; + std::atomic firstMethodGotten{0}; + + TThread::Initialize(); + //When threading, also have to keep ROOT from logging all TObjects into a list + TObject::SetObjectStat(false); + + //Have to avoid having Streamers modify themselves after they have been used + TVirtualStreamerInfo::Optimize(false); + + + for(int i=0; iGetMethodWithPrototype("id","",true /*is const*/, ROOT::kConversionMatch); + --firstMethodGotten; + while(firstMethodGotten !=0) {} + TMethod* method2 = thingClass->GetMethodWithPrototype("operator=","edmtest::Simple const&",false /*is const*/, ROOT::kConversionMatch); + + assert(nullptr != method); + assert(nullptr != method2); + }); + } + canStart = true; + + for(auto& thread: threads) { + thread.join(); + } + + return 0; +} diff --git a/FWCore/ROOTTests/test/tformula_threaded_t.cc b/FWCore/ROOTTests/test/tformula_threaded_t.cc new file mode 100644 index 0000000000000..e4d71593c62f0 --- /dev/null +++ b/FWCore/ROOTTests/test/tformula_threaded_t.cc @@ -0,0 +1,74 @@ +#include "TFormula.h" +#include "TThread.h" +#include "TObject.h" +#include "TVirtualStreamerInfo.h" +#include +#include +#include +#include +#include + + +void printHelp(const char* iName, int iDefaultNThreads) +{ + std::cout << iName <<" [number of threads] \n\n" + <<"If no arguments are given "< 2) { + printHelp(argv[0],kDefaultNThreads); + exit(1); + } + return returnValue ; +} + +int main(int argc, char** argv) +{ + const int kNThreads = parseOptionsForNumberOfThreads(argc, argv); + + std::atomic canStart{kNThreads}; + std::vector threads; + + TThread::Initialize(); + //When threading, also have to keep ROOT from logging all TObjects into a list + TObject::SetObjectStat(false); + + //Have to avoid having Streamers modify themselves after they have been used + TVirtualStreamerInfo::Optimize(false); + + + for(int i=0; i 0 ) {} + + TFormula f("testFormula","1./(1.+(4.61587e+06*(((1./(0.5*TMath::Max(1.e-6,x+1.)))-1.)/1.16042e+07)))"); + + for(int i=0; i<100;++i) { + double x = double(i)/100.; + f.Eval(x); + } + }); + } + canStart = true; + + for(auto& thread: threads) { + thread.join(); + } + + return 0; +} diff --git a/FWCore/ROOTTests/test/tprofile_threaded_t.cc b/FWCore/ROOTTests/test/tprofile_threaded_t.cc new file mode 100644 index 0000000000000..e488512680d78 --- /dev/null +++ b/FWCore/ROOTTests/test/tprofile_threaded_t.cc @@ -0,0 +1,78 @@ +#include "TProfile.h" +#include "TThread.h" +#include "TObject.h" +#include "TVirtualStreamerInfo.h" +#include +#include +#include +#include +#include +#include + +void printHelp(const char* iName, int iDefaultNThreads) +{ + std::cout << iName <<" [number of threads] \n\n" + <<"If no arguments are given "< 2) { + printHelp(argv[0],kDefaultNThreads); + exit(1); + } + return returnValue ; +} + +int main(int argc, char** argv) +{ + const int kNThreads = parseOptionsForNumberOfThreads(argc, argv); + + std::atomic canStart{false}; + std::vector> profiles; + std::vector threads; + + TH1::AddDirectory(kFALSE); + + TThread::Initialize(); + //When threading, also have to keep ROOT from logging all TObjects into a list + TObject::SetObjectStat(false); + + //Have to avoid having Streamers modify themselves after they have been used + TVirtualStreamerInfo::Optimize(false); + + + for(int i=0; i(new TProfile(s.str().c_str(),s.str().c_str(), 100,10,11,0,10))); + profiles.back()->SetBit(TH1::kCanRebin); + auto profile = profiles.back().get(); + threads.emplace_back([i,profile,&canStart]() { + static thread_local TThread guard; + while(not canStart) {} + for(int x=10; x>0; --x) { + for(int y=0; y<20; ++y) { + profile->Fill(double(x), double(y),1.); + } + } + }); + } + canStart = true; + + for(auto& thread: threads) { + thread.join(); + } + + return 0; +} diff --git a/FWCore/ROOTTests/test/write_threaded_t.cc b/FWCore/ROOTTests/test/write_threaded_t.cc new file mode 100644 index 0000000000000..0fc5454f71a62 --- /dev/null +++ b/FWCore/ROOTTests/test/write_threaded_t.cc @@ -0,0 +1,126 @@ +#include "TFile.h" +#include "TTree.h" +#include "TBranch.h" +#include "TClass.h" +#include "TThread.h" +#include "TVirtualStreamerInfo.h" +#include "TList.h" +#include "TMap.h" +#include "TObjString.h" +#include "TH1F.h" + + +#include +#include +#include +#include +#include +#include + +std::atomic waitToStart{true}; +std::atomic countdownToWrite{0}; + +void printHelp(const char* iName, int iDefaultNThreads) +{ + std::cout << iName <<" [number of threads] [gDebug value]\n\n" + <<"[number of threads] number of threads to use in test\n" + <<"[gDebug value] value of gDebug to pass to ROOT (gDebug=1 is useful)\n" + <<"If no arguments are given "< parseOptionsForNumberOfThreadsAndgDebug(int argc, char** argv) +{ + constexpr int kDefaultNThreads = 4; + int kDefaultgDebug = gDebug; + int nThreads = kDefaultNThreads; + int newGDebug = kDefaultgDebug; + if( argc >= 2 ) { + if(strcmp("-h",argv[1]) ==0) { + printHelp(argv[0],kDefaultNThreads); + exit( 0 ); + } + + nThreads = atoi(argv[1]); + } + if(argc == 3) { + newGDebug = atoi(argv[2]); + } + + if( argc > 3) { + printHelp(argv[0],kDefaultNThreads); + exit(1); + } + return std::make_pair(nThreads, newGDebug) ; +} + +TList* createList() { + auto returnValue = new TList(); + + for(unsigned int i=0; i<10;++i) { + returnValue->Add(new TList()); + returnValue->Add(new TMap()); + returnValue->Add(new TObjString()); + returnValue->Add(new TH1F()); + returnValue->Add(new TH1D()); + } + + return returnValue; +} + +int main(int argc, char** argv) { + + auto values = parseOptionsForNumberOfThreadsAndgDebug(argc,argv); + + const int kNThreads = values.first; + countdownToWrite = kNThreads; + + gDebug = values.second; + + //Tell Root we want to be multi-threaded + TThread::Initialize(); + //When threading, also have to keep ROOT from logging all TObjects into a list + TObject::SetObjectStat(false); + //Have to avoid having Streamers modify themselves after they have been used + TVirtualStreamerInfo::Optimize(false); + + + + std::vector> threads; + threads.reserve(kNThreads); + + + + for(int i=0; i< kNThreads; ++i) { + threads.push_back(std::make_shared( std::thread([i]() { + static thread_local TThread s_thread_guard; + + std::stringstream nameStream; + nameStream <<"write_thread_"<Branch("theList","TList",&theList); + + --countdownToWrite; + while(countdownToWrite !=0) ; + + for(unsigned int i = 0; i<100;++i) { + listTree->Fill(); + } + f.Write(); + f.Close(); + }) ) ); + + } + waitToStart = false; + for(auto& t : threads) { + t->join(); + } + + return 0; +} + diff --git a/FWCore/RootAutoLibraryLoader/BuildFile.xml b/FWCore/RootAutoLibraryLoader/BuildFile.xml deleted file mode 100644 index 99e9d2b2d693f..0000000000000 --- a/FWCore/RootAutoLibraryLoader/BuildFile.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h b/FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h deleted file mode 100644 index f7c2c5097be46..0000000000000 --- a/FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef LibraryLoader_RootAutoLibraryLoader_h -#define LibraryLoader_RootAutoLibraryLoader_h -/**\class RootAutoLibraryLoader - * - * ROOT helper class which can automatically load the - * proper shared library when ROOT needs a new class dictionary - * - * \author Chris Jones, Cornell - * - */ -#include "TClassGenerator.h" -#include "RVersion.h" - -#include - -class DummyClassToStopCompilerWarning; - -namespace edm { -class RootAutoLibraryLoader : public TClassGenerator { - friend class DummyClassToStopCompilerWarning; -public: - /// return class type - virtual TClass *GetClass(char const* classname, Bool_t load); - /// return class type - virtual TClass *GetClass(type_info const& typeinfo, Bool_t load); - /// interface for TClass generators - //ClassDef(RootAutoLibraryLoader,1); - /// enable automatic library loading - static void enable(); - - /// load all known libraries holding dictionaries - static void loadAll(); - -private: - char const* classNameAttemptingToLoad_; //! - RootAutoLibraryLoader(); - RootAutoLibraryLoader(RootAutoLibraryLoader const&); // stop default - RootAutoLibraryLoader const& operator=(RootAutoLibraryLoader const&); // stop default -#if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,6) - bool isInitializingCintex_; -#endif -}; - -} -#endif diff --git a/FWCore/RootAutoLibraryLoader/src/RootAutoLibraryLoader.cc b/FWCore/RootAutoLibraryLoader/src/RootAutoLibraryLoader.cc deleted file mode 100644 index f4294a918d301..0000000000000 --- a/FWCore/RootAutoLibraryLoader/src/RootAutoLibraryLoader.cc +++ /dev/null @@ -1,441 +0,0 @@ -// -*- C++ -*- -// -// Package: LibraryLoader -// Class : RootAutoLibraryLoader -// -// Implementation: -// -// -// Original Author: -// Created: Wed Nov 30 14:55:01 EST 2005 -// - -// system include files -#include -#include -#include -#include "TROOT.h" -#include "TInterpreter.h" -#include "TVirtualMutex.h" -#include "G__ci.h" - -// user include files -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" -#include "FWCore/RootAutoLibraryLoader/src/stdNamespaceAdder.h" - -#include "FWCore/PluginManager/interface/PluginManager.h" -#include "FWCore/PluginManager/interface/ProblemTracker.h" -#include "FWCore/PluginManager/interface/PluginCapabilities.h" -#include "FWCore/Utilities/interface/DictionaryTools.h" -#include "FWCore/Utilities/interface/Exception.h" - -#include "Cintex/Cintex.h" -#include "TClass.h" - -// We cannot use the MessageLogger here because this is also used by standalones that do not have the logger. - -// -// constants, enums and typedefs -// -namespace { - //Based on http://root.cern.ch/lxr/source/cintex/src/CINTSourceFile.h - // If a Cint dictionary is accidently loaded as a side effect of loading a CMS - // library Cint must have a file name assigned to that dictionary else Cint may crash - class RootLoadFileSentry { - public: - RootLoadFileSentry() { - R__LOCKGUARD2(gCINTMutex); - G__setfilecontext("{CMS auto library loader}", &oldIFile_); - } - - ~RootLoadFileSentry() { - R__LOCKGUARD2(gCINTMutex); - G__input_file* ifile = G__get_ifile(); - if (ifile) { - *ifile = oldIFile_; - } - } - - private: - G__input_file oldIFile_; - }; -} - -// -// static data member definitions -// -//hold onto the previous autolibrary loader -typedef int (*CallbackPtr)(char*, char*); -static CallbackPtr gPrevious = nullptr; -static char const* kDummyLibName = "*dummy"; - -//This is actually defined within ROOT's v6_struct.cxx file but is not declared static -// I want to use it so that if the autoloading is already turned on, I can call the previously declared routine -extern CallbackPtr G__p_class_autoloading; - -namespace ROOT { - namespace Cintex { - std::string CintName(std::string const&); - } -} - -namespace edm { - namespace { - - std::map& - cintToReflexSpecialCasesMap() { - static std::map s_map; - return s_map; - } - - void - addWrapperOfVectorOfBuiltin(std::map& iMap, char const* iBuiltin) { - static std::string const sReflexPrefix("edm::Wrapper >"); - - //Wrapper > > - static std::string const sCintPrefix("Wrapper > >"); - - std::string type(iBuiltin); - iMap.insert(make_pair(sCintPrefix + type + sCintMiddle + type + sCintPostfix, - sReflexPrefix + type + sReflexPostfix)); - } - - std::string - classNameForRoot(std::string const& classname) { - // Converts the name to the name known by CINT (e.g. strips out "std::") - return ROOT::Cintex::CintName(classname); - } - - bool - isDictionaryLoaded(std::string const& rootclassname) { - // This checks if the class name is known to the interpreter. - // In this context, this will be true if and only if the dictionary has been loaded (and converted to CINT). - // This code is independent of the identity of the interpreter. - ClassInfo_t* info = gInterpreter->ClassInfo_Factory(rootclassname.c_str()); - return gInterpreter->ClassInfo_IsValid(info); - } - - bool loadLibraryForClass(char const* classname) { - //std::cout << "loadLibaryForClass" << std::endl; - if(nullptr == classname) { - return false; - } - //std::cout << "asking to find " << classname << std::endl; - std::string const& cPrefix = dictionaryPlugInPrefix(); - //std::cout << "asking to find " << cPrefix + classname << std::endl; - std::string rootclassname = classNameForRoot(classname); - try { - //give ROOT a name for the file we are loading - RootLoadFileSentry sentry; - if(edmplugin::PluginCapabilities::get()->tryToLoad(cPrefix + classname)) { - if(!isDictionaryLoaded(rootclassname)) { - //would be nice to issue a warning here. Not sure the remainder of this comment is correct. - // this message happens too often (too many false positives) to be useful plus ROOT will complain about a missing dictionary - //std::cerr << "Warning: ROOT knows about type '" << classname << "' but has no dictionary for it." << std::endl; - return false; - } - } else { - //see if adding a std namespace helps - std::string name = root::stdNamespaceAdder(classname); - //std::cout << "see if std helps" << std::endl; - if (not edmplugin::PluginCapabilities::get()->tryToLoad(cPrefix + name)) { - // Too many false positives on built-in types here. - return false; - } - if(!isDictionaryLoaded(rootclassname)) { - //would be nice to issue a warning here - return false; - } - } - } catch(cms::Exception& e) { - //would be nice to issue a warning here - return false; - } - //std::cout << "loaded " << classname << std::endl; - return true; - } - - //Based on code in ROOT's TCint.cxx file - - int ALL_AutoLoadCallback(char* c, char* l) { - //NOTE: if the library (i.e. 'l') is an empty string this means we are dealing with a namespace - // These checks appear to avoid a crash of ROOT during shutdown of the application - if(nullptr == c || nullptr == l || l[0] == 0) { - return 0; - } - ULong_t varp = G__getgvp(); - G__setgvp((long)G__PVOID); - int result = loadLibraryForClass(c) ? 1:0; - G__setgvp(varp); - //NOTE: the check for the library is done since we can have a failure - // if a CMS library has an incomplete set of reflex dictionaries where - // the remaining dictionaries can be found by Cint. If the library with - // the reflex dictionaries is loaded first, then the Cint library then any - // requests for a Type from the reflex library will fail because for - // some reason the loading of the Cint library causes reflex to forget about - // what types it already loaded from the reflex library. This problem was - // seen for libDataFormatsMath and libMathCore. I do not print an error message - // since the dictionaries are actually loaded so things work fine. - if(!result && 0 != strcmp(l, kDummyLibName) && gPrevious) { - result = gPrevious(c, l); - } - return result; - } - - //Cint requires that we register the type and library containing the type - // before the autoloading will work - struct CompareFirst { - bool operator()(std::pair const& iLHS, - std::pair const& iRHS) const{ - return iLHS.first > iRHS.first; - } - }; - - void registerTypes() { - edmplugin::PluginManager* db = edmplugin::PluginManager::get(); - - typedef edmplugin::PluginManager::CategoryToInfos CatToInfos; - - CatToInfos::const_iterator itFound = db->categoryToInfos().find("Capability"); - - if(itFound == db->categoryToInfos().end()) { - return; - } - - //in order to determine if a name is from a class or a namespace, we will order - // all the classes in descending order so that embedded classes will be seen before - // their containing classes, that way we can say the containing class is a namespace - // before finding out it is actually a class - typedef std::vector > ClassAndLibraries; - ClassAndLibraries classes; - classes.reserve(1000); - std::string lastClass; - - //find where special cases come from - std::map specialsToLib; - std::map const& specials = cintToReflexSpecialCasesMap(); - for(auto const& special : specials) { - specialsToLib[classNameForRoot(special.second)]; - } - std::string const& cPrefix = dictionaryPlugInPrefix(); - for(auto const& info : itFound->second) { - if (lastClass == info.name_) { - continue; - } - lastClass = info.name_; - if(cPrefix == lastClass.substr(0, cPrefix.size())) { - std::string className = classNameForRoot(lastClass.c_str() + cPrefix.size()); - classes.emplace_back(className, info.loadable_.string()); - std::map::iterator iFound = specialsToLib.find(className); - if(iFound != specialsToLib.end()) { - // std::cout << "Found " << lastClass << " : " << className << std::endl; - iFound->second = info.loadable_.string(); - } - } - } - //sort_all(classes, std::greater()); - //sort_all(classes, CompareFirst()); - //the values are already sorted by less, so just need to reverse to get greater - for(ClassAndLibraries::reverse_iterator itClass = classes.rbegin(), itClassEnd = classes.rend(); - itClass != itClassEnd; - ++itClass) { - - std::string const& className = itClass->first; - std::string const& libraryName = itClass->second; - //need to register namespaces and figure out if we have an embedded class - static std::string const toFind(":<"); - std::string::size_type pos = 0; - while(std::string::npos != (pos = className.find_first_of(toFind, pos))) { - if (className[pos] == '<') {break;} - if (className.size() <= pos + 1 || className[pos + 1] != ':') {break;} - //should check to see if this is a class or not - G__set_class_autoloading_table(const_cast(className.substr(0, pos).c_str()), const_cast("")); - //std::cout << "namespace " << className.substr(0, pos).c_str() << std::endl; - pos += 2; - } - G__set_class_autoloading_table(const_cast(className.c_str()), const_cast(libraryName.c_str())); - //std::cout << "class " << className.c_str() << std::endl; - } - - //now handle the special cases - for(auto const& special : specials) { - std::string const& name = special.second; - std::string rootname = classNameForRoot(name); - //std::cout << "registering special " << itSpecial->first << " " << name << " " << std::endl << " " << specialsToLib[rootname] << std::endl; - //force loading of specials - if(specialsToLib[rootname].size()) { - //std::cout << "&&&&& found special case " << itSpecial->first << std::endl; - if(!isDictionaryLoaded(rootname) and - (not edmplugin::PluginCapabilities::get()->tryToLoad(cPrefix + name))) { - std::cout << "failed to load plugin for " << cPrefix + name << std::endl; - continue; - } else { - //need to construct the Class ourselves - if(!isDictionaryLoaded(rootname)) { - std::cout << "dictionary did not build " << name << std::endl; - continue; - } - TClass* namedClass = TClass::GetClass(rootname.c_str()); - if(nullptr == namedClass) { - std::cout << "failed to get TClass for " << name << std::endl; - continue; - } - namedClass->Clone(special.first.c_str()); - std::string magictypedef("namespace edm { typedef "); - magictypedef += rootname + " " + special.first + "; }"; - // std::cout << "Magic typedef " << magictypedef << std::endl; - gROOT->ProcessLine(magictypedef.c_str()); - } - } - } - } - } - - // - // constructors and destructor - // - RootAutoLibraryLoader::RootAutoLibraryLoader() : -#if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,6) - classNameAttemptingToLoad_(nullptr), - isInitializingCintex_(true) { -#else - classNameAttemptingToLoad_(nullptr) { -#endif - AssertHandler h; - gROOT->AddClassGenerator(this); - ROOT::Cintex::Cintex::Enable(); -#if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,6) - isInitializingCintex_ =false; -#endif - //set the special cases - std::map& specials = cintToReflexSpecialCasesMap(); - if(specials.empty()) { - addWrapperOfVectorOfBuiltin(specials,"bool"); - - addWrapperOfVectorOfBuiltin(specials,"char"); - addWrapperOfVectorOfBuiltin(specials,"unsigned char"); - addWrapperOfVectorOfBuiltin(specials,"signed char"); - addWrapperOfVectorOfBuiltin(specials,"short"); - addWrapperOfVectorOfBuiltin(specials,"unsigned short"); - addWrapperOfVectorOfBuiltin(specials,"int"); - addWrapperOfVectorOfBuiltin(specials,"unsigned int"); - addWrapperOfVectorOfBuiltin(specials,"long"); - addWrapperOfVectorOfBuiltin(specials,"unsigned long"); - addWrapperOfVectorOfBuiltin(specials,"long long"); - addWrapperOfVectorOfBuiltin(specials,"unsigned long long"); - - addWrapperOfVectorOfBuiltin(specials,"float"); - addWrapperOfVectorOfBuiltin(specials,"double"); - } - //std::cout << "my loader" << std::endl; - //remember if the callback was already set so we can chain together our results - gPrevious = G__p_class_autoloading; - G__set_class_autoloading_callback(&ALL_AutoLoadCallback); - registerTypes(); - } - - // - // member functions - // - - TClass* - RootAutoLibraryLoader::GetClass(char const* classname, Bool_t load) { - TClass* returnValue = nullptr; - if(classNameAttemptingToLoad_ != nullptr && !strcmp(classname, classNameAttemptingToLoad_)) { - // We can try to see if the class name contains "basic_string". - // If so, we replace "basic_string" with "string" and try again. - std::string className(classname); - std::string::size_type idx = className.find("basic_string"); - if (idx != std::string::npos) { - className.replace(idx, 18, std::string("string")); - //if basic_string was the last argument to a templated class - // then there would be an extra space to separate the two '>' - if(className.size() > idx + 6 && className[idx + 6] == ' ') { - className.replace(idx + 6, 1, ""); - } - classNameAttemptingToLoad_ = className.c_str(); - returnValue = TClass::GetClass(className.c_str(), kTRUE); - classNameAttemptingToLoad_ = classname; - return returnValue; - } - //NOTE: As of ROOT 5.27.06 this warning generates false positives for HepMC classes because - // ROOT has special handling for them built into class.rules - //std::cerr << "WARNING[RootAutoLibraryLoader]: ROOT failed to create CINT dictionary for " << classname << std::endl; - return nullptr; - } - //std::cout << "looking for " << classname << " load " << (load? "T":"F") << std::endl; - if (load) { - //std::cout << " going to call loadLibraryForClass" << std::endl; - //[ROOT 5.28] When Cintex is in its 'Enable' method it will register callbacks to build - // TClasses. During this phase we do not want to actually force TClasses to have to - // come into existence. -#if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,6) - if (not isInitializingCintex_ and loadLibraryForClass(classname)) { -#else - if (loadLibraryForClass(classname)) { -#endif - //use this to check for infinite recursion attempt - classNameAttemptingToLoad_ = classname; - // This next call will create the TClass object for the class. - // It will also attempt to load the dictionary for the class - // if the second argument is kTRUE. This is the default, so it - // need not be explicitly specified. - returnValue = TClass::GetClass(classname, kTRUE); - classNameAttemptingToLoad_ = nullptr; - } - } - return returnValue; - } - - TClass* - RootAutoLibraryLoader::GetClass(type_info const& typeinfo, Bool_t load) { - //std::cout << "looking for type " << typeinfo.name() << std::endl; - TClass* returnValue = nullptr; - if(load) { - return GetClass(typeinfo.name(), load); - } - return returnValue; - } - - void - RootAutoLibraryLoader::enable() { - //static BareRootProductGetter s_getter; - //static EDProductGetter::Operate s_op(&s_getter); - static RootAutoLibraryLoader s_loader; - } - - void - RootAutoLibraryLoader::loadAll() { - // std::cout << "LoadAllDictionaries" << std::endl; - enable(); - - edmplugin::PluginManager* db = edmplugin::PluginManager::get(); - - typedef edmplugin::PluginManager::CategoryToInfos CatToInfos; - - CatToInfos::const_iterator itFound = db->categoryToInfos().find("Capability"); - - if(itFound == db->categoryToInfos().end()) { - return; - } - std::string lastClass; - - //give ROOT a name for the file we are loading - RootLoadFileSentry sentry; - - for(auto const& info : itFound->second) { - if (lastClass == info.name_) { - continue; - } - - lastClass = info.name_; - edmplugin::PluginCapabilities::get()->load(lastClass); - //NOTE: since we have the library already, we could be more efficient if we just load it ourselves - } - } -} - -//ClassImp(RootAutoLibraryLoader) diff --git a/FWCore/RootAutoLibraryLoader/src/stdNamespaceAdder.cc b/FWCore/RootAutoLibraryLoader/src/stdNamespaceAdder.cc deleted file mode 100644 index 1e7e59f86de90..0000000000000 --- a/FWCore/RootAutoLibraryLoader/src/stdNamespaceAdder.cc +++ /dev/null @@ -1,35 +0,0 @@ -// -*- C++ -*- -// -// Package: RootAutoLibraryLoader -// Class : stdNamespaceAdder -// -// Implementation: -// -// -// Original Author: -// Created: Tue Dec 6 09:18:05 EST 2005 -// - -// system include files -#include "boost/regex.hpp" - -// user include files -#include "FWCore/RootAutoLibraryLoader/src/stdNamespaceAdder.h" - - -// -// constants, enums and typedefs -// -namespace edm { - namespace root { - std::string stdNamespaceAdder(const std::string& iClassName) - { - //adds the std:: prefix to vector, string, map, list or deque if it is not - // already there - static const boost::regex e("(^|[^[:alnum:]_:])((?:vector)|(?:string)|(?:map)|(?:list)|(?:deque))"); - const std::string format("\\1std::\\2"); - - return regex_replace(iClassName, e, format, boost::match_default | boost::format_sed); - } - } -} diff --git a/FWCore/RootAutoLibraryLoader/src/stdNamespaceAdder.h b/FWCore/RootAutoLibraryLoader/src/stdNamespaceAdder.h deleted file mode 100644 index e3085670f51fc..0000000000000 --- a/FWCore/RootAutoLibraryLoader/src/stdNamespaceAdder.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef FWLite_stdNamespaceAdder_h -#define FWLite_stdNamespaceAdder_h -// -*- C++ -*- -// -// Package: FWLite -// Class : stdNamespaceAdder -// -/**\class stdNamespaceAdder stdNamespaceAdder.h FWCore/RootAutoLibraryLoader/interface/stdNamespaceAdder.h - - Description: Adds back the 'std::' namespace prefix to standard classes - - Usage: - - -*/ -// -// Original Author: -// Created: Tue Dec 6 09:18:09 EST 2005 -// - -// system include files -#include - -// user include files - -// forward declarations -namespace edm { - namespace root { - std::string stdNamespaceAdder(const std::string&); - } -} -#endif diff --git a/FWCore/RootAutoLibraryLoader/test/BuildFile.xml b/FWCore/RootAutoLibraryLoader/test/BuildFile.xml deleted file mode 100644 index 1a78515f697f8..0000000000000 --- a/FWCore/RootAutoLibraryLoader/test/BuildFile.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/FWCore/RootAutoLibraryLoader/test/rootautolibraryloader_t.cppunit.cpp b/FWCore/RootAutoLibraryLoader/test/rootautolibraryloader_t.cppunit.cpp deleted file mode 100644 index 85e58f069064c..0000000000000 --- a/FWCore/RootAutoLibraryLoader/test/rootautolibraryloader_t.cppunit.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/*---------------------------------------------------------------------- - -Test program for RootAutoLibraryLoader class. -Changed by Viji on 29-06-2005 - - ----------------------------------------------------------------------*/ - -#include -#include -#include - -#include -#include "FWCore/PluginManager/interface/PluginManager.h" -#include "FWCore/PluginManager/interface/standard.h" - -#define private public -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" -#undef private - -class testRootAutoLibraryLoader: public CppUnit::TestFixture -{ -CPPUNIT_TEST_SUITE(testRootAutoLibraryLoader); - -CPPUNIT_TEST(testString); - -CPPUNIT_TEST_SUITE_END(); - -public: - void setUp(){} - void tearDown(){} - - void testString(); -}; - -static edm::RootAutoLibraryLoader* createLoader() -{ - static edm::RootAutoLibraryLoader s_loader; - return &s_loader; -} -///registration of the test so that the runner can find it -CPPUNIT_TEST_SUITE_REGISTRATION(testRootAutoLibraryLoader); - -void testRootAutoLibraryLoader::testString() -{ - if(not edmplugin::PluginManager::isAvailable()) { - edmplugin::PluginManager::configure(edmplugin::standard::config()); - } - edm::RootAutoLibraryLoader* loader = createLoader(); - - CPPUNIT_ASSERT(0!=loader->GetClass("edm::Wrapper >", true)); - - CPPUNIT_ASSERT(0==loader->GetClass("ThisClassDoesNotExist",true)); -} diff --git a/FWCore/RootAutoLibraryLoader/test/stdnamespaceadder_t.cppunit.cpp b/FWCore/RootAutoLibraryLoader/test/stdnamespaceadder_t.cppunit.cpp deleted file mode 100644 index 297e33e5db716..0000000000000 --- a/FWCore/RootAutoLibraryLoader/test/stdnamespaceadder_t.cppunit.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/*---------------------------------------------------------------------- - -Test program for edm::TypeIDBase class. -Changed by Viji on 29-06-2005 - - ----------------------------------------------------------------------*/ - -#include -#include -#include -#include -#include "FWCore/RootAutoLibraryLoader/src/stdNamespaceAdder.h" - -class testSTDNamespaceAdder: public CppUnit::TestFixture -{ -CPPUNIT_TEST_SUITE(testSTDNamespaceAdder); - -CPPUNIT_TEST(tests); - -CPPUNIT_TEST_SUITE_END(); -public: - void setUp(){} - void tearDown(){} - - void tests(); -}; - -///registration of the test so that the runner can find it -CPPUNIT_TEST_SUITE_REGISTRATION(testSTDNamespaceAdder); - -void testSTDNamespaceAdder::tests() -{ - using namespace edm::root; - - static const std::string kVectorBlahNoNS("vector"); - static const std::string kVectorBlahNS("std::vector"); - static const std::string kTVectorBlah("Tvector"); - static const std::string kVectorVectorBlahNoNS("vector >"); - static const std::string kVectorVectorBlahNS("std::vector >"); - - //cout <<" substitution \""< diff --git a/FWCore/Services/BuildFile.xml b/FWCore/Services/BuildFile.xml index 5dc4207a6afbc..7891702dc3ae2 100644 --- a/FWCore/Services/BuildFile.xml +++ b/FWCore/Services/BuildFile.xml @@ -4,7 +4,6 @@ - diff --git a/FWCore/Services/src/InitRootHandlers.cc b/FWCore/Services/src/InitRootHandlers.cc index 9c4ffd0a6535b..0af4a7e4fda55 100644 --- a/FWCore/Services/src/InitRootHandlers.cc +++ b/FWCore/Services/src/InitRootHandlers.cc @@ -5,7 +5,6 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/PluginManager/interface/PluginCapabilities.h" -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/DictionaryTools.h" @@ -16,11 +15,10 @@ #include #include -#include "Cintex/Cintex.h" -#include "G__ci.h" #include "TROOT.h" #include "TError.h" #include "TFile.h" +#include "TInterpreter.h" #include "TH1.h" #include "TSystem.h" #include "TUnixSystem.h" @@ -29,8 +27,6 @@ #include "TThread.h" #include "TClassTable.h" -#include "Reflex/Type.h" - namespace { enum class SeverityLevel { @@ -123,9 +119,7 @@ namespace { (el_message.find("already in TClassTable") != std::string::npos) || (el_message.find("matrix not positive definite") != std::string::npos) || (el_message.find("not a TStreamerInfo object") != std::string::npos) || - //This deals with a missing dictionary problem - ( (el_message.find("Collection proxy for") !=std::string::npos && - el_message.find("was not properly initialized!") != std::string::npos)) || + (el_message.find("Problems declaring payload") != std::string::npos) || (el_location.find("Fit") != std::string::npos) || (el_location.find("TDecompChol::Solve") != std::string::npos) || (el_location.find("THistPainter::PaintInit") != std::string::npos) || @@ -264,25 +258,19 @@ namespace edm { // Enable automatic Root library loading. if(autoLibraryLoader_) { - RootAutoLibraryLoader::enable(); - if(loadAllDictionaries_) { - RootAutoLibraryLoader::loadAll(); - } + gInterpreter->SetClassAutoloading(1); } - // Enable Cintex. - ROOT::Cintex::Cintex::Enable(); - // Set ROOT parameters. TTree::SetMaxTreeSize(kMaxLong64); TH1::AddDirectory(kFALSE); - G__SetCatchException(0); + //G__SetCatchException(0); // Set custom streamers setRefCoreStreamer(); // Load the library containing dictionaries for std:: classes, if not already loaded. - if (!TypeWithDict(typeid(std::vector >)).hasDictionary()) { + if (!hasDictionary(typeid(std::vector >))) { edmplugin::PluginCapabilities::get()->load(dictionaryPlugInPrefix() + "std::vector >"); } diff --git a/FWCore/Services/src/LoadAllDictionaries.cc b/FWCore/Services/src/LoadAllDictionaries.cc index 8184ba61c0522..f39019c0c9465 100644 --- a/FWCore/Services/src/LoadAllDictionaries.cc +++ b/FWCore/Services/src/LoadAllDictionaries.cc @@ -11,7 +11,6 @@ // // system include files -#include "Cintex/Cintex.h" // user include files #include "FWCore/Services/src/LoadAllDictionaries.h" @@ -36,8 +35,6 @@ edm::service::LoadAllDictionaries::LoadAllDictionaries(const edm::ParameterSet& { bool doLoad(iConfig.getUntrackedParameter("doLoad")); if(doLoad) { - ROOT::Cintex::Cintex::Enable(); - edmplugin::PluginManager*db = edmplugin::PluginManager::get(); typedef edmplugin::PluginManager::CategoryToInfos CatToInfos; diff --git a/FWCore/Services/test/fpe_test_2.sh b/FWCore/Services/test/fpe_test_2.sh index 3ce68429e464c..47c94eb3727b9 100755 --- a/FWCore/Services/test/fpe_test_2.sh +++ b/FWCore/Services/test/fpe_test_2.sh @@ -5,12 +5,12 @@ ulimit -c 0 CONFIG=${LOCAL_TEST_DIR}/fpe_test_2_cfg.py echo "***" -echo "If the test is successful, cmsRun will fail (abort) with error status 139 or 11." +echo "If the test is successful, cmsRun will fail (abort) with error status 136 or 11." echo "The purpose is to test that floating point exceptions cause failures." echo "If the floating point exception does not cause the cmsRun job to" echo "abort, an explicit exception will thrown from CMS code that also causes" echo "an abort, but this time with error status 65." -echo "The values 139 and 11 depend on things underneath that CMS does not" +echo "The values 136 and 11 depend on things underneath that CMS does not" echo "control. These values have changed before and may change again. If" echo "they do, someone will need to investigate and change the criteria in" echo "this shell script (fpe_test_2.sh)." @@ -51,8 +51,8 @@ unset OVERFLOW echo "Completed cmsRun with DIVIDEBYZERO exception enabled" echo "cmsRun status: " $status -if [ $status -ne 139 -a $status -ne 11 ] ; then - echo "Test FAILED, status neither 139 nor 11" +if [ $status -ne 136 -a $status -ne 11 ] ; then + echo "Test FAILED, status neither 136 nor 11" exit 1 fi @@ -70,8 +70,8 @@ unset OVERFLOW echo "Completed cmsRun with INVALID exception enabled" echo "cmsRun status: " $status -if [ $status -ne 139 -a $status -ne 11 ] ; then - echo "Test FAILED, status neither 139 nor 11" +if [ $status -ne 136 -a $status -ne 11 ] ; then + echo "Test FAILED, status neither 136 nor 11" exit 1 fi @@ -89,8 +89,8 @@ unset OVERFLOW echo "Completed cmsRun with OVERFLOW exception enabled" echo "cmsRun status: " $status -if [ $status -ne 139 -a $status -ne 11 ] ; then - echo "Test FAILED, status neither 139 nor 11" +if [ $status -ne 136 -a $status -ne 11 ] ; then + echo "Test FAILED, status neither 136 nor 11" exit 1 fi @@ -108,8 +108,8 @@ unset OVERFLOW echo "Completed cmsRun with UNDERFLOW exception enabled" echo "cmsRun status: " $status -if [ $status -ne 139 -a $status -ne 11 ] ; then - echo "Test FAILED, status neither 139 nor 11" +if [ $status -ne 136 -a $status -ne 11 ] ; then + echo "Test FAILED, status neither 136 nor 11" exit 1 fi diff --git a/FWCore/TFWLiteSelector/interface/TFWLiteSelector.h b/FWCore/TFWLiteSelector/interface/TFWLiteSelector.h index 8e553e60885ba..ca2686fd67823 100644 --- a/FWCore/TFWLiteSelector/interface/TFWLiteSelector.h +++ b/FWCore/TFWLiteSelector/interface/TFWLiteSelector.h @@ -50,7 +50,6 @@ class TList; // user include files #include "FWCore/TFWLiteSelector/interface/TFWLiteSelectorBasic.h" -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" // forward declarations template diff --git a/FWCore/TFWLiteSelector/interface/TFWLiteSelectorBasic.h b/FWCore/TFWLiteSelector/interface/TFWLiteSelectorBasic.h index 6e8b4c067d47e..e0ec23a5c58ff 100644 --- a/FWCore/TFWLiteSelector/interface/TFWLiteSelectorBasic.h +++ b/FWCore/TFWLiteSelector/interface/TFWLiteSelectorBasic.h @@ -25,8 +25,6 @@ allows you to access data using an edm::Event. // user include files -#include "FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h" - // forward declarations class TFile; class TList; diff --git a/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc b/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc index e308ffc446983..6127e3c034d54 100644 --- a/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc +++ b/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc @@ -51,7 +51,11 @@ #include "TChain.h" #include "TFile.h" #include "TTree.h" -#include "Reflex/Type.h" + +#include +#include +#include +#include namespace edm { namespace root { @@ -95,23 +99,23 @@ namespace edm { } //find the class type std::string const fullName = wrappedClassName(bDesc.className()); - Reflex::Type classType = Reflex::Type::ByName(fullName); - if(classType == Reflex::Type()) { + TypeWithDict classType = TypeWithDict::byName(fullName); + if(!bool(classType)) { throw cms::Exception("MissingDictionary") << "could not find dictionary for type '" << fullName << "'" << "\n Please make sure all the necessary libraries are available."; } //create an instance of it - Reflex::Object wrapperObj = classType.Construct(); - if(nullptr == wrapperObj.Address()) { + ObjectWithDict wrapperObj = classType.construct(); + if(nullptr == wrapperObj.address()) { throw cms::Exception("FailedToCreate") << "could not create an instance of '" << fullName << "'"; } - void* address = wrapperObj.Address(); + void* address = wrapperObj.address(); branch->SetAddress(&address); - Reflex::Object edProdObj = wrapperObj.CastObject(Reflex::Type::ByName("edm::WrapperBase")); + ObjectWithDict edProdObj = wrapperObj.castObject(TypeWithDict::byName("edm::WrapperBase")); - WrapperBase* prod = reinterpret_cast(edProdObj.Address()); + WrapperBase* prod = reinterpret_cast(edProdObj.address()); if(nullptr == prod) { throw cms::Exception("FailedConversion") diff --git a/FWCore/TFWLiteSelectorTest/src/ThingsTSelector2.h b/FWCore/TFWLiteSelectorTest/src/ThingsTSelector2.h index 59ba3a3615bfb..106e15a0b646f 100644 --- a/FWCore/TFWLiteSelectorTest/src/ThingsTSelector2.h +++ b/FWCore/TFWLiteSelectorTest/src/ThingsTSelector2.h @@ -34,5 +34,4 @@ public : ClassDef(ThingsTSelector2,2) }; } -template<> atomic_TClass_ptr TFWLiteSelector::fgIsA; #endif diff --git a/FWCore/Utilities/BuildFile.xml b/FWCore/Utilities/BuildFile.xml index 7b4ed5feecc18..4badf5c9a328a 100644 --- a/FWCore/Utilities/BuildFile.xml +++ b/FWCore/Utilities/BuildFile.xml @@ -1,11 +1,9 @@ - - - + diff --git a/FWCore/Utilities/interface/BaseWithDict.h b/FWCore/Utilities/interface/BaseWithDict.h index 078f401b415e2..35ceaa5defb61 100644 --- a/FWCore/Utilities/interface/BaseWithDict.h +++ b/FWCore/Utilities/interface/BaseWithDict.h @@ -2,47 +2,34 @@ #define FWCore_Utilities_BaseWithDict_h /*---------------------------------------------------------------------- - + BaseWithDict: A holder for a base class ----------------------------------------------------------------------*/ + #include class TBaseClass; namespace edm { - class TypeWithDict; - - class BaseWithDict { - // NOTE: Any use of class BaseWithDict in ROOT 5 is not thread safe without use - // of a properly scoped CINT mutex as in this example: - // { - // R__LOCKGUARD(gCintMutex); - // TypeBases bases(myType); - // for (auto const& b : bases) { - // BaseWithDict base(b); - // ... - // } - // // other use of bases goes here - // } - // The situation in ROOT 6 is not yet determined. - public: - BaseWithDict(); - - explicit BaseWithDict(TBaseClass* baseClass); - - std::string name() const; - - TypeWithDict typeOf() const; +class TypeWithDict; - bool isPublic() const; +class BaseWithDict { +private: + TBaseClass* baseClass_; +public: + BaseWithDict(); + explicit BaseWithDict(TBaseClass*); + bool isPublic() const; + std::string name() const; + TypeWithDict typeOf() const; + size_t offset() const; +}; - private: +} // namespace edm - TBaseClass* baseClass_; - }; +#include "FWCore/Utilities/interface/TypeWithDict.h" -} -#endif +#endif // FWCore_Utilities_BaseWithDict_h diff --git a/FWCore/Utilities/interface/DictionaryTools.h b/FWCore/Utilities/interface/DictionaryTools.h index dbd775eea445f..9931f1d93b97b 100644 --- a/FWCore/Utilities/interface/DictionaryTools.h +++ b/FWCore/Utilities/interface/DictionaryTools.h @@ -12,21 +12,27 @@ the CMS event model. #include #include +#include "FWCore/Utilities/interface/TypeID.h" + namespace edm { - class TypeWithDict; - typedef std::set StringSet; +class TypeID; +class TypeWithDict; +using TypeSet = std::set; + +bool checkClassDictionary(TypeID const& type); +void checkClassDictionaries(TypeID const& type, bool recursive = true); +bool checkTypeDictionary(TypeID const& type); +void checkTypeDictionaries(TypeID const& type, bool recursive = true); +void throwMissingDictionariesException(); +void loadMissingDictionaries(); +TypeSet& missingTypes(); - void checkDictionaries(std::string const& name, bool noComponents = false); - void throwMissingDictionariesException(); - void loadMissingDictionaries(); - StringSet& missingTypes(); - StringSet& foundTypes(); +void public_base_classes(TypeWithDict const& type, + std::vector& baseTypes); - void public_base_classes(TypeWithDict const& type, - std::vector& baseTypes); +std::string const& dictionaryPlugInPrefix(); - std::string const& dictionaryPlugInPrefix(); -} +} // namespace edm -#endif +#endif // FWCore_Utilities_DictionaryTools_h diff --git a/FWCore/Utilities/interface/ExceptionPropagate.h b/FWCore/Utilities/interface/ExceptionPropagate.h new file mode 100644 index 0000000000000..50aca65048e09 --- /dev/null +++ b/FWCore/Utilities/interface/ExceptionPropagate.h @@ -0,0 +1,13 @@ +#ifndef FWCore_Utilities_ExceptionPropagate_h +#define FWCore_Utilities_ExceptionPropagate_h + +#include + +namespace edm { + namespace threadLocalException { + void setException(std::exception_ptr e); + std::exception_ptr getException(); + } +} + +#endif diff --git a/FWCore/Utilities/interface/FunctionWithDict.h b/FWCore/Utilities/interface/FunctionWithDict.h index a911f3f474ac5..788b79beed897 100644 --- a/FWCore/Utilities/interface/FunctionWithDict.h +++ b/FWCore/Utilities/interface/FunctionWithDict.h @@ -2,68 +2,52 @@ #define FWCore_Utilities_FunctionWithDict_h /*---------------------------------------------------------------------- - + FunctionWithDict: A holder for a class member function ----------------------------------------------------------------------*/ -#include - -#include "Reflex/Member.h" - -namespace edm { - - class ObjectWithDict; - class TypeWithDict; - - class FunctionWithDict { - public: - FunctionWithDict() : function_() {} - - explicit FunctionWithDict(Reflex::Member const& function); - - std::string name() const; - - std::string typeName() const; - - TypeWithDict declaringType() const; - - TypeWithDict typeOf() const; - - bool isConst() const; +#include "FWCore/Utilities/interface/IterWithDict.h" - bool isConstructor() const; +#include "TMethod.h" +#include "TMethodArg.h" - bool isDestructor() const; - - bool isOperator() const; - - bool isPublic() const; - - bool isStatic() const; - - TypeWithDict returnType() const; - - TypeWithDict finalReturnType() const; - - size_t functionParameterSize(bool required = false) const; - - void invoke(ObjectWithDict const& obj, ObjectWithDict* ret, std::vector const& values = std::vector()) const; - - Reflex::Type_Iterator begin() const; - Reflex::Type_Iterator end() const; - size_t size() const { - return functionParameterSize(); - } - -#ifndef __GCCXML__ - explicit operator bool() const; -#endif - - private: +#include +#include +#include +#include +#include - Reflex::Member function_; - }; +namespace edm { -} -#endif +class ObjectWithDict; +class TypeWithDict; + +class FunctionWithDict { +private: + TMethod* function_; +public: + FunctionWithDict(); + explicit FunctionWithDict(TMethod*); + explicit operator bool() const; + std::string name() const; + std::string typeName() const; + TypeWithDict finalReturnType() const; + bool isConst() const; + bool isConstructor() const; + bool isDestructor() const; + bool isOperator() const; + bool isPublic() const; + bool isStatic() const; + TypeWithDict declaringType() const; + size_t functionParameterSize(bool required = false) const; + size_t size() const; + void invoke(ObjectWithDict const& obj, ObjectWithDict* ret = nullptr, std::vector const& values = std::vector()) const; + void invoke(ObjectWithDict* ret = nullptr, std::vector const& values = std::vector()) const; + IterWithDict begin() const; + IterWithDict end() const; +}; + +} // namespace edm + +#endif // FWCore_Utilities_FunctionWithDict_h diff --git a/FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h b/FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h deleted file mode 100644 index 14e49fe44f5e4..0000000000000 --- a/FWCore/Utilities/interface/HideStdSharedPtrFromRoot.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef FWCore_Utilities_HideStdSharedPtrFromRoot_h -#define FWCore_Utilities_HideStdSharedPtrFromRoot_h -#if defined(__GCCXML__) -// -*- C++ -*- -// -// Package: FWCore/Utilities -// Class : HideStdSharedPtrFromRoot -// -/** - - Description: gccxml can't parse std::shared_ptr so we need to give a substitute - - Usage: - gccxml has its own version of which does not include - std::shared_ptr<> so we need a declaration of the class which has - the same memory footprint and declares those methods which are seen - by gccxml. - -*/ -// -// Original Author: Chris Jones -// Created: Wed, 04 Dec 2013 16:39:12 GMT -// - -// system include files - -// user include files - -// forward declarations -namespace std { - template< typename T> - class shared_ptr { - void* data_; - unsigned long count_; - public: - shared_ptr(); - shared_ptr(T*); - template shared_ptr(const U&); - void reset(T* iValue=0); - T* get(); - T const* get() const; - - T* operator->(); - T const* operator->() const; - - T operator*() const; - - operator bool() const; - }; -} -#endif -#endif diff --git a/FWCore/Utilities/interface/IterWithDict.h b/FWCore/Utilities/interface/IterWithDict.h index 3221a7976d49a..9a3081047b083 100644 --- a/FWCore/Utilities/interface/IterWithDict.h +++ b/FWCore/Utilities/interface/IterWithDict.h @@ -2,7 +2,7 @@ #define FWCore_Utilities_IterWithDict_h /*---------------------------------------------------------------------- - + IterWithDict: An iterator for a TList so a range for loop can be used ----------------------------------------------------------------------*/ @@ -11,33 +11,33 @@ IterWithDict: An iterator for a TList so a range for loop can be used namespace edm { - class IterWithDictBase { - public: - IterWithDictBase(); - explicit IterWithDictBase(TList* list); - bool operator!=(IterWithDictBase const &) const; - - protected: - void advance(); - TIter const& iter() const; - - private: - TIter iter_; - bool atEnd_; - }; - - template - class IterWithDict : public IterWithDictBase { - public: - IterWithDict() : IterWithDictBase() {} - explicit IterWithDict(TList* list) : IterWithDictBase(list) {} - IterWithDict& operator++() { - advance(); - return *this; - } - T* operator*() const { - return static_cast(*iter()); - } - }; -} -#endif +class IterWithDictBase { +private: + TIter iter_; + bool atEnd_; +protected: + void advance(); + TIter const& iter() const; +public: + IterWithDictBase(); + explicit IterWithDictBase(TList*); + bool operator!=(IterWithDictBase const&) const; +}; + +template +class IterWithDict : public IterWithDictBase { +public: + IterWithDict() : IterWithDictBase() {} + explicit IterWithDict(TList* list) : IterWithDictBase(list) {} + IterWithDict& operator++() { + advance(); + return *this; + } + T* operator*() const { + return static_cast(*iter()); + } +}; + +} // namespace edm + +#endif // FWCore_Utilities_IterWithDict_h diff --git a/FWCore/Utilities/interface/MemberWithDict.h b/FWCore/Utilities/interface/MemberWithDict.h index 31805d4799129..8969aa3ed8ac2 100644 --- a/FWCore/Utilities/interface/MemberWithDict.h +++ b/FWCore/Utilities/interface/MemberWithDict.h @@ -2,54 +2,44 @@ #define FWCore_Utilities_MemberWithDict_h /*---------------------------------------------------------------------- - + MemberWithDict: A holder for a class member ----------------------------------------------------------------------*/ + #include class TDataMember; namespace edm { - class ObjectWithDict; - class TypeWithDict; - - class MemberWithDict { - public: - MemberWithDict(); - - explicit MemberWithDict(TDataMember* dataMember); - - std::string name() const; - - ObjectWithDict get() const; - - ObjectWithDict get(ObjectWithDict const& obj) const; - - TypeWithDict declaringType() const; - - TypeWithDict typeOf() const; - - bool isConst() const; - - bool isPublic() const; - - bool isStatic() const; - - bool isTransient() const; - - size_t offset() const; - -#ifndef __GCCXML__ - explicit operator bool() const; -#endif - - private: - - TDataMember* dataMember_; - }; - -} -#endif +class ObjectWithDict; +class TypeWithDict; + +class MemberWithDict { +private: + TDataMember* dataMember_; +public: + MemberWithDict(); + explicit MemberWithDict(TDataMember*); + explicit operator bool() const; + std::string name() const; + bool isArray() const; + bool isConst() const; + bool isPublic() const; + bool isStatic() const; + bool isTransient() const; + size_t offset() const; + TypeWithDict declaringType() const; + TypeWithDict typeOf() const; + ObjectWithDict get() const; + ObjectWithDict get(ObjectWithDict const&) const; +}; + +} // namespace edm + +#include "FWCore/Utilities/interface/ObjectWithDict.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" + +#endif // FWCore_Utilities_MemberWithDict_h diff --git a/FWCore/Utilities/interface/ObjectWithDict.h b/FWCore/Utilities/interface/ObjectWithDict.h index 73862b8abfe56..3ca178d1452d7 100644 --- a/FWCore/Utilities/interface/ObjectWithDict.h +++ b/FWCore/Utilities/interface/ObjectWithDict.h @@ -2,10 +2,11 @@ #define FWCore_Utilities_ObjectWithDict_h /*---------------------------------------------------------------------- - + ObjectWithDict: A holder for an object and its type information. ----------------------------------------------------------------------*/ + #include #include @@ -13,40 +14,32 @@ ObjectWithDict: A holder for an object and its type information. namespace edm { - class ObjectWithDict { - public: - ObjectWithDict(); - - ObjectWithDict(TypeWithDict const& type, void* address); - - ObjectWithDict(std::type_info const& typeID, void* address); - - static ObjectWithDict byType(TypeWithDict const& type); - - void* address() const; - - TypeWithDict const& typeOf() const; - - TypeWithDict dynamicType() const; - - ObjectWithDict get(std::string const& memberName) const; - -#ifndef __GCCXML__ - explicit operator bool() const; -#endif - - template T objectCast() { - return *reinterpret_cast(address_); - } - - private: - friend class FunctionWithDict; - friend class MemberWithDict; - friend class TypeWithDict; - - TypeWithDict type_; - void* address_; - }; - -} -#endif +class ObjectWithDict { +private: + TypeWithDict type_; + void* address_; +public: + static ObjectWithDict byType(TypeWithDict const&); +public: + ObjectWithDict(); + explicit ObjectWithDict(TypeWithDict const&, void* address); + explicit ObjectWithDict(std::type_info const&, void* address); + explicit operator bool() const; + void* address() const; + TypeWithDict typeOf() const; + TypeWithDict dynamicType() const; + ObjectWithDict castObject(TypeWithDict const&) const; + ObjectWithDict get(std::string const& memberName) const; + //ObjectWithDict construct() const; + void destruct(bool dealloc) const; + template + T + objectCast() { + return *reinterpret_cast(address_); + } +}; + +} // namespace edm + + +#endif // FWCore_Utilities_ObjectWithDict_h diff --git a/FWCore/Utilities/interface/TypeWithDict.h b/FWCore/Utilities/interface/TypeWithDict.h index 1ea19390d4081..3e8c9673046c2 100644 --- a/FWCore/Utilities/interface/TypeWithDict.h +++ b/FWCore/Utilities/interface/TypeWithDict.h @@ -2,241 +2,189 @@ #define FWCore_Utilities_TypeWithDict_h /*---------------------------------------------------------------------- - + TypeWithDict: A unique identifier for a C++ type, with the dictionary information The identifier is unique within an entire program, but can not be persisted across invocations of the program. ----------------------------------------------------------------------*/ -#include -#include -#include -#include +#include "FWCore/Utilities/interface/IterWithDict.h" +#include "FWCore/Utilities/interface/value_ptr.h" #include "TBaseClass.h" #include "TClass.h" #include "TDataMember.h" #include "TDataType.h" +#include "TEnum.h" #include "TMethod.h" +#include "TMethodArg.h" -#include "FWCore/Utilities/interface/IterWithDict.h" -#include "Reflex/Member.h" -#include "Reflex/Type.h" -#include "Reflex/TypeTemplate.h" - -class TBaseClass; -class TDataMember; -class TMethod; -class TMethodArg; +#include +#include +#include +#include namespace edm { - class FunctionWithDict; - class MemberWithDict; - class ObjectWithDict; - - enum TypeMemberQuery { - InheritedDefault = Reflex::INHERITEDMEMBERS_DEFAULT, - InheritedNo = Reflex::INHERITEDMEMBERS_NO, - InheritedAlso = Reflex::INHERITEDMEMBERS_ALSO - }; - - class TypeWithDict { - public: - - TypeWithDict(); - - explicit TypeWithDict(std::type_info const& t); - - explicit TypeWithDict(std::type_info const& t, Long_t property); - - explicit TypeWithDict(Reflex::Type const& type); - - explicit TypeWithDict(TypeWithDict const& type, Long_t property); - - explicit TypeWithDict(TClass* type, Long_t property = (Long_t)kIsClass); - - explicit TypeWithDict(TMethodArg* arg); - - static TypeWithDict - byName(std::string const& className); - - static TypeWithDict - byName(std::string const& className, Long_t property); - - // Print out the name of the type, using the dictionary class name. - void print(std::ostream& os) const; - - std::string qualifiedName() const; - - std::string unscopedName() const; - - std::string name() const; - - std::string userClassName() const; - - std::string friendlyClassName() const; - - bool hasDictionary() const; - - bool isClass() const; - - bool isConst() const; - - bool isEnum() const; - - bool isFundamental() const; - - bool isPointer() const; - - bool isReference() const; - - bool isTemplateInstance() const; - - bool isTypedef() const; - - bool isVirtual() const; - - TypeWithDict toType() const; - - TypeWithDict nestedType(char const* name) const; - - TypeWithDict nestedType(std::string const& name) const { - return nestedType(name.c_str()); - } - - int getBaseClassOffset(TypeWithDict const& baseClass) const; - - TypeWithDict templateArgumentAt(size_t index) const; - - std::string templateName() const; - - ObjectWithDict construct() const; - - void destruct(void* address, bool dealloc = true) const; - - void const* pointerToBaseType(void const* ptr, TypeWithDict const& derivedType) const; - - void const* pointerToContainedType(void const* ptr, TypeWithDict const& derivedType) const; - - template - void invokeByName(T& obj, std::string const& name) const { - Reflex::Member theFunction = type_.FunctionMemberByName(name); - theFunction.Invoke(obj); - } - -#ifndef __GCCXML__ - explicit operator bool() const; -#endif - - std::type_info const& typeInfo() const; - - std::type_info const& id() const; - - MemberWithDict dataMemberByName(std::string const& member) const; - - FunctionWithDict functionMemberByName(std::string const& member) const; - - FunctionWithDict functionMemberByName(std::string const& member, TypeWithDict const& signature, int mods, TypeMemberQuery memberQuery) const; - - size_t dataMemberSize() const; - - size_t functionMemberSize() const; - - int stringToEnumValue(std::string const& enumMemberName) const; - - size_t size() const; - - void* allocate() const { - return new char[size()]; - } - - void deallocate(void * obj) const { - delete [] static_cast(obj); - } - - private: - friend class BaseWithDict; - friend class FunctionWithDict; - friend class MemberWithDict; - friend class ObjectWithDict; - friend class TypeBases; - friend class TypeDataMembers; - friend class TypeFunctionMembers; - - void setProperty(); - - std::type_info const* typeInfo_; - Reflex::Type type_; - TClass* class_; - TDataType* dataType_; - Long_t property_; - }; - - inline bool operator<(TypeWithDict const& a, TypeWithDict const& b) { - return a.typeInfo().before(b.typeInfo()); - } +class FunctionWithDict; +class MemberWithDict; +class ObjectWithDict; + +class TypeBases; +class TypeDataMembers; +class TypeFunctionMembers; + +class TypeWithDict { + friend class TypeBases; + friend class TypeDataMembers; + friend class TypeFunctionMembers; + friend bool operator==(TypeWithDict const&, std::type_info const&); + typedef enum{} dummyType; // Tag for valid type, but no type_info information + typedef dummyType** invalidType; // Tag for invalid type +private: + std::type_info const* ti_; + TClass* class_; + TEnum* enum_; + TDataType* dataType_; + value_ptr > arrayDimensions_; + long property_; +public: + static TypeWithDict byName(std::string const& name); +private: + static TypeWithDict byName(std::string const& name, long property); +public: + TypeWithDict(); + TypeWithDict(TypeWithDict const&); + explicit TypeWithDict(TClass* type); + explicit TypeWithDict(TEnum* type); + explicit TypeWithDict(std::type_info const&); + explicit TypeWithDict(TMethodArg* arg); +private: + explicit TypeWithDict(std::type_info const&, long property); + explicit TypeWithDict(TClass* type, long property); + explicit TypeWithDict(TEnum* type, long property); + explicit TypeWithDict(TMethodArg* arg, long property); +public: + TypeWithDict& operator=(TypeWithDict const&); + TypeWithDict& stripConstRef(); + explicit operator bool() const; + std::type_info const& typeInfo() const; + TClass* getClass() const; + TEnum* getEnum() const; + TDataType* getDataType() const; + long getProperty() const; + bool isClass() const; + bool isConst() const; + bool isArray() const; + bool isEnum() const; + bool isFundamental() const; + bool isPointer() const; + bool isReference() const; + bool isTemplateInstance() const; + bool isTypedef() const; + bool isVirtual() const; + std::string qualifiedName() const; + std::string cppName() const; + std::string unscopedName() const; + std::string name() const; + std::string userClassName() const; + std::string friendlyClassName() const; + std::string templateName() const; + size_t size() const; + size_t arrayLength() const; + size_t arrayDimension() const; + size_t maximumIndex(size_t dim) const; + size_t dataMemberSize() const; + size_t functionMemberSize() const; + MemberWithDict dataMemberByName(std::string const&) const; + // Note: Used only by FWCore/Modules/src/EventContentAnalyzer.cc + FunctionWithDict functionMemberByName(std::string const&) const; + // Note: Used only by Fireworks/Core/src/FWModelContextMenuHandler.cc:262 + //FunctionWithDict functionMemberByName(std::string const& name, TypeWithDict const& signature, int mods, TypeMemberQuery memberQuery) const; + // Note: Used only by CondFormats/PhysicsToolsObjects/src/MVAComputer.cc + FunctionWithDict functionMemberByName(std::string const& name, std::string const& proto, bool isConst) const; + TypeWithDict nestedType(char const*) const; + TypeWithDict nestedType(std::string const&) const; + TypeWithDict finalType() const; + TypeWithDict toType() const; + void print(std::ostream& os) const; + bool hasBase(std::string const&) const; + bool hasBase(TypeWithDict const& basety) const; + int getBaseClassOffset(TypeWithDict const& baseClass) const; + TypeWithDict templateArgumentAt(size_t index) const; + void const* pointerToBaseType(void const* ptr, TypeWithDict const& derivedType) const; + void const* pointerToContainedType(void const* ptr, TypeWithDict const& derivedType) const; + int stringToEnumValue(std::string const&) const; + void* allocate() const; + void deallocate(void* address) const; + ObjectWithDict construct() const; + void destruct(void* address, bool dealloc = true) const; +}; + +// A related free function +bool hasDictionary(std::type_info const&); + +inline bool operator<(TypeWithDict const& a, TypeWithDict const& b) { + return a.name() < b.name(); +} - bool operator==(TypeWithDict const& a, TypeWithDict const& b); +bool operator==(TypeWithDict const& a, TypeWithDict const& b); - inline bool operator!=(TypeWithDict const& a, TypeWithDict const& b) { - return !(a == b); - } +inline bool operator!=(TypeWithDict const& a, TypeWithDict const& b) { + return !(a == b); +} - inline bool operator==(TypeWithDict const& a, std::type_info const& b) { - return a.typeInfo() == b; - } +bool operator==(TypeWithDict const& a, std::type_info const& b); - inline bool operator!=(TypeWithDict const& a, std::type_info const& b) { - return !(a == b); - } +inline bool operator!=(TypeWithDict const& a, std::type_info const& b) { + return !(a == b); +} - std::ostream& operator<<(std::ostream& os, TypeWithDict const& id); +inline bool operator==(std::type_info const& a, TypeWithDict const& b) { + return b == a; +} - class TypeBases { - // NOTE: Any use of class TypeBases in ROOT 5 is not thread safe without use - // of a properly scoped CINT mutex as in this example: - // { - // R__LOCKGUARD(gCintMutex); - // TypeBases bases(myType); - // // use of bases goes here - // } - // The situation in ROOT 6 is not yet determined. - public: - explicit TypeBases(TypeWithDict const& type) : type_(type.type_), class_(type.class_) {} - IterWithDict begin() const; - IterWithDict end() const; - size_t size() const; - private: - Reflex::Type const& type_; - TClass* class_; - }; - - class TypeDataMembers { - public: - explicit TypeDataMembers(TypeWithDict const& type) : type_(type.type_), class_(type.class_) {} - IterWithDict begin() const; - IterWithDict end() const; - size_t size() const; - private: - Reflex::Type const& type_; - TClass* class_; - }; - - class TypeFunctionMembers { - public: - explicit TypeFunctionMembers(TypeWithDict const& type) : type_(type.type_), class_(type.class_) {} -/* - IterWithDict begin() const; - IterWithDict end() const; -*/ - Reflex::Member_Iterator begin() const; - Reflex::Member_Iterator end() const; - size_t size() const; - private: - Reflex::Type const& type_; - TClass* class_; - }; +inline bool operator!=(std::type_info const& a, TypeWithDict const& b) { + return !(b == a); } -#endif + +std::ostream& operator<<(std::ostream& os, TypeWithDict const& id); + +class TypeBases { +private: + TClass* class_; +public: + explicit TypeBases(TypeWithDict const&); + IterWithDict begin() const; + IterWithDict end() const; + size_t size() const; +}; + +class TypeDataMembers { +private: + TClass* class_; +public: + explicit TypeDataMembers(TypeWithDict const&); + IterWithDict begin() const; + IterWithDict end() const; + size_t size() const; +}; + +class TypeFunctionMembers { +private: + TClass* class_; +public: + explicit TypeFunctionMembers(TypeWithDict const&); + IterWithDict begin() const; + IterWithDict end() const; + size_t size() const; +}; + +} // namespace edm + +#include "FWCore/Utilities/interface/FunctionWithDict.h" +#include "FWCore/Utilities/interface/MemberWithDict.h" +#include "FWCore/Utilities/interface/ObjectWithDict.h" + +#endif // FWCore_Utilities_TypeWithDict_h diff --git a/FWCore/Utilities/interface/thread_safety_macros.h b/FWCore/Utilities/interface/thread_safety_macros.h index 7c9b8bc4c3b96..3256e7fb48dc4 100644 --- a/FWCore/Utilities/interface/thread_safety_macros.h +++ b/FWCore/Utilities/interface/thread_safety_macros.h @@ -1,6 +1,6 @@ #ifndef FWCore_Utilites_thread_safe_macros_h #define FWCore_Utilites_thread_safe_macros_h -#ifndef __GCCXML__ +#ifndef __ROOTCLING__ #define CMS_THREAD_SAFE [[cms::thread_safe]] #define CMS_THREAD_GUARD(_var_) [[cms::thread_guard("#_var_")]] #else diff --git a/FWCore/Utilities/scripts/edmAddClassVersion b/FWCore/Utilities/scripts/edmAddClassVersion index 1eb43d8f2b8db..5e6aa4f9336c7 100755 --- a/FWCore/Utilities/scripts/edmAddClassVersion +++ b/FWCore/Utilities/scripts/edmAddClassVersion @@ -229,9 +229,6 @@ if __name__ == '__main__': raise RuntimeError("failed to load libFWCoreFWLite") ROOT.AutoLibraryLoader.enable() else: - if 0 != ROOT.gSystem.Load("libCintex"): - raise RuntimeError("failed to load libCintex") - ROOT.Cintex.Enable() if 0 != ROOT.gSystem.Load(options.library): raise RuntimeError("failed to load library '"+options.library+"'") diff --git a/FWCore/Utilities/scripts/edmCheckClassVersion b/FWCore/Utilities/scripts/edmCheckClassVersion index a5f39504f085d..59dcc256f4216 100755 --- a/FWCore/Utilities/scripts/edmCheckClassVersion +++ b/FWCore/Utilities/scripts/edmCheckClassVersion @@ -123,6 +123,10 @@ def checkClass(name,version,versionsToChecksums): c = ROOT.TClass.GetClass(name) if not c: raise RuntimeError("failed to load dictionary for class '"+name+"'") + temp = "checkTheClass.f(" + '"' + name + '"' + ");" + retval = ROOT.gROOT.ProcessLine(temp) + if retval == 0 : + raise RuntimeError("TClass::GetCheckSum: Failed to load dictionary for base class. See previous Error message") classChecksum = c.GetCheckSum() classVersion = c.GetClassVersion() @@ -168,14 +172,14 @@ if options.library is None: if options.checkdict : print "Dictionary checks require a specific library" else: - if 0 != ROOT.gSystem.Load("libCintex"): - raise RuntimeError("failed to load libCintex") - ROOT.Cintex.Enable() if 0 != ROOT.gSystem.Load(options.library): raise RuntimeError("failed to load library '"+options.library+"'") missingDict = 0 +ROOT.gROOT.ProcessLine("class checkclass {public: int f(char const* name) {TClass* cl = TClass::GetClass(name); bool b = false; cl->GetCheckSum(b); return (int)b;} };") +ROOT.gROOT.ProcessLine("checkclass checkTheClass;") + p = XmlParser(options.xmlfile) foundErrors = dict() for name,info in p.classes.iteritems(): diff --git a/FWCore/Utilities/src/BaseWithDict.cc b/FWCore/Utilities/src/BaseWithDict.cc index e430eafe73be6..ef2e63ff27c6d 100644 --- a/FWCore/Utilities/src/BaseWithDict.cc +++ b/FWCore/Utilities/src/BaseWithDict.cc @@ -1,19 +1,20 @@ - #include "FWCore/Utilities/interface/BaseWithDict.h" + #include "FWCore/Utilities/interface/TypeWithDict.h" #include "TBaseClass.h" namespace edm { + BaseWithDict::BaseWithDict() : baseClass_(nullptr) { } BaseWithDict::BaseWithDict(TBaseClass* baseClass) : baseClass_(baseClass) { } - TypeWithDict - BaseWithDict::typeOf() const { - return TypeWithDict(baseClass_->GetClassPointer(), baseClass_->Property()); + bool + BaseWithDict::isPublic() const { + return baseClass_->Property() & kIsPublic; } std::string @@ -21,8 +22,14 @@ namespace edm { return baseClass_->GetName(); } - bool - BaseWithDict::isPublic() const { - return (baseClass_->Property() & kIsPublic); + TypeWithDict + BaseWithDict::typeOf() const { + return TypeWithDict(baseClass_->GetClassPointer()); } -} + + size_t + BaseWithDict::offset() const { + return static_cast(baseClass_->GetDelta()); + } + +} // namespace edm diff --git a/FWCore/Utilities/src/DictionaryTools.cc b/FWCore/Utilities/src/DictionaryTools.cc index 22882eb71892d..8428f8e80f726 100644 --- a/FWCore/Utilities/src/DictionaryTools.cc +++ b/FWCore/Utilities/src/DictionaryTools.cc @@ -1,187 +1,132 @@ #include "FWCore/Utilities/interface/DictionaryTools.h" + #include "FWCore/Utilities/interface/Algorithms.h" -#include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/Utilities/interface/BaseWithDict.h" +#include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/Utilities/interface/MemberWithDict.h" +#include "FWCore/Utilities/interface/TypeID.h" #include "FWCore/Utilities/interface/TypeWithDict.h" -#include "Api.h" // for G__ClassInfo - -#include "TROOT.h" +#include "TClass.h" #include "TInterpreter.h" -#include "TVirtualMutex.h" +#include "THashTable.h" #include "boost/algorithm/string.hpp" #include "boost/thread/tss.hpp" #include #include +#include namespace edm { - std::string const& dictionaryPlugInPrefix() { + std::string const& + dictionaryPlugInPrefix() { static std::string const prefix("LCGReflex/"); return prefix; } - static StringSet foundTypes_; - static StringSet missingTypes_; - - namespace { - - int const oneParamArraySize = 6; - std::string const oneParam[oneParamArraySize] = { - "vector", - "basic_string", - "set", - "list", - "deque", - "multiset" - }; - int const twoParamArraySize = 3; - std::string const twoParam[twoParamArraySize] = { - "map", - "pair", - "multimap" - }; - - - bool - hasCintDictionary(std::string const& name) { - std::auto_ptr ci(new G__ClassInfo(name.c_str())); - return(ci.get() && ci->IsLoaded()); - } - - // Checks if there is a dictionary for the Type t. - // If noComponents is false, checks members and base classes recursively. - // If noComponents is true, checks Type t only. - void - checkType(TypeWithDict t, bool noComponents = false) { - - // ToType strips const, volatile, array, pointer, reference, etc., - // and also translates typedefs. - // To be safe, we do this recursively until we either get a void type or the same type. - for(TypeWithDict x(t.toType()); x != t && x.typeInfo() != typeid(void); t = x, x = t.toType()) {} - - std::string name(t.name()); - boost::trim(name); - - if(foundTypes().end() != foundTypes().find(name) || missingTypes().end() != missingTypes().find(name)) { - // Already been processed. Prevents infinite loop. - return; - } - - if(name.empty() || t.isFundamental() || t.isEnum() || t.typeInfo() == typeid(void)) { - foundTypes().insert(name); - return; - } + static TypeSet missingTypes_; - if(!bool(t)) { - if(hasCintDictionary(name)) { - foundTypes().insert(name); - } else { - missingTypes().insert(name); - } - return; - } + TypeSet& + missingTypes() { + return missingTypes_; + } - foundTypes().insert(name); - if(noComponents) return; - - if(name.find("std::") == 0) { - if(t.isTemplateInstance()) { - std::string::size_type n = name.find('<'); - int cnt = 0; - if(std::find(oneParam, oneParam + oneParamArraySize, name.substr(5, n - 5)) != oneParam + oneParamArraySize) { - cnt = 1; - } else if(std::find(twoParam, twoParam + twoParamArraySize, name.substr(5, n - 5)) != twoParam + twoParamArraySize) { - cnt = 2; - } - for(int i = 0; i < cnt; ++i) { - checkType(t.templateArgumentAt(i)); - } - } - } else { - TypeDataMembers members(t); - for(auto const& member : members) { - MemberWithDict m(member); - if(!m.isTransient() && !m.isStatic()) { - checkType(m.typeOf()); - } - } - { - R__LOCKGUARD(gCINTMutex); - TypeBases bases(t); - for(auto const& base : bases) { - BaseWithDict b(base); - checkType(b.typeOf()); - } - } - } + bool + checkTypeDictionary(TypeID const& type) { + TClass *cl = TClass::GetClass(type.typeInfo(), true); + if(cl == nullptr) { + // Assume not a class + return true; } - } // end unnamed namespace + if(!cl->HasDictionary()) { + missingTypes().insert(type); + return false; + } + return true; + } - StringSet& missingTypes() { - return missingTypes_; + void + checkTypeDictionaries(TypeID const& type, bool recursive) { + TClass *cl = TClass::GetClass(type.typeInfo(), true); + if(cl == nullptr) { + // Assume not a class + return; + } + THashTable result; + cl->GetMissingDictionaries(result, recursive); + for(auto const& item : result) { + TClass const* cl = static_cast(item); + missingTypes().insert(TypeID(cl->GetTypeInfo())); + } } - StringSet& foundTypes() { - // The only purpose of this cache is to stop infinite recursion. - // ROOT maintains its own internal cache. - return foundTypes_; + bool + checkClassDictionary(TypeID const& type) { + TClass *cl = TClass::GetClass(type.typeInfo(), true); + if(cl == nullptr) { + throw Exception(errors::DictionaryNotFound) + << "No TClass for class: '" << type.className() << "'" << std::endl; + } + if(!cl->HasDictionary()) { + missingTypes().insert(type); + return false; + } + return true; } - void checkDictionaries(std::string const& name, bool noComponents) { - TypeWithDict null; - TypeWithDict t(TypeWithDict::byName(name)); - if(t == null) { - if(name == std::string("void")) { - foundTypes().insert(name); - } else { - missingTypes().insert(name); - } - return; + void + checkClassDictionaries(TypeID const& type, bool recursive) { + TClass *cl = TClass::GetClass(type.typeInfo(), true); + if(cl == nullptr) { + throw Exception(errors::DictionaryNotFound) + << "No TClass for class: '" << type.className() << "'" << std::endl; + } + THashTable result; + cl->GetMissingDictionaries(result, recursive); + for(auto const& item : result) { + TClass const* cl = static_cast(item); + missingTypes().insert(TypeID(cl->GetTypeInfo())); } - checkType(t, noComponents); } - void throwMissingDictionariesException() { - if(!missingTypes().empty()) { + void + throwMissingDictionariesException() { + if (!missingTypes().empty()) { std::ostringstream ostr; - for (StringSet::const_iterator it = missingTypes().begin(), itEnd = missingTypes().end(); - it != itEnd; ++it) { - ostr << *it << "\n\n"; + for(auto const& item : missingTypes()) { + ostr << item << "\n\n"; } throw Exception(errors::DictionaryNotFound) - << "No REFLEX data dictionary found for the following classes:\n\n" - << ostr.str() - << "Most likely each dictionary was never generated,\n" - << "but it may be that it was generated in the wrong package.\n" - << "Please add (or move) the specification\n" - << "\n" - << "to the appropriate classes_def.xml file.\n" - << "If the class is a template instance, you may need\n" - << "to define a dummy variable of this type in classes.h.\n" - << "Also, if this class has any transient members,\n" - << "you need to specify them in classes_def.xml."; + << "No data dictionary found for the following classes:\n\n" + << ostr.str() + << "Most likely each dictionary was never generated,\n" + << "but it may be that it was generated in the wrong package.\n" + << "Please add (or move) the specification\n" + << "\n" + << "to the appropriate classes_def.xml file.\n" + << "If the class is a template instance, you may need\n" + << "to define a dummy variable of this type in classes.h.\n" + << "Also, if this class has any transient members,\n" + << "you need to specify them in classes_def.xml."; } } - void loadMissingDictionaries() { + void + loadMissingDictionaries() { while (!missingTypes().empty()) { - StringSet missing(missingTypes()); - for (StringSet::const_iterator it = missing.begin(), itEnd = missing.end(); - it != itEnd; ++it) { + TypeSet missing(missingTypes()); + for(auto const& item : missing) { try { - TClass::GetClass(it->c_str(), kTRUE); + TClass::GetClass(item.typeInfo(), kTRUE); } // We don't want to fail if we can't load a plug-in. - catch(...) {} + catch (...) {} } missingTypes().clear(); - for (StringSet::const_iterator it = missing.begin(), itEnd = missing.end(); - it != itEnd; ++it) { - checkDictionaries(*it); + for(auto const& item : missing) { + checkTypeDictionaries(item, true); } if (missingTypes() == missing) { break; @@ -193,51 +138,51 @@ namespace edm { throwMissingDictionariesException(); } - void public_base_classes(TypeWithDict const& typeID, - std::vector& baseTypes) { - + void + public_base_classes(TypeWithDict const& typeID, + std::vector& baseTypes) { + if (!typeID.isClass()) { + return; + } TypeWithDict type(typeID.typeInfo()); - if(type.isClass()) { - R__LOCKGUARD(gCINTMutex); - TypeBases bases(type); - for(auto const& basex : bases) { - BaseWithDict base(basex); - if(base.isPublic()) { - - TypeWithDict baseRflxType = base.typeOf(); - if(bool(baseRflxType)) { - TypeWithDict baseType(baseRflxType.typeInfo()); - - // Check to make sure this base appears only once in the - // inheritance heirarchy. - if(!search_all(baseTypes, baseType)) { - // Save the type and recursive look for its base types - baseTypes.push_back(baseType); - public_base_classes(baseType, baseTypes); - } - // For now just ignore it if the class appears twice, - // After some more testing we may decide to uncomment the following - // exception. - /* - else { - throw Exception(errors::UnimplementedFeature) - << "DataFormats/Common/src/DictionaryTools.cc in function public_base_classes.\n" - << "Encountered class that has a public base class that appears\n" - << "multiple times in its inheritance heirarchy.\n" - << "Please contact the EDM Framework group with details about\n" - << "this exception. It was our hope that this complicated situation\n" - << "would not occur. There are three possible solutions. 1. Change\n" - << "the class design so the public base class does not appear multiple\n" - << "times in the inheritance heirarchy. In many cases, this is a\n" - << "sign of bad design. 2. Modify the code that supports Views to\n" - << "ignore these base classes, but not supply support for creating a\n" - << "View of this base class. 3. Improve the View infrastructure to\n" - << "deal with this case. Class name of base class: " << baseType.Name() << "\n\n"; - } - */ - } - } + TypeBases bases(type); + for (auto const& basex : bases) { + BaseWithDict base(basex); + if (!base.isPublic()) { + continue; + } + TypeWithDict baseRflxType = base.typeOf(); + if (!bool(baseRflxType)) { + continue; } + TypeWithDict baseType(baseRflxType.typeInfo()); + // Check to make sure this base appears only once in the + // inheritance hierarchy. + if (!search_all(baseTypes, baseType)) { + // Save the type and recursive look for its base types + baseTypes.push_back(baseType); + public_base_classes(baseType, baseTypes); + } + // For now just ignore it if the class appears twice, + // After some more testing we may decide to uncomment the following + // exception. + // + //else { + // throw Exception(errors::UnimplementedFeature) + // << "DataFormats/Common/src/DictionaryTools.cc in function public_base_classes.\n" + // << "Encountered class that has a public base class that appears\n" + // << "multiple times in its inheritance heirarchy.\n" + // << "Please contact the EDM Framework group with details about\n" + // << "this exception. It was our hope that this complicated situation\n" + // << "would not occur. There are three possible solutions. 1. Change\n" + // << "the class design so the public base class does not appear multiple\n" + // << "times in the inheritance heirarchy. In many cases, this is a\n" + // << "sign of bad design. 2. Modify the code that supports Views to\n" + // << "ignore these base classes, but not supply support for creating a\n" + // << "View of this base class. 3. Improve the View infrastructure to\n" + // << "deal with this case. Class name of base class: " << baseType.Name() << "\n\n"; + //} } } -} + +} // namespace edm diff --git a/FWCore/Utilities/src/ExceptionPropagate.cc b/FWCore/Utilities/src/ExceptionPropagate.cc new file mode 100644 index 0000000000000..bdca1748af0f9 --- /dev/null +++ b/FWCore/Utilities/src/ExceptionPropagate.cc @@ -0,0 +1,15 @@ +#include "FWCore/Utilities/interface/ExceptionPropagate.h" + +namespace edm { + namespace threadLocalException { + static thread_local std::exception_ptr stdExceptionPtr; + void setException(std::exception_ptr e) { + stdExceptionPtr = e; + } + std::exception_ptr getException() { + return stdExceptionPtr; + } + } + +} + diff --git a/FWCore/Utilities/src/FunctionWithDict.cc b/FWCore/Utilities/src/FunctionWithDict.cc index 73abd2b506138..298d2c635c77f 100644 --- a/FWCore/Utilities/src/FunctionWithDict.cc +++ b/FWCore/Utilities/src/FunctionWithDict.cc @@ -1,95 +1,137 @@ - -#include "Reflex/Object.h" -#include "Reflex/Type.h" - #include "FWCore/Utilities/interface/FunctionWithDict.h" + +#include "FWCore/Utilities/interface/IterWithDict.h" #include "FWCore/Utilities/interface/ObjectWithDict.h" #include "FWCore/Utilities/interface/TypeWithDict.h" +#include "TInterpreter.h" +#include "TMethod.h" +#include "TMethodArg.h" + +#include "tbb/concurrent_unordered_map.h" + + namespace edm { + namespace { + typedef tbb::concurrent_unordered_map Map; + Map returnTypeMap; + } - FunctionWithDict::FunctionWithDict(Reflex::Member const& function) : function_(function) {} + FunctionWithDict::FunctionWithDict() : function_(nullptr) { + } - std::string - FunctionWithDict::name() const { - return function_.Name(); + FunctionWithDict::FunctionWithDict(TMethod* meth) : function_(meth) { } - std::string - FunctionWithDict::typeName() const {return function_.TypeOf().Name();} + FunctionWithDict::operator bool() const { + if (function_ == nullptr) { + return false; + } + return function_->IsValid(); + } - TypeWithDict - FunctionWithDict::typeOf() const { - return (TypeWithDict(function_.TypeOf())); + std::string FunctionWithDict::name() const { + return function_->GetName(); } - TypeWithDict - FunctionWithDict::returnType() const { - return (TypeWithDict(function_.TypeOf().ReturnType())); + std::string + FunctionWithDict::typeName() const { + return function_->GetReturnTypeNormalizedName(); } TypeWithDict FunctionWithDict::finalReturnType() const { - return (TypeWithDict(function_.TypeOf().ReturnType().FinalType())); + auto const& item = returnTypeMap.find(function_); + if(item != returnTypeMap.end()) { + return item->second; + } + TypeWithDict theType = TypeWithDict::byName(function_->GetReturnTypeNormalizedName()); + returnTypeMap.insert(std::make_pair(function_, theType)); + return theType; } TypeWithDict FunctionWithDict::declaringType() const { - return (TypeWithDict(function_.DeclaringType())); + return TypeWithDict(function_->GetClass()); } bool FunctionWithDict::isConst() const { - return function_.IsConst(); + return function_->Property() & kIsConstMethod; } bool FunctionWithDict::isConstructor() const { - return function_.IsConstructor(); + return function_->ExtraProperty() & kIsConstructor; } bool FunctionWithDict::isDestructor() const { - return function_.IsDestructor(); + return function_->ExtraProperty() & kIsDestructor; } bool FunctionWithDict::isOperator() const { - return function_.IsOperator(); + return function_->ExtraProperty() & kIsOperator; } bool FunctionWithDict::isPublic() const { - return function_.IsPublic(); + return function_->Property() & kIsPublic; } bool FunctionWithDict::isStatic() const { - return function_.IsStatic(); + return function_->Property() & kIsStatic; + } + + size_t + FunctionWithDict::functionParameterSize(bool required/*= false*/) const { + if (required) { + return function_->GetNargs() - function_->GetNargsOpt(); + } + return function_->GetNargs(); } size_t - FunctionWithDict::functionParameterSize(bool required) const { - return function_.FunctionParameterSize(required); + FunctionWithDict::size() const { + return function_->GetNargs(); } + /// Call a member function. void - FunctionWithDict::invoke(ObjectWithDict const& obj, ObjectWithDict* ret, std::vector const& values) const { - Reflex::Object reflexReturn(ret->typeOf().type_, ret->address()); - function_.Invoke(Reflex::Object(obj.typeOf().type_, obj.address()), &reflexReturn, values); + FunctionWithDict::invoke(ObjectWithDict const& obj, ObjectWithDict* ret/*=nullptr*/, + std::vector const& values/*=std::vector()*/) const { + void const** data = const_cast(values.data()); + if (ret == nullptr) { + gInterpreter->ExecuteWithArgsAndReturn(function_, obj.address(), data, values.size(), nullptr); + return; + } + gInterpreter->ExecuteWithArgsAndReturn(function_, obj.address(), data, values.size(), ret->address()); } - Reflex::Type_Iterator - FunctionWithDict::begin() const { - return function_.TypeOf().FunctionParameter_Begin(); + /// Call a static function. + void + FunctionWithDict::invoke(ObjectWithDict* ret/*=nullptr*/, + std::vector const& values/*=std::vector()*/) const { + void const** data = const_cast(values.data()); + if (ret == nullptr) { + gInterpreter->ExecuteWithArgsAndReturn(function_, nullptr, data, values.size(), nullptr); + return; + } + gInterpreter->ExecuteWithArgsAndReturn(function_, nullptr, data, values.size(), ret->address()); } - Reflex::Type_Iterator - FunctionWithDict::end() const { - return function_.TypeOf().FunctionParameter_End(); + IterWithDict + FunctionWithDict::begin() const { + if (function_ == nullptr) { + return IterWithDict(); + } + return IterWithDict(function_->GetListOfMethodArgs()); } - FunctionWithDict::operator bool() const { - return bool(function_); + IterWithDict + FunctionWithDict::end() const { + return IterWithDict(); } -} +} // namespace edm diff --git a/FWCore/Utilities/src/IterWithDict.cc b/FWCore/Utilities/src/IterWithDict.cc index 8ffb3829f776b..d8c3d460e4596 100644 --- a/FWCore/Utilities/src/IterWithDict.cc +++ b/FWCore/Utilities/src/IterWithDict.cc @@ -3,6 +3,22 @@ namespace edm { + void + IterWithDictBase::advance() { + if (atEnd_) { + return; + } + TObject* obj = iter_.Next(); + if (obj == nullptr) { + atEnd_ = true; + } + } + + TIter const& + IterWithDictBase::iter() const { + return iter_; + } + IterWithDictBase::IterWithDictBase() : iter_(static_cast(nullptr)), atEnd_(true) { // This ctor is used by the framework for the end of a range, // or for any type that does not have a TClass. @@ -12,36 +28,27 @@ namespace edm { IterWithDictBase::IterWithDictBase(TList* list) : iter_(list), atEnd_(false) { // With a TIter, you must call Next() once to point to the first element. - advance(); + TObject* obj = iter_.Next(); + if (obj == nullptr) { + atEnd_ = true; + } } bool - IterWithDictBase::operator!=(IterWithDictBase const& other) const { + IterWithDictBase::operator!=(IterWithDictBase const& rhs) const { // The special cases are needed because TIter::operator!=() // dereferences a null pointer (i.e. segfaults) if the left hand TIter // was constucted with a nullptr argument (the first constructor above). - if(atEnd_ != other.atEnd_) { + if (atEnd_ != rhs.atEnd_) { // one iterator at end, but not both - return true; - } else if(atEnd_) { + return true; + } + if (atEnd_) { // both iterators at end return false; } // neither iterator at end - return iter() != other.iter(); - } - - void - IterWithDictBase::advance() { - if(!atEnd_) { - TObject* obj = iter_.Next(); - if(obj == nullptr) atEnd_ = true; - } - } - - TIter const& - IterWithDictBase::iter() const { - return iter_; + return iter_ != rhs.iter_; } -} +} // namespace edm diff --git a/FWCore/Utilities/src/MemberWithDict.cc b/FWCore/Utilities/src/MemberWithDict.cc index 90261c1a35250..fe0dd5a0eae88 100644 --- a/FWCore/Utilities/src/MemberWithDict.cc +++ b/FWCore/Utilities/src/MemberWithDict.cc @@ -1,16 +1,20 @@ - #include "FWCore/Utilities/interface/MemberWithDict.h" + #include "FWCore/Utilities/interface/ObjectWithDict.h" #include "FWCore/Utilities/interface/TypeWithDict.h" +#include +#include namespace edm { - MemberWithDict::MemberWithDict() : - dataMember_() { + MemberWithDict::MemberWithDict() : dataMember_(nullptr) { + } + + MemberWithDict::MemberWithDict(TDataMember* dataMember) : dataMember_(dataMember) { } - MemberWithDict::MemberWithDict(TDataMember* dataMember) : - dataMember_(dataMember) { + MemberWithDict::operator bool() const { + return dataMember_ != nullptr; } std::string @@ -18,19 +22,19 @@ namespace edm { return dataMember_->GetName(); } - ObjectWithDict - MemberWithDict::get() const { - return (ObjectWithDict(typeOf(), reinterpret_cast(dataMember_->GetOffset()))); - } - - ObjectWithDict - MemberWithDict::get(ObjectWithDict const& obj) const { - return (ObjectWithDict(typeOf(), static_cast(obj.address()) + dataMember_->GetOffset())); - } - TypeWithDict MemberWithDict::typeOf() const { - return TypeWithDict::byName(dataMember_->GetTypeName(), dataMember_->Property()); + if(isArray()) { + std::ostringstream name; + name << dataMember_->GetTrueTypeName(); + for(int i = 0; i < dataMember_->GetArrayDim(); ++i) { + name << '['; + name << dataMember_->GetMaxIndex(i); + name << ']'; + } + return TypeWithDict::byName(name.str()); + } + return TypeWithDict::byName(dataMember_->GetTrueTypeName()); } TypeWithDict @@ -38,19 +42,24 @@ namespace edm { return TypeWithDict(dataMember_->GetClass()); } + bool + MemberWithDict::isArray() const { + return dataMember_->Property() & kIsArray; + } + bool MemberWithDict::isConst() const { - return (dataMember_->Property() & kIsConstant); + return dataMember_->Property() & kIsConstant; } bool MemberWithDict::isPublic() const { - return (dataMember_->Property() & kIsPublic); + return dataMember_->Property() & kIsPublic; } bool MemberWithDict::isStatic() const { - return (dataMember_->Property() & kIsStatic); + return dataMember_->Property() & kIsStatic; } bool @@ -60,11 +69,17 @@ namespace edm { size_t MemberWithDict::offset() const { - return (dataMember_->GetOffset()); + return dataMember_->GetOffset(); } - MemberWithDict::operator bool() const { - return (dataMember_ != nullptr); + ObjectWithDict + MemberWithDict::get() const { + return ObjectWithDict(typeOf(), reinterpret_cast(dataMember_->GetOffset())); + } + + ObjectWithDict + MemberWithDict::get(ObjectWithDict const& obj) const { + return ObjectWithDict(typeOf(), reinterpret_cast(obj.address()) + dataMember_->GetOffset()); } -} +} // namespace edm diff --git a/FWCore/Utilities/src/ObjectWithDict.cc b/FWCore/Utilities/src/ObjectWithDict.cc index 95f0b83771668..68b0e603c1d83 100644 --- a/FWCore/Utilities/src/ObjectWithDict.cc +++ b/FWCore/Utilities/src/ObjectWithDict.cc @@ -1,12 +1,12 @@ -#include "FWCore/Utilities/interface/MemberWithDict.h" #include "FWCore/Utilities/interface/ObjectWithDict.h" -namespace edm { +#include "FWCore/Utilities/interface/BaseWithDict.h" +#include "FWCore/Utilities/interface/MemberWithDict.h" +#include "FWCore/Utilities/interface/TypeWithDict.h" - ObjectWithDict::ObjectWithDict() : - type_(), - address_(nullptr) { - } +#include + +namespace edm { ObjectWithDict ObjectWithDict::byType(TypeWithDict const& type) { @@ -14,41 +14,105 @@ namespace edm { return obj; } + ObjectWithDict::ObjectWithDict() : type_(), address_(nullptr) { + } + ObjectWithDict::ObjectWithDict(TypeWithDict const& type, void* address) : type_(type), address_(address) { } - ObjectWithDict::ObjectWithDict(std::type_info const& typeID, void* address) : - type_(TypeWithDict(typeID)), + ObjectWithDict::ObjectWithDict(std::type_info const& ti, void* address) : + type_(TypeWithDict(ti)), address_(address) { } - TypeWithDict const& + ObjectWithDict::operator bool() const { + return bool(type_) && (address_ != nullptr); + } + + void* + ObjectWithDict::address() const { + return address_; + } + + TypeWithDict ObjectWithDict::typeOf() const { return type_; } + class DummyVT { + public: + virtual ~DummyVT(); + }; + + DummyVT::~DummyVT() { + } + TypeWithDict ObjectWithDict::dynamicType() const { - if(!type_.isVirtual()) { + if (!type_.isVirtual()) { return type_; } - struct Dummy_t {virtual ~Dummy_t() {} }; - return TypeWithDict(typeid(*(Dummy_t*)address_)); - } - - ObjectWithDict::operator bool() const { - return bool(type_) && address_ != nullptr; - } - - void* - ObjectWithDict::address() const { - return address_; + // Use a dirty trick, force the typeid() operator + // to consult the virtual table stored at address_. + return TypeWithDict(typeid(*(DummyVT*)address_)); } ObjectWithDict ObjectWithDict::get(std::string const& memberName) const { return type_.dataMemberByName(memberName).get(*this); } -} + + ObjectWithDict + ObjectWithDict::castObject(TypeWithDict const& to) const { + TypeWithDict from = typeOf(); + + // Same type + if (from == to) { + return *this; + } + + if (to.hasBase(from)) { // down cast + // use the internal dynamic casting of the compiler (e.g. libstdc++.so) + void* address = abi::__dynamic_cast(address_, static_cast(&from.typeInfo()), static_cast(&to.typeInfo()), -1); + return ObjectWithDict(to, address); + } + + if (from.hasBase(to)) { // up cast + size_t offset = from.getBaseClassOffset(to); + size_t address = reinterpret_cast(address_) + offset; + return ObjectWithDict(to, reinterpret_cast(address)); + } + + // if everything fails return the dummy object + return ObjectWithDict(); + } // castObject + + //ObjectWithDict + //ObjectWithDict::construct() const { + // TypeWithDict ty(type_); + // TClass* cl = ty.getClass(); + // if (cl != nullptr) { + // return ObjectWithDict(ty, cl->New()); + // } + // return ObjectWithDict(ty, new char[ty.size()]); + //} + + void + ObjectWithDict::destruct(bool dealloc) const { + TClass* cl = type_.getClass(); + if (cl != nullptr) { + cl->Destructor(address_, !dealloc); + //if (dealloc) { + // address_ = nullptr; + //} + return; + } + if (dealloc) { + delete[] reinterpret_cast(address_); + //address_ = nullptr; + } + } + +} // namespace edm diff --git a/FWCore/Utilities/src/TypeDemangler.cc b/FWCore/Utilities/src/TypeDemangler.cc index 94693e2cf74cb..e450c618563f2 100644 --- a/FWCore/Utilities/src/TypeDemangler.cc +++ b/FWCore/Utilities/src/TypeDemangler.cc @@ -119,14 +119,16 @@ namespace edm { // Strip default comparator std::string const comparator(",std::less<"); removeParameter(demangledName, comparator); - // Replace 'std::string' with 'std::basic_string'. - reformatter(demangledName, "(.*[^0-9A-Za-z_])std::string([^0-9A-Za-z_].*)", "$1std::basic_string$2"); // Put const qualifier before identifier. constBeforeIdentifier(demangledName); // No two consecutive '>' replaceString(demangledName, ">>", "> >"); // No u or l qualifiers for integers. reformatter(demangledName, "(.*[<,][0-9]+)[ul]l*([,>].*)", "$1$2"); + // For ROOT 6 and beyond, replace 'unsigned long long' with 'ULong64_t' + replaceString(demangledName, "unsigned long long", "ULong64_t"); + // For ROOT 6 and beyond, replace 'long long' with 'Long64_t' + replaceString(demangledName, "long long", "Long64_t"); return demangledName; } } diff --git a/FWCore/Utilities/src/TypeWithDict.cc b/FWCore/Utilities/src/TypeWithDict.cc index 735fc090e42bf..7e8766424073d 100644 --- a/FWCore/Utilities/src/TypeWithDict.cc +++ b/FWCore/Utilities/src/TypeWithDict.cc @@ -1,222 +1,479 @@ -/*---------------------------------------------------------------------- -, Long_t property -----------------------------------------------------------------------*/ -#include -#include +#include "FWCore/Utilities/interface/TypeWithDict.h" + +#include "FWCore/Utilities/interface/EDMException.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Utilities/interface/FriendlyName.h" #include "FWCore/Utilities/interface/FunctionWithDict.h" #include "FWCore/Utilities/interface/MemberWithDict.h" #include "FWCore/Utilities/interface/ObjectWithDict.h" -#include "FWCore/Utilities/interface/FriendlyName.h" -#include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/TypeDemangler.h" #include "FWCore/Utilities/interface/TypeID.h" -#include "FWCore/Utilities/interface/TypeWithDict.h" -#include "TROOT.h" + #include "TClass.h" +#include "TClassTable.h" #include "TDataType.h" +#include "TEnum.h" +#include "TEnumConstant.h" #include "TMethodArg.h" -#include "Cintex/Cintex.h" -#include "Reflex/Member.h" -#include "Reflex/Object.h" +#include "TRealData.h" +#include "TROOT.h" + #include "boost/thread/tss.hpp" +#include "tbb/concurrent_unordered_map.h" -namespace ROOT { - namespace Cintex { - std::string CintName(std::string const&); - } -} +#include +#include +#include +#include +#include -namespace { - int - toReflex(Long_t property) { - int prop = 0; - if(property&(Long_t)kIsConstant) { - prop |= Reflex::CONST; - } - if(property&(Long_t)kIsReference) { - prop |= Reflex::REFERENCE; - } - return prop; - } -} +#include +//#include namespace edm { - void - TypeWithDict::setProperty() { - if(type_.IsClass()) { - property_ |= (Long_t)kIsClass; - } - if(type_.IsConst()) { - property_ |= (Long_t)kIsConstant; - } - if(type_.IsEnum()) { - property_ |= (Long_t)kIsEnum; + + namespace { + typedef tbb::concurrent_unordered_map Map; + Map typeMap; + typedef tbb::concurrent_unordered_map FunctionMap; + FunctionMap functionMap; + } + static + void throwTypeException(std::string const& function, std::string const& typeName) { + throw Exception(errors::DictionaryNotFound) + << "Function " << function << ",\n" + << "no data dictionary found for type:\n\n" + << typeName + << "\nMost likely the dictionary was never generated,\n" + << "but it may be that it was generated in the wrong package.\n" + << "Please add (or move) the specification\n" + << "\n" + << "to the appropriate classes_def.xml file.\n" + << "If the class is a template instance, you may need\n" + << "to define a dummy variable of this type in classes.h.\n" + << "Also, if this class has any transient members,\n" + << "you need to specify them in classes_def.xml."; + + } + + TypeWithDict + TypeWithDict::byName(std::string const& name) { + // This is a public static function. + auto const& item = typeMap.find(name); + if(item != typeMap.end()) { + return item->second; } - if(type_.IsTypedef()) { - property_ |= (Long_t)kIsTypedef; + TypeWithDict theType = TypeWithDict::byName(name, 0L); + typeMap.insert(std::make_pair(name, theType)); + return theType; + } + + TypeWithDict + TypeWithDict::byName(std::string const& name, long property) { + // This is a private static function. + + static std::string const constPrefix("const "); + static std::string const constSuffix(" const"); + static size_t const constPrefixSize(constPrefix.size()); + static size_t const constSuffixSize(constSuffix.size()); + + // Handle references + if(name.back() == '&') { + assert(property == 0L); + property |= kIsReference; + return byName(name.substr(0, name.size() - 1), property); + } + + // Handle const qualifier + if(name.size() > constSuffixSize && name.back() != '*') { + if(name.substr(0, constPrefixSize) == constPrefix) { + property |= kIsConstant; + return byName(name.substr(constPrefixSize), property); + } + if(name.substr(name.size() - constSuffixSize) == constSuffix) { + property |= kIsConstant; + return byName(name.substr(0, name.size() - constSuffixSize), property); + } } - if(dataType_ != nullptr || *typeInfo_ == typeid(void)) { - property_ |= (Long_t)kIsFundamental; + + // Handle pointers + if(name.back() == '*') { + // pointer to pointer not supported + assert(!(property & (long) kIsPointer)); + // C-style array of pointers is not supported + assert(!(property & (long) kIsArray)); + property |= kIsPointer; + if(property & (long) kIsConstant) { + property &= ~((long) kIsConstant); + property |= kIsConstPointer; + } + return byName(name.substr(0, name.size() - 1), property); } - if(type_.IsPointer()) { - property_ |= (Long_t)kIsPointer; + + // Handle C-style arrays + if(name.back() == ']') { + // pointer to array not supported + assert(!(property & (long) kIsPointer)); + // Protect against the remote possibility of '[' nested in a class type + size_t begin = name.find_last_of("<>:,()"); + if(begin == std::string::npos) { + begin = 0; + } else { + ++begin; + } + size_t first = name.find('[', begin); + assert(first != std::string::npos); + assert(first != 0); + TypeWithDict ret = TypeWithDict::byName(name.substr(0, first), property); + ret.property_ |= kIsArray; + ret.arrayDimensions_ = value_ptr >(new std::vector); + std::string const dimensions = name.substr(first); + char const* s = dimensions.c_str(); + while(1) { + size_t x = 0; + int count = sscanf(s, "[%lu]", &x); + assert(count == 1); + ret.arrayDimensions_->push_back(x); + ++s; + while(*s != '\0' && *s != '[') { + ++s; + } + if(*s == '\0') { + break; + } + } + return ret; + } + + // Handle classes + TClass* theClass = TClass::GetClass(name.c_str()); + if (theClass != nullptr && theClass->GetTypeInfo() != nullptr) { + return TypeWithDict(theClass, property); + } + + // Handle enums + TEnum* theEnum = TEnum::GetEnum(name.c_str(), TEnum::kAutoload); + if(theEnum) { + return TypeWithDict(theEnum, property); + } + + // Handle built-ins + TDataType* theDataType = gROOT->GetType(name.c_str()); + if(theDataType) { + switch(theDataType->GetType()) { + case kUInt_t: + return TypeWithDict(typeid(unsigned int), property); + case kInt_t: + return TypeWithDict(typeid(int), property); + case kULong_t: + return TypeWithDict(typeid(unsigned long), property); + case kLong_t: + return TypeWithDict(typeid(long), property); + case kULong64_t: + return TypeWithDict(typeid(unsigned long long), property); + case kLong64_t: + return TypeWithDict(typeid(long long), property); + case kUShort_t: + return TypeWithDict(typeid(unsigned short), property); + case kShort_t: + return TypeWithDict(typeid(short), property); + case kUChar_t: + return TypeWithDict(typeid(unsigned char), property); + case kChar_t: + return TypeWithDict(typeid(char), property); + case kBool_t: + return TypeWithDict(typeid(bool), property); + case kFloat_t: + return TypeWithDict(typeid(float), property); + case kFloat16_t: + return TypeWithDict(typeid(Float16_t), property); + case kDouble_t: + return TypeWithDict(typeid(double), property); + case kDouble32_t: + return TypeWithDict(typeid(Double32_t), property); + case kCharStar: + return TypeWithDict(typeid(char*), property); + case kDataTypeAliasSignedChar_t: + return TypeWithDict(typeid(signed char), property); + } } - if(type_.IsReference()) { - property_ |= (Long_t)kIsReference; + + if(name == "void") { + return TypeWithDict(typeid(void), property); } - if(type_.IsStruct()) { - property_ |= (Long_t)kIsStruct; + + // For a reason not understood, TClass::GetClass sometimes cannot find std::type_info + // by name. This simple workaround bypasses the problem. + // The problem really should be debugged. (testORA12) + if(name == "std::type_info") { + return TypeWithDict(typeid(std::type_info), property); } - if(type_.IsVirtual()) { - property_ |= (Long_t)kIsVirtual; + + // For a reason not understood, TClass::GetClass sometimes cannot find std::vector::value_type + // or std::map::value_type when T is a nested class. + // This workaround bypasses the problem. The problem really should be debugged. + if(stripNamespace(name) == "value_type") { + size_t begin = name.find('<'); + size_t end = name.rfind('>'); + if(begin != std::string::npos && end != std::string::npos && end > ++begin) { + size_t amap = name.find("map"); + if(amap != std::string::npos && amap < begin) { + ++end; + return TypeWithDict::byName(std::string("std::pairGetType("void"); + return; + } + + // std::cerr << "DEBUG BY TI: " << name() << std::endl; + + throwTypeException("TypeWithDict): ", name()); + } + + TypeWithDict::TypeWithDict(TClass *cl) : TypeWithDict(cl, 0L) { } - TypeWithDict::TypeWithDict(TClass* cl, Long_t property) : - typeInfo_(cl->GetTypeInfo()), - type_(Reflex::Type::ByTypeInfo(*cl->GetTypeInfo()), toReflex(property)), + TypeWithDict::TypeWithDict(TClass* cl, long property) : + ti_(cl->GetTypeInfo()), class_(cl), + enum_(nullptr), dataType_(nullptr), + arrayDimensions_(nullptr), property_(property) { - property_ |= (Long_t)kIsClass; + if(ti_ == nullptr) { + ti_ = &typeid(TypeWithDict::invalidType); + class_ = nullptr; + property_ = 0L; + } } - TypeWithDict::TypeWithDict(TMethodArg* arg) : - typeInfo_(nullptr), - type_(), + TypeWithDict::TypeWithDict(TEnum *enm) : TypeWithDict(enm, 0L) { + } + + TypeWithDict::TypeWithDict(TEnum* enm, long property) : + ti_(&typeid(TypeWithDict::dummyType)), class_(nullptr), + enum_(enm), dataType_(nullptr), - property_(arg->Property()) { - TypeWithDict type(byName(arg->GetTypeName(), arg->Property())); - *this = std::move(type); - } - - TypeWithDict::TypeWithDict(TypeWithDict const& type, Long_t property) : - // Only modifies const and reference. - typeInfo_(type.typeInfo_), - type_(type.type_, toReflex(property|type.property_)), - class_(type.class_), - dataType_(type.dataType_), - property_(type.property_) { - if(property&(Long_t)kIsConstant) { - property_ |= (Long_t)kIsConstant; - } else { - property_ &= ~(Long_t)kIsConstant; - } - if(property&(Long_t)kIsReference) { - property_ |= (Long_t)kIsReference; - } else { - property_ &= ~(Long_t)kIsReference; - } + arrayDimensions_(nullptr), + property_(property) { } - void - TypeWithDict::print(std::ostream& os) const { - try { - os << name(); - } catch (cms::Exception const&) { - os << typeInfo().name(); + TypeWithDict::TypeWithDict(TMethodArg* arg) : TypeWithDict(arg, 0L) { + } + + TypeWithDict::TypeWithDict(TMethodArg* arg, long property) : + TypeWithDict(byName(arg->GetTypeName(), arg->Property() | property)) { + } + + TypeWithDict::operator bool() const { + if (*ti_ == typeid(invalidType)) { + return false; } + if (class_ != nullptr || dataType_ != nullptr || enum_ != nullptr) { + return true; + } + return false; } - TypeWithDict - TypeWithDict::byName(std::string const& name) { - return byName(name, 0L); + std::type_info const& + TypeWithDict::typeInfo() const { + if(*ti_ == typeid(dummyType) || isPointer() || isArray()) { + // No accurate type_info + assert(qualifiedName().c_str() == nullptr); + } + return *ti_; } - TypeWithDict - TypeWithDict::byName(std::string const& name, Long_t property) { - // static map for built in types - typedef std::map TypeMap; - static const TypeMap typeMap = { - {std::string("bool"), TypeWithDict(typeid(bool))}, - {std::string("char"), TypeWithDict(typeid(char))}, - {std::string("unsigned char"), TypeWithDict(typeid(unsigned char))}, - {std::string("short"), TypeWithDict(typeid(short))}, - {std::string("unsigned short"), TypeWithDict(typeid(unsigned short))}, - {std::string("int"), TypeWithDict(typeid(int))}, - {std::string("unsigned int"), TypeWithDict(typeid(unsigned int))}, - {std::string("long"), TypeWithDict(typeid(long))}, - {std::string("unsigned long"), TypeWithDict(typeid(unsigned long))}, - {std::string("long long"), TypeWithDict(typeid(long long))}, - {std::string("unsigned long long"), TypeWithDict(typeid(unsigned long long))}, - {std::string("float"), TypeWithDict(typeid(float))}, - {std::string("double"), TypeWithDict(typeid(double))}, - // {std::string("long double"), TypeWithDict(typeid(long double))}, // ROOT does not seem to know about long double - {std::string("string"), TypeWithDict(typeid(std::string))}, - {std::string("void"), TypeWithDict(typeid(void))} - }; - - std::string cintName = ROOT::Cintex::CintName(name); - char last = *cintName.rbegin(); - if(last == '*') { - cintName = cintName.substr(0, cintName.size() - 1); - } - - TypeMap::const_iterator it = typeMap.find(cintName); - if(it != typeMap.end()) { - return TypeWithDict(it->second, property); - } - - TClass* cl = TClass::GetClass(cintName.c_str()); - if(cl != nullptr) { - // it's a class - std::type_info const* typeInfo = cl->GetTypeInfo(); - if(typeInfo == nullptr) { - return TypeWithDict(); - } - // it's a class with a dictionary - return TypeWithDict(cl, property); + TClass* + TypeWithDict::getClass() const { + if(isPointer() || isArray()) { + return nullptr; + } + return class_; + } + + TEnum* + TypeWithDict::getEnum() const { + if(isPointer() || isArray()) { + return nullptr; + } + return enum_; + } + + TDataType* + TypeWithDict::getDataType() const { + if(isPointer() || isArray()) { + return nullptr; } - // This is an enum, or a class without a CINT dictionary. We need Reflex to handle it. - Reflex::Type t = Reflex::Type::ByName(name); - return(bool(t) ? TypeWithDict(t) : TypeWithDict()); + return dataType_; + } + + long + TypeWithDict::getProperty() const { + return property_; + } + + bool + TypeWithDict::isClass() const { + // Note: This really means is class, struct, or union. + return class_ != nullptr && !isPointer() && !isArray(); + } + + bool + TypeWithDict::isConst() const { + return (property_ & (long) kIsConstant); + } + + bool + TypeWithDict::isArray() const { + return (property_ & (long) kIsArray); + } + + bool + TypeWithDict::isEnum() const { + return enum_ != nullptr && !isPointer() && !isArray(); + } + + bool + TypeWithDict::isFundamental() const { + return dataType_ != nullptr && !isPointer() && !isArray(); + } + + bool + TypeWithDict::isPointer() const { + return (property_ & (long) kIsPointer); + } + + bool + TypeWithDict::isReference() const { + return (property_ & (long) kIsReference); + } + + bool + TypeWithDict::isTemplateInstance() const { + return (isClass() && name().back() == '>'); + } + + bool + TypeWithDict::isTypedef() const { + if (class_ != nullptr || dataType_ != nullptr || enum_ != nullptr || *ti_ == typeid(invalidType)) { + return false; + } + return true; + } + + bool + TypeWithDict::isVirtual() const { + return isClass() && (class_->ClassProperty() & (long) kClassHasVirtual); + } + + void + TypeWithDict::print(std::ostream& os) const { + os << name(); + } + + std::string + TypeWithDict::cppName() const { + std::string cName = qualifiedName(); + // Get rid of silly ROOT typedefs + replaceString(cName, "ULong64_t", "unsigned long long"); + replaceString(cName, "Long64_t", "long long"); + return cName; } std::string TypeWithDict::qualifiedName() const { std::string qname(name()); - if(isConst()) { + if (isConst() && !isPointer()) { qname = "const " + qname; + } else if (property_ & kIsConstPointer) { + qname += " const"; } - if(isReference()) { - qname += '&'; + if (isReference()) { + qname += '&'; } return qname; } @@ -225,195 +482,262 @@ namespace edm { TypeWithDict::unscopedName() const { return stripNamespace(name()); } - + std::string TypeWithDict::name() const { + if (*ti_ == typeid(invalidType)) { + return std::string(); + } + std::ostringstream out; + if(isPointer() && isConst()) { + out << "const "; + } + if(enum_ != nullptr) { + if(enum_->GetClass()) { + out << std::string(enum_->GetClass()->GetName()); + out << "::"; + } + out << enum_->GetName(); + } else { + out << TypeID(*ti_).className(); + } if(isPointer()) { - return TypeID(typeInfo()).className() + '*'; + out << '*'; + } + if(isArray()) { + for(size_t i = 0; i < arrayDimension(); ++i) { + out << '['; + out << std::dec << maximumIndex(i); + out << ']'; + } } - return TypeID(typeInfo()).className(); + return out.str(); } std::string TypeWithDict::userClassName() const { - return TypeID(typeInfo()).userClassName(); + return name(); } std::string TypeWithDict::friendlyClassName() const { - return TypeID(typeInfo()).friendlyClassName(); + return friendlyname::friendlyName(name()); } - bool - TypeWithDict::hasDictionary() const { - if(isEnum() || isTypedef() || isPointer()) { - return bool(type_); + size_t + TypeWithDict::size() const { + size_t nBytes = 0; + if(isPointer()) { + nBytes = sizeof(void*); + } else if(class_ != nullptr) { + nBytes = class_->GetClassSize(); + } else if(dataType_ != nullptr) { + nBytes = dataType_->Size(); + } else if(enum_ != nullptr) { + nBytes = sizeof(int); } - if(isFundamental()) { - return true; + if(isArray()) { + nBytes *= arrayLength(); } - return ((class_ != nullptr && class_->GetTypeInfo() != nullptr)); + return nBytes; } - ObjectWithDict - TypeWithDict::construct() const { - if(class_ != nullptr) { - return ObjectWithDict(*this, class_->New()); + size_t + TypeWithDict::arrayLength() const { + assert(isArray()); + size_t theLength = 1; + for(size_t i = 0; i < arrayDimension(); ++i) { + theLength *= maximumIndex(i); } - return ObjectWithDict(*this, new char[size()]); + return theLength; } - void - TypeWithDict::destruct(void* address, bool dealloc) const { - if(class_ != nullptr) { - class_->Destructor(address, !dealloc); - } else if(dealloc) { - delete [] static_cast(address); + size_t + TypeWithDict::arrayDimension() const { + assert(isArray()); + return arrayDimensions_->size(); + } + + size_t + TypeWithDict::maximumIndex(size_t dim) const { + assert(isArray()); + return (*arrayDimensions_)[dim]; + } + + size_t + TypeWithDict::dataMemberSize() const { + if (isClass()) { + return class_->GetListOfDataMembers()->GetSize(); + } + if (isEnum()) { + return enum_->GetConstants()->GetSize(); + } + return 0; + } + + size_t + TypeWithDict::functionMemberSize() const { + if (isClass()) { + return class_->GetListOfMethods()->GetSize(); } + return 0; } void const* TypeWithDict::pointerToBaseType(void const* ptr, TypeWithDict const& derivedType) const { - if(derivedType == *this) { + if(!isClass()) { + return ptr; + } + if (this->ti_ == derivedType.ti_ || *this->ti_ == *derivedType.ti_) { return ptr; } int offset = derivedType.getBaseClassOffset(*this); - if(offset < 0) return nullptr; + if (offset < 0) { + return nullptr; + } return static_cast(ptr) + offset; } void const* TypeWithDict::pointerToContainedType(void const* ptr, TypeWithDict const& derivedType) const { + if(!isClass()) { + return ptr; + } return pointerToBaseType(ptr, derivedType); } - TypeWithDict::operator bool() const { - return hasDictionary(); + TypeWithDict + TypeWithDict::nestedType(char const* nestedName) const { + return byName(name() + "::" + nestedName); } TypeWithDict - TypeWithDict::nestedType(char const* nestedName) const { + TypeWithDict::nestedType(std::string const& nestedName) const { return byName(name() + "::" + nestedName); } MemberWithDict TypeWithDict::dataMemberByName(std::string const& member) const { - if(class_ == nullptr) { - if(isEnum()) { - std::string fullName(name()); - size_t lastColon = fullName.find_last_of("::"); - assert(lastColon != std::string::npos && lastColon != 0U); - std::string theName(fullName.substr(0, lastColon - 1)); - TClass* cl = TClass::GetClass(theName.c_str()); - assert(cl != nullptr); - return MemberWithDict(cl->GetDataMember(member.c_str())); + if (isClass()) { + TDataMember* dataMember = class_->GetDataMember(member.c_str()); + if(dataMember == nullptr) { + // Look for indirect data members + TRealData* realDataMember = class_->GetRealData(member.c_str()); + if(realDataMember != nullptr) { + dataMember = realDataMember->GetDataMember(); + } } - return MemberWithDict(); + return MemberWithDict(dataMember); + } + if (isEnum()) { + TClass* cl = enum_->GetClass(); + return MemberWithDict(cl->GetDataMember(member.c_str())); } - return MemberWithDict(class_->GetDataMember(ROOT::Cintex::CintName(member).c_str())); + return MemberWithDict(); } FunctionWithDict TypeWithDict::functionMemberByName(std::string const& member) const { - return FunctionWithDict(type_.FunctionMemberByName(member)); - } - - FunctionWithDict - TypeWithDict::functionMemberByName(std::string const& member, TypeWithDict const& signature, int mods, TypeMemberQuery memberQuery) const { - return FunctionWithDict(type_.FunctionMemberByName(member, signature.type_, mods, static_cast(memberQuery))); - } - -/* - // Implementation in ROOT - - TypeWithDict::functionMemberByName(std::string const& member) const { - if(class_ == nullptr) { + if (!isClass()) { + return FunctionWithDict(); + } + TMethod* meth = reinterpret_cast( + class_->GetListOfMethods()->FindObject(member.c_str())); + if (meth == nullptr) { return FunctionWithDict(); } - return FunctionWithDict(class_->GetMethodAny(ROOT::Cintex::CintName(member).c_str())); + return FunctionWithDict(meth); } FunctionWithDict - TypeWithDict::functionMemberByName(std::string const& member, TypeWithDict const& signature, int mods, TypeMemberQuery memberQuery) const { - if(class_ == nullptr) { + TypeWithDict::functionMemberByName(std::string const& functionName, std::string const& proto, bool isConst) const { + if (!isClass()) { return FunctionWithDict(); } - // This is wrong. - return FunctionWithDict(class_->GetMethodAny(ROOT::Cintex::CintName(member).c_str())); - } -*/ - - bool - TypeWithDict::isClass() const { - return property_&((Long_t)kIsClass|(Long_t)kIsStruct); - } - - bool - TypeWithDict::isConst() const { - return property_&(Long_t)kIsConstant; - } - - bool - TypeWithDict::isEnum() const { - return property_&(Long_t)kIsEnum; - } - - bool - TypeWithDict::isFundamental() const { - return property_ & (Long_t)kIsFundamental; - } - - bool - TypeWithDict::isPointer() const { - return property_ & (Long_t)kIsPointer; - } - - bool - TypeWithDict::isReference() const { - return property_ & (Long_t)kIsReference; - } - - bool - TypeWithDict::isTypedef() const { - return property_ & (Long_t)kIsTypedef; - } - - bool - TypeWithDict::isTemplateInstance() const { - return *name().rbegin() == '>'; + std::string const& key = name() + '#' + functionName + '#' + proto; + auto const& item = functionMap.find(key); + if(item != functionMap.end()) { + return item->second; + } + TMethod* meth = class_->GetMethodWithPrototype(functionName.c_str(), proto.c_str(), /*objectIsConst=*/isConst, /*mode=*/ROOT::kConversionMatch); + if (meth == nullptr) { + return FunctionWithDict(); + } + FunctionWithDict theFunction = FunctionWithDict(meth); + functionMap.insert(std::make_pair(key, theFunction)); + return theFunction; } - bool - TypeWithDict::isVirtual() const { - return property_ & (Long_t)kIsVirtual; + TypeWithDict + TypeWithDict::finalType() const { + if (*ti_ == typeid(invalidType)) { + return TypeWithDict(); + } + if(!isClass() && !isFundamental()) { + return *this; + } + return TypeWithDict(*ti_); } TypeWithDict - TypeWithDict::toType() const{ - return TypeWithDict(type_.ToType()); + TypeWithDict::toType() const { + if (*ti_ == typeid(invalidType)) { + return TypeWithDict(); + } + if(isReference()) { + TypeWithDict newType = *this; + newType.property_ &= ~((long) kIsReference); + return newType; + } + if(isPointer()) { + TypeWithDict newType = *this; + newType.property_ &= ~((long) kIsPointer | (long) kIsConstPointer); + return newType; + } + if(isArray()) { + TypeWithDict newType = *this; + size_t size = newType.arrayDimensions_->size(); + if(size == 1) { + newType.property_ &= ~((long) kIsArray); + value_ptr > emptyVec; + newType.arrayDimensions_ = emptyVec; + } else { + std::vector& dims = *newType.arrayDimensions_; + for(size_t i = 0; i != size; ++i) { + dims[i] = dims[i+1]; + } + newType.arrayDimensions_->resize(size - 1); + } + return newType; + } + return *this; } std::string TypeWithDict::templateName() const { if (!isTemplateInstance()) { - return std::string(); + return ""; } - std::string templateName = name(); - size_t begin = templateName.find('<'); + if (name() == "std::string") { + return std::string("std::basic_string"); + } + std::string templateName(name()); + auto begin = templateName.find('<'); assert(begin != std::string::npos); - size_t end = templateName.rfind('<'); + auto end = templateName.rfind('<'); assert(end != std::string::npos); assert(begin <= end); - if(begin < end) { + if (begin < end) { int depth = 1; - for(size_t inx = begin + 1 ; inx <= end; ++inx) { - char c = templateName[inx]; - if(c == '<') { - if(depth == 0) { - begin = inx; + for (auto idx = begin + 1; idx <= end; ++idx) { + char c = templateName[idx]; + if (c == '<') { + if (depth == 0) { + begin = idx; } ++depth; - } else if(c == '>') { + } + else if (c == '>') { --depth; assert(depth >= 0); } @@ -424,121 +748,180 @@ namespace edm { TypeWithDict TypeWithDict::templateArgumentAt(size_t index) const { - std::string className = unscopedName(); - size_t begin = className.find('<'); - if(begin == std::string::npos) { + if(!isClass()) { + return TypeWithDict(); + } + std::string className(unscopedName()); + auto begin = className.find('<'); + if (begin == std::string::npos) { return TypeWithDict(); } ++begin; - size_t end = className.rfind('>'); + auto end = className.rfind('>'); assert(end != std::string::npos); assert(begin < end); int depth = 0; size_t argCount = 0; - for(size_t inx = begin; inx < end; ++inx) { - char c = className[inx]; - if(c == '<') { + for (auto idx = begin; idx < end; ++idx) { + char c = className[idx]; + if (c == '<') { ++depth; - } else if(c == '>') { + } + else if (c == '>') { --depth; assert(depth >= 0); - } else if(depth == 0 && c == ',') { - if(argCount < index) { - begin = inx + 1; + } + else if ((depth == 0) && (c == ',')) { + if (argCount < index) { + begin = idx + 1; ++argCount; - } else { - end = inx; + } + else { + end = idx; break; } } } assert(depth == 0); - if(argCount < index) { + if (argCount < index) { return TypeWithDict(); } return byName(className.substr(begin, end - begin)); } - std::type_info const& - TypeWithDict::typeInfo() const { - return *typeInfo_; + bool + TypeWithDict::hasBase(std::string const& basename) const { + if(!isClass()) { + return false; + } + TClass* cl = class_->GetBaseClass(basename.c_str()); + if (cl != nullptr) { + return true; + } + return false; } - std::type_info const& - TypeWithDict::id() const { - return typeInfo(); + bool + TypeWithDict::hasBase(TypeWithDict const& basety) const { + if(!isClass()) { + return false; + } + if (basety.class_ == nullptr) { + return false; + } + TClass* cl = class_->GetBaseClass(basety.name().c_str()); + if (cl != nullptr) { + return true; + } + return false; } int TypeWithDict::getBaseClassOffset(TypeWithDict const& baseClass) const { - assert(class_ != nullptr); - assert(baseClass.class_ != nullptr); + if(!isClass()) { + throw Exception(errors::LogicError) + << "Function TypeWithDict::getBaseClassOffset(), type\n" + << name() + << "\nis not a class\n"; + } + if (baseClass.class_ == nullptr) { + throw Exception(errors::LogicError) + << "Function TypeWithDict::getBaseClassOffset(), base type\n" + << name() + << "\nis not a class\n"; + } int offset = class_->GetBaseClassOffset(baseClass.class_); return offset; } int - TypeWithDict::stringToEnumValue(std::string const& enumMemberName) const { - assert(isEnum()); - Reflex::Member member = type_.MemberByName(enumMemberName); - if (!member) { - std::ostringstream err; - err<<"StringToEnumValue Failure trying to convert " << enumMemberName << " to int value"; - throw cms::Exception("ConversionError",err.str()); + TypeWithDict::stringToEnumValue(std::string const& name) const { + if (!isEnum()) { + throw Exception(errors::LogicError) + << "Function TypeWithDict::stringToEnumValue(), type\n" + << name + << "\nis not an enum\n"; } - if (member.TypeOf().TypeInfo() != typeid(int)) { - std::ostringstream err; - err << "Type "<< member.TypeOf().Name() << " is not Enum"; - throw cms::Exception("ConversionError",err.str()); + TEnumConstant const* ec = enum_->GetConstant(name.c_str()); + if (!ec) { + throw Exception(errors::LogicError) + << "Function TypeWithDict::stringToEnumValue(), type\n" + << name + << "\nis not an enum constant\n"; } - return Reflex::Object_Cast(member.Get()); + return static_cast(ec->GetValue()); } - size_t - TypeWithDict::dataMemberSize() const { - if(class_ == nullptr) { - if(isEnum()) { - return type_.DataMemberSize(); - } - return 0U; - } - return class_->GetListOfDataMembers()->GetSize(); + void* + TypeWithDict::allocate() const { + return new char[size()]; } - size_t - TypeWithDict::functionMemberSize() const { - if(class_ == nullptr) { - return 0U; + void + TypeWithDict::deallocate(void* address) const { + delete[] reinterpret_cast(address); + } + + ObjectWithDict + TypeWithDict::construct() const { + if (isClass()) { + return ObjectWithDict(*this, class_->New()); } - return class_->GetListOfMethods()->GetSize(); + return ObjectWithDict(*this, new char[size()]); } - size_t - TypeWithDict::size() const { - if(isEnum() || isTypedef() || isPointer()) { - return type_.SizeOf(); + void + TypeWithDict::destruct(void* address, bool dealloc) const { + if (isClass()) { + class_->Destructor(address, !dealloc); + return; } - if(class_ != nullptr) { - return class_->Size(); + if (dealloc) { + delete[] reinterpret_cast(address); + } + } + + // A related free function + bool + hasDictionary(std::type_info const& ti) { + if (ti.name()[1] == '\0') { + // returns true for built in types (single character mangled names) + return true; } - assert(dataType_ != nullptr); - return dataType_->Size(); + return (TClassTable::GetDict(ti) != nullptr); } bool operator==(TypeWithDict const& a, TypeWithDict const& b) { - return a.typeInfo() == b.typeInfo(); + return a.name() == b.name(); + } + + bool + operator==(TypeWithDict const& a, std::type_info const& b) { + if(*a.ti_ == typeid(TypeWithDict::dummyType) || a.isPointer() || a.isArray()) { + // No accurate type_info + return a.name() == TypeID(b).className(); + } + return *a.ti_ == b; } std::ostream& - operator<<(std::ostream& os, TypeWithDict const& id) { - id.print(os); + operator<<(std::ostream& os, TypeWithDict const& ty) { + ty.print(os); return os; } + //------------------------------------------------------------- + // + // + + TypeBases::TypeBases(TypeWithDict const& type) : + class_(type.getClass()) { + } + IterWithDict TypeBases::begin() const { - if(class_ == nullptr) { + if (class_ == nullptr) { return IterWithDict(); } return IterWithDict(class_->GetListOfBases()); @@ -551,15 +934,23 @@ namespace edm { size_t TypeBases::size() const { - if(class_ == nullptr) { - return type_.BaseSize(); + if (class_ == nullptr) { + return 0; } return class_->GetListOfBases()->GetSize(); } + //------------------------------------------------------------- + // + // + + TypeDataMembers::TypeDataMembers(TypeWithDict const& type) : + class_(type.getClass()) { + } + IterWithDict TypeDataMembers::begin() const { - if(class_ == nullptr) { + if (class_ == nullptr) { return IterWithDict(); } return IterWithDict(class_->GetListOfDataMembers()); @@ -572,16 +963,23 @@ namespace edm { size_t TypeDataMembers::size() const { - if(class_ == nullptr) { - return type_.DataMemberSize(); + if (class_ == nullptr) { + return 0; } return class_->GetListOfDataMembers()->GetSize(); } -/* + //------------------------------------------------------------- + // + // + + TypeFunctionMembers::TypeFunctionMembers(TypeWithDict const& type) : + class_(type.getClass()) { + } + IterWithDict TypeFunctionMembers::begin() const { - if(class_ == nullptr) { + if (class_ == nullptr) { return IterWithDict(); } return IterWithDict(class_->GetListOfMethods()); @@ -591,31 +989,13 @@ namespace edm { TypeFunctionMembers::end() const { return IterWithDict(); } -*/ - Reflex::Member_Iterator - TypeFunctionMembers::begin() const { - return type_.FunctionMember_Begin(); - } - - Reflex::Member_Iterator - TypeFunctionMembers::end() const { - return type_.FunctionMember_End(); - } - -/* size_t TypeFunctionMembers::size() const { - if(class_ == nullptr) { - return 0U; + if (class_ == nullptr) { + return 0; } - return class_->GetListOfMethods()->GetSize(); - } -*/ - - size_t - TypeFunctionMembers::size() const { - return type_.FunctionMemberSize(); + return class_->GetListOfMethods(kFALSE)->GetSize(); } -} +} // namespace edm diff --git a/FastSimDataFormats/External/src/classes_def.xml b/FastSimDataFormats/External/src/classes_def.xml index bf7d00a1466f7..ebbd727fd4cf8 100644 --- a/FastSimDataFormats/External/src/classes_def.xml +++ b/FastSimDataFormats/External/src/classes_def.xml @@ -7,7 +7,7 @@ - + diff --git a/FastSimDataFormats/NuclearInteractions/src/classes_def.xml b/FastSimDataFormats/NuclearInteractions/src/classes_def.xml index 028b1811c67ee..066239b9d28ed 100644 --- a/FastSimDataFormats/NuclearInteractions/src/classes_def.xml +++ b/FastSimDataFormats/NuclearInteractions/src/classes_def.xml @@ -12,7 +12,7 @@ - + @@ -20,7 +20,7 @@ - + diff --git a/FastSimDataFormats/PileUpEvents/BuildFile.xml b/FastSimDataFormats/PileUpEvents/BuildFile.xml index 59af8cc1fac04..1629b31d3cb28 100644 --- a/FastSimDataFormats/PileUpEvents/BuildFile.xml +++ b/FastSimDataFormats/PileUpEvents/BuildFile.xml @@ -1,5 +1,4 @@ - - + diff --git a/FastSimulation/MaterialEffects/test/init.C b/FastSimulation/MaterialEffects/test/init.C index b309262a417d5..4c533856de9d6 100644 --- a/FastSimulation/MaterialEffects/test/init.C +++ b/FastSimulation/MaterialEffects/test/init.C @@ -5,7 +5,5 @@ gSystem->Load("libFWCoreFWLite.so"); gSystem->Load("libFastSimulationMaterialEffects.so"); AutoLibraryLoader::enable(); -gSystem->Load("libCintex.so"); -ROOT::Cintex::Cintex::Enable(); } diff --git a/Fireworks/Core/src/FWModelContextMenuHandler.cc b/Fireworks/Core/src/FWModelContextMenuHandler.cc index 8eed889a3b93a..89d28313e71f3 100644 --- a/Fireworks/Core/src/FWModelContextMenuHandler.cc +++ b/Fireworks/Core/src/FWModelContextMenuHandler.cc @@ -20,6 +20,7 @@ #include "FWCore/Utilities/interface/ObjectWithDict.h" #include "FWCore/Utilities/interface/TypeWithDict.h" #include "TClass.h" +#include "TError.h" // user include files #include "Fireworks/Core/src/FWModelContextMenuHandler.h" @@ -255,21 +256,21 @@ FWModelContextMenuHandler::showSelectedModelContext(Int_t iX, Int_t iY, FWViewCo if( m_selectionManager->selected().size()==1 ) { - /* { - edm::TypeWithDict rtype(edm::TypeWithDict::bskpryName(id.item()->modelType()->GetName())); - edm::ObjectWithDict o(rtype, const_cast(id.item()->modelData(id.index()))); - edm::TypeMemberQuery inh = edm::TypeMemberQuery::InheritedAlso; - if ( rtype.functionMemberByName("print",edm::TypeWithDict(edm::TypeWithDict::byName("void (std::ostream&)"), Long_t(kIsConstant)), 0, inh)) - { - m_modelPopup->EnableEntry(kPrint); + { + //edm::TypeWithDict rtype(edm::TypeWithDict::byName(id.item()->modelType()->GetName())); + //edm::ObjectWithDict o(rtype, const_cast(id.item()->modelData(id.index()))); + //edm::TypeMemberQuery inh = edm::TypeMemberQuery::InheritedAlso; + //if ( rtype.functionMemberByName("print",edm::TypeWithDict(edm::TypeWithDict::byName("void (std::ostream&)"), Long_t(kIsConstant)), 0, inh)) + //{ + //m_modelPopup->EnableEntry(kPrint); // std::cout << "Enable " <DisableEntry(kPrint); // printf("Disable print \n"); - } - }*/ + //} + } //add the detail view entries std::vector viewChoices = m_detailViewManager->detailViewsFor(*(m_selectionManager->selected().begin())); if(viewChoices.size()>0) { diff --git a/Fireworks/Core/test/unittest_changemanager.cc b/Fireworks/Core/test/unittest_changemanager.cc index 1ff6c1eff5f00..b563b470f01a4 100644 --- a/Fireworks/Core/test/unittest_changemanager.cc +++ b/Fireworks/Core/test/unittest_changemanager.cc @@ -16,7 +16,6 @@ #include #include "TClass.h" -#include "Cintex/Cintex.h" // user include files #include "Fireworks/Core/interface/FWModelChangeManager.h" @@ -78,7 +77,6 @@ namespace { BOOST_AUTO_TEST_CASE( changemanager ) { - ROOT::Cintex::Cintex::Enable(); FWModelChangeManager cm; diff --git a/Fireworks/Core/test/unittest_eventitemsmanager.cc b/Fireworks/Core/test/unittest_eventitemsmanager.cc index c6c10a377c660..f54a4363c1aab 100644 --- a/Fireworks/Core/test/unittest_eventitemsmanager.cc +++ b/Fireworks/Core/test/unittest_eventitemsmanager.cc @@ -15,7 +15,6 @@ #include #include #include "TClass.h" -#include "Cintex/Cintex.h" // user include files #include "DataFormats/TrackReco/interface/TrackFwd.h" @@ -53,7 +52,6 @@ namespace { BOOST_AUTO_TEST_CASE( eventitemmanager ) { - ROOT::Cintex::Cintex::Enable(); FWModelChangeManager cm; FWSelectionManager sm(&cm); diff --git a/Fireworks/Core/test/unittest_modelexpressionselector.cc b/Fireworks/Core/test/unittest_modelexpressionselector.cc index cba0988bd74e1..9330aab9eddd5 100644 --- a/Fireworks/Core/test/unittest_modelexpressionselector.cc +++ b/Fireworks/Core/test/unittest_modelexpressionselector.cc @@ -14,7 +14,6 @@ #include #include #include "TClass.h" -#include "Cintex/Cintex.h" // user include files #include "DataFormats/TrackReco/interface/TrackFwd.h" @@ -61,7 +60,6 @@ namespace { BOOST_AUTO_TEST_CASE( modelexpressionselector ) { - ROOT::Cintex::Cintex::Enable(); FWModelChangeManager cm; FWSelectionManager sm(&cm); diff --git a/Fireworks/Core/test/unittest_modelfilter.cc b/Fireworks/Core/test/unittest_modelfilter.cc index 80ed4bddc9b5a..e850e07d4c741 100644 --- a/Fireworks/Core/test/unittest_modelfilter.cc +++ b/Fireworks/Core/test/unittest_modelfilter.cc @@ -14,7 +14,6 @@ #include #include #include "TClass.h" -#include "Cintex/Cintex.h" // user include files #include "DataFormats/TrackReco/interface/TrackFwd.h" @@ -59,7 +58,6 @@ namespace { BOOST_AUTO_TEST_CASE( itemfilter ) { - ROOT::Cintex::Cintex::Enable(); FWModelChangeManager cm; FWSelectionManager sm(&cm); diff --git a/Fireworks/Core/test/unittest_selectionmanager.cc b/Fireworks/Core/test/unittest_selectionmanager.cc index 8c19e688e4f0b..017a369ee2664 100644 --- a/Fireworks/Core/test/unittest_selectionmanager.cc +++ b/Fireworks/Core/test/unittest_selectionmanager.cc @@ -17,7 +17,6 @@ #define BOOST_TEST_MAIN #include #include "TClass.h" -#include "Cintex/Cintex.h" // user include files #include "DataFormats/TrackReco/interface/TrackFwd.h" @@ -78,7 +77,6 @@ namespace { BOOST_AUTO_TEST_CASE( selectionmanager ) { - ROOT::Cintex::Cintex::Enable(); FWModelChangeManager cm; FWSelectionManager sm(&cm); diff --git a/IOPool/Common/bin/EdmFileUtil.cpp b/IOPool/Common/bin/EdmFileUtil.cpp index ad4ed8f46cfe7..78a3f5f9dfa71 100644 --- a/IOPool/Common/bin/EdmFileUtil.cpp +++ b/IOPool/Common/bin/EdmFileUtil.cpp @@ -17,7 +17,6 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/PluginManager/interface/PluginManager.h" #include "FWCore/PluginManager/interface/standard.h" -#include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h" #include "FWCore/Services/src/SiteLocalConfigService.h" #include "FWCore/Utilities/interface/Adler32Calculator.h" #include "FWCore/Utilities/interface/Exception.h" @@ -126,7 +125,6 @@ int main(int argc, char* argv[]) { std::cout << "exception caught in EdmFileUtil while configuring the PluginManager\n" << e.what(); return 1; } - edm::RootAutoLibraryLoader::enable(); } edm::InputFileCatalog catalog(in, catalogIn, true); diff --git a/IOPool/Common/bin/EdmProvDump.cc b/IOPool/Common/bin/EdmProvDump.cc index aabf13aa24549..2961dc7bce541 100644 --- a/IOPool/Common/bin/EdmProvDump.cc +++ b/IOPool/Common/bin/EdmProvDump.cc @@ -18,7 +18,6 @@ #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/Exception.h" -#include "Cintex/Cintex.h" #include "TError.h" #include "TFile.h" #include "TTree.h" @@ -1218,9 +1217,6 @@ int main(int argc, char* argv[]) { //silence ROOT warnings about missing dictionaries gErrorIgnoreLevel = kError; - //make sure dictionaries can be used for reading - ROOT::Cintex::Cintex::Enable(); - ProvenanceDumper dumper(fileName, showDependencies, extendedAncestors, extendedDescendants, excludeESModules, showAllModules, showTopLevelPSets, findMatch, dontPrintProducts, dumpPSetID); int exitCode(0); diff --git a/IOPool/Input/src/InputFile.cc b/IOPool/Input/src/InputFile.cc index 6ade215f663d2..557f0c9dabb1f 100644 --- a/IOPool/Input/src/InputFile.cc +++ b/IOPool/Input/src/InputFile.cc @@ -8,8 +8,10 @@ Holder for an input TFile. #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Utilities/interface/ExceptionPropagate.h" #include "FWCore/Utilities/interface/TimeOfDay.h" +#include #include namespace edm { @@ -18,6 +20,11 @@ namespace edm { logFileAction(msg, fileName); file_.reset(TFile::Open(fileName)); + std::exception_ptr e = edm::threadLocalException::getException(); + if(e != std::exception_ptr()) { + edm::threadLocalException::setException(std::exception_ptr()); + std::rethrow_exception(e); + } if(!file_) { return; } @@ -74,7 +81,7 @@ namespace edm { Service reportSvc; reportSvc->reportSkippedFile(fileName, logicalFileName); } - + void InputFile::reportFallbackAttempt(std::string const& pfn, std::string const& logicalFileName, std::string const& errorMessage) { Service reportSvc; diff --git a/IOPool/Output/src/PoolOutputModule.cc b/IOPool/Output/src/PoolOutputModule.cc index d90bb9109a1ab..ba4d4d3328b21 100644 --- a/IOPool/Output/src/PoolOutputModule.cc +++ b/IOPool/Output/src/PoolOutputModule.cc @@ -92,10 +92,8 @@ namespace edm { for(int i = InEvent; i < NumBranchTypes; ++i) { BranchType branchType = static_cast(i); SelectedProducts const& keptVector = keptProducts()[branchType]; - for(SelectedProducts::const_iterator it = keptVector.begin(), itEnd = keptVector.end(); it != itEnd; ++it) { - BranchDescription const& prod = **it; - checkDictionaries(prod.fullClassName(), true); - checkDictionaries(wrappedClassName(prod.fullClassName()), true); + for(auto const& prod : keptVector) { + checkClassDictionaries(TypeID(prod->wrappedType().typeInfo()), false); } } } diff --git a/IOPool/Output/src/RootOutputFile.cc b/IOPool/Output/src/RootOutputFile.cc index 8bd992f45f64a..9a8a944fb6269 100644 --- a/IOPool/Output/src/RootOutputFile.cc +++ b/IOPool/Output/src/RootOutputFile.cc @@ -31,6 +31,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/Registry.h" #include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Utilities/interface/ExceptionPropagate.h" #include "IOPool/Common/interface/getWrapperBasePtr.h" #include "TTree.h" @@ -62,6 +63,17 @@ namespace edm { lh->processName() < rh->processName() ? true : false; } + + TFile* + openTFile(char const* name, int compressionLevel) { + TFile* file = TFile::Open(name, "recreate", "", compressionLevel); + std::exception_ptr e = edm::threadLocalException::getException(); + if(e != std::exception_ptr()) { + edm::threadLocalException::setException(std::exception_ptr()); + std::rethrow_exception(e); + } + return file; + } } RootOutputFile::RootOutputFile(PoolOutputModule* om, std::string const& fileName, std::string const& logicalFileName) : @@ -71,7 +83,7 @@ namespace edm { om_(om), whyNotFastClonable_(om_->whyNotFastClonable()), canFastCloneAux_(false), - filePtr_(TFile::Open(file_.c_str(), "recreate", "", om_->compressionLevel())), + filePtr_(openTFile(file_.c_str(), om_->compressionLevel())), fid_(), eventEntryNumber_(0LL), lumiEntryNumber_(0LL), @@ -471,9 +483,9 @@ namespace edm { &desc, om_->basketSize(), 0)) throw Exception(errors::FatalRootError) << "Failed to create a branch for Parentages in the output file"; - + ParentageRegistry& ptReg = *ParentageRegistry::instance(); - + std::vector orderedIDs(parentageIDs_.size()); for(auto const& parentageID : parentageIDs_) { orderedIDs[parentageID.second] = parentageID.first; @@ -485,7 +497,7 @@ namespace edm { // so a null value of desc can't be fatal. // Root will default construct an object in that case. parentageTree_->Fill(); - } + } } void RootOutputFile::writeFileFormatVersion() { @@ -731,7 +743,7 @@ namespace edm { treePointers_[branchType]->fillTree(); if(productProvenanceVecPtr != nullptr) productProvenanceVecPtr->clear(); } - + bool RootOutputFile::insertProductProvenance(const edm::ProductProvenance& iProv, std::set& oToInsert) { diff --git a/IOPool/Output/src/RootOutputTree.cc b/IOPool/Output/src/RootOutputTree.cc index b9f31b60aa989..213602ed19419 100644 --- a/IOPool/Output/src/RootOutputTree.cc +++ b/IOPool/Output/src/RootOutputTree.cc @@ -344,12 +344,14 @@ namespace edm { basketSize, splitLevel); assert(branch != nullptr); +/* if(pProd != nullptr) { // Delete the product that ROOT has allocated. WrapperBase const* edp = static_cast(pProd); delete edp; pProd = nullptr; } +*/ if(produced) { producedBranches_.push_back(branch); } else { diff --git a/IOPool/Streamer/src/ClassFiller.cc b/IOPool/Streamer/src/ClassFiller.cc index 8e322747463aa..d6cf250f58f65 100644 --- a/IOPool/Streamer/src/ClassFiller.cc +++ b/IOPool/Streamer/src/ClassFiller.cc @@ -4,12 +4,10 @@ #include "FWCore/Utilities/interface/DebugMacros.h" #include "FWCore/Utilities/interface/DictionaryTools.h" #include "FWCore/Utilities/interface/TypeID.h" -#include "Cintex/Cintex.h" #include "FWCore/PluginManager/interface/PluginCapabilities.h" #include "TClass.h" -#include "G__ci.h" #include #include @@ -17,17 +15,22 @@ #include namespace edm { - void loadCap(std::string const& name) { - FDEBUG(1) << "Loading dictionary for " << name << "\n"; - edmplugin::PluginCapabilities::get()->load(dictionaryPlugInPrefix() + name); - checkDictionaries(name); + void loadType(TypeID const& type) { + checkClassDictionaries(type, true); if (!missingTypes().empty()) { - StringSet missing = missingTypes(); + TypeSet missing = missingTypes(); missingTypes().clear(); - for_all(missing, loadCap); + for_all(missing, loadType); } } + void loadCap(std::string const& name) { + FDEBUG(1) << "Loading dictionary for " << name << "\n"; + edmplugin::PluginCapabilities::get()->load(dictionaryPlugInPrefix() + name); + TClass* cl = TClass::GetClass(name.c_str()); + loadType(TypeID(*cl->GetTypeInfo())); + } + void doBuildRealData(std::string const& name) { FDEBUG(3) << "doing BuildRealData for " << name << "\n"; TClass* ttest = TClass::GetClass(name.c_str()); @@ -49,8 +52,6 @@ namespace edm { loadCap(std::string("std::vector")); loadCap(std::string("edm::SendJobHeader")); } - G__SetCatchException(0); - ROOT::Cintex::Cintex::Enable(); done=true; } diff --git a/IOPool/TFileAdaptor/BuildFile.xml b/IOPool/TFileAdaptor/BuildFile.xml index 15feee5ca37a1..9ecd56ea04304 100644 --- a/IOPool/TFileAdaptor/BuildFile.xml +++ b/IOPool/TFileAdaptor/BuildFile.xml @@ -4,4 +4,6 @@ - + + + diff --git a/IOPool/TFileAdaptor/src/TFileAdaptor.cc b/IOPool/TFileAdaptor/src/TFileAdaptor.cc index 52c9fbaa7e7ba..e529ed4fc7db0 100644 --- a/IOPool/TFileAdaptor/src/TFileAdaptor.cc +++ b/IOPool/TFileAdaptor/src/TFileAdaptor.cc @@ -255,25 +255,6 @@ data.insert(std::make_pair("ROOT-tfile-write-totalMegabytes", w.str())); } -/* - * wrapper to bind TFileAdaptor to root, python etc - * loading IOPoolTFileAdaptor library and instantiating - * TFileAdaptorUI will make root to use StorageAdaptor for I/O instead - * of its own plugins - */ -class TFileAdaptorUI { -public: - - TFileAdaptorUI(); - ~TFileAdaptorUI(); - - // print current Storage statistics on cout - void stats() const; - -private: - boost::shared_ptr me; -}; - #include TFileAdaptorUI::TFileAdaptorUI() { diff --git a/IOPool/TFileAdaptor/src/TFileAdaptor.h b/IOPool/TFileAdaptor/src/TFileAdaptor.h index 959cf3e7f5079..384337b17475b 100644 --- a/IOPool/TFileAdaptor/src/TFileAdaptor.h +++ b/IOPool/TFileAdaptor/src/TFileAdaptor.h @@ -1,6 +1,8 @@ #ifndef IOPool_TFileAdaptor_TFileAdaptor_h #define IOPool_TFileAdaptor_TFileAdaptor_h +#include "boost/shared_ptr.hpp" + #include #include #include @@ -54,4 +56,25 @@ namespace edm { } } } + +/* + * wrapper to bind TFileAdaptor to root, python etc + * loading IOPoolTFileAdaptor library and instantiating + * TFileAdaptorUI will make root to use StorageAdaptor for I/O instead + * of its own plugins + */ + +class TFileAdaptorUI { +public: + + TFileAdaptorUI(); + ~TFileAdaptorUI(); + + // print current Storage statistics on cout + void stats() const; + +private: + boost::shared_ptr me; +}; + #endif diff --git a/IOPool/TFileAdaptor/src/TFileAdaptorLinkDef.h b/IOPool/TFileAdaptor/src/TFileAdaptorLinkDef.h deleted file mode 100644 index d4e98f86d3fe1..0000000000000 --- a/IOPool/TFileAdaptor/src/TFileAdaptorLinkDef.h +++ /dev/null @@ -1,37 +0,0 @@ -#include "IOPool/TFileAdaptor/interface/TStorageFactoryFile.h" -#include "IOPool/TFileAdaptor/interface/TStorageFactorySystem.h" - -#ifndef __MAKECINT__ -#include -#else -namespace boost { -template class shared_ptr; -} -#endif - -class TFileAdaptor; - -class TFileAdaptorUI { -public: - - TFileAdaptorUI(); - ~TFileAdaptorUI(); - void stats() const; - -private: - boost::shared_ptr me; -}; - - -#ifdef __CINT__ - -#pragma link off all globals; -#pragma link off all classes; -#pragma link off all functions; - -#pragma link C++ class TFileAdaptorUI; - -#pragma link C++ class TStorageFactoryFile; -#pragma link C++ class TStorageFactorySystem; - -#endif // __CINT__ diff --git a/IOPool/TFileAdaptor/src/TStorageFactoryFile.cc b/IOPool/TFileAdaptor/src/TStorageFactoryFile.cc index 828fd4e3debbe..d4e72910217ff 100644 --- a/IOPool/TFileAdaptor/src/TStorageFactoryFile.cc +++ b/IOPool/TFileAdaptor/src/TStorageFactoryFile.cc @@ -5,6 +5,7 @@ #include "Utilities/StorageFactory/interface/StatisticsSenderService.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/EDMException.h" +#include "FWCore/Utilities/interface/ExceptionPropagate.h" #include "ReadRepacker.h" #include "TFileCacheRead.h" #include "TSystem.h" @@ -84,6 +85,7 @@ static StorageAccount::Counter *s_statsWrite = 0; static StorageAccount::Counter *s_statsCWrite = 0; static StorageAccount::Counter *s_statsXWrite = 0; + static inline StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, const char *label) { @@ -111,7 +113,11 @@ TStorageFactoryFile::TStorageFactoryFile(const char *path, : TFile(path, "NET", ftitle, compress), // Pass "NET" to prevent local access in base class storage_(0) { - Initialize(path, option); + try { + Initialize(path, option); + } catch (...) { + edm::threadLocalException::setException(std::current_exception()); // capture + } } TStorageFactoryFile::TStorageFactoryFile(const char *path, @@ -121,7 +127,11 @@ TStorageFactoryFile::TStorageFactoryFile(const char *path, : TFile(path, "NET", ftitle, compress), // Pass "NET" to prevent local access in base class storage_(0) { - Initialize(path, option); + try { + Initialize(path, option); + } catch (...) { + edm::threadLocalException::setException(std::current_exception()); // capture + } } void @@ -376,7 +386,7 @@ TStorageFactoryFile::ReadBuffersSync(char *buf, Long64_t *pos, Int_t *len, Int_t Int_t remaining = nbuf; // Number of read requests left to process. Int_t pack_count; // Number of read requests processed by this iteration. - + IOSize remaining_buffer_size=0; // Calculate the remaining buffer size for the ROOT-owned buffer by adding // the size of the various requests. @@ -411,7 +421,7 @@ TStorageFactoryFile::ReadBuffersSync(char *buf, Long64_t *pos, Int_t *len, Int_t current_pos += pack_count; current_len += pack_count; - remaining -= pack_count; + remaining -= pack_count; } assert(remaining_buffer_size == 0); diff --git a/IOPool/TFileAdaptor/src/classes.h b/IOPool/TFileAdaptor/src/classes.h new file mode 100644 index 0000000000000..46bf4ff9bbfee --- /dev/null +++ b/IOPool/TFileAdaptor/src/classes.h @@ -0,0 +1,3 @@ +#include "IOPool/TFileAdaptor/interface/TStorageFactoryFile.h" +#include "IOPool/TFileAdaptor/interface/TStorageFactorySystem.h" +#include "IOPool/TFileAdaptor/src/TFileAdaptor.h" diff --git a/IOPool/TFileAdaptor/src/classes_def.xml b/IOPool/TFileAdaptor/src/classes_def.xml new file mode 100644 index 0000000000000..1739ca047cd9a --- /dev/null +++ b/IOPool/TFileAdaptor/src/classes_def.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/IOPool/TFileAdaptor/test/BuildFile.xml b/IOPool/TFileAdaptor/test/BuildFile.xml index 8ab76deacd9cd..14c396e55c798 100644 --- a/IOPool/TFileAdaptor/test/BuildFile.xml +++ b/IOPool/TFileAdaptor/test/BuildFile.xml @@ -1,4 +1,5 @@ + diff --git a/PhysicsTools/CondLiteIO/test/recordwriter.cppunit.cpp b/PhysicsTools/CondLiteIO/test/recordwriter.cppunit.cpp index 467c7bbc915aa..de83c15c04eca 100755 --- a/PhysicsTools/CondLiteIO/test/recordwriter.cppunit.cpp +++ b/PhysicsTools/CondLiteIO/test/recordwriter.cppunit.cpp @@ -8,7 +8,6 @@ #include #include -#include "Cintex/Cintex.h" #include "TFile.h" #include "TTree.h" @@ -27,7 +26,7 @@ class testRecordWriter: public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: - void setUp(){ ROOT::Cintex::Cintex::Enable(); } + void setUp(){ } void tearDown(){} void testNoInheritance(); diff --git a/PhysicsTools/Heppy/python/loadlibs.py b/PhysicsTools/Heppy/python/loadlibs.py index b1e64cce4532c..f215cbd1ed1b4 100644 --- a/PhysicsTools/Heppy/python/loadlibs.py +++ b/PhysicsTools/Heppy/python/loadlibs.py @@ -6,8 +6,6 @@ def load_libs(): gSystem.Load("libFWCoreFWLite") gROOT.ProcessLine('AutoLibraryLoader::enable();') gSystem.Load("libFWCoreFWLite") - gSystem.Load("libCintex") - gROOT.ProcessLine('ROOT::Cintex::Cintex::Enable();') #now the RootTools stuff gSystem.Load("libPhysicsToolsHeppy") diff --git a/PhysicsTools/MVAComputer/bin/mvaConvertTMVAWeights.cpp b/PhysicsTools/MVAComputer/bin/mvaConvertTMVAWeights.cpp index c7b773abcc794..9723a9251ff7d 100644 --- a/PhysicsTools/MVAComputer/bin/mvaConvertTMVAWeights.cpp +++ b/PhysicsTools/MVAComputer/bin/mvaConvertTMVAWeights.cpp @@ -10,7 +10,6 @@ #include -#include #include "FWCore/Utilities/interface/Exception.h" @@ -108,7 +107,6 @@ int main(int argc, char **argv) return 1; } - ROOT::Cintex::Cintex::Enable(); std::vector names; for(int i = 3; i < argc; i++) diff --git a/PhysicsTools/MVAComputer/bin/mvaExtractPDFs.cpp b/PhysicsTools/MVAComputer/bin/mvaExtractPDFs.cpp index 09591172bee6e..9ae24c095a5a3 100644 --- a/PhysicsTools/MVAComputer/bin/mvaExtractPDFs.cpp +++ b/PhysicsTools/MVAComputer/bin/mvaExtractPDFs.cpp @@ -7,7 +7,6 @@ #include #include -#include #include "PhysicsTools/MVAComputer/interface/Calibration.h" #include "PhysicsTools/MVAComputer/interface/MVAComputer.h" @@ -22,8 +21,6 @@ int main(int argc, char **argv) using Calibration::HistogramF; using Calibration::VarProcessor; - ROOT::Cintex::Cintex::Enable(); - if (argc != 3) { std::cerr << "Syntax: " << argv[0] << " " << "" << std::endl; diff --git a/PhysicsTools/MVAComputer/test/rootlogon.C b/PhysicsTools/MVAComputer/test/rootlogon.C index abda8fa52352d..4415a35a0f721 100644 --- a/PhysicsTools/MVAComputer/test/rootlogon.C +++ b/PhysicsTools/MVAComputer/test/rootlogon.C @@ -1,7 +1,5 @@ void rootlogon() { - gSystem->Load("libCintex"); gSystem->Load("libPhysicsToolsMVAComputer"); gSystem->Load("libPhysicsToolsMVATrainer"); - Cintex::Enable(); } diff --git a/PhysicsTools/MVATrainer/bin/mvaExtractor.cpp b/PhysicsTools/MVATrainer/bin/mvaExtractor.cpp index f35fe8462307b..69cb551ed96b6 100644 --- a/PhysicsTools/MVATrainer/bin/mvaExtractor.cpp +++ b/PhysicsTools/MVATrainer/bin/mvaExtractor.cpp @@ -5,7 +5,6 @@ #include #include -#include #include "FWCore/Utilities/interface/Exception.h" @@ -54,7 +53,6 @@ int main(int argc, char **argv) return 1; } - ROOT::Cintex::Cintex::Enable(); try { Calibration::MVAComputer *calib = diff --git a/PhysicsTools/MVATrainer/bin/mvaTreeComputer.cpp b/PhysicsTools/MVATrainer/bin/mvaTreeComputer.cpp index df61da82879ae..f84f7204db1fd 100644 --- a/PhysicsTools/MVATrainer/bin/mvaTreeComputer.cpp +++ b/PhysicsTools/MVATrainer/bin/mvaTreeComputer.cpp @@ -12,7 +12,6 @@ #include #include -#include #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/PluginManager/interface/PluginManager.h" @@ -96,8 +95,6 @@ int main(int argc, char **argv) return 1; } - ROOT::Cintex::Cintex::Enable(); - try { std::vector trees; for(int i = 3; i < argc; i++) { diff --git a/PhysicsTools/MVATrainer/bin/mvaTreeTrainer.cpp b/PhysicsTools/MVATrainer/bin/mvaTreeTrainer.cpp index 64f2db1b459ed..cf0ae6a59440b 100644 --- a/PhysicsTools/MVATrainer/bin/mvaTreeTrainer.cpp +++ b/PhysicsTools/MVATrainer/bin/mvaTreeTrainer.cpp @@ -10,8 +10,6 @@ #include #include -#include - #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/PluginManager/interface/PluginManager.h" #include "FWCore/PluginManager/interface/standard.h" @@ -160,8 +158,6 @@ int main(int argc, char **argv) return 1; } - ROOT::Cintex::Cintex::Enable(); - srandom(1); try { diff --git a/PhysicsTools/MVATrainer/test/rootlogon.C b/PhysicsTools/MVATrainer/test/rootlogon.C index abda8fa52352d..4415a35a0f721 100644 --- a/PhysicsTools/MVATrainer/test/rootlogon.C +++ b/PhysicsTools/MVATrainer/test/rootlogon.C @@ -1,7 +1,5 @@ void rootlogon() { - gSystem->Load("libCintex"); gSystem->Load("libPhysicsToolsMVAComputer"); gSystem->Load("libPhysicsToolsMVATrainer"); - Cintex::Enable(); } diff --git a/PhysicsTools/PatExamples/bin/BuildFile.xml b/PhysicsTools/PatExamples/bin/BuildFile.xml index e7b35f39db8ae..e7c1ce7862486 100644 --- a/PhysicsTools/PatExamples/bin/BuildFile.xml +++ b/PhysicsTools/PatExamples/bin/BuildFile.xml @@ -1,4 +1,6 @@ + + diff --git a/RecoBTag/PerformanceDB/bin/TestPerformanceFWLite_ES.cc b/RecoBTag/PerformanceDB/bin/TestPerformanceFWLite_ES.cc index 1dd50eae07d54..9c11652f83bcc 100644 --- a/RecoBTag/PerformanceDB/bin/TestPerformanceFWLite_ES.cc +++ b/RecoBTag/PerformanceDB/bin/TestPerformanceFWLite_ES.cc @@ -1,7 +1,6 @@ #include #include -#include "Cintex/Cintex.h" #include "TFile.h" #include "TTree.h" #include "FWCore/FWLite/interface/AutoLibraryLoader.h" diff --git a/RecoBTag/PerformanceDB/bin/getbtagPerformance.cc b/RecoBTag/PerformanceDB/bin/getbtagPerformance.cc index fd731cf32f6d3..4287c9d0e01ac 100644 --- a/RecoBTag/PerformanceDB/bin/getbtagPerformance.cc +++ b/RecoBTag/PerformanceDB/bin/getbtagPerformance.cc @@ -1,7 +1,6 @@ #include #include -#include "Cintex/Cintex.h" #include "TFile.h" #include "TTree.h" #include "FWCore/FWLite/interface/AutoLibraryLoader.h" diff --git a/RecoBTag/PerformanceDB/test/BTagCalibrationStandalone.cc b/RecoBTag/PerformanceDB/test/BTagCalibrationStandalone.cc index 766c0070a3666..09b4972457393 100644 --- a/RecoBTag/PerformanceDB/test/BTagCalibrationStandalone.cc +++ b/RecoBTag/PerformanceDB/test/BTagCalibrationStandalone.cc @@ -131,7 +131,7 @@ throw std::exception(); // e.g. "x<0 ? 1 : x<1 ? 2 : x<2 ? 3 : 4" std::string th1ToFormulaLin(const TH1* hist) { int nbins = hist->GetNbinsX(); - TAxis * axis = hist->GetXaxis(); + TAxis const* axis = hist->GetXaxis(); std::stringstream buff; buff << "x<" << axis->GetBinLowEdge(1) << " ? 0. : "; // default value for (int i=1; iGetNbinsX(); - TAxis * axis = hist->GetXaxis(); + TAxis const* axis = hist->GetXaxis(); // overwrite bounds with histo values if (params.operatingPoint == BTagEntry::OP_RESHAPING) { @@ -328,7 +328,7 @@ void BTagCalibration::readCSV(std::istream &s) } } -void BTagCalibration::makeCSV(ostream &s) const +void BTagCalibration::makeCSV(std::ostream &s) const { s << tagger_ << ";" << BTagEntry::makeCSVHeader(); for (std::map >::const_iterator i diff --git a/RecoEgamma/EgammaElectronAlgos/interface/PixelHitMatcher.h b/RecoEgamma/EgammaElectronAlgos/interface/PixelHitMatcher.h index a8c8c55222077..26626af361b80 100644 --- a/RecoEgamma/EgammaElectronAlgos/interface/PixelHitMatcher.h +++ b/RecoEgamma/EgammaElectronAlgos/interface/PixelHitMatcher.h @@ -172,7 +172,10 @@ class PixelHitMatcher typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer; typedef TransientTrackingRecHit::RecHitPointer RecHitPointer; typedef TransientTrackingRecHit::RecHitContainer RecHitContainer; - typedef ROOT::Math::PositionVector3D > REPPoint; + // Next typedef uses double in ROOT 6 rather than Double32_t due to a bug in ROOT 5, + // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase + // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5. + typedef ROOT::Math::PositionVector3D > REPPoint; PixelHitMatcher ( float phi1min, float phi1max, diff --git a/RecoMuon/MuonIdentification/test/rootlogon.C b/RecoMuon/MuonIdentification/test/rootlogon.C index 73d7061778fce..3b304cd9e5f5d 100644 --- a/RecoMuon/MuonIdentification/test/rootlogon.C +++ b/RecoMuon/MuonIdentification/test/rootlogon.C @@ -1,8 +1,6 @@ { gROOT->SetStyle("Plain"); cout << "loading..." <Load("libCintex"); - Cintex::Enable(); gSystem->Load("libFWCoreFWLite"); AutoLibraryLoader::enable(); gSystem->Load("libRooFit.so"); diff --git a/RecoParticleFlow/PFClusterProducer/test/init.C b/RecoParticleFlow/PFClusterProducer/test/init.C index a135652df88c0..8d95f10883286 100644 --- a/RecoParticleFlow/PFClusterProducer/test/init.C +++ b/RecoParticleFlow/PFClusterProducer/test/init.C @@ -2,7 +2,5 @@ gSystem->Load("libFWCoreFWLite.so"); AutoLibraryLoader::enable(); -gSystem->Load("libCintex.so"); -ROOT::Cintex::Cintex::Enable(); } diff --git a/RecoParticleFlow/PFClusterTools/test/src/clusterCalibrate.C b/RecoParticleFlow/PFClusterTools/test/src/clusterCalibrate.C index 0ea04ed3cb3cf..914bfd0bc9a10 100644 --- a/RecoParticleFlow/PFClusterTools/test/src/clusterCalibrate.C +++ b/RecoParticleFlow/PFClusterTools/test/src/clusterCalibrate.C @@ -1,6 +1,4 @@ { - gSystem->Load("libCintex.so"); - Cintex::Enable(); gSystem->Load("libRecoParticleFlowPFClusterTools.so"); std::cout << "Loaded libraries." << std::endl; using namespace std; diff --git a/RecoParticleFlow/PFClusterTools/test/src/clusterCalibrationExample.C b/RecoParticleFlow/PFClusterTools/test/src/clusterCalibrationExample.C index 6a993426f27d9..ba83df2abda93 100644 --- a/RecoParticleFlow/PFClusterTools/test/src/clusterCalibrationExample.C +++ b/RecoParticleFlow/PFClusterTools/test/src/clusterCalibrationExample.C @@ -1,7 +1,5 @@ { - gSystem->Load("libCintex.so"); - Cintex::Enable(); gSystem->Load("libRecoParticleFlowPFClusterTools.so"); @@ -44,4 +42,4 @@ std::cout << clusterCalibration_ << "\n"; -} \ No newline at end of file +} diff --git a/RecoParticleFlow/PFClusterTools/test/src/compareCalib.C b/RecoParticleFlow/PFClusterTools/test/src/compareCalib.C index 25f411392934d..73a5a90e8105c 100644 --- a/RecoParticleFlow/PFClusterTools/test/src/compareCalib.C +++ b/RecoParticleFlow/PFClusterTools/test/src/compareCalib.C @@ -1,7 +1,5 @@ { - gSystem->Load("libCintex.so"); - Cintex::Enable(); gSystem->Load("libRecoParticleFlowPFClusterTools.so"); std::cout << "Loaded libraries." << std::endl; using namespace std; diff --git a/RecoParticleFlow/PFClusterTools/test/src/doCalib.C b/RecoParticleFlow/PFClusterTools/test/src/doCalib.C index 9f67e68a00d7f..056b7164c85dd 100644 --- a/RecoParticleFlow/PFClusterTools/test/src/doCalib.C +++ b/RecoParticleFlow/PFClusterTools/test/src/doCalib.C @@ -1,7 +1,5 @@ { - gSystem->Load("libCintex.so"); - Cintex::Enable(); gSystem->Load("libRecoParticleFlowPFClusterTools.so"); std::cout << "Loaded libraries." << std::endl; using namespace std; diff --git a/RecoParticleFlow/PFClusterTools/test/src/doCalibTestbeam.C b/RecoParticleFlow/PFClusterTools/test/src/doCalibTestbeam.C index ea689e1eea4ca..bcd8c1b55a432 100644 --- a/RecoParticleFlow/PFClusterTools/test/src/doCalibTestbeam.C +++ b/RecoParticleFlow/PFClusterTools/test/src/doCalibTestbeam.C @@ -1,7 +1,5 @@ { - gSystem->Load("libCintex.so"); - Cintex::Enable(); gSystem->Load("libRecoParticleFlowPFClusterTools.so"); std::cout << "Loaded libraries." << std::endl; using namespace std; diff --git a/RecoParticleFlow/PFClusterTools/test/src/exportCSV.C b/RecoParticleFlow/PFClusterTools/test/src/exportCSV.C index d1ae7b30b5ea3..c4dfa51dacdf0 100644 --- a/RecoParticleFlow/PFClusterTools/test/src/exportCSV.C +++ b/RecoParticleFlow/PFClusterTools/test/src/exportCSV.C @@ -1,7 +1,5 @@ { - gSystem->Load("libCintex.so"); - Cintex::Enable(); gSystem->Load("libRecoParticleFlowPFClusterTools.so"); std::cout << "Loaded libraries." << std::endl; using namespace std; diff --git a/RecoParticleFlow/PFClusterTools/test/src/init.C b/RecoParticleFlow/PFClusterTools/test/src/init.C index 2b83d70073480..3c212405e615d 100644 --- a/RecoParticleFlow/PFClusterTools/test/src/init.C +++ b/RecoParticleFlow/PFClusterTools/test/src/init.C @@ -3,8 +3,6 @@ * */ { - gSystem->Load("libCintex.so"); - Cintex::Enable(); gSystem->Load("libRecoParticleFlowPFClusterTools.so"); std::cout << "Loaded libraries." << std::endl; using namespace std; diff --git a/RecoParticleFlow/PFClusterTools/test/src/testConversion.C b/RecoParticleFlow/PFClusterTools/test/src/testConversion.C index 9216ac159d88c..c9f0964453527 100644 --- a/RecoParticleFlow/PFClusterTools/test/src/testConversion.C +++ b/RecoParticleFlow/PFClusterTools/test/src/testConversion.C @@ -1,6 +1,4 @@ { - gSystem->Load("libCintex.so"); - Cintex::Enable(); gSystem->Load("libRecoParticleFlowPFClusterTools.so"); std::cout << "Loaded libraries." << std::endl; //TFile f("singleParticle.root"); @@ -57,4 +55,4 @@ // CalibratableElement chcal(0.7 * energy * (1 - ecalFrac) -1.2, eta, phi, 2); std::cout << "Finished.\n"; -} \ No newline at end of file +} diff --git a/RecoParticleFlow/PFClusterTools/test/src/testWrappers.C b/RecoParticleFlow/PFClusterTools/test/src/testWrappers.C index ba50b6e5e9768..2852dbc8814fa 100644 --- a/RecoParticleFlow/PFClusterTools/test/src/testWrappers.C +++ b/RecoParticleFlow/PFClusterTools/test/src/testWrappers.C @@ -3,10 +3,6 @@ * */ { - gSystem->Load("libCintex.so"); - - Cintex::Enable(); - gSystem->Load("libRecoParticleFlowPFClusterTools.so"); TFile f("TestWrappers.root", "recreate"); diff --git a/RecoTauTag/TauTagTools/test/trainMVA_template.C b/RecoTauTag/TauTagTools/test/trainMVA_template.C index b7f08642ccebf..3fbb635c576e3 100644 --- a/RecoTauTag/TauTagTools/test/trainMVA_template.C +++ b/RecoTauTag/TauTagTools/test/trainMVA_template.C @@ -9,12 +9,10 @@ void trainMVA() << "Example: if one of the inputs is 'NumberIsolationObjects' and this is always 0, " << endl << "(for whatever reason), this error will occur." << endl; - gSystem->Load("libCintex"); gSystem->Load("libPhysicsToolsMVAComputer"); gSystem->Load("libPhysicsToolsMVATrainer"); gSystem->Load("pluginPhysicsToolsMVATrainerProcTMVA"); gSystem->Load("pluginPhysicsToolsMVAComputerProcTMVA"); - Cintex::Enable(); using namespace PhysicsTools; diff --git a/RecoTracker/TrackProducer/test/analyze_tracks.C b/RecoTracker/TrackProducer/test/analyze_tracks.C index 5d00f39540472..b6dc287f7ee71 100644 --- a/RecoTracker/TrackProducer/test/analyze_tracks.C +++ b/RecoTracker/TrackProducer/test/analyze_tracks.C @@ -1,6 +1,4 @@ { -gSystem->Load("libCintex"); -Cintex::Enable(); gSystem->Load("libFWCoreFWLite.so"); AutoLibraryLoader::enable(); /////////SET THESE VALUES/////////////// diff --git a/SimCalorimetry/HcalSimAlgos/test/readHPDLibrary.cc b/SimCalorimetry/HcalSimAlgos/test/readHPDLibrary.cc index ab2732d8318fd..b655a81df4a54 100644 --- a/SimCalorimetry/HcalSimAlgos/test/readHPDLibrary.cc +++ b/SimCalorimetry/HcalSimAlgos/test/readHPDLibrary.cc @@ -3,10 +3,8 @@ #include #include "TClass.h" -#include int main () { - ROOT::Cintex::Cintex::Enable(); HPDNoiseReader reader ("hpdNoiseLibrary.root"); std::vector names = reader.allNames (); diff --git a/SimCalorimetry/HcalSimAlgos/test/writeHPDLibrary.cc b/SimCalorimetry/HcalSimAlgos/test/writeHPDLibrary.cc index 1b109c37e1de6..2f5dc70eb224c 100644 --- a/SimCalorimetry/HcalSimAlgos/test/writeHPDLibrary.cc +++ b/SimCalorimetry/HcalSimAlgos/test/writeHPDLibrary.cc @@ -1,9 +1,7 @@ #include "SimCalorimetry/HcalSimAlgos/interface/HPDNoiseMaker.h" #include "SimCalorimetry/HcalSimAlgos/interface/HPDNoiseData.h" -#include int main () { - ROOT::Cintex::Cintex::Enable(); HPDNoiseMaker maker ("hpdNoiseLibrary.root"); diff --git a/SimDataFormats/CaloHit/interface/CastorShowerEvent.h b/SimDataFormats/CaloHit/interface/CastorShowerEvent.h index 5799e9461de1c..b656dae0f8c94 100644 --- a/SimDataFormats/CaloHit/interface/CastorShowerEvent.h +++ b/SimDataFormats/CaloHit/interface/CastorShowerEvent.h @@ -62,7 +62,7 @@ float getPrimY() { return primY; }; float getPrimZ() { return primZ; }; - ClassDef(CastorShowerEvent,1) + ClassDef(CastorShowerEvent,2) }; diff --git a/SimDataFormats/CaloHit/src/CastorEventLinkDef.h b/SimDataFormats/CaloHit/src/CastorEventLinkDef.h deleted file mode 100644 index ab8ace6cc0370..0000000000000 --- a/SimDataFormats/CaloHit/src/CastorEventLinkDef.h +++ /dev/null @@ -1,8 +0,0 @@ -#include "SimDataFormats/CaloHit/interface/CastorShowerEvent.h" -#include "SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h" -#ifdef __CINT__ - -#pragma link C++ class CastorShowerEvent+; -#pragma link C++ class CastorShowerLibraryInfo+; -#pragma link C++ class SLBin+; -#endif diff --git a/SimDataFormats/CaloHit/src/classes_def.xml b/SimDataFormats/CaloHit/src/classes_def.xml index 9c1a593332f44..88bbb609afe7d 100644 --- a/SimDataFormats/CaloHit/src/classes_def.xml +++ b/SimDataFormats/CaloHit/src/classes_def.xml @@ -10,10 +10,20 @@ + + + + + + + + + + diff --git a/SimDataFormats/EncodedEventId/BuildFile.xml b/SimDataFormats/EncodedEventId/BuildFile.xml index f9c00311052f4..653cc500823b1 100644 --- a/SimDataFormats/EncodedEventId/BuildFile.xml +++ b/SimDataFormats/EncodedEventId/BuildFile.xml @@ -1,6 +1,5 @@ - diff --git a/SimDataFormats/GeneratorProducts/src/classes_def.xml b/SimDataFormats/GeneratorProducts/src/classes_def.xml index e886f0bc0711c..cd49df7c6aa45 100644 --- a/SimDataFormats/GeneratorProducts/src/classes_def.xml +++ b/SimDataFormats/GeneratorProducts/src/classes_def.xml @@ -1,7 +1,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/TopQuarkAnalysis/TopEventSelection/bin/TtSemiLRSignalSel_PurityLoop.cpp b/TopQuarkAnalysis/TopEventSelection/bin/TtSemiLRSignalSel_PurityLoop.cpp index ebb9817624c43..07bd162d16e36 100644 --- a/TopQuarkAnalysis/TopEventSelection/bin/TtSemiLRSignalSel_PurityLoop.cpp +++ b/TopQuarkAnalysis/TopEventSelection/bin/TtSemiLRSignalSel_PurityLoop.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include diff --git a/TopQuarkAnalysis/TopEventSelection/bin/TtSemiLRSignalSel_SoverSplusBLoop.cpp b/TopQuarkAnalysis/TopEventSelection/bin/TtSemiLRSignalSel_SoverSplusBLoop.cpp index f46c9dc829f06..076be238641f2 100644 --- a/TopQuarkAnalysis/TopEventSelection/bin/TtSemiLRSignalSel_SoverSplusBLoop.cpp +++ b/TopQuarkAnalysis/TopEventSelection/bin/TtSemiLRSignalSel_SoverSplusBLoop.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include diff --git a/TopQuarkAnalysis/TopJetCombination/bin/TtSemiLRJetComb_PurityLoop.cpp b/TopQuarkAnalysis/TopJetCombination/bin/TtSemiLRJetComb_PurityLoop.cpp index 80e0e513a4e93..992c233f843ff 100644 --- a/TopQuarkAnalysis/TopJetCombination/bin/TtSemiLRJetComb_PurityLoop.cpp +++ b/TopQuarkAnalysis/TopJetCombination/bin/TtSemiLRJetComb_PurityLoop.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include diff --git a/TopQuarkAnalysis/TopJetCombination/bin/TtSemiLRJetComb_SoverSplusBLoop.cpp b/TopQuarkAnalysis/TopJetCombination/bin/TtSemiLRJetComb_SoverSplusBLoop.cpp index a5cbbe72ee499..ea6d365b9dbcd 100644 --- a/TopQuarkAnalysis/TopJetCombination/bin/TtSemiLRJetComb_SoverSplusBLoop.cpp +++ b/TopQuarkAnalysis/TopJetCombination/bin/TtSemiLRJetComb_SoverSplusBLoop.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include diff --git a/TrackingTools/PatternTools/src/classes_def.xml b/TrackingTools/PatternTools/src/classes_def.xml index 2113ac5cccffe..c7a41b4f0ebf1 100755 --- a/TrackingTools/PatternTools/src/classes_def.xml +++ b/TrackingTools/PatternTools/src/classes_def.xml @@ -56,6 +56,8 @@ + + diff --git a/TrackingTools/TrackAssociator/test/rootlogon.C b/TrackingTools/TrackAssociator/test/rootlogon.C index 73d7061778fce..3b304cd9e5f5d 100644 --- a/TrackingTools/TrackAssociator/test/rootlogon.C +++ b/TrackingTools/TrackAssociator/test/rootlogon.C @@ -1,8 +1,6 @@ { gROOT->SetStyle("Plain"); cout << "loading..." <Load("libCintex"); - Cintex::Enable(); gSystem->Load("libFWCoreFWLite"); AutoLibraryLoader::enable(); gSystem->Load("libRooFit.so"); diff --git a/TrackingTools/TrajectoryState/src/classes_def.xml b/TrackingTools/TrajectoryState/src/classes_def.xml index 295e3cf2804a6..b6a3e9b03f813 100755 --- a/TrackingTools/TrajectoryState/src/classes_def.xml +++ b/TrackingTools/TrajectoryState/src/classes_def.xml @@ -19,5 +19,5 @@ --> - + diff --git a/Validation/EcalHits/test/rootlogon.C b/Validation/EcalHits/test/rootlogon.C index 9da127cd46c8e..43b4e937e380e 100644 --- a/Validation/EcalHits/test/rootlogon.C +++ b/Validation/EcalHits/test/rootlogon.C @@ -1,6 +1,4 @@ { -gSystem->Load("libCintex"); -Cintex::Enable(); cout << "Loading FWLite..." << endl; gSystem->Load("libFWCoreFWLite"); AutoLibraryLoader::enable(); diff --git a/Validation/GlobalDigis/test/rootlogon.C b/Validation/GlobalDigis/test/rootlogon.C index 7b31ecd191189..2f0d16f558304 100644 --- a/Validation/GlobalDigis/test/rootlogon.C +++ b/Validation/GlobalDigis/test/rootlogon.C @@ -1,6 +1,4 @@ { -gSystem->Load("libCintex"); -Cintex::Enable(); cout << "Loading FWLite..." << endl; // load CMSSW libraries gSystem->Load("libFWCoreFWLite"); AutoLibraryLoader::enable(); diff --git a/Validation/GlobalHits/test/rootlogon.C b/Validation/GlobalHits/test/rootlogon.C index 7b31ecd191189..2f0d16f558304 100644 --- a/Validation/GlobalHits/test/rootlogon.C +++ b/Validation/GlobalHits/test/rootlogon.C @@ -1,6 +1,4 @@ { -gSystem->Load("libCintex"); -Cintex::Enable(); cout << "Loading FWLite..." << endl; // load CMSSW libraries gSystem->Load("libFWCoreFWLite"); AutoLibraryLoader::enable(); diff --git a/Validation/GlobalRecHits/test/rootlogon.C b/Validation/GlobalRecHits/test/rootlogon.C index 7b31ecd191189..2f0d16f558304 100644 --- a/Validation/GlobalRecHits/test/rootlogon.C +++ b/Validation/GlobalRecHits/test/rootlogon.C @@ -1,6 +1,4 @@ { -gSystem->Load("libCintex"); -Cintex::Enable(); cout << "Loading FWLite..." << endl; // load CMSSW libraries gSystem->Load("libFWCoreFWLite"); AutoLibraryLoader::enable(); diff --git a/Validation/MuonIdentification/test/rootlogon.C b/Validation/MuonIdentification/test/rootlogon.C index 73d7061778fce..3b304cd9e5f5d 100644 --- a/Validation/MuonIdentification/test/rootlogon.C +++ b/Validation/MuonIdentification/test/rootlogon.C @@ -1,8 +1,6 @@ { gROOT->SetStyle("Plain"); cout << "loading..." <Load("libCintex"); - Cintex::Enable(); gSystem->Load("libFWCoreFWLite"); AutoLibraryLoader::enable(); gSystem->Load("libRooFit.so"); diff --git a/Validation/RecoParticleFlow/Benchmarks/ElectronBenchmarkGeneric/plot.C b/Validation/RecoParticleFlow/Benchmarks/ElectronBenchmarkGeneric/plot.C index e9caf5c1cb4f7..be9788ef9af80 100644 --- a/Validation/RecoParticleFlow/Benchmarks/ElectronBenchmarkGeneric/plot.C +++ b/Validation/RecoParticleFlow/Benchmarks/ElectronBenchmarkGeneric/plot.C @@ -1,8 +1,6 @@ { gSystem->Load("libFWCoreFWLite.so"); gSystem->Load("libValidationRecoParticleFlow.so"); -gSystem->Load("libCintex.so"); -ROOT::Cintex::Cintex::Enable(); //gROOT->LoadMacro("../Tools/NicePlot.C"); //InitNicePlot(); diff --git a/Validation/RecoParticleFlow/Benchmarks/ElectronRejectionBenchmark/plot.C b/Validation/RecoParticleFlow/Benchmarks/ElectronRejectionBenchmark/plot.C index eb75c69dd7ef5..24be16ad352b1 100644 --- a/Validation/RecoParticleFlow/Benchmarks/ElectronRejectionBenchmark/plot.C +++ b/Validation/RecoParticleFlow/Benchmarks/ElectronRejectionBenchmark/plot.C @@ -1,8 +1,6 @@ { gSystem->Load("libFWCoreFWLite.so"); gSystem->Load("libValidationRecoParticleFlow.so"); -gSystem->Load("libCintex.so"); -ROOT::Cintex::Cintex::Enable(); //gROOT->LoadMacro("../Tools/NicePlot.C"); //InitNicePlot(); diff --git a/Validation/RecoParticleFlow/Benchmarks/JetBenchmarkSpecific/Fractions.C b/Validation/RecoParticleFlow/Benchmarks/JetBenchmarkSpecific/Fractions.C index 7d1735d5f3fb3..5135caeec8891 100644 --- a/Validation/RecoParticleFlow/Benchmarks/JetBenchmarkSpecific/Fractions.C +++ b/Validation/RecoParticleFlow/Benchmarks/JetBenchmarkSpecific/Fractions.C @@ -29,8 +29,6 @@ void Fractions(const char* fileFast, const char* fileFull) gSystem->Load("libFWCoreFWLite.so"); gSystem->Load("libValidationRecoParticleFlow.so"); -gSystem->Load("libCintex.so"); -ROOT::Cintex::Cintex::Enable(); //gROOT->LoadMacro("../Tools/NicePlot.C"); //InitNicePlot(); diff --git a/Validation/RecoParticleFlow/Benchmarks/JetBenchmarkSpecific/TrackMult.C b/Validation/RecoParticleFlow/Benchmarks/JetBenchmarkSpecific/TrackMult.C index eebec3f34e665..655b61e5697fd 100644 --- a/Validation/RecoParticleFlow/Benchmarks/JetBenchmarkSpecific/TrackMult.C +++ b/Validation/RecoParticleFlow/Benchmarks/JetBenchmarkSpecific/TrackMult.C @@ -25,8 +25,6 @@ void TrackMult(const char* fileFast, const char* fileFull) gSystem->Load("libFWCoreFWLite.so"); gSystem->Load("libValidationRecoParticleFlow.so"); -gSystem->Load("libCintex.so"); -ROOT::Cintex::Cintex::Enable(); //gROOT->LoadMacro("../Tools/NicePlot.C"); //InitNicePlot(); diff --git a/Validation/RecoParticleFlow/Benchmarks/JetBenchmarkSpecific/plot.C b/Validation/RecoParticleFlow/Benchmarks/JetBenchmarkSpecific/plot.C index 15a36515fd729..f0737f669905a 100644 --- a/Validation/RecoParticleFlow/Benchmarks/JetBenchmarkSpecific/plot.C +++ b/Validation/RecoParticleFlow/Benchmarks/JetBenchmarkSpecific/plot.C @@ -1,8 +1,6 @@ { gSystem->Load("libFWCoreFWLite.so"); gSystem->Load("libValidationRecoParticleFlow.so"); -gSystem->Load("libCintex.so"); -ROOT::Cintex::Cintex::Enable(); //gROOT->LoadMacro("../Tools/NicePlot.C"); //InitNicePlot(); diff --git a/Validation/RecoParticleFlow/Benchmarks/METBenchmarkGeneric/compare.C b/Validation/RecoParticleFlow/Benchmarks/METBenchmarkGeneric/compare.C index 35dd8346499a2..00711c233fb65 100644 --- a/Validation/RecoParticleFlow/Benchmarks/METBenchmarkGeneric/compare.C +++ b/Validation/RecoParticleFlow/Benchmarks/METBenchmarkGeneric/compare.C @@ -1,8 +1,6 @@ { gSystem->Load("libFWCoreFWLite.so"); gSystem->Load("libValidationRecoParticleFlow.so"); - gSystem->Load("libCintex.so"); - ROOT::Cintex::Cintex::Enable(); gStyle->SetOptStat(1111); diff --git a/Validation/RecoParticleFlow/Benchmarks/METBenchmarkGeneric/plot.C b/Validation/RecoParticleFlow/Benchmarks/METBenchmarkGeneric/plot.C index c967a1107f182..7f6074a385079 100644 --- a/Validation/RecoParticleFlow/Benchmarks/METBenchmarkGeneric/plot.C +++ b/Validation/RecoParticleFlow/Benchmarks/METBenchmarkGeneric/plot.C @@ -1,8 +1,6 @@ { gSystem->Load("libFWCoreFWLite.so"); gSystem->Load("libValidationRecoParticleFlow.so"); - gSystem->Load("libCintex.so"); - ROOT::Cintex::Cintex::Enable(); gStyle->SetOptStat(1111); diff --git a/Validation/RecoParticleFlow/Benchmarks/METBenchmarkGeneric/plot_QCD.C b/Validation/RecoParticleFlow/Benchmarks/METBenchmarkGeneric/plot_QCD.C index b368e6fc915ee..7cbc92e2e15ce 100644 --- a/Validation/RecoParticleFlow/Benchmarks/METBenchmarkGeneric/plot_QCD.C +++ b/Validation/RecoParticleFlow/Benchmarks/METBenchmarkGeneric/plot_QCD.C @@ -1,8 +1,6 @@ { gSystem->Load("libFWCoreFWLite.so"); gSystem->Load("libValidationRecoParticleFlow.so"); - gSystem->Load("libCintex.so"); - ROOT::Cintex::Cintex::Enable(); //gStyle->SetOptStat(1111); diff --git a/Validation/RecoParticleFlow/Benchmarks/PFCandidateBenchmark/plot.C b/Validation/RecoParticleFlow/Benchmarks/PFCandidateBenchmark/plot.C index 32d77758c4de8..9a8611e7ebed1 100644 --- a/Validation/RecoParticleFlow/Benchmarks/PFCandidateBenchmark/plot.C +++ b/Validation/RecoParticleFlow/Benchmarks/PFCandidateBenchmark/plot.C @@ -1,8 +1,6 @@ { gSystem->Load("libFWCoreFWLite.so"); gSystem->Load("libValidationRecoParticleFlow.so"); - gSystem->Load("libCintex.so"); - ROOT::Cintex::Cintex::Enable(); gStyle->SetOptStat(1111); diff --git a/Validation/RecoParticleFlow/BuildFile.xml b/Validation/RecoParticleFlow/BuildFile.xml index 84588ea64cb42..e7d52b5721b1f 100644 --- a/Validation/RecoParticleFlow/BuildFile.xml +++ b/Validation/RecoParticleFlow/BuildFile.xml @@ -1,7 +1,6 @@ - diff --git a/Validation/RecoParticleFlow/test/testTH2Analyzer.C b/Validation/RecoParticleFlow/test/testTH2Analyzer.C index 41dcf6f85cc86..88bbbff49ce48 100644 --- a/Validation/RecoParticleFlow/test/testTH2Analyzer.C +++ b/Validation/RecoParticleFlow/test/testTH2Analyzer.C @@ -1,8 +1,6 @@ { gSystem->Load("libFWCoreFWLite.so"); gSystem->Load("libValidationRecoParticleFlow.so"); -gSystem->Load("libCintex.so"); -ROOT::Cintex::Cintex::Enable(); TF2 gaus2("gaus2", "[0]*exp(-0.5*((x-[1])/[2])**2)*exp(-0.5*((y-[3])/[4])**2)",0,10,0,10); gaus2.SetParameters( 100, 5, 5, 2, 2); diff --git a/Validation/TrackerHits/test/rootlogon.C b/Validation/TrackerHits/test/rootlogon.C index 5aabc22847e49..03228756e57f8 100644 --- a/Validation/TrackerHits/test/rootlogon.C +++ b/Validation/TrackerHits/test/rootlogon.C @@ -1,6 +1,4 @@ { -gSystem->Load("libCintex"); -Cintex::Enable(); cout << "Loading FWLite..." << endl; gSystem->Load("libFWCoreFWLite"); AutoLibraryLoader::enable();