File size: 3,106 Bytes
9375c9a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
// Copyright (C) 2005 Davis E. King ([email protected])
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_CRC32_KERNEl_ABSTRACT_
#ifdef DLIB_CRC32_KERNEl_ABSTRACT_
#include "../algs.h"
#include <string>
#include <vector>
namespace dlib
{
class crc32
{
/*!
INITIAL VALUE
The current checksum covers zero bytes.
get_checksum() == 0x00000000
WHAT THIS OBJECT REPRESENTS
This object represents the CRC32 algorithm for calculating
checksums.
!*/
public:
crc32 (
);
/*!
ensures
- #*this is properly initialized
!*/
crc32 (
const std::string& item
);
/*!
ensures
- #*this is properly initialized
- calls this->add(item).
(i.e. Using this constructor is the same as using the default
constructor and then calling add() on item)
!*/
crc32 (
const std::vector<char>& item
);
/*!
ensures
- #*this is properly initialized
- calls this->add(item).
(i.e. Using this constructor is the same as using the default
constructor and then calling add() on item)
!*/
virtual ~crc32 (
);
/*!
ensures
- any resources associated with *this have been released
!*/
void clear(
);
/*!
ensures
- #*this has its initial value
!*/
void add (
unsigned char item
);
/*!
ensures
- #get_checksum() == The checksum of all items added to *this previously
concatenated with item.
!*/
void add (
const std::string& item
);
/*!
ensures
- #get_checksum() == The checksum of all items added to *this previously
concatenated with item.
!*/
void add (
const std::vector<char>& item
);
/*!
ensures
- #get_checksum() == The checksum of all items added to *this previously
concatenated with item.
!*/
unsigned long get_checksum (
) const;
/*!
ensures
- returns the current checksum
!*/
operator unsigned long (
) const;
/*!
ensures
- returns get_checksum()
!*/
void swap (
crc32& item
);
/*!
ensures
- swaps *this and item
!*/
};
void swap (
crc32& a,
crc32& b
) { a.swap(b); }
/*!
provides a global swap function
!*/
}
#endif // DLIB_CRC32_KERNEl_ABSTRACT_
|