1. binet
  2. mana-core-clidcomps

Commits

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

add package info to clid.db content

  • Participants
  • Parent commits c1e70a8
  • Branches default

Comments (0)

Files changed (2)

File ChangeLog

View file
+2007-10-05  Paolo Calafiura  
+	tag CLIDComps-00-03-00
+	* src/ClassIDSvc.cxx (ClassIDSvc::processCLIDDB): add package info to
+	clid.db content
+
 2007-10-04  Paolo Calafiura 
 	* src/ClassIDSvc.cxx (ClassIDSvc::processCLIDDB): use CLIDDB instead
 	of FIXME if clid comes from file

File src/ClassIDSvc.cxx

View file
       //    copy(m_clidMap.begin(), m_clidMap,end(), os);
       CLIDMap::const_iterator i(m_clidMap.begin()), iE(m_clidMap.end());
       while (i != iE) {
-	outfile << i->first << ' ' << i->second << endl;
+	outfile << i->first << ' ' << i->second;
+	Athena::PackageInfo existInfo;
+	if (getPackageInfoForID(i->first, existInfo).isSuccess())
+	  outfile << ' ' << existInfo;
+       
+	outfile	<< endl;
 	++i;
       }
       MsgStream log(messageService(), name());
     unsigned int newEntries(0);
 #endif
     string line;
-    while (std::getline(ifile, line)) {
+    while (allOK && 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);
+      typedef boost::tokenizer<boost::char_separator<char> > Tokenizer;
+      Tokenizer tokens(line, boost::char_separator<char>(" "));
+      Tokenizer::iterator iToken(tokens.begin()), tEnd(tokens.end());
       long id(-1);       
-      try {
-	id = boost::lexical_cast<long>(line.substr(0,line.find(' ')));
-      } catch (boost::bad_lexical_cast e) {
-	readOK = false;
-      }
-      //      cout << "id " << id << endl;
-      if (readOK) {
-	string typeName(line.substr(line.find(' ') + 1, string::npos));
+      if (distance(iToken, tEnd) == 2  || distance(iToken, tEnd) == 3) {
+	try {
+	  id = boost::lexical_cast<long>(*iToken);	  
+	  //	  cout << "id " << id << endl;
+	} catch (boost::bad_lexical_cast e) { 
+	  log << MSG::ERROR << "processCLIDDB: Can't cast ["<< *iToken 
+	      << "] to long (clid)" << endmsg;
+	  allOK=false;
+	  break;
+	}
+	++iToken;
+	string typeName = *iToken++;
 	//	cout << "typeName " << typeName << endl;
-	Athena::PackageInfo info("CLIDDB-00-00-00"); //no package: got from file
-	if ((readOK = !typeName.empty())) {
+
+	Athena::PackageInfo info (( (iToken != tEnd) ?
+				    *iToken : "UNKNOWN-00-00-00") );
+	//	cout << "info " << info << endl;
+	if ((allOK = !typeName.empty())) {
 	  if (uncheckedSetTypePackageForID(id, typeName, info).isSuccess()) {
 #ifndef	 NDEBUG
 	    log << MSG::VERBOSE 
 #endif	
 	  }
 	}
-#ifndef	 NDEBUG
-#endif	
       }
-      allOK &= readOK;
     } //while records
     if (!allOK) {
       MsgStream log(messageService(), name());