Generic hardware access library
|
00001 #include "hal/DefineFactory.hh" 00002 00003 HAL::SequencerCommand* HAL::DefineFactory::create( std::list<std::string>& arguments, 00004 const HAL::AddressTableInterface& addressTable, 00005 HAL::CommandSequence& sequence ) 00006 throw (HAL::SequencerSyntaxError) { 00007 if ( arguments.size() < 1 || arguments.size() > 2 ) { 00008 std::string text ="\"define\" command must have one or two arguments.\n syntax : define $name [initValue]"; 00009 throw( HAL::SequencerSyntaxError(text)); 00010 } 00011 std::string variableName = arguments.front(); 00012 arguments.pop_front(); 00013 bool hasInitialization = false; 00014 std::string initArg = ""; 00015 if ( arguments.size() == 1 ) { 00016 hasInitialization = true; 00017 initArg = arguments.front(); 00018 } 00019 HAL::DefineCommand* commandPtr = new HAL::DefineCommand (variableName, 00020 hasInitialization, 00021 sequence); 00022 if (hasInitialization) { 00023 if (initArg[0] != '$') { 00024 commandPtr->setInitValue( stringToNumber( initArg ) ); 00025 } else { 00026 commandPtr->setInitValuePointer( sequence.getVariablePointer( initArg )); 00027 } 00028 } 00029 00030 return commandPtr; 00031 } 00032 00033 00034 00035 00036