srecord  1.65.0
alignment.h
Go to the documentation of this file.
1 //
2 // srecord - Manipulate EPROM load files
3 // Copyright (C) 2012 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify it
6 // 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 your
8 // option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 // 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_ALIGNMENT_H
20 #define SRECORD_MEMORY_WALKER_ALIGNMENT_H
21 
22 #include <srecord/memory/walker.h>
23 
24 namespace srecord
25 {
26 
27 /**
28  * The srecord::memory_walker_alignment class is used to represent the
29  * parse state of a memory walker which determines whether or not the
30  * data are well aligned.
31  */
33  public memory_walker
34 {
35 public:
36  typedef std::shared_ptr<memory_walker_alignment> pointer;
37 
38  /**
39  * The destructror.
40  */
42 
43  /**
44  * The create class method is used to create new dynamically
45  * allocated instances of class.
46  *
47  * @param multiple
48  * The multiple of bytes we expect for alignment.
49  */
50  static pointer create(unsigned multiple);
51 
52  /**
53  * The is_continuous method is used to get the results of the
54  * calculation.
55  *
56  * @returns
57  * true if the data has no holes, false if there are holes
58  */
59  bool is_well_aligned(void) const;
60 
61 protected:
62  // See base class for documentation.
63  void observe(unsigned long, const void *, int);
64 
65  // See base class for documentation.
66  void observe_end(void);
67 
68 private:
69  /**
70  * The constructor.
71  * It is private on purpose, use the #create class method instead.
72  *
73  * @param multiple
74  * The multiple of bytes we expect for alignment.
75  */
76  memory_walker_alignment(unsigned multiple);
77 
78  unsigned multiple;
79  unsigned long current_address;
80  bool data_seen;
81  bool well_aligned;
82 
83  /**
84  * The default constructor.
85  * Do not use.
86  */
88 
89  /**
90  * The copy constructor. No not use.
91  */
93 
94  /**
95  * The assignment operator. No not use.
96  */
98 };
99 
100 };
101 
102 // vim: set ts=8 sw=4 et :
103 #endif // SRECORD_MEMORY_WALKER_ALIGNMENT_H
The srecord::memory_walker_alignment class is used to represent the parse state of a memory walker wh...
Definition: alignment.h:34
virtual ~memory_walker_alignment()
The destructror.
void observe(unsigned long, const void *, int)
The observe method is used by the memory walker to provide data.
static pointer create(unsigned multiple)
The create class method is used to create new dynamically allocated instances of class.
void observe_end(void)
The observe_end method is called once all of the data blocks have been passed to the observer via the...
bool is_well_aligned(void) const
The is_continuous method is used to get the results of the calculation.
std::shared_ptr< memory_walker_alignment > pointer
Definition: alignment.h:36
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