srecord: input/generator/repeat.h Source File

srecord 1.65.0

Loading...
Searching...
No Matches
repeat.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_REPEAT_H
21#define SRECORD_INPUT_GENERATOR_REPEAT_H
22
23#include <srecord/input/generator.h>
24
25namespace srecord
26{
27
28/**
29 * The srecord::input_generator_repeat class is used to represent
30 * generating data which cycles over a fixed set of byte values.
31 */
32 class input_generator_repeat:
33 public input_generator
34{
35public:
36 /**
37 * The destructor.
38 */
39 virtual ~input_generator_repeat();
40
41private:
42 /**
43 * The constructor.
44 *
45 * @param range
46 * The address range over which to generate data.
47 * @param data
48 * Pointer to the base of an array of data to be repeated.
49 * @param length
50 * The length of the array of data to be repeated.
51 */
52 input_generator_repeat(const interval &range, unsigned char *data,
53 size_t length);
54
55public:
56 /**
57 * The create class method is used to create new dynamically
58 * allocated instances of this class.
59 *
60 * @param range
61 * The address range over which to generate data.
62 * @param data
63 * Pointer to the base of an array of data to be repeated.
64 * @param length
65 * The length of the array of data to be repeated.
66 */
67 static pointer create(const interval &range, unsigned char *data,
68 size_t length);
69
70protected:
71 // See base class for documentation.
72 unsigned char generate_data(unsigned long address);
73
74 // See base class for documentation.
75 std::string filename() const;
76
77 // See base class for documentation.
78 const char *get_file_format_name() const;
79
80private:
81 /**
82 * The address instance variable is used to remember the start of
83 * the generated data, so that modulo arithmentic will align the
84 * data repeats.
85 */
86 unsigned long address;
87
88 /**
89 * The data instance variable is used to remember the base of a
90 * dynamically allocated array of data to be repeated.
91 */
92 unsigned char *data;
93
94 /**
95 * The length instance variable is used to remember the lenth of
96 * the dynamically allocated array of data to be repeated.
97 */
98 size_t length;
99
100 /**
101 * The default constructor. Do not use.
102 */
103 input_generator_repeat();
104
105 /**
106 * The copy constructor. Do not use.
107 */
108 input_generator_repeat(const input_generator_repeat &);
109
110 /**
111 * The assignment operator. Do not use.
112 */
113 input_generator_repeat &operator=(const input_generator_repeat &);
114};
115
116};
117
118// vim: set ts=8 sw=4 et :
119#endif // SRECORD_INPUT_GENERATOR_REPEAT_H
srecord::input_generator_repeat::create
static pointer create(const interval &range, unsigned char *data, size_t length)
The create class method is used to create new dynamically allocated instances of this class.
srecord::input_generator_repeat::filename
std::string filename() const
The filename method is used to get the name of the input file being processed.
srecord::input_generator_repeat::~input_generator_repeat
virtual ~input_generator_repeat()
The destructor.
srecord::input_generator_repeat::get_file_format_name
const char * get_file_format_name() const
The get_file_format_name method is used to find out the name of the file format being read.
srecord::input_generator_repeat::generate_data
unsigned char generate_data(unsigned long address)
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::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
generator.h
srecord
Definition adler16.h:25