srecord: output/file/coe.h Source File

srecord 1.65.0

Loading...
Searching...
No Matches
coe.h
Go to the documentation of this file.
1//
2// srecord - Manipulate EPROM load files
3// Copyright (C) 2012 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 (at
8// 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 GNU
13// 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 <http://www.gnu.org/licenses/>.
17//
18
19#ifndef SRECORD_OUTPUT_FILE_COE_H
20#define SRECORD_OUTPUT_FILE_COE_H
21
22#include <srecord/output/file.h>
23
24namespace srecord
25{
26
27/**
28 * The srecord::output_file_coe class is used to represent the output state
29 * of a file in Coefficient File Format (Xilinx).
30 */
31 class output_file_coe:
32 public output_file
33{
34public:
35 /**
36 * The destructor.
37 */
38 virtual ~output_file_coe();
39
40private:
41 /**
42 * The constructor. It is private on purpose, use the #create
43 * class method instead.
44 *
45 * @param file_name
46 * The name of the file to be written. The special name "-"
47 * indicates the standard output is to be used.
48 */
49 output_file_coe(const std::string &file_name);
50
51public:
52 /**
53 * The create class method is used to create new dynamically
54 * allocated instances of this class.
55 *
56 * @param file_name
57 * The name of the file to be written.
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
69 void address_length_set(int);
70
71 // See base class for documentation
72 int preferred_block_size_get(void) const;
73
74 // See base class for documentation.
75 bool preferred_block_size_set(int nbytes);
76
77 // See base class for documentation
78 void command_line(arglex_tool *cmdln);
79
80 // See base class for documentation.
81 const char *format_name(void) const;
82
83 // See base class for documentation.
84 void notify_upper_bound(unsigned long addr);
85
86private:
87 /**
88 * The address instance variable is used to remember the next
89 * memory address to be written. This is also used to detect holes
90 * in the input data.
91 */
92 unsigned long address;
93
94 /**
95 * The column instance variable i sused to remember the output text
96 * column. This is used to know when ti wrap lines.
97 */
98 int column;
99
100 /**
101 * The depth instance variable is used to remember how many bytes
102 * of data there is. Kind of broken, because we don't know this
103 * when the header is actually printed.
104 */
105 unsigned long depth;
106
107 /**
108 * The width instance variable is used to remember how many bits
109 * there are per data item. Default to 8 (traditional bytes).
110 */
111 unsigned width;
112
113 /**
114 * The width_in_bytes instance variable is used to remember how
115 * many bytes there are per data item. Defaults to 1.
116 */
117 unsigned width_in_bytes;
118
119 /**
120 * The actual_depth instance variable is used to remember how many
121 * bytes of data there were. This is printed in the footer.
122 */
123 unsigned long actual_depth;
124
125 /**
126 * The header_done instance variable is used to remember whether
127 * the emit_header method has already been called.
128 */
129 bool header_done;
130
131 /**
132 * The pref_blk_sz instance variable is used to remember the
133 * preferred block size, in bytes.
134 */
135 int pref_blk_sz;
136
137 /**
138 * The emit_header method is used to emit the file header,
139 * if necessary.
140 */
141 void emit_header(void);
142
143 /**
144 * The GotData instance variable is used to remember whether or not
145 * some data has been seen so far. This is used to separate values
146 * with commas, but to suppress the first comma before the first
147 * data.
148 */
149 bool got_data;
150
151 /**
152 * The default constructor. Do not use.
153 */
154 output_file_coe();
155
156 /**
157 * The copy constructor. Do not use.
158 */
159 output_file_coe(const output_file_coe &);
160
161 /**
162 * The assignment operator. Do not use.
163 */
164 output_file_coe &operator=(const output_file_coe &);
165};
166
167};
168
169// vim: set ts=8 sw=4 et :
170#endif // SRECORD_OUTPUT_FILE_COE_H
srecord::arglex_tool
The srecord::arglex_tool is used to parse command line with srec-specific arguments.
Definition tool.h:41
srecord::output_file_coe::create
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
srecord::output_file_coe::format_name
const char * format_name(void) const
The format_name method is used to obtain the name of this output format.
srecord::output_file_coe::line_length_set
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...
srecord::output_file_coe::preferred_block_size_set
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...
srecord::output_file_coe::address_length_set
void address_length_set(int)
The address_length_set method is used to set the minimum number of bytes to be written for addresses ...
srecord::output_file_coe::notify_upper_bound
void notify_upper_bound(unsigned long addr)
The notify_upper_bound method is used to notify the output class of the upper bound (highest address ...
srecord::output_file_coe::~output_file_coe
virtual ~output_file_coe()
The destructor.
srecord::output_file_coe::preferred_block_size_get
int preferred_block_size_get(void) const
The preferred_block_size_get method is used to get the proferred block size of the output fformat.
srecord::output_file_coe::write
void write(const record &)
The write method is used to write a recordonto an output.
srecord::output_file_coe::command_line
void command_line(arglex_tool *cmdln)
The command_line method is used by arglex_srec::get_output when parsing the command line,...
srecord::output_file::output_file
output_file()
The default constructor.
srecord::output::pointer
std::shared_ptr< output > pointer
Definition output.h:41
srecord::record
The srecord::record class is used to represent a data record read from a file.
Definition record.h:35
srecord
Definition adler16.h:25
file.h