srecord: output/file/four_packed_code.h Source File

srecord 1.65.0

Loading...
Searching...
No Matches
four_packed_code.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 2001, 2002, 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_FOUR_PACKED_CODE_H
21#define SRECORD_OUTPUT_FILE_FOUR_PACKED_CODE_H
22
23#include <srecord/output/file.h>
24
25namespace srecord
26{
27
28/**
29 * The srecord::output_file_four_packed_code class is used to emit files
30 * in the Four Packed Code (FPC) format.
31 */
32 class output_file_four_packed_code:
33 public output_file
34{
35public:
36 /**
37 * The destructor.
38 */
39 virtual ~output_file_four_packed_code();
40
41private:
42 /**
43 * The constructor. It is private on purpose, use the #create
44 * class method instead.
45 *
46 * @param file_name
47 * The name of the file to be written. The special name "-"
48 * indicates the standard output is to be used.
49 */
50 output_file_four_packed_code(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.
56 *
57 * @param file_name
58 * The name of the file to be written.
59 */
60 static pointer create(const std::string &file_name);
61
62protected:
63 // See base class for documentation.
64 void write(const record &);
65
66 // See base class for documentation.
67 void line_length_set(int);
68
69 // See base class for documentation.
70 void address_length_set(int);
71
72 // See base class for documentation.
73 int preferred_block_size_get() const;
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 pref_block_size instance variable is used to
84 * remember the preferred block size. Read by the the
85 * preferred_block_size_get method. Set by the line_length_set
86 * method.
87 */
88 int pref_block_size;
89
90 /**
91 * The put_byte_pos instance variable is used by the put_byte
92 * method to remember where we are positioned within each
93 * 4-byte chunk.
94 */
95 unsigned put_byte_pos;
96
97 /**
98 * The put_byte_value instance variable is used by the put_byte
99 * method to remember the cumulative value of each 4-byte chunk.
100 * At the end of 4 bytes, the 5-character base85 encoding
101 * is issued.
102 */
103 unsigned long put_byte_value;
104
105 /**
106 * The write_inner method is used by the write method to
107 * write a single line of output.
108 */
109 void write_inner(unsigned long address, const void *data,
110 int data_length);
111
112 /**
113 * See base class for documentation. We over-ride this method
114 * so that we can do the base85 encoding of each 4-byte chunk.
115 */
116 void put_byte(unsigned char);
117
118 /**
119 * The default constructor. Do not use.
120 */
121 output_file_four_packed_code();
122
123 /**
124 * The copy constructor. Do not use.
125 */
126 output_file_four_packed_code(const output_file_four_packed_code &);
127
128 /**
129 * The assignment operator. Do not use.
130 */
131 output_file_four_packed_code &operator=(
132 const output_file_four_packed_code &);
133};
134
135};
136
137#endif // SRECORD_OUTPUT_FILE_FOUR_PACKED_CODE_H
srecord::output_file_four_packed_code::write
void write(const record &)
The write method is used to write a recordonto an output.
srecord::output_file_four_packed_code::~output_file_four_packed_code
virtual ~output_file_four_packed_code()
The destructor.
srecord::output_file_four_packed_code::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_four_packed_code::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_four_packed_code::format_name
const char * format_name() const
The format_name method is used to obtain the name of this output format.
srecord::output_file_four_packed_code::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_four_packed_code::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_four_packed_code::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::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