srecord: input/filter/interval.h Source File

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>
24#include <srecord/input/filter.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 */
33 class input_filter_interval:
34 public input_filter
35{
36public:
37 /**
38 * The destructor.
39 */
40 virtual ~input_filter_interval();
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.
74 bool read(record &record);
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 */
116 input_filter_interval();
117
118 /**
119 * The copy constructor. Do not use.
120 */
121 input_filter_interval(const input_filter_interval &);
122
123 /**
124 * The assignment operator. Do not use.
125 */
126 input_filter_interval &operator=(const input_filter_interval &);
127};
128
129};
130
131// vim: set ts=8 sw=4 et :
132#endif // SRECORD_INPUT_FILTER_INTERVAL_H
srecord::input_filter_interval::read
bool read(record &record)
The read method is used to read one record from the input.
srecord::input_filter_interval::get_range
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
srecord::input_filter_interval::~input_filter_interval
virtual ~input_filter_interval()
The destructor.
srecord::input_filter_interval::input_filter_interval
input_filter_interval(const input::pointer &deeper, long address, int length, endian_t end, bool inclusive)
The constructor.
srecord::input_filter_interval::calculate_result
virtual long calculate_result() const =0
The calculate_result method is used to calculate the final value to be placed into the output.
srecord::input_filter::input_filter
input_filter(input::pointer deeper)
The constructor.
srecord::input::pointer
std::shared_ptr< input > pointer
Definition input.h:41
srecord::interval
The interval class is used to represent a set of integer values, usually composed of runs of adjacent...
Definition interval.h:36
srecord::record
The srecord::record class is used to represent a data record read from a file.
Definition record.h:35
endian.h
filter.h
interval.h
srecord
Definition adler16.h:25
srecord::endian_t
endian_t
Definition endian.h:27