srecord 1.65.0
 
Loading...
Searching...
No Matches
aomf.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 2004, 2006-2008, 2010-2013 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 Lesser General Public
13// 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 <http://www.gnu.org/licenses/>.
17//
18
19#ifndef SRECORD_INPUT_FILE_AOMF_H
20#define SRECORD_INPUT_FILE_AOMF_H
21
22#include <srecord/input/file.h>
23
24namespace srecord {
25
26/**
27 * The srecord::input_file_aomf class is used to parse Intel Absolute Object
28 * Module Format (AOMF) file.
29 */
30class input_file_aomf:
31 public input_file
32{
33public:
34 /**
35 * The destructor.
36 */
38
39private:
40 /**
41 * The constructor. The input is read from the named file (or
42 * the standard input if the file name is "-"). It is private on
43 * purpose, use the "create" class method instead.
44 *
45 * @param file_name
46 * The name of the file to be read.
47 */
48 input_file_aomf(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 name of the file to be read.
57 * @returns
58 * smart pointer to new instance
59 */
60 static pointer create(const std::string &file_name);
61
62protected:
63 // See base class for documentation.
65
66 // See base class for documentation.
67 const char *get_file_format_name(void) const;
68
69 // See base class for documentation.
70 bool is_binary(void) const;
71
72 // See base class for documentation.
73 int format_option_number(void) const;
74
75private:
76 /**
77 * The get_byte method is used to fetch a byte of input, and
78 * update the checksum. We over-ride the base implementation,
79 * because we use raw bytes rather than two hex digits.
80 */
81 int get_byte(void);
82
83 /**
84 * The current_buffer instance variable is used to remember the
85 * base of an array which buffers the current input record.
86 */
87 unsigned char *current_buffer;
88
89 /**
90 * The current_length instance variable is used to remember
91 * the length of the current record. It is zero if there is no
92 * "current" record.
93 */
94 size_t current_length;
95
96 /**
97 * The current_maximum instance variable is used to remember the
98 * length of the current_buffer array. It is zero if there is no
99 * "current" buffer.
100 */
101 size_t current_maximum;
102
103 /**
104 * The current_pos instance variable is used to remember the
105 * position within the current_buffer array.
106 */
107 size_t current_pos;
108
109 /**
110 * The current_address instance variable is used to track the
111 * load address of the current record. It is updated each time
112 * we return a partial block, so that we alsoways return the
113 * correct load address.
114 */
115 unsigned long current_address;
116
117 enum state_t
118 {
119 expecting_header,
120 expecting_data,
121 expecting_eof
122 };
123
124 /**
125 * The state instance variable is used to remember what to expect
126 * next from the file.
127 */
128 state_t state;
129
130 /**
131 * The slurp method is used to fill the current_buffer array,
132 * and set the current_length.
133 */
134 int slurp(void);
135
136 /**
137 * The copy constructor. Do not use.
138 */
140
141 /**
142 * The assignment operator. Do not use.
143 */
144 input_file_aomf &operator=(const input_file_aomf &);
145};
146
147};
148
149// vim: set ts=8 sw=4 et :
150#endif // SRECORD_INPUT_FILE_AOMF_H
The srecord::input_file_aomf class is used to parse Intel Absolute Object Module Format (AOMF) file.
Definition aomf.h:32
bool read(record &record)
The read method is used to read one record from the input.
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...
const char * get_file_format_name(void) const
The get_file_format_name method is used to find out the name of the file format being read.
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
virtual ~input_file_aomf()
The destructor.
int format_option_number(void) const
The format_option_number method is used to obtain the option number, which can then be turned into te...
input_file(const std::string &file_name)
The constructor.
std::shared_ptr< input_file > pointer
Definition file.h:39
The srecord::record class is used to represent a data record read from a file.
Definition record.h:35