srecord: memory/walker.h Source File

srecord 1.65.0

Loading...
Searching...
No Matches
walker.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 1998, 1999, 2002, 2003, 2006-2008, 2010, 2012 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_H
21#define SRECORD_MEMORY_WALKER_H
22
23#include <memory>
24
25namespace srecord {
26
27class record; // forward
28
29/**
30 * The srecord::memory_walker class is used to represent an abstract handler
31 * for the action to perform when walking a memory image.
32 */
33 class memory_walker
34{
35public:
36 typedef std::shared_ptr<memory_walker> pointer;
37
38 /**
39 * The destructor.
40 */
41 virtual ~memory_walker();
42
43 /**
44 * The observe method is used by the memory walker to provide data.
45 * Derived classes are required to impliment this method, and do
46 * something with the data.
47 *
48 * @param address
49 * The base address of this chunk of memory.
50 * @param data
51 * The base address of this chunk of memory in memory.
52 * @param data_size
53 * The size, in bytes, of this chunk of memory.
54 */
55 virtual void observe(unsigned long address, const void *data,
56 int data_size) = 0;
57
58 /**
59 * The observe_end method is called once all of the data blocks
60 * have been passed to the observer via the observe() method.
61 */
62 virtual void observe_end(void);
63
64 /**
65 * The notify_upper_bound method is used to notify the walker of
66 * the upper bound (highest address plus one) of the observe calls
67 * to come. Shall be called before the any observe calls are made.
68 * By default, nothing happens.
69 *
70 * @param address
71 * The address of the byte immediately beyond the used memory.
72 */
73 virtual void notify_upper_bound(unsigned long address);
74
75 /**
76 * The observe_header method is used to inform the walker of the
77 * header record. The default does nothing.
78 *
79 * @param rec
80 * The record to be processed.
81 */
82 virtual void observe_header(const record *rec = 0);
83
84 /**
85 * The observe_start_address method is used to inform the walker
86 * of the execution start address record. The default does nothing.
87 *
88 * @param rec
89 * The record to be processed.
90 */
91 virtual void observe_start_address(const record *rec = 0);
92
93protected:
94 /**
95 * The default constructor. May only be called by derived classes.
96 */
97 memory_walker();
98
99private:
100 /**
101 * The copy constructor. Do not use.
102 */
103 memory_walker(const memory_walker &);
104
105 /**
106 * The assignment operator. Do not use.
107 */
108 memory_walker &operator=(const memory_walker &);
109};
110
111};
112
113// vim: set ts=8 sw=4 et :
114#endif // SRECORD_MEMORY_WALKER_H
srecord::memory_walker::observe_header
virtual void observe_header(const record *rec=0)
The observe_header method is used to inform the walker of the header record.
srecord::memory_walker::notify_upper_bound
virtual void notify_upper_bound(unsigned long address)
The notify_upper_bound method is used to notify the walker of the upper bound (highest address plus o...
srecord::memory_walker::memory_walker
memory_walker()
The default constructor.
srecord::memory_walker::~memory_walker
virtual ~memory_walker()
The destructor.
srecord::memory_walker::observe_end
virtual 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::pointer
std::shared_ptr< memory_walker > pointer
Definition walker.h:36
srecord::memory_walker::observe_start_address
virtual void observe_start_address(const record *rec=0)
The observe_start_address method is used to inform the walker of the execution start address record.
srecord::memory_walker::observe
virtual void observe(unsigned long address, const void *data, int data_size)=0
The observe method is used by the memory walker to provide data.
srecord::record
The srecord::record class is used to represent a data record read from a file.
Definition record.h:35
srecord
Definition adler16.h:25