Generic hardware access library
/home/cschwick/hal/generic/src/common/GotoFactory.cc
Go to the documentation of this file.
00001 #include "hal/GotoFactory.hh"
00002 
00003 HAL::SequencerCommand* HAL::GotoFactory::create( std::list<std::string>& arguments, 
00004                                                  const HAL::AddressTableInterface& addressTable,
00005                                                  HAL::CommandSequence& sequence ) 
00006   throw (HAL::SequencerSyntaxError) {
00007   if ( arguments.size() != 4 ) {
00008     std::string text ="\"goto\" command must have 4 arguments.\n    syntax : goto {labelName} op1 cond op2";
00009     throw( HAL::SequencerSyntaxError(text));
00010   }
00011   std::string labelName = arguments.front();
00012   arguments.pop_front();
00013   std::string op1Str = arguments.front();
00014   arguments.pop_front();
00015   std::string condStr = arguments.front();
00016   arguments.pop_front();
00017   std::string op2Str = arguments.front();
00018   arguments.pop_front();
00019   
00020   HAL::GotoCommand* commandPtr = new HAL::GotoCommand (labelName,
00021                                                        condStr,
00022                                                        sequence); 
00023   
00024   if (op1Str[0] != '$') {
00025     commandPtr->setOp1( stringToNumber( op1Str ) );
00026   } else {
00027     commandPtr->setOp1Pointer( sequence.getVariablePointer( op1Str ));
00028   }
00029 
00030   if (op2Str[0] != '$') {
00031     commandPtr->setOp2( stringToNumber( op2Str ) );
00032   } else {
00033     commandPtr->setOp2Pointer( sequence.getVariablePointer( op2Str ));
00034   }
00035 
00036   return commandPtr;
00037 }
00038 
00039   
00040 
00041