Commits

ca...@4525493e-7705-40b1-a816-d608a930855b  committed 08f3b0e

new method ClassIDSvc::reinitialize used by genCLIDDB

  • Participants
  • Parent commits 36b7574

Comments (0)

Files changed (3)

+2007-09-19  Paolo Calafiura  <calaf@0-11-25-81-1e-12.dhcp.lbl.gov>
+
+	* src/ClassIDSvc.cxx (ClassIDSvc::reinitialize): new method used by genCLIDDB
+	tag CLIDComps-00-00-03
+
 2007-08-30  scott snyder  <snyder@bnl.gov>
 
 	* src/ClassIDSvc.h, src/ClassIDSvc.cxx: Rescan the registry if its

File src/ClassIDSvc.cxx

   pIncSvc->addListener(this, ModuleLoadedIncident::TYPE(), PRIORITY);
   pIncSvc->release();
 
-  StatusCode sc;
-  if ((sc = Service::initialize()).isSuccess()) {
-    // Process the various clid dbs according to user's request
-    vector< string >::const_iterator i(m_DBFiles.begin()), iE(m_DBFiles.end());
-    bool allOK(true);
-    while (i != iE) {
-      std::string filepath(PathResolver::find_file(*i, "DATAPATH"));
-      if (filepath.empty()) {
-	log << MSG::WARNING << "Could not resolve file name " 
-	    << *i << " using PathResolver DATAPATH [" 
-	    << getenv("DATAPATH") << "] ----- SKIPPING" << endmsg;
-      } else {
-	allOK &= processCLIDDB(filepath.c_str());
-      }
-      ++i;
-    }
+  if (!(Service::initialize()).isSuccess()) return StatusCode::FAILURE;
 
-    if (allOK && getRegistryEntries("ALL")) {
-      log << MSG::INFO << name() << " Initialized successfully " << endreq;
-      sc = StatusCode::SUCCESS; 
-    } else sc = StatusCode::FAILURE;
-  }
-  return sc;
+  return fillDB();
 }
 
 bool ClassIDSvc::getRegistryEntries(const std::string& moduleName) {
 #endif
     string line;
     while (std::getline(ifile, line)) {
+      //not yet if ("#" == line.substr(0,0)) continue; //skip comments
       //split the record in 2 fields:	
       //      cout << "record " << line << endl;
       bool readOK(true);
     }
     log << MSG::INFO << "------------------------------" << endreq;
 }
+
+StatusCode
+ClassIDSvc::fillDB() {
+  // Process the various clid dbs according to user's request
+  vector< string >::const_iterator i(m_DBFiles.begin()), iE(m_DBFiles.end());
+  bool allOK(true);
+  while (i != iE) {
+    std::string filepath(PathResolver::find_file(*i, "DATAPATH"));
+    if (filepath.empty()) {
+      MsgStream log(messageService(), name());
+      log << MSG::WARNING << "Could not resolve file name " 
+	  << *i << " using PathResolver DATAPATH [" 
+	  << getenv("DATAPATH") << "] ----- SKIPPING" << endmsg;
+    } else {
+      allOK &= processCLIDDB(filepath.c_str());
+    }
+    ++i;
+  }
+  
+  return (allOK && getRegistryEntries("ALL")) ? 
+    StatusCode::SUCCESS :
+    StatusCode::FAILURE;
+}
+
+StatusCode
+ClassIDSvc::reinitialize() {
+  MsgStream log( messageService(), name() );
+  log << MSG::INFO << "RE-initializing " << name() 
+      << " - package version " << PACKAGE_VERSION << endreq ;  
+  return fillDB();
+}

File src/ClassIDSvc.h

  * @brief a service to manage and verify CLID assignments in athena
 
  * @author Paolo Calafiura <pcalafiura@lbl.gov> - ATLAS Collaboration
- *$Id: ClassIDSvc.h,v 1.3 2007-08-30 21:15:00 ssnyder Exp $
+ *$Id: ClassIDSvc.h,v 1.4 2007-09-19 16:26:34 calaf Exp $
  */
 
 #ifndef _CPP_MAP
   /// Gaudi Service Implementation
   //@{
   virtual StatusCode initialize();
+  virtual StatusCode reinitialize();
   ///dump CLIDmap to outputFileName;
   virtual StatusCode finalize(); 
   virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface );
   virtual ~ClassIDSvc() {};
 
 private:
+  /// get clids from CLIDDB and from registry entries
+  StatusCode fillDB();
   /// load clid/names from a "db" file
   bool processCLIDDB(const char* fileName);
   /// load clid/names from a DLL registry