Generic hardware access library
|
00001 #include "hal/AddFactory.hh" 00002 00003 HAL::SequencerCommand* HAL::AddFactory::create( std::list<std::string>& arguments, 00004 const HAL::AddressTableInterface& addressTable, 00005 HAL::CommandSequence& sequence ) 00006 throw (HAL::SequencerSyntaxError) { 00007 00008 if ( arguments.size() != 2 ) { 00009 throw ( HAL::SequencerSyntaxError("add command must have two arguments.")); 00010 } 00011 std::string variable = arguments.front(); 00012 arguments.pop_front(); 00013 sequence.existVariable( variable ); 00014 std::string dataStr = arguments.front(); 00015 arguments.pop_front(); 00016 00017 HAL::AddCommand* commandPtr = new HAL::AddCommand(variable, 00018 sequence); 00019 if ( dataStr[0] != '$' ) { 00020 commandPtr->setOp( stringToNumber( dataStr ) ); 00021 } else { 00022 commandPtr->setOpPointer( (long*)sequence.getVariablePointer( dataStr ) ); 00023 } 00024 return commandPtr; 00025 } 00026