srecord  1.65.0
generator.h
Go to the documentation of this file.
1 //
2 // srecord - The "srecord" program.
3 // Copyright (C) 2007, 2008, 2010, 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
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_GENERATOR_H
21 #define SRECORD_INPUT_GENERATOR_H
22 
23 #include <srecord/input.h>
24 #include <srecord/interval.h>
25 
26 namespace srecord
27 {
28 
29 /**
30  * The srecord::input_generator class is used to represent the state of
31  * generating data from whole cloth.
32  */
34  public input
35 {
36 public:
37  /**
38  * The destructor.
39  */
40  virtual ~input_generator();
41 
42  /**
43  * The constructor.
44  *
45  * @param range
46  * The data range over which data is to be generated.
47  */
48  input_generator(const interval &range);
49 
50  /**
51  * The create class method may be used to create new instances of
52  * input data generators.
53  *
54  * @param cmdln
55  * The command line arguments, for deciding what to generate.
56  */
58 
59 protected:
60  // See base class for documentation
61  bool read(record &record);
62 
63  // See base class for documentation
65 
66  /**
67  * The generate_data method is used to manufacture data for a
68  * specific address.
69  *
70  * @param address
71  * The address to generate data for.
72  * @returns
73  * one byte of data
74  */
75  virtual unsigned char generate_data(unsigned long address) = 0;
76 
77 private:
78  /**
79  * The range instance variable is used to remember the address
80  * range over which we are to generate data. It shrinks as the
81  * data is generated.
82  */
83  interval range;
84 
85  /**
86  * The default constructor.
87  */
89 
90  /**
91  * The copy constructor.
92  */
94 
95  /**
96  * The assignment operator.
97  */
98  input_generator &operator=(const input_generator &);
99 };
100 
101 };
102 
103 // vim: set ts=8 sw=4 et :
104 #endif // SRECORD_INPUT_GENERATOR_H
The srecord::arglex_tool is used to parse command line with srec-specific arguments.
Definition: tool.h:41
The srecord::input_generator class is used to represent the state of generating data from whole cloth...
Definition: generator.h:35
virtual unsigned char generate_data(unsigned long address)=0
The generate_data method is used to manufacture data for a specific address.
input_generator(const interval &range)
The constructor.
static input::pointer create(arglex_tool *cmdln)
The create class method may be used to create new instances of input data generators.
bool read(record &record)
The read method is used to read one record from the input.
void disable_checksum_validation()
The disable_checksum_validation method is used to have this input stream ignore checksum errors.
virtual ~input_generator()
The destructor.
The srecord::input class is used to represent an abstract EPROM load file source.
Definition: input.h:39
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