srecord 1.65.0
 
Loading...
Searching...
No Matches
ascii_hex.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 2000-2003, 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_OUTPUT_FILE_ASCII_HEX_H
21#define SRECORD_OUTPUT_FILE_ASCII_HEX_H
22
23#include <srecord/output/file.h>
24
25namespace srecord
26{
27
28/**
29 * The srecord::output_file_ascii_hex class is used to write a file in
30 * Ascii-Hex-Space format.
31 */
32class output_file_ascii_hex:
33 public output_file
34{
35public:
36 /**
37 * The destrutcor.
38 */
40
41private:
42 /**
43 * The constructor.
44 *
45 * @param file_name
46 * The name of the file to be written.
47 */
48 output_file_ascii_hex(const std::string &file_name);
49
50public:
51 /**
52 * The create class method is used to create new dynamically
53 * allocated instances of this class.
54 *
55 * @param file_name
56 * The file name to open to write data to. The name "-" is
57 * understood to mean the standard output.
58 */
59 static pointer create(const std::string &file_name);
60
61protected:
62 // See base class for documentation.
63 void write(const record &);
64
65 // See base class for documentation.
66 void line_length_set(int);
67
68 // See base class for documentation.
70
71 // See base class for documentation.
73
74 // See base class for documentation.
75 bool preferred_block_size_set(int nbytes);
76
77 // See base class for documentation.
78 const char *format_name() const;
79
80private:
81 /**
82 * The address instance variable is used to remember where we are
83 * up to in the output. Used to limit the number of $A line emitted.
84 */
85 unsigned long address;
86
87 /**
88 * The column instance variable is used to remember which column
89 * we are up to in the output. Used to limit the length of lines
90 * in the output.
91 */
92 int column;
93
94 /**
95 * The pref_block_size instance variable is used to remember the
96 * number of bytes in the preferred block size.
97 */
98 int pref_block_size;
99
100 /**
101 * The line_length instance variable is used to remember the
102 * maximum length of text lines.
103 */
104 int line_length;
105
106 /**
107 * The address_length instance variable is used to remember
108 * how many bytes of addresses are are to emit.
109 */
110 int address_length;
111
112 /**
113 * The start_code_emitted instance variable is used to remember
114 * whether or not the start code (Ctrl-B) has been emitted.
115 */
116 bool start_code_emitted;
117
118 /**
119 * The end_code_emitted instance variable is used to remember
120 * whether or not the end code (Ctrl-C) has been emitted.
121 */
122 bool end_code_emitted;
123
124 /**
125 * The emit_end_of_file method is used to write the ETX and
126 * checksum out to the file. It is safe top call this method more
127 * than once, only one ETX will be written.
128 */
129 void emit_end_of_file();
130
131 /**
132 * The default constructor. Do not use.
133 */
134 output_file_ascii_hex();
135
136 /**
137 * The copy constructor. Do not use.
138 */
139 output_file_ascii_hex(const output_file_ascii_hex &);
140
141 /**
142 * The assignment operator. Do not use.
143 */
144 output_file_ascii_hex &operator=(const output_file_ascii_hex &);
145};
146
147};
148
149#endif // SRECORD_OUTPUT_FILE_ASCII_HEX_H
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.
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_ascii_hex()
The destrutcor.
const char * format_name() const
The format_name method is used to obtain the name of this output format.
void address_length_set(int)
The address_length_set method is used to set the minimum number of bytes to be written for addresses ...
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...
int preferred_block_size_get() const
The preferred_block_size_get method is used to get the proferred block size of the output fformat.
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