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
00006     email                : roelle@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     This class is thread-safe.
00032 
00033     @author Harald Roelle
00034 */
00035 class LOW_deviceID : public LOW_deviceIDRaw {
00036 
00037 //=======================================================================================
00038 public:
00039   
00040   //=====================================================================================
00041   //
00042   // type definitions
00043   //
00044   
00045   typedef std::vector<LOW_deviceID> deviceIDVec_t;  /**< Vector type of class LOW_deviceID */
00046   
00047   
00048   //=====================================================================================
00049   //
00050   // constructors
00051   //
00052   
00053   /** Default constructor. */
00054   LOW_deviceID();
00055 
00056   /** Copy constructor. */
00057   LOW_deviceID( const LOW_deviceID &inDeviceID);
00058 
00059   /** Constructor from ROM ID as our own data type.
00060       @param  inRomID  Reference to ROM ID.
00061       @throw LOW_helper_CRC::crc_error  Thrown when CRC validation fails.
00062    */
00063   LOW_deviceID( const devRomID_t &inRomID);
00064 
00065   /** Constructor from two 32 bit values.
00066       @param inHighInt  Upper 32 bits of ROM ID.
00067       @param inLowInt   Lower 32 bits of ROM ID.
00068       @throw LOW_helper_CRC::crc_error  Thrown when CRC validation fails.
00069    */
00070   LOW_deviceID( uint32_t inHighInt, uint32_t inLowInt);
00071 
00072   /** Constructor from byte vector.
00073       @param inRomID  Reference to byte vector of exactly 8 bytes.
00074       @throw sizeMismatch_error  Thrown when <I>inRomID</I> has other size than 8.
00075       @throw LOW_helper_CRC::crc_error  Thrown when CRC validation fails.
00076    */
00077   LOW_deviceID( const byteVec_t &inRomID);
00078 
00079   /** Constructor from LOW_deviceIDRaw.
00080       @param  inDevIDRaw  Reference to a raw ROM ID.
00081       @throw LOW_helper_CRC::crc_error  Thrown when CRC validation fails.
00082    */
00083   LOW_deviceID( const LOW_deviceIDRaw &inDevIDRaw);
00084   
00085   /** Destructor. */
00086   virtual ~LOW_deviceID();
00087 
00088 
00089 //=======================================================================================
00090 private:
00091 
00092   //=====================================================================================
00093   //
00094   // methods
00095   //
00096   
00097   /** Validate CRC checksum of the current ROM ID.
00098       Returns silently when CRC is OK, else an exception is thrown.
00099       @throw LOW_helper_CRC::crc_error  Thrown when CRC validation fails.
00100    */
00101   virtual void checkCRC();
00102 
00103   /** Hidden method inherited from LOW_deviceIDRaw.
00104       Declared as private to prevent changes to ROM ID.
00105    */
00106   virtual void setBit( const uint8_t inBitNum, const bool inValue);
00107   
00108   /** Hidden method inherited from LOW_deviceIDRaw.
00109       Declared as private to prevent changes to ROM ID.
00110    */
00111   virtual void setFamilyCode( const devFamCode_t inFamCode);
00112 };
00113 
00114 #endif

Generated on Tue Feb 3 11:30:25 2004 for OneWireLibrary++ by doxygen 1.3.2