ofstd/include/dcmtk/ofstd/ofcrc32.h

00001 /*
00002  *
00003  *  Copyright (C) 2002-2010, OFFIS e.V.
00004  *  All rights reserved.  See COPYRIGHT file for details.
00005  *
00006  *  This software and supporting documentation were developed by
00007  *
00008  *    OFFIS e.V.
00009  *    R&D Division Health
00010  *    Escherweg 2
00011  *    D-26121 Oldenburg, Germany
00012  *
00013  *
00014  *  Module:  ofstd
00015  *
00016  *  Author:  Marco Eichelberg
00017  *
00018  *  Purpose: general purpose 32-bit CRC in C++
00019  *           Code is based on the CRC32 implementation (C)1986 Gary S. Brown
00020  *
00021  *  Last Update:      $Author: joergr $
00022  *  Update Date:      $Date: 2010-10-14 13:15:50 $
00023  *  CVS/RCS Revision: $Revision: 1.4 $
00024  *  Status:           $State: Exp $
00025  *
00026  *  CVS/RCS Log at end of file
00027  *
00028  */
00029 
00030 
00031 #ifndef OFCRC32_H
00032 #define OFCRC32_H
00033 
00034 
00037 class OFCRC32
00038 {
00039 public:
00040 
00042   OFCRC32()
00043   : value(0)
00044   {
00045   }
00046 
00048   ~OFCRC32()
00049   {
00050   }
00051 
00053   void reset()
00054   {
00055     value=0;
00056   }
00057 
00062   void addBlock(const void *ptr, unsigned long size);
00063 
00065   unsigned int getCRC32() const
00066   {
00067     return value;
00068   }
00069 
00075   static unsigned int compute(const void *ptr, unsigned long size);
00076 
00077 private:
00079   static const unsigned int crctab[256];
00080 
00082   unsigned int value;
00083 };
00084 
00085 #endif
00086 
00087 
00088 /*
00089  * CVS/RCS Log:
00090  * $Log: ofcrc32.h,v $
00091  * Revision 1.4  2010-10-14 13:15:50  joergr
00092  * Updated copyright header. Added reference to COPYRIGHT file.
00093  *
00094  * Revision 1.3  2005/12/08 16:05:53  meichel
00095  * Changed include path schema for all DCMTK header files
00096  *
00097  * Revision 1.2  2003/12/05 10:37:41  joergr
00098  * Removed leading underscore characters from preprocessor symbols (reserved
00099  * symbols). Updated copyright date where appropriate.
00100  *
00101  * Revision 1.1  2002/01/08 10:18:48  joergr
00102  * Added general purpose class which computes a CRC32 checksum on arbitrary
00103  * data.
00104  *
00105  *
00106  */


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1