Changeset 229 for drsdaq


Ignore:
Timestamp:
06/24/10 07:51:15 (15 years ago)
Author:
ogrimm
Message:
Config requests non-blocking if not made from main thread, adapted all servers to GetConfig() returning std::string, workaround for erroneous SERVICE_LIST
Location:
drsdaq
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • drsdaq/DAQReadout.cc

    r226 r229  
    9090  MinDelay                      = 1;
    9191
    92   // Get configuration data
    93   fRawDataPath = GetConfig("RawDataPath");
    94   fCalibDataPath = GetConfig("CalibDataPath");
    95   fFirstSample = atoi(GetConfig("FirstSample"));
    96   fSamples = atoi(GetConfig("Samples"));
    97   fMinDiskSpaceMB = atoi(GetConfig("MinDiskSpaceMB"));
    98   fMaxFileSizeMB = atoi(GetConfig("MaxFileSizeMB"));
    99   fDefaultFrequency = atof(GetConfig("DefaultFrequency"));
     92  // Get configuration data (static needed for c_str() pointers to remain valid after constructor finished)
     93  static std::string _RawDataPath = GetConfig("RawDataPath");
     94  static std::string _CalibDataPath = GetConfig("CalibDataPath");
     95  fRawDataPath = _RawDataPath.c_str();
     96  fCalibDataPath = _CalibDataPath.c_str();
     97  fFirstSample = atoi(GetConfig("FirstSample").c_str());
     98  fSamples = atoi(GetConfig("Samples").c_str());
     99  fMinDiskSpaceMB = atoi(GetConfig("MinDiskSpaceMB").c_str());
     100  fMaxFileSizeMB = atoi(GetConfig("MaxFileSizeMB").c_str());
     101  fDefaultFrequency = atof(GetConfig("DefaultFrequency").c_str());
    100102
    101103  if (fFirstSample < 0 || fFirstSample > kNumberOfBins || fSamples > kNumberOfBins) {
     
    14171419
    14181420// Return current available storage space in given directory
    1419 int CheckDisk(char *Directory) {
     1421int CheckDisk(const char *Directory) {
    14201422  struct statfs FileSystemStats;
    14211423
  • drsdaq/DAQReadout.h

    r226 r229  
    5252
    5353    // Configuration data
    54     char *fCalibDataPath;
    55     char *fRawDataPath;
     54    const char *fCalibDataPath;
     55    const char *fRawDataPath;
    5656    int fMinDiskSpaceMB;   // Minimum required disk space in MBytes
    5757    int fMaxFileSizeMB;    // Maximum File size in Bytes
     
    145145bool Match(const char*, const char*);
    146146int ParseInput(char*, const char *Param[]);
    147 int CheckDisk(char*);
     147int CheckDisk(const char*);
    148148
    149149#endif
  • drsdaq/HVFeedback.cc

    r226 r229  
    2222};
    2323
     24using namespace std;
     25
    2426//
    2527// Constructor: Initialise feedback
     
    4547
    4648  // Get configuration data
    47   fLedTrigBoard = atoi(m->GetConfig("TrigBoard"));
    48   fLedTrigChannel = atoi(m->GetConfig("TrigChannel"));
    49   fLedTrigChip = atoi(m->GetConfig("TrigChip"));
    50   fLedTrigSample = atoi(m->GetConfig("TrigSample"));
    51   fLedTrigThreshold = atoi(m->GetConfig("TrigThreshold"));
    52   fLedSignalSample = atoi(m->GetConfig("SignalSample"));
    53   fLedBaselineSample = atoi(m->GetConfig("BaselineSample"));
    54   fIntHalfWidth = atoi(m->GetConfig("IntHalfWidth"));
    55   fDefaultNumAverage = atoi(m->GetConfig("DefaultNumAverage"));
    56 
    57   char *Token = strtok(m->GetConfig("DefaultResponse"), " \t");
     49  fLedTrigBoard = atoi(m->GetConfig("TrigBoard").c_str());
     50  fLedTrigChannel = atoi(m->GetConfig("TrigChannel").c_str());
     51  fLedTrigChip = atoi(m->GetConfig("TrigChip").c_str());
     52  fLedTrigSample = atoi(m->GetConfig("TrigSample").c_str());
     53  fLedTrigThreshold = atoi(m->GetConfig("TrigThreshold").c_str());
     54  fLedSignalSample = atoi(m->GetConfig("SignalSample").c_str());
     55  fLedBaselineSample = atoi(m->GetConfig("BaselineSample").c_str());
     56  fIntHalfWidth = atoi(m->GetConfig("IntHalfWidth").c_str());
     57  fDefaultNumAverage = atoi(m->GetConfig("DefaultNumAverage").c_str());
     58
     59  vector<string> Token = m->Tokenize(m->GetConfig("DefaultResponse"), " \t");
     60  unsigned int N = 0;
    5861  for (int i=0; i<m->NumBoards; i++) {
    5962        for (int j=0; j<fNumberOfChips; j++) {
    6063          for (int k=0; k<fNumberOfChannels; k++) {
    61                 if (Token == NULL) break;
    62         Response[i][j][k] = (float) atof(Token);
    63                 Token = strtok(NULL, " \t");
     64                if (N < Token.size()) Response[i][j][k] = (float) atof(Token[N++].c_str());
    6465          }
    6566        }
    6667  }
    6768
    68   Token = strtok(m->GetConfig("DefaultTarget"), " \t");
     69  Token = m->Tokenize(m->GetConfig("DefaultTarget"), " \t");
     70  N = 0;
    6971  for (int i=0; i<m->NumBoards; i++) {
    7072        for (int j=0; j<fNumberOfChips; j++) {
    7173          for (int k=0; k<fNumberOfChannels; k++) {
    72                 if (Token == NULL) break;
    73         Target[i][j][k] = (float) atof(Token);
    74                 Token = strtok(NULL, " \t");
     74                if (N < Token.size()) Target[i][j][k] = (float) atof(Token[N++].c_str());
    7575          }
    7676        }
     
    8787
    8888  // Initial state
    89   Gain = atof(m->GetConfig("DefaultGain"));
     89  Gain = atof(m->GetConfig("DefaultGain").c_str());
    9090  SetFBMode(FB_Off);
    9191  SetNumAverages(fDefaultNumAverage);
  • drsdaq/HVFeedback.h

    r226 r229  
    77#include <math.h>
    88#include <sstream>
     9#include <vector>
    910
    1011#include "RawDataCTX.h"
Note: See TracChangeset for help on using the changeset viewer.