Changeset 11719


Ignore:
Timestamp:
07/30/11 16:12:38 (14 years ago)
Author:
tbretz
Message:
Adapted to the changed in FitsFile; encapsulated fServiceSubscriptions.clear() in the destructor by a dim_lock/unlock. This is not a final solution, but currently the best one.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/FACT++/src/datalogger.cc

    r11621 r11719  
    964964//    dim_lock();
    965965
    966      //now clear the services subscriptions
     966    //now clear the services subscriptions
     967    dim_lock();
    967968    fServiceSubscriptions.clear();
     969    dim_unlock();
    968970
    969971    //clear any remaining run number (should remain only one)
     
    18051807     {
    18061808         sub.runFile.Close();
    1807          Info("Closed: "+sub.runFile.fFileName+" (new run number)");
     1809         Info("Closed: "+sub.runFile.GetName()+" (new run number)");
    18081810     }
    18091811
     
    18411843            fOpenedNightlyFits[fileNameOnly].push_back(serviceName);
    18421844
    1843         if (!sub.nightlyFile.Open(partialName, serviceName, NULL, &fNumSubAndFitsData.numOpenFits, this, 0))
     1845        if (!sub.nightlyFile.Open(partialName, serviceName, &fNumSubAndFitsData.numOpenFits, this, 0))
    18441846        {
    18451847            GoToRunWriteErrorState();
     
    18651867        {
    18661868            partialName = CompileFileNameWithPath(fRunFilePath, sub.runNumber, "", "fits");
    1867             fileNameOnly = partialName.substr(partialName.find_last_of('/')+1, partialName.size());
    18681869        }
    18691870        else
    18701871        {
    18711872            partialName = CompileFileNameWithPath(fRunFilePath, sub.runNumber, serviceName, "fits");
    1872             fileNameOnly = partialName.substr(partialName.find_last_of('/')+1, partialName.size());
    1873         }
     1873        }
     1874
     1875        fileNameOnly = partialName.substr(partialName.find_last_of('/')+1, partialName.size());
     1876
    18741877        //get the size of the file we're about to open
    18751878        if (fFilesStats.FileOpened(partialName))
     
    19021905        if (hasGrouping)
    19031906        {
    1904             if (!sub.runFile.Open(partialName, serviceName, (cRunNumber->runFitsFile).get(), &fNumSubAndFitsData.numOpenFits, this, sub.runNumber))
     1907            if (!sub.runFile.Open(partialName, serviceName, &fNumSubAndFitsData.numOpenFits, this, sub.runNumber, cRunNumber->runFitsFile.get()))
    19051908            {
    19061909                GoToRunWriteErrorState();
     
    19101913        else
    19111914        {
    1912             if (!sub.runFile.Open(partialName, serviceName, NULL, &fNumSubAndFitsData.numOpenFits, this, sub.runNumber))
     1915            if (!sub.runFile.Open(partialName, serviceName, &fNumSubAndFitsData.numOpenFits, this, sub.runNumber))
    19131916            {
    19141917                GoToRunWriteErrorState();
     
    19411944    sub.runFile.AddStandardColumn(QoSDesc, "1J", &fQuality, sizeof(int));
    19421945
    1943     const Converter::FormatList flist = sub.fConv->GetList();
    19441946    // Compilation failed
    19451947    if (!sub.fConv->valid())
     
    19511953    //we've got a nice structure describing the format of this service's messages.
    19521954    //Let's create the appropriate FITS columns
    1953     int size = 0;
    1954 
    1955     vector<string> dataFormatsLocal;
    1956     for (unsigned int i=0;i<flist.size()-1;i++)
    1957     {
    1958          ostringstream dataQualifier;
    1959 
    1960          dataQualifier << flist[i].second.first;
    1961          switch (flist[i].first.first->name()[0])
    1962          {
    1963          case 'c': dataQualifier << 'B'; break;
    1964          case 's': dataQualifier << 'I'; break;
    1965          case 'i': dataQualifier << 'J'; break;
    1966          case 'l': dataQualifier << 'J'; break;
    1967          case 'f': dataQualifier << 'E'; break;
    1968          case 'd': dataQualifier << 'D'; break;
    1969          case 'x': dataQualifier << 'K'; break;
    1970          case 'S': //we skip the variable length strings
    1971              continue;
    1972 
    1973          default:
    1974              Fatal("THIS SHOULD NEVER BE REACHED.");
    1975          };
    1976 
    1977          size += flist[i].first.second * flist[i].second.first;
    1978          dataFormatsLocal.push_back(dataQualifier.str());
    1979      }
    1980      sub.nightlyFile.InitDataColumns(GetDescription(sub.server, sub.service), dataFormatsLocal, sub.dimInfo->getData(), size);
    1981      sub.runFile.InitDataColumns(GetDescription(sub.server, sub.service), dataFormatsLocal, sub.dimInfo->getData(), size);
    1982      sub.fitsBufferAllocated = true;
     1955    const vector<string> dataFormatsLocal = sub.fConv->GetFitsFormat();
     1956
     1957    sub.nightlyFile.InitDataColumns(GetDescription(sub.server, sub.service), dataFormatsLocal, sub.dimInfo->getData());
     1958    sub.runFile.InitDataColumns(GetDescription(sub.server, sub.service), dataFormatsLocal, sub.dimInfo->getData());
     1959    sub.fitsBufferAllocated = true;
    19831960}
    19841961// --------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.