srecord 1.65.0
 
Loading...
Searching...
No Matches
fastload.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 2001, 2005-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_OUTPUT_FILE_FASTLOAD_H
21#define SRECORD_OUTPUT_FILE_FASTLOAD_H
22
23#include <srecord/output/file.h>
24
25namespace srecord
26{
27
28/**
29 * The srecord::output_file_fastload class is used to write an LSI Logic
30 * Fast Load formatted file.
31 */
32class output_file_fastload:
33 public output_file
34{
35public:
36 /**
37 * The destructor.
38 */
40
41private:
42 /**
43 * A constructor. The output will be written to the named file (or
44 * the standard output if the file name is "-"). It is private on
45 * purpose, use the #create method instead.
46 *
47 * @param file_name
48 * The name of the file to be written.
49 */
50 output_file_fastload(const std::string &file_name);
51
52public:
53 /**
54 * The create class method is used to create new dynamically
55 * allocated instances of this class. The output will be written
56 * to the named file (or the standard output if the file name is
57 * "-").
58 *
59 * @param file_name
60 * The name of the file to be written.
61 */
62 static pointer create(const std::string &file_name);
63
64protected:
65 // See base class for documentation.
66 void write(const record &);
67
68 // See base class for documentation.
69 void line_length_set(int);
70
71 // See base class for documentation.
73
74 // See base class for documentation.
76
77 // See base class for documentation.
78 bool preferred_block_size_set(int nbytes);
79
80 // See base class for documentation.
81 const char *format_name() const;
82
83private:
84 /**
85 * The line_length instance variable is used to remember the
86 * preferred line length for the output.
87 */
88 int line_length;
89
90 /**
91 * The address instance variable is used to track the current
92 * address location within the file.
93 */
94 unsigned long address;
95
96 /**
97 * The column instance variable is used to track the current output
98 * column, to ensure that the lines don't exceed 80 characters.
99 */
100 int column;
101
102 /**
103 * The bytes_since_checksum instance variable is used to track how
104 * many bytes have ben emitted since the last checksum was issued.
105 * Don't leave it too long, or the checksum isn't any use.
106 */
107 int bytes_since_checksum;
108
109 /**
110 * The max_since_checksum instance variable is used to remember how
111 * many bytes to cover between issuing checksums. This is done in
112 * such a way as to minimize line length. There is no point going
113 * over 256 bytes, because it's a simple 16-bit additive sum.
114 */
115 int max_since_checksum;
116
117 /**
118 * The prev_was_command instance variable is used to track that was
119 * last output, bercase a newline must be thrown between commands
120 * and data, but not at any other time.
121 */
122 bool prev_was_command;
123
124 /**
125 * The write_inner method is used to write a single line (record)
126 * to the file. Use by the write() method.
127 */
128 void write_inner(int type, unsigned long addr, int addr_len,
129 const void *data, int data_len);
130
131 /**
132 * The put_number method is used to write the given value to the
133 * output in base-64 (big endian) notation.
134 */
135 void put_number(unsigned long value, int ndigits);
136
137 /**
138 * The put_command method is used to write a command to the file,
139 * including the leading '/' and the trailing newline.
140 */
141 void put_command(int c, unsigned long n, int ndigits);
142
143 /**
144 * The default constructor. Do not use.
145 */
146 output_file_fastload();
147
148 /**
149 * The copy constructor. Do not use.
150 */
151 output_file_fastload(const output_file_fastload &);
152
153 /**
154 * The assignment operator. Do not use.
155 */
156 output_file_fastload &operator=(const output_file_fastload &);
157};
158
159};
160
161#endif // SRECORD_OUTPUT_FILE_FASTLOAD_H
void address_length_set(int)
The address_length_set method is used to set the minimum number of bytes to be written for addresses ...
void line_length_set(int)
The set_line_length method is used to set the maximum length of an output line, for those formats for...
virtual ~output_file_fastload()
The destructor.
const char * format_name() const
The format_name method is used to obtain the name of this output format.
void write(const record &)
The write method is used to write a recordonto an output.
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
int preferred_block_size_get() const
The preferred_block_size_get method is used to get the proferred block size of the output fformat.
bool preferred_block_size_set(int nbytes)
The preferred_block_size_set method is is to set a precific number of bytes for the preferred block s...
output_file()
The default constructor.
std::shared_ptr< output > pointer
Definition output.h:41
The srecord::record class is used to represent a data record read from a file.
Definition record.h:35