srecord  1.65.0
fletcher32.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_MEMORY_WALKER_FLETCHER32_H
20 #define SRECORD_MEMORY_WALKER_FLETCHER32_H
21 
22 #include <srecord/fletcher32.h>
23 #include <srecord/memory/walker.h>
24 
25 namespace srecord
26 {
27 
28 /**
29  * The srecord::memory_walker_fletcher32 class is used to represent the parse
30  * state of a memory walker which calculates a running Fletcher-32 checksum.
31  */
33  public memory_walker
34 {
35 public:
36  typedef std::shared_ptr<memory_walker_fletcher32> pointer;
37 
38  /**
39  * The destructor.
40  */
42 
43 private:
44  /**
45  * The default constructor. It is private on putpose, use the
46  * #create method instead.
47  */
49 
50 public:
51  /**
52  * The create class method is used to create new dynamically
53  * allocated instances of this class.
54  */
55  static pointer create();
56 
57  /**
58  * The get method is used to get the Fletcher-32 checksum once all memory
59  * chunks have been processed by calls to our observe method.
60  */
61  unsigned get() const;
62 
63 protected:
64  // See base class for documentation.
65  void observe(unsigned long, const void *, int);
66 
67 private:
68  /**
69  * The checksum instance variable is used to remember the running
70  * state of the Fletcher-32 checksum calculation.
71  */
72  fletcher32 checksum;
73 
74  /**
75  * The copy constructor. Do not use.
76  */
78 
79  /**
80  * The assignment operator. Do not use.
81  */
83 };
84 
85 };
86 
87 // vim: set ts=8 sw=4 et :
88 #endif // SRECORD_MEMORY_WALKER_FLETCHER32_H
The fletcher32 class is used to represent the running value of a 32-bit Fletcher's Checksum of a seri...
Definition: fletcher32.h:57
The srecord::memory_walker_fletcher32 class is used to represent the parse state of a memory walker w...
Definition: fletcher32.h:34
void observe(unsigned long, const void *, int)
The observe method is used by the memory walker to provide data.
static pointer create()
The create class method is used to create new dynamically allocated instances of this class.
std::shared_ptr< memory_walker_fletcher32 > pointer
Definition: fletcher32.h:36
unsigned get() const
The get method is used to get the Fletcher-32 checksum once all memory chunks have been processed by ...
virtual ~memory_walker_fletcher32()
The destructor.
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