srecord: output/file/cosmac.h Source File

srecord 1.65.0

Loading...
Searching...
No Matches
cosmac.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_COSMAC_H
21#define SRECORD_OUTPUT_FILE_COSMAC_H
22
23#include <srecord/output/file.h>
24
25namespace srecord
26{
27
28/**
29 * The srecord::output_file_cosmac class is used to represent an output
30 * which emits RCA Cosmac format.
31 */
32 class output_file_cosmac:
33 public output_file
34{
35public:
36 /**
37 * The destructor.
38 */
39 virtual ~output_file_cosmac();
40
41private:
42 /**
43 * The constructor.
44 *
45 * @param file_name
46 * The name of the file to be written.
47 */
48 output_file_cosmac(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.
69 void address_length_set(int);
70
71 // See base class for documentation.
72 int preferred_block_size_get() const;
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 the current
83 * output address, so that file size can be optimized.
84 */
85 unsigned long address;
86
87 /**
88 * The address_length is used to remember the preferred number of
89 * characters used to represent an address in the output file.
90 * Defaults to 4 characters.
91 */
92 unsigned address_length;
93
94 /**
95 * The line_length instance variable is used to remember the maximum
96 * line length of the output. Defaults to 80 characters.
97 */
98 unsigned line_length;
99
100 /**
101 * The column instance variable is used to remember which output
102 * column the current output position is on.
103 */
104 unsigned column;
105
106 /**
107 * The header_required instance variable is used to remember whether
108 * or not the header (the !M command) has been issued, or not.
109 */
110 bool header_required;
111
112 /**
113 * The default constructor. Do not use.
114 */
115 output_file_cosmac();
116
117 /**
118 * The copy constructor. Do not use.
119 */
120 output_file_cosmac(const output_file_cosmac &);
121
122 /**
123 * The assignment operator. Do not use.
124 */
125 output_file_cosmac &operator=(const output_file_cosmac &);
126};
127
128};
129
130#endif // SRECORD_OUTPUT_FILE_COSMAC_H
srecord::output_file_cosmac::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_cosmac::write
void write(const record &)
The write method is used to write a recordonto an output.
srecord::output_file_cosmac::~output_file_cosmac
virtual ~output_file_cosmac()
The destructor.
srecord::output_file_cosmac::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_cosmac::format_name
const char * format_name() const
The format_name method is used to obtain the name of this output format.
srecord::output_file_cosmac::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_cosmac::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_cosmac::preferred_block_size_get
int preferred_block_size_get() const
The preferred_block_size_get method is used to get the proferred block size of the output fformat.
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