Generic hardware access library
/home/cschwick/hal/generic/include/hal/AddressTableInterface.hh
Go to the documentation of this file.
00001 #ifndef __AddressTableInterface
00002 #define __AddressTableInterface
00003 
00004 #include <string>
00005 #include <ext/hash_map>
00006 #include <iostream>
00007 #include "hal/GeneralHardwareAddress.hh"
00008 #include "hal/AddressTableItem.hh"
00009 #include "hal/NoSuchItemException.hh"
00010 #include "hal/IllegalOperationException.hh"
00011 #include "hal/MaskBoundaryException.hh"
00012 #include "hal/AddressOutOfLimitsException.hh"
00013 #include "hal/HalHash.hh"
00014 
00015 namespace HAL {
00016 
00057 class AddressTableInterface {
00058 public:
00059 
00060   virtual ~AddressTableInterface() {};
00061 
00065   virtual std::string getName() const = 0;
00070   virtual const GeneralHardwareAddress& getGeneralHardwareAddress( std::string item ) const
00071     throw( NoSuchItemException ) = 0;
00077   virtual const GeneralHardwareAddress& getWritableHardwareAddress( std::string item ) const
00078     throw (NoSuchItemException, IllegalOperationException) = 0;
00084   virtual const GeneralHardwareAddress& getReadableHardwareAddress( std::string item ) const
00085     throw (NoSuchItemException, IllegalOperationException) = 0;
00091   virtual const AddressTableItem&  checkItem( std::string item ) const
00092     throw (NoSuchItemException) = 0;
00096   virtual bool isReadable( std::string item ) const 
00097     throw( NoSuchItemException ) = 0;
00101   virtual bool isWritable( std::string item ) const
00102     throw( NoSuchItemException ) = 0;
00106   virtual bool exists( std::string item ) const = 0;
00111   virtual void checkAddressLimits( std::string item, 
00112                                    uint32_t offset ) const 
00113     throw( NoSuchItemException,
00114            AddressOutOfLimitsException ) = 0;
00122   virtual void checkAddressLimits( const GeneralHardwareAddress& address,
00123                                    uint32_t offset ) const
00124     throw( AddressOutOfLimitsException ) = 0;
00128   virtual uint32_t getMask( std::string item ) const 
00129     throw( NoSuchItemException ) = 0;
00133   virtual std::string getDescription( std::string item ) const
00134     throw( NoSuchItemException ) = 0;
00135 
00141   virtual bool isBit( std::string item ) const
00142     throw( NoSuchItemException ) = 0;
00143 
00153   virtual __gnu_cxx::hash_map<std::string, AddressTableItem*, HalHash<std::string> >::const_iterator
00154   getItemListBegin() const = 0; 
00155 
00161   virtual __gnu_cxx::hash_map<std::string, AddressTableItem*, HalHash<std::string> >::const_iterator
00162   getItemListEnd() const = 0; 
00163   
00167   virtual void print( std::ostream& os = std::cout ) const = 0;
00168 
00184   virtual uint32_t applyToMask( std::string item, 
00185                                      uint32_t data, 
00186                                      bool MaskBoundaryCheck = true ) const
00187   throw( NoSuchItemException,
00188          MaskBoundaryException ) = 0;
00207   virtual uint32_t applyFromMask( std::string item, 
00208                                        uint32_t data, 
00209                                        bool MaskBoundaryCheck = false ) const
00210     throw( NoSuchItemException,
00211            MaskBoundaryException ) = 0;
00212 
00213 
00214 };
00215 } /* namespace HAL */
00216 
00217 #endif /*__AddressTableInterface */
00218