srecord  1.65.0
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 
26 namespace 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  */
34  public memory_walker
35 {
36 public:
37  typedef std::shared_ptr<memory_walker_crc32> pointer;
38 
39  /**
40  * The destructor.
41  */
43 
44 private:
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  */
53 
54 public:
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 
70 protected:
71  // See base class for documentation.
72  void observe(unsigned long, const void *, int);
73 
74 private:
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  */
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
The crc32 class is used to represent the running value of a 32-bit cyclic redundancy check of series ...
Definition: crc32.h:33
The srecord::memory_walker_crc32 class is used to represent the parse state of a memory walker which ...
Definition: crc32.h:35
void observe(unsigned long, const void *, int)
The observe method is used by the memory walker to provide data.
std::shared_ptr< memory_walker_crc32 > pointer
Definition: crc32.h:37
static pointer create(crc32::seed_mode_t seed_mode)
The create class method is used to create new dynamically allocated instances of this class.
virtual ~memory_walker_crc32()
The destructor.
unsigned get() const
The get method is used to get the CRC32 checksum once all memory chunks have been processed by calls ...
The srecord::memory_walker class is used to represent an abstract handler for the action to perform w...
Definition: walker.h:34
std::shared_ptr< memory_walker > pointer
Definition: walker.h:36