Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

LOW_deviceID.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           LOW_deviceID.h  -  description
00003                              -------------------
00004     begin                : Sat Jul 6 2002
00005     copyright            : (C) 2002 by Harald Roelle, Helmut Reiser
00006     email                : roelle@informatik.uni-muenchen.de, reiser@informatik.uni-muenchen.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef LOW_DEVICEID_H
00019 #define LOW_DEVICEID_H
00020 
00021 
00022 #include "LOW_types.h"
00023 #include "LOW_deviceIDRaw.h"
00024 
00025 
00026 /** Class for immutable 1-Wire ROM IDs.
00027 
00028     In contrast to LOW_deviceIDRaw this class prevents manipulation of the ID
00029     and a CRC validation is done on creation.
00030 
00031     @author Harald Roelle, Helmut Reiser
00032 */
00033 class LOW_deviceID : public LOW_deviceIDRaw {
00034 
00035 //=======================================================================================
00036 public:
00037   
00038   //=====================================================================================
00039   //
00040   // type definitions
00041   //
00042   
00043   typedef std::vector<LOW_deviceID> deviceIDVec_t;  /**< Vector type of class LOW_deviceID */
00044   
00045   
00046   //=====================================================================================
00047   //
00048   // constructors
00049   //
00050   
00051   /** Default constructor. */
00052   LOW_deviceID();
00053 
00054   /** Constructor from ROM ID as our own data type.
00055       @param  inRomID  Reference to ROM ID.
00056       @throw LOW_helper_CRC::crc_error  Thrown when CRC validation fails.
00057    */
00058   LOW_deviceID( const devRomID_t &inRomID);
00059 
00060   /** Constructor from two 32 bit values.
00061       @param inHighInt  Upper 32 bits of ROM ID.
00062       @param inLowInt   Lower 32 bits of ROM ID.
00063       @throw LOW_helper_CRC::crc_error  Thrown when CRC validation fails.
00064    */
00065   LOW_deviceID( uint32_t inHighInt, uint32_t inLowInt);
00066 
00067   /** Constructor from byte vector.
00068       @param inRomID  Reference to byte vector of exactly 8 bytes.
00069       @throw sizeMismatch_error  Thrown when <I>inRomID</I> has other size than 8.
00070       @throw LOW_helper_CRC::crc_error  Thrown when CRC validation fails.
00071    */
00072   LOW_deviceID( const byteVec_t &inRomID);
00073 
00074   /** Constructor from LOW_deviceIDRaw.
00075       @param  inDevIDRaw  Reference to a raw ROM ID.
00076       @throw LOW_helper_CRC::crc_error  Thrown when CRC validation fails.
00077    */
00078   LOW_deviceID( const LOW_deviceIDRaw &inDevIDRaw);
00079   
00080   /** Destructor. */
00081   ~LOW_deviceID();
00082 
00083 
00084 //=======================================================================================
00085 private:
00086 
00087   //=====================================================================================
00088   //
00089   // methods
00090   //
00091   
00092   /** Validate CRC checksum of the current ROM ID.
00093       Returns silently when CRC is OK, else an exception is thrown.
00094       @throw LOW_helper_CRC::crc_error  Thrown when CRC validation fails.
00095    */
00096   void checkCRC();
00097 
00098   /** Hidden method inherited from LOW_deviceIDRaw.
00099       Declared as private to prevent changes to ROM ID.
00100    */
00101   void setBit( const uint8_t inBitNum, const bool inValue);
00102   
00103   /** Hidden method inherited from LOW_deviceIDRaw.
00104       Declared as private to prevent changes to ROM ID.
00105    */
00106   void setFamilyCode( const devFamCode_t inFamCode);
00107 };
00108 
00109 #endif

Generated on Sun Jan 12 21:07:43 2003 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001