srecord  1.65.0
adler16.h
Go to the documentation of this file.
1 //
2 // srecord - manipulate eprom load files
3 // Copyright (C) 2009, 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_ADLER16_H
21 #define SRECORD_MEMORY_WALKER_ADLER16_H
22 
23 #include <srecord/adler16.h>
24 #include <srecord/memory/walker.h>
25 
26 namespace srecord
27 {
28 
29 /**
30  * The srecord::memory_walker_adler16 class is used to represent the parse
31  * state of a memory walker which calculates a running ADLER16 checksum.
32  */
34  public memory_walker
35 {
36 public:
37  typedef std::shared_ptr<memory_walker_adler16> 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  */
50 
51 public:
52  /**
53  * The create class method is used to create new dynamically
54  * allocated instances of this class.
55  */
56  static pointer create();
57 
58  /**
59  * The get method is used to get the ADLER16 checksum once all memory
60  * chunks have been processed by calls to our observe method.
61  */
62  unsigned get() const;
63 
64 protected:
65  // See base class for documentation.
66  void observe(unsigned long, const void *, int);
67 
68 private:
69  /**
70  * The checksum instance variable is used to remember the running
71  * state of the ADLER16 checksum calculation.
72  */
73  adler16 checksum;
74 
75  /**
76  * The copy constructor. Do not use.
77  */
79 
80  /**
81  * The assignment operator. Do not use.
82  */
83  memory_walker_adler16 &operator=(const memory_walker_adler16 &);
84 };
85 
86 };
87 
88 #endif // SRECORD_MEMORY_WALKER_ADLER16_H
The adler16 class is used to represent the running value of a 16-bit Adler checksum of series of byte...
Definition: adler16.h:33
The srecord::memory_walker_adler16 class is used to represent the parse state of a memory walker whic...
Definition: adler16.h:35
unsigned get() const
The get method is used to get the ADLER16 checksum once all memory chunks have been processed by call...
std::shared_ptr< memory_walker_adler16 > pointer
Definition: adler16.h:37
virtual ~memory_walker_adler16()
The destructor.
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.
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