Changeset 10930


Ignore:
Timestamp:
Jun 8, 2011, 6:04:28 PM (9 years ago)
Author:
tbretz
Message:
Moved Time argument as last and default argument in CompileFileName; some little changes to some output
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/dataLogger.cc

    r10927 r10930  
    423423    void AppendYearMonthDaytoPath(string& path);
    424424    ///Form the files path
    425     string CompileFileName(const string &path, const Time &time, const string &service, const string & extension);
     425    string CompileFileName(const string &path, const string &service, const string & extension, const Time &time=Time());
    426426    ///Form the files path
    427     string CompileFileName(const string &path, const Time &time, uint32_t run, const string &service, const string & extension);
     427    string CompileFileName(const string &path, uint32_t run, const string &service, const string & extension, const Time &time=Time());
    428428    ///Check whether service is in black and/or white list
    429429    bool ShouldSubscribe(const string& server, const string& service);
     
    690690//! @param extension the extension to add, if any
    691691//
    692 string DataLogger::CompileFileName(const string &path, const Time &time, const string &service, const string & extension)
     692string DataLogger::CompileFileName(const string &path, const string &service, const string & extension, const Time &time)
    693693{
    694694       ostringstream str;
     
    725725//! @param extension the extension to add, if any
    726726//
    727 string DataLogger::CompileFileName(const string &path, const Time &time, uint32_t run, const string &service, const string & extension)
     727string DataLogger::CompileFileName(const string &path, uint32_t run, const string &service, const string & extension, const Time &time)
    728728{
    729729       ostringstream str;
     
    12151215        return -1;
    12161216    }
    1217     run.logName = CompileFileName(fRunFilePath, Time(), run.runNumber, "", "log");
     1217    run.logName = CompileFileName(fRunFilePath, run.runNumber, "", "log");
    12181218    errno = 0;
    12191219    run.logFile->open(run.logName.c_str(), ios_base::out | ios_base::app);
     
    12261226#endif
    12271227    //open report file
    1228     run.reportName = CompileFileName(fRunFilePath, Time(), run.runNumber, "", "rep");
     1228    run.reportName = CompileFileName(fRunFilePath, run.runNumber, "", "rep");
    12291229    if (run.reportFile->is_open())
    12301230    {
     
    12651265
    12661266    //TODO this notification scheme might be messed up now.... fix it !
    1267     string baseFileName = CompileFileName(fRunFilePath, Time(), run.runNumber, "", "");
     1267    string baseFileName = CompileFileName(fRunFilePath, run.runNumber, "", "");
    12681268    NotifyOpenedFile(baseFileName, 3, fOpenedRunFiles);
    12691269    run.openedFits.clear();
     
    13571357    //construct the header
    13581358    ostringstream header;
    1359     Time cTime(I->getTimestamp(), I->getTimestampMillisecs()*1000);
     1359    const Time cTime(I->getTimestamp(), I->getTimestampMillisecs()*1000);
    13601360    fQuality = I->getQuality();
    13611361    fMjD = cTime.Mjd();
     
    13941394                Error(str);
    13951395            }
     1396
    13961397        }
    13971398    }
     
    14951496    //print active run numbers
    14961497    ostringstream str;
    1497     str << "Active Run Numbers: ";
     1498    str << "Active Run Numbers:";
    14981499    for (list<RunNumberType>::iterator it=fRunNumber.begin(); it!=fRunNumber.end(); it++)
    1499         str << "\n" << it->runNumber;
     1500        str << " " << it->runNumber;
     1501    if (fRunNumber.size()==0)
     1502        str << " <none>";
    15001503    Message(str);
    15011504
     
    15031506    Message("------------ OPENED FILES ----------------");
    15041507    if (fNightlyLogFile.is_open())
    1505         Message("Nightly log-file: "/*+filename+*/" (OPEN)");
     1508        Message("Nightly log-file: OPEN");
    15061509
    15071510    if (fNightlyReportFile.is_open())
    1508         Message("Nightly report-file: "/*filename+*/" (OPEN)");
     1511        Message("Nightly report-file: OPEN");
    15091512
    15101513    for (list<RunNumberType>::iterator it=fRunNumber.begin(); it!=fRunNumber.end(); it++)
     
    17581761        {
    17591762            ostringstream str;
    1760             str << "Updating files service " << service->getName() << "with code: " << type << " and file: " << name;
     1763            str << "Updating " << service->getName() << " file '" << name << "' (type=" << type << ")";
    17611764            Debug(str);
    17621765            str.str("");
     
    17891792        Debug("Starting...");   
    17901793    }
    1791     fFullNightlyLogFileName = CompileFileName(fNightlyFilePath, Time(), "", "log");
     1794    fFullNightlyLogFileName = CompileFileName(fNightlyFilePath, "", "log");
    17921795    OpenTextFilePlease(fNightlyLogFile, fFullNightlyLogFileName);
    17931796
    1794     fFullNightlyReportFileName = CompileFileName(fNightlyFilePath, Time(), "", "rep");
     1797    fFullNightlyReportFileName = CompileFileName(fNightlyFilePath, "", "rep");
    17951798    OpenTextFilePlease(fNightlyReportFile, fFullNightlyReportFileName);
    17961799
     
    18101813
    18111814    //notify that a new file has been opened.
    1812     string baseFileName = CompileFileName(fNightlyFilePath, Time(), "", "");
     1815    string baseFileName = CompileFileName(fNightlyFilePath, "", "");
    18131816    NotifyOpenedFile(baseFileName, 3, fOpenedNightlyFiles);
    18141817
     
    18601863    {
    18611864        string fileNameOnly, partialName;
    1862         partialName = CompileFileName(fNightlyFilePath, Time(), serviceName, "fits");
     1865        partialName = CompileFileName(fNightlyFilePath, serviceName, "fits");
    18631866        fileNameOnly = partialName.substr(partialName.find_last_of('/')+1, partialName.size());
    18641867        AllocateFITSBuffers(sub);
     
    18701873
    18711874        //notify the opening
    1872         string baseFileName = CompileFileName(fNightlyFilePath, Time(), "", "");
     1875        string baseFileName = CompileFileName(fNightlyFilePath, "", "");
    18731876        NotifyOpenedFile(baseFileName, 7, fOpenedNightlyFiles);
    18741877        if (fNumSubAndFitsIsOn)
     
    18771880        {
    18781881            ostringstream str;
    1879             str << "Opened Nightly FITS: " << partialName << " and table: FACT-" << serviceName << ".current number of opened FITS: " << fNumSubAndFitsData.numOpenFits;
     1882            str << "Opened Nightly FITS: " << partialName << " and table: " << serviceName << ".current number of opened FITS: " << fNumSubAndFitsData.numOpenFits;
    18801883            Debug(str);
    18811884        }
     
    18881891        if (hasGrouping)
    18891892        {
    1890             partialName = CompileFileName(fRunFilePath, Time(), sub.runNumber, "group", "fits");
     1893            partialName = CompileFileName(fRunFilePath, sub.runNumber, "group", "fits");
    18911894            fileNameOnly = partialName.substr(partialName.find_last_of('/')+1, partialName.size());
    18921895        }
    18931896        else
    18941897        {
    1895             partialName = CompileFileName(fRunFilePath, Time(), sub.runNumber, serviceName, "fits");
     1898            partialName = CompileFileName(fRunFilePath, sub.runNumber, serviceName, "fits");
    18961899            fileNameOnly = partialName.substr(partialName.find_last_of('/')+1, partialName.size());
    18971900        }
     
    19191922            }
    19201923
    1921         string baseFileName = CompileFileName(fRunFilePath, Time(), sub.runNumber, "", "");
     1924        string baseFileName = CompileFileName(fRunFilePath, sub.runNumber, "", "");
    19221925        NotifyOpenedFile(baseFileName, 7, fOpenedRunFiles);// + '_' + serviceName, 4);
    19231926        if (hasGrouping)
     
    19311934        {
    19321935            ostringstream str;
    1933             str << "Opened Run FITS: " << partialName << " and table: FACT-" << serviceName << ".current number of opened FITS: " << fNumSubAndFitsData.numOpenFits;
     1936            str << "Opened Run FITS: " << partialName << " and table: " << serviceName << ".current number of opened FITS: " << fNumSubAndFitsData.numOpenFits;
    19341937            Debug(str);
    19351938        }
     
    21012104    string groupName;
    21022105    if (runNumber != 0)
    2103         groupName = CompileFileName(fRunFilePath, Time(), runNumber, "", "fits");
     2106        groupName = CompileFileName(fRunFilePath, runNumber, "", "fits");
    21042107    else
    2105         groupName = CompileFileName(fNightlyFilePath, Time(), "", "fits");
     2108        groupName = CompileFileName(fNightlyFilePath, "", "fits");
    21062109
    21072110    CCfits::Table* groupTable;
Note: See TracChangeset for help on using the changeset viewer.