Changeset 229 for drsdaq/HVFeedback.cc


Ignore:
Timestamp:
06/24/10 07:51:15 (14 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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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);
Note: See TracChangeset for help on using the changeset viewer.