srecord: memory/walker/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, 2002, 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_MEMORY_WALKER_CRC32_H
21#define SRECORD_MEMORY_WALKER_CRC32_H
22
23#include <srecord/crc32.h>
24#include <srecord/memory/walker.h>
25
26namespace srecord
27{
28
29/**
30 * The srecord::memory_walker_crc32 class is used to represent the parse
31 * state of a memory walker which calculates a running CRC32 checksum.
32 */
33 class memory_walker_crc32:
34 public memory_walker
35{
36public:
37 typedef std::shared_ptr<memory_walker_crc32> pointer;
38
39 /**
40 * The destructor.
41 */
42 virtual ~memory_walker_crc32();
43
44private:
45 /**
46 * The default constructor. It is private on putpose, use the
47 * #create method instead.
48 *
49 * @param seed_mode
50 * How to calculate the initial seed.
51 */
52 memory_walker_crc32(crc32::seed_mode_t seed_mode);
53
54public:
55 /**
56 * The create class method is used to create new dynamically
57 * allocated instances of this class.
58 *
59 * @param seed_mode
60 * How to calculate the initial seed.
61 */
62 static pointer create(crc32::seed_mode_t seed_mode);
63
64 /**
65 * The get method is used to get the CRC32 checksum once all memory
66 * chunks have been processed by calls to our observe method.
67 */
68 unsigned get() const;
69
70protected:
71 // See base class for documentation.
72 void observe(unsigned long, const void *, int);
73
74private:
75 /**
76 * The checksum instance variable is used to remember the running
77 * state of the CRC32 checksum calculation.
78 */
79 crc32 checksum;
80
81 /**
82 * The copy constructor. Do not use.
83 */
84 memory_walker_crc32(const memory_walker_crc32 &);
85
86 /**
87 * The assignment operator. Do not use.
88 */
89 memory_walker_crc32 &operator=(const memory_walker_crc32 &);
90};
91
92};
93
94#endif // SRECORD_MEMORY_WALKER_CRC32_H
srecord::crc32
The crc32 class is used to represent the running value of a 32-bit cyclic redundancy check of series ...
Definition crc32.h:33
srecord::crc32::seed_mode_t
seed_mode_t
Definition crc32.h:36
srecord::memory_walker_crc32::observe
void observe(unsigned long, const void *, int)
The observe method is used by the memory walker to provide data.
srecord::memory_walker_crc32::pointer
std::shared_ptr< memory_walker_crc32 > pointer
Definition crc32.h:37
srecord::memory_walker_crc32::create
static pointer create(crc32::seed_mode_t seed_mode)
The create class method is used to create new dynamically allocated instances of this class.
srecord::memory_walker_crc32::~memory_walker_crc32
virtual ~memory_walker_crc32()
The destructor.
srecord::memory_walker_crc32::get
unsigned get() const
The get method is used to get the CRC32 checksum once all memory chunks have been processed by calls ...
srecord::memory_walker::memory_walker
memory_walker()
The default constructor.
crc32.h
srecord
Definition adler16.h:25
walker.h