Generic hardware access library
/home/cschwick/hal/generic/include/hal/CommandSequence.hh
Go to the documentation of this file.
00001 #ifndef __CommandSequence
00002 #define __CommandSequence
00003 
00004 #include <string>
00005 #include <map>
00006 #include <vector>
00007 
00008 #include "hal/CommandSequenceReader.hh"
00009 #include "hal/HardwareDeviceInterface.hh"
00010 #include "hal/SequencerCommand.hh"
00011 #include "hal/CommandCreator.hh"
00012 #include "hal/AddressTableInterface.hh"
00013 #include "hal/SequencerSyntaxError.hh"
00014 #include "hal/NoSuchItemException.hh"
00015 #include "hal/BusAdapterException.hh"
00016 #include "hal/TimeoutException.hh"
00017 
00018 namespace HAL {
00019 
00041 class CommandSequence {
00042 public :
00067   CommandSequence( std::string name,
00068                    CommandSequenceReader& reader,
00069                    const AddressTableInterface& addressTable )
00070     throw( SequencerSyntaxError, NoSuchItemException );
00071 
00075   virtual ~CommandSequence();
00076 
00080   void run( const HardwareDeviceInterface& device )
00081     throw( SequencerSyntaxError,
00082            IllegalOperationException,
00083            BusAdapterException,
00084            MaskBoundaryException,
00085            TimeoutException);
00086 
00087   std::string getName() const { return name; }
00088 
00093   uint32_t* addVariable( std::string name, 
00094                               uint32_t initValue = 0 );
00095 
00100   void addLabel( std::string name );
00101 
00107   uint32_t getVariable( std::string name ) const
00108     throw( SequencerSyntaxError );
00109   
00116   uint32_t* getVariablePointer( std::string name )
00117     throw( SequencerSyntaxError );
00118 
00126   void setVariable( std::string name,
00127                     uint32_t value) 
00128     throw( SequencerSyntaxError );
00134   void existVariable( std::string name ) const
00135     throw( SequencerSyntaxError );
00136 
00143   void gotoLabel( std::string labelName )
00144     throw (SequencerSyntaxError );
00145 
00155   void rescan() 
00156     throw( NoSuchItemException,
00157            SequencerSyntaxError );
00158 
00164   void existLabel( std::string labelName ) const
00165     throw ( SequencerSyntaxError );
00166 
00167 private:
00168   std::string name;
00169   CommandSequenceReader& reader;
00170   const AddressTableInterface& addressTable;
00171   int commandIndex;
00172   std::vector< SequencerCommand* > commandList;
00173   std::vector< SequencerCommand* >::iterator commandIterator;
00174   std::map< std::string, uint32_t > variableMap;
00175   std::map< std::string, int > labelMap;
00176 };
00177 
00178 } /* namespace HAL */
00179 
00180 #endif /* __CommandSequence */