srecord 1.65.0
 
Loading...
Searching...
No Matches
ppx.h
Go to the documentation of this file.
1//
2// srecord - Manipulate EPROM load files
3// Copyright (C) 2011 Peter Miller
4//
5// This program is free software; you can redistribute it and/or modify it
6// 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 your
8// option) any later version.
9//
10// This program is distributed in the hope that it will be useful, but WITHOUT
11// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13// 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_PPX_H
20#define SRECORD_OUTPUT_FILE_PPX_H
21
22#include <srecord/output/file.h>
23
24namespace srecord {
25
26/**
27 * The output_file_ppx class is used to represent the processing
28 * required to write a file in PPX or Stag Hex format.
29 */
30class output_file_ppx:
31 public output_file
32{
33public:
34 /**
35 * The destructor.
36 */
38
39 /**
40 * The create class method is used to create new dynamically
41 * allocated instances of this class.
42 *
43 * @param file_name
44 * The name of the file to be written.
45 */
46 static pointer create(const std::string &file_name);
47
48protected:
49 // See base class for documentation.
50 void write(const record &);
51
52 // See base class for documentation.
53 void line_length_set(int);
54
55 // See base class for documentation.
57
58 // See base class for documentation.
59 int preferred_block_size_get(void) const;
60
61 // See base class for documentation.
62 bool preferred_block_size_set(int nbytes);
63
64 // See base class for documentation.
65 const char *format_name(void) const;
66
67private:
68 /**
69 * The constructor. It is private on purpose, use the #create
70 * class method instead.
71 *
72 * @param file_name
73 * The name of the file to be written. The special name "-"
74 * indicates the standard output is to be used.
75 */
76 output_file_ppx(const std::string &file_name);
77
78 /**
79 * The started instance variable is used to remember whether or not
80 * we have emitted the start sequence.
81 */
82 bool started;
83
84 /**
85 * The address instance variable is used to remember the address of
86 * the next data byte to be parsed.
87 */
88 unsigned long address;
89
90 /**
91 * The line_length instance variable is used to remember how long
92 * the output lines are to be.
93 */
94 int line_length;
95
96 /**
97 * The column instance variable is used to remember the current
98 * output column. Used for determining when to start a new line.
99 */
100 int column;
101
102 /**
103 * The dsum instance variable is used to remember the simple sum of
104 * all the data bytes, but not the address bytes.
105 */
106 unsigned short dsum;
107
108 /**
109 * The default constructor. Do not use.
110 */
111 output_file_ppx();
112
113 /**
114 * The copy constructor. Do not use.
115 */
116 output_file_ppx(const output_file_ppx &);
117
118 /**
119 * The assignment operator. Do not use.
120 */
121 output_file_ppx &operator=(const output_file_ppx &);
122};
123
124};
125
126// vim: set ts=8 sw=4 et :
127#endif // SRECORD_OUTPUT_FILE_PPX_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 ...
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
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...
virtual ~output_file_ppx()
The destructor.
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.
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(void) 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.
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