srecord  1.65.0
adler32.h
Go to the documentation of this file.
1 //
2 // srecord - Manipulate EPROM load files
3 // Copyright (C) 2009-2011 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or (at
8 // your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 //
18 
19 #ifndef SRECORD_ADLER32_H
20 #define SRECORD_ADLER32_H
21 
22 #include <cstddef>
23 
24 namespace srecord
25 {
26 
27 /**
28  * The adler32 class is used to represent the running value of a 32-bit
29  * Adler checksum of series of bytes.
30  *
31  * See wikipedia for a description
32  * http://en.wikipedia.org/wiki/Adler-32
33  */
34 class adler32
35 {
36 public:
37  /**
38  * The destructor.
39  */
40  virtual ~adler32();
41 
42  /**
43  * The default constructor.
44  */
46 
47  /**
48  * The copy constructor.
49  */
50  adler32(const adler32 &);
51 
52  /**
53  * The assignment operator.
54  */
56 
57  /**
58  * The get method is used to obtain the running value of the
59  * checksum.
60  */
61  unsigned long get() const;
62 
63  /**
64  * The next method is used to advance the state by one byte.
65  */
66  void next(unsigned char);
67 
68  /**
69  * The nextbuf method is used to advance the state by a series of bytes.
70  */
71  void nextbuf(const void *, size_t);
72 
73 private:
74  /**
75  * The sum_a instance variable is used to remember the sum of bytes
76  * scanned.
77  */
78  unsigned short sum_a;
79 
80  /**
81  * The sum_b instance variable is used to remember the sum of the
82  * sum of bytes scanned.
83  */
84  unsigned short sum_b;
85 };
86 
87 };
88 
89 // vim: set ts=8 sw=4 et :
90 #endif // SRECORD_ADLER32_H
The adler32 class is used to represent the running value of a 32-bit Adler checksum of series of byte...
Definition: adler32.h:35
adler32 & operator=(const adler32 &)
The assignment operator.
virtual ~adler32()
The destructor.
void nextbuf(const void *, size_t)
The nextbuf method is used to advance the state by a series of bytes.
adler32()
The default constructor.
unsigned long get() const
The get method is used to obtain the running value of the checksum.
void next(unsigned char)
The next method is used to advance the state by one byte.
adler32(const adler32 &)
The copy constructor.