srecord 1.65.0
 
Loading...
Searching...
No Matches
basic.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 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_BASIC_H
21#define SRECORD_OUTPUT_FILE_BASIC_H
22
23#include <srecord/output/file.h>
24#include <srecord/interval.h>
25
26namespace srecord
27{
28
29/**
30 * The srecord::output_file_basic class is used to emit record in BASIc
31 * format, using DATA statements.
32 */
33class output_file_basic:
34 public output_file
35{
36public:
37 /**
38 * The destructor.
39 */
41
42private:
43 /**
44 * The constructor.
45 *
46 * @param file_name
47 * The name of the file to be written.
48 */
49 output_file_basic(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 file name to open to write data to. The name "-" is
58 * understood to mean the standard output.
59 */
60 static pointer create(const std::string &file_name);
61
62protected:
63 // See base class for docum,entation.
64 void write(const record &);
65
66 // See base class for docum,entation.
67 void line_length_set(int);
68
69 // See base class for docum,entation.
71
72 // See base class for docum,entation.
74
75 // See base class for documentation.
76 bool preferred_block_size_set(int nbytes);
77
78 // See base class for documentation.
79 const char *format_name() const;
80
81private:
82 /**
83 * The taddr instance variabel is used to remember the
84 * termination address, to be emitted in the footer.
85 */
86 unsigned long taddr;
87
88 /**
89 * The range instance variable is used to remember the range
90 * of addresses present in the output.
91 */
92 interval range;
93
94 /**
95 * The column instance variable is used to remember the current
96 * printing column on the line.
97 */
98 int column;
99
100 /**
101 * The current_address instance variabel is used to remember
102 * the current address that the file is positioned at. This is
103 * used to know whether we need to add padding.
104 */
105 unsigned long current_address;
106
107 /**
108 * The line_length instance variable is used to remember the
109 * maximum line length. The output usually does not exceed it.
110 */
111 int line_length;
112
113 /**
114 * The emit_byte method is used to emit a single byte. It uses
115 * column to track the position, so as not to exceed line_length.
116 */
117 void emit_byte(int);
118
119 /**
120 * The default constructor. Do not use.
121 */
122 output_file_basic();
123
124 /**
125 * The copy constructor. Do not use.
126 */
127 output_file_basic(const output_file_basic &);
128
129 /**
130 * The assignment operator. Do not use.
131 */
132 output_file_basic &operator=(const output_file_basic &);
133};
134
135};
136
137#endif // SRECORD_OUTPUT_FILE_BASIC_H
The interval class is used to represent a set of integer values, usually composed of runs of adjacent...
Definition interval.h:36
virtual ~output_file_basic()
The destructor.
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...
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.
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...
void address_length_set(int)
The address_length_set method is used to set the minimum number of bytes to be written for addresses ...
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.
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