srecord  1.65.0
fill.h
Go to the documentation of this file.
1 //
2 // srecord - manipulate eprom load files
3 // Copyright (C) 1998, 1999, 2001, 2002, 2004, 2006-2008, 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_FILL_H
21 #define SRECORD_INPUT_FILTER_FILL_H
22 
23 #include <srecord/interval.h>
24 #include <srecord/input/filter.h>
25 #include <srecord/record.h>
26 
27 namespace srecord {
28 
29 /**
30  * The srecord::input_filter_fill class is used to represent a filter
31  * which replaces in set data locations with constant data.
32  */
34  public input_filter
35 {
36 public:
37  /**
38  * The destructor.
39  */
40  virtual ~input_filter_fill();
41 
42 private:
43  /**
44  * The constructor.
45  *
46  * @param deeper
47  * The incoming data source to be filtered
48  * @param value
49  * The byte value to fill with.
50  * @param range
51  * The address range to be filled.
52  */
53  input_filter_fill(const input::pointer &deeper, int value,
54  const interval &range);
55 
56 public:
57  /**
58  * The create class method is used to create new dynamically
59  * allocated instances of this class.
60  *
61  * @param deeper
62  * The incoming data source to be filtered
63  * @param value
64  * The byte value to fill with.
65  * @param range
66  * The address range to be filled.
67  */
68  static pointer create(const input::pointer &deeper, int value,
69  const interval &range);
70 
71 protected:
72  // See base class for documentation.
73  bool read(record &record);
74 
75 private:
76  /**
77  * The filler_value instance variable is used to remember the value
78  * to assign to fill bytes.
79  */
80  int filler_value;
81 
82  /**
83  * The filler_block instance variable is used to remember the base
84  * of a dynamically allocated array of bytes, used to construct
85  * filler block records.
86  */
87  unsigned char *filler_block;
88 
89  /**
90  * The range instance variable is used to remember the range of
91  * addresses to be filled. As fill blocks are produced the range
92  * is reduced.
93  */
94  interval range;
95 
96  /**
97  * The generate method is used to genetate fill records.
98  */
99  bool generate(record &record);
100 
101  /**
102  * The default constructor. Do not use.
103  */
105 
106  /**
107  * The copy constructor. Do not use.
108  */
110 
111  /**
112  * The assignment. Do not use.
113  */
114  input_filter_fill &operator=(const input_filter_fill &);
115 };
116 
117 };
118 
119 #endif // SRECORD_INPUT_FILTER_FILL_H
The srecord::input_filter_fill class is used to represent a filter which replaces in set data locatio...
Definition: fill.h:35
static pointer create(const input::pointer &deeper, int value, const interval &range)
The create class method is used to create new dynamically allocated instances of this class.
virtual ~input_filter_fill()
The destructor.
bool read(record &record)
The read method is used to read one record from the input.
The srecord::input_filter class is an abstract interface for all of the various filters that can be a...
Definition: filter.h:37
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