Generic hardware access library
/home/cschwick/hal/generic/include/hal/AddressTableItem.hh
Go to the documentation of this file.
00001 #ifndef __AddressTableItem
00002 #define __AddressTableItem
00003 
00004 #include <string>
00005 #include <iostream>
00006 #include "hal/GeneralHardwareAddress.hh"
00007 #include "hal/IllegalOperationException.hh"
00008 #include "hal/MaskBoundaryException.hh"
00009 
00010 namespace HAL {
00011 
00033 class AddressTableItem {
00034 public:
00051   AddressTableItem( std::string key,
00052                     std::string description,
00053                     GeneralHardwareAddress& address,
00054                     uint32_t mask,
00055                     bool writableFlag,
00056                     bool readableFlag);
00057   
00058 
00069   AddressTableItem( const AddressTableItem& );
00070 
00074   virtual ~AddressTableItem();
00075 
00076   uint32_t getMask() const;
00077 
00078   std::string getDescription() const;
00079 
00080   std::string getKey() const;
00081 
00091   GeneralHardwareAddress& getGeneralHardwareAddress() const;
00092 
00093   bool isWritable() const;
00094 
00095   bool isReadable()const;
00096 
00100   void checkWritable() const 
00101     throw(IllegalOperationException);
00102 
00106   void checkReadable() const 
00107     throw(IllegalOperationException);
00108 
00115   bool isBit() const ;
00116 
00117   void checkBit() const 
00118     throw(IllegalOperationException);
00119 
00123   virtual void print( std::ostream& os = std::cout ) const;
00124 
00143   uint32_t applyFromMask( uint32_t data,
00144                                bool MaskBoundaryCheck = false ) const
00145     throw( MaskBoundaryException );
00146 
00162   uint32_t applyToMask( uint32_t data,
00163                              bool MaskBoundaryCheck = true ) const
00164     throw( MaskBoundaryException) ;
00165 protected:
00169   uint32_t countBits( uint32_t word ) const;
00170   
00171 private:
00175   void operator=(const AddressTableItem& ai) {};
00176   GeneralHardwareAddress& hardwareAddress;
00177   std::string key;
00178   std::string description;
00179   uint32_t mask;
00180   bool writableFlag;
00181   bool readableFlag;
00182   bool bitFlag;
00183 };
00184 } /* namespace HAL */
00185 
00186 #endif /*_AddressTableItem */
00187