Generic hardware access library
/home/cschwick/hal/generic/src/common/PrintCommand.cc
Go to the documentation of this file.
00001 #include "hal/PrintCommand.hh"
00002 #include <iostream>
00003 #include <iomanip>
00004 
00005 
00006 HAL::PrintCommand::PrintCommand( std::list< std::string > arguments,
00007                                  HAL::CommandSequence& sequence )
00008   throw (HAL::SequencerSyntaxError)
00009   : arguments( arguments ),
00010     sequence(sequence) {
00011 }
00012 
00013 void HAL::PrintCommand::excecute( const HAL::HardwareDeviceInterface& device ) const
00014   throw(){
00015   std::list< std::string >::const_iterator it;
00016   for ( it = arguments.begin(); it!=arguments.end(); it++ ) {
00017     if ( (*it)[0] == '$' ) {
00018       uint32_t value = sequence.getVariable(*it);
00019       std::cout << value << " ";
00020     } else if ( (*it)[0] == '%' ) {
00021       if ( *it == "%hex" ) {
00022         std::cout << std::hex << std::setw(8) << std::setfill('0');
00023       } else if ( *it == "%dec" ) {
00024         std::cout << std::dec;
00025       } else {
00026         std::cout << *it << " ";
00027       }
00028     } else {
00029       std::cout << *it << " ";
00030     }
00031   }
00032   std::cout << std::endl;
00033 }
00034