srecord 1.65.0
 
Loading...
Searching...
No Matches
formatted_binary.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 2003, 2006-2008, 2010, 2011 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_FORMATTED_BINARY_H
21#define SRECORD_OUTPUT_FILE_FORMATTED_BINARY_H
22
23#include <srecord/output/file.h>
24
25namespace srecord
26{
27
28/**
29 * The srecord::output_file_formatted_binary class is used to represent
30 * the current state when writing a file in the Formatted Binary format.
31 */
32class output_file_formatted_binary:
33 public output_file
34{
35public:
36 /**
37 * The destructor.
38 */
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.
48 */
49 output_file_formatted_binary(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 name of the file to be written.
58 */
59 static pointer create(const std::string &file_name);
60
61protected:
62 // See base class for documentation.
63 void notify_upper_bound(long unsigned);
64
65 // See base class for documentation.
66 void write(const record &);
67
68 // See base class for documentation.
69 void line_length_set(int);
70
71 // See base class for documentation.
73
74 // See base class for documentation.
76
77 // See base class for documentation.
78 bool preferred_block_size_set(int nbytes);
79
80 // See base class for documentation.
81 const char *format_name() const;
82
83 // See base class for documentation.
84 bool is_binary(void) const;
85
86private:
87 /**
88 * The upper_bound instance variable is used to remember the upper
89 * bound of memory addresses (maximum address plus one).
90 */
91 unsigned long upper_bound;
92
93 /**
94 * The address instance variable is used to remember the current
95 * output address, to know if padding is required.
96 */
97 unsigned long address;
98
99 /**
100 * The check_sum instance variable is used to remember the running
101 * sum of data baytes written to date.
102 */
103 unsigned short check_sum;
104
105 /**
106 * The default constructor. Do not use.
107 */
108 output_file_formatted_binary();
109
110 /**
111 * The copy constructor. Do not use.
112 */
113 output_file_formatted_binary(const output_file_formatted_binary &);
114
115 /**
116 * The assignment operator. Do not use.
117 */
118 output_file_formatted_binary &operator=(
119 const output_file_formatted_binary &);
120};
121
122};
123
124#endif // SRECORD_OUTPUT_FILE_FORMATTED_BINARY_H
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...
int preferred_block_size_get() const
The preferred_block_size_get method is used to get the proferred block size of the output fformat.
void notify_upper_bound(long unsigned)
const char * format_name() const
The format_name method is used to obtain the name of this output format.
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 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.
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...
virtual ~output_file_formatted_binary()
The destructor.
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