srecord 1.65.0
 
Loading...
Searching...
No Matches
dec_binary.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 2001, 2002, 2005-2008, 2010-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
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_DEC_BINARY_H
21#define SRECORD_OUTPUT_FILE_DEC_BINARY_H
22
23#include <srecord/output/file.h>
24
25namespace srecord
26{
27
28/**
29 * The srecord::output_file_dec_binary class is used to write a DEC Binary
30 * (XXDP) formatted file.
31 */
32class output_file_dec_binary:
33 public output_file
34{
35public:
36 /**
37 * The destructor.
38 */
40
41private:
42 /**
43 * A constructor. The input will be read from the named file (or
44 * the standard input if the file name is "-"). It is private on
45 * purpose, use the create class method intead.
46 *
47 * @param file_name
48 * The name of the file to be written.
49 */
50 output_file_dec_binary(const std::string &file_name);
51
52public:
53 /**
54 * The create class method is used to create new dynamically
55 * allocated instances of this class. The input will be read from
56 * the named file (or the standard input if the file name is "-").
57 *
58 * @param file_name
59 * The name of the file to be written.
60 */
61 static pointer create(const std::string &file_name);
62
63protected:
64 // See base class for documentation.
65 void write(const record &);
66
67 // See base class for documentation.
69
70 // See base class for documentation.
71 bool preferred_block_size_set(int nbytes);
72
73 // See base class for documentation.
74 void line_length_set(int);
75
76 // See base class for documentation.
78
79 // See base class for documentation.
80 const char *format_name() const;
81
82 // See base class for documentation.
83 bool is_binary(void) const;
84
85private:
86 /**
87 * See base class for documentation. We are over-riding it because
88 * we use raw binary, so we call the put_char() method. This
89 * method also tracks the byte_offset, so that we can align to
90 * specific boundaries. Calls the checksum_add() method.
91 */
92 void put_byte(unsigned char);
93
94 /**
95 * The byte_offset instance variable is used to track the location
96 * in the output file. Maintained by the put_byte() method.
97 */
98 unsigned long byte_offset;
99
100 /**
101 * The pref_block_size is used to remember the preferred
102 * block size. Set by the constructor. Read by the
103 * preferred_block_size_get() method.
104 */
105 int pref_block_size;
106
107 /**
108 * The preferred_block_size_calculate method is used to determine
109 * the best block size to pack into 512 byte blocks.
110 */
111 static int preferred_block_size_calculate();
112
113 /**
114 * The default constructor. Do not use.
115 */
116 output_file_dec_binary();
117
118 /**
119 * The copy constructor. Do not use.
120 */
121 output_file_dec_binary(const output_file_dec_binary &);
122
123 /**
124 * The assignment operator. Do not use.
125 */
126 output_file_dec_binary &operator=(const output_file_dec_binary &);
127};
128
129};
130
131// vim: set ts=8 sw=4 et :
132#endif // SRECORD_OUTPUT_FILE_DEC_BINARY_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 ...
virtual ~output_file_dec_binary()
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.
int preferred_block_size_get() const
The preferred_block_size_get method is used to get the proferred block size of the output fformat.
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...
bool is_binary(void) const
The is_binary method is used to to determine whether or not a file format is binary (true) of text (f...
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.
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