srecord: input/generator.h Source File

srecord 1.65.0

Loading...
Searching...
No Matches
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
26namespace srecord
27{
28
29/**
30 * The srecord::input_generator class is used to represent the state of
31 * generating data from whole cloth.
32 */
33 class input_generator:
34 public input
35{
36public:
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 */
57 static input::pointer create(arglex_tool *cmdln);
58
59protected:
60 // See base class for documentation
61 bool read(record &record);
62
63 // See base class for documentation
64 void disable_checksum_validation();
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
77private:
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 */
88 input_generator();
89
90 /**
91 * The copy constructor.
92 */
93 input_generator(const input_generator &);
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
srecord::arglex_tool
The srecord::arglex_tool is used to parse command line with srec-specific arguments.
Definition tool.h:41
srecord::input_generator::generate_data
virtual unsigned char generate_data(unsigned long address)=0
The generate_data method is used to manufacture data for a specific address.
srecord::input_generator::input_generator
input_generator(const interval &range)
The constructor.
srecord::input_generator::create
static input::pointer create(arglex_tool *cmdln)
The create class method may be used to create new instances of input data generators.
srecord::input_generator::read
bool read(record &record)
The read method is used to read one record from the input.
srecord::input_generator::disable_checksum_validation
void disable_checksum_validation()
The disable_checksum_validation method is used to have this input stream ignore checksum errors.
srecord::input_generator::~input_generator
virtual ~input_generator()
The destructor.
srecord::input::input
input()
The default 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
input.h
interval.h
srecord
Definition adler16.h:25