srecord: memory/walker/alignment.h Source File

srecord 1.65.0

Loading...
Searching...
No Matches
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
24namespace 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 */
32 class memory_walker_alignment:
33 public memory_walker
34{
35public:
36 typedef std::shared_ptr<memory_walker_alignment> pointer;
37
38 /**
39 * The destructror.
40 */
41 virtual ~memory_walker_alignment();
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
61protected:
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
68private:
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 */
87 memory_walker_alignment();
88
89 /**
90 * The copy constructor. No not use.
91 */
92 memory_walker_alignment(const memory_walker_alignment &);
93
94 /**
95 * The assignment operator. No not use.
96 */
97 memory_walker_alignment &operator=(const memory_walker_alignment &);
98};
99
100};
101
102// vim: set ts=8 sw=4 et :
103#endif // SRECORD_MEMORY_WALKER_ALIGNMENT_H
srecord::memory_walker_alignment::~memory_walker_alignment
virtual ~memory_walker_alignment()
The destructror.
srecord::memory_walker_alignment::observe
void observe(unsigned long, const void *, int)
The observe method is used by the memory walker to provide data.
srecord::memory_walker_alignment::create
static pointer create(unsigned multiple)
The create class method is used to create new dynamically allocated instances of class.
srecord::memory_walker_alignment::observe_end
void observe_end(void)
The observe_end method is called once all of the data blocks have been passed to the observer via the...
srecord::memory_walker_alignment::is_well_aligned
bool is_well_aligned(void) const
The is_continuous method is used to get the results of the calculation.
srecord::memory_walker_alignment::pointer
std::shared_ptr< memory_walker_alignment > pointer
Definition alignment.h:36
srecord::memory_walker::memory_walker
memory_walker()
The default constructor.
srecord
Definition adler16.h:25
walker.h