Esempio n. 1
0
ProgramComponent* CommandParser::ParseCycle(char* pBuffer) {
  char countBuf[5];
	
  //find first step
  char* pStep = strchr(pBuffer, '[');
	
  //get cycle count
  int countLen = pStep - pBuffer;
  strncpy(countBuf, pBuffer, countLen);
  countBuf[countLen] = '\0';
  int cycCount = atoi(countBuf);
  
  Cycle* pCycle = gpThermocycler->GetCyclePool().AllocateComponent();
  pCycle->SetNumCycles(cycCount);
	
  //add steps
  while (pStep != NULL) {
    *pStep++ = '\0';
    char* pStepEnd = strchr(pStep, ']');
    *pStepEnd++ = '\0';

    Step* pNewStep = ParseStep(pStep);
    pCycle->AddComponent(pNewStep);
    pStep = strchr(pStepEnd, '[');
  }

  return pCycle;
}
Esempio n. 2
0
Cycle* CommandParser::ParseProgram(char* pBuffer) {
  Cycle* pProgram = gpThermocycler->GetCyclePool().AllocateComponent();
  pProgram->SetNumCycles(1);
	
  char* pCycBuf = strtok(pBuffer, "()");
  while (pCycBuf != NULL) {
    pProgram->AddComponent(ParseCycle(pCycBuf));
    pCycBuf = strtok(NULL, "()");
  }
  
  return pProgram;
}