Changeset 10899
- Timestamp:
- 06/01/11 15:27:21 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/dataLogger.cc
r10898 r10899 96 96 ///Run number record. Used to keep track of which run numbers are still active 97 97 struct RunNumberType { 98 #ifdef RUN_LOGS 98 99 ///the run number log file 99 ofstream* logFile; 100 shared_ptr<ofstream> logFile; 101 #endif 100 102 ///the run number report file 101 ofstream*reportFile;103 shared_ptr<ofstream> reportFile; 102 104 #ifdef HAVE_FITS 103 105 ///the run number group fits file 104 CCfits::FITS* runFitsFile; 105 #endif 106 shared_ptr<CCfits::FITS> runFitsFile; 107 #endif 108 #ifdef RUN_LOGS 106 109 ///the log filename 107 110 string logName; 111 #endif 108 112 ///the report filename 109 113 string reportName; … … 112 116 ///the time at which the run number was received 113 117 Time time; 114 ///internal counter used for smart referencing115 int* numCopies;116 118 ///list of opened fits used to create the fits grouping when the run ends 117 119 map<string, vector<string> > openedFits; … … 119 121 RunNumberType() 120 122 { 121 logFile = new ofstream(); 122 reportFile = new ofstream(); 123 #ifdef RUN_LOGS 124 logFile = shared_ptr<ofstream>(new ofstream()); 125 #endif 126 reportFile = shared_ptr<ofstream>(new ofstream()); 123 127 #ifdef HAVE_FITS 124 runFitsFile = NULL;128 runFitsFile = shared_ptr<CCfits::FITS>(); 125 129 #endif 126 130 runNumber = 0; 127 131 //give it a meaningless, 0 time to distinguish with actual, valid times 128 132 time = Time(0,0); 129 numCopies = new int(1);130 133 } 131 134 ///default destructor 132 135 ~RunNumberType() 133 136 { 134 if (numCopies) 135 { 136 (*numCopies)--; 137 if (*numCopies < 1) 138 { 139 if (logFile) 140 { 141 if (logFile->is_open()) 142 logFile->close(); 143 delete logFile; 144 logFile = NULL; 145 } 146 if (reportFile) 147 { 148 if (reportFile->is_open()) 149 reportFile->close(); 150 delete reportFile; 151 reportFile = NULL; 152 } 153 #ifdef HAVE_FITS 154 if (runFitsFile) 155 { 156 delete runFitsFile; 157 runFitsFile = NULL; 158 } 159 #endif 160 delete numCopies; 161 numCopies = NULL; 162 } 163 } 137 164 138 } 165 139 ///copy operator 166 140 void operator = (const RunNumberType& other) 167 141 { 142 #ifdef RUN_LOGS 168 143 logFile = other.logFile; 144 logName = other.logName; 145 #endif 169 146 reportFile = other.reportFile; 170 logName = other.logName;171 147 reportName = other.reportName; 172 148 runNumber = other.runNumber; 173 149 time = other.time; 174 numCopies = other.numCopies;175 150 #ifdef HAVE_FITS 176 151 runFitsFile = other.runFitsFile; 177 152 #endif 178 (*numCopies)++;179 153 } 180 154 ///copy constructor 181 155 RunNumberType(const RunNumberType& other) 182 156 { 157 #ifdef RUN_LOGS 183 158 logFile = other.logFile; 159 logName = other.logName; 160 #endif 184 161 reportFile = other.reportFile; 185 logName = other.logName;186 162 reportName = other.reportName; 187 163 runNumber = other.runNumber; 188 164 time = other.time; 189 numCopies = other.numCopies;190 165 #ifdef HAVE_FITS 191 166 runFitsFile = other.runFitsFile; 192 167 #endif 193 (*numCopies)++;194 168 } 195 169 … … 220 194 #endif 221 195 ///the actual dimInfo pointer 222 DimStampedInfo*dimInfo;196 shared_ptr<DimStampedInfo> dimInfo; 223 197 ///the server 224 198 string server; … … 226 200 string service; 227 201 ///the converter for outputting the data according to the format 228 Converter* fConv; 229 ///internal counter used for smart referencing 230 int* numCopies; 202 shared_ptr<Converter> fConv; 231 203 ///the current run number used by this subscription 232 204 uint32_t runNumber; … … 241 213 server = other.server; 242 214 service = other.service; 243 numCopies = other.numCopies;244 215 fConv = other.fConv; 245 216 runNumber = other.runNumber; 246 (*numCopies)++;247 217 } 248 218 ///copy constructor … … 256 226 server = other.server; 257 227 service = other.service; 258 numCopies = other.numCopies;259 228 fConv = other.fConv; 260 229 runNumber = other.runNumber; 261 (*numCopies)++;262 230 } 263 231 ///Dim info constructor 264 232 SubscriptionType(DimStampedInfo* info) 265 233 { 266 dimInfo = info;267 fConv = NULL;234 dimInfo = shared_ptr<DimStampedInfo>(info); 235 fConv = shared_ptr<Converter>(); 268 236 runNumber = 0; 269 numCopies = new int(1);270 237 } 271 238 ///default constructor 272 239 SubscriptionType() 273 240 { 274 dimInfo = NULL;275 fConv = NULL;241 dimInfo = shared_ptr<DimStampedInfo>(); 242 fConv = shared_ptr<Converter>(); 276 243 runNumber = 0; 277 numCopies = new int(1);278 244 } 279 245 ///default destructor 280 246 ~SubscriptionType() 281 247 { 282 if (numCopies)283 (*numCopies)--;284 if (numCopies)285 if (*numCopies < 1)286 {287 if (dimInfo)288 delete dimInfo;289 #ifdef HAVE_FITS290 if (nightlyFile.IsOpen())291 nightlyFile.Close();292 if (runFile.IsOpen())293 runFile.Close();294 #endif295 if (numCopies)296 delete numCopies;297 delete fConv;298 fConv = NULL;299 dimInfo = NULL;300 numCopies = NULL;301 }302 248 } 303 249 }; … … 473 419 ///retrieves the size of a file 474 420 off_t GetFileSize(string&); 421 ///Get the digits of year, month and day for filenames and paths 422 void GetYearMonthDayForFiles(unsigned short& year, unsigned short& month, unsigned short& day); 423 ///Appends the relevant year month day to a given path 424 void AppendYearMonthDaytoPath(string& path); 425 ///Form the base nightly path 426 void FormBaseNightlyPath(string& path); 427 ///Form the base run path 428 void FormBaseRunPath(string& path, const int runNumber); 475 429 ///Form the base (without extension) name of the nightly text files (logs and reports) 476 430 void FormBaseNightlyTextFileName(string& name); … … 501 455 ///Checks if the input osftream is in error state, and if so close it. 502 456 void CheckForOfstreamError(ofstream& out); 457 ///Checks if a given path exist 458 bool DoesPathExist(string path); 459 ///Create a given directory 460 bool CreateDirectory(string path); 503 461 /*************************************************** 504 462 * INHERITED FROM DIMSERVICEINFOLIST … … 514 472 // -------------------------------------------------------------------------- 515 473 // 474 //! Check if a given path exists 475 //! @param path the path to be checked 476 //! @return whether or not the creation has been successfull 477 // 478 bool DataLogger::CreateDirectory(string path) 479 { 480 mode_t rightsMask = S_IRWXU | S_IXGRP | S_IRGRP | S_IXOTH | S_IROTH; //everybody read, owner writes 481 482 int returnValue = mkdir(path.c_str(), rightsMask); 483 484 if (returnValue != 0) 485 { 486 ostringstream str; 487 str << "Could not create directory " << path << " mkdir error code: " << errno; 488 Error(str.str()); 489 return false; 490 } 491 492 return true; 493 } 494 // -------------------------------------------------------------------------- 495 // 496 //! Check if a given path exists 497 //! @param path the path to be checked 498 //! @return whether or not the given path exists 499 // 500 bool DataLogger::DoesPathExist(string path) 501 { 502 struct stat st; 503 if(stat(path.c_str(),&st) == 0) 504 return true; 505 506 return false; 507 } 508 // -------------------------------------------------------------------------- 509 // 516 510 //! Add a new service subscription 517 511 //! @param server the server for which the subscription should be created 518 512 //! @param service the service for which the subscription should be created 519 513 //! @param isCmd whether this is a Dim Command or not. Commands are not logged 520 //TODO maybe commands should indeed be logged ?521 514 // 522 515 void DataLogger::AddService(const string& server, const string& service, const string&, bool isCmd) … … 525 518 if (!ShouldSubscribe(server, service)) 526 519 return; 527 //dataLogger does not subscribe to commands 520 521 //dataLogger does not subscribe to commands 528 522 if (isCmd) 529 523 return; 530 //do we already have an entry for that server ? 531 SubscriptionsListType::iterator cSubs = fServiceSubscriptions.find(server); 532 if (cSubs != fServiceSubscriptions.end()) 533 {//server already here. check its services 534 if (cSubs->second.find(service) == cSubs->second.end()) 535 {//service not found. Add it 536 cSubs->second[service].dimInfo = SubscribeToPlease(server, service); 537 cSubs->second[service].server = server; 538 cSubs->second[service].service = service; 539 } 540 else 541 { 542 MessageImp::Error("Service " + server + "/" + service + " is already in the dataLogger's list. ignoring its update."); 543 return; 544 } 545 } 546 else 547 {//server not yet in our list. add it 548 fServiceSubscriptions[server] = map<string, SubscriptionType>(); 549 map<string, SubscriptionType>& liste = fServiceSubscriptions[server]; 550 liste[service].dimInfo = SubscribeToPlease(server, service); 551 liste[service].server = server; 552 liste[service].service = service; 553 } 524 525 map<string, SubscriptionType> &list = fServiceSubscriptions[server]; 526 527 if (list.find(service) != list.end()) 528 { 529 Error("Service " + server + "/" + service + " is already in the dataLogger's list. ignoring its update."); 530 return; 531 } 532 533 list[service].dimInfo = shared_ptr<DimStampedInfo>(SubscribeToPlease(server, service)); 534 list[service].server = server; 535 list[service].service = service; 536 554 537 if (fDebugIsOn) 555 {556 538 Debug("Added subscription to " + server + "/" + service); 557 }558 539 } 559 540 // -------------------------------------------------------------------------- … … 630 611 string DataLogger::CheckIfDirIsDot(const string& dir) 631 612 { 613 errno = 0; 632 614 if (dir == ".") 633 615 { … … 657 639 void DataLogger::OpenTextFilePlease(ofstream& stream, const string& name) 658 640 { 641 errno = 0; 659 642 stream.open(name.c_str(), ios_base::out | ios_base::app); 660 643 if (errno != 0) … … 714 697 sRun << runNumber; 715 698 fileName = sRun.str() + "_group.fits"; 716 fileNameWithPath = fRunFilePath + '/' + fileName; 699 string path; 700 FormBaseRunPath(path, runNumber); 701 fileNameWithPath = path + '/' + fileName; 717 702 } 718 703 … … 727 712 { 728 713 ostringstream groupName; 714 string path; 729 715 if (runNumber != 0) 730 716 { 731 groupName << fRunFilePath << '/' << runNumber << ".fits"; 717 FormBaseRunPath(path, runNumber); 718 groupName << path << '/' << runNumber << ".fits"; 732 719 } 733 720 else 734 721 { 735 Time time;736 722 ostringstream sTime; 737 sTime << time.Y() << "_" << time.M() << "_" << time.D(); 738 groupName << fNightlyFilePath << '/' << sTime.str() << ".fits"; 723 unsigned short year, month, day; 724 GetYearMonthDayForFiles(year, month, day); 725 sTime << year << "_" << month << "_" << day; 726 FormBaseNightlyPath(path); 727 728 groupName << path << '/' << sTime.str() << ".fits"; 739 729 } 740 730 fileNameWithPath = groupName.str(); … … 750 740 void DataLogger::FormNightlyFitsFileName(string& fileName, string& fileNameWithPath, const string& serviceName) 751 741 { 752 Time time;753 742 ostringstream sTime; 754 sTime << time.Y() << "_" << time.M() << "_" << time.D(); 743 unsigned short year, month, day; 744 GetYearMonthDayForFiles(year, month, day); 745 sTime << year << "_" << month << "_" << day; 755 746 fileName = sTime.str() + '_' + serviceName + ".fits"; 756 fileNameWithPath = fNightlyFilePath + '/' + fileName; 747 string path; 748 FormBaseNightlyPath(path); 749 fileNameWithPath = path + '/' + fileName; 757 750 } 758 751 // -------------------------------------------------------------------------- … … 769 762 sRun << runNumber; 770 763 fileName = sRun.str() + '_' + serviceName + ".fits"; 771 fileNameWithPath = fRunFilePath + '/' + fileName; 764 string path; 765 FormBaseRunPath(path, runNumber); 766 fileNameWithPath = path + '/' + fileName; 772 767 } 773 768 // -------------------------------------------------------------------------- … … 781 776 ostringstream sRun; 782 777 sRun << runNumber; 783 784 name = CheckIfDirIsDot(fRunFilePath) + '/' + sRun.str(); 778 string path; 779 FormBaseRunPath(path, runNumber); 780 name = path + '/' + sRun.str(); 785 781 } 786 782 // -------------------------------------------------------------------------- … … 807 803 void DataLogger::FormBaseNightlyTextFileName(string& name) 808 804 { 809 Time time;810 805 ostringstream sTime; 811 sTime << time.Y() << "_" << time.M() << "_" << time.D(); 812 813 name = CheckIfDirIsDot(fNightlyFilePath) + '/' + sTime.str(); 806 unsigned short year, month, day; 807 GetYearMonthDayForFiles(year, month, day); 808 sTime << year << "_" << month << "_" << day; 809 810 FormBaseNightlyPath(name); 811 812 name += '/' + sTime.str(); 814 813 } 815 814 // -------------------------------------------------------------------------- … … 830 829 // -------------------------------------------------------------------------- 831 830 // 831 //!Fills in the correct values for naming files based on current date. 832 //! It fills in the same values throughout a whole night for consistency 833 //! @param year the year to be used for file names 834 //! @param month the month to be used for file names 835 //! @param day the day to be used for file names 836 // 837 void DataLogger::GetYearMonthDayForFiles(unsigned short& year, unsigned short& month, unsigned short& day) 838 { 839 Time time; 840 year = time.Y(); 841 month = time.M(); 842 day = time.D(); 843 bool shouldGoBackOneDay = false; 844 if (time.h() < 12) //we are currently before noon. go back one day 845 shouldGoBackOneDay = true; 846 847 if (shouldGoBackOneDay && (month == 1) && (day == 1)) 848 year--; 849 850 if (shouldGoBackOneDay && (day == 1)) 851 { 852 if (month != 1) 853 month--; 854 else 855 month = 12; 856 } 857 858 if (shouldGoBackOneDay) 859 { 860 if (day != 1) 861 day--; 862 else 863 switch (month) 864 { 865 case 1: 866 case 3: 867 case 5: 868 case 7: 869 case 8: 870 case 10: 871 case 12: 872 day = 31; 873 break; 874 case 4: 875 case 6: 876 case 9: 877 case 11: 878 day = 30; 879 break; 880 case 2: 881 if (year == 2012 || year == 2016 || year == 2020 || year == 2024 || year == 2028 || year == 2032 || year == 2036 || year == 2040) 882 day = 29; 883 else 884 day = 28; 885 break; 886 }; 887 } 888 889 890 } 891 // -------------------------------------------------------------------------- 892 // 893 //! Appends the appropriate year, month and day to a given path. 894 //! creates the required directories if they do not already exist 895 //! @param path the path to be augmented 896 // 897 void DataLogger::AppendYearMonthDaytoPath(string& path) 898 { 899 ostringstream basePath; 900 unsigned short year, month, day; 901 GetYearMonthDayForFiles(year, month, day); 902 903 basePath << CheckIfDirIsDot(path) << '/' << year; 904 if (!DoesPathExist(basePath.str())) 905 CreateDirectory(basePath.str()); 906 907 basePath << '/' << month; 908 if (!DoesPathExist(basePath.str())) 909 CreateDirectory(basePath.str()); 910 911 basePath << '/' << day; 912 if (!DoesPathExist(basePath.str())) 913 CreateDirectory(basePath.str()); 914 915 path = basePath.str(); 916 } 917 // -------------------------------------------------------------------------- 918 // 919 //! Forms the base path for putting nightly files in it 920 //! @param the variable that should receive the path 921 // 922 void DataLogger::FormBaseNightlyPath(string& path) 923 { 924 path = fNightlyFilePath; 925 AppendYearMonthDaytoPath(path); 926 } 927 // -------------------------------------------------------------------------- 928 // 929 //! Forms the base path for putting run files in it 930 //! @param the variable that should receive the path 931 //! @runNumber the run number for which to create the path 932 // 933 void DataLogger::FormBaseRunPath(string& path, const int runNumber) 934 { 935 path = fRunFilePath; 936 AppendYearMonthDaytoPath(path); 937 938 ostringstream basePath; 939 basePath << path << '/' << runNumber; 940 if (!DoesPathExist(basePath.str())) 941 CreateDirectory(basePath.str()); 942 943 path = basePath.str(); 944 } 945 // -------------------------------------------------------------------------- 946 // 832 947 //!retrieves the size on disk of a file 833 948 //! @param fileName the full file name for which the size on disk should be retrieved … … 836 951 off_t DataLogger::GetFileSize(string& fileName) 837 952 { 953 errno = 0; 838 954 struct stat st; 839 955 if (!stat(fileName.c_str(), &st)) … … 935 1051 if (it->reportFile->is_open()) 936 1052 fFileSizesMap[it->reportName] = GetFileSize(it->reportName); 1053 #ifdef RUN_LOGS 937 1054 if (it->logFile->is_open()) 938 1055 fFileSizesMap[it->logName] = GetFileSize(it->logName); 1056 #endif 939 1057 } 940 1058 struct statvfs vfs; … … 1222 1340 {//find current service is subscriptions 1223 1341 for (y=x->second.begin(); y!=x->second.end();y++) 1224 if ( y->second.dimInfo== I)1342 if ((y->second.dimInfo).get() == I) 1225 1343 { 1226 1344 found = true; … … 1256 1374 int DataLogger::OpenRunFile(RunNumberType& run) 1257 1375 { 1376 #ifdef RUN_LOGS 1258 1377 if (run.logFile->is_open()) 1259 1378 { … … 1264 1383 } 1265 1384 FormRunTextFileName(run.logName, false, run.runNumber); 1385 errno = 0; 1266 1386 run.logFile->open(run.logName.c_str(), ios_base::out | ios_base::app); 1267 1387 if (errno != 0) … … 1271 1391 Error(str); 1272 1392 } 1393 #endif 1273 1394 //open report file 1274 1395 FormRunTextFileName(run.reportName, true, run.runNumber); … … 1280 1401 return -1; 1281 1402 } 1403 errno = 0; 1282 1404 run.reportFile->open(run.reportName.c_str(), ios_base::out | ios_base::app); 1283 1405 if (errno != 0) … … 1288 1410 } 1289 1411 1412 #ifdef RUN_LOGS 1290 1413 if (!run.logFile->is_open() || !run.reportFile->is_open()) 1414 #else 1415 if (!run.reportFile->is_open()) 1416 #endif 1291 1417 { 1292 1418 ostringstream str; 1293 str << "Something went wrong while openning nightly files " << run.logName << " and " << run.reportName; 1419 str << "Something went wrong while openning files "; 1420 #ifdef RUN_LOGS 1421 str << run.logName << " and "; 1422 #endif 1423 str << run.reportName; 1294 1424 Error(str); 1295 1425 return -1; 1296 1426 } 1297 1427 //get the size of the newly opened file. 1428 #ifdef RUN_LOGS 1298 1429 RememberFileOrigSizePlease(run.logName, false); 1430 #endif 1299 1431 RememberFileOrigSizePlease(run.reportName, false); 1300 1432 … … 1382 1514 if (fakeFormat[fakeFormat.size()-1] == 'C') 1383 1515 fakeFormat = fakeFormat.substr(0, fakeFormat.size()-1); 1384 sub.fConv = new Converter(Out(), I->getFormat());1516 sub.fConv = shared_ptr<Converter>(new Converter(Out(), I->getFormat())); 1385 1517 if (!sub.fConv) 1386 1518 { … … 1410 1542 cRunNumber = &(*rit); 1411 1543 sub.runNumber = rit->runNumber; 1412 targetRunFile = isItaReport ? rit->reportFile : rit->logFile; 1544 #ifdef RUN_LOGS 1545 targetRunFile = isItaReport ? (rit->reportFile).get() : (rit->logFile).get(); 1546 #else 1547 targetRunFile = isItaReport ? (rit->reportFile).get() : NULL; 1548 #endif 1413 1549 break; 1414 1550 } … … 1536 1672 if (fNightlyLogFile.is_open()) 1537 1673 Message("Nightly log-file: "/*+filename+*/" (OPEN)"); 1538 else 1539 Message("Nightly log-file: "/*filename+*/" (CLOSED)"); 1674 1540 1675 if (fNightlyReportFile.is_open()) 1541 1676 Message("Nightly report-file: "/*filename+*/" (OPEN)"); 1542 else 1543 Message("Nightly report-file: "/*filename+*/" (CLOSED)"); 1677 1544 1678 for (list<RunNumberType>::iterator it=fRunNumber.begin(); it!=fRunNumber.end(); it++) 1545 1679 { 1680 #ifdef RUN_LOGS 1546 1681 if (it->logFile->is_open()) 1547 1682 Message("Run log-file: " + it->logName + " (OPEN)"); 1548 else 1549 Message("Run log-file: " + it->logName + " (CLOSED)"); 1683 #endif 1550 1684 if (it->reportFile->is_open()) 1551 1685 Message("Run report-file: " + it->reportName + " (OPEN)"); 1552 else1553 Message("Run report-file: " + it->reportName + " (CLOSED)");1554 1686 } 1555 1687 … … 1728 1860 if (evt.GetText() != NULL) 1729 1861 { 1730 fNightlyFilePath = string(evt.GetText()); 1862 string givenPath = string(evt.GetText()); 1863 if (!DoesPathExist(givenPath)) 1864 { 1865 Error("Given Nightly folder \"" + givenPath + "\" does not exist. Please specify a valid path"); 1866 return GetCurrentState(); 1867 } 1868 fNightlyFilePath = givenPath; 1731 1869 Message("New Nightly folder specified: " + fNightlyFilePath); 1732 1870 } … … 1747 1885 if (evt.GetText() != NULL) 1748 1886 { 1749 fRunFilePath = string(evt.GetText()); 1887 string givenPath = string(evt.GetText()); 1888 if (!DoesPathExist(givenPath)) 1889 { 1890 Error("Given Run folder \"" + givenPath + "\" does not exist. Please specify a valid path"); 1891 return GetCurrentState(); 1892 } 1893 fRunFilePath = givenPath; 1750 1894 Message("New Run folder specified: " + fRunFilePath); 1751 1895 } … … 1933 2077 try 1934 2078 { 1935 cRunNumber->runFitsFile = new CCfits::FITS(partialName, CCfits::RWmode::Write);2079 cRunNumber->runFitsFile = shared_ptr<CCfits::FITS>(new CCfits::FITS(partialName, CCfits::RWmode::Write)); 1936 2080 (fNumSubAndFitsData.numOpenFits)++; 1937 2081 } … … 1941 2085 str << "Could not open FITS Run file " << partialName << " reason: " << e.message(); 1942 2086 Error(str); 1943 cRunNumber->runFitsFile = NULL;2087 cRunNumber->runFitsFile = shared_ptr<CCfits::FITS>();//NULL; 1944 2088 } 1945 2089 … … 1948 2092 NotifyOpenedFile(baseFileName, 7, fOpenedRunFiles);// + '_' + serviceName, 4); 1949 2093 if (hasGrouping) 1950 sub.runFile.Open(partialName, serviceName, cRunNumber->runFitsFile, &fNumSubAndFitsData.numOpenFits, this, sub.runNumber);//Out());2094 sub.runFile.Open(partialName, serviceName, (cRunNumber->runFitsFile).get(), &fNumSubAndFitsData.numOpenFits, this, sub.runNumber);//Out()); 1951 2095 else 1952 2096 sub.runFile.Open(partialName, serviceName, NULL, &fNumSubAndFitsData.numOpenFits, this, sub.runNumber);//Out()); … … 2051 2195 if (sub.nightlyFile.IsOpen()) 2052 2196 { 2053 sub.nightlyFile.Write(sub.fConv );2197 sub.nightlyFile.Write(sub.fConv.get()); 2054 2198 if (fDebugIsOn) 2055 2199 { … … 2059 2203 if (sub.runFile.IsOpen()) 2060 2204 { 2061 sub.runFile.Write(sub.fConv );2205 sub.runFile.Write(sub.fConv.get()); 2062 2206 if (fDebugIsOn) 2063 2207 { … … 2163 2307 const unsigned int n = 8 + 3 + 2*maxCharLength + 1; //+1 for trailling character 2164 2308 2165 unsigned char* fitsBuffer = new unsigned char[n]; 2309 vector<unsigned char> realBuffer; 2310 realBuffer.resize(n); 2311 unsigned char* fitsBuffer = &realBuffer[0]; 2166 2312 memset(fitsBuffer, 0, n); 2167 2313 … … 2218 2364 for (list<RunNumberType>::iterator it=fRunNumber.begin(); it != fRunNumber.end(); it++) 2219 2365 { 2366 #ifdef RUN_LOGS 2220 2367 if (!it->logFile->is_open() || !it->reportFile->is_open()) 2368 #else 2369 if (!it->reportFile->is_open()) 2370 #endif 2221 2371 return kSM_FatalError; 2372 #ifdef RUN_LOGS 2222 2373 it->logFile->close(); 2374 #endif 2223 2375 it->reportFile->close(); 2224 2376 }
Note:
See TracChangeset
for help on using the changeset viewer.