srecord: crc32.h Source File

srecord 1.65.0

Loading...
Searching...
No Matches
crc32.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 2000-2003, 2006-2008, 2010 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
8// (at 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
13// GNU Lesser 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
17// <http://www.gnu.org/licenses/>.
18//
19
20#ifndef SRECORD_CRC32_H
21#define SRECORD_CRC32_H
22
23#include <stddef.h>
24
25namespace srecord
26{
27
28/**
29 * The crc32 class is used to represent the running value of a 32-bit
30 * cyclic redundancy check of series of bytes.
31 */
32 class crc32
33{
34public:
35 enum seed_mode_t
36 {
37 seed_mode_ccitt, // all ones
38 seed_mode_xmodem // all zero
39 };
40
41 /**
42 * The destructor.
43 */
44 virtual ~crc32();
45
46 /**
47 * The default constructor.
48 */
49 crc32(seed_mode_t seed_mode = seed_mode_ccitt);
50
51 /**
52 * The copy constructor.
53 */
54 crc32(const crc32 &);
55
56 /**
57 * The assignment operator.
58 */
59 crc32 &operator=(const crc32 &);
60
61 /**
62 * The get method is used to obtain the running value of the cyclic
63 * redundancy check.
64 */
65 unsigned long get() const;
66
67 /**
68 * The next method is used to advance the state by one byte.
69 */
70 void next(unsigned char);
71
72 /**
73 * The nextbuf method is used to advance the state by a series of bytes.
74 */
75 void nextbuf(const void *, size_t);
76
77private:
78 /**
79 * The state instance variable is used to remember the running
80 * value of the 32-bit cyclic redundancy check.
81 */
82 unsigned long state;
83};
84
85};
86
87#endif // SRECORD_CRC32_H
srecord::crc32::operator=
crc32 & operator=(const crc32 &)
The assignment operator.
srecord::crc32::next
void next(unsigned char)
The next method is used to advance the state by one byte.
srecord::crc32::~crc32
virtual ~crc32()
The destructor.
srecord::crc32::nextbuf
void nextbuf(const void *, size_t)
The nextbuf method is used to advance the state by a series of bytes.
srecord::crc32::crc32
crc32(seed_mode_t seed_mode=seed_mode_ccitt)
The default constructor.
srecord::crc32::get
unsigned long get() const
The get method is used to obtain the running value of the cyclic redundancy check.
srecord::crc32::seed_mode_t
seed_mode_t
Definition crc32.h:36
srecord::crc32::seed_mode_ccitt
@ seed_mode_ccitt
Definition crc32.h:37
srecord::crc32::seed_mode_xmodem
@ seed_mode_xmodem
Definition crc32.h:38
srecord::crc32::crc32
crc32(const crc32 &)
The copy constructor.
srecord
Definition adler16.h:25