srecord 1.65.0
 
Loading...
Searching...
No Matches
unfill.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 2001, 2002, 2005-2010 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_INPUT_FILTER_UNFILL_H
21#define SRECORD_INPUT_FILTER_UNFILL_H
22
24#include <srecord/record.h>
25
26namespace srecord
27{
28
29/**
30 * The srecord::input_filter_unfill class is used to represent a filter
31 * which makes holes in the data wherever a specified data byte value
32 * appears.
33 *
34 * This is the inverse of the srecord::input_filter_fill class.
35 *
36 * Usually this is used to find the actual limits of data from an
37 * extracted EPROM image; you can specify a minimum run length of the
38 * same byte, so that you don't simply get a 1/256 reduction in density
39 * in the middle of "real" data.
40 */
41class input_filter_unfill:
42 public input_filter
43{
44public:
45 /**
46 * The destructor.
47 */
49
50private:
51 /**
52 * The constructor.
53 *
54 * @param deeper
55 * The deeper input source to be filtered.
56 * @param value
57 * The value of the bytes to be turned into holes.
58 * @param minimum
59 * The minimum run length to be considered a hole.
60 */
61 input_filter_unfill(const input::pointer &deeper, int value, int minimum);
62
63public:
64 /**
65 * The create class method is used to create new dynamically
66 * allocated instances of this class.
67 *
68 * @param deeper
69 * The incoming data source to be filtered
70 * @param value
71 * The value of the bytes to be turned into holes.
72 * @param minimum
73 * The minimum run length to be considered a hole.
74 */
75 static pointer create(const input::pointer &deeper, int value, int minimum);
76
77protected:
78 // See base class for documentation.
80
81private:
82 /**
83 * The fill_value instance variable is used to remember the value
84 * of the bytes to be turned into holes.
85 */
86 record::data_t fill_value;
87
88 /**
89 * The fill_minimum instance variable is used to remember the
90 * minimum run length to be considered a hole.
91 */
92 record::address_t fill_minimum;
93
94 /**
95 * The buffer instance variable is used to remember the data
96 * that has been read from the deeper input source and is being
97 * processed to unfill certain valued bytes.
98 */
99 record buffer;
100
101 /**
102 * The fill_value instance variable is used to remember where we
103 * are up to in the "buffer" instance variable.
104 */
105 size_t buffer_pos;
106
107 /**
108 * The default constructor. Do not use.
109 */
110 input_filter_unfill();
111
112 /**
113 * The copy constructor. Do not use.
114 */
115 input_filter_unfill(const input_filter_unfill &);
116
117 /**
118 * The assignment operator. Do not use.
119 */
120 input_filter_unfill &operator=(const input_filter_unfill &);
121};
122
123};
124
125#endif // SRECORD_INPUT_FILTER_UNFILL_H
static pointer create(const input::pointer &deeper, int value, int minimum)
The create class method is used to create new dynamically allocated instances of this class.
virtual ~input_filter_unfill()
The destructor.
bool read(record &record)
The read method is used to read one record from the input.
input_filter(input::pointer deeper)
The constructor.
std::shared_ptr< input > pointer
Definition input.h:41
The srecord::record class is used to represent a data record read from a file.
Definition record.h:35
uint8_t data_t
The type of record data values.
Definition record.h:63
uint32_t address_t
The type of record addresses.
Definition record.h:58