srecord 1.65.0
 
Loading...
Searching...
No Matches
interval.h
Go to the documentation of this file.
1//
2// srecord - Manipulate EPROM load files
3// Copyright (C) 2008-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_INPUT_FILTER_INTERVAL_H
20#define SRECORD_INPUT_FILTER_INTERVAL_H
21
22#include <srecord/endian.h>
23#include <srecord/interval.h>
25
26namespace srecord {
27
28/**
29 * The srecord::input_filter_interval class is used to represent a filter
30 * which works with the interval representing the data's coverage,
31 * <i>exclusive</i> of where the result is to be placed.
32 */
34 public input_filter
35{
36public:
37 /**
38 * The destructor.
39 */
41
42protected:
43 /**
44 * The constructor.
45 *
46 * @param deeper
47 * The input source to be filtered.
48 * @param address
49 * The address at which to place the interval.
50 * @param length
51 * The number of bytes of interval to be inserted.
52 * @param end
53 * The byte order.
54 * @param inclusive
55 * true if the output location is included in the address
56 * range, false if not
57 */
58 input_filter_interval(const input::pointer &deeper, long address,
59 int length, endian_t end, bool inclusive);
60
61 /**
62 * The calculate_result method is used to calculate the final value
63 * to be placed into the output.
64 */
65 virtual long calculate_result() const = 0;
66
67 /**
68 * The get_range method may be used to derived classes to get
69 * access to the address range covered by the input data.
70 */
71 const interval &get_range() const { return range; }
72
73 // See base class for documentation.
75
76private:
77 /**
78 * The address instance variable is used to remember where the
79 * final result is to be placed.
80 */
81 long address;
82
83 /**
84 * The length instance variable is used to remember how many bytes
85 * are to be placed at the above address.
86 *
87 * 0 < length && length <= 8
88 * (a length of zero means we have already emitted the results)
89 */
90 int length;
91
92 /**
93 * The end instance variable is used to remember whether to use
94 * big endian order or little endian byte order.
95 */
96 endian_t end;
97
98 /**
99 * The range instance variable is used to remember the address
100 * range covered by the input data.
101 */
102 interval range;
103
104 /**
105 * The generate method is used to generate the final record with
106 * the interval data in it.
107 *
108 * @param record
109 * where to put the result
110 */
111 bool generate(record &record);
112
113 /**
114 * The default constructor. Do not use.
115 */
117
118 /**
119 * The copy constructor. Do not use.
120 */
122
123 /**
124 * The assignment operator. Do not use.
125 */
127};
128
129};
130
131// vim: set ts=8 sw=4 et :
132#endif // SRECORD_INPUT_FILTER_INTERVAL_H
bool read(record &record)
The read method is used to read one record from the input.
const interval & get_range() const
The get_range method may be used to derived classes to get access to the address range covered by the...
Definition interval.h:71
virtual ~input_filter_interval()
The destructor.
input_filter_interval(const input::pointer &deeper, long address, int length, endian_t end, bool inclusive)
The constructor.
virtual long calculate_result() const =0
The calculate_result method is used to calculate the final value to be placed into the output.
input_filter(input::pointer deeper)
The constructor.
std::shared_ptr< input > pointer
Definition input.h:41
The interval class is used to represent a set of integer values, usually composed of runs of adjacent...
Definition interval.h:36
The srecord::record class is used to represent a data record read from a file.
Definition record.h:35
endian_t
Definition endian.h:27